diff options
| author | Paul Eggert | 2011-03-29 16:35:49 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-03-29 16:35:49 -0700 |
| commit | 8289296548281f6fa4c8b6b1ee9ead764c4c9aa3 (patch) | |
| tree | 61d1528d9dab94f1be62dd0c76496c9edd00dc1f /src/eval.c | |
| parent | 792c7b2ba5319f436b459ff2c0d21e20207db550 (diff) | |
| parent | d806ab682a8e914345db3f2eede292f85745c98c (diff) | |
| download | emacs-8289296548281f6fa4c8b6b1ee9ead764c4c9aa3.tar.gz emacs-8289296548281f6fa4c8b6b1ee9ead764c4c9aa3.zip | |
Merge from mainline.
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 148 |
1 files changed, 86 insertions, 62 deletions
diff --git a/src/eval.c b/src/eval.c index 982fec66bbf..c3f9cd158f7 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -30,8 +30,8 @@ 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 | { |
| @@ -40,9 +40,9 @@ struct backtrace | |||
| 40 | Lisp_Object *args; /* Points to vector of args. */ | 40 | Lisp_Object *args; /* Points to vector of args. */ |
| 41 | size_t nargs; /* Length of vector. | 41 | size_t nargs; /* Length of vector. |
| 42 | If nargs is (size_t) UNEVALLED, args points | 42 | If nargs is (size_t) UNEVALLED, args points |
| 43 | to slot holding list of unevalled args */ | 43 | to slot holding list of unevalled args. */ |
| 44 | char evalargs; | 44 | char evalargs; |
| 45 | /* Nonzero means call value of debugger when done with this operation. */ | 45 | /* Nonzero means call value of debugger when done with this operation. */ |
| 46 | char debug_on_exit; | 46 | char debug_on_exit; |
| 47 | }; | 47 | }; |
| 48 | 48 | ||
| @@ -146,7 +146,7 @@ init_eval (void) | |||
| 146 | when_entered_debugger = -1; | 146 | when_entered_debugger = -1; |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | /* unwind-protect function used by call_debugger. */ | 149 | /* Unwind-protect function used by call_debugger. */ |
| 150 | 150 | ||
| 151 | static Lisp_Object | 151 | static Lisp_Object |
| 152 | restore_stack_limits (Lisp_Object data) | 152 | restore_stack_limits (Lisp_Object data) |
| @@ -556,7 +556,7 @@ interactive_p (int exclude_subrs_p) | |||
| 556 | || btp->nargs == (size_t) UNEVALLED)) | 556 | || btp->nargs == (size_t) UNEVALLED)) |
| 557 | btp = btp->next; | 557 | btp = btp->next; |
| 558 | 558 | ||
| 559 | /* btp now points at the frame of the innermost function that isn't | 559 | /* `btp' now points at the frame of the innermost function that isn't |
| 560 | a special form, ignoring frames for Finteractive_p and/or | 560 | a special form, ignoring frames for Finteractive_p and/or |
| 561 | Fbytecode at the top. If this frame is for a built-in function | 561 | Fbytecode at the top. If this frame is for a built-in function |
| 562 | (such as load or eval-region) return nil. */ | 562 | (such as load or eval-region) return nil. */ |
| @@ -564,7 +564,7 @@ interactive_p (int exclude_subrs_p) | |||
| 564 | if (exclude_subrs_p && SUBRP (fun)) | 564 | if (exclude_subrs_p && SUBRP (fun)) |
| 565 | return 0; | 565 | return 0; |
| 566 | 566 | ||
| 567 | /* btp points to the frame of a Lisp function that called interactive-p. | 567 | /* `btp' points to the frame of a Lisp function that called interactive-p. |
| 568 | Return t if that function was called interactively. */ | 568 | Return t if that function was called interactively. */ |
| 569 | if (btp && btp->next && EQ (*btp->next->function, Qcall_interactively)) | 569 | if (btp && btp->next && EQ (*btp->next->function, Qcall_interactively)) |
| 570 | return 1; | 570 | return 1; |
| @@ -965,11 +965,11 @@ usage: (let VARLIST BODY...) */) | |||
| 965 | 965 | ||
| 966 | varlist = Fcar (args); | 966 | varlist = Fcar (args); |
| 967 | 967 | ||
| 968 | /* Make space to hold the values to give the bound variables */ | 968 | /* Make space to hold the values to give the bound variables. */ |
| 969 | elt = Flength (varlist); | 969 | elt = Flength (varlist); |
| 970 | SAFE_ALLOCA_LISP (temps, XFASTINT (elt)); | 970 | SAFE_ALLOCA_LISP (temps, XFASTINT (elt)); |
| 971 | 971 | ||
| 972 | /* Compute the values and store them in `temps' */ | 972 | /* Compute the values and store them in `temps'. */ |
| 973 | 973 | ||
| 974 | GCPRO2 (args, *temps); | 974 | GCPRO2 (args, *temps); |
| 975 | gcpro2.nvars = 0; | 975 | gcpro2.nvars = 0; |
| @@ -1072,7 +1072,7 @@ definitions to shadow the loaded ones for use in file byte-compilation. */) | |||
| 1072 | /* SYM is not mentioned in ENVIRONMENT. | 1072 | /* SYM is not mentioned in ENVIRONMENT. |
| 1073 | Look at its function definition. */ | 1073 | Look at its function definition. */ |
| 1074 | if (EQ (def, Qunbound) || !CONSP (def)) | 1074 | if (EQ (def, Qunbound) || !CONSP (def)) |
| 1075 | /* Not defined or definition not suitable */ | 1075 | /* Not defined or definition not suitable. */ |
| 1076 | break; | 1076 | break; |
| 1077 | if (EQ (XCAR (def), Qautoload)) | 1077 | if (EQ (XCAR (def), Qautoload)) |
| 1078 | { | 1078 | { |
| @@ -1213,10 +1213,7 @@ unwind_to_catch (struct catchtag *catch, Lisp_Object value) | |||
| 1213 | byte_stack_list = catch->byte_stack; | 1213 | byte_stack_list = catch->byte_stack; |
| 1214 | gcprolist = catch->gcpro; | 1214 | gcprolist = catch->gcpro; |
| 1215 | #ifdef DEBUG_GCPRO | 1215 | #ifdef DEBUG_GCPRO |
| 1216 | if (gcprolist != 0) | 1216 | gcpro_level = gcprolist ? gcprolist->level + 1 : gcpro_level = 0; |
| 1217 | gcpro_level = gcprolist->level + 1; | ||
| 1218 | else | ||
| 1219 | gcpro_level = 0; | ||
| 1220 | #endif | 1217 | #endif |
| 1221 | backtrace_list = catch->backlist; | 1218 | backtrace_list = catch->backlist; |
| 1222 | lisp_eval_depth = catch->lisp_eval_depth; | 1219 | lisp_eval_depth = catch->lisp_eval_depth; |
| @@ -1824,7 +1821,7 @@ maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, Lisp_Object data) | |||
| 1824 | ? debug_on_quit | 1821 | ? debug_on_quit |
| 1825 | : wants_debugger (Vdebug_on_error, conditions)) | 1822 | : wants_debugger (Vdebug_on_error, conditions)) |
| 1826 | && ! skip_debugger (conditions, combined_data) | 1823 | && ! skip_debugger (conditions, combined_data) |
| 1827 | /* rms: what's this for? */ | 1824 | /* RMS: What's this for? */ |
| 1828 | && when_entered_debugger < num_nonmacro_input_events) | 1825 | && when_entered_debugger < num_nonmacro_input_events) |
| 1829 | { | 1826 | { |
| 1830 | call_debugger (Fcons (Qerror, Fcons (combined_data, Qnil))); | 1827 | call_debugger (Fcons (Qerror, Fcons (combined_data, Qnil))); |
| @@ -1891,7 +1888,7 @@ find_handler_clause (Lisp_Object handlers, Lisp_Object conditions, | |||
| 1891 | } | 1888 | } |
| 1892 | 1889 | ||
| 1893 | 1890 | ||
| 1894 | /* dump an error message; called like vprintf */ | 1891 | /* Dump an error message; called like vprintf. */ |
| 1895 | void | 1892 | void |
| 1896 | verror (const char *m, va_list ap) | 1893 | verror (const char *m, va_list ap) |
| 1897 | { | 1894 | { |
| @@ -1928,7 +1925,7 @@ verror (const char *m, va_list ap) | |||
| 1928 | } | 1925 | } |
| 1929 | 1926 | ||
| 1930 | 1927 | ||
| 1931 | /* dump an error message; called like printf */ | 1928 | /* Dump an error message; called like printf. */ |
| 1932 | 1929 | ||
| 1933 | /* VARARGS 1 */ | 1930 | /* VARARGS 1 */ |
| 1934 | void | 1931 | void |
| @@ -2024,7 +2021,7 @@ this does nothing and returns nil. */) | |||
| 2024 | CHECK_SYMBOL (function); | 2021 | CHECK_SYMBOL (function); |
| 2025 | CHECK_STRING (file); | 2022 | CHECK_STRING (file); |
| 2026 | 2023 | ||
| 2027 | /* If function is defined and not as an autoload, don't override */ | 2024 | /* If function is defined and not as an autoload, don't override. */ |
| 2028 | if (!EQ (XSYMBOL (function)->function, Qunbound) | 2025 | if (!EQ (XSYMBOL (function)->function, Qunbound) |
| 2029 | && !(CONSP (XSYMBOL (function)->function) | 2026 | && !(CONSP (XSYMBOL (function)->function) |
| 2030 | && EQ (XCAR (XSYMBOL (function)->function), Qautoload))) | 2027 | && EQ (XCAR (XSYMBOL (function)->function), Qautoload))) |
| @@ -2159,7 +2156,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, | |||
| 2159 | 2156 | ||
| 2160 | backtrace.next = backtrace_list; | 2157 | backtrace.next = backtrace_list; |
| 2161 | backtrace_list = &backtrace; | 2158 | backtrace_list = &backtrace; |
| 2162 | backtrace.function = &original_fun; /* This also protects them from gc */ | 2159 | backtrace.function = &original_fun; /* This also protects them from gc. */ |
| 2163 | backtrace.args = &original_args; | 2160 | backtrace.args = &original_args; |
| 2164 | backtrace.nargs = UNEVALLED; | 2161 | backtrace.nargs = UNEVALLED; |
| 2165 | backtrace.evalargs = 1; | 2162 | backtrace.evalargs = 1; |
| @@ -2169,7 +2166,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, | |||
| 2169 | do_debug_on_call (Qt); | 2166 | do_debug_on_call (Qt); |
| 2170 | 2167 | ||
| 2171 | /* At this point, only original_fun and original_args | 2168 | /* At this point, only original_fun and original_args |
| 2172 | have values that will be used below */ | 2169 | have values that will be used below. */ |
| 2173 | retry: | 2170 | retry: |
| 2174 | 2171 | ||
| 2175 | /* Optimize for no indirection. */ | 2172 | /* Optimize for no indirection. */ |
| @@ -2190,8 +2187,9 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, | |||
| 2190 | 2187 | ||
| 2191 | CHECK_CONS_LIST (); | 2188 | CHECK_CONS_LIST (); |
| 2192 | 2189 | ||
| 2193 | if (XINT (numargs) < XSUBR (fun)->min_args || | 2190 | if (XINT (numargs) < XSUBR (fun)->min_args |
| 2194 | (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < XINT (numargs))) | 2191 | || (0 <= XSUBR (fun)->max_args |
| 2192 | && XSUBR (fun)->max_args < XINT (numargs))) | ||
| 2195 | xsignal2 (Qwrong_number_of_arguments, original_fun, numargs); | 2193 | xsignal2 (Qwrong_number_of_arguments, original_fun, numargs); |
| 2196 | 2194 | ||
| 2197 | else if (XSUBR (fun)->max_args == UNEVALLED) | 2195 | else if (XSUBR (fun)->max_args == UNEVALLED) |
| @@ -2201,7 +2199,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, | |||
| 2201 | } | 2199 | } |
| 2202 | else if (XSUBR (fun)->max_args == MANY) | 2200 | else if (XSUBR (fun)->max_args == MANY) |
| 2203 | { | 2201 | { |
| 2204 | /* Pass a vector of evaluated arguments */ | 2202 | /* Pass a vector of evaluated arguments. */ |
| 2205 | Lisp_Object *vals; | 2203 | Lisp_Object *vals; |
| 2206 | register size_t argnum = 0; | 2204 | register size_t argnum = 0; |
| 2207 | USE_SAFE_ALLOCA; | 2205 | USE_SAFE_ALLOCA; |
| @@ -2364,7 +2362,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) | |||
| 2364 | fun = indirect_function (fun); | 2362 | fun = indirect_function (fun); |
| 2365 | if (EQ (fun, Qunbound)) | 2363 | if (EQ (fun, Qunbound)) |
| 2366 | { | 2364 | { |
| 2367 | /* Let funcall get the error */ | 2365 | /* Let funcall get the error. */ |
| 2368 | fun = args[0]; | 2366 | fun = args[0]; |
| 2369 | goto funcall; | 2367 | goto funcall; |
| 2370 | } | 2368 | } |
| @@ -2373,11 +2371,11 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) | |||
| 2373 | { | 2371 | { |
| 2374 | if (numargs < XSUBR (fun)->min_args | 2372 | if (numargs < XSUBR (fun)->min_args |
| 2375 | || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs)) | 2373 | || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs)) |
| 2376 | goto funcall; /* Let funcall get the error */ | 2374 | goto funcall; /* Let funcall get the error. */ |
| 2377 | else if (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args > numargs) | 2375 | else if (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args > numargs) |
| 2378 | { | 2376 | { |
| 2379 | /* Avoid making funcall cons up a yet another new vector of arguments | 2377 | /* Avoid making funcall cons up a yet another new vector of arguments |
| 2380 | by explicitly supplying nil's for optional values */ | 2378 | by explicitly supplying nil's for optional values. */ |
| 2381 | SAFE_ALLOCA_LISP (funcall_args, 1 + XSUBR (fun)->max_args); | 2379 | SAFE_ALLOCA_LISP (funcall_args, 1 + XSUBR (fun)->max_args); |
| 2382 | for (i = numargs; i < XSUBR (fun)->max_args;) | 2380 | for (i = numargs; i < XSUBR (fun)->max_args;) |
| 2383 | funcall_args[++i] = Qnil; | 2381 | funcall_args[++i] = Qnil; |
| @@ -2415,9 +2413,12 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) | |||
| 2415 | 2413 | ||
| 2416 | /* Run hook variables in various ways. */ | 2414 | /* Run hook variables in various ways. */ |
| 2417 | 2415 | ||
| 2418 | enum run_hooks_condition {to_completion, until_success, until_failure}; | 2416 | static Lisp_Object |
| 2419 | static Lisp_Object run_hook_with_args (size_t, Lisp_Object *, | 2417 | funcall_nil (size_t nargs, Lisp_Object *args) |
| 2420 | enum run_hooks_condition); | 2418 | { |
| 2419 | Ffuncall (nargs, args); | ||
| 2420 | return Qnil; | ||
| 2421 | } | ||
| 2421 | 2422 | ||
| 2422 | DEFUN ("run-hooks", Frun_hooks, Srun_hooks, 0, MANY, 0, | 2423 | DEFUN ("run-hooks", Frun_hooks, Srun_hooks, 0, MANY, 0, |
| 2423 | doc: /* Run each hook in HOOKS. | 2424 | doc: /* Run each hook in HOOKS. |
| @@ -2442,7 +2443,7 @@ usage: (run-hooks &rest HOOKS) */) | |||
| 2442 | for (i = 0; i < nargs; i++) | 2443 | for (i = 0; i < nargs; i++) |
| 2443 | { | 2444 | { |
| 2444 | hook[0] = args[i]; | 2445 | hook[0] = args[i]; |
| 2445 | run_hook_with_args (1, hook, to_completion); | 2446 | run_hook_with_args (1, hook, funcall_nil); |
| 2446 | } | 2447 | } |
| 2447 | 2448 | ||
| 2448 | return Qnil; | 2449 | return Qnil; |
| @@ -2465,7 +2466,7 @@ Instead, use `add-hook' and specify t for the LOCAL argument. | |||
| 2465 | usage: (run-hook-with-args HOOK &rest ARGS) */) | 2466 | usage: (run-hook-with-args HOOK &rest ARGS) */) |
| 2466 | (size_t nargs, Lisp_Object *args) | 2467 | (size_t nargs, Lisp_Object *args) |
| 2467 | { | 2468 | { |
| 2468 | return run_hook_with_args (nargs, args, to_completion); | 2469 | return run_hook_with_args (nargs, args, funcall_nil); |
| 2469 | } | 2470 | } |
| 2470 | 2471 | ||
| 2471 | DEFUN ("run-hook-with-args-until-success", Frun_hook_with_args_until_success, | 2472 | DEFUN ("run-hook-with-args-until-success", Frun_hook_with_args_until_success, |
| @@ -2485,7 +2486,13 @@ Instead, use `add-hook' and specify t for the LOCAL argument. | |||
| 2485 | usage: (run-hook-with-args-until-success HOOK &rest ARGS) */) | 2486 | usage: (run-hook-with-args-until-success HOOK &rest ARGS) */) |
| 2486 | (size_t nargs, Lisp_Object *args) | 2487 | (size_t nargs, Lisp_Object *args) |
| 2487 | { | 2488 | { |
| 2488 | return run_hook_with_args (nargs, args, until_success); | 2489 | return run_hook_with_args (nargs, args, Ffuncall); |
| 2490 | } | ||
| 2491 | |||
| 2492 | static Lisp_Object | ||
| 2493 | funcall_not (size_t nargs, Lisp_Object *args) | ||
| 2494 | { | ||
| 2495 | return NILP (Ffuncall (nargs, args)) ? Qt : Qnil; | ||
| 2489 | } | 2496 | } |
| 2490 | 2497 | ||
| 2491 | DEFUN ("run-hook-with-args-until-failure", Frun_hook_with_args_until_failure, | 2498 | DEFUN ("run-hook-with-args-until-failure", Frun_hook_with_args_until_failure, |
| @@ -2504,22 +2511,45 @@ Instead, use `add-hook' and specify t for the LOCAL argument. | |||
| 2504 | usage: (run-hook-with-args-until-failure HOOK &rest ARGS) */) | 2511 | usage: (run-hook-with-args-until-failure HOOK &rest ARGS) */) |
| 2505 | (size_t nargs, Lisp_Object *args) | 2512 | (size_t nargs, Lisp_Object *args) |
| 2506 | { | 2513 | { |
| 2507 | return run_hook_with_args (nargs, args, until_failure); | 2514 | return NILP (run_hook_with_args (nargs, args, funcall_not)) ? Qt : Qnil; |
| 2515 | } | ||
| 2516 | |||
| 2517 | static Lisp_Object | ||
| 2518 | run_hook_wrapped_funcall (size_t nargs, Lisp_Object *args) | ||
| 2519 | { | ||
| 2520 | Lisp_Object tmp = args[0], ret; | ||
| 2521 | args[0] = args[1]; | ||
| 2522 | args[1] = tmp; | ||
| 2523 | ret = Ffuncall (nargs, args); | ||
| 2524 | args[1] = args[0]; | ||
| 2525 | args[0] = tmp; | ||
| 2526 | return ret; | ||
| 2527 | } | ||
| 2528 | |||
| 2529 | DEFUN ("run-hook-wrapped", Frun_hook_wrapped, Srun_hook_wrapped, 2, MANY, 0, | ||
| 2530 | doc: /* Run HOOK, passing each function through WRAP-FUNCTION. | ||
| 2531 | I.e. instead of calling each function FUN directly with arguments ARGS, | ||
| 2532 | it calls WRAP-FUNCTION with arguments FUN and ARGS. | ||
| 2533 | As soon as a call to WRAP-FUNCTION returns non-nil, `run-hook-wrapped' | ||
| 2534 | aborts and returns that value. | ||
| 2535 | usage: (run-hook-wrapped HOOK WRAP-FUNCTION &rest ARGS) */) | ||
| 2536 | (size_t nargs, Lisp_Object *args) | ||
| 2537 | { | ||
| 2538 | return run_hook_with_args (nargs, args, run_hook_wrapped_funcall); | ||
| 2508 | } | 2539 | } |
| 2509 | 2540 | ||
| 2510 | /* ARGS[0] should be a hook symbol. | 2541 | /* ARGS[0] should be a hook symbol. |
| 2511 | Call each of the functions in the hook value, passing each of them | 2542 | Call each of the functions in the hook value, passing each of them |
| 2512 | as arguments all the rest of ARGS (all NARGS - 1 elements). | 2543 | as arguments all the rest of ARGS (all NARGS - 1 elements). |
| 2513 | COND specifies a condition to test after each call | 2544 | FUNCALL specifies how to call each function on the hook. |
| 2514 | to decide whether to stop. | ||
| 2515 | The caller (or its caller, etc) must gcpro all of ARGS, | 2545 | The caller (or its caller, etc) must gcpro all of ARGS, |
| 2516 | except that it isn't necessary to gcpro ARGS[0]. */ | 2546 | except that it isn't necessary to gcpro ARGS[0]. */ |
| 2517 | 2547 | ||
| 2518 | static Lisp_Object | 2548 | Lisp_Object |
| 2519 | run_hook_with_args (size_t nargs, Lisp_Object *args, | 2549 | run_hook_with_args (size_t nargs, Lisp_Object *args, |
| 2520 | enum run_hooks_condition cond) | 2550 | Lisp_Object (*funcall) (size_t nargs, Lisp_Object *args)) |
| 2521 | { | 2551 | { |
| 2522 | Lisp_Object sym, val, ret; | 2552 | Lisp_Object sym, val, ret = Qnil; |
| 2523 | struct gcpro gcpro1, gcpro2, gcpro3; | 2553 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 2524 | 2554 | ||
| 2525 | /* If we are dying or still initializing, | 2555 | /* If we are dying or still initializing, |
| @@ -2529,14 +2559,13 @@ run_hook_with_args (size_t nargs, Lisp_Object *args, | |||
| 2529 | 2559 | ||
| 2530 | sym = args[0]; | 2560 | sym = args[0]; |
| 2531 | val = find_symbol_value (sym); | 2561 | val = find_symbol_value (sym); |
| 2532 | ret = (cond == until_failure ? Qt : Qnil); | ||
| 2533 | 2562 | ||
| 2534 | if (EQ (val, Qunbound) || NILP (val)) | 2563 | if (EQ (val, Qunbound) || NILP (val)) |
| 2535 | return ret; | 2564 | return ret; |
| 2536 | else if (!CONSP (val) || EQ (XCAR (val), Qlambda)) | 2565 | else if (!CONSP (val) || EQ (XCAR (val), Qlambda)) |
| 2537 | { | 2566 | { |
| 2538 | args[0] = val; | 2567 | args[0] = val; |
| 2539 | return Ffuncall (nargs, args); | 2568 | return funcall (nargs, args); |
| 2540 | } | 2569 | } |
| 2541 | else | 2570 | else |
| 2542 | { | 2571 | { |
| @@ -2544,9 +2573,7 @@ run_hook_with_args (size_t nargs, Lisp_Object *args, | |||
| 2544 | GCPRO3 (sym, val, global_vals); | 2573 | GCPRO3 (sym, val, global_vals); |
| 2545 | 2574 | ||
| 2546 | for (; | 2575 | for (; |
| 2547 | CONSP (val) && ((cond == to_completion) | 2576 | CONSP (val) && NILP (ret); |
| 2548 | || (cond == until_success ? NILP (ret) | ||
| 2549 | : !NILP (ret))); | ||
| 2550 | val = XCDR (val)) | 2577 | val = XCDR (val)) |
| 2551 | { | 2578 | { |
| 2552 | if (EQ (XCAR (val), Qt)) | 2579 | if (EQ (XCAR (val), Qt)) |
| @@ -2559,30 +2586,26 @@ run_hook_with_args (size_t nargs, Lisp_Object *args, | |||
| 2559 | if (!CONSP (global_vals) || EQ (XCAR (global_vals), Qlambda)) | 2586 | if (!CONSP (global_vals) || EQ (XCAR (global_vals), Qlambda)) |
| 2560 | { | 2587 | { |
| 2561 | args[0] = global_vals; | 2588 | args[0] = global_vals; |
| 2562 | ret = Ffuncall (nargs, args); | 2589 | ret = funcall (nargs, args); |
| 2563 | } | 2590 | } |
| 2564 | else | 2591 | else |
| 2565 | { | 2592 | { |
| 2566 | for (; | 2593 | for (; |
| 2567 | (CONSP (global_vals) | 2594 | CONSP (global_vals) && NILP (ret); |
| 2568 | && (cond == to_completion | ||
| 2569 | || (cond == until_success | ||
| 2570 | ? NILP (ret) | ||
| 2571 | : !NILP (ret)))); | ||
| 2572 | global_vals = XCDR (global_vals)) | 2595 | global_vals = XCDR (global_vals)) |
| 2573 | { | 2596 | { |
| 2574 | args[0] = XCAR (global_vals); | 2597 | args[0] = XCAR (global_vals); |
| 2575 | /* In a global value, t should not occur. If it does, we | 2598 | /* In a global value, t should not occur. If it does, we |
| 2576 | must ignore it to avoid an endless loop. */ | 2599 | must ignore it to avoid an endless loop. */ |
| 2577 | if (!EQ (args[0], Qt)) | 2600 | if (!EQ (args[0], Qt)) |
| 2578 | ret = Ffuncall (nargs, args); | 2601 | ret = funcall (nargs, args); |
| 2579 | } | 2602 | } |
| 2580 | } | 2603 | } |
| 2581 | } | 2604 | } |
| 2582 | else | 2605 | else |
| 2583 | { | 2606 | { |
| 2584 | args[0] = XCAR (val); | 2607 | args[0] = XCAR (val); |
| 2585 | ret = Ffuncall (nargs, args); | 2608 | ret = funcall (nargs, args); |
| 2586 | } | 2609 | } |
| 2587 | } | 2610 | } |
| 2588 | 2611 | ||
| @@ -2604,7 +2627,7 @@ run_hook_with_args_2 (Lisp_Object hook, Lisp_Object arg1, Lisp_Object arg2) | |||
| 2604 | Frun_hook_with_args (3, temp); | 2627 | Frun_hook_with_args (3, temp); |
| 2605 | } | 2628 | } |
| 2606 | 2629 | ||
| 2607 | /* Apply fn to arg */ | 2630 | /* Apply fn to arg. */ |
| 2608 | Lisp_Object | 2631 | Lisp_Object |
| 2609 | apply1 (Lisp_Object fn, Lisp_Object arg) | 2632 | apply1 (Lisp_Object fn, Lisp_Object arg) |
| 2610 | { | 2633 | { |
| @@ -2623,7 +2646,7 @@ apply1 (Lisp_Object fn, Lisp_Object arg) | |||
| 2623 | } | 2646 | } |
| 2624 | } | 2647 | } |
| 2625 | 2648 | ||
| 2626 | /* Call function fn on no arguments */ | 2649 | /* Call function fn on no arguments. */ |
| 2627 | Lisp_Object | 2650 | Lisp_Object |
| 2628 | call0 (Lisp_Object fn) | 2651 | call0 (Lisp_Object fn) |
| 2629 | { | 2652 | { |
| @@ -2633,7 +2656,7 @@ call0 (Lisp_Object fn) | |||
| 2633 | RETURN_UNGCPRO (Ffuncall (1, &fn)); | 2656 | RETURN_UNGCPRO (Ffuncall (1, &fn)); |
| 2634 | } | 2657 | } |
| 2635 | 2658 | ||
| 2636 | /* Call function fn with 1 argument arg1 */ | 2659 | /* Call function fn with 1 argument arg1. */ |
| 2637 | /* ARGSUSED */ | 2660 | /* ARGSUSED */ |
| 2638 | Lisp_Object | 2661 | Lisp_Object |
| 2639 | call1 (Lisp_Object fn, Lisp_Object arg1) | 2662 | call1 (Lisp_Object fn, Lisp_Object arg1) |
| @@ -2648,7 +2671,7 @@ call1 (Lisp_Object fn, Lisp_Object arg1) | |||
| 2648 | RETURN_UNGCPRO (Ffuncall (2, args)); | 2671 | RETURN_UNGCPRO (Ffuncall (2, args)); |
| 2649 | } | 2672 | } |
| 2650 | 2673 | ||
| 2651 | /* Call function fn with 2 arguments arg1, arg2 */ | 2674 | /* Call function fn with 2 arguments arg1, arg2. */ |
| 2652 | /* ARGSUSED */ | 2675 | /* ARGSUSED */ |
| 2653 | Lisp_Object | 2676 | Lisp_Object |
| 2654 | call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2) | 2677 | call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2) |
| @@ -2663,7 +2686,7 @@ call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2) | |||
| 2663 | RETURN_UNGCPRO (Ffuncall (3, args)); | 2686 | RETURN_UNGCPRO (Ffuncall (3, args)); |
| 2664 | } | 2687 | } |
| 2665 | 2688 | ||
| 2666 | /* Call function fn with 3 arguments arg1, arg2, arg3 */ | 2689 | /* Call function fn with 3 arguments arg1, arg2, arg3. */ |
| 2667 | /* ARGSUSED */ | 2690 | /* ARGSUSED */ |
| 2668 | Lisp_Object | 2691 | Lisp_Object |
| 2669 | call3 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) | 2692 | call3 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) |
| @@ -2679,7 +2702,7 @@ call3 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) | |||
| 2679 | RETURN_UNGCPRO (Ffuncall (4, args)); | 2702 | RETURN_UNGCPRO (Ffuncall (4, args)); |
| 2680 | } | 2703 | } |
| 2681 | 2704 | ||
| 2682 | /* Call function fn with 4 arguments arg1, arg2, arg3, arg4 */ | 2705 | /* Call function fn with 4 arguments arg1, arg2, arg3, arg4. */ |
| 2683 | /* ARGSUSED */ | 2706 | /* ARGSUSED */ |
| 2684 | Lisp_Object | 2707 | Lisp_Object |
| 2685 | call4 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, | 2708 | call4 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, |
| @@ -2697,7 +2720,7 @@ call4 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, | |||
| 2697 | RETURN_UNGCPRO (Ffuncall (5, args)); | 2720 | RETURN_UNGCPRO (Ffuncall (5, args)); |
| 2698 | } | 2721 | } |
| 2699 | 2722 | ||
| 2700 | /* Call function fn with 5 arguments arg1, arg2, arg3, arg4, arg5 */ | 2723 | /* Call function fn with 5 arguments arg1, arg2, arg3, arg4, arg5. */ |
| 2701 | /* ARGSUSED */ | 2724 | /* ARGSUSED */ |
| 2702 | Lisp_Object | 2725 | Lisp_Object |
| 2703 | call5 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, | 2726 | call5 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, |
| @@ -2716,7 +2739,7 @@ call5 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, | |||
| 2716 | RETURN_UNGCPRO (Ffuncall (6, args)); | 2739 | RETURN_UNGCPRO (Ffuncall (6, args)); |
| 2717 | } | 2740 | } |
| 2718 | 2741 | ||
| 2719 | /* Call function fn with 6 arguments arg1, arg2, arg3, arg4, arg5, arg6 */ | 2742 | /* Call function fn with 6 arguments arg1, arg2, arg3, arg4, arg5, arg6. */ |
| 2720 | /* ARGSUSED */ | 2743 | /* ARGSUSED */ |
| 2721 | Lisp_Object | 2744 | Lisp_Object |
| 2722 | call6 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, | 2745 | call6 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, |
| @@ -2736,7 +2759,7 @@ call6 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, | |||
| 2736 | RETURN_UNGCPRO (Ffuncall (7, args)); | 2759 | RETURN_UNGCPRO (Ffuncall (7, args)); |
| 2737 | } | 2760 | } |
| 2738 | 2761 | ||
| 2739 | /* Call function fn with 7 arguments arg1, arg2, arg3, arg4, arg5, arg6, arg7 */ | 2762 | /* Call function fn with 7 arguments arg1, arg2, arg3, arg4, arg5, arg6, arg7. */ |
| 2740 | /* ARGSUSED */ | 2763 | /* ARGSUSED */ |
| 2741 | Lisp_Object | 2764 | Lisp_Object |
| 2742 | call7 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, | 2765 | call7 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, |
| @@ -3082,7 +3105,7 @@ grow_specpdl (void) | |||
| 3082 | specpdl_ptr = specpdl + count; | 3105 | specpdl_ptr = specpdl + count; |
| 3083 | } | 3106 | } |
| 3084 | 3107 | ||
| 3085 | /* specpdl_ptr->symbol is a field which describes which variable is | 3108 | /* `specpdl_ptr->symbol' is a field which describes which variable is |
| 3086 | let-bound, so it can be properly undone when we unbind_to. | 3109 | let-bound, so it can be properly undone when we unbind_to. |
| 3087 | It can have the following two shapes: | 3110 | It can have the following two shapes: |
| 3088 | - SYMBOL : if it's a plain symbol, it means that we have let-bound | 3111 | - SYMBOL : if it's a plain symbol, it means that we have let-bound |
| @@ -3320,7 +3343,7 @@ Output stream used is value of `standard-output'. */) | |||
| 3320 | else | 3343 | else |
| 3321 | { | 3344 | { |
| 3322 | tem = *backlist->function; | 3345 | tem = *backlist->function; |
| 3323 | Fprin1 (tem, Qnil); /* This can QUIT */ | 3346 | Fprin1 (tem, Qnil); /* This can QUIT. */ |
| 3324 | write_string ("(", -1); | 3347 | write_string ("(", -1); |
| 3325 | if (backlist->nargs == (size_t) MANY) | 3348 | if (backlist->nargs == (size_t) MANY) |
| 3326 | { | 3349 | { |
| @@ -3593,6 +3616,7 @@ The value the function returns is not used. */); | |||
| 3593 | defsubr (&Srun_hook_with_args); | 3616 | defsubr (&Srun_hook_with_args); |
| 3594 | defsubr (&Srun_hook_with_args_until_success); | 3617 | defsubr (&Srun_hook_with_args_until_success); |
| 3595 | defsubr (&Srun_hook_with_args_until_failure); | 3618 | defsubr (&Srun_hook_with_args_until_failure); |
| 3619 | defsubr (&Srun_hook_wrapped); | ||
| 3596 | defsubr (&Sfetch_bytecode); | 3620 | defsubr (&Sfetch_bytecode); |
| 3597 | defsubr (&Sbacktrace_debug); | 3621 | defsubr (&Sbacktrace_debug); |
| 3598 | defsubr (&Sbacktrace); | 3622 | defsubr (&Sbacktrace); |