Mercurial > hg > xemacs-beta
comparison src/glyphs-x.c @ 231:557eaa0339bf r20-5b14
Import from CVS: tag r20-5b14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:13:48 +0200 |
parents | 12579d965149 |
children | f220cc83d72e |
comparison
equal
deleted
inserted
replaced
230:39ed1d2bdd9d | 231:557eaa0339bf |
---|---|
40 ImageMagick support | 40 ImageMagick support |
41 Convert images.el to C and stick it in here? | 41 Convert images.el to C and stick it in here? |
42 */ | 42 */ |
43 | 43 |
44 #include <config.h> | 44 #include <config.h> |
45 #include <setjmp.h> | |
45 #include "lisp.h" | 46 #include "lisp.h" |
46 | 47 |
47 #include "console-x.h" | 48 #include "console-x.h" |
48 #include "glyphs-x.h" | 49 #include "glyphs-x.h" |
49 #include "objects-x.h" | 50 #include "objects-x.h" |
1676 | 1677 |
1677 #ifdef HAVE_IMAGEMAGICK | 1678 #ifdef HAVE_IMAGEMAGICK |
1678 /********************************************************************** | 1679 /********************************************************************** |
1679 * ImageMagick * | 1680 * ImageMagick * |
1680 **********************************************************************/ | 1681 **********************************************************************/ |
1682 JMP_BUF imagick_jump; | |
1683 Lisp_Object imagick_err; /* slightly hackish way to return a proper error message */ | |
1684 | |
1681 static void | 1685 static void |
1682 imagick_validate (Lisp_Object instantiator) | 1686 imagick_validate (Lisp_Object instantiator) |
1683 { | 1687 { |
1684 file_or_data_must_be_present (instantiator); | 1688 file_or_data_must_be_present (instantiator); |
1689 } | |
1690 | |
1691 static void | |
1692 imagick_error_handler (const char *message,const char *qualifier) | |
1693 { | |
1694 /* ImageMagick defaults to exiting on errors, which is an anti-thing. | |
1695 * Dump the info into imagick_err, and jmp back */ | |
1696 if (qualifier != NULL) | |
1697 imagick_err = emacs_doprnt_string_c((CONST Bufbyte *) GETTEXT ("ImageMagick error: %s (%s)"), | |
1698 Qnil, -1, message, qualifier); | |
1699 else | |
1700 imagick_err = emacs_doprnt_string_c((CONST Bufbyte *) GETTEXT ("ImageMagick error: %s"), | |
1701 Qnil, -1, message); | |
1702 LONGJMP(imagick_jump,1); | |
1703 } | |
1704 | |
1705 static void | |
1706 imagick_warning_handler (const char *message,const char *qualifier) | |
1707 { | |
1708 if (qualifier != NULL) | |
1709 warn_when_safe(Qimagick, Qwarning, "ImageMagick warning: %s (%s)",message,qualifier); | |
1710 else | |
1711 warn_when_safe(Qimagick, Qwarning, "ImageMagick warning: %s",message); | |
1685 } | 1712 } |
1686 | 1713 |
1687 static Lisp_Object | 1714 static Lisp_Object |
1688 imagick_normalize (Lisp_Object inst, Lisp_Object console_type) | 1715 imagick_normalize (Lisp_Object inst, Lisp_Object console_type) |
1689 { | 1716 { |
1773 memset (&unwind, 0, sizeof (unwind)); | 1800 memset (&unwind, 0, sizeof (unwind)); |
1774 unwind.dpy = dpy; | 1801 unwind.dpy = dpy; |
1775 unwind.cmap = cmap; | 1802 unwind.cmap = cmap; |
1776 speccount = specpdl_depth(); | 1803 speccount = specpdl_depth(); |
1777 record_unwind_protect(imagick_instantiate_unwind,make_opaque_ptr(&unwind)); | 1804 record_unwind_protect(imagick_instantiate_unwind,make_opaque_ptr(&unwind)); |
1805 | |
1806 /* Set up error handlers */ | |
1807 if (SETJMP(imagick_jump)) | |
1808 { | |
1809 /* signal error GCPROs it's arguments */ | |
1810 signal_error(Qerror, list2(imagick_err, instantiator)); | |
1811 } | |
1812 | |
1813 SetErrorHandler(imagick_error_handler); | |
1814 SetWarningHandler(imagick_warning_handler); | |
1778 | 1815 |
1779 /* Write out to a temp file - not sure if ImageMagick supports the | 1816 /* Write out to a temp file - not sure if ImageMagick supports the |
1780 ** notion of an abstract 'data source' right now. | 1817 ** notion of an abstract 'data source' right now. |
1781 ** JH: It doesn't as of 3.9.3 | 1818 ** JH: It doesn't as of 3.9.3 |
1782 */ | 1819 */ |