diff options
| author | Juanma Barranquero <lekktu@gmail.com> | 2011-05-04 16:03:16 +0200 |
|---|---|---|
| committer | Juanma Barranquero <lekktu@gmail.com> | 2011-05-04 16:03:16 +0200 |
| commit | 0898ca10c0109274d24f91453036c065f9f5c056 (patch) | |
| tree | 32c087173edd460b860b5c3ec8298777a39b52ca /src/image.c | |
| parent | 67a2aecd40f802838d97f2aeb81f0a3698c68f62 (diff) | |
| download | emacs-0898ca10c0109274d24f91453036c065f9f5c056.tar.gz | |
Implement dynamic loading of GnuTLS on Windows.
* lisp/term/w32-win.el (dynamic-library-alist): Add `gnutls'.
* nt/INSTALL: Clarify GnuTLS support.
* src/callproc.c, src/emacs.c: Include lisp.h before src/w32.h, not after.
* src/gnutls.c (Qgnutls_dll): Define.
(DEF_GNUTLS_FN, LOAD_GNUTLS_FN): New macros.
(gnutls_*): Declare function pointers.
(init_gnutls_functions): New function to initialize function pointers.
(emacs_gnutls_handshake, Fgnutls_error_string, Fgnutls_deinit)
(emacs_gnutls_global_init, Fgnutls_bye): Use function pointers.
(emacs_gnutls_record_check_pending, emacs_gnutls_transport_set_errno):
Wrappers for gnutls_record_check_pending and gnutls_transport_set_errno.
(emacs_gnutls_write, emacs_gnutls_read)
(emacs_gnutls_handle_error, Fgnutls_error_fatalp)
(Fgnutls_available_p): New function.
(Fgnutls_boot): Call Fgnutls_available_p. Use function pointers.
(syms_of_gnutls) <Qgnutls_dll>: Initialize and staticpro it.
(syms_of_gnutls) <Sgnutls_available_p>: defsubr it.
* src/gnutls.h (GNUTLS_EMACS_ERROR_NOT_LOADED): New macro.
(emacs_gnutls_write, emacs_gnutls_read): Mark as extern.
(emacs_gnutls_record_check_pending, emacs_gnutls_transport_set_errno):
Declare.
* src/w32.c (QCloaded_from, Vlibrary_cache): Define.
(w32_delayed_load): Move from image.c. When loading a library, record
its filename in the :loaded-from property of the library id.
(globals_of_w32) <QCloaded_from, Vlibrary_cache>:
Initialize and staticpro them.
(emacs_gnutls_pull, emacs_gnutls_push): Call emacs_gnutls_* functions.
* src/image.c: Include w32.h.
(Vimage_type_cache): Delete.
(syms_of_image) <Vimage_type_cache>: Don't initialize and staticpro it.
(CACHE_IMAGE_TYPE, Finit_image_library): Use Vlibrary_cache instead.
(w32_delayed_load): Move to w32.c.
* src/process.c: Include lisp.h before src/w32.h, not after.
(wait_reading_process_output): Call emacs_gnutls_record_check_pending
instead of gnutls_record_check_pending.
* src/w32.h (VlibraryCache, QCloaded_from, w32_delayed_load): Declare.
Diffstat (limited to 'src/image.c')
| -rw-r--r-- | src/image.c | 41 |
1 files changed, 3 insertions, 38 deletions
diff --git a/src/image.c b/src/image.c index 6feeb75afd6..2377b41735d 100644 --- a/src/image.c +++ b/src/image.c @@ -67,6 +67,7 @@ typedef struct x_bitmap_record Bitmap_Record; #ifdef HAVE_NTGUI +#include "w32.h" #include "w32term.h" /* W32_TODO : Color tables on W32. */ @@ -556,10 +557,6 @@ x_create_bitmap_mask (struct frame *f, int id) static struct image_type *image_types; -/* Cache for delayed-loading image types. */ - -static Lisp_Object Vimage_type_cache; - /* The symbol `xbm' which is used as the type symbol for XBM images. */ static Lisp_Object Qxbm; @@ -589,7 +586,7 @@ static int x_build_heuristic_mask (struct frame *, struct image *, Lisp_Object); #define CACHE_IMAGE_TYPE(type, status) \ - do { Vimage_type_cache = Fcons (Fcons (type, status), Vimage_type_cache); } while (0) + do { Vlibrary_cache = Fcons (Fcons (type, status), Vlibrary_cache); } while (0) #define ADD_IMAGE_TYPE(type) \ do { Vimage_types = Fcons (type, Vimage_types); } while (0) @@ -1900,34 +1897,6 @@ mark_image_cache (struct image_cache *c) if (!fn_##func) return 0; \ } -/* Load a DLL implementing an image type. - The argument LIBRARIES is usually the variable - `dynamic-library-alist', which associates a symbol, identifying - an external DLL library, to a list of possible filenames. - The function returns NULL if no library could be loaded for - the given symbol, or if the library was previously loaded; - else the handle of the DLL. */ -static HMODULE -w32_delayed_load (Lisp_Object libraries, Lisp_Object type) -{ - HMODULE library = NULL; - - if (CONSP (libraries) && NILP (Fassq (type, Vimage_type_cache))) - { - Lisp_Object dlls = Fassq (type, libraries); - - if (CONSP (dlls)) - for (dlls = XCDR (dlls); CONSP (dlls); dlls = XCDR (dlls)) - { - CHECK_STRING_CAR (dlls); - if (library = LoadLibrary (SDATA (XCAR (dlls)))) - break; - } - } - - return library; -} - #endif /* HAVE_NTGUI */ static int x_create_x_image_and_pixmap (struct frame *, int, int, int, @@ -5452,7 +5421,6 @@ init_png_functions (Lisp_Object libraries) { HMODULE library; - /* Try loading libpng under probable names. */ if (!(library = w32_delayed_load (libraries, Qpng))) return 0; @@ -8634,7 +8602,7 @@ of `dynamic-library-alist', which see). */) Lisp_Object tested; /* Don't try to reload the library. */ - tested = Fassq (type, Vimage_type_cache); + tested = Fassq (type, Vlibrary_cache); if (CONSP (tested)) return XCDR (tested); @@ -8714,9 +8682,6 @@ as a ratio to the frame height and width. If the value is non-numeric, there is no explicit limit on the size of images. */); Vmax_image_size = make_float (MAX_IMAGE_SIZE); - Vimage_type_cache = Qnil; - staticpro (&Vimage_type_cache); - Qpbm = intern_c_string ("pbm"); staticpro (&Qpbm); ADD_IMAGE_TYPE (Qpbm); |
