diff src/specifier.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 190b164ddcac
line wrap: on
line diff
--- a/src/specifier.c	Thu May 24 06:30:21 2001 +0000
+++ b/src/specifier.c	Thu May 24 07:51:33 2001 +0000
@@ -46,10 +46,6 @@
 
 Lisp_Object Qconsole_type, Qdevice_class;
 
-Lisp_Object Qspecifier_syntax_error;
-Lisp_Object Qspecifier_argument_error;
-Lisp_Object Qspecifier_change_error;
-
 static Lisp_Object Vuser_defined_tags;
 
 typedef struct specifier_type_entry specifier_type_entry;
@@ -274,8 +270,8 @@
   Lisp_Object the_specs;
 
   if (print_readably)
-    error ("printing unreadable object #<%s-specifier 0x%x>",
-	   sp->methods->name, sp->header.uid);
+    printing_unreadable_object ("#<%s-specifier 0x%x>",
+				sp->methods->name, sp->header.uid);
 
   sprintf (buf, "#<%s-specifier global=", sp->methods->name);
   write_c_string (buf, printcharfun);
@@ -433,7 +429,7 @@
 	return Dynarr_at (the_specifier_type_entry_dynarr, i).meths;
     }
 
-  maybe_signal_type_error (Qspecifier_argument_error, "Invalid specifier type",
+  maybe_invalid_argument ("Invalid specifier type",
 			   type, Qspecifier, errb);
 
   return 0;
@@ -678,8 +674,7 @@
       !NILP (Fvalid_specifier_locale_p (locale)) ||
       !NILP (Fvalid_specifier_locale_type_p (locale)))
     return;
