diff src/event-stream.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 c69610198c35
children 5fd7ba8b56e7
line wrap: on
line diff
--- a/src/event-stream.c	Thu May 24 06:30:21 2001 +0000
+++ b/src/event-stream.c	Thu May 24 07:51:33 2001 +0000
@@ -102,6 +102,7 @@
 static Fixnum auto_save_interval;
 
 Lisp_Object Qundefined_keystroke_sequence;
+Lisp_Object Qinvalid_key_binding;
 
 Lisp_Object Qcommand_event_p;
 
@@ -414,20 +415,23 @@
       switch (op)
 	{
 	case EVENT_STREAM_PROCESS:
-	  error ("Can't start subprocesses in -batch mode");
+	  invalid_operation ("Can't start subprocesses in -batch mode",
+			     Qunbound);
 	case EVENT_STREAM_TIMEOUT:
-	  error ("Can't add timeouts in -batch mode");
+	  invalid_operation ("Can't add timeouts in -batch mode", Qunbound);
 	case EVENT_STREAM_CONSOLE:
-	  error ("Can't add consoles in -batch mode");
+	  invalid_operation ("Can't add consoles in -batch mode", Qunbound);
 	case EVENT_STREAM_READ:
-	  error ("Can't read events in -batch mode");
+	  invalid_operation ("Can't read events in -batch mode", Qunbound);
 	default:
 	  abort ();
 	}
     }
   else if (!event_stream)
     {
-      error ("event-stream callbacks not initialized (internal error?)");
+      invalid_operation
+	("event-stream callbacks not initialized (internal error?)",
+	 Qunbound);
     }
 }
 
@@ -1332,11 +1336,11 @@
   fsecs = XINT (secs);
 #endif
   if (fsecs < 0)
-    signal_simple_error ("timeout is negative", secs);
+    invalid_argument ("timeout is negative", secs);
   if (!allow_0 && fsecs == 0)
-    signal_simple_error ("timeout is non-positive", secs);
+    invalid_argument ("timeout is non-positive", secs);
   if (fsecs >= (((unsigned int) 0xFFFFFFFF) / 1000))
-    signal_simple_error
+    invalid_argument
       ("timeout would exceed 32 bits when represented in milliseconds", secs);
 
   return (unsigned long) (1000 * fsecs);
@@ -2081,7 +2085,8 @@
    * so we signal an error here.
    */
   if (in_menu_callback)
-    error ("Attempt to call next-event inside menu callback");
+    invalid_operation ("Attempt to call next-event inside menu callback",
+		       Qunbound);
 #endif /* LWLIB_MENUBARS_LUCID */
 
   if (NILP (event))
@@ -2119,7 +2124,7 @@
       if (!CONSP (Vunread_command_events))
 	{
 	  Vunread_command_events = Qnil;
-	  signal_error (Qwrong_type_argument,
+	  signal_error_1 (Qwrong_type_argument,
 			list3 (Qconsp, Vunread_command_events,
 			       Qunread_command_events));
 	}
@@ -2128,7 +2133,7 @@
 	  Lisp_Object e = XCAR (Vunread_command_events);
 	  Vunread_command_events = XCDR (Vunread_command_events);
 	  if (!EVENTP (e) || !command_event_p (e))
-	    signal_error (Qwrong_type_argument,
+	    signal_error_1 (Qwrong_type_argument,
 			  list3 (Qcommand_event_p, e, Qunread_command_events));
 	  redisplay ();
 	  if (!EQ (e, event))
@@ -2145,7 +2150,7 @@
 
       if (!EVENTP (e) || !command_event_p (e))
 	{
-	  signal_error (Qwrong_type_argument,
+	  signal_error_1 (Qwrong_type_argument,
 			list3 (Qeventp, e, Qunread_command_event));
 	}
       if (!EQ (e, event))
@@ -2235,7 +2240,7 @@
   if (XEVENT_TYPE (Vlast_input_event) == dead_event)
     {
       Vlast_input_event = Fmake_event (Qnil, Qnil);
-      error ("Someone deallocated last-input-event!");
+      invalid_state ("Someone deallocated last-input-event!", Qunbound);
     }
   if (! EQ (event, Vlast_input_event))
     Fcopy_event (event, Vlast_input_event);
@@ -3173,10 +3178,11 @@
 	  return result;
 	}
 
-      signal_simple_error ((munge == MUNGE_ME_FUNCTION_KEY ?
-			    "Invalid binding in function-key-map" :
-			    "Invalid binding in key-translation-map"),
-			   result);
+      signal_error (Qinvalid_key_binding,
+			 (munge == MUNGE_ME_FUNCTION_KEY ?
+			  "Invalid binding in function-key-map" :
+			  "Invalid binding in key-translation-map"),
+			 result);
     }
 
   return Qnil;
@@ -3438,7 +3444,7 @@
 
   CHECK_INT (size);
   if (XINT (size) <= 0)
-    error ("Recent keys ring size must be positive");
+    invalid_argument ("Recent keys ring size must be positive", size);
   if (XINT (size) == recent_keys_ring_size)
     return size;
 
@@ -3873,7 +3879,7 @@
   if (XEVENT (Vlast_command_event)->event_type == dead_event)
     {
       Vlast_command_event = Fmake_event (Qnil, Qnil);
-      error ("Someone deallocated the last-command-event!");
+      invalid_state ("Someone deallocated the last-command-event!", Qunbound);
     }
 
   if (! EQ (event, Vlast_command_event))
@@ -4445,7 +4451,7 @@
 		 O_WRONLY | O_TRUNC | O_CREAT | OPEN_BINARY,
 		 CREAT_MODE);
       if (fd < 0)
