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 /src/image.c | |
| 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.
Diffstat (limited to 'src/image.c')
| -rw-r--r-- | src/image.c | 107 |
1 files changed, 44 insertions, 63 deletions
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; |