comparison src/objects.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 3078fd1074e8
children 190b164ddcac
comparison
equal deleted inserted replaced
562:c775bd016b32 563:183866b06e0b
43 finalose (void *ptr) 43 finalose (void *ptr)
44 { 44 {
45 Lisp_Object obj; 45 Lisp_Object obj;
46 XSETOBJ (obj, ptr); 46 XSETOBJ (obj, ptr);
47 47
48 signal_simple_error 48 invalid_operation
49 ("Can't dump an emacs containing window system objects", obj); 49 ("Can't dump an emacs containing window system objects", obj);
50 } 50 }
51 51
52 52
53 /**************************************************************************** 53 /****************************************************************************
72 int escapeflag) 72 int escapeflag)
73 { 73 {
74 char buf[100]; 74 char buf[100];
75 Lisp_Color_Instance *c = XCOLOR_INSTANCE (obj); 75 Lisp_Color_Instance *c = XCOLOR_INSTANCE (obj);
76 if (print_readably) 76 if (print_readably)
77 error ("printing unreadable object #<color-instance 0x%x>", 77 printing_unreadable_object ("#<color-instance 0x%x>",
78 c->header.uid); 78 c->header.uid);
79 write_c_string ("#<color-instance ", printcharfun); 79 write_c_string ("#<color-instance ", printcharfun);
80 print_internal (c->name, printcharfun, 0); 80 print_internal (c->name, printcharfun, 0);
81 write_c_string (" on ", printcharfun); 81 write_c_string (" on ", printcharfun);
82 print_internal (c->device, printcharfun, 0); 82 print_internal (c->device, printcharfun, 0);
252 print_font_instance (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) 252 print_font_instance (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
253 { 253 {
254 char buf[200]; 254 char buf[200];
255 Lisp_Font_Instance *f = XFONT_INSTANCE (obj); 255 Lisp_Font_Instance *f = XFONT_INSTANCE (obj);
256 if (print_readably) 256 if (print_readably)
257 error ("printing unreadable object #<font-instance 0x%x>", f->header.uid); 257 printing_unreadable_object ("#<font-instance 0x%x>", f->header.uid);
258 write_c_string ("#<font-instance ", printcharfun); 258 write_c_string ("#<font-instance ", printcharfun);
259 print_internal (f->name, printcharfun, 1); 259 print_internal (f->name, printcharfun, 1);
260 write_c_string (" on ", printcharfun); 260 write_c_string (" on ", printcharfun);
261 print_internal (f->device, printcharfun, 0); 261 print_internal (f->device, printcharfun, 0);
262 if (!NILP (f->device)) 262 if (!NILP (f->device))
419 { 419 {
420 Lisp_Font_Instance *f = XFONT_INSTANCE (font_instance); 420 Lisp_Font_Instance *f = XFONT_INSTANCE (font_instance);
421 421
422 if (NILP (f->device)) 422 if (NILP (f->device))
423 { 423 {
424 maybe_signal_simple_error ("Couldn't determine font truename", 424 maybe_signal_error (Qgui_error, "Couldn't determine font truename",
425 font_instance, Qfont, errb); 425 font_instance, Qfont, errb);
426 return Qnil; 426 return Qnil;
427 } 427 }
428 428
429 return DEVMETH_OR_GIVEN (XDEVICE (f->device), 429 return DEVMETH_OR_GIVEN (XDEVICE (f->device),
430 font_instance_truename, (f, errb), f->name); 430 font_instance_truename, (f, errb), f->name);
543 { 543 {
544 case 0: 544 case 0:
545 if (DEVICE_TTY_P (d)) 545 if (DEVICE_TTY_P (d))
546 return Vthe_null_color_instance; 546 return Vthe_null_color_instance;
547 else 547 else
548 signal_simple_error ("Color instantiator [] only valid on TTY's", 548 gui_error ("Color instantiator [] only valid on TTY's",
549 device); 549 device);
550 550
551 case 1: 551 case 1:
552 if (NILP (COLOR_SPECIFIER_FACE (XCOLOR_SPECIFIER (specifier)))) 552 if (NILP (COLOR_SPECIFIER_FACE (XCOLOR_SPECIFIER (specifier))))
553 signal_simple_error ("Color specifier not attached to a face", 553 gui_error ("Color specifier not attached to a face",
554 instantiator); 554 instantiator);
555 return (FACE_PROPERTY_INSTANCE_1 555 return (FACE_PROPERTY_INSTANCE_1
556 (Fget_face (XVECTOR_DATA (instantiator)[0]), 556 (Fget_face (XVECTOR_DATA (instantiator)[0]),
557 COLOR_SPECIFIER_FACE_PROPERTY (XCOLOR_SPECIFIER (specifier)), 557 COLOR_SPECIFIER_FACE_PROPERTY (XCOLOR_SPECIFIER (specifier)),
558 domain, ERROR_ME, 0, depth)); 558 domain, ERROR_ME, 0, depth));
569 else if (NILP (instantiator)) 569 else if (NILP (instantiator))
570 { 570 {
571 if (DEVICE_TTY_P (d)) 571 if (DEVICE_TTY_P (d))
572 return Vthe_null_color_instance; 572 return Vthe_null_color_instance;
573 else 573 else
574 signal_simple_error ("Color instantiator [] only valid on TTY's", 574 gui_error ("Color instantiator [] only valid on TTY's",
575 device); 575 device);
576 } 576 }
577 else 577 else
578 abort (); /* The spec validation routines are screwed up. */ 578 abort (); /* The spec validation routines are screwed up. */
579 579
586 if (COLOR_INSTANCEP (instantiator) || STRINGP (instantiator)) 586 if (COLOR_INSTANCEP (instantiator) || STRINGP (instantiator))
587 return; 587 return;
588 if (VECTORP (instantiator)) 588 if (VECTORP (instantiator))
589 { 589 {
590 if (XVECTOR_LENGTH (instantiator) > 2) 590 if (XVECTOR_LENGTH (instantiator) > 2)
591 signal_simple_error ("Inheritance vector must be of size 0 - 2", 591 sferror ("Inheritance vector must be of size 0 - 2",
592 instantiator); 592 instantiator);
593 else if (XVECTOR_LENGTH (instantiator) > 0) 593 else if (XVECTOR_LENGTH (instantiator) > 0)
594 { 594 {
595 Lisp_Object face = XVECTOR_DATA (instantiator)[0]; 595 Lisp_Object face = XVECTOR_DATA (instantiator)[0];
596 596
597 Fget_face (face); 597 Fget_face (face);
598 if (XVECTOR_LENGTH (instantiator) == 2) 598 if (XVECTOR_LENGTH (instantiator) == 2)
599 { 599 {
600 Lisp_Object field = XVECTOR_DATA (instantiator)[1]; 600 Lisp_Object field = XVECTOR_DATA (instantiator)[1];
601 if (!EQ (field, Qforeground) && !EQ (field, Qbackground)) 601 if (!EQ (field, Qforeground) && !EQ (field, Qbackground))
602 signal_simple_error 602 invalid_constant
603 ("Inheritance field must be `foreground' or `background'", 603 ("Inheritance field must be `foreground' or `background'",
604 field); 604 field);
605 } 605 }
606 } 606 }
607 } 607 }
608 else 608 else
609 signal_simple_error ("Invalid color instantiator", instantiator); 609 invalid_argument ("Invalid color instantiator", instantiator);
610 } 610 }
611 611
612 static void 612 static void
613 color_after_change (Lisp_Object specifier, Lisp_Object locale) 613 color_after_change (Lisp_Object specifier, Lisp_Object locale)
614 { 614 {
799 return; 799 return;
800 if (VECTORP (instantiator)) 800 if (VECTORP (instantiator))
801 { 801 {
802 if (XVECTOR_LENGTH (instantiator) != 1) 802 if (XVECTOR_LENGTH (instantiator) != 1)
803 { 803 {
804 signal_simple_error 804 sferror
805 ("Vector length must be one for font inheritance", instantiator); 805 ("Vector length must be one for font inheritance", instantiator);
806 } 806 }
807 Fget_face (XVECTOR_DATA (instantiator)[0]); 807 Fget_face (XVECTOR_DATA (instantiator)[0]);
808 } 808 }
809 else 809 else
810 signal_simple_error ("Must be string, vector, or font-instance", 810 invalid_argument ("Must be string, vector, or font-instance",
811 instantiator); 811 instantiator);
812 } 812 }
813 813
814 static void 814 static void
815 font_after_change (Lisp_Object specifier, Lisp_Object locale) 815 font_after_change (Lisp_Object specifier, Lisp_Object locale)
892 prop = XVECTOR_DATA (instantiator)[1]; 892 prop = XVECTOR_DATA (instantiator)[1];
893 else 893 else
894 { 894 {
895 if (NILP (FACE_BOOLEAN_SPECIFIER_FACE 895 if (NILP (FACE_BOOLEAN_SPECIFIER_FACE
896 (XFACE_BOOLEAN_SPECIFIER (specifier)))) 896 (XFACE_BOOLEAN_SPECIFIER (specifier))))
897 signal_simple_error 897 gui_error
898 ("Face-boolean specifier not attached to a face", instantiator); 898 ("Face-boolean specifier not attached to a face", instantiator);
899 prop = FACE_BOOLEAN_SPECIFIER_FACE_PROPERTY 899 prop = FACE_BOOLEAN_SPECIFIER_FACE_PROPERTY
900 (XFACE_BOOLEAN_SPECIFIER (specifier)); 900 (XFACE_BOOLEAN_SPECIFIER (specifier));
901 } 901 }
902 902
935 && !EQ (field, Qstrikethru) 935 && !EQ (field, Qstrikethru)
936 && !EQ (field, Qhighlight) 936 && !EQ (field, Qhighlight)
937 && !EQ (field, Qdim) 937 && !EQ (field, Qdim)
938 && !EQ (field, Qblinking) 938 && !EQ (field, Qblinking)
939 && !EQ (field, Qreverse)) 939 && !EQ (field, Qreverse))
940 signal_simple_error ("Invalid face-boolean inheritance field", 940 invalid_constant ("Invalid face-boolean inheritance field",
941 field); 941 field);
942 } 942 }
943 } 943 }
944 else if (VECTORP (instantiator)) 944 else if (VECTORP (instantiator))
945 signal_simple_error ("Wrong length for face-boolean inheritance spec", 945 sferror ("Wrong length for face-boolean inheritance spec",
946 instantiator); 946 instantiator);
947 else 947 else
948 signal_simple_error ("Face-boolean instantiator must be nil, t, or vector", 948 invalid_argument ("Face-boolean instantiator must be nil, t, or vector",
949 instantiator); 949 instantiator);
950 } 950 }
951 951
952 static void 952 static void
953 face_boolean_after_change (Lisp_Object specifier, Lisp_Object locale) 953 face_boolean_after_change (Lisp_Object specifier, Lisp_Object locale)
998 998
999 DEFSUBR (Fcolor_specifier_p); 999 DEFSUBR (Fcolor_specifier_p);
1000 DEFSUBR (Ffont_specifier_p); 1000 DEFSUBR (Ffont_specifier_p);
1001 DEFSUBR (Fface_boolean_specifier_p); 1001 DEFSUBR (Fface_boolean_specifier_p);
1002 1002
1003 defsymbol (&Qcolor_instancep, "color-instance-p"); 1003 DEFSYMBOL_MULTIWORD_PREDICATE (Qcolor_instancep);
1004 DEFSUBR (Fmake_color_instance); 1004 DEFSUBR (Fmake_color_instance);
1005 DEFSUBR (Fcolor_instance_p); 1005 DEFSUBR (Fcolor_instance_p);
1006 DEFSUBR (Fcolor_instance_name); 1006 DEFSUBR (Fcolor_instance_name);
1007 DEFSUBR (Fcolor_instance_rgb_components); 1007 DEFSUBR (Fcolor_instance_rgb_components);
1008 DEFSUBR (Fvalid_color_name_p); 1008 DEFSUBR (Fvalid_color_name_p);
1009 1009
1010 defsymbol (&Qfont_instancep, "font-instance-p"); 1010 DEFSYMBOL_MULTIWORD_PREDICATE (Qfont_instancep);
1011 DEFSUBR (Fmake_font_instance); 1011 DEFSUBR (Fmake_font_instance);
1012 DEFSUBR (Ffont_instance_p); 1012 DEFSUBR (Ffont_instance_p);
1013 DEFSUBR (Ffont_instance_name); 1013 DEFSUBR (Ffont_instance_name);
1014 DEFSUBR (Ffont_instance_ascent); 1014 DEFSUBR (Ffont_instance_ascent);
1015 DEFSUBR (Ffont_instance_descent); 1015 DEFSUBR (Ffont_instance_descent);
1018 DEFSUBR (Ffont_instance_truename); 1018 DEFSUBR (Ffont_instance_truename);
1019 DEFSUBR (Ffont_instance_properties); 1019 DEFSUBR (Ffont_instance_properties);
1020 DEFSUBR (Flist_fonts); 1020 DEFSUBR (Flist_fonts);
1021 1021
1022 /* Qcolor, Qfont defined in general.c */ 1022 /* Qcolor, Qfont defined in general.c */
1023 defsymbol (&Qface_boolean, "face-boolean"); 1023 DEFSYMBOL (Qface_boolean);
1024 } 1024 }
1025 1025
1026 static const struct lrecord_description color_specifier_description[] = { 1026 static const struct lrecord_description color_specifier_description[] = {
1027 { XD_LISP_OBJECT, specifier_data_offset + offsetof (struct color_specifier, face) }, 1027 { XD_LISP_OBJECT, specifier_data_offset + offsetof (struct color_specifier, face) },
1028 { XD_LISP_OBJECT, specifier_data_offset + offsetof (struct color_specifier, face_property) }, 1028 { XD_LISP_OBJECT, specifier_data_offset + offsetof (struct color_specifier, face_property) },