diff options
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 236 |
1 files changed, 134 insertions, 102 deletions
diff --git a/src/eval.c b/src/eval.c index c22e7d3f571..9f90e6df4b5 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -30,24 +30,28 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 30 | #include "xterm.h" | 30 | #include "xterm.h" |
| 31 | #endif | 31 | #endif |
| 32 | 32 | ||
| 33 | /* This definition is duplicated in alloc.c and keyboard.c */ | 33 | /* This definition is duplicated in alloc.c and keyboard.c. */ |
| 34 | /* Putting it in lisp.h makes cc bomb out! */ | 34 | /* Putting it in lisp.h makes cc bomb out! */ |
| 35 | 35 | ||
| 36 | struct backtrace | 36 | struct backtrace |
| 37 | { | 37 | { |
| 38 | struct backtrace *next; | 38 | struct backtrace *next; |
| 39 | Lisp_Object *function; | 39 | Lisp_Object *function; |
| 40 | Lisp_Object *args; /* Points to vector of args. */ | 40 | Lisp_Object *args; /* Points to vector of args. */ |
| 41 | int nargs; /* Length of vector. | 41 | #define NARGS_BITS (BITS_PER_INT - 2) |
| 42 | If nargs is UNEVALLED, args points to slot holding | 42 | /* Let's not use size_t because we want to allow negative values (for |
| 43 | list of unevalled args */ | 43 | UNEVALLED). Also let's steal 2 bits so we save a word (or more for |
| 44 | char evalargs; | 44 | alignment). In any case I doubt Emacs would survive a function call with |
| 45 | /* Nonzero means call value of debugger when done with this operation. */ | 45 | more than 500M arguments. */ |
| 46 | char debug_on_exit; | 46 | int nargs : NARGS_BITS; /* Length of vector. |
| 47 | If nargs is UNEVALLED, args points | ||
| 48 | to slot holding list of unevalled args. */ | ||
| 49 | char evalargs : 1; | ||
| 50 | /* Nonzero means call value of debugger when done with this operation. */ | ||
| 51 | char debug_on_exit : 1; | ||
| 47 | }; | 52 | }; |
| 48 | 53 | ||
| 49 | struct backtrace *backtrace_list; | 54 | struct backtrace *backtrace_list; |
| 50 | |||
| 51 | struct catchtag *catchlist; | 55 | struct catchtag *catchlist; |
| 52 | 56 | ||
| 53 | #ifdef DEBUG_GCPRO | 57 | #ifdef DEBUG_GCPRO |
| @@ -114,7 +118,7 @@ Lisp_Object Vsignaling_function; | |||
| 114 | int handling_signal; | 118 | int handling_signal; |
| 115 | 119 | ||
| 116 | static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args); | 120 | static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args); |
| 117 | static Lisp_Object funcall_lambda (Lisp_Object, int, Lisp_Object *); | 121 | static Lisp_Object funcall_lambda (Lisp_Object, size_t, Lisp_Object *); |
| 118 | static void unwind_to_catch (struct catchtag *, Lisp_Object) NO_RETURN; | 122 | static void unwind_to_catch (struct catchtag *, Lisp_Object) NO_RETURN; |
| 119 | static int interactive_p (int); | 123 | static int interactive_p (int); |
| 120 | 124 | ||
| @@ -148,7 +152,7 @@ init_eval (void) | |||
| 148 | when_entered_debugger = -1; | 152 | when_entered_debugger = -1; |
| 149 | } | 153 | } |
| 150 | 154 | ||
| 151 | /* unwind-protect function used by call_debugger. */ | 155 | /* Unwind-protect function used by call_debugger. */ |
| 152 | 156 | ||
| 153 | static Lisp_Object | 157 | static Lisp_Object |
| 154 | restore_stack_limits (Lisp_Object data) | 158 | restore_stack_limits (Lisp_Object data) |
| @@ -578,7 +582,7 @@ interactive_p (int exclude_subrs_p) | |||
| 578 | || btp->nargs == UNEVALLED)) | 582 | || btp->nargs == UNEVALLED)) |
| 579 | btp = btp->next; | 583 | btp = btp->next; |
| 580 | 584 | ||
| 581 | /* btp now points at the frame of the innermost function that isn't | 585 | /* `btp' now points at the frame of the innermost function that isn't |
| 582 | a special form, ignoring frames for Finteractive_p and/or | 586 | a special form, ignoring frames for Finteractive_p and/or |
| 583 | Fbytecode at the top. If this frame is for a built-in function | 587 | Fbytecode at the top. If this frame is for a built-in function |
| 584 | (such as load or eval-region) return nil. */ | 588 | (such as load or eval-region) return nil. */ |
| @@ -586,7 +590,7 @@ interactive_p (int exclude_subrs_p) | |||
| 586 | if (exclude_subrs_p && SUBRP (fun)) | 590 | if (exclude_subrs_p && SUBRP (fun)) |
| 587 | return 0; | 591 | return 0; |
| 588 | 592 | ||
| 589 | /* btp points to the frame of a Lisp function that called interactive-p. | 593 | /* `btp' points to the frame of a Lisp function that called interactive-p. |
| 590 | Return t if that function was called interactively. */ | 594 | Return t if that function was called interactively. */ |
| 591 | if (btp && btp->next && EQ (*btp->next->function, Qcall_interactively)) | 595 | if (btp && btp->next && EQ (*btp->next->function, Qcall_interactively)) |
| 592 | return 1; | 596 | return 1; |
| @@ -1028,17 +1032,17 @@ usage: (let VARLIST BODY...) */) | |||
| 1028 | Lisp_Object *temps, tem, lexenv; | 1032 | Lisp_Object *temps, tem, lexenv; |
| 1029 | register Lisp_Object elt, varlist; | 1033 | register Lisp_Object elt, varlist; |
| 1030 | int count = SPECPDL_INDEX (); | 1034 | int count = SPECPDL_INDEX (); |
| 1031 | register int argnum; | 1035 | register size_t argnum; |
| 1032 | struct gcpro gcpro1, gcpro2; | 1036 | struct gcpro gcpro1, gcpro2; |
| 1033 | USE_SAFE_ALLOCA; | 1037 | USE_SAFE_ALLOCA; |
| 1034 | 1038 | ||
| 1035 | varlist = Fcar (args); | 1039 | varlist = Fcar (args); |
| 1036 | 1040 | ||
| 1037 | /* Make space to hold the values to give the bound variables */ | 1041 | /* Make space to hold the values to give the bound variables. */ |
| 1038 | elt = Flength (varlist); | 1042 | elt = Flength (varlist); |
| 1039 | SAFE_ALLOCA_LISP (temps, XFASTINT (elt)); | 1043 | SAFE_ALLOCA_LISP (temps, XFASTINT (elt)); |
| 1040 | 1044 | ||
| 1041 | /* Compute the values and store them in `temps' */ | 1045 | /* Compute the values and store them in `temps'. */ |
| 1042 | 1046 | ||
| 1043 | GCPRO2 (args, *temps); | 1047 | GCPRO2 (args, *temps); |
| 1044 | gcpro2.nvars = 0; | 1048 | gcpro2.nvars = 0; |
| @@ -1155,7 +1159,7 @@ definitions to shadow the loaded ones for use in file byte-compilation. */) | |||
| 1155 | /* SYM is not mentioned in ENVIRONMENT. | 1159 | /* SYM is not mentioned in ENVIRONMENT. |
| 1156 | Look at its function definition. */ | 1160 | Look at its function definition. */ |
| 1157 | if (EQ (def, Qunbound) || !CONSP (def)) | 1161 | if (EQ (def, Qunbound) || !CONSP (def)) |
| 1158 | /* Not defined or definition not suitable */ | 1162 | /* Not defined or definition not suitable. */ |
| 1159 | break; | 1163 | break; |
| 1160 | if (EQ (XCAR (def), Qautoload)) | 1164 | if (EQ (XCAR (def), Qautoload)) |
| 1161 | { | 1165 | { |
| @@ -1296,10 +1300,7 @@ unwind_to_catch (struct catchtag *catch, Lisp_Object value) | |||
| 1296 | byte_stack_list = catch->byte_stack; | 1300 | byte_stack_list = catch->byte_stack; |
| 1297 | gcprolist = catch->gcpro; | 1301 | gcprolist = catch->gcpro; |
| 1298 | #ifdef DEBUG_GCPRO | 1302 | #ifdef DEBUG_GCPRO |
| 1299 | if (gcprolist != 0) | 1303 | gcpro_level = gcprolist ? gcprolist->level + 1 : gcpro_level = 0; |
| 1300 | gcpro_level = gcprolist->level + 1; | ||
| 1301 | else | ||
| 1302 | gcpro_level = 0; | ||
| 1303 | #endif | 1304 | #endif |
| 1304 | backtrace_list = catch->backlist; | 1305 | backtrace_list = catch->backlist; |
| 1305 | lisp_eval_depth = catch->lisp_eval_depth; | 1306 | lisp_eval_depth = catch->lisp_eval_depth; |
| @@ -1594,8 +1595,8 @@ internal_condition_case_2 (Lisp_Object (*bfun) (Lisp_Object, Lisp_Object), | |||
| 1594 | and ARGS as second argument. */ | 1595 | and ARGS as second argument. */ |
| 1595 | 1596 | ||
| 1596 | Lisp_Object | 1597 | Lisp_Object |
| 1597 | internal_condition_case_n (Lisp_Object (*bfun) (int, Lisp_Object*), | 1598 | internal_condition_case_n (Lisp_Object (*bfun) (size_t, Lisp_Object *), |
| 1598 | int nargs, | 1599 | size_t nargs, |
| 1599 | Lisp_Object *args, | 1600 | Lisp_Object *args, |
| 1600 | Lisp_Object handlers, | 1601 | Lisp_Object handlers, |
| 1601 | Lisp_Object (*hfun) (Lisp_Object)) | 1602 | Lisp_Object (*hfun) (Lisp_Object)) |
| @@ -1907,7 +1908,7 @@ maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, Lisp_Object data) | |||
| 1907 | ? debug_on_quit | 1908 | ? debug_on_quit |
| 1908 | : wants_debugger (Vdebug_on_error, conditions)) | 1909 | : wants_debugger (Vdebug_on_error, conditions)) |
| 1909 | && ! skip_debugger (conditions, combined_data) | 1910 | && ! skip_debugger (conditions, combined_data) |
| 1910 | /* rms: what's this for? */ | 1911 | /* RMS: What's this for? */ |
| 1911 | && when_entered_debugger < num_nonmacro_input_events) | 1912 | && when_entered_debugger < num_nonmacro_input_events) |
| 1912 | { | 1913 | { |
| 1913 | call_debugger (Fcons (Qerror, Fcons (combined_data, Qnil))); | 1914 | call_debugger (Fcons (Qerror, Fcons (combined_data, Qnil))); |
| @@ -1974,7 +1975,7 @@ find_handler_clause (Lisp_Object handlers, Lisp_Object conditions, | |||
| 1974 | } | 1975 | } |
| 1975 | 1976 | ||
| 1976 | 1977 | ||
| 1977 | /* dump an error message; called like vprintf */ | 1978 | /* Dump an error message; called like vprintf. */ |
| 1978 | void | 1979 | void |
| 1979 | verror (const char *m, va_list ap) | 1980 | verror (const char *m, va_list ap) |
| 1980 | { | 1981 | { |
| @@ -2011,7 +2012,7 @@ verror (const char *m, va_list ap) | |||
| 2011 | } | 2012 | } |
| 2012 | 2013 | ||
| 2013 | 2014 | ||
| 2014 | /* dump an error message; called like printf */ | 2015 | /* Dump an error message; called like printf. */ |
| 2015 | 2016 | ||
| 2016 | /* VARARGS 1 */ | 2017 | /* VARARGS 1 */ |
| 2017 | void | 2018 | void |
| @@ -2109,7 +2110,7 @@ this does nothing and returns nil. */) | |||
| 2109 | CHECK_SYMBOL (function); | 2110 | CHECK_SYMBOL (function); |
| 2110 | CHECK_STRING (file); | 2111 | CHECK_STRING (file); |
| 2111 | 2112 | ||
| 2112 | /* If function is defined and not as an autoload, don't override */ | 2113 | /* If function is defined and not as an autoload, don't override. */ |
| 2113 | if (!EQ (XSYMBOL (function)->function, Qunbound) | 2114 | if (!EQ (XSYMBOL (function)->function, Qunbound) |
| 2114 | && !(CONSP (XSYMBOL (function)->function) | 2115 | && !(CONSP (XSYMBOL (function)->function) |
| 2115 | && EQ (XCAR (XSYMBOL (function)->function), Qautoload))) | 2116 | && EQ (XCAR (XSYMBOL (function)->function), Qautoload))) |
| @@ -2269,7 +2270,7 @@ eval_sub (Lisp_Object form) | |||
| 2269 | 2270 | ||
| 2270 | backtrace.next = backtrace_list; | 2271 | backtrace.next = backtrace_list; |
| 2271 | backtrace_list = &backtrace; | 2272 | backtrace_list = &backtrace; |
| 2272 | backtrace.function = &original_fun; /* This also protects them from gc */ | 2273 | backtrace.function = &original_fun; /* This also protects them from gc. */ |
| 2273 | backtrace.args = &original_args; | 2274 | backtrace.args = &original_args; |
| 2274 | backtrace.nargs = UNEVALLED; | 2275 | backtrace.nargs = UNEVALLED; |
| 2275 | backtrace.evalargs = 1; | 2276 | backtrace.evalargs = 1; |
| @@ -2279,7 +2280,7 @@ eval_sub (Lisp_Object form) | |||
| 2279 | do_debug_on_call (Qt); | 2280 | do_debug_on_call (Qt); |
| 2280 | 2281 | ||
| 2281 | /* At this point, only original_fun and original_args | 2282 | /* At this point, only original_fun and original_args |
| 2282 | have values that will be used below */ | 2283 | have values that will be used below. */ |
| 2283 | retry: | 2284 | retry: |
| 2284 | 2285 | ||
| 2285 | /* Optimize for no indirection. */ | 2286 | /* Optimize for no indirection. */ |
| @@ -2300,8 +2301,9 @@ eval_sub (Lisp_Object form) | |||
| 2300 | 2301 | ||
| 2301 | CHECK_CONS_LIST (); | 2302 | CHECK_CONS_LIST (); |
| 2302 | 2303 | ||
| 2303 | if (XINT (numargs) < XSUBR (fun)->min_args || | 2304 | if (XINT (numargs) < XSUBR (fun)->min_args |
| 2304 | (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < XINT (numargs))) | 2305 | || (XSUBR (fun)->max_args >= 0 |
| 2306 | && XSUBR (fun)->max_args < XINT (numargs))) | ||
| 2305 | xsignal2 (Qwrong_number_of_arguments, original_fun, numargs); | 2307 | xsignal2 (Qwrong_number_of_arguments, original_fun, numargs); |
| 2306 | 2308 | ||
| 2307 | else if (XSUBR (fun)->max_args == UNEVALLED) | 2309 | else if (XSUBR (fun)->max_args == UNEVALLED) |
| @@ -2311,9 +2313,9 @@ eval_sub (Lisp_Object form) | |||
| 2311 | } | 2313 | } |
| 2312 | else if (XSUBR (fun)->max_args == MANY) | 2314 | else if (XSUBR (fun)->max_args == MANY) |
| 2313 | { | 2315 | { |
| 2314 | /* Pass a vector of evaluated arguments */ | 2316 | /* Pass a vector of evaluated arguments. */ |
| 2315 | Lisp_Object *vals; | 2317 | Lisp_Object *vals; |
| 2316 | register int argnum = 0; | 2318 | register size_t argnum = 0; |
| 2317 | USE_SAFE_ALLOCA; | 2319 | USE_SAFE_ALLOCA; |
| 2318 | 2320 | ||
| 2319 | SAFE_ALLOCA_LISP (vals, XINT (numargs)); | 2321 | SAFE_ALLOCA_LISP (vals, XINT (numargs)); |
| @@ -2443,9 +2445,9 @@ DEFUN ("apply", Fapply, Sapply, 2, MANY, 0, | |||
| 2443 | Then return the value FUNCTION returns. | 2445 | Then return the value FUNCTION returns. |
| 2444 | Thus, (apply '+ 1 2 '(3 4)) returns 10. | 2446 | Thus, (apply '+ 1 2 '(3 4)) returns 10. |
| 2445 | usage: (apply FUNCTION &rest ARGUMENTS) */) | 2447 | usage: (apply FUNCTION &rest ARGUMENTS) */) |
| 2446 | (int nargs, Lisp_Object *args) | 2448 | (size_t nargs, Lisp_Object *args) |
| 2447 | { | 2449 | { |
| 2448 | register int i, numargs; | 2450 | register size_t i, numargs; |
| 2449 | register Lisp_Object spread_arg; | 2451 | register Lisp_Object spread_arg; |
| 2450 | register Lisp_Object *funcall_args; | 2452 | register Lisp_Object *funcall_args; |
| 2451 | Lisp_Object fun, retval; | 2453 | Lisp_Object fun, retval; |
| @@ -2475,7 +2477,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) | |||
| 2475 | fun = indirect_function (fun); | 2477 | fun = indirect_function (fun); |
| 2476 | if (EQ (fun, Qunbound)) | 2478 | if (EQ (fun, Qunbound)) |
| 2477 | { | 2479 | { |
| 2478 | /* Let funcall get the error */ | 2480 | /* Let funcall get the error. */ |
| 2479 | fun = args[0]; | 2481 | fun = args[0]; |
| 2480 | goto funcall; | 2482 | goto funcall; |
| 2481 | } | 2483 | } |
| @@ -2484,11 +2486,11 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) | |||
| 2484 | { | 2486 | { |
| 2485 | if (numargs < XSUBR (fun)->min_args | 2487 | if (numargs < XSUBR (fun)->min_args |
| 2486 | || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs)) | 2488 | || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs)) |
| 2487 | goto funcall; /* Let funcall get the error */ | 2489 | goto funcall; /* Let funcall get the error. */ |
| 2488 | else if (XSUBR (fun)->max_args > numargs) | 2490 | else if (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args > numargs) |
| 2489 | { | 2491 | { |
| 2490 | /* Avoid making funcall cons up a yet another new vector of arguments | 2492 | /* Avoid making funcall cons up a yet another new vector of arguments |
| 2491 | by explicitly supplying nil's for optional values */ | 2493 | by explicitly supplying nil's for optional values. */ |
| 2492 | SAFE_ALLOCA_LISP (funcall_args, 1 + XSUBR (fun)->max_args); | 2494 | SAFE_ALLOCA_LISP (funcall_args, 1 + XSUBR (fun)->max_args); |
| 2493 | for (i = numargs; i < XSUBR (fun)->max_args;) | 2495 | for (i = numargs; i < XSUBR (fun)->max_args;) |
| 2494 | funcall_args[++i] = Qnil; | 2496 | funcall_args[++i] = Qnil; |
| @@ -2526,9 +2528,12 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) | |||
| 2526 | 2528 | ||
| 2527 | /* Run hook variables in various ways. */ | 2529 | /* Run hook variables in various ways. */ |
| 2528 | 2530 | ||
| 2529 | enum run_hooks_condition {to_completion, until_success, until_failure}; | 2531 | static Lisp_Object |
| 2530 | static Lisp_Object run_hook_with_args (int, Lisp_Object *, | 2532 | funcall_nil (size_t nargs, Lisp_Object *args) |
| 2531 | enum run_hooks_condition); | 2533 | { |
| 2534 | Ffuncall (nargs, args); | ||
| 2535 | return Qnil; | ||
| 2536 | } | ||
| 2532 | 2537 | ||
| 2533 | DEFUN ("run-hooks", Frun_hooks, Srun_hooks, 0, MANY, 0, | 2538 | DEFUN ("run-hooks", Frun_hooks, Srun_hooks, 0, MANY, 0, |
| 2534 | doc: /* Run each hook in HOOKS. | 2539 | doc: /* Run each hook in HOOKS. |
| @@ -2545,15 +2550,15 @@ hook; they should use `run-mode-hooks' instead. | |||
| 2545 | Do not use `make-local-variable' to make a hook variable buffer-local. | 2550 | Do not use `make-local-variable' to make a hook variable buffer-local. |
| 2546 | Instead, use `add-hook' and specify t for the LOCAL argument. | 2551 | Instead, use `add-hook' and specify t for the LOCAL argument. |
| 2547 | usage: (run-hooks &rest HOOKS) */) | 2552 | usage: (run-hooks &rest HOOKS) */) |
| 2548 | (int nargs, Lisp_Object *args) | 2553 | (size_t nargs, Lisp_Object *args) |
| 2549 | { | 2554 | { |
| 2550 | Lisp_Object hook[1]; | 2555 | Lisp_Object hook[1]; |
| 2551 | register int i; | 2556 | register size_t i; |
| 2552 | 2557 | ||
| 2553 | for (i = 0; i < nargs; i++) | 2558 | for (i = 0; i < nargs; i++) |
| 2554 | { | 2559 | { |
| 2555 | hook[0] = args[i]; | 2560 | hook[0] = args[i]; |
| 2556 | run_hook_with_args (1, hook, to_completion); | 2561 | run_hook_with_args (1, hook, funcall_nil); |
| 2557 | } | 2562 | } |
| 2558 | 2563 | ||
| 2559 | return Qnil; | 2564 | return Qnil; |
| @@ -2574,9 +2579,9 @@ as that may change. | |||
| 2574 | Do not use `make-local-variable' to make a hook variable buffer-local. | 2579 | Do not use `make-local-variable' to make a hook variable buffer-local. |
| 2575 | Instead, use `add-hook' and specify t for the LOCAL argument. | 2580 | Instead, use `add-hook' and specify t for the LOCAL argument. |
| 2576 | usage: (run-hook-with-args HOOK &rest ARGS) */) | 2581 | usage: (run-hook-with-args HOOK &rest ARGS) */) |
| 2577 | (int nargs, Lisp_Object *args) | 2582 | (size_t nargs, Lisp_Object *args) |
| 2578 | { | 2583 | { |
| 2579 | return run_hook_with_args (nargs, args, to_completion); | 2584 | return run_hook_with_args (nargs, args, funcall_nil); |
| 2580 | } | 2585 | } |
| 2581 | 2586 | ||
| 2582 | DEFUN ("run-hook-with-args-until-success", Frun_hook_with_args_until_success, | 2587 | DEFUN ("run-hook-with-args-until-success", Frun_hook_with_args_until_success, |
| @@ -2594,9 +2599,15 @@ However, if they all return nil, we return nil. | |||
| 2594 | Do not use `make-local-variable' to make a hook variable buffer-local. | 2599 | Do not use `make-local-variable' to make a hook variable buffer-local. |
| 2595 | Instead, use `add-hook' and specify t for the LOCAL argument. | 2600 | Instead, use `add-hook' and specify t for the LOCAL argument. |
| 2596 | usage: (run-hook-with-args-until-success HOOK &rest ARGS) */) | 2601 | usage: (run-hook-with-args-until-success HOOK &rest ARGS) */) |
| 2597 | (int nargs, Lisp_Object *args) | 2602 | (size_t nargs, Lisp_Object *args) |
| 2598 | { | 2603 | { |
| 2599 | return run_hook_with_args (nargs, args, until_success); | 2604 | return run_hook_with_args (nargs, args, Ffuncall); |
| 2605 | } | ||
| 2606 | |||
| 2607 | static Lisp_Object | ||
| 2608 | funcall_not (size_t nargs, Lisp_Object *args) | ||
| 2609 | { | ||
| 2610 | return NILP (Ffuncall (nargs, args)) ? Qt : Qnil; | ||
| 2600 | } | 2611 | } |
| 2601 | 2612 | ||
| 2602 | DEFUN ("run-hook-with-args-until-failure", Frun_hook_with_args_until_failure, | 2613 | DEFUN ("run-hook-with-args-until-failure", Frun_hook_with_args_until_failure, |
| @@ -2613,23 +2624,47 @@ Then we return nil. However, if they all return non-nil, we return non-nil. | |||
| 2613 | Do not use `make-local-variable' to make a hook variable buffer-local. | 2624 | Do not use `make-local-variable' to make a hook variable buffer-local. |
| 2614 | Instead, use `add-hook' and specify t for the LOCAL argument. | 2625 | Instead, use `add-hook' and specify t for the LOCAL argument. |
| 2615 | usage: (run-hook-with-args-until-failure HOOK &rest ARGS) */) | 2626 | usage: (run-hook-with-args-until-failure HOOK &rest ARGS) */) |
| 2616 | (int nargs, Lisp_Object *args) | 2627 | (size_t nargs, Lisp_Object *args) |
| 2617 | { | 2628 | { |
| 2618 | return run_hook_with_args (nargs, args, until_failure); | 2629 | return NILP (run_hook_with_args (nargs, args, funcall_not)) ? Qt : Qnil; |
| 2630 | } | ||
| 2631 | |||
| 2632 | static Lisp_Object | ||
| 2633 | run_hook_wrapped_funcall (size_t nargs, Lisp_Object *args) | ||
| 2634 | { | ||
| 2635 | Lisp_Object tmp = args[0], ret; | ||
| 2636 | args[0] = args[1]; | ||
| 2637 | args[1] = tmp; | ||
| 2638 | ret = Ffuncall (nargs, args); | ||
| 2639 | args[1] = args[0]; | ||
| 2640 | args[0] = tmp; | ||
| 2641 | return ret; | ||
| 2642 | } | ||
| 2643 | |||
| 2644 | DEFUN ("run-hook-wrapped", Frun_hook_wrapped, Srun_hook_wrapped, 2, MANY, 0, | ||
| 2645 | doc: /* Run HOOK, passing each function through WRAP-FUNCTION. | ||
| 2646 | I.e. instead of calling each function FUN directly with arguments ARGS, | ||
| 2647 | it calls WRAP-FUNCTION with arguments FUN and ARGS. | ||
| 2648 | As soon as a call to WRAP-FUNCTION returns non-nil, `run-hook-wrapped' | ||
| 2649 | aborts and returns that value. | ||
| 2650 | usage: (run-hook-wrapped HOOK WRAP-FUNCTION &rest ARGS) */) | ||
| 2651 | (size_t nargs, Lisp_Object *args) | ||
| 2652 | { | ||
| 2653 | return run_hook_with_args (nargs, args, run_hook_wrapped_funcall); | ||
| 2619 | } | 2654 | } |
| 2620 | 2655 | ||
| 2621 | /* ARGS[0] should be a hook symbol. | 2656 | /* ARGS[0] should be a hook symbol. |
| 2622 | Call each of the functions in the hook value, passing each of them | 2657 | Call each of the functions in the hook value, passing each of them |
| 2623 | as arguments all the rest of ARGS (all NARGS - 1 elements). | 2658 | as arguments all the rest of ARGS (all NARGS - 1 elements). |
| 2624 | COND specifies a condition to test after each call | 2659 | FUNCALL specifies how to call each function on the hook. |
| 2625 | to decide whether to stop. | ||
| 2626 | The caller (or its caller, etc) must gcpro all of ARGS, | 2660 | The caller (or its caller, etc) must gcpro all of ARGS, |
| 2627 | except that it isn't necessary to gcpro ARGS[0]. */ | 2661 | except that it isn't necessary to gcpro ARGS[0]. */ |
| 2628 | 2662 | ||
| 2629 | static Lisp_Object | 2663 | Lisp_Object |
| 2630 | run_hook_with_args (int nargs, Lisp_Object *args, enum run_hooks_condition cond) | 2664 | run_hook_with_args (size_t nargs, Lisp_Object *args, |
| 2665 | Lisp_Object (*funcall) (size_t nargs, Lisp_Object *args)) | ||
| 2631 | { | 2666 | { |
| 2632 | Lisp_Object sym, val, ret; | 2667 | Lisp_Object sym, val, ret = Qnil; |
| 2633 | struct gcpro gcpro1, gcpro2, gcpro3; | 2668 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 2634 | 2669 | ||
| 2635 | /* If we are dying or still initializing, | 2670 | /* If we are dying or still initializing, |
| @@ -2639,14 +2674,13 @@ run_hook_with_args (int nargs, Lisp_Object *args, enum run_hooks_condition cond) | |||
| 2639 | 2674 | ||
| 2640 | sym = args[0]; | 2675 | sym = args[0]; |
| 2641 | val = find_symbol_value (sym); | 2676 | val = find_symbol_value (sym); |
| 2642 | ret = (cond == until_failure ? Qt : Qnil); | ||
| 2643 | 2677 | ||
| 2644 | if (EQ (val, Qunbound) || NILP (val)) | 2678 | if (EQ (val, Qunbound) || NILP (val)) |
| 2645 | return ret; | 2679 | return ret; |
| 2646 | else if (!CONSP (val) || EQ (XCAR (val), Qlambda)) | 2680 | else if (!CONSP (val) || EQ (XCAR (val), Qlambda)) |
| 2647 | { | 2681 | { |
| 2648 | args[0] = val; | 2682 | args[0] = val; |
| 2649 | return Ffuncall (nargs, args); | 2683 | return funcall (nargs, args); |
| 2650 | } | 2684 | } |
| 2651 | else | 2685 | else |
| 2652 | { | 2686 | { |
| @@ -2654,9 +2688,7 @@ run_hook_with_args (int nargs, Lisp_Object *args, enum run_hooks_condition cond) | |||
| 2654 | GCPRO3 (sym, val, global_vals); | 2688 | GCPRO3 (sym, val, global_vals); |
| 2655 | 2689 | ||
| 2656 | for (; | 2690 | for (; |
| 2657 | CONSP (val) && ((cond == to_completion) | 2691 | CONSP (val) && NILP (ret); |
| 2658 | || (cond == until_success ? NILP (ret) | ||
| 2659 | : !NILP (ret))); | ||
| 2660 | val = XCDR (val)) | 2692 | val = XCDR (val)) |
| 2661 | { | 2693 | { |
| 2662 | if (EQ (XCAR (val), Qt)) | 2694 | if (EQ (XCAR (val), Qt)) |
| @@ -2669,30 +2701,26 @@ run_hook_with_args (int nargs, Lisp_Object *args, enum run_hooks_condition cond) | |||
| 2669 | if (!CONSP (global_vals) || EQ (XCAR (global_vals), Qlambda)) | 2701 | if (!CONSP (global_vals) || EQ (XCAR (global_vals), Qlambda)) |
| 2670 | { | 2702 | { |
| 2671 | args[0] = global_vals; | 2703 | args[0] = global_vals; |
| 2672 | ret = Ffuncall (nargs, args); | 2704 | ret = funcall (nargs, args); |
| 2673 | } | 2705 | } |
| 2674 | else | 2706 | else |
| 2675 | { | 2707 | { |
| 2676 | for (; | 2708 | for (; |
| 2677 | (CONSP (global_vals) | 2709 | CONSP (global_vals) && NILP (ret); |
| 2678 | && (cond == to_completion | ||
| 2679 | || (cond == until_success | ||
| 2680 | ? NILP (ret) | ||
| 2681 | : !NILP (ret)))); | ||
| 2682 | global_vals = XCDR (global_vals)) | 2710 | global_vals = XCDR (global_vals)) |
| 2683 | { | 2711 | { |
| 2684 | args[0] = XCAR (global_vals); | 2712 | args[0] = XCAR (global_vals); |
| 2685 | /* In a global value, t should not occur. If it does, we | 2713 | /* In a global value, t should not occur. If it does, we |
| 2686 | must ignore it to avoid an endless loop. */ | 2714 | must ignore it to avoid an endless loop. */ |
| 2687 | if (!EQ (args[0], Qt)) | 2715 | if (!EQ (args[0], Qt)) |
| 2688 | ret = Ffuncall (nargs, args); | 2716 | ret = funcall (nargs, args); |
| 2689 | } | 2717 | } |
| 2690 | } | 2718 | } |
| 2691 | } | 2719 | } |
| 2692 | else | 2720 | else |
| 2693 | { | 2721 | { |
| 2694 | args[0] = XCAR (val); | 2722 | args[0] = XCAR (val); |
| 2695 | ret = Ffuncall (nargs, args); | 2723 | ret = funcall (nargs, args); |
| 2696 | } | 2724 | } |
| 2697 | } | 2725 | } |
| 2698 | 2726 | ||
| @@ -2714,7 +2742,7 @@ run_hook_with_args_2 (Lisp_Object hook, Lisp_Object arg1, Lisp_Object arg2) | |||
| 2714 | Frun_hook_with_args (3, temp); | 2742 | Frun_hook_with_args (3, temp); |
| 2715 | } | 2743 | } |
| 2716 | 2744 | ||
| 2717 | /* Apply fn to arg */ | 2745 | /* Apply fn to arg. */ |
| 2718 | Lisp_Object | 2746 | Lisp_Object |
| 2719 | apply1 (Lisp_Object fn, Lisp_Object arg) | 2747 | apply1 (Lisp_Object fn, Lisp_Object arg) |
| 2720 | { | 2748 | { |
| @@ -2733,7 +2761,7 @@ apply1 (Lisp_Object fn, Lisp_Object arg) | |||
| 2733 | } | 2761 | } |
| 2734 | } | 2762 | } |
| 2735 | 2763 | ||
| 2736 | /* Call function fn on no arguments */ | 2764 | /* Call function fn on no arguments. */ |
| 2737 | Lisp_Object | 2765 | Lisp_Object |
| 2738 | call0 (Lisp_Object fn) | 2766 | call0 (Lisp_Object fn) |
| 2739 | { | 2767 | { |
| @@ -2743,7 +2771,7 @@ call0 (Lisp_Object fn) | |||
| 2743 | RETURN_UNGCPRO (Ffuncall (1, &fn)); | 2771 | RETURN_UNGCPRO (Ffuncall (1, &fn)); |
| 2744 | } | 2772 | } |
| 2745 | 2773 | ||
| 2746 | /* Call function fn with 1 argument arg1 */ | 2774 | /* Call function fn with 1 argument arg1. */ |
| 2747 | /* ARGSUSED */ | 2775 | /* ARGSUSED */ |
| 2748 | Lisp_Object | 2776 | Lisp_Object |
| 2749 | call1 (Lisp_Object fn, Lisp_Object arg1) | 2777 | call1 (Lisp_Object fn, Lisp_Object arg1) |
| @@ -2758,7 +2786,7 @@ call1 (Lisp_Object fn, Lisp_Object arg1) | |||
| 2758 | RETURN_UNGCPRO (Ffuncall (2, args)); | 2786 | RETURN_UNGCPRO (Ffuncall (2, args)); |
| 2759 | } | 2787 | } |
| 2760 | 2788 | ||
| 2761 | /* Call function fn with 2 arguments arg1, arg2 */ | 2789 | /* Call function fn with 2 arguments arg1, arg2. */ |
| 2762 | /* ARGSUSED */ | 2790 | /* ARGSUSED */ |
| 2763 | Lisp_Object | 2791 | Lisp_Object |
| 2764 | call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2) | 2792 | call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2) |
| @@ -2773,7 +2801,7 @@ call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2) | |||
| 2773 | RETURN_UNGCPRO (Ffuncall (3, args)); | 2801 | RETURN_UNGCPRO (Ffuncall (3, args)); |
| 2774 | } | 2802 | } |
| 2775 | 2803 | ||
| 2776 | /* Call function fn with 3 arguments arg1, arg2, arg3 */ | 2804 | /* Call function fn with 3 arguments arg1, arg2, arg3. */ |
| 2777 | /* ARGSUSED */ | 2805 | /* ARGSUSED */ |
| 2778 | Lisp_Object | 2806 | Lisp_Object |
| 2779 | call3 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) | 2807 | call3 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) |
| @@ -2789,7 +2817,7 @@ call3 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) | |||
| 2789 | RETURN_UNGCPRO (Ffuncall (4, args)); | 2817 | RETURN_UNGCPRO (Ffuncall (4, args)); |
| 2790 | } | 2818 | } |
| 2791 | 2819 | ||
| 2792 | /* Call function fn with 4 arguments arg1, arg2, arg3, arg4 */ | 2820 | /* Call function fn with 4 arguments arg1, arg2, arg3, arg4. */ |
| 2793 | /* ARGSUSED */ | 2821 | /* ARGSUSED */ |
| 2794 | Lisp_Object | 2822 | Lisp_Object |
| 2795 | call4 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, | 2823 | call4 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, |
| @@ -2807,7 +2835,7 @@ call4 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, | |||
| 2807 | RETURN_UNGCPRO (Ffuncall (5, args)); | 2835 | RETURN_UNGCPRO (Ffuncall (5, args)); |
| 2808 | } | 2836 | } |
| 2809 | 2837 | ||
| 2810 | /* Call function fn with 5 arguments arg1, arg2, arg3, arg4, arg5 */ | 2838 | /* Call function fn with 5 arguments arg1, arg2, arg3, arg4, arg5. */ |
| 2811 | /* ARGSUSED */ | 2839 | /* ARGSUSED */ |
| 2812 | Lisp_Object | 2840 | Lisp_Object |
| 2813 | call5 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, | 2841 | call5 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, |
| @@ -2826,7 +2854,7 @@ call5 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, | |||
| 2826 | RETURN_UNGCPRO (Ffuncall (6, args)); | 2854 | RETURN_UNGCPRO (Ffuncall (6, args)); |
| 2827 | } | 2855 | } |
| 2828 | 2856 | ||
| 2829 | /* Call function fn with 6 arguments arg1, arg2, arg3, arg4, arg5, arg6 */ | 2857 | /* Call function fn with 6 arguments arg1, arg2, arg3, arg4, arg5, arg6. */ |
| 2830 | /* ARGSUSED */ | 2858 | /* ARGSUSED */ |
| 2831 | Lisp_Object | 2859 | Lisp_Object |
| 2832 | call6 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, | 2860 | call6 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, |
| @@ -2846,7 +2874,7 @@ call6 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, | |||
| 2846 | RETURN_UNGCPRO (Ffuncall (7, args)); | 2874 | RETURN_UNGCPRO (Ffuncall (7, args)); |
| 2847 | } | 2875 | } |
| 2848 | 2876 | ||
| 2849 | /* Call function fn with 7 arguments arg1, arg2, arg3, arg4, arg5, arg6, arg7 */ | 2877 | /* Call function fn with 7 arguments arg1, arg2, arg3, arg4, arg5, arg6, arg7. */ |
| 2850 | /* ARGSUSED */ | 2878 | /* ARGSUSED */ |
| 2851 | Lisp_Object | 2879 | Lisp_Object |
| 2852 | call7 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, | 2880 | call7 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, |
| @@ -2907,16 +2935,16 @@ DEFUN ("funcall", Ffuncall, Sfuncall, 1, MANY, 0, | |||
| 2907 | Return the value that function returns. | 2935 | Return the value that function returns. |
| 2908 | Thus, (funcall 'cons 'x 'y) returns (x . y). | 2936 | Thus, (funcall 'cons 'x 'y) returns (x . y). |
| 2909 | usage: (funcall FUNCTION &rest ARGUMENTS) */) | 2937 | usage: (funcall FUNCTION &rest ARGUMENTS) */) |
| 2910 | (int nargs, Lisp_Object *args) | 2938 | (size_t nargs, Lisp_Object *args) |
| 2911 | { | 2939 | { |
| 2912 | Lisp_Object fun, original_fun; | 2940 | Lisp_Object fun, original_fun; |
| 2913 | Lisp_Object funcar; | 2941 | Lisp_Object funcar; |
| 2914 | int numargs = nargs - 1; | 2942 | size_t numargs = nargs - 1; |
| 2915 | Lisp_Object lisp_numargs; | 2943 | Lisp_Object lisp_numargs; |
| 2916 | Lisp_Object val; | 2944 | Lisp_Object val; |
| 2917 | struct backtrace backtrace; | 2945 | struct backtrace backtrace; |
| 2918 | register Lisp_Object *internal_args; | 2946 | register Lisp_Object *internal_args; |
| 2919 | register int i; | 2947 | register size_t i; |
| 2920 | 2948 | ||
| 2921 | QUIT; | 2949 | QUIT; |
| 2922 | if ((consing_since_gc > gc_cons_threshold | 2950 | if ((consing_since_gc > gc_cons_threshold |
| @@ -3070,21 +3098,21 @@ static Lisp_Object | |||
| 3070 | apply_lambda (Lisp_Object fun, Lisp_Object args) | 3098 | apply_lambda (Lisp_Object fun, Lisp_Object args) |
| 3071 | { | 3099 | { |
| 3072 | Lisp_Object args_left; | 3100 | Lisp_Object args_left; |
| 3073 | Lisp_Object numargs; | 3101 | size_t numargs; |
| 3074 | register Lisp_Object *arg_vector; | 3102 | register Lisp_Object *arg_vector; |
| 3075 | struct gcpro gcpro1, gcpro2, gcpro3; | 3103 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 3076 | register int i; | 3104 | register size_t i; |
| 3077 | register Lisp_Object tem; | 3105 | register Lisp_Object tem; |
| 3078 | USE_SAFE_ALLOCA; | 3106 | USE_SAFE_ALLOCA; |
| 3079 | 3107 | ||
| 3080 | numargs = Flength (args); | 3108 | numargs = XINT (Flength (args)); |
| 3081 | SAFE_ALLOCA_LISP (arg_vector, XINT (numargs)); | 3109 | SAFE_ALLOCA_LISP (arg_vector, numargs); |
| 3082 | args_left = args; | 3110 | args_left = args; |
| 3083 | 3111 | ||
| 3084 | GCPRO3 (*arg_vector, args_left, fun); | 3112 | GCPRO3 (*arg_vector, args_left, fun); |
| 3085 | gcpro1.nvars = 0; | 3113 | gcpro1.nvars = 0; |
| 3086 | 3114 | ||
| 3087 | for (i = 0; i < XINT (numargs);) | 3115 | for (i = 0; i < numargs; ) |
| 3088 | { | 3116 | { |
| 3089 | tem = Fcar (args_left), args_left = Fcdr (args_left); | 3117 | tem = Fcar (args_left), args_left = Fcdr (args_left); |
| 3090 | tem = eval_sub (tem); | 3118 | tem = eval_sub (tem); |
| @@ -3097,7 +3125,7 @@ apply_lambda (Lisp_Object fun, Lisp_Object args) | |||
| 3097 | backtrace_list->args = arg_vector; | 3125 | backtrace_list->args = arg_vector; |
| 3098 | backtrace_list->nargs = i; | 3126 | backtrace_list->nargs = i; |
| 3099 | backtrace_list->evalargs = 0; | 3127 | backtrace_list->evalargs = 0; |
| 3100 | tem = funcall_lambda (fun, XINT (numargs), arg_vector); | 3128 | tem = funcall_lambda (fun, numargs, arg_vector); |
| 3101 | 3129 | ||
| 3102 | /* Do the debug-on-exit now, while arg_vector still exists. */ | 3130 | /* Do the debug-on-exit now, while arg_vector still exists. */ |
| 3103 | if (backtrace_list->debug_on_exit) | 3131 | if (backtrace_list->debug_on_exit) |
| @@ -3113,12 +3141,13 @@ apply_lambda (Lisp_Object fun, Lisp_Object args) | |||
| 3113 | FUN must be either a lambda-expression or a compiled-code object. */ | 3141 | FUN must be either a lambda-expression or a compiled-code object. */ |
| 3114 | 3142 | ||
| 3115 | static Lisp_Object | 3143 | static Lisp_Object |
| 3116 | funcall_lambda (Lisp_Object fun, int nargs, | 3144 | funcall_lambda (Lisp_Object fun, size_t nargs, |
| 3117 | register Lisp_Object *arg_vector) | 3145 | register Lisp_Object *arg_vector) |
| 3118 | { | 3146 | { |
| 3119 | Lisp_Object val, syms_left, next, lexenv; | 3147 | Lisp_Object val, syms_left, next, lexenv; |
| 3120 | int count = SPECPDL_INDEX (); | 3148 | int count = SPECPDL_INDEX (); |
| 3121 | int i, optional, rest; | 3149 | size_t i; |
| 3150 | int optional, rest; | ||
| 3122 | 3151 | ||
| 3123 | if (CONSP (fun)) | 3152 | if (CONSP (fun)) |
| 3124 | { | 3153 | { |
| @@ -3270,7 +3299,7 @@ grow_specpdl (void) | |||
| 3270 | specpdl_ptr = specpdl + count; | 3299 | specpdl_ptr = specpdl + count; |
| 3271 | } | 3300 | } |
| 3272 | 3301 | ||
| 3273 | /* specpdl_ptr->symbol is a field which describes which variable is | 3302 | /* `specpdl_ptr->symbol' is a field which describes which variable is |
| 3274 | let-bound, so it can be properly undone when we unbind_to. | 3303 | let-bound, so it can be properly undone when we unbind_to. |
| 3275 | It can have the following two shapes: | 3304 | It can have the following two shapes: |
| 3276 | - SYMBOL : if it's a plain symbol, it means that we have let-bound | 3305 | - SYMBOL : if it's a plain symbol, it means that we have let-bound |
| @@ -3500,7 +3529,6 @@ Output stream used is value of `standard-output'. */) | |||
| 3500 | (void) | 3529 | (void) |
| 3501 | { | 3530 | { |
| 3502 | register struct backtrace *backlist = backtrace_list; | 3531 | register struct backtrace *backlist = backtrace_list; |
| 3503 | register int i; | ||
| 3504 | Lisp_Object tail; | 3532 | Lisp_Object tail; |
| 3505 | Lisp_Object tem; | 3533 | Lisp_Object tem; |
| 3506 | struct gcpro gcpro1; | 3534 | struct gcpro gcpro1; |
| @@ -3523,13 +3551,14 @@ Output stream used is value of `standard-output'. */) | |||
| 3523 | else | 3551 | else |
| 3524 | { | 3552 | { |
| 3525 | tem = *backlist->function; | 3553 | tem = *backlist->function; |
| 3526 | Fprin1 (tem, Qnil); /* This can QUIT */ | 3554 | Fprin1 (tem, Qnil); /* This can QUIT. */ |
| 3527 | write_string ("(", -1); | 3555 | write_string ("(", -1); |
| 3528 | if (backlist->nargs == MANY) | 3556 | if (backlist->nargs == MANY) |
| 3529 | { | 3557 | { /* FIXME: Can this happen? */ |
| 3558 | int i; | ||
| 3530 | for (tail = *backlist->args, i = 0; | 3559 | for (tail = *backlist->args, i = 0; |
| 3531 | !NILP (tail); | 3560 | !NILP (tail); |
| 3532 | tail = Fcdr (tail), i++) | 3561 | tail = Fcdr (tail), i = 1) |
| 3533 | { | 3562 | { |
| 3534 | if (i) write_string (" ", -1); | 3563 | if (i) write_string (" ", -1); |
| 3535 | Fprin1 (Fcar (tail), Qnil); | 3564 | Fprin1 (Fcar (tail), Qnil); |
| @@ -3537,6 +3566,7 @@ Output stream used is value of `standard-output'. */) | |||
| 3537 | } | 3566 | } |
| 3538 | else | 3567 | else |
| 3539 | { | 3568 | { |
| 3569 | size_t i; | ||
| 3540 | for (i = 0; i < backlist->nargs; i++) | 3570 | for (i = 0; i < backlist->nargs; i++) |
| 3541 | { | 3571 | { |
| 3542 | if (i) write_string (" ", -1); | 3572 | if (i) write_string (" ", -1); |
| @@ -3566,7 +3596,7 @@ If NFRAMES is more than the number of frames, the value is nil. */) | |||
| 3566 | (Lisp_Object nframes) | 3596 | (Lisp_Object nframes) |
| 3567 | { | 3597 | { |
| 3568 | register struct backtrace *backlist = backtrace_list; | 3598 | register struct backtrace *backlist = backtrace_list; |
| 3569 | register int i; | 3599 | register EMACS_INT i; |
| 3570 | Lisp_Object tem; | 3600 | Lisp_Object tem; |
| 3571 | 3601 | ||
| 3572 | CHECK_NATNUM (nframes); | 3602 | CHECK_NATNUM (nframes); |
| @@ -3581,7 +3611,7 @@ If NFRAMES is more than the number of frames, the value is nil. */) | |||
| 3581 | return Fcons (Qnil, Fcons (*backlist->function, *backlist->args)); | 3611 | return Fcons (Qnil, Fcons (*backlist->function, *backlist->args)); |
| 3582 | else | 3612 | else |
| 3583 | { | 3613 | { |
| 3584 | if (backlist->nargs == MANY) | 3614 | if (backlist->nargs == MANY) /* FIXME: Can this happen? */ |
| 3585 | tem = *backlist->args; | 3615 | tem = *backlist->args; |
| 3586 | else | 3616 | else |
| 3587 | tem = Flist (backlist->nargs, backlist->args); | 3617 | tem = Flist (backlist->nargs, backlist->args); |
| @@ -3595,17 +3625,18 @@ void | |||
| 3595 | mark_backtrace (void) | 3625 | mark_backtrace (void) |
| 3596 | { | 3626 | { |
| 3597 | register struct backtrace *backlist; | 3627 | register struct backtrace *backlist; |
| 3598 | register int i; | 3628 | register size_t i; |
| 3599 | 3629 | ||
| 3600 | for (backlist = backtrace_list; backlist; backlist = backlist->next) | 3630 | for (backlist = backtrace_list; backlist; backlist = backlist->next) |
| 3601 | { | 3631 | { |
| 3602 | mark_object (*backlist->function); | 3632 | mark_object (*backlist->function); |
| 3603 | 3633 | ||
| 3604 | if (backlist->nargs == UNEVALLED || backlist->nargs == MANY) | 3634 | if (backlist->nargs == UNEVALLED |
| 3605 | i = 0; | 3635 | || backlist->nargs == MANY) /* FIXME: Can this happen? */ |
| 3636 | i = 1; | ||
| 3606 | else | 3637 | else |
| 3607 | i = backlist->nargs - 1; | 3638 | i = backlist->nargs; |
| 3608 | for (; i >= 0; i--) | 3639 | while (i--) |
| 3609 | mark_object (backlist->args[i]); | 3640 | mark_object (backlist->args[i]); |
| 3610 | } | 3641 | } |
| 3611 | } | 3642 | } |
| @@ -3820,6 +3851,7 @@ alist of active lexical bindings. */); | |||
| 3820 | defsubr (&Srun_hook_with_args); | 3851 | defsubr (&Srun_hook_with_args); |
| 3821 | defsubr (&Srun_hook_with_args_until_success); | 3852 | defsubr (&Srun_hook_with_args_until_success); |
| 3822 | defsubr (&Srun_hook_with_args_until_failure); | 3853 | defsubr (&Srun_hook_with_args_until_failure); |
| 3854 | defsubr (&Srun_hook_wrapped); | ||
| 3823 | defsubr (&Sfetch_bytecode); | 3855 | defsubr (&Sfetch_bytecode); |
| 3824 | defsubr (&Sbacktrace_debug); | 3856 | defsubr (&Sbacktrace_debug); |
| 3825 | defsubr (&Sbacktrace); | 3857 | defsubr (&Sbacktrace); |