comparison src/gui.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 d7a9135ec789
children 9cdcb214753f
comparison
equal deleted inserted replaced
562:c775bd016b32 563:183866b06e0b
36 Lisp_Object Qmenu_no_selection_hook; 36 Lisp_Object Qmenu_no_selection_hook;
37 Lisp_Object Vmenu_no_selection_hook; 37 Lisp_Object Vmenu_no_selection_hook;
38 38
39 static Lisp_Object parse_gui_item_tree_list (Lisp_Object list); 39 static Lisp_Object parse_gui_item_tree_list (Lisp_Object list);
40 Lisp_Object find_keyword_in_vector (Lisp_Object vector, Lisp_Object keyword); 40 Lisp_Object find_keyword_in_vector (Lisp_Object vector, Lisp_Object keyword);
41
42 Lisp_Object Qgui_error;
41 43
42 #ifdef HAVE_POPUPS 44 #ifdef HAVE_POPUPS
43 45
44 /* count of menus/dboxes currently up */ 46 /* count of menus/dboxes currently up */
45 int popup_up_p; 47 int popup_up_p;
119 { 121 {
120 Lisp_Gui_Item *pgui_item = XGUI_ITEM (gui_item); 122 Lisp_Gui_Item *pgui_item = XGUI_ITEM (gui_item);
121 int retval = 0; 123 int retval = 0;
122 124
123 if (!KEYWORDP (key)) 125 if (!KEYWORDP (key))
124 syntax_error_2 ("Non-keyword in gui item", key, pgui_item->name); 126 sferror_2 ("Non-keyword in gui item", key, pgui_item->name);
125 127
126 if (EQ (key, Q_descriptor)) 128 if (EQ (key, Q_descriptor))
127 { 129 {
128 if (!EQ (pgui_item->name, val)) 130 if (!EQ (pgui_item->name, val))
129 { 131 {
160 { 162 {
161 retval = 1; 163 retval = 1;
162 if (SYMBOLP (val) || CHARP (val)) 164 if (SYMBOLP (val) || CHARP (val))
163 pgui_item->accelerator = val; 165 pgui_item->accelerator = val;
164 else if (ERRB_EQ (errb, ERROR_ME)) 166 else if (ERRB_EQ (errb, ERROR_ME))
165 syntax_error ("Bad keyboard accelerator", val); 167 invalid_argument ("Bad keyboard accelerator", val);
166 } 168 }
167 } 169 }
168 else if (ERRB_EQ (errb, ERROR_ME)) 170 else if (ERRB_EQ (errb, ERROR_ME))
169 syntax_error_2 ("Unknown keyword in gui item", key, 171 invalid_argument_2 ("Unknown keyword in gui item", key,
170 pgui_item->name); 172 pgui_item->name);
171 return retval; 173 return retval;
172 } 174 }
173 175
174 void 176 void
222 CHECK_VECTOR (item); 224 CHECK_VECTOR (item);
223 length = XVECTOR_LENGTH (item); 225 length = XVECTOR_LENGTH (item);
224 contents = XVECTOR_DATA (item); 226 contents = XVECTOR_DATA (item);
225 227
226 if (length < 1) 228 if (length < 1)
227 syntax_error ("GUI item descriptors must be at least 1 elts long", item); 229 sferror ("GUI item descriptors must be at least 1 elts long", item);
228 230
229 /* length 1: [ "name" ] 231 /* length 1: [ "name" ]
230 length 2: [ "name" callback ] 232 length 2: [ "name" callback ]
231 length 3: [ "name" callback active-p ] 233 length 3: [ "name" callback active-p ]
232 or [ "name" keyword value ] 234 or [ "name" keyword value ]
257 else 259 else
258 /* the new way */ 260 /* the new way */
259 { 261 {
260 int i; 262 int i;
261 if ((length - start) & 1) 263 if ((length - start) & 1)
262 syntax_error ( 264 sferror (
263 "GUI item descriptor has an odd number of keywords and values", 265 "GUI item descriptor has an odd number of keywords and values",
264 item); 266 item);
265 267
266 for (i = start; i < length;) 268 for (i = start; i < length;)
267 { 269 {
285 CHECK_VECTOR (item); 287 CHECK_VECTOR (item);
286 length = XVECTOR_LENGTH (item); 288 length = XVECTOR_LENGTH (item);
287 contents = XVECTOR_DATA (item); 289 contents = XVECTOR_DATA (item);
288 290
289 if (!NILP (desc) && !STRINGP (desc) && !VECTORP (desc)) 291 if (!NILP (desc) && !STRINGP (desc) && !VECTORP (desc))
290 syntax_error ("Invalid GUI item descriptor", item); 292 sferror ("Invalid GUI item descriptor", item);
291 293
292 if (length & 1) 294 if (length & 1)
293 { 295 {
294 if (!SYMBOLP (contents [0])) 296 if (!SYMBOLP (contents [0]))
295 syntax_error ("Invalid GUI item descriptor", item); 297 sferror ("Invalid GUI item descriptor", item);
296 contents++; /* Ignore the leading symbol. */ 298 contents++; /* Ignore the leading symbol. */
297 length--; 299 length--;
298 } 300 }
299 301
300 for (i = 0; i < length;) 302 for (i = 0; i < length;)
319 contents = XVECTOR_DATA (item); 321 contents = XVECTOR_DATA (item);
320 322
321 if (length & 1) 323 if (length & 1)
322 { 324 {
323 if (!SYMBOLP (contents [0])) 325 if (!SYMBOLP (contents [0]))
324 syntax_error ("Invalid GUI item descriptor", item); 326 sferror ("Invalid GUI item descriptor", item);
325 contents++; /* Ignore the leading symbol. */ 327 contents++; /* Ignore the leading symbol. */
326 length--; 328 length--;
327 } 329 }
328 330
329 for (i = 0; i < length;) 331 for (i = 0; i < length;)
484 } 486 }
485 487
486 static DOESNT_RETURN 488 static DOESNT_RETURN
487 signal_too_long_error (Lisp_Object name) 489 signal_too_long_error (Lisp_Object name)
488 { 490 {
489 syntax_error ("GUI item produces too long displayable string", name); 491 invalid_argument ("GUI item produces too long displayable string", name);
490 } 492 }
491 493
492 #ifdef HAVE_WINDOW_SYSTEM 494 #ifdef HAVE_WINDOW_SYSTEM
493 /* 495 /*
494 * Format "left flush" display portion of an item into BUF, guarded by 496 * Format "left flush" display portion of an item into BUF, guarded by
697 { 699 {
698 Lisp_Gui_Item *g = XGUI_ITEM (obj); 700 Lisp_Gui_Item *g = XGUI_ITEM (obj);
699 char buf[20]; 701 char buf[20];
700 702
701 if (print_readably) 703 if (print_readably)
702 error ("printing unreadable object #<gui-item 0x%x>", g->header.uid); 704 printing_unreadable_object ("#<gui-item 0x%x>", g->header.uid);
703 705
704 write_c_string ("#<gui-item ", printcharfun); 706 write_c_string ("#<gui-item ", printcharfun);
705 sprintf (buf, "0x%x>", g->header.uid); 707 sprintf (buf, "0x%x>", g->header.uid);
706 write_c_string (buf, printcharfun); 708 write_c_string (buf, printcharfun);
707 } 709 }
769 else if (STRINGP (entry)) 771 else if (STRINGP (entry))
770 { 772 {
771 CHECK_STRING (entry); 773 CHECK_STRING (entry);
772 } 774 }
773 else 775 else
774 syntax_error ("item must be a vector or a string", entry); 776 sferror ("item must be a vector or a string", entry);
775 777
776 RETURN_UNGCPRO (ret); 778 RETURN_UNGCPRO (ret);
777 } 779 }
778 780
779 Lisp_Object 781 Lisp_Object
821 finalize_gui_item, gui_item_equal, 823 finalize_gui_item, gui_item_equal,
822 gui_item_hash, 824 gui_item_hash,
823 0, 825 0,
824 Lisp_Gui_Item); 826 Lisp_Gui_Item);
825 827
828
829 DOESNT_RETURN
830 gui_error (const char *reason, Lisp_Object frob)
831 {
832 signal_error (Qgui_error, reason, frob);
833 }
834
826 void 835 void
827 syms_of_gui (void) 836 syms_of_gui (void)
828 { 837 {
829 INIT_LRECORD_IMPLEMENTATION (gui_item); 838 INIT_LRECORD_IMPLEMENTATION (gui_item);
830 839
831 DEFSYMBOL (Qmenu_no_selection_hook); 840 DEFSYMBOL (Qmenu_no_selection_hook);
841
842 DEFERROR_STANDARD (Qgui_error, Qio_error);
832 843
833 #ifdef HAVE_POPUPS 844 #ifdef HAVE_POPUPS
834 DEFSUBR (Fpopup_up_p); 845 DEFSUBR (Fpopup_up_p);
835 #endif 846 #endif
836 } 847 }