Mercurial > hg > xemacs-beta
comparison src/eval.c @ 185:3d6bfa290dbd r20-3b19
Import from CVS: tag r20-3b19
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:55:28 +0200 |
parents | bfd6434d15b3 |
children | b405438285a2 |
comparison
equal
deleted
inserted
replaced
184:bcd2674570bf | 185:3d6bfa290dbd |
---|---|
67 in the specpdl stack (used for variable bindings and | 67 in the specpdl stack (used for variable bindings and |
68 unwind-protects), the value of LISP_EVAL_DEPTH, and the | 68 unwind-protects), the value of LISP_EVAL_DEPTH, and the |
69 current position in the GCPRO stack. All of these are | 69 current position in the GCPRO stack. All of these are |
70 restored by Fthrow(). | 70 restored by Fthrow(). |
71 */ | 71 */ |
72 | 72 |
73 struct catchtag *catchlist; | 73 struct catchtag *catchlist; |
74 | 74 |
75 Lisp_Object Qautoload, Qmacro, Qexit; | 75 Lisp_Object Qautoload, Qmacro, Qexit; |
76 Lisp_Object Qinteractive, Qcommandp, Qdefun, Qprogn, Qvalues; | 76 Lisp_Object Qinteractive, Qcommandp, Qdefun, Qprogn, Qvalues; |
77 Lisp_Object Vquit_flag, Vinhibit_quit; | 77 Lisp_Object Vquit_flag, Vinhibit_quit; |
179 invocations. */ | 179 invocations. */ |
180 int when_entered_debugger; | 180 int when_entered_debugger; |
181 #endif | 181 #endif |
182 | 182 |
183 /* Nonzero means we are trying to enter the debugger. | 183 /* Nonzero means we are trying to enter the debugger. |
184 This is to prevent recursive attempts. | 184 This is to prevent recursive attempts. |
185 Cleared by the debugger calling Fbacktrace */ | 185 Cleared by the debugger calling Fbacktrace */ |
186 static int entering_debugger; | 186 static int entering_debugger; |
187 | 187 |
188 /* Function to call to invoke the debugger */ | 188 /* Function to call to invoke the debugger */ |
189 Lisp_Object Vdebugger; | 189 Lisp_Object Vdebugger; |
256 | 256 |
257 write_c_string (((subr->max_args == UNEVALLED) | 257 write_c_string (((subr->max_args == UNEVALLED) |
258 ? "#<special-form " | 258 ? "#<special-form " |
259 : "#<subr "), | 259 : "#<subr "), |
260 printcharfun); | 260 printcharfun); |
261 | 261 |
262 write_c_string (subr_name (subr), printcharfun); | 262 write_c_string (subr_name (subr), printcharfun); |
263 write_c_string (((subr->prompt) ? " (interactive)>" : ">"), | 263 write_c_string (((subr->prompt) ? " (interactive)>" : ">"), |
264 printcharfun); | 264 printcharfun); |
265 } | 265 } |
266 | 266 |
301 && b1->flags.interactivep == b2->flags.interactivep | 301 && b1->flags.interactivep == b2->flags.interactivep |
302 && b1->flags.domainp == b2->flags.domainp /* I18N3 */ | 302 && b1->flags.domainp == b2->flags.domainp /* I18N3 */ |
303 && internal_equal (b1->bytecodes, b2->bytecodes, depth + 1) | 303 && internal_equal (b1->bytecodes, b2->bytecodes, depth + 1) |
304 && internal_equal (b1->constants, b2->constants, depth + 1) | 304 && internal_equal (b1->constants, b2->constants, depth + 1) |
305 && internal_equal (b1->arglist, b2->arglist, depth + 1) | 305 && internal_equal (b1->arglist, b2->arglist, depth + 1) |
306 && internal_equal (b1->doc_and_interactive, | 306 && internal_equal (b1->doc_and_interactive, |
307 b2->doc_and_interactive, depth + 1)); | 307 b2->doc_and_interactive, depth + 1)); |
308 } | 308 } |
309 | 309 |
310 static unsigned long | 310 static unsigned long |
311 compiled_function_hash (Lisp_Object obj, int depth) | 311 compiled_function_hash (Lisp_Object obj, int depth) |
397 if (specpdl_size + 40 > max_specpdl_size) | 397 if (specpdl_size + 40 > max_specpdl_size) |
398 max_specpdl_size = specpdl_size + 40; | 398 max_specpdl_size = specpdl_size + 40; |
399 debug_on_next_call = 0; | 399 debug_on_next_call = 0; |
400 | 400 |
401 speccount = specpdl_depth_counter; | 401 speccount = specpdl_depth_counter; |
402 record_unwind_protect (restore_entering_debugger, | 402 record_unwind_protect (restore_entering_debugger, |
403 (entering_debugger ? Qt : Qnil)); | 403 (entering_debugger ? Qt : Qnil)); |
404 entering_debugger = 1; | 404 entering_debugger = 1; |
405 val = internal_catch (Qdebugger, call_debugger_259, arg, &threw); | 405 val = internal_catch (Qdebugger, call_debugger_259, arg, &threw); |
406 | 406 |
407 return unbind_to (speccount, ((threw) | 407 return unbind_to (speccount, ((threw) |
408 ? Qunbound /* Not returning a value */ | 408 ? Qunbound /* Not returning a value */ |
409 : val)); | 409 : val)); |
410 } | 410 } |
411 | 411 |
412 /* Called when debug-on-exit behavior is called for. Enter the debugger | 412 /* Called when debug-on-exit behavior is called for. Enter the debugger |
571 { | 571 { |
572 specbind (Qdebug_on_error, Qnil); | 572 specbind (Qdebug_on_error, Qnil); |
573 specbind (Qstack_trace_on_error, Qnil); | 573 specbind (Qstack_trace_on_error, Qnil); |
574 specbind (Qdebug_on_signal, Qnil); | 574 specbind (Qdebug_on_signal, Qnil); |
575 specbind (Qstack_trace_on_signal, Qnil); | 575 specbind (Qstack_trace_on_signal, Qnil); |
576 | 576 |
577 internal_with_output_to_temp_buffer ("*Backtrace*", | 577 internal_with_output_to_temp_buffer ("*Backtrace*", |
578 backtrace_259, | 578 backtrace_259, |
579 Qnil, | 579 Qnil, |
580 Qnil); | 580 Qnil); |
581 unbind_to (speccount, Qnil); | 581 unbind_to (speccount, Qnil); |
582 *stack_trace_displayed = 1; | 582 *stack_trace_displayed = 1; |
583 } | 583 } |
584 | 584 |
585 if (!entering_debugger && !*debugger_entered && !signal_vars_only | 585 if (!entering_debugger && !*debugger_entered && !signal_vars_only |
586 && (EQ (sig, Qquit) | 586 && (EQ (sig, Qquit) |
587 ? debug_on_quit | 587 ? debug_on_quit |
588 : wants_debugger (Vdebug_on_error, conditions)) | 588 : wants_debugger (Vdebug_on_error, conditions)) |
589 && !skip_debugger (conditions, temp_data)) | 589 && !skip_debugger (conditions, temp_data)) |
591 debug_on_quit &= ~2; /* reset critical bit */ | 591 debug_on_quit &= ~2; /* reset critical bit */ |
592 specbind (Qdebug_on_error, Qnil); | 592 specbind (Qdebug_on_error, Qnil); |
593 specbind (Qstack_trace_on_error, Qnil); | 593 specbind (Qstack_trace_on_error, Qnil); |
594 specbind (Qdebug_on_signal, Qnil); | 594 specbind (Qdebug_on_signal, Qnil); |
595 specbind (Qstack_trace_on_signal, Qnil); | 595 specbind (Qstack_trace_on_signal, Qnil); |
596 | 596 |
597 val = call_debugger (list2 (Qerror, (Fcons (sig, data)))); | 597 val = call_debugger (list2 (Qerror, (Fcons (sig, data)))); |
598 *debugger_entered = 1; | 598 *debugger_entered = 1; |
599 } | 599 } |
600 | 600 |
601 if (!entering_debugger && !*stack_trace_displayed | 601 if (!entering_debugger && !*stack_trace_displayed |
603 { | 603 { |
604 specbind (Qdebug_on_error, Qnil); | 604 specbind (Qdebug_on_error, Qnil); |
605 specbind (Qstack_trace_on_error, Qnil); | 605 specbind (Qstack_trace_on_error, Qnil); |
606 specbind (Qdebug_on_signal, Qnil); | 606 specbind (Qdebug_on_signal, Qnil); |
607 specbind (Qstack_trace_on_signal, Qnil); | 607 specbind (Qstack_trace_on_signal, Qnil); |
608 | 608 |
609 internal_with_output_to_temp_buffer ("*Backtrace*", | 609 internal_with_output_to_temp_buffer ("*Backtrace*", |
610 backtrace_259, | 610 backtrace_259, |
611 Qnil, | 611 Qnil, |
612 Qnil); | 612 Qnil); |
613 unbind_to (speccount, Qnil); | 613 unbind_to (speccount, Qnil); |
622 debug_on_quit &= ~2; /* reset critical bit */ | 622 debug_on_quit &= ~2; /* reset critical bit */ |
623 specbind (Qdebug_on_error, Qnil); | 623 specbind (Qdebug_on_error, Qnil); |
624 specbind (Qstack_trace_on_error, Qnil); | 624 specbind (Qstack_trace_on_error, Qnil); |
625 specbind (Qdebug_on_signal, Qnil); | 625 specbind (Qdebug_on_signal, Qnil); |
626 specbind (Qstack_trace_on_signal, Qnil); | 626 specbind (Qstack_trace_on_signal, Qnil); |
627 | 627 |
628 val = call_debugger (list2 (Qerror, (Fcons (sig, data)))); | 628 val = call_debugger (list2 (Qerror, (Fcons (sig, data)))); |
629 *debugger_entered = 1; | 629 *debugger_entered = 1; |
630 } | 630 } |
631 | 631 |
632 UNGCPRO; | 632 UNGCPRO; |
914 | 914 |
915 varlist = Fcar (args); | 915 varlist = Fcar (args); |
916 | 916 |
917 /* Make space to hold the values to give the bound variables */ | 917 /* Make space to hold the values to give the bound variables */ |
918 elt = Flength (varlist); | 918 elt = Flength (varlist); |
919 temps = (Lisp_Object *) alloca (XINT (elt) * sizeof (Lisp_Object)); | 919 temps = alloca_array (Lisp_Object, XINT (elt)); |
920 | 920 |
921 /* Compute the values and store them in `temps' */ | 921 /* Compute the values and store them in `temps' */ |
922 | 922 |
923 GCPRO2 (args, *temps); | 923 GCPRO2 (args, *temps); |
924 gcpro2.nvars = 0; | 924 gcpro2.nvars = 0; |
976 | 976 |
977 UNGCPRO; | 977 UNGCPRO; |
978 return Qnil; | 978 return Qnil; |
979 } | 979 } |
980 | 980 |
981 Lisp_Object Qsetq; | |
982 | |
983 DEFUN ("setq", Fsetq, 0, UNEVALLED, 0, /* | 981 DEFUN ("setq", Fsetq, 0, UNEVALLED, 0, /* |
984 (setq SYM VAL SYM VAL ...): set each SYM to the value of its VAL. | 982 (setq SYM VAL SYM VAL ...): set each SYM to the value of its VAL. |
985 The symbols SYM are variables; they are literal (not evaluated). | 983 The symbols SYM are variables; they are literal (not evaluated). |
986 The values VAL are expressions; they are evaluated. | 984 The values VAL are expressions; they are evaluated. |
987 Thus, (setq x (1+ y)) sets `x' to the value of `(1+ y)'. | 985 Thus, (setq x (1+ y)) sets `x' to the value of `(1+ y)'. |
1016 while (!NILP (args_left)); | 1014 while (!NILP (args_left)); |
1017 | 1015 |
1018 UNGCPRO; | 1016 UNGCPRO; |
1019 return val; | 1017 return val; |
1020 } | 1018 } |
1021 | 1019 |
1022 DEFUN ("quote", Fquote, 1, UNEVALLED, 0, /* | 1020 DEFUN ("quote", Fquote, 1, UNEVALLED, 0, /* |
1023 Return the argument, without evaluating it. `(quote x)' yields `x'. | 1021 Return the argument, without evaluating it. `(quote x)' yields `x'. |
1024 */ | 1022 */ |
1025 (args)) | 1023 (args)) |
1026 { | 1024 { |
1027 return Fcar (args); | 1025 return Fcar (args); |
1028 } | 1026 } |
1029 | 1027 |
1030 DEFUN ("function", Ffunction, 1, UNEVALLED, 0, /* | 1028 DEFUN ("function", Ffunction, 1, UNEVALLED, 0, /* |
1031 Like `quote', but preferred for objects which are functions. | 1029 Like `quote', but preferred for objects which are functions. |
1032 In byte compilation, `function' causes its argument to be compiled. | 1030 In byte compilation, `function' causes its argument to be compiled. |
1033 `quote' cannot do that. | 1031 `quote' cannot do that. |
1034 */ | 1032 */ |
1202 for the variable is `*'. | 1200 for the variable is `*'. |
1203 */ | 1201 */ |
1204 (variable)) | 1202 (variable)) |
1205 { | 1203 { |
1206 Lisp_Object documentation; | 1204 Lisp_Object documentation; |
1207 | 1205 |
1208 documentation = Fget (variable, Qvariable_documentation, Qnil); | 1206 documentation = Fget (variable, Qvariable_documentation, Qnil); |
1209 if (INTP (documentation) && XINT (documentation) < 0) | 1207 if (INTP (documentation) && XINT (documentation) < 0) |
1210 return Qt; | 1208 return Qt; |
1211 if ((STRINGP (documentation)) && | 1209 if ((STRINGP (documentation)) && |
1212 (string_byte (XSTRING (documentation), 0) == '*')) | 1210 (string_byte (XSTRING (documentation), 0) == '*')) |
1216 && STRINGP (XCAR (documentation)) | 1214 && STRINGP (XCAR (documentation)) |
1217 && INTP (XCDR (documentation)) | 1215 && INTP (XCDR (documentation)) |
1218 && XINT (XCDR (documentation)) < 0) | 1216 && XINT (XCDR (documentation)) < 0) |
1219 return Qt; | 1217 return Qt; |
1220 return Qnil; | 1218 return Qnil; |
1221 } | 1219 } |
1222 | 1220 |
1223 DEFUN ("macroexpand-internal", Fmacroexpand_internal, 1, 2, 0, /* | 1221 DEFUN ("macroexpand-internal", Fmacroexpand_internal, 1, 2, 0, /* |
1224 Return result of expanding macros at top level of FORM. | 1222 Return result of expanding macros at top level of FORM. |
1225 If FORM is not a macro call, it is returned unchanged. | 1223 If FORM is not a macro call, it is returned unchanged. |
1226 Otherwise, the macro is expanded and the expansion is considered | 1224 Otherwise, the macro is expanded and the expansion is considered |
1324 /* Set up a catch, then call C function FUNC on argument ARG. | 1322 /* Set up a catch, then call C function FUNC on argument ARG. |
1325 FUNC should return a Lisp_Object. | 1323 FUNC should return a Lisp_Object. |
1326 This is how catches are done from within C code. */ | 1324 This is how catches are done from within C code. */ |
1327 | 1325 |
1328 Lisp_Object | 1326 Lisp_Object |
1329 internal_catch (Lisp_Object tag, | 1327 internal_catch (Lisp_Object tag, |
1330 Lisp_Object (*func) (Lisp_Object arg), | 1328 Lisp_Object (*func) (Lisp_Object arg), |
1331 Lisp_Object arg, | 1329 Lisp_Object arg, |
1332 int *threw) | 1330 int *threw) |
1333 { | 1331 { |
1334 /* This structure is made part of the chain `catchlist'. */ | 1332 /* This structure is made part of the chain `catchlist'. */ |
1395 At the end, restore some static info saved in CATCH, | 1393 At the end, restore some static info saved in CATCH, |
1396 and longjmp to the location specified. | 1394 and longjmp to the location specified. |
1397 */ | 1395 */ |
1398 | 1396 |
1399 /* Save the value somewhere it will be GC'ed. | 1397 /* Save the value somewhere it will be GC'ed. |
1400 (Can't overwrite tag slot because an unwind-protect may | 1398 (Can't overwrite tag slot because an unwind-protect may |
1401 want to throw to this same tag, which isn't yet invalid.) */ | 1399 want to throw to this same tag, which isn't yet invalid.) */ |
1402 c->val = val; | 1400 c->val = val; |
1403 | 1401 |
1404 #if 0 /* FSFmacs */ | 1402 #if 0 /* FSFmacs */ |
1405 /* Restore the polling-suppression count. */ | 1403 /* Restore the polling-suppression count. */ |
1429 backtrace_list = c->backlist; | 1427 backtrace_list = c->backlist; |
1430 lisp_eval_depth = c->lisp_eval_depth; | 1428 lisp_eval_depth = c->lisp_eval_depth; |
1431 | 1429 |
1432 throw_level = 0; | 1430 throw_level = 0; |
1433 LONGJMP (c->jmp, 1); | 1431 LONGJMP (c->jmp, 1); |
1434 } | 1432 } |
1435 | 1433 |
1436 static DOESNT_RETURN | 1434 static DOESNT_RETURN |
1437 throw_or_bomb_out (Lisp_Object tag, Lisp_Object val, int bomb_out_p, | 1435 throw_or_bomb_out (Lisp_Object tag, Lisp_Object val, int bomb_out_p, |
1438 Lisp_Object sig, Lisp_Object data) | 1436 Lisp_Object sig, Lisp_Object data) |
1439 { | 1437 { |
1453 occurs is when there's no catch for 'top-level -- the | 1451 occurs is when there's no catch for 'top-level -- the |
1454 'top-level catch and the catch-all error handler are | 1452 'top-level catch and the catch-all error handler are |
1455 established at the same time, in initial_command_loop/ | 1453 established at the same time, in initial_command_loop/ |
1456 top_level_1. | 1454 top_level_1. |
1457 | 1455 |
1458 #### Fix this horrifitude! | 1456 #### Fix this horrifitude! |
1459 */ | 1457 */ |
1460 | 1458 |
1461 while (1) | 1459 while (1) |
1462 { | 1460 { |
1463 REGISTER struct catchtag *c; | 1461 REGISTER struct catchtag *c; |
1464 | 1462 |
1465 #if 0 /* FSFmacs */ | 1463 #if 0 /* FSFmacs */ |
1701 /* This function can GC */ | 1699 /* This function can GC */ |
1702 #if 0 /* FSFmacs */ | 1700 #if 0 /* FSFmacs */ |
1703 if (!NILP (h.var)) | 1701 if (!NILP (h.var)) |
1704 specbind (h.var, c.val); | 1702 specbind (h.var, c.val); |
1705 val = Fprogn (Fcdr (h.chosen_clause)); | 1703 val = Fprogn (Fcdr (h.chosen_clause)); |
1706 | 1704 |
1707 /* Note that this just undoes the binding of h.var; whoever | 1705 /* Note that this just undoes the binding of h.var; whoever |
1708 longjumped to us unwound the stack to c.pdlcount before | 1706 longjumped to us unwound the stack to c.pdlcount before |
1709 throwing. */ | 1707 throwing. */ |
1710 unbind_to (c.pdlcount, Qnil); | 1708 unbind_to (c.pdlcount, Qnil); |
1711 return val; | 1709 return val; |
1724 | 1722 |
1725 /* Here for bytecode to call non-consfully. This is exactly like | 1723 /* Here for bytecode to call non-consfully. This is exactly like |
1726 condition-case except that it takes three arguments rather | 1724 condition-case except that it takes three arguments rather |
1727 than a single list of arguments. */ | 1725 than a single list of arguments. */ |
1728 Lisp_Object | 1726 Lisp_Object |
1729 Fcondition_case_3 (Lisp_Object bodyform, | 1727 Fcondition_case_3 (Lisp_Object bodyform, |
1730 Lisp_Object var, Lisp_Object handlers) | 1728 Lisp_Object var, Lisp_Object handlers) |
1731 { | 1729 { |
1732 /* This function can GC */ | 1730 /* This function can GC */ |
1733 Lisp_Object val; | 1731 Lisp_Object val; |
1734 | 1732 |
1736 | 1734 |
1737 for (val = handlers; ! NILP (val); val = Fcdr (val)) | 1735 for (val = handlers; ! NILP (val); val = Fcdr (val)) |
1738 { | 1736 { |
1739 Lisp_Object tem; | 1737 Lisp_Object tem; |
1740 tem = Fcar (val); | 1738 tem = Fcar (val); |
1741 if ((!NILP (tem)) | 1739 if ((!NILP (tem)) |
1742 && (!CONSP (tem) | 1740 && (!CONSP (tem) |
1743 || (!SYMBOLP (XCAR (tem)) && !CONSP (XCAR (tem))))) | 1741 || (!SYMBOLP (XCAR (tem)) && !CONSP (XCAR (tem))))) |
1744 signal_simple_error ("Invalid condition handler", tem); | 1742 signal_simple_error ("Invalid condition handler", tem); |
1745 } | 1743 } |
1746 | 1744 |
1747 return condition_case_1 (handlers, | 1745 return condition_case_1 (handlers, |
1748 Feval, bodyform, | 1746 Feval, bodyform, |
1749 run_condition_case_handlers, | 1747 run_condition_case_handlers, |
1750 var); | 1748 var); |
1751 } | 1749 } |
1752 | 1750 |
1788 { | 1786 { |
1789 /* This function can GC */ | 1787 /* This function can GC */ |
1790 return Fcondition_case_3 (Fcar (Fcdr (args)), | 1788 return Fcondition_case_3 (Fcar (Fcdr (args)), |
1791 Fcar (args), | 1789 Fcar (args), |
1792 Fcdr (Fcdr (args))); | 1790 Fcdr (Fcdr (args))); |
1793 } | 1791 } |
1794 | 1792 |
1795 DEFUN ("call-with-condition-handler", Fcall_with_condition_handler, 2, MANY, 0, /* | 1793 DEFUN ("call-with-condition-handler", Fcall_with_condition_handler, 2, MANY, 0, /* |
1796 Regain control when an error is signalled, without popping the stack. | 1794 Regain control when an error is signalled, without popping the stack. |
1797 Usage looks like (call-with-condition-handler HANDLER FUNCTION &rest ARGS). | 1795 Usage looks like (call-with-condition-handler HANDLER FUNCTION &rest ARGS). |
1798 This function is similar to `condition-case', but the handler is invoked | 1796 This function is similar to `condition-case', but the handler is invoked |
1961 Vcondition_handlers = all_handlers; | 1959 Vcondition_handlers = all_handlers; |
1962 } | 1960 } |
1963 | 1961 |
1964 /* It's a condition-case handler */ | 1962 /* It's a condition-case handler */ |
1965 | 1963 |
1966 /* t is used by handlers for all conditions, set up by C code. | 1964 /* t is used by handlers for all conditions, set up by C code. |
1967 * debugger is not called even if debug_on_error */ | 1965 * debugger is not called even if debug_on_error */ |
1968 else if (EQ (handler_data, Qt)) | 1966 else if (EQ (handler_data, Qt)) |
1969 { | 1967 { |
1970 UNGCPRO; | 1968 UNGCPRO; |
1971 return Fthrow (handlers, Fcons (sig, data)); | 1969 return Fthrow (handlers, Fcons (sig, data)); |
2022 #### The only time that no handler is present is during | 2020 #### The only time that no handler is present is during |
2023 temacs or perhaps very early in XEmacs. In both cases, | 2021 temacs or perhaps very early in XEmacs. In both cases, |
2024 there is no 'top-level catch. (That's why the | 2022 there is no 'top-level catch. (That's why the |
2025 "bomb-out" hack was added.) | 2023 "bomb-out" hack was added.) |
2026 | 2024 |
2027 #### Fix this horrifitude! | 2025 #### Fix this horrifitude! |
2028 */ | 2026 */ |
2029 signal_call_debugger (conditions, sig, data, Qnil, 0, | 2027 signal_call_debugger (conditions, sig, data, Qnil, 0, |
2030 &stack_trace_displayed, | 2028 &stack_trace_displayed, |
2031 &debugger_entered); | 2029 &debugger_entered); |
2032 UNGCPRO; | 2030 UNGCPRO; |
2154 errb = ERROR_ME_NOT; | 2152 errb = ERROR_ME_NOT; |
2155 no_error = Qt; | 2153 no_error = Qt; |
2156 } | 2154 } |
2157 else | 2155 else |
2158 no_error = Qnil; | 2156 no_error = Qnil; |
2159 | 2157 |
2160 va_start (vargs, nargs); | 2158 va_start (vargs, nargs); |
2161 for (i = 0; i < nargs; i++) | 2159 for (i = 0; i < nargs; i++) |
2162 args[i] = va_arg (vargs, Lisp_Object); | 2160 args[i] = va_arg (vargs, Lisp_Object); |
2163 va_end (vargs); | 2161 va_end (vargs); |
2164 | 2162 |
2165 /* If error-checking is not disabled, just call the function. | 2163 /* If error-checking is not disabled, just call the function. |
2166 It's important not to override disabled error-checking with | 2164 It's important not to override disabled error-checking with |
2167 enabled error-checking. */ | 2165 enabled error-checking. */ |
2168 | 2166 |
2169 if (ERRB_EQ (errb, ERROR_ME)) | 2167 if (ERRB_EQ (errb, ERROR_ME)) |
2170 return primitive_funcall (fun, nargs, args); | 2168 return primitive_funcall (fun, nargs, args); |
2171 | 2169 |
2172 speccount = specpdl_depth (); | 2170 speccount = specpdl_depth (); |
2173 if (NILP (class) || NILP (Vcurrent_warning_class)) | 2171 if (NILP (class) || NILP (Vcurrent_warning_class)) |
2364 if (ERRB_EQ (errb, ERROR_ME_NOT)) | 2362 if (ERRB_EQ (errb, ERROR_ME_NOT)) |
2365 return Qnil; | 2363 return Qnil; |
2366 return maybe_signal_continuable_error | 2364 return maybe_signal_continuable_error |
2367 (Qerror, list2 (build_translated_string (reason), | 2365 (Qerror, list2 (build_translated_string (reason), |
2368 frob), class, errb); | 2366 frob), class, errb); |
2369 } | 2367 } |
2370 | 2368 |
2371 | 2369 |
2372 /****************** Error functions class 4 ******************/ | 2370 /****************** Error functions class 4 ******************/ |
2373 | 2371 |
2374 /* Class 4: Printf-like functions that signal an error. | 2372 /* Class 4: Printf-like functions that signal an error. |
2504 signal_quit (void) | 2502 signal_quit (void) |
2505 { | 2503 { |
2506 /* This function can GC */ | 2504 /* This function can GC */ |
2507 if (EQ (Vquit_flag, Qcritical)) | 2505 if (EQ (Vquit_flag, Qcritical)) |
2508 debug_on_quit |= 2; /* set critical bit. */ | 2506 debug_on_quit |= 2; /* set critical bit. */ |
2509 Vquit_flag = Qnil; | 2507 Vquit_flag = Qnil; |
2510 /* note that this is continuable. */ | 2508 /* note that this is continuable. */ |
2511 Fsignal (Qquit, Qnil); | 2509 Fsignal (Qquit, Qnil); |
2512 } | 2510 } |
2513 | 2511 |
2514 | 2512 |
2674 if (EQ (*btp->function, Qbyte_code)) | 2672 if (EQ (*btp->function, Qbyte_code)) |
2675 btp = btp->next; | 2673 btp = btp->next; |
2676 | 2674 |
2677 /* If this isn't a byte-compiled function, then we may now be | 2675 /* If this isn't a byte-compiled function, then we may now be |
2678 looking at several frames for special forms. Skip past them. */ | 2676 looking at several frames for special forms. Skip past them. */ |
2679 while (btp && | 2677 while (btp && |
2680 btp->nargs == UNEVALLED) | 2678 btp->nargs == UNEVALLED) |
2681 btp = btp->next; | 2679 btp = btp->next; |
2682 | 2680 |
2683 #else | 2681 #else |
2684 | 2682 |
2744 { | 2742 { |
2745 /* Attempt to avoid consing identical (string=) pure strings. */ | 2743 /* Attempt to avoid consing identical (string=) pure strings. */ |
2746 file = Fsymbol_name (Fintern (file, Qnil)); | 2744 file = Fsymbol_name (Fintern (file, Qnil)); |
2747 } | 2745 } |
2748 | 2746 |
2749 return Ffset (function, | 2747 return Ffset (function, |
2750 Fpurecopy (Fcons (Qautoload, list4 (file, | 2748 Fpurecopy (Fcons (Qautoload, list4 (file, |
2751 docstring, | 2749 docstring, |
2752 interactive, | 2750 interactive, |
2753 type)))); | 2751 type)))); |
2754 } | 2752 } |
2776 } | 2774 } |
2777 return Qnil; | 2775 return Qnil; |
2778 } | 2776 } |
2779 | 2777 |
2780 void | 2778 void |
2781 do_autoload (Lisp_Object fundef, | 2779 do_autoload (Lisp_Object fundef, |
2782 Lisp_Object funname) | 2780 Lisp_Object funname) |
2783 { | 2781 { |
2784 /* This function can GC */ | 2782 /* This function can GC */ |
2785 int speccount = specpdl_depth_counter; | 2783 int speccount = specpdl_depth_counter; |
2786 Lisp_Object fun = funname; | 2784 Lisp_Object fun = funname; |
2838 | 2836 |
2839 /**********************************************************************/ | 2837 /**********************************************************************/ |
2840 /* eval, funcall, apply */ | 2838 /* eval, funcall, apply */ |
2841 /**********************************************************************/ | 2839 /**********************************************************************/ |
2842 | 2840 |
2843 static Lisp_Object funcall_lambda (Lisp_Object fun, | 2841 static Lisp_Object funcall_lambda (Lisp_Object fun, |
2844 int nargs, Lisp_Object args[]); | 2842 int nargs, Lisp_Object args[]); |
2845 static Lisp_Object apply_lambda (Lisp_Object fun, | 2843 static Lisp_Object apply_lambda (Lisp_Object fun, |
2846 int nargs, Lisp_Object args); | 2844 int nargs, Lisp_Object args); |
2847 static Lisp_Object funcall_subr (struct Lisp_Subr *sub, Lisp_Object args[]); | 2845 static Lisp_Object funcall_subr (struct Lisp_Subr *sub, Lisp_Object args[]); |
2848 | 2846 |
2849 static int in_warnings; | 2847 static int in_warnings; |
2850 | 2848 |
2883 free_cons (XCONS (this_warning_cons)); | 2881 free_cons (XCONS (this_warning_cons)); |
2884 class = XCAR (this_warning); | 2882 class = XCAR (this_warning); |
2885 level = XCAR (XCDR (this_warning)); | 2883 level = XCAR (XCDR (this_warning)); |
2886 messij = XCAR (XCDR (XCDR (this_warning))); | 2884 messij = XCAR (XCDR (XCDR (this_warning))); |
2887 free_list (this_warning); | 2885 free_list (this_warning); |
2888 | 2886 |
2889 if (NILP (Vpending_warnings)) | 2887 if (NILP (Vpending_warnings)) |
2890 Vpending_warnings_tail = Qnil; /* perhaps not strictly necessary, | 2888 Vpending_warnings_tail = Qnil; /* perhaps not strictly necessary, |
2891 but safer */ | 2889 but safer */ |
2892 | 2890 |
2893 GCPRO4 (form, class, level, messij); | 2891 GCPRO4 (form, class, level, messij); |
2959 args_left = original_args; | 2957 args_left = original_args; |
2960 | 2958 |
2961 if (nargs < subr->min_args | 2959 if (nargs < subr->min_args |
2962 || (max_args >= 0 && max_args < nargs)) | 2960 || (max_args >= 0 && max_args < nargs)) |
2963 { | 2961 { |
2964 return Fsignal (Qwrong_number_of_arguments, | 2962 return Fsignal (Qwrong_number_of_arguments, |
2965 list2 (fun, make_int (nargs))); | 2963 list2 (fun, make_int (nargs))); |
2966 } | 2964 } |
2967 | 2965 |
2968 if (max_args == UNEVALLED) | 2966 if (max_args == UNEVALLED) |
2969 { | 2967 { |
2976 /* Pass a vector of evaluated arguments */ | 2974 /* Pass a vector of evaluated arguments */ |
2977 Lisp_Object *vals; | 2975 Lisp_Object *vals; |
2978 REGISTER int argnum; | 2976 REGISTER int argnum; |
2979 struct gcpro gcpro1, gcpro2, gcpro3; | 2977 struct gcpro gcpro1, gcpro2, gcpro3; |
2980 | 2978 |
2981 vals = (Lisp_Object *) alloca (nargs * sizeof (Lisp_Object)); | 2979 vals = alloca_array (Lisp_Object, nargs); |
2982 | 2980 |
2983 GCPRO3 (args_left, fun, vals[0]); | 2981 GCPRO3 (args_left, fun, vals[0]); |
2984 gcpro3.nvars = 0; | 2982 gcpro3.nvars = 0; |
2985 | 2983 |
2986 argnum = 0; | 2984 argnum = 0; |
3021 for (i = 0; i < nargs; args_left = Fcdr (args_left)) | 3019 for (i = 0; i < nargs; args_left = Fcdr (args_left)) |
3022 { | 3020 { |
3023 argvals[i] = Feval (Fcar (args_left)); | 3021 argvals[i] = Feval (Fcar (args_left)); |
3024 gcpro3.nvars = ++i; | 3022 gcpro3.nvars = ++i; |
3025 } | 3023 } |
3026 | 3024 |
3027 UNGCPRO; | 3025 UNGCPRO; |
3028 | 3026 |
3029 for (i = nargs; i < max_args; i++) | 3027 for (i = nargs; i < max_args; i++) |
3030 argvals[i] = Qnil; | 3028 argvals[i] = Qnil; |
3031 | 3029 |
3032 backtrace.args = argvals; | 3030 backtrace.args = argvals; |
3033 backtrace.nargs = nargs; | 3031 backtrace.nargs = nargs; |
3135 return Fsignal (Qinvalid_function, list1 (fun)); | 3133 return Fsignal (Qinvalid_function, list1 (fun)); |
3136 | 3134 |
3137 if (nargs < subr->min_args | 3135 if (nargs < subr->min_args |
3138 || (max_args >= 0 && max_args < nargs)) | 3136 || (max_args >= 0 && max_args < nargs)) |
3139 { | 3137 { |
3140 return Fsignal (Qwrong_number_of_arguments, | 3138 return Fsignal (Qwrong_number_of_arguments, |
3141 list2 (fun, make_int (nargs))); | 3139 list2 (fun, make_int (nargs))); |
3142 } | 3140 } |
3143 | 3141 |
3144 if (max_args == MANY) | 3142 if (max_args == MANY) |
3145 { | 3143 { |
3344 Lisp_Object spread_arg = args [nargs - 1]; | 3342 Lisp_Object spread_arg = args [nargs - 1]; |
3345 int numargs; | 3343 int numargs; |
3346 int funcall_nargs; | 3344 int funcall_nargs; |
3347 | 3345 |
3348 CHECK_LIST (spread_arg); | 3346 CHECK_LIST (spread_arg); |
3349 | 3347 |
3350 numargs = XINT (Flength (spread_arg)); | 3348 numargs = XINT (Flength (spread_arg)); |
3351 | 3349 |
3352 if (numargs == 0) | 3350 if (numargs == 0) |
3353 /* (apply foo 0 1 '()) */ | 3351 /* (apply foo 0 1 '()) */ |
3354 return Ffuncall (nargs - 1, args); | 3352 return Ffuncall (nargs - 1, args); |
3388 funcall_nargs += (max_args - numargs); | 3386 funcall_nargs += (max_args - numargs); |
3389 } | 3387 } |
3390 } | 3388 } |
3391 { | 3389 { |
3392 REGISTER int i; | 3390 REGISTER int i; |
3393 REGISTER Lisp_Object *funcall_args | 3391 Lisp_Object *funcall_args = alloca_array (Lisp_Object, funcall_nargs); |
3394 = (Lisp_Object *) alloca (funcall_nargs * sizeof (Lisp_Object)); | |
3395 struct gcpro gcpro1; | 3392 struct gcpro gcpro1; |
3396 | 3393 |
3397 GCPRO1 (*funcall_args); | 3394 GCPRO1 (*funcall_args); |
3398 gcpro1.nvars = funcall_nargs; | 3395 gcpro1.nvars = funcall_nargs; |
3399 | 3396 |
3400 /* Copy in the unspread args */ | 3397 /* Copy in the unspread args */ |
3401 memcpy (funcall_args, args, (nargs - 1) * sizeof (Lisp_Object)); | 3398 memcpy (funcall_args, args, (nargs - 1) * sizeof (Lisp_Object)); |
3402 /* Spread the last arg we got. Its first element goes in | 3399 /* Spread the last arg we got. Its first element goes in |
3403 the slot that it used to occupy, hence this value of I. */ | 3400 the slot that it used to occupy, hence this value of I. */ |
3404 for (i = nargs - 1; | 3401 for (i = nargs - 1; |
3405 !NILP (spread_arg); /* i < 1 + numargs */ | 3402 !NILP (spread_arg); /* i < 1 + numargs */ |
3406 i++, spread_arg = XCDR (spread_arg)) | 3403 i++, spread_arg = XCDR (spread_arg)) |
3407 { | 3404 { |
3408 funcall_args [i] = XCAR (spread_arg); | 3405 funcall_args [i] = XCAR (spread_arg); |
3409 } | 3406 } |
3476 { | 3473 { |
3477 /* This function can GC */ | 3474 /* This function can GC */ |
3478 struct gcpro gcpro1, gcpro2, gcpro3; | 3475 struct gcpro gcpro1, gcpro2, gcpro3; |
3479 REGISTER int i; | 3476 REGISTER int i; |
3480 REGISTER Lisp_Object tem; | 3477 REGISTER Lisp_Object tem; |
3481 REGISTER Lisp_Object *arg_vector | 3478 REGISTER Lisp_Object *arg_vector = alloca_array (Lisp_Object, numargs); |
3482 = (Lisp_Object *) alloca (numargs * sizeof (Lisp_Object)); | |
3483 | 3479 |
3484 GCPRO3 (*arg_vector, unevalled_args, fun); | 3480 GCPRO3 (*arg_vector, unevalled_args, fun); |
3485 gcpro1.nvars = 0; | 3481 gcpro1.nvars = 0; |
3486 | 3482 |
3487 for (i = 0; i < numargs;) | 3483 for (i = 0; i < numargs;) |
3548 { | 3544 { |
3549 tem = arg_vector[i++]; | 3545 tem = arg_vector[i++]; |
3550 specbind (next, tem); | 3546 specbind (next, tem); |
3551 } | 3547 } |
3552 else if (!optional) | 3548 else if (!optional) |
3553 return Fsignal (Qwrong_number_of_arguments, | 3549 return Fsignal (Qwrong_number_of_arguments, |
3554 list2 (fun, make_int (nargs))); | 3550 list2 (fun, make_int (nargs))); |
3555 else | 3551 else |
3556 specbind (next, Qnil); | 3552 specbind (next, Qnil); |
3557 } | 3553 } |
3558 | 3554 |
3559 if (i < nargs) | 3555 if (i < nargs) |
3560 return Fsignal (Qwrong_number_of_arguments, | 3556 return Fsignal (Qwrong_number_of_arguments, |
3561 list2 (fun, make_int (nargs))); | 3557 list2 (fun, make_int (nargs))); |
3562 | 3558 |
3563 if (CONSP (fun)) | 3559 if (CONSP (fun)) |
3564 val = Fprogn (Fcdr (Fcdr (fun))); | 3560 val = Fprogn (Fcdr (Fcdr (fun))); |
3565 else | 3561 else |
3629 run_hook_with_args (1, hook, RUN_HOOKS_TO_COMPLETION); | 3625 run_hook_with_args (1, hook, RUN_HOOKS_TO_COMPLETION); |
3630 } | 3626 } |
3631 | 3627 |
3632 return Qnil; | 3628 return Qnil; |
3633 } | 3629 } |
3634 | 3630 |
3635 DEFUN ("run-hook-with-args", Frun_hook_with_args, 1, MANY, 0, /* | 3631 DEFUN ("run-hook-with-args", Frun_hook_with_args, 1, MANY, 0, /* |
3636 Run HOOK with the specified arguments ARGS. | 3632 Run HOOK with the specified arguments ARGS. |
3637 HOOK should be a symbol, a hook variable. If HOOK has a non-nil | 3633 HOOK should be a symbol, a hook variable. If HOOK has a non-nil |
3638 value, that value may be a function or a list of functions to be | 3634 value, that value may be a function or a list of functions to be |
3639 called to run the hook. If the value is a function, it is called with | 3635 called to run the hook. If the value is a function, it is called with |
3823 { | 3819 { |
3824 /* This function can GC */ | 3820 /* This function can GC */ |
3825 struct gcpro gcpro1; | 3821 struct gcpro gcpro1; |
3826 int i; | 3822 int i; |
3827 va_list vargs; | 3823 va_list vargs; |
3828 Lisp_Object *funcall_args = | 3824 Lisp_Object *funcall_args = alloca_array (Lisp_Object, 1 + nargs); |
3829 (Lisp_Object *) alloca ((1 + nargs) * sizeof (Lisp_Object)); | |
3830 | 3825 |
3831 va_start (vargs, nargs); | 3826 va_start (vargs, nargs); |
3832 funcall_args[0] = hook_var; | 3827 funcall_args[0] = hook_var; |
3833 for (i = 0; i < nargs; i++) | 3828 for (i = 0; i < nargs; i++) |
3834 funcall_args[i + 1] = va_arg (vargs, Lisp_Object); | 3829 funcall_args[i + 1] = va_arg (vargs, Lisp_Object); |
3846 { | 3841 { |
3847 /* This function can GC */ | 3842 /* This function can GC */ |
3848 struct gcpro gcpro1; | 3843 struct gcpro gcpro1; |
3849 int i; | 3844 int i; |
3850 va_list vargs; | 3845 va_list vargs; |
3851 Lisp_Object *funcall_args = | 3846 Lisp_Object *funcall_args = alloca_array (Lisp_Object, 1 + nargs); |
3852 (Lisp_Object *) alloca ((1 + nargs) * sizeof (Lisp_Object)); | |
3853 | 3847 |
3854 va_start (vargs, nargs); | 3848 va_start (vargs, nargs); |
3855 funcall_args[0] = hook_var; | 3849 funcall_args[0] = hook_var; |
3856 for (i = 0; i < nargs; i++) | 3850 for (i = 0; i < nargs; i++) |
3857 funcall_args[i + 1] = va_arg (vargs, Lisp_Object); | 3851 funcall_args[i + 1] = va_arg (vargs, Lisp_Object); |
3909 call1 (Lisp_Object fn, | 3903 call1 (Lisp_Object fn, |
3910 Lisp_Object arg0) | 3904 Lisp_Object arg0) |
3911 { | 3905 { |
3912 /* This function can GC */ | 3906 /* This function can GC */ |
3913 struct gcpro gcpro1; | 3907 struct gcpro gcpro1; |
3914 Lisp_Object args[2]; | 3908 Lisp_Object args[2]; |
3915 args[0] = fn; | 3909 args[0] = fn; |
3916 args[1] = arg0; | 3910 args[1] = arg0; |
3917 GCPRO1 (args[0]); | 3911 GCPRO1 (args[0]); |
3918 gcpro1.nvars = 2; | 3912 gcpro1.nvars = 2; |
3919 RETURN_UNGCPRO (Ffuncall (2, args)); | 3913 RETURN_UNGCPRO (Ffuncall (2, args)); |
3972 } | 3966 } |
3973 | 3967 |
3974 /* Call function fn with arguments arg0, arg1, arg2, arg3, arg4 */ | 3968 /* Call function fn with arguments arg0, arg1, arg2, arg3, arg4 */ |
3975 Lisp_Object | 3969 Lisp_Object |
3976 call5 (Lisp_Object fn, | 3970 call5 (Lisp_Object fn, |
3977 Lisp_Object arg0, Lisp_Object arg1, Lisp_Object arg2, | 3971 Lisp_Object arg0, Lisp_Object arg1, Lisp_Object arg2, |
3978 Lisp_Object arg3, Lisp_Object arg4) | 3972 Lisp_Object arg3, Lisp_Object arg4) |
3979 { | 3973 { |
3980 /* This function can GC */ | 3974 /* This function can GC */ |
3981 struct gcpro gcpro1; | 3975 struct gcpro gcpro1; |
3982 Lisp_Object args[6]; | 3976 Lisp_Object args[6]; |
3991 RETURN_UNGCPRO (Ffuncall (6, args)); | 3985 RETURN_UNGCPRO (Ffuncall (6, args)); |
3992 } | 3986 } |
3993 | 3987 |
3994 Lisp_Object | 3988 Lisp_Object |
3995 call6 (Lisp_Object fn, | 3989 call6 (Lisp_Object fn, |
3996 Lisp_Object arg0, Lisp_Object arg1, Lisp_Object arg2, | 3990 Lisp_Object arg0, Lisp_Object arg1, Lisp_Object arg2, |
3997 Lisp_Object arg3, Lisp_Object arg4, Lisp_Object arg5) | 3991 Lisp_Object arg3, Lisp_Object arg4, Lisp_Object arg5) |
3998 { | 3992 { |
3999 /* This function can GC */ | 3993 /* This function can GC */ |
4000 struct gcpro gcpro1; | 3994 struct gcpro gcpro1; |
4001 Lisp_Object args[7]; | 3995 Lisp_Object args[7]; |
4011 RETURN_UNGCPRO (Ffuncall (7, args)); | 4005 RETURN_UNGCPRO (Ffuncall (7, args)); |
4012 } | 4006 } |
4013 | 4007 |
4014 Lisp_Object | 4008 Lisp_Object |
4015 call7 (Lisp_Object fn, | 4009 call7 (Lisp_Object fn, |
4016 Lisp_Object arg0, Lisp_Object arg1, Lisp_Object arg2, | 4010 Lisp_Object arg0, Lisp_Object arg1, Lisp_Object arg2, |
4017 Lisp_Object arg3, Lisp_Object arg4, Lisp_Object arg5, | 4011 Lisp_Object arg3, Lisp_Object arg4, Lisp_Object arg5, |
4018 Lisp_Object arg6) | 4012 Lisp_Object arg6) |
4019 { | 4013 { |
4020 /* This function can GC */ | 4014 /* This function can GC */ |
4021 struct gcpro gcpro1; | 4015 struct gcpro gcpro1; |
4033 RETURN_UNGCPRO (Ffuncall (8, args)); | 4027 RETURN_UNGCPRO (Ffuncall (8, args)); |
4034 } | 4028 } |
4035 | 4029 |
4036 Lisp_Object | 4030 Lisp_Object |
4037 call8 (Lisp_Object fn, | 4031 call8 (Lisp_Object fn, |
4038 Lisp_Object arg0, Lisp_Object arg1, Lisp_Object arg2, | 4032 Lisp_Object arg0, Lisp_Object arg1, Lisp_Object arg2, |
4039 Lisp_Object arg3, Lisp_Object arg4, Lisp_Object arg5, | 4033 Lisp_Object arg3, Lisp_Object arg4, Lisp_Object arg5, |
4040 Lisp_Object arg6, Lisp_Object arg7) | 4034 Lisp_Object arg6, Lisp_Object arg7) |
4041 { | 4035 { |
4042 /* This function can GC */ | 4036 /* This function can GC */ |
4043 struct gcpro gcpro1; | 4037 struct gcpro gcpro1; |
4235 QUIT is inhibited while these functions are running, and if | 4229 QUIT is inhibited while these functions are running, and if |
4236 an error occurs, Qunbound is returned instead of the normal | 4230 an error occurs, Qunbound is returned instead of the normal |
4237 return value. | 4231 return value. |
4238 */ | 4232 */ |
4239 | 4233 |
4240 /* #### This stuff needs to catch throws as well. We need to | 4234 /* #### This stuff needs to catch throws as well. We need to |
4241 improve internal_catch() so it can take a "catch anything" | 4235 improve internal_catch() so it can take a "catch anything" |
4242 argument similar to Qt or Qerror for condition_case_1(). */ | 4236 argument similar to Qt or Qerror for condition_case_1(). */ |
4243 | 4237 |
4244 static Lisp_Object | 4238 static Lisp_Object |
4245 caught_a_squirmer (Lisp_Object errordata, Lisp_Object arg) | 4239 caught_a_squirmer (Lisp_Object errordata, Lisp_Object arg) |
4246 { | 4240 { |
4247 if (!NILP (errordata)) | 4241 if (!NILP (errordata)) |
4248 { | 4242 { |
4249 Lisp_Object args[2]; | 4243 Lisp_Object args[2]; |
4250 | 4244 |
4251 if (!NILP (arg)) | 4245 if (!NILP (arg)) |
4252 { | 4246 { |
4253 char *str = (char *) get_opaque_ptr (arg); | 4247 char *str = (char *) get_opaque_ptr (arg); |
4254 args[0] = build_string (str); | 4248 args[0] = build_string (str); |
4255 } | 4249 } |
4328 caught_a_squirmer, opaque); | 4322 caught_a_squirmer, opaque); |
4329 free_cons (XCONS (cons)); | 4323 free_cons (XCONS (cons)); |
4330 if (OPAQUEP (opaque)) | 4324 if (OPAQUEP (opaque)) |
4331 free_opaque_ptr (opaque); | 4325 free_opaque_ptr (opaque); |
4332 UNGCPRO; | 4326 UNGCPRO; |
4333 | 4327 |
4334 /* gc_currently_forbidden = 0; */ | 4328 /* gc_currently_forbidden = 0; */ |
4335 return unbind_to (speccount, tem); | 4329 return unbind_to (speccount, tem); |
4336 } | 4330 } |
4337 | 4331 |
4338 static Lisp_Object | 4332 static Lisp_Object |
4392 return Qnil; | 4386 return Qnil; |
4393 | 4387 |
4394 if (!allow_quit) | 4388 if (!allow_quit) |
4395 specbind (Qinhibit_quit, Qt); | 4389 specbind (Qinhibit_quit, Qt); |
4396 | 4390 |
4397 cons = noseeum_cons (hook_symbol, | 4391 cons = noseeum_cons (hook_symbol, |
4398 warning_string ? make_opaque_ptr (warning_string) | 4392 warning_string ? make_opaque_ptr (warning_string) |
4399 : Qnil); | 4393 : Qnil); |
4400 GCPRO1 (cons); | 4394 GCPRO1 (cons); |
4401 /* Qerror not Qt, so you can get a backtrace */ | 4395 /* Qerror not Qt, so you can get a backtrace */ |
4402 tem = condition_case_1 (Qerror, | 4396 tem = condition_case_1 (Qerror, |
4497 caught_a_squirmer, opaque); | 4491 caught_a_squirmer, opaque); |
4498 if (OPAQUEP (opaque)) | 4492 if (OPAQUEP (opaque)) |
4499 free_opaque_ptr (opaque); | 4493 free_opaque_ptr (opaque); |
4500 free_cons (XCONS (cons)); | 4494 free_cons (XCONS (cons)); |
4501 UNGCPRO; | 4495 UNGCPRO; |
4502 | 4496 |
4503 /* gc_currently_forbidden = 0; */ | 4497 /* gc_currently_forbidden = 0; */ |
4504 return unbind_to (speccount, tem); | 4498 return unbind_to (speccount, tem); |
4505 } | 4499 } |
4506 | 4500 |
4507 Lisp_Object | 4501 Lisp_Object |
4564 } | 4558 } |
4565 } | 4559 } |
4566 specpdl_size *= 2; | 4560 specpdl_size *= 2; |
4567 if (specpdl_size > max_specpdl_size) | 4561 if (specpdl_size > max_specpdl_size) |
4568 specpdl_size = max_specpdl_size; | 4562 specpdl_size = max_specpdl_size; |
4569 specpdl = ((struct specbinding *) | 4563 XREALLOC_ARRAY (specpdl, struct specbinding, specpdl_size); |
4570 xrealloc (specpdl, specpdl_size * sizeof (struct specbinding))); | |
4571 specpdl_ptr = specpdl + specpdl_depth_counter; | 4564 specpdl_ptr = specpdl + specpdl_depth_counter; |
4572 } | 4565 } |
4573 | 4566 |
4574 | 4567 |
4575 /* Handle unbinding buffer-local variables */ | 4568 /* Handle unbinding buffer-local variables */ |
4674 { | 4667 { |
4675 /* About to become buffer-local */ | 4668 /* About to become buffer-local */ |
4676 specpdl_ptr->old_value = Fcurrent_buffer (); | 4669 specpdl_ptr->old_value = Fcurrent_buffer (); |
4677 specpdl_ptr->func = specbind_unwind_wasnt_local; | 4670 specpdl_ptr->func = specbind_unwind_wasnt_local; |
4678 } | 4671 } |
4679 | 4672 |
4680 specpdl_ptr->symbol = symbol; | 4673 specpdl_ptr->symbol = symbol; |
4681 specpdl_ptr++; | 4674 specpdl_ptr++; |
4682 specpdl_depth_counter++; | 4675 specpdl_depth_counter++; |
4683 | 4676 |
4684 Fset (symbol, value); | 4677 Fset (symbol, value); |
4790 ptr->old_value = newval; | 4783 ptr->old_value = newval; |
4791 return newval; | 4784 return newval; |
4792 } | 4785 } |
4793 } | 4786 } |
4794 return Fset (symbol, newval); | 4787 return Fset (symbol, newval); |
4795 } | 4788 } |
4796 | 4789 |
4797 #endif /* 0 */ | 4790 #endif /* 0 */ |
4798 | 4791 |
4799 | 4792 |
4800 /**********************************************************************/ | 4793 /**********************************************************************/ |
4853 Print a trace of Lisp function calls currently active. | 4846 Print a trace of Lisp function calls currently active. |
4854 Option arg STREAM specifies the output stream to send the backtrace to, | 4847 Option arg STREAM specifies the output stream to send the backtrace to, |
4855 and defaults to the value of `standard-output'. Optional second arg | 4848 and defaults to the value of `standard-output'. Optional second arg |
4856 DETAILED means show places where currently active variable bindings, | 4849 DETAILED means show places where currently active variable bindings, |
4857 catches, condition-cases, and unwind-protects were made as well as | 4850 catches, condition-cases, and unwind-protects were made as well as |
4858 function calls. | 4851 function calls. |
4859 */ | 4852 */ |
4860 (stream, detailed)) | 4853 (stream, detailed)) |
4861 { | 4854 { |
4862 struct backtrace *backlist = backtrace_list; | 4855 struct backtrace *backlist = backtrace_list; |
4863 struct catchtag *catches = catchlist; | 4856 struct catchtag *catches = catchlist; |
4895 int catchpdl = catches->pdlcount; | 4888 int catchpdl = catches->pdlcount; |
4896 if (specpdl[catchpdl].func == condition_case_unwind | 4889 if (specpdl[catchpdl].func == condition_case_unwind |
4897 && speccount > catchpdl) | 4890 && speccount > catchpdl) |
4898 /* This is a condition-case catchpoint */ | 4891 /* This is a condition-case catchpoint */ |
4899 catchpdl = catchpdl + 1; | 4892 catchpdl = catchpdl + 1; |
4900 | 4893 |
4901 backtrace_specials (speccount, catchpdl, stream); | 4894 backtrace_specials (speccount, catchpdl, stream); |
4902 | 4895 |
4903 speccount = catches->pdlcount; | 4896 speccount = catches->pdlcount; |
4904 if (catchpdl == speccount) | 4897 if (catchpdl == speccount) |
4905 { | 4898 { |
5268 Qunbound_suspended_errors_tag = make_opaque_long (0); | 5261 Qunbound_suspended_errors_tag = make_opaque_long (0); |
5269 staticpro (&Qunbound_suspended_errors_tag); | 5262 staticpro (&Qunbound_suspended_errors_tag); |
5270 | 5263 |
5271 specpdl_size = 50; | 5264 specpdl_size = 50; |
5272 specpdl_depth_counter = 0; | 5265 specpdl_depth_counter = 0; |
5273 specpdl = (struct specbinding *) | 5266 specpdl = xnew_array (struct specbinding, specpdl_size); |
5274 xmalloc (specpdl_size * sizeof (struct specbinding)); | |
5275 /* XEmacs change: increase these values. */ | 5267 /* XEmacs change: increase these values. */ |
5276 max_specpdl_size = 3000; | 5268 max_specpdl_size = 3000; |
5277 max_lisp_eval_depth = 500; | 5269 max_lisp_eval_depth = 500; |
5278 throw_level = 0; | 5270 throw_level = 0; |
5279 | 5271 |