-	error ("Unable to create dribble file");
+	report_file_error ("Unable to create dribble file", filename);
       Vdribble_file = make_filedesc_output_stream (fd, 0, 0, LSTR_CLOSING);
 #ifdef MULE
       Vdribble_file =
@@ -4484,10 +4490,11 @@
   INIT_LRECORD_IMPLEMENTATION (command_builder);
   INIT_LRECORD_IMPLEMENTATION (timeout);
 
-  defsymbol (&Qdisabled, "disabled");
-  defsymbol (&Qcommand_event_p, "command-event-p");
-
-  DEFERROR_STANDARD (Qundefined_keystroke_sequence, Qinvalid_argument);
+  DEFSYMBOL (Qdisabled);
+  DEFSYMBOL (Qcommand_event_p);
+
+  DEFERROR_STANDARD (Qundefined_keystroke_sequence, Qsyntax_error);
+  DEFERROR_STANDARD (Qinvalid_key_binding, Qinvalid_state);
 
   DEFSUBR (Frecent_keys);
   DEFSUBR (Frecent_keys_ring_size);
@@ -4512,20 +4519,18 @@
   DEFSUBR (Fopen_dribble_file);
   DEFSUBR (Fcurrent_event_timestamp);
 
-  defsymbol (&Qpre_command_hook, "pre-command-hook");
-  defsymbol (&Qpost_command_hook, "post-command-hook");
-  defsymbol (&Qunread_command_events, "unread-command-events");
-  defsymbol (&Qunread_command_event, "unread-command-event");
-  defsymbol (&Qpre_idle_hook, "pre-idle-hook");
-  defsymbol (&Qhandle_pre_motion_command, "handle-pre-motion-command");
-  defsymbol (&Qhandle_post_motion_command, "handle-post-motion-command");
-  defsymbol (&Qretry_undefined_key_binding_unshifted,
-	     "retry-undefined-key-binding-unshifted");
-  defsymbol (&Qauto_show_make_point_visible,
-	     "auto-show-make-point-visible");
-
-  defsymbol (&Qself_insert_defer_undo, "self-insert-defer-undo");
-  defsymbol (&Qcancel_mode_internal, "cancel-mode-internal");
+  DEFSYMBOL (Qpre_command_hook);
+  DEFSYMBOL (Qpost_command_hook);
+  DEFSYMBOL (Qunread_command_events);
+  DEFSYMBOL (Qunread_command_event);
+  DEFSYMBOL (Qpre_idle_hook);
+  DEFSYMBOL (Qhandle_pre_motion_command);
+  DEFSYMBOL (Qhandle_post_motion_command);
+  DEFSYMBOL (Qretry_undefined_key_binding_unshifted);
+  DEFSYMBOL (Qauto_show_make_point_visible);
+
+  DEFSYMBOL (Qself_insert_defer_undo);
+  DEFSYMBOL (Qcancel_mode_internal);
 }
 
 void