Mercurial > hg > xemacs-beta
comparison src/events.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 | 7039e6323819 |
children | b39c14581166 |
comparison
equal
deleted
inserted
replaced
562:c775bd016b32 | 563:183866b06e0b |
---|---|
141 | 141 |
142 static void | 142 static void |
143 print_event (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) | 143 print_event (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) |
144 { | 144 { |
145 if (print_readably) | 145 if (print_readably) |
146 error ("Printing unreadable object #<event>"); | 146 printing_unreadable_object ("#<event>"); |
147 | 147 |
148 switch (XEVENT (obj)->event_type) | 148 switch (XEVENT (obj)->event_type) |
149 { | 149 { |
150 case key_press_event: | 150 case key_press_event: |
151 print_event_1 ("#<keypress-event ", obj, printcharfun); | 151 print_event_1 ("#<keypress-event ", obj, printcharfun); |
456 PLIST. In fact, processing PLIST would be wrong, because the | 456 PLIST. In fact, processing PLIST would be wrong, because the |
457 sanitizing process would fill in the properties | 457 sanitizing process would fill in the properties |
458 (e.g. CHANNEL), which we don't want in empty events. */ | 458 (e.g. CHANNEL), which we don't want in empty events. */ |
459 e->event_type = empty_event; | 459 e->event_type = empty_event; |
460 if (!NILP (plist)) | 460 if (!NILP (plist)) |
461 syntax_error ("Cannot set properties of empty event", plist); | 461 invalid_operation ("Cannot set properties of empty event", plist); |
462 UNGCPRO; | 462 UNGCPRO; |
463 return event; | 463 return event; |
464 } | 464 } |
465 else if (EQ (type, Qkey_press)) | 465 else if (EQ (type, Qkey_press)) |
466 { | 466 { |
479 e->event.eval.function = e->event.eval.object = Qnil; | 479 e->event.eval.function = e->event.eval.object = Qnil; |
480 } | 480 } |
481 else | 481 else |
482 { | 482 { |
483 /* Not allowed: Qprocess, Qtimeout, Qmagic, Qeval, Qmagic_eval. */ | 483 /* Not allowed: Qprocess, Qtimeout, Qmagic, Qeval, Qmagic_eval. */ |
484 invalid_argument ("Invalid event type", type); | 484 invalid_constant ("Invalid event type", type); |
485 } | 485 } |
486 | 486 |
487 EVENT_CHANNEL (e) = Qnil; | 487 EVENT_CHANNEL (e) = Qnil; |
488 | 488 |
489 plist = Fcopy_sequence (plist); | 489 plist = Fcopy_sequence (plist); |
490 Fcanonicalize_plist (plist, Qnil); | 490 Fcanonicalize_plist (plist, Qnil); |
491 | 491 |
492 #define WRONG_EVENT_TYPE_FOR_PROPERTY(event_type, prop) \ | 492 #define WRONG_EVENT_TYPE_FOR_PROPERTY(event_type, prop) \ |
493 syntax_error_2 ("Invalid property for event type", prop, event_type) | 493 invalid_argument_2 ("Invalid property for event type", prop, event_type) |
494 | 494 |
495 { | 495 { |
496 EXTERNAL_PROPERTY_LIST_LOOP_3 (keyword, value, plist) | 496 EXTERNAL_PROPERTY_LIST_LOOP_3 (keyword, value, plist) |
497 { | 497 { |
498 if (EQ (keyword, Qchannel)) | 498 if (EQ (keyword, Qchannel)) |
513 { | 513 { |
514 switch (e->event_type) | 514 switch (e->event_type) |
515 { | 515 { |
516 case key_press_event: | 516 case key_press_event: |
517 if (!SYMBOLP (value) && !CHARP (value)) | 517 if (!SYMBOLP (value) && !CHARP (value)) |
518 syntax_error ("Invalid event key", value); | 518 invalid_argument ("Invalid event key", value); |
519 e->event.key.keysym = value; | 519 e->event.key.keysym = value; |
520 break; | 520 break; |
521 default: | 521 default: |
522 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); | 522 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); |
523 break; | 523 break; |
559 else if (EQ (sym, Qbutton2)) modifiers |= XEMACS_MOD_BUTTON2; | 559 else if (EQ (sym, Qbutton2)) modifiers |= XEMACS_MOD_BUTTON2; |
560 else if (EQ (sym, Qbutton3)) modifiers |= XEMACS_MOD_BUTTON3; | 560 else if (EQ (sym, Qbutton3)) modifiers |= XEMACS_MOD_BUTTON3; |
561 else if (EQ (sym, Qbutton4)) modifiers |= XEMACS_MOD_BUTTON4; | 561 else if (EQ (sym, Qbutton4)) modifiers |= XEMACS_MOD_BUTTON4; |
562 else if (EQ (sym, Qbutton5)) modifiers |= XEMACS_MOD_BUTTON5; | 562 else if (EQ (sym, Qbutton5)) modifiers |= XEMACS_MOD_BUTTON5; |
563 else | 563 else |
564 syntax_error ("Invalid key modifier", sym); | 564 invalid_constant ("Invalid key modifier", sym); |
565 } | 565 } |
566 | 566 |
567 switch (e->event_type) | 567 switch (e->event_type) |
568 { | 568 { |
569 case key_press_event: | 569 case key_press_event: |
647 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); | 647 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); |
648 break; | 648 break; |
649 } | 649 } |
650 } | 650 } |
651 else | 651 else |
652 syntax_error_2 ("Invalid property", keyword, value); | 652 invalid_constant_2 ("Invalid property", keyword, value); |
653 } | 653 } |
654 } | 654 } |
655 | 655 |
656 /* Insert the channel, if missing. */ | 656 /* Insert the channel, if missing. */ |
657 if (NILP (EVENT_CHANNEL (e))) | 657 if (NILP (EVENT_CHANNEL (e))) |
692 /* Finally, do some more validation. */ | 692 /* Finally, do some more validation. */ |
693 switch (e->event_type) | 693 switch (e->event_type) |
694 { | 694 { |
695 case key_press_event: | 695 case key_press_event: |
696 if (UNBOUNDP (e->event.key.keysym)) | 696 if (UNBOUNDP (e->event.key.keysym)) |
697 syntax_error ("A key must be specified to make a keypress event", | 697 sferror ("A key must be specified to make a keypress event", |
698 plist); | 698 plist); |
699 break; | 699 break; |
700 case button_press_event: | 700 case button_press_event: |
701 if (!e->event.button.button) | 701 if (!e->event.button.button) |
702 syntax_error | 702 sferror |
703 ("A button must be specified to make a button-press event", | 703 ("A button must be specified to make a button-press event", |
704 plist); | 704 plist); |
705 break; | 705 break; |
706 case button_release_event: | 706 case button_release_event: |
707 if (!e->event.button.button) | 707 if (!e->event.button.button) |
708 syntax_error | 708 sferror |
709 ("A button must be specified to make a button-release event", | 709 ("A button must be specified to make a button-release event", |
710 plist); | 710 plist); |
711 break; | 711 break; |
712 case misc_user_event: | 712 case misc_user_event: |
713 if (NILP (e->event.misc.function)) | 713 if (NILP (e->event.misc.function)) |
714 syntax_error ("A function must be specified to make a misc-user event", | 714 sferror ("A function must be specified to make a misc-user event", |
715 plist); | 715 plist); |
716 break; | 716 break; |
717 default: | 717 default: |
718 break; | 718 break; |
719 } | 719 } |
733 (event)) | 733 (event)) |
734 { | 734 { |
735 CHECK_EVENT (event); | 735 CHECK_EVENT (event); |
736 | 736 |
737 if (XEVENT_TYPE (event) == dead_event) | 737 if (XEVENT_TYPE (event) == dead_event) |
738 error ("this event is already deallocated!"); | 738 invalid_argument ("this event is already deallocated!", Qunbound); |
739 | 739 |
740 assert (XEVENT_TYPE (event) <= last_event_type); | 740 assert (XEVENT_TYPE (event) <= last_event_type); |
741 | 741 |
742 #if 0 | 742 #if 0 |
743 { | 743 { |
785 event2 = Fmake_event (Qnil, Qnil); | 785 event2 = Fmake_event (Qnil, Qnil); |
786 else | 786 else |
787 { | 787 { |
788 CHECK_LIVE_EVENT (event2); | 788 CHECK_LIVE_EVENT (event2); |
789 if (EQ (event1, event2)) | 789 if (EQ (event1, event2)) |
790 return signal_simple_continuable_error_2 | 790 return signal_continuable_error_2 |
791 ("copy-event called with `eq' events", event1, event2); | 791 (Qinvalid_argument, |
792 "copy-event called with `eq' events", event1, event2); | |
792 } | 793 } |
793 | 794 |
794 assert (XEVENT_TYPE (event1) <= last_event_type); | 795 assert (XEVENT_TYPE (event1) <= last_event_type); |
795 assert (XEVENT_TYPE (event2) <= last_event_type); | 796 assert (XEVENT_TYPE (event2) <= last_event_type); |
796 | 797 |
986 int use_console_meta_flag, int do_backspace_mapping) | 987 int use_console_meta_flag, int do_backspace_mapping) |
987 { | 988 { |
988 Lisp_Object k = Qnil; | 989 Lisp_Object k = Qnil; |
989 int m = 0; | 990 int m = 0; |
990 if (event->event_type == dead_event) | 991 if (event->event_type == dead_event) |
991 error ("character-to-event called with a deallocated event!"); | 992 invalid_argument ("character-to-event called with a deallocated event!", Qunbound); |
992 | 993 |
993 #ifndef MULE | 994 #ifndef MULE |
994 c &= 255; | 995 c &= 255; |
995 #endif | 996 #endif |
996 if (c > 127 && c <= 255) | 997 if (c > 127 && c <= 255) |
1413 | 1414 |
1414 EVENT_CHAIN_LOOP (ev, XEVENT_NEXT (event)) | 1415 EVENT_CHAIN_LOOP (ev, XEVENT_NEXT (event)) |
1415 { | 1416 { |
1416 QUIT; | 1417 QUIT; |
1417 if (EQ (ev, event)) | 1418 if (EQ (ev, event)) |
1418 signal_error (Qerror, | 1419 invalid_operation_2 ("Cyclic event-next", event, next_event); |
1419 list3 (build_string ("Cyclic event-next"), | |
1420 event, | |
1421 next_event)); | |
1422 } | 1420 } |
1423 XSET_EVENT_NEXT (event, next_event); | 1421 XSET_EVENT_NEXT (event, next_event); |
1424 return next_event; | 1422 return next_event; |
1425 } | 1423 } |
1426 | 1424 |
2321 DEFSUBR (Fevent_toolbar_button); | 2319 DEFSUBR (Fevent_toolbar_button); |
2322 DEFSUBR (Fevent_process); | 2320 DEFSUBR (Fevent_process); |
2323 DEFSUBR (Fevent_function); | 2321 DEFSUBR (Fevent_function); |
2324 DEFSUBR (Fevent_object); | 2322 DEFSUBR (Fevent_object); |
2325 | 2323 |
2326 defsymbol (&Qeventp, "eventp"); | 2324 DEFSYMBOL (Qeventp); |
2327 defsymbol (&Qevent_live_p, "event-live-p"); | 2325 DEFSYMBOL (Qevent_live_p); |
2328 defsymbol (&Qkey_press_event_p, "key-press-event-p"); | 2326 DEFSYMBOL (Qkey_press_event_p); |
2329 defsymbol (&Qbutton_event_p, "button-event-p"); | 2327 DEFSYMBOL (Qbutton_event_p); |
2330 defsymbol (&Qmouse_event_p, "mouse-event-p"); | 2328 DEFSYMBOL (Qmouse_event_p); |
2331 defsymbol (&Qprocess_event_p, "process-event-p"); | 2329 DEFSYMBOL (Qprocess_event_p); |
2332 defsymbol (&Qkey_press, "key-press"); | 2330 DEFSYMBOL (Qkey_press); |
2333 defsymbol (&Qbutton_press, "button-press"); | 2331 DEFSYMBOL (Qbutton_press); |
2334 defsymbol (&Qbutton_release, "button-release"); | 2332 DEFSYMBOL (Qbutton_release); |
2335 defsymbol (&Qmisc_user, "misc-user"); | 2333 DEFSYMBOL (Qmisc_user); |
2336 defsymbol (&Qascii_character, "ascii-character"); | 2334 DEFSYMBOL (Qascii_character); |
2337 | 2335 |
2338 defsymbol (&QKbackspace, "backspace"); | 2336 defsymbol (&QKbackspace, "backspace"); |
2339 defsymbol (&QKtab, "tab"); | 2337 defsymbol (&QKtab, "tab"); |
2340 defsymbol (&QKlinefeed, "linefeed"); | 2338 defsymbol (&QKlinefeed, "linefeed"); |
2341 defsymbol (&QKreturn, "return"); | 2339 defsymbol (&QKreturn, "return"); |