diff src/process.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 fdefd0186b75
line wrap: on
line diff
--- a/src/process.c	Thu May 24 06:30:21 2001 +0000
+++ b/src/process.c	Thu May 24 07:51:33 2001 +0000
@@ -109,6 +109,9 @@
 extern Lisp_Object Vlisp_EXEC_SUFFIXES;
 Lisp_Object Vnull_device;
 
+Lisp_Object Qprocess_error;
+Lisp_Object Qnetwork_error;
+
 
 
 static Lisp_Object
@@ -138,8 +141,7 @@
   Lisp_Process *process = XPROCESS (object);
 
   if (print_readably)
-    error ("printing unreadable object #<process %s>",
-           XSTRING_DATA (process->name));
+    printing_unreadable_object ("#<process %s>", XSTRING_DATA (process->name));
 
   if (!escapeflag)
     {
@@ -342,7 +344,7 @@
       if (BUFFERP (buffer))
 	goto have_buffer_object;
 
-      error ("Process %s does not exist", XSTRING_DATA (name));
+      invalid_argument ("Process does not exist", name);
     }
   else if (NILP (name))
     {
@@ -359,8 +361,7 @@
       if (PROCESSP (process))
 	return process;
 
-      error ("Buffer %s has no process",
-	     XSTRING_DATA (XBUFFER (buffer)->name));
+      invalid_argument ("Buffer has no process", buffer);
     }
   else
     return get_process (Fsignal (Qwrong_type_argument,
@@ -414,6 +415,18 @@
 /*                          creating a process                          */
 /************************************************************************/
 
+DOESNT_RETURN
+report_process_error (const char *string, Lisp_Object data)
+{
+  report_error_with_errno (Qprocess_error, string, data);
+}
+
+DOESNT_RETURN
+report_network_error (const char *string, Lisp_Object data)
+{
+  report_error_with_errno (Qnetwork_error, string, data);
+}
+
 Lisp_Object
 make_process_internal (Lisp_Object name)
 {
@@ -469,11 +482,13 @@
 init_process_io_handles (Lisp_Process *p, void* in, void* out, int flags)
 {
   USID usid = event_stream_create_stream_pair (in, out,
-					       &p->pipe_instream, &p->pipe_outstream,
+					       &p->pipe_instream,
+					       &p->pipe_outstream,
 					       flags);
 
   if (usid == USID_ERROR)
-    report_file_error ("Setting up communication with subprocess", Qnil);
+    signal_error (Qprocess_error, "Setting up communication with subprocess",
+		  Qunbound);
 
   if (usid != USID_DONTHASH)
     {
@@ -587,8 +602,8 @@
   /* dmoore - if you re-enable this code, you have to gcprotect
      current_buffer through the above calls. */
   if (NILP (Ffile_accessible_directory_p (current_dir)))
-    report_file_error ("Setting current directory",
-		       list1 (current_buffer->directory));
+    signal_error (Qprocess_error, "Setting current directory",
+		  current_buffer->directory);
 #endif /* 0 */
 
   /* If program file name is not absolute, search our path for it */
@@ -602,7 +617,7 @@
       NGCPRO1 (tem);
       locate_file (Vexec_path, program, Vlisp_EXEC_SUFFIXES, &tem, X_OK);
       if (NILP (tem))
-	report_file_error ("Searching for program", list1 (program));
+	signal_error (Qprocess_error, "Searching for program", program);
       program = Fexpand_file_name (tem, Qnil);
       NUNGCPRO;
     }
@@ -617,7 +632,7 @@
       locate_file (list1 (build_string ("")), program, Vlisp_EXEC_SUFFIXES,
 		   &tem, X_OK);
       if (NILP (tem))
-	report_file_error ("Searching for program", list1 (program));
+	signal_error (Qprocess_error, "Searching for program", program);
       program = tem;
       NUNGCPRO;
     }
@@ -989,7 +1004,7 @@
   GCPRO2 (process, lstream);
 
   if (NILP (DATA_OUTSTREAM (XPROCESS (process))))
-    signal_simple_error ("Process not open for writing", process);
+    invalid_operation ("Process not open for writing", process);
 
   if (nonrelocatable)
     lstream =
@@ -1691,7 +1706,7 @@
 
 #undef handle_signal
 
-      error ("Undefined signal name %s", name);
+      invalid_constant ("Undefined signal name", signal_);
       return 0; /* Unreached */
     }
 }
@@ -1717,8 +1732,7 @@
   process = get_process (process);
 
   if (network_connection_p (process))
-    error ("Network connection %s is not a subprocess",
-	   XSTRING_DATA (XPROCESS(process)->name));
+    invalid_operation ("Network connection is not a subprocess", process);
   CHECK_LIVE_PROCESS (process);
 
   MAYBE_PROCMETH (kill_child_process, (process, signo, current_group, nomsg));
@@ -1764,7 +1778,9 @@
 #ifdef SIGKILL
   process_send_signal (process, SIGKILL, !NILP (current_group), 0);
 #else
-  error ("kill-process: Not supported on this system");
+  signal_error (Qunimplemented,
+		     "kill-process: Not supported on this system",
+		     Qunbound);
 #endif
   return process;
 }