-  signal_type_error (Qspecifier_argument_error,
-		     "Invalid specifier locale or locale type", locale);
+  invalid_argument ("Invalid specifier locale or locale type", locale);
 }
 
 DEFUN ("specifier-locale-type-from-locale", Fspecifier_locale_type_from_locale,
@@ -690,7 +685,7 @@
 {
   /* This cannot GC. */
   if (NILP (Fvalid_specifier_locale_p (locale)))
-    signal_type_error (Qspecifier_argument_error, "Invalid specifier locale",
+    invalid_argument ("Invalid specifier locale",
 		       locale);
   if (DEVICEP (locale)) return Qdevice;
   if (FRAMEP  (locale)) return Qframe;
@@ -709,7 +704,7 @@
   else if (!NILP (Fvalid_specifier_locale_p (locale)))
     return locale;
   else
-    signal_type_error (Qspecifier_argument_error, "Invalid specifier locale",
+    invalid_argument ("Invalid specifier locale",
 		       locale);
 
   return Qnil;
@@ -725,7 +720,7 @@
   if (EQ (locale_type, Qwindow)) return LOCALE_WINDOW;
   if (EQ (locale_type, Qbuffer)) return LOCALE_BUFFER;
 
-  signal_type_error (Qspecifier_argument_error, "Invalid specifier locale type",
+  invalid_argument ("Invalid specifier locale type",
 		     locale_type);
   return LOCALE_GLOBAL; /* not reached */
 }
@@ -762,7 +757,7 @@
 check_valid_domain (Lisp_Object domain)
 {
   if (NILP (Fvalid_specifier_domain_p (domain)))
-    signal_type_error (Qspecifier_argument_error, "Invalid specifier domain",
+    invalid_argument ("Invalid specifier domain",
 		       domain);
 }
 
@@ -839,7 +834,7 @@
   if (!NILP (Fvalid_specifier_tag_p (tag_set)))
     return list1 (tag_set);
   if (NILP (Fvalid_specifier_tag_set_p (tag_set)))
-    signal_type_error (Qspecifier_argument_error, "Invalid specifier tag-set",
+    invalid_argument ("Invalid specifier tag-set",
 		       tag_set);
   return tag_set;
 }
@@ -903,7 +898,7 @@
        (tag_set))
 {
   if (NILP (Fvalid_specifier_tag_set_p (tag_set)))
-    signal_type_error (Qspecifier_argument_error, "Invalid tag set", tag_set);
+    invalid_argument ("Invalid tag set", tag_set);
   return canonicalize_tag_set (tag_set);
 }
 
@@ -945,7 +940,7 @@
   CHECK_LIVE_DEVICE (device);
 
   if (NILP (Fvalid_specifier_tag_set_p (tag_set)))
-    signal_type_error (Qspecifier_argument_error, "Invalid tag set", tag_set);
+    invalid_argument ("Invalid tag set", tag_set);
 
   return device_matches_specifier_tag_set_p (device, tag_set) ? Qt : Qnil;
 }
@@ -968,13 +963,11 @@
   CHECK_SYMBOL (tag);
   if (valid_device_class_p (tag) ||
       valid_console_type_p (tag))
-    signal_type_error (Qspecifier_change_error,
-		       "Cannot redefine built-in specifier tags", tag);
+    invalid_change ("Cannot redefine built-in specifier tags", tag);
   /* Try to prevent common instantiators and locales from being
      redefined, to reduce ambiguity */
   if (NILP (tag) || EQ (tag, Qt) || EQ (tag, Qall) || EQ (tag, Qglobal))
-    signal_type_error (Qspecifier_change_error, "Cannot define nil, t, 'all, or 'global",
-		       tag);
+    invalid_change ("Cannot define nil, t, 'all, or 'global", tag);
   assoc = assq_no_quit (tag, Vuser_defined_tags);
   if (NILP (assoc))
     {
@@ -1104,7 +1097,7 @@
   CHECK_SYMBOL (tag);
 
   if (NILP (Fvalid_specifier_tag_p (tag)))
-    signal_type_error (Qspecifier_argument_error, "Invalid specifier tag",
+    invalid_argument ("Invalid specifier tag",
 		       tag);
 
   /* Make up some predicates for the built-in types */
@@ -1232,21 +1225,21 @@
 
       if (!CONSP (rest))
 	{
-	  maybe_signal_type_error (Qspecifier_syntax_error,
+	  maybe_sferror (
 				   "Invalid instantiator list", inst_list,
 				     Qspecifier, errb);
 	  return Qnil;
 	}
       if (!CONSP (inst_pair = XCAR (rest)))
 	{
-	  maybe_signal_type_error (Qspecifier_syntax_error,
+	  maybe_sferror (
 				   "Invalid instantiator pair", inst_pair,
 				     Qspecifier, errb);
 	  return Qnil;
 	}
       if (NILP (Fvalid_specifier_tag_set_p (tag_set = XCAR (inst_pair))))
 	{
-	  maybe_signal_type_error (Qspecifier_syntax_error,
+	  maybe_invalid_argument (
 				   "Invalid specifier tag", tag_set,
 				     Qspecifier, errb);
 	  return Qnil;
@@ -1290,14 +1283,14 @@
       Lisp_Object spec, locale;
       if (!CONSP (rest) || !CONSP (spec = XCAR (rest)))
 	{
-	  maybe_signal_type_error (Qspecifier_syntax_error,
+	  maybe_sferror (
 				   "Invalid specification list", spec_list,
 				     Qspecifier, errb);
 	  return Qnil;
 	}
       if (NILP (Fvalid_specifier_locale_p (locale = XCAR (spec))))
 	{
-	  maybe_signal_type_error (Qspecifier_syntax_error,
+	  maybe_invalid_argument (
 				   "Invalid specifier locale", locale,
 				     Qspecifier, errb);
 	  return Qnil;
@@ -1348,8 +1341,7 @@
   if (EQ (Qremove_all, how_to_add))
     return SPEC_REMOVE_ALL;
 
-  signal_type_error (Qspecifier_argument_error, "Invalid `how-to-add' flag",
-		     how_to_add);
+  invalid_constant ("Invalid `how-to-add' flag", how_to_add);
 
   return SPEC_PREPEND;		/* not reached */
 }
@@ -1373,9 +1365,9 @@
 {
   if (NILP (Vunlock_ghost_specifiers)
       && GHOST_SPECIFIER_P (XSPECIFIER (spec)))
-    signal_type_error (Qspecifier_change_error,
-		       "Attempt to modify read-only specifier",
-			 list1 (spec));
+    signal_error (Qsetting_constant,
+		  "Attempt to modify read-only specifier",
+		  spec);
 }
 
 /* Helper function which unwind protects the value of
@@ -2332,7 +2324,7 @@
       CHECK_SPECIFIER (dest);
       check_modifiable_specifier (dest);
       if (XSPECIFIER (dest)->methods != XSPECIFIER (specifier)->methods)
-	error ("Specifiers not of same type");
+ invalid_argument ("Specifiers not of same type", Qunbound);
     }
 
   cl.dest = dest;
@@ -2390,7 +2382,7 @@
     }
   else
     {
-      maybe_signal_simple_error
+      maybe_sferror
 	("Matchspecs not allowed for this specifier type",
 	 intern (meths->name), Qspecifier, errb);
       return Qnil;
@@ -2597,7 +2589,9 @@
   depth = make_int (1 + XINT (depth));
   if (XINT (depth) > 20)
     {
-      maybe_error (Qspecifier, errb, "Apparent loop in specifier inheritance");
+      maybe_signal_error (Qstack_overflow,
+			  "Apparent loop in specifier inheritance",
+			  Qunbound, Qspecifier, errb);
       /* The specification is fucked; at least try the fallback
 	 (which better not be fucked, because it's not changeable
 	 from Lisp). */
@@ -3119,8 +3113,7 @@
 boolean_validate (Lisp_Object instantiator)
 {
   if (!EQ (instantiator, Qt) && !EQ (instantiator, Qnil))
-    signal_type_error (Qspecifier_argument_error, "Must be t or nil",
-		       instantiator);
+    invalid_constant ("Must be t or nil", instantiator);
 }
 
 DEFUN ("boolean-specifier-p", Fboolean_specifier_p, 1, 1, 0, /*
@@ -3261,10 +3254,6 @@
   DEFSYMBOL (Qremove_tag_set_append);
   DEFSYMBOL (Qremove_locale);
   DEFSYMBOL (Qremove_locale_type);
-
-  DEFERROR_STANDARD (Qspecifier_syntax_error, Qsyntax_error);
-  DEFERROR_STANDARD (Qspecifier_argument_error, Qinvalid_argument);
-  DEFERROR_STANDARD (Qspecifier_change_error, Qinvalid_change);
 }
 
 void