diff src/fns.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 e7ef97881643
children d5e8f5ad5043
line wrap: on
line diff
--- a/src/fns.c	Thu May 24 06:30:21 2001 +0000
+++ b/src/fns.c	Thu May 24 07:51:33 2001 +0000
@@ -55,6 +55,8 @@
 Lisp_Object Qstring_lessp;
 Lisp_Object Qidentity;
 
+Lisp_Object Qbase64_conversion_error;
+
 static int internal_old_equal (Lisp_Object, Lisp_Object, int);
 Lisp_Object safe_copy_tree (Lisp_Object arg, Lisp_Object vecp, int depth);
 
@@ -205,8 +207,8 @@
 check_losing_bytecode (const char *function, Lisp_Object seq)
 {
   if (COMPILED_FUNCTIONP (seq))
-    error_with_frob
-      (seq,
+    signal_ferror_with_frob
+      (Qinvalid_argument, seq,
        "As of 20.3, `%s' no longer works with compiled-function objects",
        function);
 }
@@ -871,7 +873,7 @@
 safe_copy_tree (Lisp_Object arg, Lisp_Object vecp, int depth)
 {
   if (depth > 200)
-    signal_simple_error ("Stack overflow in copy-tree", arg);
+    stack_overflow ("Stack overflow in copy-tree", arg);
     
   if (CONSP (arg))
     {
@@ -2569,7 +2571,7 @@
   if (LRECORDP (object) && XRECORD_LHEADER_IMPLEMENTATION (object)->getprop)
     val = XRECORD_LHEADER_IMPLEMENTATION (object)->getprop (object, property);
   else
-    signal_simple_error ("Object type has no properties", object);
+    invalid_operation ("Object type has no properties", object);
 
   return UNBOUNDP (val) ? default_ : val;
 }
@@ -2591,10 +2593,10 @@
     {
       if (! XRECORD_LHEADER_IMPLEMENTATION (object)->putprop
 	  (object, property, value))
-	signal_simple_error ("Can't set property on object", property);
+	invalid_change ("Can't set property on object", property);
     }
   else
-    signal_simple_error ("Object type has no settable properties", object);
+    invalid_change ("Object type has no settable properties", object);
 
   return value;
 }
@@ -2615,10 +2617,10 @@
     {
       ret = XRECORD_LHEADER_IMPLEMENTATION (object)->remprop (object, property);
       if (ret == -1)
-	signal_simple_error ("Can't remove property from object", property);
+	invalid_change ("Can't remove property from object", property);
     }
   else
-    signal_simple_error ("Object type has no removable properties", object);
+    invalid_change ("Object type has no removable properties", object);
 
   return ret ? Qt : Qnil;
 }
@@ -2635,7 +2637,7 @@
   if (LRECORDP (object) && XRECORD_LHEADER_IMPLEMENTATION (object)->plist)
     return XRECORD_LHEADER_IMPLEMENTATION (object)->plist (object);
   else
-    signal_simple_error ("Object type has no properties", object);
+    invalid_operation ("Object type has no properties", object);
 
   return Qnil;
 }
