Mercurial > hg > xemacs-beta
comparison src/glyphs.c @ 563:183866b06e0b
[xemacs-hg @ 2001-05-24 07:50:48 by ben]
Makefile.in.in, abbrev.c, alloc.c, buffer.c, bytecode.c, callint.c, callproc.c, casetab.c, chartab.c, cmdloop.c, cmds.c, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console.c, data.c, database.c, debug.c, device-gtk.c, device-msw.c, device-tty.c, device-x.c, device.c, dialog-gtk.c, dialog-msw.c, dialog-x.c, dialog.c, dired-msw.c, dired.c, doc.c, doprnt.c, dragdrop.c, editfns.c, eldap.c, eldap.h, elhash.c, emacs-widget-accessors.c, emacs.c, emodules.c, esd.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, extents.c, faces.c, file-coding.c, fileio.c, filelock.c, floatfns.c, fns.c, font-lock.c, frame-gtk.c, frame-x.c, frame.c, general-slots.h, glade.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-gtk.c, gui-x.c, gui.c, gutter.c, hpplay.c, indent.c, input-method-xlib.c, insdel.c, intl.c, keymap.c, libsst.c, libsst.h, linuxplay.c, lisp.h, lread.c, lstream.c, lstream.h, macros.c, marker.c, md5.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, miscplay.c, miscplay.h, mule-ccl.c, mule-charset.c, mule-wnnfns.c, mule.c, nas.c, ntplay.c, ntproc.c, objects-gtk.c, objects-msw.c, objects-x.c, objects.c, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, ralloc.c, rangetab.c, redisplay.c, scrollbar.c, search.c, select-gtk.c, select-x.c, select.c, sgiplay.c, sheap.c, sound.c, specifier.c, sunplay.c, symbols.c, symeval.h, symsinit.h, syntax.c, sysdep.c, toolbar-msw.c, toolbar.c, tooltalk.c, ui-byhand.c, ui-gtk.c, undo.c, unexaix.c, unexapollo.c, unexconvex.c, unexec.c, widget.c, win32.c, window.c:
-- defsymbol -> DEFSYMBOL.
-- add an error type to all errors.
-- eliminate the error functions in eval.c that let you just
use Qerror as the type.
-- redo the error API to be more consistent, sensibly named,
and easier to use.
-- redo the error hierarchy somewhat. create new errors:
structure-formation-error, gui-error, invalid-constant,
stack-overflow, out-of-memory, process-error, network-error,
sound-error, printing-unreadable-object, base64-conversion-
error; coding-system-error renamed to text-conversion error;
some others.
-- fix Mule problems in error strings in emodules.c, tooltalk.c.
-- fix error handling in mswin open-network-stream.
-- Mule-ize all sound files and clean up the headers.
-- nativesound.h -> sound.h and used for all sound files.
-- move some shared stuff into glyphs-shared.c: first attempt
at eliminating some of the massive GTK code duplication.
xemacs.mak: add glyphs-shared.c.
xemacs-faq.texi: document how to debug X errors
subr.el: fix doc string to reflect reality
author | ben |
---|---|
date | Thu, 24 May 2001 07:51:33 +0000 |
parents | 0784d089fdc9 |
children | 190b164ddcac |
comparison
equal
deleted
inserted
replaced
562:c775bd016b32 | 563:183866b06e0b |
---|---|
181 (DEVICE_CONSOLE (XDEVICE (device)))), d))) | 181 (DEVICE_CONSOLE (XDEVICE (device)))), d))) |
182 return Dynarr_at (the_image_instantiator_format_entry_dynarr, i).meths; | 182 return Dynarr_at (the_image_instantiator_format_entry_dynarr, i).meths; |
183 } | 183 } |
184 } | 184 } |
185 | 185 |
186 maybe_signal_simple_error ("Invalid image-instantiator format", format, | 186 maybe_invalid_argument ("Invalid image-instantiator format", format, |
187 Qimage, errb); | 187 Qimage, errb); |
188 | 188 |
189 return 0; | 189 return 0; |
190 } | 190 } |
191 | 191 |
313 if (!CONSP (mapping) || | 313 if (!CONSP (mapping) || |
314 !CONSP (XCDR (mapping)) || | 314 !CONSP (XCDR (mapping)) || |
315 (!NILP (XCDR (XCDR (mapping))) && | 315 (!NILP (XCDR (XCDR (mapping))) && |
316 (!CONSP (XCDR (XCDR (mapping))) || | 316 (!CONSP (XCDR (XCDR (mapping))) || |
317 !NILP (XCDR (XCDR (XCDR (mapping))))))) | 317 !NILP (XCDR (XCDR (XCDR (mapping))))))) |
318 signal_simple_error ("Invalid mapping form", mapping); | 318 invalid_argument ("Invalid mapping form", mapping); |
319 else | 319 else |
320 { | 320 { |
321 Lisp_Object exp = XCAR (mapping); | 321 Lisp_Object exp = XCAR (mapping); |
322 Lisp_Object typevec = XCAR (XCDR (mapping)); | 322 Lisp_Object typevec = XCAR (XCDR (mapping)); |
323 Lisp_Object pos = Qnil; | 323 Lisp_Object pos = Qnil; |
398 return typevec; | 398 return typevec; |
399 } | 399 } |
400 } | 400 } |
401 | 401 |
402 /* Oh well. */ | 402 /* Oh well. */ |
403 signal_simple_error ("Unable to interpret glyph instantiator", | 403 invalid_argument ("Unable to interpret glyph instantiator", |
404 data); | 404 data); |
405 | 405 |
406 return Qnil; | 406 return Qnil; |
407 } | 407 } |
408 | 408 |
482 Lisp_Object *elt; | 482 Lisp_Object *elt; |
483 int len; | 483 int len; |
484 | 484 |
485 CHECK_VECTOR (instantiator); | 485 CHECK_VECTOR (instantiator); |
486 if (!KEYWORDP (keyword)) | 486 if (!KEYWORDP (keyword)) |
487 signal_simple_error ("instantiator property must be a keyword", keyword); | 487 invalid_argument ("instantiator property must be a keyword", keyword); |
488 | 488 |
489 elt = XVECTOR_DATA (instantiator); | 489 elt = XVECTOR_DATA (instantiator); |
490 len = XVECTOR_LENGTH (instantiator); | 490 len = XVECTOR_LENGTH (instantiator); |
491 | 491 |
492 for (len -= 2; len >= 1; len -= 2) | 492 for (len -= 2; len >= 1; len -= 2) |
542 void | 542 void |
543 file_or_data_must_be_present (Lisp_Object instantiator) | 543 file_or_data_must_be_present (Lisp_Object instantiator) |
544 { | 544 { |
545 if (NILP (find_keyword_in_vector (instantiator, Q_file)) && | 545 if (NILP (find_keyword_in_vector (instantiator, Q_file)) && |
546 NILP (find_keyword_in_vector (instantiator, Q_data))) | 546 NILP (find_keyword_in_vector (instantiator, Q_data))) |
547 signal_simple_error ("Must supply either :file or :data", | 547 sferror ("Must supply either :file or :data", |
548 instantiator); | 548 instantiator); |
549 } | 549 } |
550 | 550 |
551 void | 551 void |
552 data_must_be_present (Lisp_Object instantiator) | 552 data_must_be_present (Lisp_Object instantiator) |
553 { | 553 { |
554 if (NILP (find_keyword_in_vector (instantiator, Q_data))) | 554 if (NILP (find_keyword_in_vector (instantiator, Q_data))) |
555 signal_simple_error ("Must supply :data", instantiator); | 555 sferror ("Must supply :data", instantiator); |
556 } | 556 } |
557 | 557 |
558 static void | 558 static void |
559 face_must_be_present (Lisp_Object instantiator) | 559 face_must_be_present (Lisp_Object instantiator) |
560 { | 560 { |
561 if (NILP (find_keyword_in_vector (instantiator, Q_face))) | 561 if (NILP (find_keyword_in_vector (instantiator, Q_face))) |
562 signal_simple_error ("Must supply :face", instantiator); | 562 sferror ("Must supply :face", instantiator); |
563 } | 563 } |
564 | 564 |
565 /* utility function useful in retrieving data from a file. */ | 565 /* utility function useful in retrieving data from a file. */ |
566 | 566 |
567 Lisp_Object | 567 Lisp_Object |
694 governing_domain = IIFORMAT_METH_OR_GIVEN (meths, governing_domain, (), | 694 governing_domain = IIFORMAT_METH_OR_GIVEN (meths, governing_domain, (), |
695 GOVERNING_DOMAIN_DEVICE); | 695 GOVERNING_DOMAIN_DEVICE); |
696 | 696 |
697 if (governing_domain == GOVERNING_DOMAIN_WINDOW | 697 if (governing_domain == GOVERNING_DOMAIN_WINDOW |
698 && NILP (DOMAIN_WINDOW (domain))) | 698 && NILP (DOMAIN_WINDOW (domain))) |
699 signal_simple_error_2 ("Domain for this instantiator must be resolvable to a window", | 699 invalid_argument_2 |
700 instantiator, domain); | 700 ("Domain for this instantiator must be resolvable to a window", |
701 instantiator, domain); | |
701 else if (governing_domain == GOVERNING_DOMAIN_FRAME | 702 else if (governing_domain == GOVERNING_DOMAIN_FRAME |
702 && NILP (DOMAIN_FRAME (domain))) | 703 && NILP (DOMAIN_FRAME (domain))) |
703 signal_simple_error_2 | 704 invalid_argument_2 |
704 ("Domain for this instantiator must be resolvable to a frame", | 705 ("Domain for this instantiator must be resolvable to a frame", |
705 instantiator, domain); | 706 instantiator, domain); |
706 | 707 |
707 if (governing_domain == GOVERNING_DOMAIN_WINDOW) | 708 if (governing_domain == GOVERNING_DOMAIN_WINDOW) |
708 domain = DOMAIN_WINDOW (domain); | 709 domain = DOMAIN_WINDOW (domain); |
765 struct gcpro gcpro1; | 766 struct gcpro gcpro1; |
766 | 767 |
767 GCPRO1 (ii); | 768 GCPRO1 (ii); |
768 if (!valid_image_instantiator_format_p (INSTANTIATOR_TYPE (instantiator), | 769 if (!valid_image_instantiator_format_p (INSTANTIATOR_TYPE (instantiator), |
769 DOMAIN_DEVICE (governing_domain))) | 770 DOMAIN_DEVICE (governing_domain))) |
770 signal_simple_error | 771 invalid_argument |
771 ("Image instantiator format is invalid in this locale.", | 772 ("Image instantiator format is invalid in this locale.", |
772 instantiator); | 773 instantiator); |
773 | 774 |
774 meths = decode_image_instantiator_format (INSTANTIATOR_TYPE (instantiator), | 775 meths = decode_image_instantiator_format (INSTANTIATOR_TYPE (instantiator), |
775 ERROR_ME); | 776 ERROR_ME); |
781 INSTANTIATOR_TYPE (instantiator), | 782 INSTANTIATOR_TYPE (instantiator), |
782 ERROR_ME_NOT); | 783 ERROR_ME_NOT); |
783 | 784 |
784 if (!HAS_IIFORMAT_METH_P (meths, instantiate) | 785 if (!HAS_IIFORMAT_METH_P (meths, instantiate) |
785 && (!device_meths || !HAS_IIFORMAT_METH_P (device_meths, instantiate))) | 786 && (!device_meths || !HAS_IIFORMAT_METH_P (device_meths, instantiate))) |
786 signal_simple_error | 787 invalid_argument |
787 ("Don't know how to instantiate this image instantiator?", | 788 ("Don't know how to instantiate this image instantiator?", |
788 instantiator); | 789 instantiator); |
789 | 790 |
790 /* In general native window system methods will require sane | 791 /* In general native window system methods will require sane |
791 geometry values, thus the instance needs to have been laid-out | 792 geometry values, thus the instance needs to have been laid-out |
903 { | 904 { |
904 char buf[100]; | 905 char buf[100]; |
905 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (obj); | 906 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (obj); |
906 | 907 |
907 if (print_readably) | 908 if (print_readably) |
908 error ("printing unreadable object #<image-instance 0x%x>", | 909 printing_unreadable_object ("#<image-instance 0x%x>", |
909 ii->header.uid); | 910 ii->header.uid); |
910 write_c_string ("#<image-instance (", printcharfun); | 911 write_c_string ("#<image-instance (", printcharfun); |
911 print_internal (Fimage_instance_type (obj), printcharfun, 0); | 912 print_internal (Fimage_instance_type (obj), printcharfun, 0); |
912 write_c_string (") ", printcharfun); | 913 write_c_string (") ", printcharfun); |
913 if (!NILP (ii->name)) | 914 if (!NILP (ii->name)) |
1301 if (EQ (type, Qcolor_pixmap)) return IMAGE_COLOR_PIXMAP; | 1302 if (EQ (type, Qcolor_pixmap)) return IMAGE_COLOR_PIXMAP; |
1302 if (EQ (type, Qpointer)) return IMAGE_POINTER; | 1303 if (EQ (type, Qpointer)) return IMAGE_POINTER; |
1303 if (EQ (type, Qsubwindow)) return IMAGE_SUBWINDOW; | 1304 if (EQ (type, Qsubwindow)) return IMAGE_SUBWINDOW; |
1304 if (EQ (type, Qwidget)) return IMAGE_WIDGET; | 1305 if (EQ (type, Qwidget)) return IMAGE_WIDGET; |
1305 | 1306 |
1306 maybe_signal_simple_error ("Invalid image-instance type", type, | 1307 maybe_invalid_constant ("Invalid image-instance type", type, |
1307 Qimage, errb); | 1308 Qimage, errb); |
1308 | 1309 |
1309 return IMAGE_UNKNOWN; /* not reached */ | 1310 return IMAGE_UNKNOWN; /* not reached */ |
1310 } | 1311 } |
1311 | 1312 |
1374 | 1375 |
1375 DOESNT_RETURN | 1376 DOESNT_RETURN |
1376 incompatible_image_types (Lisp_Object instantiator, int given_dest_mask, | 1377 incompatible_image_types (Lisp_Object instantiator, int given_dest_mask, |
1377 int desired_dest_mask) | 1378 int desired_dest_mask) |
1378 { | 1379 { |
1379 signal_error | 1380 signal_error_1 |
1380 (Qerror, | 1381 (Qinvalid_argument, |
1381 list2 | 1382 list2 |
1382 (emacs_doprnt_string_lisp_2 | 1383 (emacs_doprnt_string_lisp_2 |
1383 ((const Bufbyte *) | 1384 ((const Bufbyte *) |
1384 "No compatible image-instance types given: wanted one of %s, got %s", | 1385 "No compatible image-instance types given: wanted one of %s, got %s", |
1385 Qnil, -1, 2, | 1386 Qnil, -1, 2, |
1455 struct gcpro gcpro1; | 1456 struct gcpro gcpro1; |
1456 int dest_mask; | 1457 int dest_mask; |
1457 Lisp_Object governing_domain; | 1458 Lisp_Object governing_domain; |
1458 | 1459 |
1459 if (IMAGE_INSTANCEP (data)) | 1460 if (IMAGE_INSTANCEP (data)) |
1460 signal_simple_error ("Image instances not allowed here", data); | 1461 invalid_argument ("Image instances not allowed here", data); |
1461 image_validate (data); | 1462 image_validate (data); |
1462 domain = decode_domain (domain); | 1463 domain = decode_domain (domain); |
1463 /* instantiate_image_instantiator() will abort if given an | 1464 /* instantiate_image_instantiator() will abort if given an |
1464 image instance ... */ | 1465 image instance ... */ |
1465 dest_mask = decode_image_instance_type_list (dest_types); | 1466 dest_mask = decode_image_instance_type_list (dest_types); |
1468 make_int (dest_mask)); | 1469 make_int (dest_mask)); |
1469 GCPRO1 (data); | 1470 GCPRO1 (data); |
1470 /* After normalizing the data, it's always either an image instance (which | 1471 /* After normalizing the data, it's always either an image instance (which |
1471 we filtered out above) or a vector. */ | 1472 we filtered out above) or a vector. */ |
1472 if (EQ (INSTANTIATOR_TYPE (data), Qinherit)) | 1473 if (EQ (INSTANTIATOR_TYPE (data), Qinherit)) |
1473 signal_simple_error ("Inheritance not allowed here", data); | 1474 invalid_argument ("Inheritance not allowed here", data); |
1474 governing_domain = | 1475 governing_domain = |
1475 get_image_instantiator_governing_domain (data, domain); | 1476 get_image_instantiator_governing_domain (data, domain); |
1476 ii = instantiate_image_instantiator (governing_domain, domain, data, | 1477 ii = instantiate_image_instantiator (governing_domain, domain, data, |
1477 Qnil, Qnil, dest_mask, Qnil); | 1478 Qnil, Qnil, dest_mask, Qnil); |
1478 RETURN_UNGCPRO (ii); | 1479 RETURN_UNGCPRO (ii); |
2139 /* error helpers */ | 2140 /* error helpers */ |
2140 /************************************************************************/ | 2141 /************************************************************************/ |
2141 DOESNT_RETURN | 2142 DOESNT_RETURN |
2142 signal_image_error (const char *reason, Lisp_Object frob) | 2143 signal_image_error (const char *reason, Lisp_Object frob) |
2143 { | 2144 { |
2144 signal_error (Qimage_conversion_error, | 2145 signal_error (Qimage_conversion_error, reason, frob); |
2145 list2 (build_translated_string (reason), frob)); | |
2146 } | 2146 } |
2147 | 2147 |
2148 DOESNT_RETURN | 2148 DOESNT_RETURN |
2149 signal_image_error_2 (const char *reason, Lisp_Object frob0, Lisp_Object frob1) | 2149 signal_image_error_2 (const char *reason, Lisp_Object frob0, Lisp_Object frob1) |
2150 { | 2150 { |
2151 signal_error (Qimage_conversion_error, | 2151 signal_error_2 (Qimage_conversion_error, reason, frob0, frob1); |
2152 list3 (build_translated_string (reason), frob0, frob1)); | 2152 } |
2153 | |
2154 DOESNT_RETURN | |
2155 signal_double_image_error (const char *string1, const char *string2, | |
2156 Lisp_Object data) | |
2157 { | |
2158 signal_error_1 (Qimage_conversion_error, | |
2159 list3 (build_translated_string (string1), | |
2160 build_translated_string (string2), | |
2161 data)); | |
2162 } | |
2163 | |
2164 DOESNT_RETURN | |
2165 signal_double_image_error_2 (const char *string1, const char *string2, | |
2166 Lisp_Object data1, Lisp_Object data2) | |
2167 { | |
2168 signal_error_1 (Qimage_conversion_error, | |
2169 list4 (build_translated_string (string1), | |
2170 build_translated_string (string2), | |
2171 data1, data2)); | |
2153 } | 2172 } |
2154 | 2173 |
2155 /**************************************************************************** | 2174 /**************************************************************************** |
2156 * nothing * | 2175 * nothing * |
2157 ****************************************************************************/ | 2176 ****************************************************************************/ |
2473 | 2492 |
2474 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, | 2493 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, |
2475 console_type); | 2494 console_type); |
2476 | 2495 |
2477 if (CONSP (file)) /* failure locating filename */ | 2496 if (CONSP (file)) /* failure locating filename */ |
2478 signal_double_file_error ("Opening pixmap file", | 2497 signal_double_image_error ("Opening pixmap file", |
2479 "no such file or directory", | 2498 "no such file or directory", |
2480 Fcar (file)); | 2499 Fcar (file)); |
2481 | 2500 |
2482 if (NILP (file)) /* no conversion necessary */ | 2501 if (NILP (file)) /* no conversion necessary */ |
2483 RETURN_UNGCPRO (inst); | 2502 RETURN_UNGCPRO (inst); |
2484 | 2503 |
2485 alist = tagged_vector_to_alist (inst); | 2504 alist = tagged_vector_to_alist (inst); |
2516 | 2535 |
2517 if (!CONSP (data) || | 2536 if (!CONSP (data) || |
2518 !CONSP (XCDR (data)) || | 2537 !CONSP (XCDR (data)) || |
2519 !CONSP (XCDR (XCDR (data))) || | 2538 !CONSP (XCDR (XCDR (data))) || |
2520 !NILP (XCDR (XCDR (XCDR (data))))) | 2539 !NILP (XCDR (XCDR (XCDR (data))))) |
2521 signal_simple_error ("Must be list of 3 elements", data); | 2540 sferror ("Must be list of 3 elements", data); |
2522 | 2541 |
2523 width = XCAR (data); | 2542 width = XCAR (data); |
2524 height = XCAR (XCDR (data)); | 2543 height = XCAR (XCDR (data)); |
2525 bits = XCAR (XCDR (XCDR (data))); | 2544 bits = XCAR (XCDR (XCDR (data))); |
2526 | 2545 |
2527 CHECK_STRING (bits); | 2546 CHECK_STRING (bits); |
2528 | 2547 |
2529 if (!NATNUMP (width)) | 2548 if (!NATNUMP (width)) |
2530 signal_simple_error ("Width must be a natural number", width); | 2549 invalid_argument ("Width must be a natural number", width); |
2531 | 2550 |
2532 if (!NATNUMP (height)) | 2551 if (!NATNUMP (height)) |
2533 signal_simple_error ("Height must be a natural number", height); | 2552 invalid_argument ("Height must be a natural number", height); |
2534 | 2553 |
2535 if (((XINT (width) * XINT (height)) / 8) > XSTRING_CHAR_LENGTH (bits)) | 2554 if (((XINT (width) * XINT (height)) / 8) > XSTRING_CHAR_LENGTH (bits)) |
2536 signal_simple_error ("data is too short for width and height", | 2555 invalid_argument ("data is too short for width and height", |
2537 vector3 (width, height, bits)); | 2556 vector3 (width, height, bits)); |
2538 } | 2557 } |
2539 | 2558 |
2540 /* Validate method for XBM's. */ | 2559 /* Validate method for XBM's. */ |
2541 | 2560 |
2590 switch (result) | 2609 switch (result) |
2591 { | 2610 { |
2592 case BitmapOpenFailed: | 2611 case BitmapOpenFailed: |
2593 { | 2612 { |
2594 /* should never happen */ | 2613 /* should never happen */ |
2595 signal_double_file_error ("Opening bitmap file", | 2614 signal_double_image_error ("Opening bitmap file", |
2596 "no such file or directory", | 2615 "no such file or directory", |
2597 name); | 2616 name); |
2598 } | 2617 } |
2599 case BitmapFileInvalid: | 2618 case BitmapFileInvalid: |
2600 { | 2619 { |
2601 if (ok_if_data_invalid) | 2620 if (ok_if_data_invalid) |
2602 return Qt; | 2621 return Qt; |
2603 signal_double_file_error ("Reading bitmap file", | 2622 signal_double_image_error ("Reading bitmap file", |
2604 "invalid data in file", | 2623 "invalid data in file", |
2605 name); | 2624 name); |
2606 } | 2625 } |
2607 case BitmapNoMemory: | 2626 case BitmapNoMemory: |
2608 { | 2627 { |
2609 signal_double_file_error ("Reading bitmap file", | 2628 signal_double_image_error ("Reading bitmap file", |
2610 "out of memory", | 2629 "out of memory", |
2611 name); | 2630 name); |
2612 } | 2631 } |
2613 default: | 2632 default: |
2614 { | 2633 { |
2615 signal_double_file_error_2 ("Reading bitmap file", | 2634 signal_double_image_error_2 ("Reading bitmap file", |
2616 "unknown error code", | 2635 "unknown error code", |
2617 make_int (result), name); | 2636 make_int (result), name); |
2618 } | 2637 } |
2619 } | 2638 } |
2620 | 2639 |
2621 return Qnil; /* not reached */ | 2640 return Qnil; /* not reached */ |
2622 } | 2641 } |
2680 console_type); | 2699 console_type); |
2681 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file, | 2700 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file, |
2682 Q_mask_data, console_type); | 2701 Q_mask_data, console_type); |
2683 | 2702 |
2684 if (CONSP (file)) /* failure locating filename */ | 2703 if (CONSP (file)) /* failure locating filename */ |
2685 signal_double_file_error ("Opening bitmap file", | 2704 signal_double_image_error ("Opening bitmap file", |
2686 "no such file or directory", | 2705 "no such file or directory", |
2687 Fcar (file)); | 2706 Fcar (file)); |
2688 | 2707 |
2689 if (NILP (file) && NILP (mask_file)) /* no conversion necessary */ | 2708 if (NILP (file) && NILP (mask_file)) /* no conversion necessary */ |
2690 RETURN_UNGCPRO (inst); | 2709 RETURN_UNGCPRO (inst); |
2691 | 2710 |
2692 alist = tagged_vector_to_alist (inst); | 2711 alist = tagged_vector_to_alist (inst); |
2765 console_type); | 2784 console_type); |
2766 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file, | 2785 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file, |
2767 Q_mask_data, console_type); | 2786 Q_mask_data, console_type); |
2768 | 2787 |
2769 if (CONSP (file)) /* failure locating filename */ | 2788 if (CONSP (file)) /* failure locating filename */ |
2770 signal_double_file_error ("Opening bitmap file", | 2789 signal_double_image_error ("Opening bitmap file", |
2771 "no such file or directory", | 2790 "no such file or directory", |
2772 Fcar (file)); | 2791 Fcar (file)); |
2773 | 2792 |
2774 if (NILP (file) && NILP (mask_file)) /* no conversion necessary */ | 2793 if (NILP (file) && NILP (mask_file)) /* no conversion necessary */ |
2775 RETURN_UNGCPRO (inst); | 2794 RETURN_UNGCPRO (inst); |
2776 | 2795 |
2777 alist = tagged_vector_to_alist (inst); | 2796 alist = tagged_vector_to_alist (inst); |
2878 return Qt; | 2897 return Qt; |
2879 signal_image_error ("invalid XPM data in file", name); | 2898 signal_image_error ("invalid XPM data in file", name); |
2880 } | 2899 } |
2881 case XpmNoMemory: | 2900 case XpmNoMemory: |
2882 { | 2901 { |
2883 signal_double_file_error ("Reading pixmap file", | 2902 signal_double_image_error ("Reading pixmap file", |
2884 "out of memory", name); | 2903 "out of memory", name); |
2885 } | 2904 } |
2886 case XpmOpenFailed: | 2905 case XpmOpenFailed: |
2887 { | 2906 { |
2888 /* should never happen? */ | 2907 /* should never happen? */ |
2889 signal_double_file_error ("Opening pixmap file", | 2908 signal_double_image_error ("Opening pixmap file", |
2890 "no such file or directory", name); | 2909 "no such file or directory", name); |
2891 } | 2910 } |
2892 default: | 2911 default: |
2893 { | 2912 { |
2894 signal_double_file_error_2 ("Parsing pixmap file", | 2913 signal_double_image_error_2 ("Parsing pixmap file", |
2895 "unknown error code", | 2914 "unknown error code", |
2896 make_int (result), name); | 2915 make_int (result), name); |
2897 break; | 2916 break; |
2898 } | 2917 } |
2899 } | 2918 } |
2900 | 2919 |
2901 return Qnil; /* not reached */ | 2920 return Qnil; /* not reached */ |
2912 if (!CONSP (rest) || | 2931 if (!CONSP (rest) || |
2913 !CONSP (XCAR (rest)) || | 2932 !CONSP (XCAR (rest)) || |
2914 !STRINGP (XCAR (XCAR (rest))) || | 2933 !STRINGP (XCAR (XCAR (rest))) || |
2915 (!STRINGP (XCDR (XCAR (rest))) && | 2934 (!STRINGP (XCDR (XCAR (rest))) && |
2916 !COLOR_SPECIFIERP (XCDR (XCAR (rest))))) | 2935 !COLOR_SPECIFIERP (XCDR (XCAR (rest))))) |
2917 signal_simple_error ("Invalid color symbol alist", data); | 2936 sferror ("Invalid color symbol alist", data); |
2918 } | 2937 } |
2919 } | 2938 } |
2920 | 2939 |
2921 static void | 2940 static void |
2922 xpm_validate (Lisp_Object instantiator) | 2941 xpm_validate (Lisp_Object instantiator) |
2947 value = XCAR (value); | 2966 value = XCAR (value); |
2948 value = Feval (value); | 2967 value = Feval (value); |
2949 if (NILP (value)) | 2968 if (NILP (value)) |
2950 continue; | 2969 continue; |
2951 if (!STRINGP (value) && !COLOR_SPECIFIERP (value)) | 2970 if (!STRINGP (value) && !COLOR_SPECIFIERP (value)) |
2952 signal_simple_error | 2971 invalid_argument |
2953 ("Result from xpm-color-symbols eval must be nil, string, or color", | 2972 ("Result from xpm-color-symbols eval must be nil, string, or color", |
2954 value); | 2973 value); |
2955 results = Fcons (Fcons (name, value), results); | 2974 results = Fcons (Fcons (name, value), results); |
2956 } | 2975 } |
2957 UNGCPRO; /* no more evaluation */ | 2976 UNGCPRO; /* no more evaluation */ |
2979 | 2998 |
2980 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, | 2999 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, |
2981 console_type); | 3000 console_type); |
2982 | 3001 |
2983 if (CONSP (file)) /* failure locating filename */ | 3002 if (CONSP (file)) /* failure locating filename */ |
2984 signal_double_file_error ("Opening pixmap file", | 3003 signal_double_image_error ("Opening pixmap file", |
2985 "no such file or directory", | 3004 "no such file or directory", |
2986 Fcar (file)); | 3005 Fcar (file)); |
2987 | 3006 |
2988 color_symbols = find_keyword_in_vector_or_given (inst, Q_color_symbols, | 3007 color_symbols = find_keyword_in_vector_or_given (inst, Q_color_symbols, |
2989 Qunbound); | 3008 Qunbound); |
2990 | 3009 |
2991 if (NILP (file) && !UNBOUNDP (color_symbols)) | 3010 if (NILP (file) && !UNBOUNDP (color_symbols)) |
3138 int mask = | 3157 int mask = |
3139 image_instance_type_to_mask (XIMAGE_INSTANCE_TYPE (instantiator)); | 3158 image_instance_type_to_mask (XIMAGE_INSTANCE_TYPE (instantiator)); |
3140 if (mask & dest_mask) | 3159 if (mask & dest_mask) |
3141 return instantiator; | 3160 return instantiator; |
3142 else | 3161 else |
3143 signal_simple_error ("Type of image instance not allowed here", | 3162 invalid_argument ("Type of image instance not allowed here", |
3144 instantiator); | 3163 instantiator); |
3145 } | 3164 } |
3146 else | 3165 else |
3147 signal_simple_error_2 ("Wrong domain for image instance", | 3166 invalid_argument_2 ("Wrong domain for image instance", |
3148 instantiator, domain); | 3167 instantiator, domain); |
3149 } | 3168 } |
3150 /* How ugly !! An image instanciator that uses a kludgy syntax to snarf in | 3169 /* How ugly !! An image instanciator that uses a kludgy syntax to snarf in |
3151 face properties. There's a design flaw here. -- didier */ | 3170 face properties. There's a design flaw here. -- didier */ |
3152 else if (VECTORP (instantiator) | 3171 else if (VECTORP (instantiator) |
3282 ->subwindow_instance_cache, | 3301 ->subwindow_instance_cache, |
3283 Qunbound), instance)); | 3302 Qunbound), instance)); |
3284 #endif | 3303 #endif |
3285 } | 3304 } |
3286 else if (NILP (instance)) | 3305 else if (NILP (instance)) |
3287 signal_simple_error ("Can't instantiate image (probably cached)", | 3306 gui_error ("Can't instantiate image (probably cached)", instantiator); |
3288 instantiator); | |
3289 /* We found an instance. However, because we are using the glyph | 3307 /* We found an instance. However, because we are using the glyph |
3290 as the hash key instead of the instantiator, the current | 3308 as the hash key instead of the instantiator, the current |
3291 instantiator may not be the same as the original. Thus we | 3309 instantiator may not be the same as the original. Thus we |
3292 must update the instance based on the new | 3310 must update the instance based on the new |
3293 instantiator. Preserving instance identity like this is | 3311 instantiator. Preserving instance identity like this is |
3333 Lisp_Object already_seen = Qnil; | 3351 Lisp_Object already_seen = Qnil; |
3334 struct gcpro gcpro1; | 3352 struct gcpro gcpro1; |
3335 int i; | 3353 int i; |
3336 | 3354 |
3337 if (instantiator_len < 1) | 3355 if (instantiator_len < 1) |
3338 signal_simple_error ("Vector length must be at least 1", | 3356 sferror ("Vector length must be at least 1", |
3339 instantiator); | 3357 instantiator); |
3340 | 3358 |
3341 meths = decode_image_instantiator_format (elt[0], ERROR_ME); | 3359 meths = decode_image_instantiator_format (elt[0], ERROR_ME); |
3342 if (!(instantiator_len & 1)) | 3360 if (!(instantiator_len & 1)) |
3343 signal_simple_error | 3361 sferror |
3344 ("Must have alternating keyword/value pairs", instantiator); | 3362 ("Must have alternating keyword/value pairs", instantiator); |
3345 | 3363 |
3346 GCPRO1 (already_seen); | 3364 GCPRO1 (already_seen); |
3347 | 3365 |
3348 for (i = 1; i < instantiator_len; i += 2) | 3366 for (i = 1; i < instantiator_len; i += 2) |
3351 Lisp_Object value = elt[i+1]; | 3369 Lisp_Object value = elt[i+1]; |
3352 int j; | 3370 int j; |
3353 | 3371 |
3354 CHECK_SYMBOL (keyword); | 3372 CHECK_SYMBOL (keyword); |
3355 if (!SYMBOL_IS_KEYWORD (keyword)) | 3373 if (!SYMBOL_IS_KEYWORD (keyword)) |
3356 signal_simple_error ("Symbol must begin with a colon", keyword); | 3374 invalid_argument ("Symbol must begin with a colon", keyword); |
3357 | 3375 |
3358 for (j = 0; j < Dynarr_length (meths->keywords); j++) | 3376 for (j = 0; j < Dynarr_length (meths->keywords); j++) |
3359 if (EQ (keyword, Dynarr_at (meths->keywords, j).keyword)) | 3377 if (EQ (keyword, Dynarr_at (meths->keywords, j).keyword)) |
3360 break; | 3378 break; |
3361 | 3379 |
3362 if (j == Dynarr_length (meths->keywords)) | 3380 if (j == Dynarr_length (meths->keywords)) |
3363 signal_simple_error ("Unrecognized keyword", keyword); | 3381 invalid_argument ("Unrecognized keyword", keyword); |
3364 | 3382 |
3365 if (!Dynarr_at (meths->keywords, j).multiple_p) | 3383 if (!Dynarr_at (meths->keywords, j).multiple_p) |
3366 { | 3384 { |
3367 if (!NILP (memq_no_quit (keyword, already_seen))) | 3385 if (!NILP (memq_no_quit (keyword, already_seen))) |
3368 signal_simple_error | 3386 sferror |
3369 ("Keyword may not appear more than once", keyword); | 3387 ("Keyword may not appear more than once", keyword); |
3370 already_seen = Fcons (keyword, already_seen); | 3388 already_seen = Fcons (keyword, already_seen); |
3371 } | 3389 } |
3372 | 3390 |
3373 (Dynarr_at (meths->keywords, j).validate) (value); | 3391 (Dynarr_at (meths->keywords, j).validate) (value); |
3376 UNGCPRO; | 3394 UNGCPRO; |
3377 | 3395 |
3378 MAYBE_IIFORMAT_METH (meths, validate, (instantiator)); | 3396 MAYBE_IIFORMAT_METH (meths, validate, (instantiator)); |
3379 } | 3397 } |
3380 else | 3398 else |
3381 signal_simple_error ("Must be string or vector", instantiator); | 3399 invalid_argument ("Must be string or vector", instantiator); |
3382 } | 3400 } |
3383 | 3401 |
3384 static void | 3402 static void |
3385 image_after_change (Lisp_Object specifier, Lisp_Object locale) | 3403 image_after_change (Lisp_Object specifier, Lisp_Object locale) |
3386 { | 3404 { |
3559 { | 3577 { |
3560 Lisp_Glyph *glyph = XGLYPH (obj); | 3578 Lisp_Glyph *glyph = XGLYPH (obj); |
3561 char buf[20]; | 3579 char buf[20]; |
3562 | 3580 |
3563 if (print_readably) | 3581 if (print_readably) |
3564 error ("printing unreadable object #<glyph 0x%x>", glyph->header.uid); | 3582 printing_unreadable_object ("#<glyph 0x%x>", glyph->header.uid); |
3565 | 3583 |
3566 write_c_string ("#<glyph (", printcharfun); | 3584 write_c_string ("#<glyph (", printcharfun); |
3567 print_internal (Fglyph_type (obj), printcharfun, 0); | 3585 print_internal (Fglyph_type (obj), printcharfun, 0); |
3568 write_c_string (") ", printcharfun); | 3586 write_c_string (") ", printcharfun); |
3569 print_internal (glyph->image, printcharfun, 1); | 3587 print_internal (glyph->image, printcharfun, 1); |
3754 | 3772 |
3755 if (EQ (type, Qbuffer)) return GLYPH_BUFFER; | 3773 if (EQ (type, Qbuffer)) return GLYPH_BUFFER; |
3756 if (EQ (type, Qpointer)) return GLYPH_POINTER; | 3774 if (EQ (type, Qpointer)) return GLYPH_POINTER; |
3757 if (EQ (type, Qicon)) return GLYPH_ICON; | 3775 if (EQ (type, Qicon)) return GLYPH_ICON; |
3758 | 3776 |
3759 maybe_signal_simple_error ("Invalid glyph type", type, Qimage, errb); | 3777 maybe_invalid_constant ("Invalid glyph type", type, Qimage, errb); |
3760 | 3778 |
3761 return GLYPH_UNKNOWN; | 3779 return GLYPH_UNKNOWN; |
3762 } | 3780 } |
3763 | 3781 |
3764 static int | 3782 static int |
4706 Lisp_Object frame = DOMAIN_FRAME (domain); | 4724 Lisp_Object frame = DOMAIN_FRAME (domain); |
4707 Lisp_Object width = find_keyword_in_vector (instantiator, Q_pixel_width); | 4725 Lisp_Object width = find_keyword_in_vector (instantiator, Q_pixel_width); |
4708 Lisp_Object height = find_keyword_in_vector (instantiator, Q_pixel_height); | 4726 Lisp_Object height = find_keyword_in_vector (instantiator, Q_pixel_height); |
4709 | 4727 |
4710 if (NILP (frame)) | 4728 if (NILP (frame)) |
4711 signal_simple_error ("No selected frame", device); | 4729 invalid_state ("No selected frame", device); |
4712 | 4730 |
4713 if (!(dest_mask & IMAGE_SUBWINDOW_MASK)) | 4731 if (!(dest_mask & IMAGE_SUBWINDOW_MASK)) |
4714 incompatible_image_types (instantiator, dest_mask, IMAGE_SUBWINDOW_MASK); | 4732 incompatible_image_types (instantiator, dest_mask, IMAGE_SUBWINDOW_MASK); |
4715 | 4733 |
4716 ii->data = 0; | 4734 ii->data = 0; |
5006 DEFSUBR (Fimage_specifier_p); | 5024 DEFSUBR (Fimage_specifier_p); |
5007 /* Qimage in general.c */ | 5025 /* Qimage in general.c */ |
5008 | 5026 |
5009 /* image instances */ | 5027 /* image instances */ |
5010 | 5028 |
5011 defsymbol (&Qimage_instancep, "image-instance-p"); | 5029 DEFSYMBOL_MULTIWORD_PREDICATE (Qimage_instancep); |
5012 | 5030 |
5013 DEFSYMBOL (Qnothing_image_instance_p); | 5031 DEFSYMBOL (Qnothing_image_instance_p); |
5014 DEFSYMBOL (Qtext_image_instance_p); | 5032 DEFSYMBOL (Qtext_image_instance_p); |
5015 DEFSYMBOL (Qmono_pixmap_image_instance_p); | 5033 DEFSYMBOL (Qmono_pixmap_image_instance_p); |
5016 DEFSYMBOL (Qcolor_pixmap_image_instance_p); | 5034 DEFSYMBOL (Qcolor_pixmap_image_instance_p); |
5080 for animated glyphs. */ | 5098 for animated glyphs. */ |
5081 DEFSYMBOL (Qglyph_animated_timeout_handler); | 5099 DEFSYMBOL (Qglyph_animated_timeout_handler); |
5082 DEFSUBR (Fglyph_animated_timeout_handler); | 5100 DEFSUBR (Fglyph_animated_timeout_handler); |
5083 | 5101 |
5084 /* Errors */ | 5102 /* Errors */ |
5085 DEFERROR_STANDARD (Qimage_conversion_error, Qio_error); | 5103 DEFERROR_STANDARD (Qimage_conversion_error, Qconversion_error); |
5086 } | 5104 } |
5087 | 5105 |
5088 static const struct lrecord_description image_specifier_description[] = { | 5106 static const struct lrecord_description image_specifier_description[] = { |
5089 { XD_LISP_OBJECT, specifier_data_offset + offsetof (struct image_specifier, attachee) }, | 5107 { XD_LISP_OBJECT, specifier_data_offset + offsetof (struct image_specifier, attachee) }, |
5090 { XD_LISP_OBJECT, specifier_data_offset + offsetof (struct image_specifier, attachee_property) }, | 5108 { XD_LISP_OBJECT, specifier_data_offset + offsetof (struct image_specifier, attachee_property) }, |