diff options
| author | Chong Yidong | 2012-09-23 17:16:57 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-09-23 17:16:57 +0800 |
| commit | d07ff9db920196077333148f6db88525c8ba3151 (patch) | |
| tree | 728ab8cebaa9efbfaa79b6076374435727d47db2 | |
| parent | 4d7e6e51dd4acecff466a28d958c50f34fc130b8 (diff) | |
| download | emacs-d07ff9db920196077333148f6db88525c8ba3151.tar.gz emacs-d07ff9db920196077333148f6db88525c8ba3151.zip | |
Remove LIBRARIES arg from w32_delayed_load and friends.
These always use Vdynamic_library_alist anyway.
* src/image.c (Finit_image_library, lookup_image_type)
(define_image_type): Remove now-unneeded second arg.
(init_xpm_functions, init_png_functions, init_jpeg_functions)
(init_tiff_functions, init_gif_functions, init_svg_functions):
Arglist and w32_delayed_load calling convention changed.
(gs_type): Remove init_gs_functions; there is no such function.
* src/gnutls.c (init_gnutls_functions): Caller changed; remove arg.
(Fgnutls_available_p): Caller changed.
* src/xml.c (init_libxml2_functions, Flibxml_parse_html_region)
(Flibxml_parse_xml_region): Likewise.
* src/dispextern.h (struct image_type): Remove arg from init function.
* src/w32.c (w32_delayed_load): Remove LIBRARIES argument; always use
Vdynamic_library_alist.
* lisp/image.el (image-type-available-p): Change caller to
init-image-library.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/image.el | 2 | ||||
| -rw-r--r-- | src/ChangeLog | 20 | ||||
| -rw-r--r-- | src/dispextern.h | 2 | ||||
| -rw-r--r-- | src/gnutls.c | 6 | ||||
| -rw-r--r-- | src/image.c | 107 | ||||
| -rw-r--r-- | src/w32.c | 28 | ||||
| -rw-r--r-- | src/w32.h | 2 | ||||
| -rw-r--r-- | src/xml.c | 8 |
9 files changed, 92 insertions, 88 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 351b6ea6cb8..d0c1c50a6dd 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-09-23 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * image.el (image-type-available-p): Adapt to init-image-library | ||
| 4 | argument changes. | ||
| 5 | |||
| 1 | 2012-09-22 Juri Linkov <juri@jurta.org> | 6 | 2012-09-22 Juri Linkov <juri@jurta.org> |
| 2 | 7 | ||
| 3 | * dired.el (dired-mode-map): Add [remap read-only-mode] for | 8 | * dired.el (dired-mode-map): Add [remap read-only-mode] for |
diff --git a/lisp/image.el b/lisp/image.el index 99c0a74a512..72dc654757a 100644 --- a/lisp/image.el +++ b/lisp/image.el | |||
| @@ -346,7 +346,7 @@ Optional DATA-P non-nil means SOURCE is a string containing image data." | |||
| 346 | "Return non-nil if image type TYPE is available. | 346 | "Return non-nil if image type TYPE is available. |
| 347 | Image types are symbols like `xbm' or `jpeg'." | 347 | Image types are symbols like `xbm' or `jpeg'." |
| 348 | (and (fboundp 'init-image-library) | 348 | (and (fboundp 'init-image-library) |
| 349 | (init-image-library type dynamic-library-alist))) | 349 | (init-image-library type))) |
| 350 | 350 | ||
| 351 | 351 | ||
| 352 | ;;;###autoload | 352 | ;;;###autoload |
diff --git a/src/ChangeLog b/src/ChangeLog index 37c1ecf8824..d35092e277f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,23 @@ | |||
| 1 | 2012-09-23 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * w32.c (w32_delayed_load): Remove LIBRARIES argument; always use | ||
| 4 | Vdynamic_library_alist. | ||
| 5 | |||
| 6 | * gnutls.c (init_gnutls_functions): Caller changed; remove arg. | ||
| 7 | (Fgnutls_available_p): Caller changed. | ||
| 8 | |||
| 9 | * xml.c (init_libxml2_functions, Flibxml_parse_html_region) | ||
| 10 | (Flibxml_parse_xml_region): Likewise. | ||
| 11 | |||
| 12 | * dispextern.h (struct image_type): Remove arg from init function. | ||
| 13 | |||
| 14 | * image.c (Finit_image_library, lookup_image_type) | ||
| 15 | (define_image_type): Remove now-unneeded second arg. | ||
| 16 | (init_xpm_functions, init_png_functions, init_jpeg_functions) | ||
| 17 | (init_tiff_functions, init_gif_functions, init_svg_functions): | ||
| 18 | Arglist and w32_delayed_load calling convention changed. | ||
| 19 | (gs_type): Remove init_gs_functions; there is no such function. | ||
| 20 | |||
| 1 | 2012-09-23 Paul Eggert <eggert@cs.ucla.edu> | 21 | 2012-09-23 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 22 | ||
| 3 | Simplify and avoid signal-handling races (Bug#12471). | 23 | Simplify and avoid signal-handling races (Bug#12471). |
diff --git a/src/dispextern.h b/src/dispextern.h index 1faeeb19d5b..bb894520a4d 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -2769,7 +2769,7 @@ struct image_type | |||
| 2769 | 2769 | ||
| 2770 | /* Initialization function (used for dynamic loading of image | 2770 | /* Initialization function (used for dynamic loading of image |
| 2771 | libraries on Windows), or NULL if none. */ | 2771 | libraries on Windows), or NULL if none. */ |
| 2772 | int (* init) (Lisp_Object); | 2772 | int (* init) (void); |
| 2773 | 2773 | ||
| 2774 | /* Next in list of all supported image types. */ | 2774 | /* Next in list of all supported image types. */ |
| 2775 | struct image_type *next; | 2775 | struct image_type *next; |
diff --git a/src/gnutls.c b/src/gnutls.c index 1c4693aee32..cfe7d97aa59 100644 --- a/src/gnutls.c +++ b/src/gnutls.c | |||
| @@ -142,12 +142,12 @@ DEF_GNUTLS_FN (int, gnutls_x509_crt_import, | |||
| 142 | DEF_GNUTLS_FN (int, gnutls_x509_crt_init, (gnutls_x509_crt_t *)); | 142 | DEF_GNUTLS_FN (int, gnutls_x509_crt_init, (gnutls_x509_crt_t *)); |
| 143 | 143 | ||
| 144 | static int | 144 | static int |
| 145 | init_gnutls_functions (Lisp_Object libraries) | 145 | init_gnutls_functions (void) |
| 146 | { | 146 | { |
| 147 | HMODULE library; | 147 | HMODULE library; |
| 148 | int max_log_level = 1; | 148 | int max_log_level = 1; |
| 149 | 149 | ||
| 150 | if (!(library = w32_delayed_load (libraries, Qgnutls_dll))) | 150 | if (!(library = w32_delayed_load (Qgnutls_dll))) |
| 151 | { | 151 | { |
| 152 | GNUTLS_LOG (1, max_log_level, "GnuTLS library not found"); | 152 | GNUTLS_LOG (1, max_log_level, "GnuTLS library not found"); |
| 153 | return 0; | 153 | return 0; |
| @@ -656,7 +656,7 @@ DEFUN ("gnutls-available-p", Fgnutls_available_p, Sgnutls_available_p, 0, 0, 0, | |||
| 656 | else | 656 | else |
| 657 | { | 657 | { |
| 658 | Lisp_Object status; | 658 | Lisp_Object status; |
| 659 | status = init_gnutls_functions (Vdynamic_library_alist) ? Qt : Qnil; | 659 | status = init_gnutls_functions () ? Qt : Qnil; |
| 660 | Vlibrary_cache = Fcons (Fcons (Qgnutls_dll, status), Vlibrary_cache); | 660 | Vlibrary_cache = Fcons (Fcons (Qgnutls_dll, status), Vlibrary_cache); |
| 661 | return status; | 661 | return status; |
| 662 | } | 662 | } |
diff --git a/src/image.c b/src/image.c index a3717bf365e..7c74df5457f 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -579,15 +579,10 @@ static int x_build_heuristic_mask (struct frame *, struct image *, | |||
| 579 | do { Vimage_types = Fcons (type, Vimage_types); } while (0) | 579 | do { Vimage_types = Fcons (type, Vimage_types); } while (0) |
| 580 | 580 | ||
| 581 | /* Define a new image type from TYPE. This adds a copy of TYPE to | 581 | /* Define a new image type from TYPE. This adds a copy of TYPE to |
| 582 | image_types and caches the loading status of TYPE. | 582 | image_types and caches the loading status of TYPE. */ |
| 583 | |||
| 584 | LIBRARIES is an alist associating dynamic libraries to external | ||
| 585 | files implementing them, which is passed to the image library | ||
| 586 | initialization function if necessary. A nil value defaults to | ||
| 587 | Vdynamic_library_alist. */ | ||
| 588 | 583 | ||
| 589 | static struct image_type * | 584 | static struct image_type * |
| 590 | define_image_type (struct image_type *type, Lisp_Object libraries) | 585 | define_image_type (struct image_type *type) |
| 591 | { | 586 | { |
| 592 | struct image_type *p = NULL; | 587 | struct image_type *p = NULL; |
| 593 | Lisp_Object target_type = *type->type; | 588 | Lisp_Object target_type = *type->type; |
| @@ -609,7 +604,7 @@ define_image_type (struct image_type *type, Lisp_Object libraries) | |||
| 609 | else | 604 | else |
| 610 | #endif | 605 | #endif |
| 611 | { | 606 | { |
| 612 | type_valid = type->init (libraries); | 607 | type_valid = type->init (); |
| 613 | CACHE_IMAGE_TYPE (target_type, type_valid ? Qt : Qnil); | 608 | CACHE_IMAGE_TYPE (target_type, type_valid ? Qt : Qnil); |
| 614 | } | 609 | } |
| 615 | } | 610 | } |
| @@ -3053,7 +3048,7 @@ static const struct image_keyword xpm_format[XPM_LAST] = | |||
| 3053 | }; | 3048 | }; |
| 3054 | 3049 | ||
| 3055 | #ifdef HAVE_NTGUI | 3050 | #ifdef HAVE_NTGUI |
| 3056 | static int init_xpm_functions (Lisp_Object); | 3051 | static int init_xpm_functions (void); |
| 3057 | #else | 3052 | #else |
| 3058 | #define init_xpm_functions NULL | 3053 | #define init_xpm_functions NULL |
| 3059 | #endif | 3054 | #endif |
| @@ -3267,11 +3262,11 @@ DEF_IMGLIB_FN (int, XpmReadFileToImage, (Display *, char *, xpm_XImage **, | |||
| 3267 | DEF_IMGLIB_FN (void, XImageFree, (xpm_XImage *)); | 3262 | DEF_IMGLIB_FN (void, XImageFree, (xpm_XImage *)); |
| 3268 | 3263 | ||
| 3269 | static int | 3264 | static int |
| 3270 | init_xpm_functions (Lisp_Object libraries) | 3265 | init_xpm_functions (void) |
| 3271 | { | 3266 | { |
| 3272 | HMODULE library; | 3267 | HMODULE library; |
| 3273 | 3268 | ||
| 3274 | if (!(library = w32_delayed_load (libraries, Qxpm))) | 3269 | if (!(library = w32_delayed_load (Qxpm))) |
| 3275 | return 0; | 3270 | return 0; |
| 3276 | 3271 | ||
| 3277 | LOAD_IMGLIB_FN (library, XpmFreeAttributes); | 3272 | LOAD_IMGLIB_FN (library, XpmFreeAttributes); |
| @@ -5397,7 +5392,7 @@ static const struct image_keyword png_format[PNG_LAST] = | |||
| 5397 | }; | 5392 | }; |
| 5398 | 5393 | ||
| 5399 | #ifdef HAVE_NTGUI | 5394 | #ifdef HAVE_NTGUI |
| 5400 | static int init_png_functions (Lisp_Object); | 5395 | static int init_png_functions (void); |
| 5401 | #else | 5396 | #else |
| 5402 | #define init_png_functions NULL | 5397 | #define init_png_functions NULL |
| 5403 | #endif | 5398 | #endif |
| @@ -5469,11 +5464,11 @@ DEF_IMGLIB_FN (jmp_buf *, png_set_longjmp_fn, (png_structp, png_longjmp_ptr, siz | |||
| 5469 | #endif /* libpng version >= 1.5 */ | 5464 | #endif /* libpng version >= 1.5 */ |
| 5470 | 5465 | ||
| 5471 | static int | 5466 | static int |
| 5472 | init_png_functions (Lisp_Object libraries) | 5467 | init_png_functions (void) |
| 5473 | { | 5468 | { |
| 5474 | HMODULE library; | 5469 | HMODULE library; |
| 5475 | 5470 | ||
| 5476 | if (!(library = w32_delayed_load (libraries, Qpng))) | 5471 | if (!(library = w32_delayed_load (Qpng))) |
| 5477 | return 0; | 5472 | return 0; |
| 5478 | 5473 | ||
| 5479 | LOAD_IMGLIB_FN (library, png_get_io_ptr); | 5474 | LOAD_IMGLIB_FN (library, png_get_io_ptr); |
| @@ -6056,7 +6051,7 @@ static const struct image_keyword jpeg_format[JPEG_LAST] = | |||
| 6056 | }; | 6051 | }; |
| 6057 | 6052 | ||
| 6058 | #ifdef HAVE_NTGUI | 6053 | #ifdef HAVE_NTGUI |
| 6059 | static int init_jpeg_functions (Lisp_Object); | 6054 | static int init_jpeg_functions (void); |
| 6060 | #else | 6055 | #else |
| 6061 | #define init_jpeg_functions NULL | 6056 | #define init_jpeg_functions NULL |
| 6062 | #endif | 6057 | #endif |
| @@ -6125,11 +6120,11 @@ DEF_IMGLIB_FN (struct jpeg_error_mgr *, jpeg_std_error, (struct jpeg_error_mgr * | |||
| 6125 | DEF_IMGLIB_FN (boolean, jpeg_resync_to_restart, (j_decompress_ptr, int)); | 6120 | DEF_IMGLIB_FN (boolean, jpeg_resync_to_restart, (j_decompress_ptr, int)); |
| 6126 | 6121 | ||
| 6127 | static int | 6122 | static int |
| 6128 | init_jpeg_functions (Lisp_Object libraries) | 6123 | init_jpeg_functions (void) |
| 6129 | { | 6124 | { |
| 6130 | HMODULE library; | 6125 | HMODULE library; |
| 6131 | 6126 | ||
| 6132 | if (!(library = w32_delayed_load (libraries, Qjpeg))) | 6127 | if (!(library = w32_delayed_load (Qjpeg))) |
| 6133 | return 0; | 6128 | return 0; |
| 6134 | 6129 | ||
| 6135 | LOAD_IMGLIB_FN (library, jpeg_finish_decompress); | 6130 | LOAD_IMGLIB_FN (library, jpeg_finish_decompress); |
| @@ -6648,7 +6643,7 @@ static const struct image_keyword tiff_format[TIFF_LAST] = | |||
| 6648 | }; | 6643 | }; |
| 6649 | 6644 | ||
| 6650 | #ifdef HAVE_NTGUI | 6645 | #ifdef HAVE_NTGUI |
| 6651 | static int init_tiff_functions (Lisp_Object); | 6646 | static int init_tiff_functions (void); |
| 6652 | #else | 6647 | #else |
| 6653 | #define init_tiff_functions NULL | 6648 | #define init_tiff_functions NULL |
| 6654 | #endif | 6649 | #endif |
| @@ -6702,11 +6697,11 @@ DEF_IMGLIB_FN (void, TIFFClose, (TIFF *)); | |||
| 6702 | DEF_IMGLIB_FN (int, TIFFSetDirectory, (TIFF *, tdir_t)); | 6697 | DEF_IMGLIB_FN (int, TIFFSetDirectory, (TIFF *, tdir_t)); |
| 6703 | 6698 | ||
| 6704 | static int | 6699 | static int |
| 6705 | init_tiff_functions (Lisp_Object libraries) | 6700 | init_tiff_functions (void) |
| 6706 | { | 6701 | { |
| 6707 | HMODULE library; | 6702 | HMODULE library; |
| 6708 | 6703 | ||
| 6709 | if (!(library = w32_delayed_load (libraries, Qtiff))) | 6704 | if (!(library = w32_delayed_load (Qtiff))) |
| 6710 | return 0; | 6705 | return 0; |
| 6711 | 6706 | ||
| 6712 | LOAD_IMGLIB_FN (library, TIFFSetErrorHandler); | 6707 | LOAD_IMGLIB_FN (library, TIFFSetErrorHandler); |
| @@ -7103,7 +7098,7 @@ static const struct image_keyword gif_format[GIF_LAST] = | |||
| 7103 | }; | 7098 | }; |
| 7104 | 7099 | ||
| 7105 | #ifdef HAVE_NTGUI | 7100 | #ifdef HAVE_NTGUI |
| 7106 | static int init_gif_functions (Lisp_Object); | 7101 | static int init_gif_functions (void); |
| 7107 | #else | 7102 | #else |
| 7108 | #define init_gif_functions NULL | 7103 | #define init_gif_functions NULL |
| 7109 | #endif | 7104 | #endif |
| @@ -7175,11 +7170,11 @@ DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc)); | |||
| 7175 | DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *)); | 7170 | DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *)); |
| 7176 | 7171 | ||
| 7177 | static int | 7172 | static int |
| 7178 | init_gif_functions (Lisp_Object libraries) | 7173 | init_gif_functions (void) |
| 7179 | { | 7174 | { |
| 7180 | HMODULE library; | 7175 | HMODULE library; |
| 7181 | 7176 | ||
| 7182 | if (!(library = w32_delayed_load (libraries, Qgif))) | 7177 | if (!(library = w32_delayed_load (Qgif))) |
| 7183 | return 0; | 7178 | return 0; |
| 7184 | 7179 | ||
| 7185 | LOAD_IMGLIB_FN (library, DGifCloseFile); | 7180 | LOAD_IMGLIB_FN (library, DGifCloseFile); |
| @@ -7600,7 +7595,7 @@ static struct image_keyword imagemagick_format[IMAGEMAGICK_LAST] = | |||
| 7600 | }; | 7595 | }; |
| 7601 | 7596 | ||
| 7602 | #ifdef HAVE_NTGUI | 7597 | #ifdef HAVE_NTGUI |
| 7603 | static int init_imagemagick_functions (Lisp_Object); | 7598 | static int init_imagemagick_functions (void); |
| 7604 | #else | 7599 | #else |
| 7605 | #define init_imagemagick_functions NULL | 7600 | #define init_imagemagick_functions NULL |
| 7606 | #endif | 7601 | #endif |
| @@ -8154,7 +8149,7 @@ static const struct image_keyword svg_format[SVG_LAST] = | |||
| 8154 | }; | 8149 | }; |
| 8155 | 8150 | ||
| 8156 | #ifdef HAVE_NTGUI | 8151 | #ifdef HAVE_NTGUI |
| 8157 | static int init_svg_functions (Lisp_Object); | 8152 | static int init_svg_functions (void); |
| 8158 | #else | 8153 | #else |
| 8159 | #define init_svg_functions NULL | 8154 | #define init_svg_functions NULL |
| 8160 | #endif | 8155 | #endif |
| @@ -8218,14 +8213,14 @@ DEF_IMGLIB_FN (void, g_error_free); | |||
| 8218 | Lisp_Object Qgdk_pixbuf, Qglib, Qgobject; | 8213 | Lisp_Object Qgdk_pixbuf, Qglib, Qgobject; |
| 8219 | 8214 | ||
| 8220 | static int | 8215 | static int |
| 8221 | init_svg_functions (Lisp_Object libraries) | 8216 | init_svg_functions (void) |
| 8222 | { | 8217 | { |
| 8223 | HMODULE library, gdklib, glib, gobject; | 8218 | HMODULE library, gdklib, glib, gobject; |
| 8224 | 8219 | ||
| 8225 | if (!(glib = w32_delayed_load (libraries, Qglib)) | 8220 | if (!(glib = w32_delayed_load (Qglib)) |
| 8226 | || !(gobject = w32_delayed_load (libraries, Qgobject)) | 8221 | || !(gobject = w32_delayed_load (Qgobject)) |
| 8227 | || !(gdklib = w32_delayed_load (libraries, Qgdk_pixbuf)) | 8222 | || !(gdklib = w32_delayed_load (Qgdk_pixbuf)) |
| 8228 | || !(library = w32_delayed_load (libraries, Qsvg))) | 8223 | || !(library = w32_delayed_load (Qsvg))) |
| 8229 | return 0; | 8224 | return 0; |
| 8230 | 8225 | ||
| 8231 | LOAD_IMGLIB_FN (library, rsvg_handle_new); | 8226 | LOAD_IMGLIB_FN (library, rsvg_handle_new); |
| @@ -8549,12 +8544,6 @@ static const struct image_keyword gs_format[GS_LAST] = | |||
| 8549 | {":background", IMAGE_STRING_OR_NIL_VALUE, 0} | 8544 | {":background", IMAGE_STRING_OR_NIL_VALUE, 0} |
| 8550 | }; | 8545 | }; |
| 8551 | 8546 | ||
| 8552 | #ifdef HAVE_NTGUI | ||
| 8553 | static int init_gs_functions (Lisp_Object); | ||
| 8554 | #else | ||
| 8555 | #define init_gs_functions NULL | ||
| 8556 | #endif | ||
| 8557 | |||
| 8558 | /* Structure describing the image type `ghostscript'. */ | 8547 | /* Structure describing the image type `ghostscript'. */ |
| 8559 | 8548 | ||
| 8560 | static struct image_type gs_type = | 8549 | static struct image_type gs_type = |
| @@ -8563,7 +8552,7 @@ static struct image_type gs_type = | |||
| 8563 | gs_image_p, | 8552 | gs_image_p, |
| 8564 | gs_load, | 8553 | gs_load, |
| 8565 | gs_clear_image, | 8554 | gs_clear_image, |
| 8566 | init_gs_functions, | 8555 | NULL, |
| 8567 | NULL | 8556 | NULL |
| 8568 | }; | 8557 | }; |
| 8569 | 8558 | ||
| @@ -8826,77 +8815,69 @@ DEFUN ("lookup-image", Flookup_image, Slookup_image, 1, 1, 0, "") | |||
| 8826 | Initialization | 8815 | Initialization |
| 8827 | ***********************************************************************/ | 8816 | ***********************************************************************/ |
| 8828 | 8817 | ||
| 8829 | DEFUN ("init-image-library", Finit_image_library, Sinit_image_library, 2, 2, 0, | 8818 | DEFUN ("init-image-library", Finit_image_library, Sinit_image_library, 1, 1, 0, |
| 8830 | doc: /* Initialize image library implementing image type TYPE. | 8819 | doc: /* Initialize image library implementing image type TYPE. |
| 8831 | Return non-nil if TYPE is a supported image type. | 8820 | Return non-nil if TYPE is a supported image type. |
| 8832 | 8821 | ||
| 8833 | Image types pbm and xbm are prebuilt; other types are loaded here. | 8822 | If image libraries are loaded dynamically (currently only the case on |
| 8834 | Libraries to load are specified in alist LIBRARIES (usually, the value | 8823 | MS-Windows), load the library for TYPE if it is not yet loaded, using |
| 8835 | of `dynamic-library-alist', which see). */) | 8824 | the library file(s) specified by `dynamic-library-alist'. */) |
| 8836 | (Lisp_Object type, Lisp_Object libraries) | 8825 | (Lisp_Object type) |
| 8837 | { | 8826 | { |
| 8838 | return lookup_image_type (type, libraries) ? Qt : Qnil; | 8827 | return lookup_image_type (type) ? Qt : Qnil; |
| 8839 | } | 8828 | } |
| 8840 | 8829 | ||
| 8841 | /* Look up image type TYPE, and return a pointer to its image_type | 8830 | /* Look up image type TYPE, and return a pointer to its image_type |
| 8842 | structure. Return 0 if TYPE is not a known image type. | 8831 | structure. Return 0 if TYPE is not a known image type. */ |
| 8843 | |||
| 8844 | LIBRARIES is an alist associating dynamic libraries to external | ||
| 8845 | files implementing them, which is passed to the image library | ||
| 8846 | initialization function if necessary. A nil value defaults to | ||
| 8847 | Vdynamic_library_alist. */ | ||
| 8848 | 8832 | ||
| 8849 | static struct image_type * | 8833 | static struct image_type * |
| 8850 | lookup_image_type (Lisp_Object type, Lisp_Object libraries) | 8834 | lookup_image_type (Lisp_Object type) |
| 8851 | { | 8835 | { |
| 8852 | if (NILP (libraries)) | ||
| 8853 | libraries = Vdynamic_library_alist; | ||
| 8854 | |||
| 8855 | /* Types pbm and xbm are built-in and always available. */ | 8836 | /* Types pbm and xbm are built-in and always available. */ |
| 8856 | if (EQ (type, Qpbm)) | 8837 | if (EQ (type, Qpbm)) |
| 8857 | return define_image_type (&pbm_type, libraries); | 8838 | return define_image_type (&pbm_type); |
| 8858 | 8839 | ||
| 8859 | if (EQ (type, Qxbm)) | 8840 | if (EQ (type, Qxbm)) |
| 8860 | return define_image_type (&xbm_type, libraries); | 8841 | return define_image_type (&xbm_type); |
| 8861 | 8842 | ||
| 8862 | #if defined (HAVE_XPM) || defined (HAVE_NS) | 8843 | #if defined (HAVE_XPM) || defined (HAVE_NS) |
| 8863 | if (EQ (type, Qxpm)) | 8844 | if (EQ (type, Qxpm)) |
| 8864 | return define_image_type (&xpm_type, libraries); | 8845 | return define_image_type (&xpm_type); |
| 8865 | #endif | 8846 | #endif |
| 8866 | 8847 | ||
| 8867 | #if defined (HAVE_JPEG) || defined (HAVE_NS) | 8848 | #if defined (HAVE_JPEG) || defined (HAVE_NS) |
| 8868 | if (EQ (type, Qjpeg)) | 8849 | if (EQ (type, Qjpeg)) |
| 8869 | return define_image_type (&jpeg_type, libraries); | 8850 | return define_image_type (&jpeg_type); |
| 8870 | #endif | 8851 | #endif |
| 8871 | 8852 | ||
| 8872 | #if defined (HAVE_TIFF) || defined (HAVE_NS) | 8853 | #if defined (HAVE_TIFF) || defined (HAVE_NS) |
| 8873 | if (EQ (type, Qtiff)) | 8854 | if (EQ (type, Qtiff)) |
| 8874 | return define_image_type (&tiff_type, libraries); | 8855 | return define_image_type (&tiff_type); |
| 8875 | #endif | 8856 | #endif |
| 8876 | 8857 | ||
| 8877 | #if defined (HAVE_GIF) || defined (HAVE_NS) | 8858 | #if defined (HAVE_GIF) || defined (HAVE_NS) |
| 8878 | if (EQ (type, Qgif)) | 8859 | if (EQ (type, Qgif)) |
| 8879 | return define_image_type (&gif_type, libraries); | 8860 | return define_image_type (&gif_type); |
| 8880 | #endif | 8861 | #endif |
| 8881 | 8862 | ||
| 8882 | #if defined (HAVE_PNG) || defined (HAVE_NS) | 8863 | #if defined (HAVE_PNG) || defined (HAVE_NS) |
| 8883 | if (EQ (type, Qpng)) | 8864 | if (EQ (type, Qpng)) |
| 8884 | return define_image_type (&png_type, libraries); | 8865 | return define_image_type (&png_type); |
| 8885 | #endif | 8866 | #endif |
| 8886 | 8867 | ||
| 8887 | #if defined (HAVE_RSVG) | 8868 | #if defined (HAVE_RSVG) |
| 8888 | if (EQ (type, Qsvg)) | 8869 | if (EQ (type, Qsvg)) |
| 8889 | return define_image_type (&svg_type, libraries); | 8870 | return define_image_type (&svg_type); |
| 8890 | #endif | 8871 | #endif |
| 8891 | 8872 | ||
| 8892 | #if defined (HAVE_IMAGEMAGICK) | 8873 | #if defined (HAVE_IMAGEMAGICK) |
| 8893 | if (EQ (type, Qimagemagick)) | 8874 | if (EQ (type, Qimagemagick)) |
| 8894 | return define_image_type (&imagemagick_type, libraries); | 8875 | return define_image_type (&imagemagick_type); |
| 8895 | #endif | 8876 | #endif |
| 8896 | 8877 | ||
| 8897 | #ifdef HAVE_GHOSTSCRIPT | 8878 | #ifdef HAVE_GHOSTSCRIPT |
| 8898 | if (EQ (type, Qpostscript)) | 8879 | if (EQ (type, Qpostscript)) |
| 8899 | return define_image_type (&gs_type, libraries); | 8880 | return define_image_type (&gs_type); |
| 8900 | #endif | 8881 | #endif |
| 8901 | 8882 | ||
| 8902 | return NULL; | 8883 | return NULL; |
| @@ -6525,29 +6525,27 @@ sys_localtime (const time_t *t) | |||
| 6525 | 6525 | ||
| 6526 | Lisp_Object Vlibrary_cache; | 6526 | Lisp_Object Vlibrary_cache; |
| 6527 | 6527 | ||
| 6528 | /* The argument LIBRARIES is an alist that associates a symbol | 6528 | /* Try loading LIBRARY_ID from the file(s) specified in |
| 6529 | LIBRARY_ID, identifying an external DLL library known to Emacs, to | 6529 | Vdynamic_library_alist. If the library is loaded successfully, |
| 6530 | a list of filenames under which the library is usually found. In | 6530 | return the handle of the DLL, and record the filename in the |
| 6531 | most cases, the argument passed as LIBRARIES is the variable | 6531 | property :loaded-from of LIBRARY_ID. If the library could not be |
| 6532 | `dynamic-library-alist', which is initialized to a list of common | 6532 | found, or when it was already loaded (because the handle is not |
| 6533 | library names. If the function loads the library successfully, it | 6533 | recorded anywhere, and so is lost after use), return NULL. |
| 6534 | returns the handle of the DLL, and records the filename in the | 6534 | |
| 6535 | property :loaded-from of LIBRARY_ID; it returns NULL if the library | 6535 | We could also save the handle in :loaded-from, but currently |
| 6536 | could not be found, or when it was already loaded (because the | 6536 | there's no use case for it. */ |
| 6537 | handle is not recorded anywhere, and so is lost after use). It | ||
| 6538 | would be trivial to save the handle too in :loaded-from, but | ||
| 6539 | currently there's no use case for it. */ | ||
| 6540 | HMODULE | 6537 | HMODULE |
| 6541 | w32_delayed_load (Lisp_Object libraries, Lisp_Object library_id) | 6538 | w32_delayed_load (Lisp_Object library_id) |
| 6542 | { | 6539 | { |
| 6543 | HMODULE library_dll = NULL; | 6540 | HMODULE library_dll = NULL; |
| 6544 | 6541 | ||
| 6545 | CHECK_SYMBOL (library_id); | 6542 | CHECK_SYMBOL (library_id); |
| 6546 | 6543 | ||
| 6547 | if (CONSP (libraries) && NILP (Fassq (library_id, Vlibrary_cache))) | 6544 | if (CONSP (Vdynamic_library_alist) |
| 6545 | && NILP (Fassq (library_id, Vlibrary_cache))) | ||
| 6548 | { | 6546 | { |
| 6549 | Lisp_Object found = Qnil; | 6547 | Lisp_Object found = Qnil; |
| 6550 | Lisp_Object dlls = Fassq (library_id, libraries); | 6548 | Lisp_Object dlls = Fassq (library_id, Vdynamic_library_alist); |
| 6551 | 6549 | ||
| 6552 | if (CONSP (dlls)) | 6550 | if (CONSP (dlls)) |
| 6553 | for (dlls = XCDR (dlls); CONSP (dlls); dlls = XCDR (dlls)) | 6551 | for (dlls = XCDR (dlls); CONSP (dlls); dlls = XCDR (dlls)) |
| @@ -146,7 +146,7 @@ extern int _sys_read_ahead (int fd); | |||
| 146 | extern int _sys_wait_accept (int fd); | 146 | extern int _sys_wait_accept (int fd); |
| 147 | 147 | ||
| 148 | extern Lisp_Object Vlibrary_cache, QCloaded_from; | 148 | extern Lisp_Object Vlibrary_cache, QCloaded_from; |
| 149 | extern HMODULE w32_delayed_load (Lisp_Object, Lisp_Object); | 149 | extern HMODULE w32_delayed_load (Lisp_Object); |
| 150 | 150 | ||
| 151 | #ifdef HAVE_GNUTLS | 151 | #ifdef HAVE_GNUTLS |
| 152 | #include <gnutls/gnutls.h> | 152 | #include <gnutls/gnutls.h> |
| @@ -82,7 +82,7 @@ libxml2_loaded_p (void) | |||
| 82 | #endif /* !WINDOWSNT */ | 82 | #endif /* !WINDOWSNT */ |
| 83 | 83 | ||
| 84 | static int | 84 | static int |
| 85 | init_libxml2_functions (Lisp_Object libraries) | 85 | init_libxml2_functions (void) |
| 86 | { | 86 | { |
| 87 | #ifdef WINDOWSNT | 87 | #ifdef WINDOWSNT |
| 88 | if (libxml2_loaded_p ()) | 88 | if (libxml2_loaded_p ()) |
| @@ -91,7 +91,7 @@ init_libxml2_functions (Lisp_Object libraries) | |||
| 91 | { | 91 | { |
| 92 | HMODULE library; | 92 | HMODULE library; |
| 93 | 93 | ||
| 94 | if (!(library = w32_delayed_load (libraries, Qlibxml2_dll))) | 94 | if (!(library = w32_delayed_load (Qlibxml2_dll))) |
| 95 | { | 95 | { |
| 96 | message ("%s", "libxml2 library not found"); | 96 | message ("%s", "libxml2 library not found"); |
| 97 | return 0; | 97 | return 0; |
| @@ -257,7 +257,7 @@ DEFUN ("libxml-parse-html-region", Flibxml_parse_html_region, | |||
| 257 | If BASE-URL is non-nil, it is used to expand relative URLs. */) | 257 | If BASE-URL is non-nil, it is used to expand relative URLs. */) |
| 258 | (Lisp_Object start, Lisp_Object end, Lisp_Object base_url) | 258 | (Lisp_Object start, Lisp_Object end, Lisp_Object base_url) |
| 259 | { | 259 | { |
| 260 | if (init_libxml2_functions (Vdynamic_library_alist)) | 260 | if (init_libxml2_functions ()) |
| 261 | return parse_region (start, end, base_url, 1); | 261 | return parse_region (start, end, base_url, 1); |
| 262 | return Qnil; | 262 | return Qnil; |
| 263 | } | 263 | } |
| @@ -269,7 +269,7 @@ DEFUN ("libxml-parse-xml-region", Flibxml_parse_xml_region, | |||
| 269 | If BASE-URL is non-nil, it is used to expand relative URLs. */) | 269 | If BASE-URL is non-nil, it is used to expand relative URLs. */) |
| 270 | (Lisp_Object start, Lisp_Object end, Lisp_Object base_url) | 270 | (Lisp_Object start, Lisp_Object end, Lisp_Object base_url) |
| 271 | { | 271 | { |
| 272 | if (init_libxml2_functions (Vdynamic_library_alist)) | 272 | if (init_libxml2_functions ()) |
| 273 | return parse_region (start, end, base_url, 0); | 273 | return parse_region (start, end, base_url, 0); |
| 274 | return Qnil; | 274 | return Qnil; |
| 275 | } | 275 | } |