comparison src/eval.c @ 771:943eaba38521

[xemacs-hg @ 2002-03-13 08:51:24 by ben] The big ben-mule-21-5 check-in! Various files were added and deleted. See CHANGES-ben-mule. There are still some test suite failures. No crashes, though. Many of the failures have to do with problems in the test suite itself rather than in the actual code. I'll be addressing these in the next day or so -- none of the test suite failures are at all critical. Meanwhile I'll be trying to address the biggest issues -- i.e. build or run failures, which will almost certainly happen on various platforms. All comments should be sent to ben@xemacs.org -- use a Cc: if necessary when sending to mailing lists. There will be pre- and post- tags, something like pre-ben-mule-21-5-merge-in, and post-ben-mule-21-5-merge-in.
author ben
date Wed, 13 Mar 2002 08:54:06 +0000
parents b1f74adcc1ff
children e38acbeb1cae
comparison
equal deleted inserted replaced
770:336a418893b5 771:943eaba38521
390 record_unwind_protect (restore_entering_debugger, 390 record_unwind_protect (restore_entering_debugger,
391 (entering_debugger ? Qt : Qnil)); 391 (entering_debugger ? Qt : Qnil));
392 entering_debugger = 1; 392 entering_debugger = 1;
393 val = internal_catch (Qdebugger, call_debugger_259, arg, &threw); 393 val = internal_catch (Qdebugger, call_debugger_259, arg, &threw);
394 394
395 return unbind_to (speccount, ((threw) 395 return unbind_to_1 (speccount, ((threw)
396 ? Qunbound /* Not returning a value */ 396 ? Qunbound /* Not returning a value */
397 : val)); 397 : val));
398 } 398 }
399 399
400 /* Called when debug-on-exit behavior is called for. Enter the debugger 400 /* Called when debug-on-exit behavior is called for. Enter the debugger
567 backtrace_259, 567 backtrace_259,
568 Qnil, 568 Qnil,
569 Qnil); 569 Qnil);
570 else /* in batch mode, we want this going to stderr. */ 570 else /* in batch mode, we want this going to stderr. */
571 backtrace_259 (Qnil); 571 backtrace_259 (Qnil);
572 unbind_to (speccount, Qnil); 572 unbind_to (speccount);
573 *stack_trace_displayed = 1; 573 *stack_trace_displayed = 1;
574 } 574 }
575 575
576 if (!entering_debugger && !*debugger_entered && !signal_vars_only 576 if (!entering_debugger && !*debugger_entered && !signal_vars_only
577 && (EQ (sig, Qquit) 577 && (EQ (sig, Qquit)
602 backtrace_259, 602 backtrace_259,
603 Qnil, 603 Qnil,
604 Qnil); 604 Qnil);
605 else /* in batch mode, we want this going to stderr. */ 605 else /* in batch mode, we want this going to stderr. */
606 backtrace_259 (Qnil); 606 backtrace_259 (Qnil);
607 unbind_to (speccount, Qnil); 607 unbind_to (speccount);
608 *stack_trace_displayed = 1; 608 *stack_trace_displayed = 1;
609 } 609 }
610 610
611 if (!entering_debugger && !*debugger_entered 611 if (!entering_debugger && !*debugger_entered
612 && (EQ (sig, Qquit) 612 && (EQ (sig, Qquit)
623 *debugger_entered = 1; 623 *debugger_entered = 1;
624 } 624 }
625 625
626 UNGCPRO; 626 UNGCPRO;
627 Vcondition_handlers = all_handlers; 627 Vcondition_handlers = all_handlers;
628 return unbind_to (speccount, val); 628 return unbind_to_1 (speccount, val);
629 } 629 }
630 630
631 631
632 /************************************************************************/ 632 /************************************************************************/
633 /* The basic special forms */ 633 /* The basic special forms */
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 }
875 return unbind_to (speccount, Fprogn (body)); 875 return unbind_to_1 (speccount, Fprogn (body));
876 } 876 }
877 877
878 DEFUN ("let", Flet, 1, UNEVALLED, 0, /* 878 DEFUN ("let", Flet, 1, UNEVALLED, 0, /*
879 \(let VARLIST BODY...): bind variables according to VARLIST then eval BODY. 879 \(let VARLIST BODY...): bind variables according to VARLIST then eval BODY.
880 The value of the last form in BODY is returned. 880 The value of the last form in BODY is returned.
939 } 939 }
940 } 940 }
941 941
942 UNGCPRO; 942 UNGCPRO;
943 943
944 return unbind_to (speccount, Fprogn (body)); 944 return unbind_to_1 (speccount, Fprogn (body));
945 } 945 }
946 946
947 DEFUN ("while", Fwhile, 1, UNEVALLED, 0, /* 947 DEFUN ("while", Fwhile, 1, UNEVALLED, 0, /*
948 \(while TEST BODY...): if TEST yields non-nil, eval BODY... and repeat. 948 \(while TEST BODY...): if TEST yields non-nil, eval BODY... and repeat.
949 The order of execution is thus TEST, BODY, TEST, BODY and so on 949 The order of execution is thus TEST, BODY, TEST, BODY and so on
1367 { 1367 {
1368 last_time = catchlist == c; 1368 last_time = catchlist == c;
1369 1369
1370 /* Unwind the specpdl stack, and then restore the proper set of 1370 /* Unwind the specpdl stack, and then restore the proper set of
1371 handlers. */ 1371 handlers. */
1372 unbind_to (catchlist->pdlcount, Qnil); 1372 unbind_to (catchlist->pdlcount);
1373 catchlist = catchlist->next; 1373 catchlist = catchlist->next;
1374 #ifdef ERROR_CHECK_TYPECHECK 1374 #ifdef ERROR_CHECK_TYPECHECK
1375 check_error_state_sanity (); 1375 check_error_state_sanity ();
1376 #endif 1376 #endif
1377 } 1377 }
1396 This would try to throw to the inner (catch 'bar)! 1396 This would try to throw to the inner (catch 'bar)!
1397 1397
1398 --ben 1398 --ben
1399 */ 1399 */
1400 /* Unwind the specpdl stack */ 1400 /* Unwind the specpdl stack */
1401 unbind_to (c->pdlcount, Qnil); 1401 unbind_to (c->pdlcount);
1402 catchlist = c->next; 1402 catchlist = c->next;
1403 #ifdef ERROR_CHECK_TYPECHECK 1403 #ifdef ERROR_CHECK_TYPECHECK
1404 check_error_state_sanity (); 1404 check_error_state_sanity ();
1405 #endif 1405 #endif
1406 #endif /* Former code */ 1406 #endif /* Former code */
1506 { 1506 {
1507 /* This function can GC */ 1507 /* This function can GC */
1508 int speccount = specpdl_depth(); 1508 int speccount = specpdl_depth();
1509 1509
1510 record_unwind_protect (Fprogn, XCDR (args)); 1510 record_unwind_protect (Fprogn, XCDR (args));
1511 return unbind_to (speccount, Feval (XCAR (args))); 1511 return unbind_to_1 (speccount, Feval (XCAR (args)));
1512 } 1512 }
1513 1513
1514 1514
1515 /************************************************************************/ 1515 /************************************************************************/
1516 /* Signalling and trapping errors */ 1516 /* Signalling and trapping errors */
1700 check_error_state_sanity (); 1700 check_error_state_sanity ();
1701 #endif 1701 #endif
1702 /* Note: The unbind also resets Vcondition_handlers. Maybe we should 1702 /* Note: The unbind also resets Vcondition_handlers. Maybe we should
1703 delete this here. */ 1703 delete this here. */
1704 Vcondition_handlers = XCDR (c.tag); 1704 Vcondition_handlers = XCDR (c.tag);
1705 unbind_to (speccount, Qnil); 1705 unbind_to (speccount);
1706 1706
1707 UNGCPRO; 1707 UNGCPRO;
1708 /* free the conses *after* the unbind, because the unbind will run 1708 /* free the conses *after* the unbind, because the unbind will run
1709 condition_case_unwind above. */ 1709 condition_case_unwind above. */
1710 free_cons (XCONS (XCAR (c.tag))); 1710 free_cons (XCONS (XCAR (c.tag)));
1722 val = Fprogn (Fcdr (h.chosen_clause)); 1722 val = Fprogn (Fcdr (h.chosen_clause));
1723 1723
1724 /* Note that this just undoes the binding of h.var; whoever 1724 /* Note that this just undoes the binding of h.var; whoever
1725 longjmp()ed to us unwound the stack to c.pdlcount before 1725 longjmp()ed to us unwound the stack to c.pdlcount before
1726 throwing. */ 1726 throwing. */
1727 unbind_to (c.pdlcount, Qnil); 1727 unbind_to (c.pdlcount);
1728 return val; 1728 return val;
1729 #else 1729 #else
1730 int speccount; 1730 int speccount;
1731 1731
1732 CHECK_TRUE_LIST (val); 1732 CHECK_TRUE_LIST (val);
1734 return Fprogn (Fcdr (val)); /* tail call */ 1734 return Fprogn (Fcdr (val)); /* tail call */
1735 1735
1736 speccount = specpdl_depth(); 1736 speccount = specpdl_depth();
1737 specbind (var, Fcar (val)); 1737 specbind (var, Fcar (val));
1738 val = Fprogn (Fcdr (val)); 1738 val = Fprogn (Fcdr (val));
1739 return unbind_to (speccount, val); 1739 return unbind_to_1 (speccount, val);
1740 #endif 1740 #endif
1741 } 1741 }
1742 1742
1743 /* Here for bytecode to call non-consfully. This is exactly like 1743 /* Here for bytecode to call non-consfully. This is exactly like
1744 condition-case except that it takes three arguments rather 1744 condition-case except that it takes three arguments rather
1784 Usage looks like (condition-case VAR BODYFORM HANDLERS...). 1784 Usage looks like (condition-case VAR BODYFORM HANDLERS...).
1785 Executes BODYFORM and returns its value if no error happens. 1785 Executes BODYFORM and returns its value if no error happens.
1786 Each element of HANDLERS looks like (CONDITION-NAME BODY...) 1786 Each element of HANDLERS looks like (CONDITION-NAME BODY...)
1787 where the BODY is made of Lisp expressions. 1787 where the BODY is made of Lisp expressions.
1788 1788
1789 A typical usage of `condition-case' looks like this:
1790
1791 (condition-case nil
1792 ;; you need a progn here if you want more than one statement ...
1793 (progn
1794 (do-something)
1795 (do-something-else))
1796 (error
1797 (issue-warning-or)
1798 ;; but strangely, you don't need one here.
1799 (return-a-value-etc)
1800 ))
1801
1789 A handler is applicable to an error if CONDITION-NAME is one of the 1802 A handler is applicable to an error if CONDITION-NAME is one of the
1790 error's condition names. If an error happens, the first applicable 1803 error's condition names. If an error happens, the first applicable
1791 handler is run. As a special case, a CONDITION-NAME of t matches 1804 handler is run. As a special case, a CONDITION-NAME of t matches
1792 all errors, even those without the `error' condition name on them 1805 all errors, even those without the `error' condition name on them
1793 \(e.g. `quit'). 1806 \(e.g. `quit').
1851 tem = noseeum_cons (list1 (args[0]), Vcondition_handlers); 1864 tem = noseeum_cons (list1 (args[0]), Vcondition_handlers);
1852 record_unwind_protect (condition_bind_unwind, tem); 1865 record_unwind_protect (condition_bind_unwind, tem);
1853 Vcondition_handlers = tem; 1866 Vcondition_handlers = tem;
1854 1867
1855 /* Caller should have GC-protected args */ 1868 /* Caller should have GC-protected args */
1856 return unbind_to (speccount, Ffuncall (nargs - 1, args + 1)); 1869 return unbind_to_1 (speccount, Ffuncall (nargs - 1, args + 1));
1857 } 1870 }
1858 1871
1859 static int 1872 static int
1860 condition_type_p (Lisp_Object type, Lisp_Object conditions) 1873 condition_type_p (Lisp_Object type, Lisp_Object conditions)
1861 { 1874 {
1920 1933
1921 if (!initialized) 1934 if (!initialized)
1922 { 1935 {
1923 /* who knows how much has been initialized? Safest bet is 1936 /* who knows how much has been initialized? Safest bet is
1924 just to bomb out immediately. */ 1937 just to bomb out immediately. */
1925 /* let's not use stderr_out() here, because that does a bunch of 1938 stderr_out ("Error before initialization is complete!\n");
1926 things that might not be safe yet. */
1927 fprintf (stderr, "Error before initialization is complete!\n");
1928 abort (); 1939 abort ();
1929 } 1940 }
1930 1941
1931 if (gc_in_progress || in_display) 1942 if (gc_in_progress || in_display)
1932 /* This is one of many reasons why you can't run lisp code from redisplay. 1943 /* This is one of many reasons why you can't run lisp code from redisplay.
2157 Vcurrent_error_state); 2168 Vcurrent_error_state);
2158 Vcurrent_error_state = no_error; 2169 Vcurrent_error_state = no_error;
2159 } 2170 }
2160 PRIMITIVE_FUNCALL (val, get_opaque_ptr (kludgy_args[0]), 2171 PRIMITIVE_FUNCALL (val, get_opaque_ptr (kludgy_args[0]),
2161 kludgy_args + 3, XINT (kludgy_args[1])); 2172 kludgy_args + 3, XINT (kludgy_args[1]));
2162 return unbind_to (speccount, val); 2173 return unbind_to_1 (speccount, val);
2163 } 2174 }
2164 2175
2165 /* Many functions would like to do one of three things if an error 2176 /* Many functions would like to do one of three things if an error
2166 occurs: 2177 occurs:
2167 2178
2257 free_opaque_ptr (opaque2); 2268 free_opaque_ptr (opaque2);
2258 UNGCPRO; 2269 UNGCPRO;
2259 /* Use the returned value except in non-local exit, when 2270 /* Use the returned value except in non-local exit, when
2260 RETVAL applies. */ 2271 RETVAL applies. */
2261 /* Some perverse compilers require the perverse cast below. */ 2272 /* Some perverse compilers require the perverse cast below. */
2262 return unbind_to (speccount, 2273 return unbind_to_1 (speccount,
2263 threw ? *((Lisp_Object*) &(retval)) : the_retval); 2274 threw ? *((Lisp_Object*) &(retval)) : the_retval);
2264 } 2275 }
2265 } 2276 }
2266 2277
2267 /* Signal a non-continuable error or display a warning or do nothing, 2278 /* Signal a non-continuable error or display a warning or do nothing,
2326 else 2337 else
2327 frob = list1 (frob); 2338 frob = list1 (frob);
2328 if (!reason) 2339 if (!reason)
2329 return frob; 2340 return frob;
2330 else 2341 else
2331 return Fcons (build_translated_string (reason), frob); 2342 return Fcons (build_msg_string (reason), frob);
2332 } 2343 }
2333 2344
2334 DOESNT_RETURN 2345 DOESNT_RETURN
2335 signal_error (Lisp_Object type, const CIntbyte *reason, Lisp_Object frob) 2346 signal_error (Lisp_Object type, const CIntbyte *reason, Lisp_Object frob)
2336 { 2347 {
2379 2390
2380 DOESNT_RETURN 2391 DOESNT_RETURN
2381 signal_error_2 (Lisp_Object type, const CIntbyte *reason, 2392 signal_error_2 (Lisp_Object type, const CIntbyte *reason,
2382 Lisp_Object frob0, Lisp_Object frob1) 2393 Lisp_Object frob0, Lisp_Object frob1)
2383 { 2394 {
2384 signal_error_1 (type, list3 (build_translated_string (reason), frob0, 2395 signal_error_1 (type, list3 (build_msg_string (reason), frob0,
2385 frob1)); 2396 frob1));
2386 } 2397 }
2387 2398
2388 void 2399 void
2389 maybe_signal_error_2 (Lisp_Object type, const CIntbyte *reason, 2400 maybe_signal_error_2 (Lisp_Object type, const CIntbyte *reason,
2391 Lisp_Object class, Error_Behavior errb) 2402 Lisp_Object class, Error_Behavior errb)
2392 { 2403 {
2393 /* Optimization: */ 2404 /* Optimization: */
2394 if (ERRB_EQ (errb, ERROR_ME_NOT)) 2405 if (ERRB_EQ (errb, ERROR_ME_NOT))
2395 return; 2406 return;
2396 maybe_signal_error_1 (type, list3 (build_translated_string (reason), frob0, 2407 maybe_signal_error_1 (type, list3 (build_msg_string (reason), frob0,
2397 frob1), class, errb); 2408 frob1), class, errb);
2398 } 2409 }
2399 2410
2400 Lisp_Object 2411 Lisp_Object
2401 signal_continuable_error_2 (Lisp_Object type, const CIntbyte *reason, 2412 signal_continuable_error_2 (Lisp_Object type, const CIntbyte *reason,
2402 Lisp_Object frob0, Lisp_Object frob1) 2413 Lisp_Object frob0, Lisp_Object frob1)
2403 { 2414 {
2404 return Fsignal (type, list3 (build_translated_string (reason), frob0, 2415 return Fsignal (type, list3 (build_msg_string (reason), frob0,
2405 frob1)); 2416 frob1));
2406 } 2417 }
2407 2418
2408 Lisp_Object 2419 Lisp_Object
2409 maybe_signal_continuable_error_2 (Lisp_Object type, const CIntbyte *reason, 2420 maybe_signal_continuable_error_2 (Lisp_Object type, const CIntbyte *reason,
2412 { 2423 {
2413 /* Optimization: */ 2424 /* Optimization: */
2414 if (ERRB_EQ (errb, ERROR_ME_NOT)) 2425 if (ERRB_EQ (errb, ERROR_ME_NOT))
2415 return Qnil; 2426 return Qnil;
2416 return maybe_signal_continuable_error_1 2427 return maybe_signal_continuable_error_1
2417 (type, list3 (build_translated_string (reason), frob0, frob1), 2428 (type, list3 (build_msg_string (reason), frob0, frob1),
2418 class, errb); 2429 class, errb);
2419 } 2430 }
2420 2431
2421 2432
2422 /****************** Error functions class 4 ******************/ 2433 /****************** Error functions class 4 ******************/
2430 { 2441 {
2431 Lisp_Object obj; 2442 Lisp_Object obj;
2432 va_list args; 2443 va_list args;
2433 2444
2434 va_start (args, fmt); 2445 va_start (args, fmt);
2435 obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1, 2446 obj = emacs_vsprintf_string (CGETTEXT (fmt), args);
2436 args);
2437 va_end (args); 2447 va_end (args);
2438 2448
2439 /* Fsignal GC-protects its args */ 2449 /* Fsignal GC-protects its args */
2440 signal_error (type, 0, obj); 2450 signal_error (type, 0, obj);
2441 } 2451 }
2450 /* Optimization: */ 2460 /* Optimization: */
2451 if (ERRB_EQ (errb, ERROR_ME_NOT)) 2461 if (ERRB_EQ (errb, ERROR_ME_NOT))
2452 return; 2462 return;
2453 2463
2454 va_start (args, fmt); 2464 va_start (args, fmt);
2455 obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1, 2465 obj = emacs_vsprintf_string (CGETTEXT (fmt), args);
2456 args);
2457 va_end (args); 2466 va_end (args);
2458 2467
2459 /* Fsignal GC-protects its args */ 2468 /* Fsignal GC-protects its args */
2460 maybe_signal_error (type, 0, obj, class, errb); 2469 maybe_signal_error (type, 0, obj, class, errb);
2461 } 2470 }
2465 { 2474 {
2466 Lisp_Object obj; 2475 Lisp_Object obj;
2467 va_list args; 2476 va_list args;
2468 2477
2469 va_start (args, fmt); 2478 va_start (args, fmt);
2470 obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1, 2479 obj = emacs_vsprintf_string (CGETTEXT (fmt), args);
2471 args);
2472 va_end (args); 2480 va_end (args);
2473 2481
2474 /* Fsignal GC-protects its args */ 2482 /* Fsignal GC-protects its args */
2475 return Fsignal (type, list1 (obj)); 2483 return Fsignal (type, list1 (obj));
2476 } 2484 }
2485 /* Optimization: */ 2493 /* Optimization: */
2486 if (ERRB_EQ (errb, ERROR_ME_NOT)) 2494 if (ERRB_EQ (errb, ERROR_ME_NOT))
2487 return Qnil; 2495 return Qnil;
2488 2496
2489 va_start (args, fmt); 2497 va_start (args, fmt);
2490 obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1, 2498 obj = emacs_vsprintf_string (CGETTEXT (fmt), args);
2491 args);
2492 va_end (args); 2499 va_end (args);
2493 2500
2494 /* Fsignal GC-protects its args */ 2501 /* Fsignal GC-protects its args */
2495 return maybe_signal_continuable_error (type, 0, obj, class, errb); 2502 return maybe_signal_continuable_error (type, 0, obj, class, errb);
2496 } 2503 }
2516 { 2523 {
2517 Lisp_Object obj; 2524 Lisp_Object obj;
2518 va_list args; 2525 va_list args;
2519 2526
2520 va_start (args, fmt); 2527 va_start (args, fmt);
2521 obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1, 2528 obj = emacs_vsprintf_string (CGETTEXT (fmt), args);
2522 args);
2523 va_end (args); 2529 va_end (args);
2524 2530
2525 /* Fsignal GC-protects its args */ 2531 /* Fsignal GC-protects its args */
2526 signal_error_1 (type, Fcons (obj, build_error_data (0, frob))); 2532 signal_error_1 (type, Fcons (obj, build_error_data (0, frob)));
2527 } 2533 }
2537 /* Optimization: */ 2543 /* Optimization: */
2538 if (ERRB_EQ (errb, ERROR_ME_NOT)) 2544 if (ERRB_EQ (errb, ERROR_ME_NOT))
2539 return; 2545 return;
2540 2546
2541 va_start (args, fmt); 2547 va_start (args, fmt);
2542 obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1, 2548 obj = emacs_vsprintf_string (CGETTEXT (fmt), args);
2543 args);
2544 va_end (args); 2549 va_end (args);
2545 2550
2546 /* Fsignal GC-protects its args */ 2551 /* Fsignal GC-protects its args */
2547 maybe_signal_error_1 (type, Fcons (obj, build_error_data (0, frob)), class, 2552 maybe_signal_error_1 (type, Fcons (obj, build_error_data (0, frob)), class,
2548 errb); 2553 errb);
2554 { 2559 {
2555 Lisp_Object obj; 2560 Lisp_Object obj;
2556 va_list args; 2561 va_list args;
2557 2562
2558 va_start (args, fmt); 2563 va_start (args, fmt);
2559 obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1, 2564 obj = emacs_vsprintf_string (CGETTEXT (fmt), args);
2560 args);
2561 va_end (args); 2565 va_end (args);
2562 2566
2563 /* Fsignal GC-protects its args */ 2567 /* Fsignal GC-protects its args */
2564 return Fsignal (type, Fcons (obj, build_error_data (0, frob))); 2568 return Fsignal (type, Fcons (obj, build_error_data (0, frob)));
2565 } 2569 }
2576 /* Optimization: */ 2580 /* Optimization: */
2577 if (ERRB_EQ (errb, ERROR_ME_NOT)) 2581 if (ERRB_EQ (errb, ERROR_ME_NOT))
2578 return Qnil; 2582 return Qnil;
2579 2583
2580 va_start (args, fmt); 2584 va_start (args, fmt);
2581 obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1, 2585 obj = emacs_vsprintf_string (CGETTEXT (fmt), args);
2582 args);
2583 va_end (args); 2586 va_end (args);
2584 2587
2585 /* Fsignal GC-protects its args */ 2588 /* Fsignal GC-protects its args */
2586 return maybe_signal_continuable_error_1 (type, 2589 return maybe_signal_continuable_error_1 (type,
2587 Fcons (obj, 2590 Fcons (obj,
2808 { 2811 {
2809 Lisp_Object obj; 2812 Lisp_Object obj;
2810 va_list args; 2813 va_list args;
2811 2814
2812 va_start (args, fmt); 2815 va_start (args, fmt);
2813 obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1, 2816 obj = emacs_vsprintf_string (CGETTEXT (fmt), args);
2814 args);
2815 va_end (args); 2817 va_end (args);
2816 2818
2817 /* Fsignal GC-protects its args */ 2819 /* Fsignal GC-protects its args */
2818 signal_error (Qprinting_unreadable_object, 0, obj); 2820 signal_error (Qprinting_unreadable_object, 0, obj);
2819 } 2821 }
3112 } 3114 }
3113 } 3115 }
3114 3116
3115 /* Once loading finishes, don't undo it. */ 3117 /* Once loading finishes, don't undo it. */
3116 Vautoload_queue = Qt; 3118 Vautoload_queue = Qt;
3117 unbind_to (speccount, Qnil); 3119 unbind_to (speccount);
3118 3120
3119 fun = indirect_function (fun, 0); 3121 fun = indirect_function (fun, 0);
3120 3122
3121 #if 0 /* FSFmacs */ 3123 #if 0 /* FSFmacs */
3122 if (!NILP (Fequal (fun, fundef))) 3124 if (!NILP (Fequal (fun, fundef)))
3182 GCPRO4 (form, class, level, messij); 3184 GCPRO4 (form, class, level, messij);
3183 if (!STRINGP (messij)) 3185 if (!STRINGP (messij))
3184 messij = Fprin1_to_string (messij, Qnil); 3186 messij = Fprin1_to_string (messij, Qnil);
3185 call3 (Qdisplay_warning, class, messij, level); 3187 call3 (Qdisplay_warning, class, messij, level);
3186 UNGCPRO; 3188 UNGCPRO;
3187 unbind_to (speccount, Qnil); 3189 unbind_to (speccount);
3188 } 3190 }
3189 3191
3190 if (!CONSP (form)) 3192 if (!CONSP (form))
3191 { 3193 {
3192 if (SYMBOLP (form)) 3194 if (SYMBOLP (form))
3800 } 3802 }
3801 3803
3802 if (i < nargs) 3804 if (i < nargs)
3803 goto wrong_number_of_arguments; 3805 goto wrong_number_of_arguments;
3804 3806
3805 return unbind_to (speccount, Fprogn (body)); 3807 return unbind_to_1 (speccount, Fprogn (body));
3806 3808
3807 wrong_number_of_arguments: 3809 wrong_number_of_arguments:
3808 return signal_wrong_number_of_arguments_error (fun, nargs); 3810 return signal_wrong_number_of_arguments_error (fun, nargs);
3809 3811
3810 invalid_function: 3812 invalid_function:
3910 /* Whenever gc_in_progress is true, preparing_for_armageddon 3912 /* Whenever gc_in_progress is true, preparing_for_armageddon
3911 will also be true unless something is really hosed. */ 3913 will also be true unless something is really hosed. */
3912 assert (!gc_in_progress); 3914 assert (!gc_in_progress);
3913 3915
3914 sym = args[0]; 3916 sym = args[0];
3915 val = symbol_value_in_buffer (sym, make_buffer (buf)); 3917 val = symbol_value_in_buffer (sym, wrap_buffer (buf));
3916 ret = (cond == RUN_HOOKS_UNTIL_FAILURE ? Qt : Qnil); 3918 ret = (cond == RUN_HOOKS_UNTIL_FAILURE ? Qt : Qnil);
3917 3919
3918 if (UNBOUNDP (val) || NILP (val)) 3920 if (UNBOUNDP (val) || NILP (val))
3919 return ret; 3921 return ret;
3920 else if (!CONSP (val) || EQ (XCAR (val), Qlambda)) 3922 else if (!CONSP (val) || EQ (XCAR (val), Qlambda))
4279 Lisp_Object val; 4281 Lisp_Object val;
4280 int speccount = specpdl_depth(); 4282 int speccount = specpdl_depth();
4281 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); 4283 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
4282 set_buffer_internal (buf); 4284 set_buffer_internal (buf);
4283 val = call0 (fn); 4285 val = call0 (fn);
4284 unbind_to (speccount, Qnil); 4286 unbind_to (speccount);
4285 return val; 4287 return val;
4286 } 4288 }
4287 } 4289 }
4288 4290
4289 Lisp_Object 4291 Lisp_Object
4297 Lisp_Object val; 4299 Lisp_Object val;
4298 int speccount = specpdl_depth(); 4300 int speccount = specpdl_depth();
4299 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); 4301 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
4300 set_buffer_internal (buf); 4302 set_buffer_internal (buf);
4301 val = call1 (fn, arg0); 4303 val = call1 (fn, arg0);
4302 unbind_to (speccount, Qnil); 4304 unbind_to (speccount);
4303 return val; 4305 return val;
4304 } 4306 }
4305 } 4307 }
4306 4308
4307 Lisp_Object 4309 Lisp_Object
4315 Lisp_Object val; 4317 Lisp_Object val;
4316 int speccount = specpdl_depth(); 4318 int speccount = specpdl_depth();
4317 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); 4319 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
4318 set_buffer_internal (buf); 4320 set_buffer_internal (buf);
4319 val = call2 (fn, arg0, arg1); 4321 val = call2 (fn, arg0, arg1);
4320 unbind_to (speccount, Qnil); 4322 unbind_to (speccount);
4321 return val; 4323 return val;
4322 } 4324 }
4323 } 4325 }
4324 4326
4325 Lisp_Object 4327 Lisp_Object
4333 Lisp_Object val; 4335 Lisp_Object val;
4334 int speccount = specpdl_depth(); 4336 int speccount = specpdl_depth();
4335 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); 4337 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
4336 set_buffer_internal (buf); 4338 set_buffer_internal (buf);
4337 val = call3 (fn, arg0, arg1, arg2); 4339 val = call3 (fn, arg0, arg1, arg2);
4338 unbind_to (speccount, Qnil); 4340 unbind_to (speccount);
4339 return val; 4341 return val;
4340 } 4342 }
4341 } 4343 }
4342 4344
4343 Lisp_Object 4345 Lisp_Object
4352 Lisp_Object val; 4354 Lisp_Object val;
4353 int speccount = specpdl_depth(); 4355 int speccount = specpdl_depth();
4354 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); 4356 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
4355 set_buffer_internal (buf); 4357 set_buffer_internal (buf);
4356 val = call4 (fn, arg0, arg1, arg2, arg3); 4358 val = call4 (fn, arg0, arg1, arg2, arg3);
4357 unbind_to (speccount, Qnil); 4359 unbind_to (speccount);
4358 return val; 4360 return val;
4359 } 4361 }
4360 } 4362 }
4361 4363
4362 Lisp_Object 4364 Lisp_Object
4369 Lisp_Object val; 4371 Lisp_Object val;
4370 int speccount = specpdl_depth(); 4372 int speccount = specpdl_depth();
4371 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); 4373 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
4372 set_buffer_internal (buf); 4374 set_buffer_internal (buf);
4373 val = Feval (form); 4375 val = Feval (form);
4374 unbind_to (speccount, Qnil); 4376 unbind_to (speccount);
4375 return val; 4377 return val;
4376 } 4378 }
4377 } 4379 }
4378 4380
4379 4381
4427 argument similar to Qt or Qerror for condition_case_1(). */ 4429 argument similar to Qt or Qerror for condition_case_1(). */
4428 4430
4429 static Lisp_Object 4431 static Lisp_Object
4430 caught_a_squirmer (Lisp_Object errordata, Lisp_Object arg) 4432 caught_a_squirmer (Lisp_Object errordata, Lisp_Object arg)
4431 { 4433 {
4434 /* #### should be rewritten to work with emacs_sprintf_string_lisp(); but this
4435 whole stuff is getting junked and replaced from my stderr-proc ws */
4432 if (!NILP (errordata)) 4436 if (!NILP (errordata))
4433 { 4437 {
4434 Lisp_Object args[2]; 4438 Lisp_Object args[2];
4435 4439
4436 if (!NILP (arg)) 4440 if (!NILP (arg))
4437 { 4441 {
4438 CIntbyte *str = (CIntbyte *) get_opaque_ptr (arg); 4442 Intbyte *str = (Intbyte *) get_opaque_ptr (arg);
4439 args[0] = build_string (str); 4443 args[0] = build_intstring (str);
4440 } 4444 }
4441 else 4445 else
4442 args[0] = build_string ("error"); 4446 args[0] = build_msg_string ("error");
4443 /* #### This should call 4447 /* #### This should call
4444 (with-output-to-string (display-error errordata)) 4448 (with-output-to-string (display-error errordata))
4445 but that stuff is all in Lisp currently. */ 4449 but that stuff is all in Lisp currently. */
4446 args[1] = errordata; 4450 args[1] = errordata;
4447 warn_when_safe_lispobj 4451 warn_when_safe_lispobj
4448 (Qerror, Qwarning, 4452 (Qerror, Qwarning,
4449 emacs_doprnt_string_lisp ((const Intbyte *) "%s: %s", 4453 emacs_vsprintf_string_lisp ("%s: %s", Qnil, 2, args));
4450 Qnil, -1, 2, args));
4451 } 4454 }
4452 return Qunbound; 4455 return Qunbound;
4453 } 4456 }
4454 4457
4455 static Lisp_Object 4458 static Lisp_Object
4500 struct gcpro gcpro1, gcpro2; 4503 struct gcpro gcpro1, gcpro2;
4501 4504
4502 XSETBUFFER (buffer, buf); 4505 XSETBUFFER (buffer, buf);
4503 4506
4504 specbind (Qinhibit_quit, Qt); 4507 specbind (Qinhibit_quit, Qt);
4505 /* gc_currently_forbidden = 1; Currently no reason to do this; */ 4508 /* begin_gc_forbidden(); Currently no reason to do this; */
4506 4509
4507 cons = noseeum_cons (buffer, form); 4510 cons = noseeum_cons (buffer, form);
4508 opaque = (warning_string ? make_opaque_ptr ((void *)warning_string) : Qnil); 4511 opaque = (warning_string ? make_opaque_ptr ((void *)warning_string) : Qnil);
4509 GCPRO2 (cons, opaque); 4512 GCPRO2 (cons, opaque);
4510 /* Qerror not Qt, so you can get a backtrace */ 4513 /* Qerror not Qt, so you can get a backtrace */
4514 free_cons (XCONS (cons)); 4517 free_cons (XCONS (cons));
4515 if (OPAQUE_PTRP (opaque)) 4518 if (OPAQUE_PTRP (opaque))
4516 free_opaque_ptr (opaque); 4519 free_opaque_ptr (opaque);
4517 UNGCPRO; 4520 UNGCPRO;
4518 4521
4519 /* gc_currently_forbidden = 0; */ 4522 return unbind_to_1 (speccount, tem);
4520 return unbind_to (speccount, tem);
4521 } 4523 }
4522 4524
4523 static Lisp_Object 4525 static Lisp_Object
4524 catch_them_squirmers_run_hook (Lisp_Object hook_symbol) 4526 catch_them_squirmers_run_hook (Lisp_Object hook_symbol)
4525 { 4527 {
4554 caught_a_squirmer, opaque); 4556 caught_a_squirmer, opaque);
4555 if (OPAQUE_PTRP (opaque)) 4557 if (OPAQUE_PTRP (opaque))
4556 free_opaque_ptr (opaque); 4558 free_opaque_ptr (opaque);
4557 UNGCPRO; 4559 UNGCPRO;
4558 4560
4559 return unbind_to (speccount, tem); 4561 return unbind_to_1 (speccount, tem);
4560 } 4562 }
4561 4563
4562 /* Same as run_hook_trapping_errors() but also set the hook to nil 4564 /* Same as run_hook_trapping_errors() but also set the hook to nil
4563 if an error occurs. */ 4565 if an error occurs. */
4564 4566
4596 if (OPAQUE_PTRP (XCDR (cons))) 4598 if (OPAQUE_PTRP (XCDR (cons)))
4597 free_opaque_ptr (XCDR (cons)); 4599 free_opaque_ptr (XCDR (cons));
4598 free_cons (XCONS (cons)); 4600 free_cons (XCONS (cons));
4599 UNGCPRO; 4601 UNGCPRO;
4600 4602
4601 return unbind_to (speccount, tem); 4603 return unbind_to_1 (speccount, tem);
4602 } 4604 }
4603 4605
4604 static Lisp_Object 4606 static Lisp_Object
4605 catch_them_squirmers_call0 (Lisp_Object function) 4607 catch_them_squirmers_call0 (Lisp_Object function)
4606 { 4608 {
4624 } 4626 }
4625 4627
4626 GCPRO2 (opaque, function); 4628 GCPRO2 (opaque, function);
4627 speccount = specpdl_depth(); 4629 speccount = specpdl_depth();
4628 specbind (Qinhibit_quit, Qt); 4630 specbind (Qinhibit_quit, Qt);
4629 /* gc_currently_forbidden = 1; Currently no reason to do this; */ 4631 /* begin_gc_forbidden(); Currently no reason to do this; */
4630 4632
4631 opaque = (warning_string ? make_opaque_ptr ((void *)warning_string) : Qnil); 4633 opaque = (warning_string ? make_opaque_ptr ((void *)warning_string) : Qnil);
4632 /* Qerror not Qt, so you can get a backtrace */ 4634 /* Qerror not Qt, so you can get a backtrace */
4633 tem = condition_case_1 (Qerror, 4635 tem = condition_case_1 (Qerror,
4634 catch_them_squirmers_call0, function, 4636 catch_them_squirmers_call0, function,
4635 caught_a_squirmer, opaque); 4637 caught_a_squirmer, opaque);
4636 if (OPAQUE_PTRP (opaque)) 4638 if (OPAQUE_PTRP (opaque))
4637 free_opaque_ptr (opaque); 4639 free_opaque_ptr (opaque);
4638 UNGCPRO; 4640 UNGCPRO;
4639 4641
4640 /* gc_currently_forbidden = 0; */ 4642 return unbind_to_1 (speccount, tem);
4641 return unbind_to (speccount, tem);
4642 } 4643 }
4643 4644
4644 static Lisp_Object 4645 static Lisp_Object
4645 catch_them_squirmers_call1 (Lisp_Object cons) 4646 catch_them_squirmers_call1 (Lisp_Object cons)
4646 { 4647 {
4673 } 4674 }
4674 4675
4675 GCPRO4 (cons, opaque, function, object); 4676 GCPRO4 (cons, opaque, function, object);
4676 4677
4677 specbind (Qinhibit_quit, Qt); 4678 specbind (Qinhibit_quit, Qt);
4678 /* gc_currently_forbidden = 1; Currently no reason to do this; */ 4679 /* begin_gc_forbidden(); Currently no reason to do this; */
4679 4680
4680 cons = noseeum_cons (function, object); 4681 cons = noseeum_cons (function, object);
4681 opaque = (warning_string ? make_opaque_ptr ((void *)warning_string) : Qnil); 4682 opaque = (warning_string ? make_opaque_ptr ((void *)warning_string) : Qnil);
4682 /* Qerror not Qt, so you can get a backtrace */ 4683 /* Qerror not Qt, so you can get a backtrace */
4683 tem = condition_case_1 (Qerror, 4684 tem = condition_case_1 (Qerror,
4686 if (OPAQUE_PTRP (opaque)) 4687 if (OPAQUE_PTRP (opaque))
4687 free_opaque_ptr (opaque); 4688 free_opaque_ptr (opaque);
4688 free_cons (XCONS (cons)); 4689 free_cons (XCONS (cons));
4689 UNGCPRO; 4690 UNGCPRO;
4690 4691
4691 /* gc_currently_forbidden = 0; */ 4692 return unbind_to_1 (speccount, tem);
4692 return unbind_to (speccount, tem);
4693 } 4693 }
4694 4694
4695 Lisp_Object 4695 Lisp_Object
4696 call2_trapping_errors (const CIntbyte *warning_string, Lisp_Object function, 4696 call2_trapping_errors (const CIntbyte *warning_string, Lisp_Object function,
4697 Lisp_Object object1, Lisp_Object object2) 4697 Lisp_Object object1, Lisp_Object object2)
4709 return Qnil; 4709 return Qnil;
4710 } 4710 }
4711 4711
4712 GCPRO5 (cons, opaque, function, object1, object2); 4712 GCPRO5 (cons, opaque, function, object1, object2);
4713 specbind (Qinhibit_quit, Qt); 4713 specbind (Qinhibit_quit, Qt);
4714 /* gc_currently_forbidden = 1; Currently no reason to do this; */ 4714 /* begin_gc_forbidden(); Currently no reason to do this; */
4715 4715
4716 cons = list3 (function, object1, object2); 4716 cons = list3 (function, object1, object2);
4717 opaque = (warning_string ? make_opaque_ptr ((void *)warning_string) : Qnil); 4717 opaque = (warning_string ? make_opaque_ptr ((void *)warning_string) : Qnil);
4718 /* Qerror not Qt, so you can get a backtrace */ 4718 /* Qerror not Qt, so you can get a backtrace */
4719 tem = condition_case_1 (Qerror, 4719 tem = condition_case_1 (Qerror,
4722 if (OPAQUE_PTRP (opaque)) 4722 if (OPAQUE_PTRP (opaque))
4723 free_opaque_ptr (opaque); 4723 free_opaque_ptr (opaque);
4724 free_list (cons); 4724 free_list (cons);
4725 UNGCPRO; 4725 UNGCPRO;
4726 4726
4727 /* gc_currently_forbidden = 0; */ 4727 return unbind_to_1 (speccount, tem);
4728 return unbind_to (speccount, tem);
4729 } 4728 }
4730 4729
4731 4730
4732 /************************************************************************/ 4731 /************************************************************************/
4733 /* The special binding stack */ 4732 /* The special binding stack */
4734 /* Most C code should simply use specbind() and unbind_to(). */ 4733 /* Most C code should simply use specbind() and unbind_to_1(). */
4735 /* When performance is critical, use the macros in backtrace.h. */ 4734 /* When performance is critical, use the macros in backtrace.h. */
4736 /************************************************************************/ 4735 /************************************************************************/
4737 4736
4738 #define min_max_specpdl_size 400 4737 #define min_max_specpdl_size 400
4739 4738
4852 symbol_value_buffer_local_info (symbol, current_buffer); 4851 symbol_value_buffer_local_info (symbol, current_buffer);
4853 4852
4854 if (buffer_local == 0) 4853 if (buffer_local == 0)
4855 { 4854 {
4856 specpdl_ptr->old_value = find_symbol_value (symbol); 4855 specpdl_ptr->old_value = find_symbol_value (symbol);
4857 specpdl_ptr->func = 0; /* Handled specially by unbind_to */ 4856 specpdl_ptr->func = 0; /* Handled specially by unbind_to_1 */
4858 } 4857 }
4859 else if (buffer_local > 0) 4858 else if (buffer_local > 0)
4860 { 4859 {
4861 /* Already buffer-local */ 4860 /* Already buffer-local */
4862 specpdl_ptr->old_value = noseeum_cons (Fcurrent_buffer (), 4861 specpdl_ptr->old_value = noseeum_cons (Fcurrent_buffer (),
4875 specpdl_depth_counter++; 4874 specpdl_depth_counter++;
4876 4875
4877 Fset (symbol, value); 4876 Fset (symbol, value);
4878 } 4877 }
4879 4878
4880 /* Note: As long as the unwind-protect exists, its arg is automatically 4879 /* Record an unwind-protect -- FUNCTION will be called with ARG no matter
4881 GCPRO'd. */ 4880 whether a normal or non-local exit occurs. (You need to call unbind_to_1()
4882 4881 before your function returns normally, passing in the integer returned
4883 void 4882 by this function.) Note: As long as the unwind-protect exists, ARG is
4883 automatically GCPRO'd. The return value from FUNCTION is completely
4884 ignored. #### We should eliminate it entirely. */
4885
4886 int
4884 record_unwind_protect (Lisp_Object (*function) (Lisp_Object arg), 4887 record_unwind_protect (Lisp_Object (*function) (Lisp_Object arg),
4885 Lisp_Object arg) 4888 Lisp_Object arg)
4886 { 4889 {
4887 SPECPDL_RESERVE (1); 4890 SPECPDL_RESERVE (1);
4888 specpdl_ptr->func = function; 4891 specpdl_ptr->func = function;
4889 specpdl_ptr->symbol = Qnil; 4892 specpdl_ptr->symbol = Qnil;
4890 specpdl_ptr->old_value = arg; 4893 specpdl_ptr->old_value = arg;
4891 specpdl_ptr++; 4894 specpdl_ptr++;
4892 specpdl_depth_counter++; 4895 specpdl_depth_counter++;
4893 } 4896 return specpdl_depth_counter - 1;
4894 4897 }
4895 extern int check_sigio (void); 4898
4899 static Lisp_Object
4900 free_pointer (Lisp_Object opaque)
4901 {
4902 xfree (get_opaque_ptr (opaque));
4903 free_opaque_ptr (opaque);
4904 return Qnil;
4905 }
4906
4907 /* Establish an unwind-protect which will free the specified block.
4908 */
4909 int
4910 record_unwind_protect_freeing (void *ptr)
4911 {
4912 Lisp_Object opaque = make_opaque_ptr (ptr);
4913 return record_unwind_protect (free_pointer, opaque);
4914 }
4915
4916 static Lisp_Object
4917 free_dynarr (Lisp_Object opaque)
4918 {
4919 Dynarr_free (get_opaque_ptr (opaque));
4920 free_opaque_ptr (opaque);
4921 return Qnil;
4922 }
4923
4924 int
4925 record_unwind_protect_freeing_dynarr (void *ptr)
4926 {
4927 Lisp_Object opaque = make_opaque_ptr (ptr);
4928 return record_unwind_protect (free_dynarr, opaque);
4929 }
4896 4930
4897 /* Unwind the stack till specpdl_depth() == COUNT. 4931 /* Unwind the stack till specpdl_depth() == COUNT.
4898 VALUE is not used, except that, purely as a convenience to the 4932 VALUE is not used, except that, purely as a convenience to the
4899 caller, it is protected from garbage-protection. */ 4933 caller, it is protected from garbage-protection and returned. */
4900 Lisp_Object 4934 Lisp_Object
4901 unbind_to (int count, Lisp_Object value) 4935 unbind_to_1 (int count, Lisp_Object value)
4902 { 4936 {
4903 UNBIND_TO_GCPRO (count, value); 4937 UNBIND_TO_GCPRO (count, value);
4904 return value; 4938 return value;
4905 } 4939 }
4906 4940
4907 /* Don't call this directly. 4941 /* Don't call this directly.
4908 Only for use by UNBIND_TO* macros in backtrace.h */ 4942 Only for use by UNBIND_TO* macros in backtrace.h */
4909 void 4943 void
4910 unbind_to_hairy (int count) 4944 unbind_to_hairy (int count)
4911 { 4945 {
4912 int quitf; 4946 Lisp_Object oquit;
4913 4947
4914 ++specpdl_ptr; 4948 ++specpdl_ptr;
4915 ++specpdl_depth_counter; 4949 ++specpdl_depth_counter;
4916 4950
4951 /* Allow QUIT within unwind-protect routines, but defer any existing QUIT
4952 until afterwards. */
4917 check_quit (); /* make Vquit_flag accurate */ 4953 check_quit (); /* make Vquit_flag accurate */
4918 quitf = !NILP (Vquit_flag); 4954 oquit = Vquit_flag;
4919 Vquit_flag = Qnil; 4955 Vquit_flag = Qnil;
4920 4956
4921 while (specpdl_depth_counter != count) 4957 while (specpdl_depth_counter != count)
4922 { 4958 {
4923 --specpdl_ptr; 4959 --specpdl_ptr;
4955 /* Don't mess with gcprolist, backtrace_list here */ 4991 /* Don't mess with gcprolist, backtrace_list here */
4956 } 4992 }
4957 #endif 4993 #endif
4958 #endif 4994 #endif
4959 } 4995 }
4960 if (quitf) 4996 Vquit_flag = oquit;
4961 Vquit_flag = Qt;
4962 } 4997 }
4963 4998
4964 4999
4965 5000
4966 /* Get the value of symbol's global binding, even if that binding is 5001 /* Get the value of symbol's global binding, even if that binding is
5254 { 5289 {
5255 Lisp_Object obj; 5290 Lisp_Object obj;
5256 va_list args; 5291 va_list args;
5257 5292
5258 va_start (args, fmt); 5293 va_start (args, fmt);
5259 obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), 5294 obj = emacs_vsprintf_string (CGETTEXT (fmt), args);
5260 Qnil, -1, args);
5261 va_end (args); 5295 va_end (args);
5262 5296
5263 warn_when_safe_lispobj (class, level, obj); 5297 warn_when_safe_lispobj (class, level, obj);
5264 } 5298 }
5265 5299
5342 DEFSUBR (Fbacktrace); 5376 DEFSUBR (Fbacktrace);
5343 DEFSUBR (Fbacktrace_frame); 5377 DEFSUBR (Fbacktrace_frame);
5344 } 5378 }
5345 5379
5346 void 5380 void
5347 reinit_eval (void) 5381 init_eval_early (void)
5348 { 5382 {
5349 specpdl_ptr = specpdl; 5383 specpdl_ptr = specpdl;
5350 specpdl_depth_counter = 0; 5384 specpdl_depth_counter = 0;
5351 catchlist = 0; 5385 catchlist = 0;
5352 Vcondition_handlers = Qnil; 5386 Vcondition_handlers = Qnil;
5444 a `condition-case'. 5478 a `condition-case'.
5445 If the value is a list, an error only means to enter the debugger 5479 If the value is a list, an error only means to enter the debugger
5446 if one of its condition symbols appears in the list. 5480 if one of its condition symbols appears in the list.
5447 This variable is overridden by `debug-ignored-errors'. 5481 This variable is overridden by `debug-ignored-errors'.
5448 See also variables `debug-on-quit' and `debug-on-signal'. 5482 See also variables `debug-on-quit' and `debug-on-signal'.
5483 If this variable is set while XEmacs is running noninteractively,
5484 an unhandled error will cause a backtrace to be output and the C
5485 debugger entered using `force-debugging-signal'. This can be very
5486 useful when debugging noninteractive errors in tricky situations,
5487 e.g. makefiles, since you can set this variable using an environment
5488 variable, like this:
5489
5490 \(using csh) setenv XEMACSDEBUG '(setq debug-on-error t)'
5491 \(using bash) export XEMACSDEBUG='(setq debug-on-error t)'
5449 */ ); 5492 */ );
5450 Vdebug_on_error = Qnil; 5493 Vdebug_on_error = Qnil;
5451 5494
5452 DEFVAR_LISP ("debug-on-signal", &Vdebug_on_signal /* 5495 DEFVAR_LISP ("debug-on-signal", &Vdebug_on_signal /*
5453 *Non-nil means enter debugger if an error is signalled. 5496 *Non-nil means enter debugger if an error is signalled.
5494 staticpro (&Vcurrent_warning_class); 5537 staticpro (&Vcurrent_warning_class);
5495 Vcurrent_warning_class = Qnil; 5538 Vcurrent_warning_class = Qnil;
5496 5539
5497 staticpro (&Vcurrent_error_state); 5540 staticpro (&Vcurrent_error_state);
5498 Vcurrent_error_state = Qnil; /* errors as normal */ 5541 Vcurrent_error_state = Qnil; /* errors as normal */
5499 5542 }
5500 reinit_eval ();
5501 }