comparison src/eval.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 666d73d6ac56
children 190b164ddcac
comparison
equal deleted inserted replaced
562:c775bd016b32 563:183866b06e0b
1 /* Evaluator for XEmacs Lisp interpreter. 1 /* Evaluator for XEmacs Lisp interpreter.
2 Copyright (C) 1985-1987, 1992-1994 Free Software Foundation, Inc. 2 Copyright (C) 1985-1987, 1992-1994 Free Software Foundation, Inc.
3 Copyright (C) 1995 Sun Microsystems, Inc. 3 Copyright (C) 1995 Sun Microsystems, Inc.
4 Copyright (C) 2000 Ben Wing. 4 Copyright (C) 2000, 2001 Ben Wing.
5 5
6 This file is part of XEmacs. 6 This file is part of XEmacs.
7 7
8 XEmacs is free software; you can redistribute it and/or modify it 8 XEmacs is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the 9 under the terms of the GNU General Public License as published by the
288 (subr->max_args == UNEVALLED) ? "#<special-form " : "#<subr "; 288 (subr->max_args == UNEVALLED) ? "#<special-form " : "#<subr ";
289 const char *name = subr_name (subr); 289 const char *name = subr_name (subr);
290 const char *trailer = subr->prompt ? " (interactive)>" : ">"; 290 const char *trailer = subr->prompt ? " (interactive)>" : ">";
291 291
292 if (print_readably) 292 if (print_readably)
293 error ("printing unreadable object %s%s%s", header, name, trailer); 293 printing_unreadable_object ("%s%s%s", header, name, trailer);
294 294
295 write_c_string (header, printcharfun); 295 write_c_string (header, printcharfun);
296 write_c_string (name, printcharfun); 296 write_c_string (name, printcharfun);
297 write_c_string (trailer, printcharfun); 297 write_c_string (trailer, printcharfun);
298 } 298 }
864 else 864 else
865 { 865 {
866 CHECK_CONS (tem); 866 CHECK_CONS (tem);
867 value = Feval (XCAR (tem)); 867 value = Feval (XCAR (tem));
868 if (!NILP (XCDR (tem))) 868 if (!NILP (XCDR (tem)))
869 signal_simple_error 869 sferror
870 ("`let' bindings can have only one value-form", var); 870 ("`let' bindings can have only one value-form", var);
871 } 871 }
872 } 872 }
873 specbind (symbol, value); 873 specbind (symbol, value);
874 } 874 }
922 CHECK_CONS (tem); 922 CHECK_CONS (tem);
923 *value = Feval (XCAR (tem)); 923 *value = Feval (XCAR (tem));
924 gcpro1.nvars = idx; 924 gcpro1.nvars = idx;
925 925
926 if (!NILP (XCDR (tem))) 926 if (!NILP (XCDR (tem)))
927 signal_simple_error 927 sferror
928 ("`let' bindings can have only one value-form", var); 928 ("`let' bindings can have only one value-form", var);
929 } 929 }
930 } 930 }
931 } 931 }
932 } 932 }
1094 if (!NILP (args = XCDR (args))) 1094 if (!NILP (args = XCDR (args)))
1095 { 1095 {
1096 Lisp_Object doc = XCAR (args); 1096 Lisp_Object doc = XCAR (args);
1097 Fput (sym, Qvariable_documentation, doc); 1097 Fput (sym, Qvariable_documentation, doc);
1098 if (!NILP (args = XCDR (args))) 1098 if (!NILP (args = XCDR (args)))
1099 error ("too many arguments"); 1099 signal_error (Qwrong_number_of_arguments, "too many arguments", Qunbound);
1100 } 1100 }
1101 } 1101 }
1102 1102
1103 #ifdef I18N3 1103 #ifdef I18N3
1104 if (!NILP (Vfile_domain)) 1104 if (!NILP (Vfile_domain))
1142 if (!NILP (args = XCDR (args))) 1142 if (!NILP (args = XCDR (args)))
1143 { 1143 {
1144 Lisp_Object doc = XCAR (args); 1144 Lisp_Object doc = XCAR (args);
1145 Fput (sym, Qvariable_documentation, doc); 1145 Fput (sym, Qvariable_documentation, doc);
1146 if (!NILP (args = XCDR (args))) 1146 if (!NILP (args = XCDR (args)))
1147 error ("too many arguments"); 1147 signal_error (Qwrong_number_of_arguments, "too many arguments", Qunbound);
1148 } 1148 }
1149 1149
1150 #ifdef I18N3 1150 #ifdef I18N3
1151 if (!NILP (Vfile_domain)) 1151 if (!NILP (Vfile_domain))
1152 Fput (sym, Qvariable_domain, Vfile_domain); 1152 Fput (sym, Qvariable_domain, Vfile_domain);
1718 } 1718 }
1719 } 1719 }
1720 else 1720 else
1721 { 1721 {
1722 invalid_condition_handler: 1722 invalid_condition_handler:
1723 signal_simple_error ("Invalid condition handler", handler); 1723 sferror ("Invalid condition handler", handler);
1724 } 1724 }
1725 } 1725 }
1726 1726
1727 CHECK_SYMBOL (var); 1727 CHECK_SYMBOL (var);
1728 1728
1837 /* Have called debugger; return value to signaller */ 1837 /* Have called debugger; return value to signaller */
1838 return value; 1838 return value;
1839 #else /* But the reality is that that stinks, because: */ 1839 #else /* But the reality is that that stinks, because: */
1840 /* GACK!!! Really want some way for debug-on-quit errors 1840 /* GACK!!! Really want some way for debug-on-quit errors
1841 to be continuable!! */ 1841 to be continuable!! */
1842 error ("Returning a value from an error is no longer supported"); 1842 signal_error (Qunimplemented,
1843 "Returning a value from an error is no longer supported",
1844 Qunbound);
1843 #endif 1845 #endif
1844 } 1846 }
1845 1847
1846 extern int in_display; 1848 extern int in_display;
1847 1849
2015 /* Class 1: General functions that signal an error. 2017 /* Class 1: General functions that signal an error.
2016 These functions take an error type and a list of associated error 2018 These functions take an error type and a list of associated error
2017 data. */ 2019 data. */
2018 2020
2019 /* The simplest external error function: it would be called 2021 /* The simplest external error function: it would be called
2020 signal_continuable_error() in the terminology below, but it's 2022 signal_continuable_error_1() in the terminology below, but it's
2021 Lisp-callable. */ 2023 Lisp-callable. */
2022 2024
2023 DEFUN ("signal", Fsignal, 2, 2, 0, /* 2025 DEFUN ("signal", Fsignal, 2, 2, 0, /*
2024 Signal a continuable error. Args are ERROR-SYMBOL, and associated DATA. 2026 Signal a continuable error. Args are ERROR-SYMBOL, and associated DATA.
2025 An error symbol is a symbol defined using `define-error'. 2027 An error symbol is a symbol defined using `define-error'.
2053 } 2055 }
2054 2056
2055 /* Signal a non-continuable error. */ 2057 /* Signal a non-continuable error. */
2056 2058
2057 DOESNT_RETURN 2059 DOESNT_RETURN
2058 signal_error (Lisp_Object sig, Lisp_Object data) 2060 signal_error_1 (Lisp_Object sig, Lisp_Object data)
2059 { 2061 {
2060 for (;;) 2062 for (;;)
2061 Fsignal (sig, data); 2063 Fsignal (sig, data);
2062 } 2064 }
2063 #ifdef ERROR_CHECK_TYPECHECK 2065 #ifdef ERROR_CHECK_TYPECHECK
2219 according to ERRB. CLASS is the class of warning and should 2221 according to ERRB. CLASS is the class of warning and should
2220 refer to what sort of operation is being done (e.g. Qtoolbar, 2222 refer to what sort of operation is being done (e.g. Qtoolbar,
2221 Qresource, etc.). */ 2223 Qresource, etc.). */
2222 2224
2223 void 2225 void
2224 maybe_signal_error (Lisp_Object sig, Lisp_Object data, Lisp_Object class, 2226 maybe_signal_error_1 (Lisp_Object sig, Lisp_Object data, Lisp_Object class,
2225 Error_behavior errb) 2227 Error_behavior errb)
2226 { 2228 {
2227 if (ERRB_EQ (errb, ERROR_ME_NOT)) 2229 if (ERRB_EQ (errb, ERROR_ME_NOT))
2228 return; 2230 return;
2229 else if (ERRB_EQ (errb, ERROR_ME_WARN)) 2231 else if (ERRB_EQ (errb, ERROR_ME_WARN))
2230 warn_when_safe_lispobj (class, Qwarning, Fcons (sig, data)); 2232 warn_when_safe_lispobj (class, Qwarning, Fcons (sig, data));
2235 2237
2236 /* Signal a continuable error or display a warning or do nothing, 2238 /* Signal a continuable error or display a warning or do nothing,
2237 according to ERRB. */ 2239 according to ERRB. */
2238 2240
2239 Lisp_Object 2241 Lisp_Object
2240 maybe_signal_continuable_error (Lisp_Object sig, Lisp_Object data, 2242 maybe_signal_continuable_error_1 (Lisp_Object sig, Lisp_Object data,
2241 Lisp_Object class, Error_behavior errb) 2243 Lisp_Object class, Error_behavior errb)
2242 { 2244 {
2243 if (ERRB_EQ (errb, ERROR_ME_NOT)) 2245 if (ERRB_EQ (errb, ERROR_ME_NOT))
2244 return Qnil; 2246 return Qnil;
2245 else if (ERRB_EQ (errb, ERROR_ME_WARN)) 2247 else if (ERRB_EQ (errb, ERROR_ME_WARN))
2246 { 2248 {
2252 } 2254 }
2253 2255
2254 2256
2255 /****************** Error functions class 2 ******************/ 2257 /****************** Error functions class 2 ******************/
2256 2258
2257 /* Class 2: Printf-like functions that signal an error. 2259 /* Class 2: Signal an error with a string and an associated object.
2260 Normally these functions are used to attach one associated object,
2261 but to attach no objects, specify Qunbound for FROB, and for more
2262 than one object, make a list of the objects with Qunbound as the
2263 first element. (If you have specifically two objects to attach,
2264 consider using the function in class 3 below.) These functions
2265 signal an error of a specified type, whose data is one or more
2266 objects (usually two), a string the related Lisp object(s)
2267 specified as FROB. */
2268
2269 /* Out of REASON and FROB, return a list of elements suitable for passing
2270 to signal_error_1(). */
2271
2272 Lisp_Object
2273 build_error_data (const char *reason, Lisp_Object frob)
2274 {
2275 if (EQ (frob, Qunbound))
2276 frob = Qnil;
2277 else if (CONSP (frob) && EQ (XCAR (frob), Qunbound))
2278 frob = XCDR (frob);
2279 else
2280 frob = list1 (frob);
2281 if (!reason)
2282 return frob;
2283 else
2284 return Fcons (build_translated_string (reason), frob);
2285 }
2286
2287 DOESNT_RETURN
2288 signal_error (Lisp_Object type, const char *reason, Lisp_Object frob)
2289 {
2290 signal_error_1 (type, build_error_data (reason, frob));
2291 }
2292
2293 void
2294 maybe_signal_error (Lisp_Object type, const char *reason,
2295 Lisp_Object frob, Lisp_Object class,
2296 Error_behavior errb)
2297 {
2298 /* Optimization: */
2299 if (ERRB_EQ (errb, ERROR_ME_NOT))
2300 return;
2301 maybe_signal_error_1 (type, build_error_data (reason, frob), class, errb);
2302 }
2303
2304 Lisp_Object
2305 signal_continuable_error (Lisp_Object type, const char *reason,
2306 Lisp_Object frob)
2307 {
2308 return Fsignal (type, build_error_data (reason, frob));
2309 }
2310
2311 Lisp_Object
2312 maybe_signal_continuable_error (Lisp_Object type, const char *reason,
2313 Lisp_Object frob, Lisp_Object class,
2314 Error_behavior errb)
2315 {
2316 /* Optimization: */
2317 if (ERRB_EQ (errb, ERROR_ME_NOT))
2318 return Qnil;
2319 return maybe_signal_continuable_error_1 (type,
2320 build_error_data (reason, frob),
2321 class, errb);
2322 }
2323
2324
2325 /****************** Error functions class 3 ******************/
2326
2327 /* Class 3: Signal an error with a string and two associated objects.
2328 These functions signal an error of a specified type, whose data
2329 is three objects, a string and two related Lisp objects.
2330 (The equivalent could be accomplished using the class 2 functions,
2331 but these are more convenient in this particular case.) */
2332
2333 DOESNT_RETURN
2334 signal_error_2 (Lisp_Object type, const char *reason,
2335 Lisp_Object frob0, Lisp_Object frob1)
2336 {
2337 signal_error_1 (type, list3 (build_translated_string (reason), frob0,
2338 frob1));
2339 }
2340
2341 void
2342 maybe_signal_error_2 (Lisp_Object type, const char *reason,
2343 Lisp_Object frob0, Lisp_Object frob1,
2344 Lisp_Object class, Error_behavior errb)
2345 {
2346 /* Optimization: */
2347 if (ERRB_EQ (errb, ERROR_ME_NOT))
2348 return;
2349 maybe_signal_error_1 (type, list3 (build_translated_string (reason), frob0,
2350 frob1), class, errb);
2351 }
2352
2353 Lisp_Object
2354 signal_continuable_error_2 (Lisp_Object type, const char *reason,
2355 Lisp_Object frob0, Lisp_Object frob1)
2356 {
2357 return Fsignal (type, list3 (build_translated_string (reason), frob0,
2358 frob1));
2359 }
2360
2361 Lisp_Object
2362 maybe_signal_continuable_error_2 (Lisp_Object type, const char *reason,
2363 Lisp_Object frob0, Lisp_Object frob1,
2364 Lisp_Object class, Error_behavior errb)
2365 {
2366 /* Optimization: */
2367 if (ERRB_EQ (errb, ERROR_ME_NOT))
2368 return Qnil;
2369 return maybe_signal_continuable_error_1
2370 (type, list3 (build_translated_string (reason), frob0, frob1),
2371 class, errb);
2372 }
2373
2374
2375 /****************** Error functions class 4 ******************/
2376
2377 /* Class 4: Printf-like functions that signal an error.
2258 These functions signal an error of a specified type, whose data 2378 These functions signal an error of a specified type, whose data
2259 is a single string, created using the arguments. */ 2379 is a single string, created using the arguments. */
2260 2380
2261 /* dump an error message; called like printf */
2262
2263 DOESNT_RETURN 2381 DOESNT_RETURN
2264 type_error (Lisp_Object type, const char *fmt, ...) 2382 signal_ferror (Lisp_Object type, const char *fmt, ...)
2265 { 2383 {
2266 Lisp_Object obj; 2384 Lisp_Object obj;
2267 va_list args; 2385 va_list args;
2268 2386
2269 va_start (args, fmt); 2387 va_start (args, fmt);
2270 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1, 2388 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
2271 args); 2389 args);
2272 va_end (args); 2390 va_end (args);
2273 2391
2274 /* Fsignal GC-protects its args */ 2392 /* Fsignal GC-protects its args */
2275 signal_error (type, list1 (obj)); 2393 signal_error (type, 0, obj);
2276 } 2394 }
2277 2395
2278 void 2396 void
2279 maybe_type_error (Lisp_Object type, Lisp_Object class, Error_behavior errb, 2397 maybe_signal_ferror (Lisp_Object type, Lisp_Object class, Error_behavior errb,
2280 const char *fmt, ...) 2398 const char *fmt, ...)
2281 { 2399 {
2282 Lisp_Object obj; 2400 Lisp_Object obj;
2283 va_list args; 2401 va_list args;
2284 2402
2285 /* Optimization: */ 2403 /* Optimization: */
2290 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1, 2408 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
2291 args); 2409 args);
2292 va_end (args); 2410 va_end (args);
2293 2411
2294 /* Fsignal GC-protects its args */ 2412 /* Fsignal GC-protects its args */
2295 maybe_signal_error (type, list1 (obj), class, errb); 2413 maybe_signal_error (type, 0, obj, class, errb);
2296 } 2414 }
2297 2415
2298 Lisp_Object 2416 Lisp_Object
2299 continuable_type_error (Lisp_Object type, const char *fmt, ...) 2417 signal_continuable_ferror (Lisp_Object type, const char *fmt, ...)
2300 { 2418 {
2301 Lisp_Object obj; 2419 Lisp_Object obj;
2302 va_list args; 2420 va_list args;
2303 2421
2304 va_start (args, fmt); 2422 va_start (args, fmt);
2309 /* Fsignal GC-protects its args */ 2427 /* Fsignal GC-protects its args */
2310 return Fsignal (type, list1 (obj)); 2428 return Fsignal (type, list1 (obj));
2311 } 2429 }
2312 2430
2313 Lisp_Object 2431 Lisp_Object
2314 maybe_continuable_type_error (Lisp_Object type, Lisp_Object class, 2432 maybe_signal_continuable_ferror (Lisp_Object type, Lisp_Object class,
2315 Error_behavior errb, const char *fmt, ...) 2433 Error_behavior errb, const char *fmt, ...)
2316 { 2434 {
2317 Lisp_Object obj; 2435 Lisp_Object obj;
2318 va_list args; 2436 va_list args;
2319 2437
2320 /* Optimization: */ 2438 /* Optimization: */
2325 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1, 2443 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
2326 args); 2444 args);
2327 va_end (args); 2445 va_end (args);
2328 2446
2329 /* Fsignal GC-protects its args */ 2447 /* Fsignal GC-protects its args */
2330 return maybe_signal_continuable_error (type, list1 (obj), class, errb); 2448 return maybe_signal_continuable_error (type, 0, obj, class, errb);
2331 } 2449 }
2332 2450
2333 2451
2334 /****************** Error functions class 3 ******************/ 2452 /****************** Error functions class 5 ******************/
2335 2453
2336 /* Class 3: Signal an error with a string and an associated object. 2454 /* Class 5: Printf-like functions that signal an error.
2337 These functions signal an error of a specified type, whose data 2455 These functions signal an error of a specified type, whose data
2338 is two objects, a string and a related Lisp object (usually the object 2456 is a one or more objects, a string (created using the arguments)
2339 where the error is occurring). */ 2457 and additional Lisp objects specified in FROB. (The syntax of FROB
2458 is the same as for class 2.)
2459
2460 There is no need for a class 6 because you can always attach 2
2461 objects using class 5 (for FROB, specify a list with three
2462 elements, the first of which is Qunbound), and these functions are
2463 not commonly used.
2464 */
2340 2465
2341 DOESNT_RETURN 2466 DOESNT_RETURN
2342 signal_type_error (Lisp_Object type, const char *reason, Lisp_Object frob) 2467 signal_ferror_with_frob (Lisp_Object type, Lisp_Object frob, const char *fmt,
2343 { 2468 ...)
2344 if (UNBOUNDP (frob))
2345 signal_error (type, list1 (build_translated_string (reason)));
2346 else
2347 signal_error (type, list2 (build_translated_string (reason), frob));
2348 }
2349
2350 void
2351 maybe_signal_type_error (Lisp_Object type, const char *reason,
2352 Lisp_Object frob, Lisp_Object class,
2353 Error_behavior errb)
2354 {
2355 /* Optimization: */
2356 if (ERRB_EQ (errb, ERROR_ME_NOT))
2357 return;
2358 maybe_signal_error (type, list2 (build_translated_string (reason), frob),
2359 class, errb);
2360 }
2361
2362 Lisp_Object
2363 signal_type_continuable_error (Lisp_Object type, const char *reason,
2364 Lisp_Object frob)
2365 {
2366 return Fsignal (type, list2 (build_translated_string (reason), frob));
2367 }
2368
2369 Lisp_Object
2370 maybe_signal_type_continuable_error (Lisp_Object type, const char *reason,
2371 Lisp_Object frob, Lisp_Object class,
2372 Error_behavior errb)
2373 {
2374 /* Optimization: */
2375 if (ERRB_EQ (errb, ERROR_ME_NOT))
2376 return Qnil;
2377 return maybe_signal_continuable_error
2378 (type, list2 (build_translated_string (reason),
2379 frob), class, errb);
2380 }
2381
2382
2383 /****************** Error functions class 4 ******************/
2384
2385 /* Class 4: Printf-like functions that signal an error.
2386 These functions signal an error of a specified type, whose data
2387 is a two objects, a string (created using the arguments) and a
2388 Lisp object.
2389 */
2390
2391 DOESNT_RETURN
2392 type_error_with_frob (Lisp_Object type, Lisp_Object frob, const char *fmt, ...)
2393 { 2469 {
2394 Lisp_Object obj; 2470 Lisp_Object obj;
2395 va_list args; 2471 va_list args;
2396 2472
2397 va_start (args, fmt); 2473 va_start (args, fmt);
2398 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1, 2474 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
2399 args); 2475 args);
2400 va_end (args); 2476 va_end (args);
2401 2477
2402 /* Fsignal GC-protects its args */ 2478 /* Fsignal GC-protects its args */
2403 signal_error (type, list2 (obj, frob)); 2479 signal_error_1 (type, Fcons (obj, build_error_data (0, frob)));
2404 } 2480 }
2405 2481
2406 void 2482 void
2407 maybe_type_error_with_frob (Lisp_Object type, Lisp_Object frob, 2483 maybe_signal_ferror_with_frob (Lisp_Object type, Lisp_Object frob,
2408 Lisp_Object class, Error_behavior errb, 2484 Lisp_Object class, Error_behavior errb,
2409 const char *fmt, ...) 2485 const char *fmt, ...)
2410 { 2486 {
2411 Lisp_Object obj; 2487 Lisp_Object obj;
2412 va_list args; 2488 va_list args;
2413 2489
2414 /* Optimization: */ 2490 /* Optimization: */
2419 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1, 2495 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
2420 args); 2496 args);
2421 va_end (args); 2497 va_end (args);
2422 2498
2423 /* Fsignal GC-protects its args */ 2499 /* Fsignal GC-protects its args */
2424 maybe_signal_error (type, list2 (obj, frob), class, errb); 2500 maybe_signal_error_1 (type, Fcons (obj, build_error_data (0, frob)), class,
2501 errb);
2425 } 2502 }
2426 2503
2427 Lisp_Object 2504 Lisp_Object
2428 continuable_type_error_with_frob (Lisp_Object type, Lisp_Object frob, 2505 signal_continuable_ferror_with_frob (Lisp_Object type, Lisp_Object frob,
2429 const char *fmt, ...) 2506 const char *fmt, ...)
2430 { 2507 {
2431 Lisp_Object obj; 2508 Lisp_Object obj;
2432 va_list args; 2509 va_list args;
2433 2510
2434 va_start (args, fmt); 2511 va_start (args, fmt);
2435 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1, 2512 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
2436 args); 2513 args);
2437 va_end (args); 2514 va_end (args);
2438 2515
2439 /* Fsignal GC-protects its args */ 2516 /* Fsignal GC-protects its args */
2440 return Fsignal (type, list2 (obj, frob)); 2517 return Fsignal (type, Fcons (obj, build_error_data (0, frob)));
2441 } 2518 }
2442 2519
2443 Lisp_Object 2520 Lisp_Object
2444 maybe_continuable_type_error_with_frob (Lisp_Object type, Lisp_Object frob, 2521 maybe_signal_continuable_ferror_with_frob (Lisp_Object type, Lisp_Object frob,
2445 Lisp_Object class, Error_behavior errb, 2522 Lisp_Object class,
2446 const char *fmt, ...) 2523 Error_behavior errb,
2524 const char *fmt, ...)
2447 { 2525 {
2448 Lisp_Object obj; 2526 Lisp_Object obj;
2449 va_list args; 2527 va_list args;
2450 2528
2451 /* Optimization: */ 2529 /* Optimization: */
2456 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1, 2534 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
2457 args); 2535 args);
2458 va_end (args); 2536 va_end (args);
2459 2537
2460 /* Fsignal GC-protects its args */ 2538 /* Fsignal GC-protects its args */
2461 return maybe_signal_continuable_error (type, list2 (obj, frob), 2539 return maybe_signal_continuable_error_1 (type,
2462 class, errb); 2540 Fcons (obj,
2463 } 2541 build_error_data (0, frob)),
2464 2542 class, errb);
2465
2466 /****************** Error functions class 5 ******************/
2467
2468 /* Class 5: Signal an error with a string and two associated objects.
2469 These functions signal an error of a specified type, whose data
2470 is three objects, a string and two related Lisp objects. */
2471
2472 DOESNT_RETURN
2473 signal_type_error_2 (Lisp_Object type, const char *reason,
2474 Lisp_Object frob0, Lisp_Object frob1)
2475 {
2476 signal_error (type, list3 (build_translated_string (reason), frob0,
2477 frob1));
2478 }
2479
2480 void
2481 maybe_signal_type_error_2 (Lisp_Object type, const char *reason,
2482 Lisp_Object frob0, Lisp_Object frob1,
2483 Lisp_Object class, Error_behavior errb)
2484 {
2485 /* Optimization: */
2486 if (ERRB_EQ (errb, ERROR_ME_NOT))
2487 return;
2488 maybe_signal_error (type, list3 (build_translated_string (reason), frob0,
2489 frob1), class, errb);
2490 }
2491
2492
2493 Lisp_Object
2494 signal_type_continuable_error_2 (Lisp_Object type, const char *reason,
2495 Lisp_Object frob0, Lisp_Object frob1)
2496 {
2497 return Fsignal (type, list3 (build_translated_string (reason), frob0,
2498 frob1));
2499 }
2500
2501 Lisp_Object
2502 maybe_signal_type_continuable_error_2 (Lisp_Object type, const char *reason,
2503 Lisp_Object frob0, Lisp_Object frob1,
2504 Lisp_Object class, Error_behavior errb)
2505 {
2506 /* Optimization: */
2507 if (ERRB_EQ (errb, ERROR_ME_NOT))
2508 return Qnil;
2509 return maybe_signal_continuable_error
2510 (type, list3 (build_translated_string (reason), frob0,
2511 frob1),
2512 class, errb);
2513 }
2514
2515
2516 /****************** Simple error functions class 2 ******************/
2517
2518 /* Simple class 2: Printf-like functions that signal an error.
2519 These functions signal an error of type Qerror, whose data
2520 is a single string, created using the arguments. */
2521
2522 /* dump an error message; called like printf */
2523
2524 DOESNT_RETURN
2525 error (const char *fmt, ...)
2526 {
2527 Lisp_Object obj;
2528 va_list args;
2529
2530 va_start (args, fmt);
2531 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
2532 args);
2533 va_end (args);
2534
2535 /* Fsignal GC-protects its args */
2536 signal_error (Qerror, list1 (obj));
2537 }
2538
2539 void
2540 maybe_error (Lisp_Object class, Error_behavior errb, const char *fmt, ...)
2541 {
2542 Lisp_Object obj;
2543 va_list args;
2544
2545 /* Optimization: */
2546 if (ERRB_EQ (errb, ERROR_ME_NOT))
2547 return;
2548
2549 va_start (args, fmt);
2550 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
2551 args);
2552 va_end (args);
2553
2554 /* Fsignal GC-protects its args */
2555 maybe_signal_error (Qerror, list1 (obj), class, errb);
2556 }
2557
2558 Lisp_Object
2559 continuable_error (const char *fmt, ...)
2560 {
2561 Lisp_Object obj;
2562 va_list args;
2563
2564 va_start (args, fmt);
2565 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
2566 args);
2567 va_end (args);
2568
2569 /* Fsignal GC-protects its args */
2570 return Fsignal (Qerror, list1 (obj));
2571 }
2572
2573 Lisp_Object
2574 maybe_continuable_error (Lisp_Object class, Error_behavior errb,
2575 const char *fmt, ...)
2576 {
2577 Lisp_Object obj;
2578 va_list args;
2579
2580 /* Optimization: */
2581 if (ERRB_EQ (errb, ERROR_ME_NOT))
2582 return Qnil;
2583
2584 va_start (args, fmt);
2585 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
2586 args);
2587 va_end (args);
2588
2589 /* Fsignal GC-protects its args */
2590 return maybe_signal_continuable_error (Qerror, list1 (obj), class, errb);
2591 }
2592
2593
2594 /****************** Simple error functions class 3 ******************/
2595
2596 /* Simple class 3: Signal an error with a string and an associated object.
2597 These functions signal an error of type Qerror, whose data
2598 is two objects, a string and a related Lisp object (usually the object
2599 where the error is occurring). */
2600
2601 DOESNT_RETURN
2602 signal_simple_error (const char *reason, Lisp_Object frob)
2603 {
2604 signal_error (Qerror, list2 (build_translated_string (reason), frob));
2605 }
2606
2607 void
2608 maybe_signal_simple_error (const char *reason, Lisp_Object frob,
2609 Lisp_Object class, Error_behavior errb)
2610 {
2611 /* Optimization: */
2612 if (ERRB_EQ (errb, ERROR_ME_NOT))
2613 return;
2614 maybe_signal_error (Qerror, list2 (build_translated_string (reason), frob),
2615 class, errb);
2616 }
2617
2618 Lisp_Object
2619 signal_simple_continuable_error (const char *reason, Lisp_Object frob)
2620 {
2621 return Fsignal (Qerror, list2 (build_translated_string (reason), frob));
2622 }
2623
2624 Lisp_Object
2625 maybe_signal_simple_continuable_error (const char *reason, Lisp_Object frob,
2626 Lisp_Object class, Error_behavior errb)
2627 {
2628 /* Optimization: */
2629 if (ERRB_EQ (errb, ERROR_ME_NOT))
2630 return Qnil;
2631 return maybe_signal_continuable_error
2632 (Qerror, list2 (build_translated_string (reason),
2633 frob), class, errb);
2634 }
2635
2636
2637 /****************** Simple error functions class 4 ******************/
2638
2639 /* Simple class 4: Printf-like functions that signal an error.
2640 These functions signal an error of type Qerror, whose data
2641 is a two objects, a string (created using the arguments) and a
2642 Lisp object.
2643 */
2644
2645 DOESNT_RETURN
2646 error_with_frob (Lisp_Object frob, const char *fmt, ...)
2647 {
2648 Lisp_Object obj;
2649 va_list args;
2650
2651 va_start (args, fmt);
2652 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
2653 args);
2654 va_end (args);
2655
2656 /* Fsignal GC-protects its args */
2657 signal_error (Qerror, list2 (obj, frob));
2658 }
2659
2660 void
2661 maybe_error_with_frob (Lisp_Object frob, Lisp_Object class,
2662 Error_behavior errb, const char *fmt, ...)
2663 {
2664 Lisp_Object obj;
2665 va_list args;
2666
2667 /* Optimization: */
2668 if (ERRB_EQ (errb, ERROR_ME_NOT))
2669 return;
2670
2671 va_start (args, fmt);
2672 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
2673 args);
2674 va_end (args);
2675
2676 /* Fsignal GC-protects its args */
2677 maybe_signal_error (Qerror, list2 (obj, frob), class, errb);
2678 }
2679
2680 Lisp_Object
2681 continuable_error_with_frob (Lisp_Object frob, const char *fmt, ...)
2682 {
2683 Lisp_Object obj;
2684 va_list args;
2685
2686 va_start (args, fmt);
2687 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
2688 args);
2689 va_end (args);
2690
2691 /* Fsignal GC-protects its args */
2692 return Fsignal (Qerror, list2 (obj, frob));
2693 }
2694
2695 Lisp_Object
2696 maybe_continuable_error_with_frob (Lisp_Object frob, Lisp_Object class,
2697 Error_behavior errb, const char *fmt, ...)
2698 {
2699 Lisp_Object obj;
2700 va_list args;
2701
2702 /* Optimization: */
2703 if (ERRB_EQ (errb, ERROR_ME_NOT))
2704 return Qnil;
2705
2706 va_start (args, fmt);
2707 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
2708 args);
2709 va_end (args);
2710
2711 /* Fsignal GC-protects its args */
2712 return maybe_signal_continuable_error (Qerror, list2 (obj, frob),
2713 class, errb);
2714 }
2715
2716
2717 /****************** Simple error functions class 5 ******************/
2718
2719 /* Simple class 5: Signal an error with a string and two associated objects.
2720 These functions signal an error of type Qerror, whose data
2721 is three objects, a string and two related Lisp objects. */
2722
2723 DOESNT_RETURN
2724 signal_simple_error_2 (const char *reason,
2725 Lisp_Object frob0, Lisp_Object frob1)
2726 {
2727 signal_error (Qerror, list3 (build_translated_string (reason), frob0,
2728 frob1));
2729 }
2730
2731 void
2732 maybe_signal_simple_error_2 (const char *reason, Lisp_Object frob0,
2733 Lisp_Object frob1, Lisp_Object class,
2734 Error_behavior errb)
2735 {
2736 /* Optimization: */
2737 if (ERRB_EQ (errb, ERROR_ME_NOT))
2738 return;
2739 maybe_signal_error (Qerror, list3 (build_translated_string (reason), frob0,
2740 frob1), class, errb);
2741 }
2742
2743
2744 Lisp_Object
2745 signal_simple_continuable_error_2 (const char *reason, Lisp_Object frob0,
2746 Lisp_Object frob1)
2747 {
2748 return Fsignal (Qerror, list3 (build_translated_string (reason), frob0,
2749 frob1));
2750 }
2751
2752 Lisp_Object
2753 maybe_signal_simple_continuable_error_2 (const char *reason, Lisp_Object frob0,
2754 Lisp_Object frob1, Lisp_Object class,
2755 Error_behavior errb)
2756 {
2757 /* Optimization: */
2758 if (ERRB_EQ (errb, ERROR_ME_NOT))
2759 return Qnil;
2760 return maybe_signal_continuable_error
2761 (Qerror, list3 (build_translated_string (reason), frob0,
2762 frob1),
2763 class, errb);
2764 } 2543 }
2765 2544
2766 2545
2767 /* This is what the QUIT macro calls to signal a quit */ 2546 /* This is what the QUIT macro calls to signal a quit */
2768 void 2547 void
2775 /* note that this is continuable. */ 2554 /* note that this is continuable. */
2776 Fsignal (Qquit, Qnil); 2555 Fsignal (Qquit, Qnil);
2777 } 2556 }
2778 2557
2779 2558
2780 /* Used in core lisp functions for efficiency */ 2559 /************************ convenience error functions ***********************/
2560
2781 Lisp_Object 2561 Lisp_Object
2782 signal_void_function_error (Lisp_Object function) 2562 signal_void_function_error (Lisp_Object function)
2783 { 2563 {
2784 return Fsignal (Qvoid_function, list1 (function)); 2564 return Fsignal (Qvoid_function, list1 (function));
2785 } 2565 }
2799 2579
2800 /* Used in list traversal macros for efficiency. */ 2580 /* Used in list traversal macros for efficiency. */
2801 DOESNT_RETURN 2581 DOESNT_RETURN
2802 signal_malformed_list_error (Lisp_Object list) 2582 signal_malformed_list_error (Lisp_Object list)
2803 { 2583 {
2804 signal_error (Qmalformed_list, list1 (list)); 2584 signal_error (Qmalformed_list, 0, list);
2805 } 2585 }
2806 2586
2807 DOESNT_RETURN 2587 DOESNT_RETURN
2808 signal_malformed_property_list_error (Lisp_Object list) 2588 signal_malformed_property_list_error (Lisp_Object list)
2809 { 2589 {
2810 signal_error (Qmalformed_property_list, list1 (list)); 2590 signal_error (Qmalformed_property_list, 0, list);
2811 } 2591 }
2812 2592
2813 DOESNT_RETURN 2593 DOESNT_RETURN
2814 signal_circular_list_error (Lisp_Object list) 2594 signal_circular_list_error (Lisp_Object list)
2815 { 2595 {
2816 signal_error (Qcircular_list, list1 (list)); 2596 signal_error (Qcircular_list, 0, list);
2817 } 2597 }
2818 2598
2819 DOESNT_RETURN 2599 DOESNT_RETURN
2820 signal_circular_property_list_error (Lisp_Object list) 2600 signal_circular_property_list_error (Lisp_Object list)
2821 { 2601 {
2822 signal_error (Qcircular_property_list, list1 (list)); 2602 signal_error (Qcircular_property_list, 0, list);
2823 } 2603 }
2824 2604
2825 DOESNT_RETURN 2605 DOESNT_RETURN
2826 syntax_error (const char *reason, Lisp_Object frob) 2606 syntax_error (const char *reason, Lisp_Object frob)
2827 { 2607 {
2828 signal_type_error (Qsyntax_error, reason, frob); 2608 signal_error (Qsyntax_error, reason, frob);
2829 } 2609 }
2830 2610
2831 DOESNT_RETURN 2611 DOESNT_RETURN
2832 syntax_error_2 (const char *reason, Lisp_Object frob1, Lisp_Object frob2) 2612 syntax_error_2 (const char *reason, Lisp_Object frob1, Lisp_Object frob2)
2833 { 2613 {
2834 signal_type_error_2 (Qsyntax_error, reason, frob1, frob2); 2614 signal_error_2 (Qsyntax_error, reason, frob1, frob2);
2615 }
2616
2617 void
2618 maybe_syntax_error (const char *reason, Lisp_Object frob,
2619 Lisp_Object class, Error_behavior errb)
2620 {
2621 maybe_signal_error (Qsyntax_error, reason, frob, class, errb);
2622 }
2623
2624 DOESNT_RETURN
2625 sferror (const char *reason, Lisp_Object frob)
2626 {
2627 signal_error (Qstructure_formation_error, reason, frob);
2628 }
2629
2630 DOESNT_RETURN
2631 sferror_2 (const char *reason, Lisp_Object frob1, Lisp_Object frob2)
2632 {
2633 signal_error_2 (Qstructure_formation_error, reason, frob1, frob2);
2634 }
2635
2636 void
2637 maybe_sferror (const char *reason, Lisp_Object frob,
2638 Lisp_Object class, Error_behavior errb)
2639 {
2640 maybe_signal_error (Qstructure_formation_error, reason, frob, class, errb);
2835 } 2641 }
2836 2642
2837 DOESNT_RETURN 2643 DOESNT_RETURN
2838 invalid_argument (const char *reason, Lisp_Object frob) 2644 invalid_argument (const char *reason, Lisp_Object frob)
2839 { 2645 {
2840 signal_type_error (Qinvalid_argument, reason, frob); 2646 signal_error (Qinvalid_argument, reason, frob);
2841 } 2647 }
2842 2648
2843 DOESNT_RETURN 2649 DOESNT_RETURN
2844 invalid_argument_2 (const char *reason, Lisp_Object frob1, Lisp_Object frob2) 2650 invalid_argument_2 (const char *reason, Lisp_Object frob1, Lisp_Object frob2)
2845 { 2651 {
2846 signal_type_error_2 (Qinvalid_argument, reason, frob1, frob2); 2652 signal_error_2 (Qinvalid_argument, reason, frob1, frob2);
2653 }
2654
2655 void
2656 maybe_invalid_argument (const char *reason, Lisp_Object frob,
2657 Lisp_Object class, Error_behavior errb)
2658 {
2659 maybe_signal_error (Qinvalid_argument, reason, frob, class, errb);
2660 }
2661
2662 DOESNT_RETURN
2663 invalid_constant (const char *reason, Lisp_Object frob)
2664 {
2665 signal_error (Qinvalid_constant, reason, frob);
2666 }
2667
2668 DOESNT_RETURN
2669 invalid_constant_2 (const char *reason, Lisp_Object frob1, Lisp_Object frob2)
2670 {
2671 signal_error_2 (Qinvalid_constant, reason, frob1, frob2);
2672 }
2673
2674 void
2675 maybe_invalid_constant (const char *reason, Lisp_Object frob,
2676 Lisp_Object class, Error_behavior errb)
2677 {
2678 maybe_signal_error (Qinvalid_constant, reason, frob, class, errb);
2847 } 2679 }
2848 2680
2849 DOESNT_RETURN 2681 DOESNT_RETURN
2850 invalid_operation (const char *reason, Lisp_Object frob) 2682 invalid_operation (const char *reason, Lisp_Object frob)
2851 { 2683 {
2852 signal_type_error (Qinvalid_operation, reason, frob); 2684 signal_error (Qinvalid_operation, reason, frob);
2853 } 2685 }
2854 2686
2855 DOESNT_RETURN 2687 DOESNT_RETURN
2856 invalid_operation_2 (const char *reason, Lisp_Object frob1, Lisp_Object frob2) 2688 invalid_operation_2 (const char *reason, Lisp_Object frob1, Lisp_Object frob2)
2857 { 2689 {
2858 signal_type_error_2 (Qinvalid_operation, reason, frob1, frob2); 2690 signal_error_2 (Qinvalid_operation, reason, frob1, frob2);
2691 }
2692
2693 void
2694 maybe_invalid_operation (const char *reason, Lisp_Object frob,
2695 Lisp_Object class, Error_behavior errb)
2696 {
2697 maybe_signal_error (Qinvalid_operation, reason, frob, class, errb);
2859 } 2698 }
2860 2699
2861 DOESNT_RETURN 2700 DOESNT_RETURN
2862 invalid_change (const char *reason, Lisp_Object frob) 2701 invalid_change (const char *reason, Lisp_Object frob)
2863 { 2702 {
2864 signal_type_error (Qinvalid_change, reason, frob); 2703 signal_error (Qinvalid_change, reason, frob);
2865 } 2704 }
2866 2705
2867 DOESNT_RETURN 2706 DOESNT_RETURN
2868 invalid_change_2 (const char *reason, Lisp_Object frob1, Lisp_Object frob2) 2707 invalid_change_2 (const char *reason, Lisp_Object frob1, Lisp_Object frob2)
2869 { 2708 {
2870 signal_type_error_2 (Qinvalid_change, reason, frob1, frob2); 2709 signal_error_2 (Qinvalid_change, reason, frob1, frob2);
2710 }
2711
2712 void
2713 maybe_invalid_change (const char *reason, Lisp_Object frob,
2714 Lisp_Object class, Error_behavior errb)
2715 {
2716 maybe_signal_error (Qinvalid_change, reason, frob, class, errb);
2717 }
2718
2719 DOESNT_RETURN
2720 invalid_state (const char *reason, Lisp_Object frob)
2721 {
2722 signal_error (Qinvalid_state, reason, frob);
2723 }
2724
2725 DOESNT_RETURN
2726 invalid_state_2 (const char *reason, Lisp_Object frob1, Lisp_Object frob2)
2727 {
2728 signal_error_2 (Qinvalid_state, reason, frob1, frob2);
2729 }
2730
2731 void
2732 maybe_invalid_state (const char *reason, Lisp_Object frob,
2733 Lisp_Object class, Error_behavior errb)
2734 {
2735 maybe_signal_error (Qinvalid_state, reason, frob, class, errb);
2736 }
2737
2738 DOESNT_RETURN
2739 wtaerror (const char *reason, Lisp_Object frob)
2740 {
2741 signal_error (Qwrong_type_argument, reason, frob);
2742 }
2743
2744 DOESNT_RETURN
2745 stack_overflow (const char *reason, Lisp_Object frob)
2746 {
2747 signal_error (Qstack_overflow, reason, frob);
2748 }
2749
2750 DOESNT_RETURN
2751 out_of_memory (const char *reason, Lisp_Object frob)
2752 {
2753 signal_error (Qout_of_memory, reason, frob);
2754 }
2755
2756 DOESNT_RETURN
2757 printing_unreadable_object (const char *fmt, ...)
2758 {
2759 Lisp_Object obj;
2760 va_list args;
2761
2762 va_start (args, fmt);
2763 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
2764 args);
2765 va_end (args);
2766
2767 /* Fsignal GC-protects its args */
2768 signal_error (Qprinting_unreadable_object, 0, obj);
2871 } 2769 }
2872 2770
2873 2771
2874 /************************************************************************/ 2772 /************************************************************************/
2875 /* User commands */ 2773 /* User commands */
3175 #else 3073 #else
3176 if (UNBOUNDP (fun) 3074 if (UNBOUNDP (fun)
3177 || (CONSP (fun) 3075 || (CONSP (fun)
3178 && EQ (XCAR (fun), Qautoload))) 3076 && EQ (XCAR (fun), Qautoload)))
3179 #endif 3077 #endif
3180 error ("Autoloading failed to define function %s", 3078 invalid_state ("Autoloading failed to define function", funname);
3181 string_data (XSYMBOL (funname)->name));
3182 UNGCPRO; 3079 UNGCPRO;
3183 } 3080 }
3184 3081
3185 3082
3186 /************************************************************************/ 3083 /************************************************************************/
3260 if (++lisp_eval_depth > max_lisp_eval_depth) 3157 if (++lisp_eval_depth > max_lisp_eval_depth)
3261 { 3158 {
3262 if (max_lisp_eval_depth < 100) 3159 if (max_lisp_eval_depth < 100)
3263 max_lisp_eval_depth = 100; 3160 max_lisp_eval_depth = 100;
3264 if (lisp_eval_depth > max_lisp_eval_depth) 3161 if (lisp_eval_depth > max_lisp_eval_depth)
3265 error ("Lisp nesting exceeds `max-lisp-eval-depth'"); 3162 stack_overflow ("Lisp nesting exceeds `max-lisp-eval-depth'",
3163 Qunbound);
3266 } 3164 }
3267 3165
3268 /* We guaranteed CONSP (form) above */ 3166 /* We guaranteed CONSP (form) above */
3269 original_fun = XCAR (form); 3167 original_fun = XCAR (form);
3270 original_args = XCDR (form); 3168 original_args = XCDR (form);
3479 if (++lisp_eval_depth > max_lisp_eval_depth) 3377 if (++lisp_eval_depth > max_lisp_eval_depth)
3480 { 3378 {
3481 if (max_lisp_eval_depth < 100) 3379 if (max_lisp_eval_depth < 100)
3482 max_lisp_eval_depth = 100; 3380 max_lisp_eval_depth = 100;
3483 if (lisp_eval_depth > max_lisp_eval_depth) 3381 if (lisp_eval_depth > max_lisp_eval_depth)
3484 error ("Lisp nesting exceeds `max-lisp-eval-depth'"); 3382 stack_overflow ("Lisp nesting exceeds `max-lisp-eval-depth'",
3383 Qunbound);
3485 } 3384 }
3486 3385
3487 backtrace.pdlcount = specpdl_depth(); 3386 backtrace.pdlcount = specpdl_depth();
3488 backtrace.function = &args[0]; 3387 backtrace.function = &args[0];
3489 backtrace.args = fun_args; 3388 backtrace.args = fun_args;
4799 { 4698 {
4800 if (!NILP (Vdebug_on_error) || 4699 if (!NILP (Vdebug_on_error) ||
4801 !NILP (Vdebug_on_signal)) 4700 !NILP (Vdebug_on_signal))
4802 /* Leave room for some specpdl in the debugger. */ 4701 /* Leave room for some specpdl in the debugger. */
4803 max_specpdl_size = size_needed + 100; 4702 max_specpdl_size = size_needed + 100;
4804 continuable_error 4703 signal_continuable_error
4805 ("Variable binding depth exceeds max-specpdl-size"); 4704 (Qstack_overflow,
4705 "Variable binding depth exceeds max-specpdl-size", Qunbound);
4806 } 4706 }
4807 } 4707 }
4808 while (specpdl_size < size_needed) 4708 while (specpdl_size < size_needed)
4809 { 4709 {
4810 specpdl_size *= 2; 4710 specpdl_size *= 2;
5322 void 5222 void
5323 syms_of_eval (void) 5223 syms_of_eval (void)
5324 { 5224 {
5325 INIT_LRECORD_IMPLEMENTATION (subr); 5225 INIT_LRECORD_IMPLEMENTATION (subr);
5326 5226
5327 defsymbol (&Qinhibit_quit, "inhibit-quit"); 5227 DEFSYMBOL (Qinhibit_quit);
5328 defsymbol (&Qautoload, "autoload"); 5228 DEFSYMBOL (Qautoload);
5329 defsymbol (&Qdebug_on_error, "debug-on-error"); 5229 DEFSYMBOL (Qdebug_on_error);
5330 defsymbol (&Qstack_trace_on_error, "stack-trace-on-error"); 5230 DEFSYMBOL (Qstack_trace_on_error);
5331 defsymbol (&Qdebug_on_signal, "debug-on-signal"); 5231 DEFSYMBOL (Qdebug_on_signal);
5332 defsymbol (&Qstack_trace_on_signal, "stack-trace-on-signal"); 5232 DEFSYMBOL (Qstack_trace_on_signal);
5333 defsymbol (&Qdebugger, "debugger"); 5233 DEFSYMBOL (Qdebugger);
5334 defsymbol (&Qmacro, "macro"); 5234 DEFSYMBOL (Qmacro);
5335 defsymbol (&Qand_rest, "&rest"); 5235 defsymbol (&Qand_rest, "&rest");
5336 defsymbol (&Qand_optional, "&optional"); 5236 defsymbol (&Qand_optional, "&optional");
5337 /* Note that the process code also uses Qexit */ 5237 /* Note that the process code also uses Qexit */
5338 defsymbol (&Qexit, "exit"); 5238 DEFSYMBOL (Qexit);
5339 defsymbol (&Qsetq, "setq"); 5239 DEFSYMBOL (Qsetq);
5340 defsymbol (&Qinteractive, "interactive"); 5240 DEFSYMBOL (Qinteractive);
5341 defsymbol (&Qcommandp, "commandp"); 5241 DEFSYMBOL (Qcommandp);
5342 defsymbol (&Qdefun, "defun"); 5242 DEFSYMBOL (Qdefun);
5343 defsymbol (&Qprogn, "progn"); 5243 DEFSYMBOL (Qprogn);
5344 defsymbol (&Qvalues, "values"); 5244 DEFSYMBOL (Qvalues);
5345 defsymbol (&Qdisplay_warning, "display-warning"); 5245 DEFSYMBOL (Qdisplay_warning);
5346 defsymbol (&Qrun_hooks, "run-hooks"); 5246 DEFSYMBOL (Qrun_hooks);
5347 defsymbol (&Qif, "if"); 5247 DEFSYMBOL (Qif);
5348 5248
5349 DEFSUBR (For); 5249 DEFSUBR (For);
5350 DEFSUBR (Fand); 5250 DEFSUBR (Fand);
5351 DEFSUBR (Fif); 5251 DEFSUBR (Fif);
5352 DEFSUBR_MACRO (Fwhen); 5252 DEFSUBR_MACRO (Fwhen);