@@ -2645,7 +2647,7 @@
 internal_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
 {
   if (depth > 200)
-    error ("Stack overflow in equal");
+    stack_overflow ("Stack overflow in equal", Qunbound);
   QUIT;
   if (EQ_WITH_EBOLA_NOTICE (obj1, obj2))
     return 1;
@@ -2675,7 +2677,7 @@
 internal_old_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
 {
   if (depth > 200)
-    error ("Stack overflow in equal");
+    stack_overflow ("Stack overflow in equal", Qunbound);
   QUIT;
   if (HACKEQ_UNSAFE (obj1, obj2))
     return 1;
@@ -3178,10 +3180,11 @@
   Lisp_Object ret = Qnil;
 
   if (loads == -2)
-    error ("load-average not implemented for this operating system");
+    signal_error (Qunimplemented,
+		  "load-average not implemented for this operating system",
+		  Qunbound);
   else if (loads < 0)
-    signal_simple_error ("Could not get load-average",
-			 lisp_strerror (errno));
+    invalid_operation ("Could not get load-average", lisp_strerror (errno));
 
   while (loads-- > 0)
     {
@@ -3349,8 +3352,7 @@
 
       tem = Fmemq (feature, Vfeatures);
       if (NILP (tem))
-	error ("Required feature %s was not provided",
-	       string_data (XSYMBOL (feature)->name));
+	invalid_state ("Required feature was not provided", feature);
 
       /* Once loading finishes, don't undo it.  */
       Vautoload_queue = Qt;
@@ -3419,11 +3421,17 @@
    The octets are divided into 6 bit chunks, which are then encoded into
    base64 characters.  */
 
-#define ADVANCE_INPUT(c, stream)				\
- ((ec = Lstream_get_emchar (stream)) == -1 ? 0 :		\
-  ((ec > 255) ?							\
-   (signal_simple_error ("Non-ascii character in base64 input",	\
-			 make_char (ec)), 0)			\
+DOESNT_RETURN
+base64_conversion_error (const char *reason, Lisp_Object frob)
+{
+  signal_error (Qbase64_conversion_error, reason, frob);
+}
+
+#define ADVANCE_INPUT(c, stream)					\
+ ((ec = Lstream_get_emchar (stream)) == -1 ? 0 :			\
+  ((ec > 255) ?								\
+   (base64_conversion_error ("Non-ascii character in base64 input",	\
+    make_char (ec)), 0)							\
    : (c = (Bufbyte)ec), 1))
 
 static Bytind
@@ -3518,33 +3526,37 @@
       if (ec < 0)
 	break;
       if (ec == '=')
-	signal_simple_error ("Illegal `=' character while decoding base64",
-			     make_int (streampos));
+	base64_conversion_error ("Illegal `=' character while decoding base64",
+		      make_int (streampos));
       value = base64_char_to_value[ec] << 18;
 
       /* Process second byte of a quadruplet.  */
       ADVANCE_INPUT_IGNORE_NONBASE64 (ec, istream, streampos);
       if (ec < 0)
-	error ("Premature EOF while decoding base64");
+	base64_conversion_error ("Premature EOF while decoding base64",
+				 Qunbound);
       if (ec == '=')
-	signal_simple_error ("Illegal `=' character while decoding base64",
-			     make_int (streampos));
+	base64_conversion_error ("Illegal `=' character while decoding base64",
+		      make_int (streampos));
       value |= base64_char_to_value[ec] << 12;
       STORE_BYTE (e, value >> 16, ccnt);
 
       /* Process third byte of a quadruplet.  */
       ADVANCE_INPUT_IGNORE_NONBASE64 (ec, istream, streampos);
       if (ec < 0)
-	error ("Premature EOF while decoding base64");
+	base64_conversion_error ("Premature EOF while decoding base64",
+				 Qunbound);
 
       if (ec == '=')
 	{
 	  ADVANCE_INPUT_IGNORE_NONBASE64 (ec, istream, streampos);
 	  if (ec < 0)
-	    error ("Premature EOF while decoding base64");
+	    base64_conversion_error ("Premature EOF while decoding base64",
+				     Qunbound);
 	  if (ec != '=')
-	    signal_simple_error ("Padding `=' expected but not found while decoding base64",
-				 make_int (streampos));
+	    base64_conversion_error
+	      ("Padding `=' expected but not found while decoding base64",
+	       make_int (streampos));
 	  continue;
 	}
 
@@ -3554,7 +3566,8 @@
       /* Process fourth byte of a quadruplet.  */
       ADVANCE_INPUT_IGNORE_NONBASE64 (ec, istream, streampos);
       if (ec < 0)
-	error ("Premature EOF while decoding base64");
+	base64_conversion_error ("Premature EOF while decoding base64",
+				 Qunbound);
       if (ec == '=')
 	continue;
 
@@ -3766,9 +3779,11 @@
 {
   INIT_LRECORD_IMPLEMENTATION (bit_vector);
 
-  defsymbol (&Qstring_lessp, "string-lessp");
-  defsymbol (&Qidentity, "identity");
-  defsymbol (&Qyes_or_no_p, "yes-or-no-p");
+  DEFSYMBOL (Qstring_lessp);
+  DEFSYMBOL (Qidentity);
+  DEFSYMBOL (Qyes_or_no_p);
+
+  DEFERROR_STANDARD (Qbase64_conversion_error, Qconversion_error);
 
   DEFSUBR (Fidentity);
   DEFSUBR (Frandom);