@@ -1779,7 +1795,9 @@
 #ifdef SIGQUIT
   process_send_signal (process, SIGQUIT, !NILP (current_group), 0);
 #else
-  error ("quit-process: Not supported on this system");
+  signal_error (Qunimplemented,
+		     "quit-process: Not supported on this system",
+		     Qunbound);
 #endif
   return process;
 }
@@ -1794,7 +1812,9 @@
 #ifdef SIGTSTP
   process_send_signal (process, SIGTSTP, !NILP (current_group), 0);
 #else
-  error ("stop-process: Not supported on this system");
+  signal_error (Qunimplemented,
+		     "stop-process: Not supported on this system",
+		     Qunbound);
 #endif
   return process;
 }
@@ -1809,7 +1829,9 @@
 #ifdef SIGCONT
   process_send_signal (process, SIGCONT, !NILP (current_group), 0);
 #else
-  error ("continue-process: Not supported on this system");
+  signal_error (Qunimplemented,
+		     "continue-process: Not supported on this system",
+		     Qunbound);
 #endif
   return process;
 }
@@ -1844,7 +1866,7 @@
 
   /* Make sure the process is really alive.  */
   if (! EQ (XPROCESS (process)->status_symbol, Qrun))
-    error ("Process %s not running", XSTRING_DATA (XPROCESS (process)->name));
+    invalid_operation ("Process not running", process);
 
   if (!MAYBE_INT_PROCMETH (process_send_eof, (process)))
     {
@@ -2023,20 +2045,23 @@
 {
   INIT_LRECORD_IMPLEMENTATION (process);
 
-  defsymbol (&Qprocessp, "processp");
-  defsymbol (&Qprocess_live_p, "process-live-p");
-  defsymbol (&Qrun, "run");
-  defsymbol (&Qstop, "stop");
-  defsymbol (&Qopen, "open");
-  defsymbol (&Qclosed, "closed");
+  DEFSYMBOL (Qprocessp);
+  DEFSYMBOL (Qprocess_live_p);
+  DEFSYMBOL (Qrun);
+  DEFSYMBOL (Qstop);
+  DEFSYMBOL (Qopen);
+  DEFSYMBOL (Qclosed);
 
-  defsymbol (&Qtcp, "tcp");
-  defsymbol (&Qudp, "udp");
+  DEFSYMBOL (Qtcp);
+  DEFSYMBOL (Qudp);
 
 #ifdef HAVE_MULTICAST
-  defsymbol(&Qmulticast, "multicast"); /* Used for occasional warnings */
+  DEFSYMBOL (Qmulticast); /* Used for occasional warnings */
 #endif
 
+  DEFERROR_STANDARD (Qprocess_error, Qio_error);
+  DEFERROR_STANDARD (Qnetwork_error, Qio_error);
+
   DEFSUBR (Fprocessp);
   DEFSUBR (Fprocess_live_p);
   DEFSUBR (Fget_process);