Mercurial > emacs
annotate src/eval.c @ 30058:cbdbc61ee760
(internal_condition_case): Comment out abort if
interrupt_input_blocked is not zero.
| author | Andrew Innes <andrewi@gnu.org> |
|---|---|
| date | Wed, 05 Jul 2000 15:40:14 +0000 |
| parents | 86eaa645e6bc |
| children | ed8f34a43649 |
| rev | line source |
|---|---|
| 272 | 1 /* Evaluator for GNU Emacs Lisp interpreter. |
|
27554
229352fdbf68
Fix various doc strings not to duplicate information from
Dave Love <fx@gnu.org>
parents:
27295
diff
changeset
|
2 Copyright (C) 1985, 86, 87, 93, 94, 95, 99, 2000 |
|
229352fdbf68
Fix various doc strings not to duplicate information from
Dave Love <fx@gnu.org>
parents:
27295
diff
changeset
|
3 Free Software Foundation, Inc. |
| 272 | 4 |
| 5 This file is part of GNU Emacs. | |
| 6 | |
| 7 GNU Emacs is free software; you can redistribute it and/or modify | |
| 8 it under the terms of the GNU General Public License as published by | |
|
10342
01d13c22797e
(Fcommandp): Use & PSEUDOVECTOR_SIZE_MASK on `size' field of compiled
Roland McGrath <roland@gnu.org>
parents:
10201
diff
changeset
|
9 the Free Software Foundation; either version 2, or (at your option) |
| 272 | 10 any later version. |
| 11 | |
| 12 GNU Emacs is distributed in the hope that it will be useful, | |
| 13 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 GNU General Public License for more details. | |
| 16 | |
| 17 You should have received a copy of the GNU General Public License | |
| 18 along with GNU Emacs; see the file COPYING. If not, write to | |
|
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14073
diff
changeset
|
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14073
diff
changeset
|
20 Boston, MA 02111-1307, USA. */ |
| 272 | 21 |
| 22 | |
|
4696
1fc792473491
Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents:
4474
diff
changeset
|
23 #include <config.h> |
| 272 | 24 #include "lisp.h" |
|
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
1564
diff
changeset
|
25 #include "blockinput.h" |
| 272 | 26 #include "commands.h" |
| 515 | 27 #include "keyboard.h" |
|
26764
9fd028e7872c
(call_debugger): When entering the debugger while redisplaying,
Gerd Moellmann <gerd@gnu.org>
parents:
26365
diff
changeset
|
28 #include "dispextern.h" |
| 272 | 29 #include <setjmp.h> |
| 30 | |
| 31 /* This definition is duplicated in alloc.c and keyboard.c */ | |
| 32 /* Putting it in lisp.h makes cc bomb out! */ | |
| 33 | |
| 34 struct backtrace | |
| 35 { | |
| 36 struct backtrace *next; | |
| 37 Lisp_Object *function; | |
| 38 Lisp_Object *args; /* Points to vector of args. */ | |
| 727 | 39 int nargs; /* Length of vector. |
| 40 If nargs is UNEVALLED, args points to slot holding | |
| 41 list of unevalled args */ | |
| 272 | 42 char evalargs; |
| 43 /* Nonzero means call value of debugger when done with this operation. */ | |
| 44 char debug_on_exit; | |
| 45 }; | |
| 46 | |
| 47 struct backtrace *backtrace_list; | |
| 48 | |
|
1196
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
49 /* This structure helps implement the `catch' and `throw' control |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
50 structure. A struct catchtag contains all the information needed |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
51 to restore the state of the interpreter after a non-local jump. |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
52 |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
53 Handlers for error conditions (represented by `struct handler' |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
54 structures) just point to a catch tag to do the cleanup required |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
55 for their jumps. |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
56 |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
57 catchtag structures are chained together in the C calling stack; |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
58 the `next' member points to the next outer catchtag. |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
59 |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
60 A call like (throw TAG VAL) searches for a catchtag whose `tag' |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
61 member is TAG, and then unbinds to it. The `val' member is used to |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
62 hold VAL while the stack is unwound; `val' is returned as the value |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
63 of the catch form. |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
64 |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
65 All the other members are concerned with restoring the interpreter |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
66 state. */ |
| 272 | 67 struct catchtag |
| 68 { | |
| 69 Lisp_Object tag; | |
| 70 Lisp_Object val; | |
| 71 struct catchtag *next; | |
| 72 struct gcpro *gcpro; | |
| 73 jmp_buf jmp; | |
| 74 struct backtrace *backlist; | |
| 75 struct handler *handlerlist; | |
| 76 int lisp_eval_depth; | |
| 77 int pdlcount; | |
| 78 int poll_suppress_count; | |
|
26365
6527989cb214
(struct catchtag): Add member byte_stack.
Gerd Moellmann <gerd@gnu.org>
parents:
26307
diff
changeset
|
79 struct byte_stack *byte_stack; |
| 272 | 80 }; |
| 81 | |
| 82 struct catchtag *catchlist; | |
| 83 | |
|
26297
4d1e267efd41
[DEBUG_GCPRO] (gcpro_level): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
26088
diff
changeset
|
84 #ifdef DEBUG_GCPRO |
|
4d1e267efd41
[DEBUG_GCPRO] (gcpro_level): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
26088
diff
changeset
|
85 /* Count levels of GCPRO to detect failure to UNGCPRO. */ |
|
4d1e267efd41
[DEBUG_GCPRO] (gcpro_level): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
26088
diff
changeset
|
86 int gcpro_level; |
|
4d1e267efd41
[DEBUG_GCPRO] (gcpro_level): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
26088
diff
changeset
|
87 #endif |
|
4d1e267efd41
[DEBUG_GCPRO] (gcpro_level): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
26088
diff
changeset
|
88 |
| 272 | 89 Lisp_Object Qautoload, Qmacro, Qexit, Qinteractive, Qcommandp, Qdefun; |
| 381 | 90 Lisp_Object Qinhibit_quit, Vinhibit_quit, Vquit_flag; |
| 272 | 91 Lisp_Object Qmocklisp_arguments, Vmocklisp_arguments, Qmocklisp; |
| 92 Lisp_Object Qand_rest, Qand_optional; | |
| 93 Lisp_Object Qdebug_on_error; | |
| 94 | |
|
16296
584310941e70
(syms_of_eval): Initialize Vrun_hooks here.
Richard M. Stallman <rms@gnu.org>
parents:
16113
diff
changeset
|
95 /* This holds either the symbol `run-hooks' or nil. |
|
584310941e70
(syms_of_eval): Initialize Vrun_hooks here.
Richard M. Stallman <rms@gnu.org>
parents:
16113
diff
changeset
|
96 It is nil at an early stage of startup, and when Emacs |
|
584310941e70
(syms_of_eval): Initialize Vrun_hooks here.
Richard M. Stallman <rms@gnu.org>
parents:
16113
diff
changeset
|
97 is shutting down. */ |
| 272 | 98 Lisp_Object Vrun_hooks; |
| 99 | |
| 100 /* Non-nil means record all fset's and provide's, to be undone | |
| 101 if the file being autoloaded is not fully loaded. | |
| 102 They are recorded by being consed onto the front of Vautoload_queue: | |
| 103 (FUN . ODEF) for a defun, (OFEATURES . nil) for a provide. */ | |
| 104 | |
| 105 Lisp_Object Vautoload_queue; | |
| 106 | |
| 107 /* Current number of specbindings allocated in specpdl. */ | |
| 108 int specpdl_size; | |
| 109 | |
| 110 /* Pointer to beginning of specpdl. */ | |
| 111 struct specbinding *specpdl; | |
| 112 | |
| 113 /* Pointer to first unused element in specpdl. */ | |
| 114 struct specbinding *specpdl_ptr; | |
| 115 | |
| 116 /* Maximum size allowed for specpdl allocation */ | |
| 117 int max_specpdl_size; | |
| 118 | |
| 119 /* Depth in Lisp evaluations and function calls. */ | |
| 120 int lisp_eval_depth; | |
| 121 | |
| 122 /* Maximum allowed depth in Lisp evaluations and function calls. */ | |
| 123 int max_lisp_eval_depth; | |
| 124 | |
| 125 /* Nonzero means enter debugger before next function call */ | |
| 126 int debug_on_next_call; | |
| 127 | |
|
26947
7987a6499aaa
(debugger_may_continue): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
26764
diff
changeset
|
128 /* Non-zero means debuffer may continue. This is zero when the |
|
7987a6499aaa
(debugger_may_continue): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
26764
diff
changeset
|
129 debugger is called during redisplay, where it might not be safe to |
|
7987a6499aaa
(debugger_may_continue): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
26764
diff
changeset
|
130 continue the interrupted redisplay. */ |
|
7987a6499aaa
(debugger_may_continue): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
26764
diff
changeset
|
131 |
|
7987a6499aaa
(debugger_may_continue): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
26764
diff
changeset
|
132 int debugger_may_continue; |
|
7987a6499aaa
(debugger_may_continue): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
26764
diff
changeset
|
133 |
| 684 | 134 /* List of conditions (non-nil atom means all) which cause a backtrace |
|
706
86cb5db0b6c3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
687
diff
changeset
|
135 if an error is handled by the command loop's error handler. */ |
| 684 | 136 Lisp_Object Vstack_trace_on_error; |
| 272 | 137 |
| 684 | 138 /* List of conditions (non-nil atom means all) which enter the debugger |
|
706
86cb5db0b6c3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
687
diff
changeset
|
139 if an error is handled by the command loop's error handler. */ |
| 684 | 140 Lisp_Object Vdebug_on_error; |
| 272 | 141 |
| 13768 | 142 /* List of conditions and regexps specifying error messages which |
| 143 do not enter the debugger even if Vdebug_on_errors says they should. */ | |
| 144 Lisp_Object Vdebug_ignored_errors; | |
| 145 | |
|
16355
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
146 /* Non-nil means call the debugger even if the error will be handled. */ |
|
16443
0128b923d281
(Vdebug_on_signal): Renamed from Vdebug_force.
Richard M. Stallman <rms@gnu.org>
parents:
16355
diff
changeset
|
147 Lisp_Object Vdebug_on_signal; |
|
16355
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
148 |
|
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
149 /* Hook for edebug to use. */ |
|
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
150 Lisp_Object Vsignal_hook_function; |
|
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
151 |
| 272 | 152 /* Nonzero means enter debugger if a quit signal |
| 684 | 153 is handled by the command loop's error handler. */ |
| 272 | 154 int debug_on_quit; |
| 155 | |
|
17872
31b2c6763574
(num_nonmacro_input_events):
Richard M. Stallman <rms@gnu.org>
parents:
17275
diff
changeset
|
156 /* The value of num_nonmacro_input_events as of the last time we |
|
1196
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
157 started to enter the debugger. If we decide to enter the debugger |
|
17872
31b2c6763574
(num_nonmacro_input_events):
Richard M. Stallman <rms@gnu.org>
parents:
17275
diff
changeset
|
158 again when this is still equal to num_nonmacro_input_events, then we |
|
1196
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
159 know that the debugger itself has an error, and we should just |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
160 signal the error instead of entering an infinite loop of debugger |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
161 invocations. */ |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
162 int when_entered_debugger; |
| 272 | 163 |
| 164 Lisp_Object Vdebugger; | |
| 165 | |
| 166 void specbind (), record_unwind_protect (); | |
| 167 | |
|
13314
661060193eb8
(run_hook_with_args): Add forward declaration.
Richard M. Stallman <rms@gnu.org>
parents:
13103
diff
changeset
|
168 Lisp_Object run_hook_with_args (); |
|
661060193eb8
(run_hook_with_args): Add forward declaration.
Richard M. Stallman <rms@gnu.org>
parents:
13103
diff
changeset
|
169 |
| 272 | 170 Lisp_Object funcall_lambda (); |
| 171 extern Lisp_Object ml_apply (); /* Apply a mocklisp function to unevaluated argument list */ | |
| 172 | |
| 21514 | 173 void |
| 272 | 174 init_eval_once () |
| 175 { | |
| 176 specpdl_size = 50; | |
|
7885
bc6406a90796
(init_eval_once): Call xmalloc, not malloc.
Richard M. Stallman <rms@gnu.org>
parents:
7533
diff
changeset
|
177 specpdl = (struct specbinding *) xmalloc (specpdl_size * sizeof (struct specbinding)); |
|
14600
f32beac333a0
(init_eval_once): Initialize specpdl_ptr.
Karl Heuer <kwzh@gnu.org>
parents:
14218
diff
changeset
|
178 specpdl_ptr = specpdl; |
| 272 | 179 max_specpdl_size = 600; |
|
17061
bc9a4db95edb
(init_eval_once): Increase max_lisp_eval_depth to 300.
Karl Heuer <kwzh@gnu.org>
parents:
16930
diff
changeset
|
180 max_lisp_eval_depth = 300; |
|
8980
e641b60610a1
(init_eval_once): Init Vrun_hooks here.
Richard M. Stallman <rms@gnu.org>
parents:
8902
diff
changeset
|
181 |
|
e641b60610a1
(init_eval_once): Init Vrun_hooks here.
Richard M. Stallman <rms@gnu.org>
parents:
8902
diff
changeset
|
182 Vrun_hooks = Qnil; |
| 272 | 183 } |
| 184 | |
| 21514 | 185 void |
| 272 | 186 init_eval () |
| 187 { | |
| 188 specpdl_ptr = specpdl; | |
| 189 catchlist = 0; | |
| 190 handlerlist = 0; | |
| 191 backtrace_list = 0; | |
| 192 Vquit_flag = Qnil; | |
| 193 debug_on_next_call = 0; | |
| 194 lisp_eval_depth = 0; | |
|
26307
155d5adcdff4
(init_eval): Conditionalize declaration of gcpro_level.
Dave Love <fx@gnu.org>
parents:
26297
diff
changeset
|
195 #ifdef DEBUG_GCPRO |
|
26297
4d1e267efd41
[DEBUG_GCPRO] (gcpro_level): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
26088
diff
changeset
|
196 gcpro_level = 0; |
|
26307
155d5adcdff4
(init_eval): Conditionalize declaration of gcpro_level.
Dave Love <fx@gnu.org>
parents:
26297
diff
changeset
|
197 #endif |
|
17872
31b2c6763574
(num_nonmacro_input_events):
Richard M. Stallman <rms@gnu.org>
parents:
17275
diff
changeset
|
198 /* This is less than the initial value of num_nonmacro_input_events. */ |
|
7213
bb5db306a305
(init_eval): Initialize when_entered_debugger to -1.
Richard M. Stallman <rms@gnu.org>
parents:
6918
diff
changeset
|
199 when_entered_debugger = -1; |
| 272 | 200 } |
| 201 | |
| 202 Lisp_Object | |
| 203 call_debugger (arg) | |
| 204 Lisp_Object arg; | |
| 205 { | |
|
26764
9fd028e7872c
(call_debugger): When entering the debugger while redisplaying,
Gerd Moellmann <gerd@gnu.org>
parents:
26365
diff
changeset
|
206 int debug_while_redisplaying; |
|
26947
7987a6499aaa
(debugger_may_continue): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
26764
diff
changeset
|
207 int count = specpdl_ptr - specpdl; |
|
26764
9fd028e7872c
(call_debugger): When entering the debugger while redisplaying,
Gerd Moellmann <gerd@gnu.org>
parents:
26365
diff
changeset
|
208 Lisp_Object val; |
|
9fd028e7872c
(call_debugger): When entering the debugger while redisplaying,
Gerd Moellmann <gerd@gnu.org>
parents:
26365
diff
changeset
|
209 |
| 272 | 210 if (lisp_eval_depth + 20 > max_lisp_eval_depth) |
| 211 max_lisp_eval_depth = lisp_eval_depth + 20; | |
|
26764
9fd028e7872c
(call_debugger): When entering the debugger while redisplaying,
Gerd Moellmann <gerd@gnu.org>
parents:
26365
diff
changeset
|
212 |
| 272 | 213 if (specpdl_size + 40 > max_specpdl_size) |
| 214 max_specpdl_size = specpdl_size + 40; | |
|
26764
9fd028e7872c
(call_debugger): When entering the debugger while redisplaying,
Gerd Moellmann <gerd@gnu.org>
parents:
26365
diff
changeset
|
215 |
|
28383
55d5c0156349
(call_debugger): Cancel busy-cursor.
Gerd Moellmann <gerd@gnu.org>
parents:
28297
diff
changeset
|
216 #ifdef HAVE_X_WINDOWS |
|
55d5c0156349
(call_debugger): Cancel busy-cursor.
Gerd Moellmann <gerd@gnu.org>
parents:
28297
diff
changeset
|
217 if (display_busy_cursor_p) |
|
55d5c0156349
(call_debugger): Cancel busy-cursor.
Gerd Moellmann <gerd@gnu.org>
parents:
28297
diff
changeset
|
218 cancel_busy_cursor (); |
|
55d5c0156349
(call_debugger): Cancel busy-cursor.
Gerd Moellmann <gerd@gnu.org>
parents:
28297
diff
changeset
|
219 #endif |
|
55d5c0156349
(call_debugger): Cancel busy-cursor.
Gerd Moellmann <gerd@gnu.org>
parents:
28297
diff
changeset
|
220 |
| 272 | 221 debug_on_next_call = 0; |
|
17872
31b2c6763574
(num_nonmacro_input_events):
Richard M. Stallman <rms@gnu.org>
parents:
17275
diff
changeset
|
222 when_entered_debugger = num_nonmacro_input_events; |
|
26764
9fd028e7872c
(call_debugger): When entering the debugger while redisplaying,
Gerd Moellmann <gerd@gnu.org>
parents:
26365
diff
changeset
|
223 |
|
9fd028e7872c
(call_debugger): When entering the debugger while redisplaying,
Gerd Moellmann <gerd@gnu.org>
parents:
26365
diff
changeset
|
224 /* Resetting redisplaying_p to 0 makes sure that debug output is |
|
9fd028e7872c
(call_debugger): When entering the debugger while redisplaying,
Gerd Moellmann <gerd@gnu.org>
parents:
26365
diff
changeset
|
225 displayed if the debugger is invoked during redisplay. */ |
|
9fd028e7872c
(call_debugger): When entering the debugger while redisplaying,
Gerd Moellmann <gerd@gnu.org>
parents:
26365
diff
changeset
|
226 debug_while_redisplaying = redisplaying_p; |
|
9fd028e7872c
(call_debugger): When entering the debugger while redisplaying,
Gerd Moellmann <gerd@gnu.org>
parents:
26365
diff
changeset
|
227 redisplaying_p = 0; |
|
26947
7987a6499aaa
(debugger_may_continue): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
26764
diff
changeset
|
228 specbind (intern ("debugger-may-continue"), |
|
7987a6499aaa
(debugger_may_continue): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
26764
diff
changeset
|
229 debug_while_redisplaying ? Qnil : Qt); |
|
26764
9fd028e7872c
(call_debugger): When entering the debugger while redisplaying,
Gerd Moellmann <gerd@gnu.org>
parents:
26365
diff
changeset
|
230 |
|
9fd028e7872c
(call_debugger): When entering the debugger while redisplaying,
Gerd Moellmann <gerd@gnu.org>
parents:
26365
diff
changeset
|
231 val = apply1 (Vdebugger, arg); |
|
9fd028e7872c
(call_debugger): When entering the debugger while redisplaying,
Gerd Moellmann <gerd@gnu.org>
parents:
26365
diff
changeset
|
232 |
|
9fd028e7872c
(call_debugger): When entering the debugger while redisplaying,
Gerd Moellmann <gerd@gnu.org>
parents:
26365
diff
changeset
|
233 /* Interrupting redisplay and resuming it later is not safe under |
|
9fd028e7872c
(call_debugger): When entering the debugger while redisplaying,
Gerd Moellmann <gerd@gnu.org>
parents:
26365
diff
changeset
|
234 all circumstances. So, when the debugger returns, abort the |
|
9fd028e7872c
(call_debugger): When entering the debugger while redisplaying,
Gerd Moellmann <gerd@gnu.org>
parents:
26365
diff
changeset
|
235 interupted redisplay by going back to the top-level. */ |
|
9fd028e7872c
(call_debugger): When entering the debugger while redisplaying,
Gerd Moellmann <gerd@gnu.org>
parents:
26365
diff
changeset
|
236 if (debug_while_redisplaying) |
|
9fd028e7872c
(call_debugger): When entering the debugger while redisplaying,
Gerd Moellmann <gerd@gnu.org>
parents:
26365
diff
changeset
|
237 Ftop_level (); |
|
9fd028e7872c
(call_debugger): When entering the debugger while redisplaying,
Gerd Moellmann <gerd@gnu.org>
parents:
26365
diff
changeset
|
238 |
|
26947
7987a6499aaa
(debugger_may_continue): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
26764
diff
changeset
|
239 return unbind_to (count, val); |
| 272 | 240 } |
| 241 | |
| 21514 | 242 void |
| 272 | 243 do_debug_on_call (code) |
| 244 Lisp_Object code; | |
| 245 { | |
| 246 debug_on_next_call = 0; | |
| 247 backtrace_list->debug_on_exit = 1; | |
| 248 call_debugger (Fcons (code, Qnil)); | |
| 249 } | |
| 250 | |
| 251 /* NOTE!!! Every function that can call EVAL must protect its args | |
| 252 and temporaries from garbage collection while it needs them. | |
| 253 The definition of `For' shows what you have to do. */ | |
| 254 | |
| 255 DEFUN ("or", For, Sor, 0, UNEVALLED, 0, | |
| 256 "Eval args until one of them yields non-nil, then return that value.\n\ | |
| 257 The remaining args are not evalled at all.\n\ | |
| 258 If all args return nil, return nil.") | |
| 259 (args) | |
| 260 Lisp_Object args; | |
| 261 { | |
| 262 register Lisp_Object val; | |
| 263 Lisp_Object args_left; | |
| 264 struct gcpro gcpro1; | |
| 265 | |
| 485 | 266 if (NILP(args)) |
| 272 | 267 return Qnil; |
| 268 | |
| 269 args_left = args; | |
| 270 GCPRO1 (args_left); | |
| 271 | |
| 272 do | |
| 273 { | |
| 274 val = Feval (Fcar (args_left)); | |
| 485 | 275 if (!NILP (val)) |
| 272 | 276 break; |
| 277 args_left = Fcdr (args_left); | |
| 278 } | |
| 485 | 279 while (!NILP(args_left)); |
| 272 | 280 |
| 281 UNGCPRO; | |
| 282 return val; | |
| 283 } | |
| 284 | |
| 285 DEFUN ("and", Fand, Sand, 0, UNEVALLED, 0, | |
| 286 "Eval args until one of them yields nil, then return nil.\n\ | |
| 287 The remaining args are not evalled at all.\n\ | |
| 288 If no arg yields nil, return the last arg's value.") | |
| 289 (args) | |
| 290 Lisp_Object args; | |
| 291 { | |
| 292 register Lisp_Object val; | |
| 293 Lisp_Object args_left; | |
| 294 struct gcpro gcpro1; | |
| 295 | |
| 485 | 296 if (NILP(args)) |
| 272 | 297 return Qt; |
| 298 | |
| 299 args_left = args; | |
| 300 GCPRO1 (args_left); | |
| 301 | |
| 302 do | |
| 303 { | |
| 304 val = Feval (Fcar (args_left)); | |
| 485 | 305 if (NILP (val)) |
| 272 | 306 break; |
| 307 args_left = Fcdr (args_left); | |
| 308 } | |
| 485 | 309 while (!NILP(args_left)); |
| 272 | 310 |
| 311 UNGCPRO; | |
| 312 return val; | |
| 313 } | |
| 314 | |
| 315 DEFUN ("if", Fif, Sif, 2, UNEVALLED, 0, | |
|
27554
229352fdbf68
Fix various doc strings not to duplicate information from
Dave Love <fx@gnu.org>
parents:
27295
diff
changeset
|
316 "If COND yields non-nil, do THEN, else do ELSE...\n\ |
| 272 | 317 Returns the value of THEN or the value of the last of the ELSE's.\n\ |
| 318 THEN must be one expression, but ELSE... can be zero or more expressions.\n\ | |
| 319 If COND yields nil, and there are no ELSE's, the value is nil.") | |
| 320 (args) | |
| 321 Lisp_Object args; | |
| 322 { | |
| 323 register Lisp_Object cond; | |
| 324 struct gcpro gcpro1; | |
| 325 | |
| 326 GCPRO1 (args); | |
| 327 cond = Feval (Fcar (args)); | |
| 328 UNGCPRO; | |
| 329 | |
| 485 | 330 if (!NILP (cond)) |
| 272 | 331 return Feval (Fcar (Fcdr (args))); |
| 332 return Fprogn (Fcdr (Fcdr (args))); | |
| 333 } | |
| 334 | |
| 335 DEFUN ("cond", Fcond, Scond, 0, UNEVALLED, 0, | |
|
27554
229352fdbf68
Fix various doc strings not to duplicate information from
Dave Love <fx@gnu.org>
parents:
27295
diff
changeset
|
336 "Try each clause until one succeeds.\n\ |
| 272 | 337 Each clause looks like (CONDITION BODY...). CONDITION is evaluated\n\ |
| 338 and, if the value is non-nil, this clause succeeds:\n\ | |
| 339 then the expressions in BODY are evaluated and the last one's\n\ | |
| 340 value is the value of the cond-form.\n\ | |
| 341 If no clause succeeds, cond returns nil.\n\ | |
| 342 If a clause has one element, as in (CONDITION),\n\ | |
| 343 CONDITION's value if non-nil is returned from the cond-form.") | |
| 344 (args) | |
| 345 Lisp_Object args; | |
| 346 { | |
| 347 register Lisp_Object clause, val; | |
| 348 struct gcpro gcpro1; | |
| 349 | |
| 350 val = Qnil; | |
| 351 GCPRO1 (args); | |
| 485 | 352 while (!NILP (args)) |
| 272 | 353 { |
| 354 clause = Fcar (args); | |
| 355 val = Feval (Fcar (clause)); | |
| 485 | 356 if (!NILP (val)) |
| 272 | 357 { |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
358 if (!EQ (XCDR (clause), Qnil)) |
|
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
359 val = Fprogn (XCDR (clause)); |
| 272 | 360 break; |
| 361 } | |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
362 args = XCDR (args); |
| 272 | 363 } |
| 364 UNGCPRO; | |
| 365 | |
| 366 return val; | |
| 367 } | |
| 368 | |
| 369 DEFUN ("progn", Fprogn, Sprogn, 0, UNEVALLED, 0, | |
|
27554
229352fdbf68
Fix various doc strings not to duplicate information from
Dave Love <fx@gnu.org>
parents:
27295
diff
changeset
|
370 "Eval BODY forms sequentially and return value of last one.") |
| 272 | 371 (args) |
| 372 Lisp_Object args; | |
| 373 { | |
| 374 register Lisp_Object val, tem; | |
| 375 Lisp_Object args_left; | |
| 376 struct gcpro gcpro1; | |
| 377 | |
| 378 /* In Mocklisp code, symbols at the front of the progn arglist | |
| 379 are to be bound to zero. */ | |
| 380 if (!EQ (Vmocklisp_arguments, Qt)) | |
| 381 { | |
| 382 val = make_number (0); | |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
383 while (!NILP (args) && (tem = Fcar (args), SYMBOLP (tem))) |
| 272 | 384 { |
| 385 QUIT; | |
| 386 specbind (tem, val), args = Fcdr (args); | |
| 387 } | |
| 388 } | |
| 389 | |
| 485 | 390 if (NILP(args)) |
| 272 | 391 return Qnil; |
| 392 | |
| 393 args_left = args; | |
| 394 GCPRO1 (args_left); | |
| 395 | |
| 396 do | |
| 397 { | |
| 398 val = Feval (Fcar (args_left)); | |
| 399 args_left = Fcdr (args_left); | |
| 400 } | |
| 485 | 401 while (!NILP(args_left)); |
| 272 | 402 |
| 403 UNGCPRO; | |
| 404 return val; | |
| 405 } | |
| 406 | |
| 407 DEFUN ("prog1", Fprog1, Sprog1, 1, UNEVALLED, 0, | |
|
27554
229352fdbf68
Fix various doc strings not to duplicate information from
Dave Love <fx@gnu.org>
parents:
27295
diff
changeset
|
408 "Eval FIRST and BODY sequentially; value from FIRST.\n\ |
| 272 | 409 The value of FIRST is saved during the evaluation of the remaining args,\n\ |
| 410 whose values are discarded.") | |
| 411 (args) | |
| 412 Lisp_Object args; | |
| 413 { | |
| 414 Lisp_Object val; | |
| 415 register Lisp_Object args_left; | |
| 416 struct gcpro gcpro1, gcpro2; | |
| 417 register int argnum = 0; | |
| 418 | |
| 485 | 419 if (NILP(args)) |
| 272 | 420 return Qnil; |
| 421 | |
| 422 args_left = args; | |
| 423 val = Qnil; | |
| 424 GCPRO2 (args, val); | |
| 425 | |
| 426 do | |
| 427 { | |
| 428 if (!(argnum++)) | |
| 429 val = Feval (Fcar (args_left)); | |
| 430 else | |
| 431 Feval (Fcar (args_left)); | |
| 432 args_left = Fcdr (args_left); | |
| 433 } | |
| 485 | 434 while (!NILP(args_left)); |
| 272 | 435 |
| 436 UNGCPRO; | |
| 437 return val; | |
| 438 } | |
| 439 | |
| 440 DEFUN ("prog2", Fprog2, Sprog2, 2, UNEVALLED, 0, | |
|
27554
229352fdbf68
Fix various doc strings not to duplicate information from
Dave Love <fx@gnu.org>
parents:
27295
diff
changeset
|
441 "Eval X, Y and BODY sequentially; value from Y.\n\ |
| 272 | 442 The value of Y is saved during the evaluation of the remaining args,\n\ |
| 443 whose values are discarded.") | |
| 444 (args) | |
| 445 Lisp_Object args; | |
| 446 { | |
| 447 Lisp_Object val; | |
| 448 register Lisp_Object args_left; | |
| 449 struct gcpro gcpro1, gcpro2; | |
| 450 register int argnum = -1; | |
| 451 | |
| 452 val = Qnil; | |
| 453 | |
| 6803 | 454 if (NILP (args)) |
| 272 | 455 return Qnil; |
| 456 | |
| 457 args_left = args; | |
| 458 val = Qnil; | |
| 459 GCPRO2 (args, val); | |
| 460 | |
| 461 do | |
| 462 { | |
| 463 if (!(argnum++)) | |
| 464 val = Feval (Fcar (args_left)); | |
| 465 else | |
| 466 Feval (Fcar (args_left)); | |
| 467 args_left = Fcdr (args_left); | |
| 468 } | |
| 6803 | 469 while (!NILP (args_left)); |
| 272 | 470 |
| 471 UNGCPRO; | |
| 472 return val; | |
| 473 } | |
| 474 | |
| 475 DEFUN ("setq", Fsetq, Ssetq, 0, UNEVALLED, 0, | |
|
27554
229352fdbf68
Fix various doc strings not to duplicate information from
Dave Love <fx@gnu.org>
parents:
27295
diff
changeset
|
476 "Set each SYM to the value of its VAL.\n\ |
| 6918 | 477 The symbols SYM are variables; they are literal (not evaluated).\n\ |
| 478 The values VAL are expressions; they are evaluated.\n\ | |
| 479 Thus, (setq x (1+ y)) sets `x' to the value of `(1+ y)'.\n\ | |
| 480 The second VAL is not computed until after the first SYM is set, and so on;\n\ | |
| 481 each VAL can use the new value of variables set earlier in the `setq'.\n\ | |
| 6713 | 482 The return value of the `setq' form is the value of the last VAL.") |
| 272 | 483 (args) |
| 484 Lisp_Object args; | |
| 485 { | |
| 486 register Lisp_Object args_left; | |
| 487 register Lisp_Object val, sym; | |
| 488 struct gcpro gcpro1; | |
| 489 | |
| 485 | 490 if (NILP(args)) |
| 272 | 491 return Qnil; |
| 492 | |
| 493 args_left = args; | |
| 494 GCPRO1 (args); | |
| 495 | |
| 496 do | |
| 497 { | |
| 498 val = Feval (Fcar (Fcdr (args_left))); | |
| 499 sym = Fcar (args_left); | |
| 500 Fset (sym, val); | |
| 501 args_left = Fcdr (Fcdr (args_left)); | |
| 502 } | |
| 485 | 503 while (!NILP(args_left)); |
| 272 | 504 |
| 505 UNGCPRO; | |
| 506 return val; | |
| 507 } | |
| 508 | |
| 509 DEFUN ("quote", Fquote, Squote, 1, UNEVALLED, 0, | |
| 510 "Return the argument, without evaluating it. `(quote x)' yields `x'.") | |
| 511 (args) | |
| 512 Lisp_Object args; | |
| 513 { | |
| 514 return Fcar (args); | |
| 515 } | |
| 516 | |
| 517 DEFUN ("function", Ffunction, Sfunction, 1, UNEVALLED, 0, | |
| 518 "Like `quote', but preferred for objects which are functions.\n\ | |
| 519 In byte compilation, `function' causes its argument to be compiled.\n\ | |
| 520 `quote' cannot do that.") | |
| 521 (args) | |
| 522 Lisp_Object args; | |
| 523 { | |
| 524 return Fcar (args); | |
| 525 } | |
| 526 | |
| 527 DEFUN ("interactive-p", Finteractive_p, Sinteractive_p, 0, 0, 0, | |
| 528 "Return t if function in which this appears was called interactively.\n\ | |
| 529 This means that the function was called with call-interactively (which\n\ | |
| 530 includes being called as the binding of a key)\n\ | |
| 531 and input is currently coming from the keyboard (not in keyboard macro).") | |
| 532 () | |
| 533 { | |
| 534 register struct backtrace *btp; | |
| 535 register Lisp_Object fun; | |
| 536 | |
| 537 if (!INTERACTIVE) | |
| 538 return Qnil; | |
| 539 | |
| 540 btp = backtrace_list; | |
| 727 | 541 |
| 542 /* If this isn't a byte-compiled function, there may be a frame at | |
| 543 the top for Finteractive_p itself. If so, skip it. */ | |
| 544 fun = Findirect_function (*btp->function); | |
|
9959
c942c7e6ebbd
(Finteractive_p): Use XSUBR instead of its expansion.
Karl Heuer <kwzh@gnu.org>
parents:
9306
diff
changeset
|
545 if (SUBRP (fun) && XSUBR (fun) == &Sinteractive_p) |
| 323 | 546 btp = btp->next; |
| 547 | |
| 727 | 548 /* If we're running an Emacs 18-style byte-compiled function, there |
| 549 may be a frame for Fbytecode. Now, given the strictest | |
| 550 definition, this function isn't really being called | |
| 551 interactively, but because that's the way Emacs 18 always builds | |
| 552 byte-compiled functions, we'll accept it for now. */ | |
| 553 if (EQ (*btp->function, Qbytecode)) | |
| 554 btp = btp->next; | |
| 555 | |
| 556 /* If this isn't a byte-compiled function, then we may now be | |
| 557 looking at several frames for special forms. Skip past them. */ | |
| 558 while (btp && | |
| 559 btp->nargs == UNEVALLED) | |
| 560 btp = btp->next; | |
| 561 | |
| 562 /* btp now points at the frame of the innermost function that isn't | |
| 563 a special form, ignoring frames for Finteractive_p and/or | |
| 564 Fbytecode at the top. If this frame is for a built-in function | |
| 565 (such as load or eval-region) return nil. */ | |
| 648 | 566 fun = Findirect_function (*btp->function); |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
567 if (SUBRP (fun)) |
| 272 | 568 return Qnil; |
| 569 /* btp points to the frame of a Lisp function that called interactive-p. | |
| 570 Return t if that function was called interactively. */ | |
| 571 if (btp && btp->next && EQ (*btp->next->function, Qcall_interactively)) | |
| 572 return Qt; | |
| 573 return Qnil; | |
| 574 } | |
| 575 | |
| 576 DEFUN ("defun", Fdefun, Sdefun, 2, UNEVALLED, 0, | |
|
27554
229352fdbf68
Fix various doc strings not to duplicate information from
Dave Love <fx@gnu.org>
parents:
27295
diff
changeset
|
577 "Define NAME as a function.\n\ |
| 272 | 578 The definition is (lambda ARGLIST [DOCSTRING] BODY...).\n\ |
| 579 See also the function `interactive'.") | |
| 580 (args) | |
| 581 Lisp_Object args; | |
| 582 { | |
| 583 register Lisp_Object fn_name; | |
| 584 register Lisp_Object defn; | |
| 585 | |
| 586 fn_name = Fcar (args); | |
| 587 defn = Fcons (Qlambda, Fcdr (args)); | |
| 485 | 588 if (!NILP (Vpurify_flag)) |
| 272 | 589 defn = Fpurecopy (defn); |
| 590 Ffset (fn_name, defn); | |
|
2547
c73c68a87cd5
(defun, defmacro, defvar, defconst):
Richard M. Stallman <rms@gnu.org>
parents:
2439
diff
changeset
|
591 LOADHIST_ATTACH (fn_name); |
| 272 | 592 return fn_name; |
| 593 } | |
| 594 | |
| 595 DEFUN ("defmacro", Fdefmacro, Sdefmacro, 2, UNEVALLED, 0, | |
|
27554
229352fdbf68
Fix various doc strings not to duplicate information from
Dave Love <fx@gnu.org>
parents:
27295
diff
changeset
|
596 "Define NAME as a macro.\n\ |
| 272 | 597 The definition is (macro lambda ARGLIST [DOCSTRING] BODY...).\n\ |
| 598 When the macro is called, as in (NAME ARGS...),\n\ | |
| 599 the function (lambda ARGLIST BODY...) is applied to\n\ | |
| 600 the list ARGS... as it appears in the expression,\n\ | |
| 601 and the result should be a form to be evaluated instead of the original.") | |
| 602 (args) | |
| 603 Lisp_Object args; | |
| 604 { | |
| 605 register Lisp_Object fn_name; | |
| 606 register Lisp_Object defn; | |
| 607 | |
| 608 fn_name = Fcar (args); | |
| 609 defn = Fcons (Qmacro, Fcons (Qlambda, Fcdr (args))); | |
| 485 | 610 if (!NILP (Vpurify_flag)) |
| 272 | 611 defn = Fpurecopy (defn); |
| 612 Ffset (fn_name, defn); | |
|
2547
c73c68a87cd5
(defun, defmacro, defvar, defconst):
Richard M. Stallman <rms@gnu.org>
parents:
2439
diff
changeset
|
613 LOADHIST_ATTACH (fn_name); |
| 272 | 614 return fn_name; |
| 615 } | |
| 616 | |
| 617 DEFUN ("defvar", Fdefvar, Sdefvar, 1, UNEVALLED, 0, | |
|
27554
229352fdbf68
Fix various doc strings not to duplicate information from
Dave Love <fx@gnu.org>
parents:
27295
diff
changeset
|
618 "Define SYMBOL as a variable.\n\ |
| 272 | 619 You are not required to define a variable in order to use it,\n\ |
| 620 but the definition can supply documentation and an initial value\n\ | |
| 621 in a way that tags can recognize.\n\n\ | |
| 622 INITVALUE is evaluated, and used to set SYMBOL, only if SYMBOL's value is void.\n\ | |
|
687
e2b747dd6a6e
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
684
diff
changeset
|
623 If SYMBOL is buffer-local, its default value is what is set;\n\ |
|
e2b747dd6a6e
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
684
diff
changeset
|
624 buffer-local values are not affected.\n\ |
| 272 | 625 INITVALUE and DOCSTRING are optional.\n\ |
| 626 If DOCSTRING starts with *, this variable is identified as a user option.\n\ | |
| 627 This means that M-x set-variable and M-x edit-options recognize it.\n\ | |
| 628 If INITVALUE is missing, SYMBOL's value is not set.") | |
| 629 (args) | |
| 630 Lisp_Object args; | |
| 631 { | |
|
10161
512a84fb3c75
(Fdefconst, Fdefvar): Error if too many arguments.
Richard M. Stallman <rms@gnu.org>
parents:
9959
diff
changeset
|
632 register Lisp_Object sym, tem, tail; |
| 272 | 633 |
| 634 sym = Fcar (args); | |
|
10161
512a84fb3c75
(Fdefconst, Fdefvar): Error if too many arguments.
Richard M. Stallman <rms@gnu.org>
parents:
9959
diff
changeset
|
635 tail = Fcdr (args); |
|
512a84fb3c75
(Fdefconst, Fdefvar): Error if too many arguments.
Richard M. Stallman <rms@gnu.org>
parents:
9959
diff
changeset
|
636 if (!NILP (Fcdr (Fcdr (tail)))) |
|
512a84fb3c75
(Fdefconst, Fdefvar): Error if too many arguments.
Richard M. Stallman <rms@gnu.org>
parents:
9959
diff
changeset
|
637 error ("too many arguments"); |
|
512a84fb3c75
(Fdefconst, Fdefvar): Error if too many arguments.
Richard M. Stallman <rms@gnu.org>
parents:
9959
diff
changeset
|
638 |
|
512a84fb3c75
(Fdefconst, Fdefvar): Error if too many arguments.
Richard M. Stallman <rms@gnu.org>
parents:
9959
diff
changeset
|
639 if (!NILP (tail)) |
| 272 | 640 { |
| 641 tem = Fdefault_boundp (sym); | |
| 485 | 642 if (NILP (tem)) |
| 272 | 643 Fset_default (sym, Feval (Fcar (Fcdr (args)))); |
| 644 } | |
|
10161
512a84fb3c75
(Fdefconst, Fdefvar): Error if too many arguments.
Richard M. Stallman <rms@gnu.org>
parents:
9959
diff
changeset
|
645 tail = Fcdr (Fcdr (args)); |
|
512a84fb3c75
(Fdefconst, Fdefvar): Error if too many arguments.
Richard M. Stallman <rms@gnu.org>
parents:
9959
diff
changeset
|
646 if (!NILP (Fcar (tail))) |
| 272 | 647 { |
|
10201
03f3a1f4264a
(Fdefvar): Fix minor error in previous change.
Richard M. Stallman <rms@gnu.org>
parents:
10161
diff
changeset
|
648 tem = Fcar (tail); |
| 485 | 649 if (!NILP (Vpurify_flag)) |
| 272 | 650 tem = Fpurecopy (tem); |
| 651 Fput (sym, Qvariable_documentation, tem); | |
| 652 } | |
|
2547
c73c68a87cd5
(defun, defmacro, defvar, defconst):
Richard M. Stallman <rms@gnu.org>
parents:
2439
diff
changeset
|
653 LOADHIST_ATTACH (sym); |
| 272 | 654 return sym; |
| 655 } | |
| 656 | |
| 657 DEFUN ("defconst", Fdefconst, Sdefconst, 2, UNEVALLED, 0, | |
|
27554
229352fdbf68
Fix various doc strings not to duplicate information from
Dave Love <fx@gnu.org>
parents:
27295
diff
changeset
|
658 "Define SYMBOL as a constant variable.\n\ |
| 24427 | 659 The intent is that neither programs nor users should ever change this value.\n\ |
| 272 | 660 Always sets the value of SYMBOL to the result of evalling INITVALUE.\n\ |
|
687
e2b747dd6a6e
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
684
diff
changeset
|
661 If SYMBOL is buffer-local, its default value is what is set;\n\ |
|
e2b747dd6a6e
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
684
diff
changeset
|
662 buffer-local values are not affected.\n\ |
| 24391 | 663 DOCSTRING is optional.") |
| 272 | 664 (args) |
| 665 Lisp_Object args; | |
| 666 { | |
| 667 register Lisp_Object sym, tem; | |
| 668 | |
| 669 sym = Fcar (args); | |
|
10161
512a84fb3c75
(Fdefconst, Fdefvar): Error if too many arguments.
Richard M. Stallman <rms@gnu.org>
parents:
9959
diff
changeset
|
670 if (!NILP (Fcdr (Fcdr (Fcdr (args))))) |
|
512a84fb3c75
(Fdefconst, Fdefvar): Error if too many arguments.
Richard M. Stallman <rms@gnu.org>
parents:
9959
diff
changeset
|
671 error ("too many arguments"); |
|
512a84fb3c75
(Fdefconst, Fdefvar): Error if too many arguments.
Richard M. Stallman <rms@gnu.org>
parents:
9959
diff
changeset
|
672 |
|
27554
229352fdbf68
Fix various doc strings not to duplicate information from
Dave Love <fx@gnu.org>
parents:
27295
diff
changeset
|
673 tem = Feval (Fcar (Fcdr (args))); |
|
229352fdbf68
Fix various doc strings not to duplicate information from
Dave Love <fx@gnu.org>
parents:
27295
diff
changeset
|
674 if (!NILP (Vpurify_flag)) |
|
229352fdbf68
Fix various doc strings not to duplicate information from
Dave Love <fx@gnu.org>
parents:
27295
diff
changeset
|
675 tem = Fpurecopy (tem); |
|
229352fdbf68
Fix various doc strings not to duplicate information from
Dave Love <fx@gnu.org>
parents:
27295
diff
changeset
|
676 Fset_default (sym, tem); |
| 272 | 677 tem = Fcar (Fcdr (Fcdr (args))); |
| 485 | 678 if (!NILP (tem)) |
| 272 | 679 { |
| 485 | 680 if (!NILP (Vpurify_flag)) |
| 272 | 681 tem = Fpurecopy (tem); |
| 682 Fput (sym, Qvariable_documentation, tem); | |
| 683 } | |
|
2547
c73c68a87cd5
(defun, defmacro, defvar, defconst):
Richard M. Stallman <rms@gnu.org>
parents:
2439
diff
changeset
|
684 LOADHIST_ATTACH (sym); |
| 272 | 685 return sym; |
| 686 } | |
| 687 | |
| 688 DEFUN ("user-variable-p", Fuser_variable_p, Suser_variable_p, 1, 1, 0, | |
| 689 "Returns t if VARIABLE is intended to be set and modified by users.\n\ | |
| 690 \(The alternative is a variable used internally in a Lisp program.)\n\ | |
| 691 Determined by whether the first character of the documentation\n\ | |
|
27226
44dc06740e6c
(Fuser_variable_p): Check customizability too.
Dave Love <fx@gnu.org>
parents:
27031
diff
changeset
|
692 for the variable is `*' or if the variable is customizable (has a non-nil\n\ |
|
44dc06740e6c
(Fuser_variable_p): Check customizability too.
Dave Love <fx@gnu.org>
parents:
27031
diff
changeset
|
693 value of any of `custom-type', `custom-loads' or `standard-value'\n\ |
|
44dc06740e6c
(Fuser_variable_p): Check customizability too.
Dave Love <fx@gnu.org>
parents:
27031
diff
changeset
|
694 on its property list).") |
| 272 | 695 (variable) |
| 696 Lisp_Object variable; | |
| 697 { | |
| 698 Lisp_Object documentation; | |
| 699 | |
|
17275
03f89f7e614e
(Fuser_variable_p): If not a symbol, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
17061
diff
changeset
|
700 if (!SYMBOLP (variable)) |
|
03f89f7e614e
(Fuser_variable_p): If not a symbol, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
17061
diff
changeset
|
701 return Qnil; |
|
03f89f7e614e
(Fuser_variable_p): If not a symbol, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
17061
diff
changeset
|
702 |
| 272 | 703 documentation = Fget (variable, Qvariable_documentation); |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
704 if (INTEGERP (documentation) && XINT (documentation) < 0) |
| 272 | 705 return Qt; |
|
11251
f6bc91242185
(Fuser_variable_p): For (STRING . INTEGER), test sign.
Richard M. Stallman <rms@gnu.org>
parents:
11205
diff
changeset
|
706 if (STRINGP (documentation) |
|
f6bc91242185
(Fuser_variable_p): For (STRING . INTEGER), test sign.
Richard M. Stallman <rms@gnu.org>
parents:
11205
diff
changeset
|
707 && ((unsigned char) XSTRING (documentation)->data[0] == '*')) |
|
f6bc91242185
(Fuser_variable_p): For (STRING . INTEGER), test sign.
Richard M. Stallman <rms@gnu.org>
parents:
11205
diff
changeset
|
708 return Qt; |
|
f6bc91242185
(Fuser_variable_p): For (STRING . INTEGER), test sign.
Richard M. Stallman <rms@gnu.org>
parents:
11205
diff
changeset
|
709 /* If it is (STRING . INTEGER), a negative integer means a user variable. */ |
|
f6bc91242185
(Fuser_variable_p): For (STRING . INTEGER), test sign.
Richard M. Stallman <rms@gnu.org>
parents:
11205
diff
changeset
|
710 if (CONSP (documentation) |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
711 && STRINGP (XCAR (documentation)) |
|
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
712 && INTEGERP (XCDR (documentation)) |
|
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
713 && XINT (XCDR (documentation)) < 0) |
| 272 | 714 return Qt; |
|
27226
44dc06740e6c
(Fuser_variable_p): Check customizability too.
Dave Love <fx@gnu.org>
parents:
27031
diff
changeset
|
715 /* Customizable? */ |
|
44dc06740e6c
(Fuser_variable_p): Check customizability too.
Dave Love <fx@gnu.org>
parents:
27031
diff
changeset
|
716 if ((!NILP (Fget (variable, intern ("custom-type")))) |
|
44dc06740e6c
(Fuser_variable_p): Check customizability too.
Dave Love <fx@gnu.org>
parents:
27031
diff
changeset
|
717 || (!NILP (Fget (variable, intern ("custom-loads")))) |
|
44dc06740e6c
(Fuser_variable_p): Check customizability too.
Dave Love <fx@gnu.org>
parents:
27031
diff
changeset
|
718 || (!NILP (Fget (variable, intern ("standard-value"))))) |
|
44dc06740e6c
(Fuser_variable_p): Check customizability too.
Dave Love <fx@gnu.org>
parents:
27031
diff
changeset
|
719 return Qt; |
| 272 | 720 return Qnil; |
| 721 } | |
| 722 | |
| 723 DEFUN ("let*", FletX, SletX, 1, UNEVALLED, 0, | |
|
27554
229352fdbf68
Fix various doc strings not to duplicate information from
Dave Love <fx@gnu.org>
parents:
27295
diff
changeset
|
724 "Bind variables according to VARLIST then eval BODY.\n\ |
| 272 | 725 The value of the last form in BODY is returned.\n\ |
| 726 Each element of VARLIST is a symbol (which is bound to nil)\n\ | |
| 727 or a list (SYMBOL VALUEFORM) (which binds SYMBOL to the value of VALUEFORM).\n\ | |
| 728 Each VALUEFORM can refer to the symbols already bound by this VARLIST.") | |
| 729 (args) | |
| 730 Lisp_Object args; | |
| 731 { | |
| 732 Lisp_Object varlist, val, elt; | |
| 733 int count = specpdl_ptr - specpdl; | |
| 734 struct gcpro gcpro1, gcpro2, gcpro3; | |
| 735 | |
| 736 GCPRO3 (args, elt, varlist); | |
| 737 | |
| 738 varlist = Fcar (args); | |
| 485 | 739 while (!NILP (varlist)) |
| 272 | 740 { |
| 741 QUIT; | |
| 742 elt = Fcar (varlist); | |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
743 if (SYMBOLP (elt)) |
| 272 | 744 specbind (elt, Qnil); |
| 604 | 745 else if (! NILP (Fcdr (Fcdr (elt)))) |
| 746 Fsignal (Qerror, | |
| 747 Fcons (build_string ("`let' bindings can have only one value-form"), | |
| 748 elt)); | |
| 272 | 749 else |
| 750 { | |
| 751 val = Feval (Fcar (Fcdr (elt))); | |
| 752 specbind (Fcar (elt), val); | |
| 753 } | |
| 754 varlist = Fcdr (varlist); | |
| 755 } | |
| 756 UNGCPRO; | |
| 757 val = Fprogn (Fcdr (args)); | |
| 758 return unbind_to (count, val); | |
| 759 } | |
| 760 | |
| 761 DEFUN ("let", Flet, Slet, 1, UNEVALLED, 0, | |
|
27554
229352fdbf68
Fix various doc strings not to duplicate information from
Dave Love <fx@gnu.org>
parents:
27295
diff
changeset
|
762 "Bind variables according to VARLIST then eval BODY.\n\ |
| 272 | 763 The value of the last form in BODY is returned.\n\ |
| 764 Each element of VARLIST is a symbol (which is bound to nil)\n\ | |
| 765 or a list (SYMBOL VALUEFORM) (which binds SYMBOL to the value of VALUEFORM).\n\ | |
| 766 All the VALUEFORMs are evalled before any symbols are bound.") | |
| 767 (args) | |
| 768 Lisp_Object args; | |
| 769 { | |
| 770 Lisp_Object *temps, tem; | |
| 771 register Lisp_Object elt, varlist; | |
| 772 int count = specpdl_ptr - specpdl; | |
| 773 register int argnum; | |
| 774 struct gcpro gcpro1, gcpro2; | |
| 775 | |
| 776 varlist = Fcar (args); | |
| 777 | |
| 778 /* Make space to hold the values to give the bound variables */ | |
| 779 elt = Flength (varlist); | |
| 780 temps = (Lisp_Object *) alloca (XFASTINT (elt) * sizeof (Lisp_Object)); | |
| 781 | |
| 782 /* Compute the values and store them in `temps' */ | |
| 783 | |
| 784 GCPRO2 (args, *temps); | |
| 785 gcpro2.nvars = 0; | |
| 786 | |
| 485 | 787 for (argnum = 0; !NILP (varlist); varlist = Fcdr (varlist)) |
| 272 | 788 { |
| 789 QUIT; | |
| 790 elt = Fcar (varlist); | |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
791 if (SYMBOLP (elt)) |
| 272 | 792 temps [argnum++] = Qnil; |
| 604 | 793 else if (! NILP (Fcdr (Fcdr (elt)))) |
| 794 Fsignal (Qerror, | |
| 795 Fcons (build_string ("`let' bindings can have only one value-form"), | |
| 796 elt)); | |
| 272 | 797 else |
| 798 temps [argnum++] = Feval (Fcar (Fcdr (elt))); | |
| 799 gcpro2.nvars = argnum; | |
| 800 } | |
| 801 UNGCPRO; | |
| 802 | |
| 803 varlist = Fcar (args); | |
| 485 | 804 for (argnum = 0; !NILP (varlist); varlist = Fcdr (varlist)) |
| 272 | 805 { |
| 806 elt = Fcar (varlist); | |
| 807 tem = temps[argnum++]; | |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
808 if (SYMBOLP (elt)) |
| 272 | 809 specbind (elt, tem); |
| 810 else | |
| 811 specbind (Fcar (elt), tem); | |
| 812 } | |
| 813 | |
| 814 elt = Fprogn (Fcdr (args)); | |
| 815 return unbind_to (count, elt); | |
| 816 } | |
| 817 | |
| 818 DEFUN ("while", Fwhile, Swhile, 1, UNEVALLED, 0, | |
|
27554
229352fdbf68
Fix various doc strings not to duplicate information from
Dave Love <fx@gnu.org>
parents:
27295
diff
changeset
|
819 "If TEST yields non-nil, eval BODY... and repeat.\n\ |
| 272 | 820 The order of execution is thus TEST, BODY, TEST, BODY and so on\n\ |
| 821 until TEST returns nil.") | |
| 822 (args) | |
| 823 Lisp_Object args; | |
| 824 { | |
| 825 Lisp_Object test, body, tem; | |
| 826 struct gcpro gcpro1, gcpro2; | |
| 827 | |
| 828 GCPRO2 (test, body); | |
| 829 | |
| 830 test = Fcar (args); | |
| 831 body = Fcdr (args); | |
|
4167
f037b1f51320
(Fwhile): If mocklisp, test for nonzeroness.
Richard M. Stallman <rms@gnu.org>
parents:
3973
diff
changeset
|
832 while (tem = Feval (test), |
|
f037b1f51320
(Fwhile): If mocklisp, test for nonzeroness.
Richard M. Stallman <rms@gnu.org>
parents:
3973
diff
changeset
|
833 (!EQ (Vmocklisp_arguments, Qt) ? XINT (tem) : !NILP (tem))) |
| 272 | 834 { |
| 835 QUIT; | |
| 836 Fprogn (body); | |
| 837 } | |
| 838 | |
| 839 UNGCPRO; | |
| 840 return Qnil; | |
| 841 } | |
| 842 | |
| 843 DEFUN ("macroexpand", Fmacroexpand, Smacroexpand, 1, 2, 0, | |
| 844 "Return result of expanding macros at top level of FORM.\n\ | |
| 845 If FORM is not a macro call, it is returned unchanged.\n\ | |
| 846 Otherwise, the macro is expanded and the expansion is considered\n\ | |
| 847 in place of FORM. When a non-macro-call results, it is returned.\n\n\ | |
| 848 The second optional arg ENVIRONMENT species an environment of macro\n\ | |
| 849 definitions to shadow the loaded ones for use in file byte-compilation.") | |
|
14073
0df4b4f2a2a1
(Fmacroexpand, Fthrow, Fbacktrace_frame): Harmonize arguments with
Erik Naggum <erik@naggum.no>
parents:
13945
diff
changeset
|
850 (form, environment) |
|
16113
df832a303ce5
(Fmacroexpand): Don't declare `form' as register.
Richard M. Stallman <rms@gnu.org>
parents:
16108
diff
changeset
|
851 Lisp_Object form; |
|
14073
0df4b4f2a2a1
(Fmacroexpand, Fthrow, Fbacktrace_frame): Harmonize arguments with
Erik Naggum <erik@naggum.no>
parents:
13945
diff
changeset
|
852 Lisp_Object environment; |
| 272 | 853 { |
| 753 | 854 /* With cleanups from Hallvard Furuseth. */ |
| 272 | 855 register Lisp_Object expander, sym, def, tem; |
| 856 | |
| 857 while (1) | |
| 858 { | |
| 859 /* Come back here each time we expand a macro call, | |
| 860 in case it expands into another macro call. */ | |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
861 if (!CONSP (form)) |
| 272 | 862 break; |
| 753 | 863 /* Set SYM, give DEF and TEM right values in case SYM is not a symbol. */ |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
864 def = sym = XCAR (form); |
| 753 | 865 tem = Qnil; |
| 272 | 866 /* Trace symbols aliases to other symbols |
| 867 until we get a symbol that is not an alias. */ | |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
868 while (SYMBOLP (def)) |
| 272 | 869 { |
| 870 QUIT; | |
| 753 | 871 sym = def; |
|
14073
0df4b4f2a2a1
(Fmacroexpand, Fthrow, Fbacktrace_frame): Harmonize arguments with
Erik Naggum <erik@naggum.no>
parents:
13945
diff
changeset
|
872 tem = Fassq (sym, environment); |
| 485 | 873 if (NILP (tem)) |
| 272 | 874 { |
| 875 def = XSYMBOL (sym)->function; | |
| 753 | 876 if (!EQ (def, Qunbound)) |
| 877 continue; | |
| 272 | 878 } |
| 753 | 879 break; |
| 272 | 880 } |
|
14073
0df4b4f2a2a1
(Fmacroexpand, Fthrow, Fbacktrace_frame): Harmonize arguments with
Erik Naggum <erik@naggum.no>
parents:
13945
diff
changeset
|
881 /* Right now TEM is the result from SYM in ENVIRONMENT, |
| 272 | 882 and if TEM is nil then DEF is SYM's function definition. */ |
| 485 | 883 if (NILP (tem)) |
| 272 | 884 { |
|
14073
0df4b4f2a2a1
(Fmacroexpand, Fthrow, Fbacktrace_frame): Harmonize arguments with
Erik Naggum <erik@naggum.no>
parents:
13945
diff
changeset
|
885 /* SYM is not mentioned in ENVIRONMENT. |
| 272 | 886 Look at its function definition. */ |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
887 if (EQ (def, Qunbound) || !CONSP (def)) |
| 272 | 888 /* Not defined or definition not suitable */ |
| 889 break; | |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
890 if (EQ (XCAR (def), Qautoload)) |
| 272 | 891 { |
| 892 /* Autoloading function: will it be a macro when loaded? */ | |
|
1564
b327816041d1
* eval.c (Fautoload): Renamed fifth argument TYPE. Document the
Jim Blandy <jimb@redhat.com>
parents:
1452
diff
changeset
|
893 tem = Fnth (make_number (4), def); |
|
5254
b38b74fe1722
(Fmacroexpand): For an autoload definition,
Richard M. Stallman <rms@gnu.org>
parents:
4782
diff
changeset
|
894 if (EQ (tem, Qt) || EQ (tem, Qmacro)) |
|
1564
b327816041d1
* eval.c (Fautoload): Renamed fifth argument TYPE. Document the
Jim Blandy <jimb@redhat.com>
parents:
1452
diff
changeset
|
895 /* Yes, load it and try again. */ |
|
b327816041d1
* eval.c (Fautoload): Renamed fifth argument TYPE. Document the
Jim Blandy <jimb@redhat.com>
parents:
1452
diff
changeset
|
896 { |
|
16108
2c9c0c867e00
(Fmacroexpand): gcpro form while calling do_autoload.
Richard M. Stallman <rms@gnu.org>
parents:
15275
diff
changeset
|
897 struct gcpro gcpro1; |
|
2c9c0c867e00
(Fmacroexpand): gcpro form while calling do_autoload.
Richard M. Stallman <rms@gnu.org>
parents:
15275
diff
changeset
|
898 GCPRO1 (form); |
|
1564
b327816041d1
* eval.c (Fautoload): Renamed fifth argument TYPE. Document the
Jim Blandy <jimb@redhat.com>
parents:
1452
diff
changeset
|
899 do_autoload (def, sym); |
|
16108
2c9c0c867e00
(Fmacroexpand): gcpro form while calling do_autoload.
Richard M. Stallman <rms@gnu.org>
parents:
15275
diff
changeset
|
900 UNGCPRO; |
|
1564
b327816041d1
* eval.c (Fautoload): Renamed fifth argument TYPE. Document the
Jim Blandy <jimb@redhat.com>
parents:
1452
diff
changeset
|
901 continue; |
|
b327816041d1
* eval.c (Fautoload): Renamed fifth argument TYPE. Document the
Jim Blandy <jimb@redhat.com>
parents:
1452
diff
changeset
|
902 } |
|
b327816041d1
* eval.c (Fautoload): Renamed fifth argument TYPE. Document the
Jim Blandy <jimb@redhat.com>
parents:
1452
diff
changeset
|
903 else |
| 272 | 904 break; |
| 905 } | |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
906 else if (!EQ (XCAR (def), Qmacro)) |
| 272 | 907 break; |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
908 else expander = XCDR (def); |
| 272 | 909 } |
| 910 else | |
| 911 { | |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
912 expander = XCDR (tem); |
| 485 | 913 if (NILP (expander)) |
| 272 | 914 break; |
| 915 } | |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
916 form = apply1 (expander, XCDR (form)); |
| 272 | 917 } |
| 918 return form; | |
| 919 } | |
| 920 | |
| 921 DEFUN ("catch", Fcatch, Scatch, 1, UNEVALLED, 0, | |
|
27554
229352fdbf68
Fix various doc strings not to duplicate information from
Dave Love <fx@gnu.org>
parents:
27295
diff
changeset
|
922 "Eval BODY allowing nonlocal exits using `throw'.\n\ |
| 21589 | 923 TAG is evalled to get the tag to use; it must not be nil.\n\ |
| 924 \n\ | |
| 925 Then the BODY is executed.\n\ | |
| 272 | 926 Within BODY, (throw TAG) with same tag exits BODY and exits this `catch'.\n\ |
| 927 If no throw happens, `catch' returns the value of the last BODY form.\n\ | |
| 928 If a throw happens, it specifies the value to return from `catch'.") | |
| 929 (args) | |
| 930 Lisp_Object args; | |
| 931 { | |
| 932 register Lisp_Object tag; | |
| 933 struct gcpro gcpro1; | |
| 934 | |
| 935 GCPRO1 (args); | |
| 936 tag = Feval (Fcar (args)); | |
| 937 UNGCPRO; | |
| 938 return internal_catch (tag, Fprogn, Fcdr (args)); | |
| 939 } | |
| 940 | |
| 941 /* Set up a catch, then call C function FUNC on argument ARG. | |
| 942 FUNC should return a Lisp_Object. | |
| 943 This is how catches are done from within C code. */ | |
| 944 | |
| 945 Lisp_Object | |
| 946 internal_catch (tag, func, arg) | |
| 947 Lisp_Object tag; | |
| 948 Lisp_Object (*func) (); | |
| 949 Lisp_Object arg; | |
| 950 { | |
| 951 /* This structure is made part of the chain `catchlist'. */ | |
| 952 struct catchtag c; | |
| 953 | |
| 954 /* Fill in the components of c, and put it on the list. */ | |
| 955 c.next = catchlist; | |
| 956 c.tag = tag; | |
| 957 c.val = Qnil; | |
| 958 c.backlist = backtrace_list; | |
| 959 c.handlerlist = handlerlist; | |
| 960 c.lisp_eval_depth = lisp_eval_depth; | |
| 961 c.pdlcount = specpdl_ptr - specpdl; | |
| 962 c.poll_suppress_count = poll_suppress_count; | |
| 963 c.gcpro = gcprolist; | |
|
26365
6527989cb214
(struct catchtag): Add member byte_stack.
Gerd Moellmann <gerd@gnu.org>
parents:
26307
diff
changeset
|
964 c.byte_stack = byte_stack_list; |
| 272 | 965 catchlist = &c; |
| 966 | |
| 967 /* Call FUNC. */ | |
| 968 if (! _setjmp (c.jmp)) | |
| 969 c.val = (*func) (arg); | |
| 970 | |
| 971 /* Throw works by a longjmp that comes right here. */ | |
| 972 catchlist = c.next; | |
| 973 return c.val; | |
| 974 } | |
| 975 | |
|
1199
ab2d88e2505b
* eval.c (unbind_catch): Do the long-jump here. Take a VALUE
Jim Blandy <jimb@redhat.com>
parents:
1196
diff
changeset
|
976 /* Unwind the specbind, catch, and handler stacks back to CATCH, and |
|
ab2d88e2505b
* eval.c (unbind_catch): Do the long-jump here. Take a VALUE
Jim Blandy <jimb@redhat.com>
parents:
1196
diff
changeset
|
977 jump to that CATCH, returning VALUE as the value of that catch. |
|
ab2d88e2505b
* eval.c (unbind_catch): Do the long-jump here. Take a VALUE
Jim Blandy <jimb@redhat.com>
parents:
1196
diff
changeset
|
978 |
|
ab2d88e2505b
* eval.c (unbind_catch): Do the long-jump here. Take a VALUE
Jim Blandy <jimb@redhat.com>
parents:
1196
diff
changeset
|
979 This is the guts Fthrow and Fsignal; they differ only in the way |
|
ab2d88e2505b
* eval.c (unbind_catch): Do the long-jump here. Take a VALUE
Jim Blandy <jimb@redhat.com>
parents:
1196
diff
changeset
|
980 they choose the catch tag to throw to. A catch tag for a |
|
ab2d88e2505b
* eval.c (unbind_catch): Do the long-jump here. Take a VALUE
Jim Blandy <jimb@redhat.com>
parents:
1196
diff
changeset
|
981 condition-case form has a TAG of Qnil. |
| 272 | 982 |
|
1199
ab2d88e2505b
* eval.c (unbind_catch): Do the long-jump here. Take a VALUE
Jim Blandy <jimb@redhat.com>
parents:
1196
diff
changeset
|
983 Before each catch is discarded, unbind all special bindings and |
|
ab2d88e2505b
* eval.c (unbind_catch): Do the long-jump here. Take a VALUE
Jim Blandy <jimb@redhat.com>
parents:
1196
diff
changeset
|
984 execute all unwind-protect clauses made above that catch. Unwind |
|
ab2d88e2505b
* eval.c (unbind_catch): Do the long-jump here. Take a VALUE
Jim Blandy <jimb@redhat.com>
parents:
1196
diff
changeset
|
985 the handler stack as we go, so that the proper handlers are in |
|
ab2d88e2505b
* eval.c (unbind_catch): Do the long-jump here. Take a VALUE
Jim Blandy <jimb@redhat.com>
parents:
1196
diff
changeset
|
986 effect for each unwind-protect clause we run. At the end, restore |
|
ab2d88e2505b
* eval.c (unbind_catch): Do the long-jump here. Take a VALUE
Jim Blandy <jimb@redhat.com>
parents:
1196
diff
changeset
|
987 some static info saved in CATCH, and longjmp to the location |
|
ab2d88e2505b
* eval.c (unbind_catch): Do the long-jump here. Take a VALUE
Jim Blandy <jimb@redhat.com>
parents:
1196
diff
changeset
|
988 specified in the |
| 272 | 989 |
|
1199
ab2d88e2505b
* eval.c (unbind_catch): Do the long-jump here. Take a VALUE
Jim Blandy <jimb@redhat.com>
parents:
1196
diff
changeset
|
990 This is used for correct unwinding in Fthrow and Fsignal. */ |
| 272 | 991 |
| 992 static void | |
|
1199
ab2d88e2505b
* eval.c (unbind_catch): Do the long-jump here. Take a VALUE
Jim Blandy <jimb@redhat.com>
parents:
1196
diff
changeset
|
993 unwind_to_catch (catch, value) |
| 272 | 994 struct catchtag *catch; |
|
1199
ab2d88e2505b
* eval.c (unbind_catch): Do the long-jump here. Take a VALUE
Jim Blandy <jimb@redhat.com>
parents:
1196
diff
changeset
|
995 Lisp_Object value; |
| 272 | 996 { |
| 997 register int last_time; | |
| 998 | |
|
1199
ab2d88e2505b
* eval.c (unbind_catch): Do the long-jump here. Take a VALUE
Jim Blandy <jimb@redhat.com>
parents:
1196
diff
changeset
|
999 /* Save the value in the tag. */ |
|
ab2d88e2505b
* eval.c (unbind_catch): Do the long-jump here. Take a VALUE
Jim Blandy <jimb@redhat.com>
parents:
1196
diff
changeset
|
1000 catch->val = value; |
|
ab2d88e2505b
* eval.c (unbind_catch): Do the long-jump here. Take a VALUE
Jim Blandy <jimb@redhat.com>
parents:
1196
diff
changeset
|
1001 |
|
1196
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1002 /* Restore the polling-suppression count. */ |
|
4474
23d5b09bd218
(unwind_to_catch): Call set_poll_suppress_count.
Richard M. Stallman <rms@gnu.org>
parents:
4462
diff
changeset
|
1003 set_poll_suppress_count (catch->poll_suppress_count); |
|
1196
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1004 |
| 272 | 1005 do |
| 1006 { | |
| 1007 last_time = catchlist == catch; | |
|
1196
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1008 |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1009 /* Unwind the specpdl stack, and then restore the proper set of |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1010 handlers. */ |
| 272 | 1011 unbind_to (catchlist->pdlcount, Qnil); |
| 1012 handlerlist = catchlist->handlerlist; | |
| 1013 catchlist = catchlist->next; | |
| 1014 } | |
| 1015 while (! last_time); | |
| 1016 | |
|
26365
6527989cb214
(struct catchtag): Add member byte_stack.
Gerd Moellmann <gerd@gnu.org>
parents:
26307
diff
changeset
|
1017 byte_stack_list = catch->byte_stack; |
| 272 | 1018 gcprolist = catch->gcpro; |
|
26297
4d1e267efd41
[DEBUG_GCPRO] (gcpro_level): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
26088
diff
changeset
|
1019 #ifdef DEBUG_GCPRO |
|
4d1e267efd41
[DEBUG_GCPRO] (gcpro_level): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
26088
diff
changeset
|
1020 if (gcprolist != 0) |
|
4d1e267efd41
[DEBUG_GCPRO] (gcpro_level): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
26088
diff
changeset
|
1021 gcpro_level = gcprolist->level + 1; |
|
4d1e267efd41
[DEBUG_GCPRO] (gcpro_level): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
26088
diff
changeset
|
1022 else |
|
4d1e267efd41
[DEBUG_GCPRO] (gcpro_level): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
26088
diff
changeset
|
1023 gcpro_level = 0; |
|
4d1e267efd41
[DEBUG_GCPRO] (gcpro_level): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
26088
diff
changeset
|
1024 #endif |
| 272 | 1025 backtrace_list = catch->backlist; |
| 1026 lisp_eval_depth = catch->lisp_eval_depth; | |
|
1199
ab2d88e2505b
* eval.c (unbind_catch): Do the long-jump here. Take a VALUE
Jim Blandy <jimb@redhat.com>
parents:
1196
diff
changeset
|
1027 |
|
ab2d88e2505b
* eval.c (unbind_catch): Do the long-jump here. Take a VALUE
Jim Blandy <jimb@redhat.com>
parents:
1196
diff
changeset
|
1028 _longjmp (catch->jmp, 1); |
| 272 | 1029 } |
| 1030 | |
| 1031 DEFUN ("throw", Fthrow, Sthrow, 2, 2, 0, | |
|
27554
229352fdbf68
Fix various doc strings not to duplicate information from
Dave Love <fx@gnu.org>
parents:
27295
diff
changeset
|
1032 "Throw to the catch for TAG and return VALUE from it.\n\ |
| 272 | 1033 Both TAG and VALUE are evalled.") |
|
14073
0df4b4f2a2a1
(Fmacroexpand, Fthrow, Fbacktrace_frame): Harmonize arguments with
Erik Naggum <erik@naggum.no>
parents:
13945
diff
changeset
|
1034 (tag, value) |
|
0df4b4f2a2a1
(Fmacroexpand, Fthrow, Fbacktrace_frame): Harmonize arguments with
Erik Naggum <erik@naggum.no>
parents:
13945
diff
changeset
|
1035 register Lisp_Object tag, value; |
| 272 | 1036 { |
| 1037 register struct catchtag *c; | |
| 1038 | |
| 1039 while (1) | |
| 1040 { | |
| 485 | 1041 if (!NILP (tag)) |
| 272 | 1042 for (c = catchlist; c; c = c->next) |
| 1043 { | |
| 1044 if (EQ (c->tag, tag)) | |
|
14073
0df4b4f2a2a1
(Fmacroexpand, Fthrow, Fbacktrace_frame): Harmonize arguments with
Erik Naggum <erik@naggum.no>
parents:
13945
diff
changeset
|
1045 unwind_to_catch (c, value); |
| 272 | 1046 } |
|
14073
0df4b4f2a2a1
(Fmacroexpand, Fthrow, Fbacktrace_frame): Harmonize arguments with
Erik Naggum <erik@naggum.no>
parents:
13945
diff
changeset
|
1047 tag = Fsignal (Qno_catch, Fcons (tag, Fcons (value, Qnil))); |
| 272 | 1048 } |
| 1049 } | |
| 1050 | |
| 1051 | |
| 1052 DEFUN ("unwind-protect", Funwind_protect, Sunwind_protect, 1, UNEVALLED, 0, | |
| 1053 "Do BODYFORM, protecting with UNWINDFORMS.\n\ | |
| 1054 If BODYFORM completes normally, its value is returned\n\ | |
| 1055 after executing the UNWINDFORMS.\n\ | |
| 1056 If BODYFORM exits nonlocally, the UNWINDFORMS are executed anyway.") | |
| 1057 (args) | |
| 1058 Lisp_Object args; | |
| 1059 { | |
| 1060 Lisp_Object val; | |
| 1061 int count = specpdl_ptr - specpdl; | |
| 1062 | |
| 1063 record_unwind_protect (0, Fcdr (args)); | |
| 1064 val = Feval (Fcar (args)); | |
| 1065 return unbind_to (count, val); | |
| 1066 } | |
| 1067 | |
| 1068 /* Chain of condition handlers currently in effect. | |
| 1069 The elements of this chain are contained in the stack frames | |
| 1070 of Fcondition_case and internal_condition_case. | |
| 1071 When an error is signaled (by calling Fsignal, below), | |
| 1072 this chain is searched for an element that applies. */ | |
| 1073 | |
| 1074 struct handler *handlerlist; | |
| 1075 | |
| 1076 DEFUN ("condition-case", Fcondition_case, Scondition_case, 2, UNEVALLED, 0, | |
| 1077 "Regain control when an error is signaled.\n\ | |
| 1078 executes BODYFORM and returns its value if no error happens.\n\ | |
| 1079 Each element of HANDLERS looks like (CONDITION-NAME BODY...)\n\ | |
| 1080 where the BODY is made of Lisp expressions.\n\n\ | |
| 1081 A handler is applicable to an error\n\ | |
| 1082 if CONDITION-NAME is one of the error's condition names.\n\ | |
| 1083 If an error happens, the first applicable handler is run.\n\ | |
| 1084 \n\ | |
|
5567
c61f49e4283a
(Fcondition_case): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
5566
diff
changeset
|
1085 The car of a handler may be a list of condition names\n\ |
|
c61f49e4283a
(Fcondition_case): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
5566
diff
changeset
|
1086 instead of a single condition name.\n\ |
|
c61f49e4283a
(Fcondition_case): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
5566
diff
changeset
|
1087 \n\ |
| 272 | 1088 When a handler handles an error,\n\ |
| 1089 control returns to the condition-case and the handler BODY... is executed\n\ | |
| 1090 with VAR bound to (SIGNALED-CONDITIONS . SIGNAL-DATA).\n\ | |
| 1091 VAR may be nil; then you do not get access to the signal information.\n\ | |
| 1092 \n\ | |
| 1093 The value of the last BODY form is returned from the condition-case.\n\ | |
| 1094 See also the function `signal' for more info.") | |
| 1095 (args) | |
| 1096 Lisp_Object args; | |
| 1097 { | |
| 1098 Lisp_Object val; | |
| 1099 struct catchtag c; | |
| 1100 struct handler h; | |
|
1196
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1101 register Lisp_Object var, bodyform, handlers; |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1102 |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1103 var = Fcar (args); |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1104 bodyform = Fcar (Fcdr (args)); |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1105 handlers = Fcdr (Fcdr (args)); |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1106 CHECK_SYMBOL (var, 0); |
| 272 | 1107 |
|
1196
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1108 for (val = handlers; ! NILP (val); val = Fcdr (val)) |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1109 { |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1110 Lisp_Object tem; |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1111 tem = Fcar (val); |
|
5563
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1112 if (! (NILP (tem) |
|
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1113 || (CONSP (tem) |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
1114 && (SYMBOLP (XCAR (tem)) |
|
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
1115 || CONSP (XCAR (tem)))))) |
|
1196
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1116 error ("Invalid condition handler", tem); |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1117 } |
| 272 | 1118 |
| 1119 c.tag = Qnil; | |
| 1120 c.val = Qnil; | |
| 1121 c.backlist = backtrace_list; | |
| 1122 c.handlerlist = handlerlist; | |
| 1123 c.lisp_eval_depth = lisp_eval_depth; | |
| 1124 c.pdlcount = specpdl_ptr - specpdl; | |
| 1125 c.poll_suppress_count = poll_suppress_count; | |
| 1126 c.gcpro = gcprolist; | |
|
26365
6527989cb214
(struct catchtag): Add member byte_stack.
Gerd Moellmann <gerd@gnu.org>
parents:
26307
diff
changeset
|
1127 c.byte_stack = byte_stack_list; |
| 272 | 1128 if (_setjmp (c.jmp)) |
| 1129 { | |
| 485 | 1130 if (!NILP (h.var)) |
|
6132
ddf57829cf03
(Fsignal): If DATA is memory_signal_data, don't add to it.
Richard M. Stallman <rms@gnu.org>
parents:
5807
diff
changeset
|
1131 specbind (h.var, c.val); |
|
ddf57829cf03
(Fsignal): If DATA is memory_signal_data, don't add to it.
Richard M. Stallman <rms@gnu.org>
parents:
5807
diff
changeset
|
1132 val = Fprogn (Fcdr (h.chosen_clause)); |
|
1196
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1133 |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1134 /* Note that this just undoes the binding of h.var; whoever |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1135 longjumped to us unwound the stack to c.pdlcount before |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1136 throwing. */ |
| 272 | 1137 unbind_to (c.pdlcount, Qnil); |
| 1138 return val; | |
| 1139 } | |
| 1140 c.next = catchlist; | |
| 1141 catchlist = &c; | |
| 1142 | |
|
1196
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1143 h.var = var; |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1144 h.handler = handlers; |
| 272 | 1145 h.next = handlerlist; |
| 1146 h.tag = &c; | |
| 1147 handlerlist = &h; | |
| 1148 | |
|
1196
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1149 val = Feval (bodyform); |
| 272 | 1150 catchlist = c.next; |
| 1151 handlerlist = h.next; | |
| 1152 return val; | |
| 1153 } | |
| 1154 | |
|
14218
346d4cf758f5
(run_hook_with_args): Do nothing if Vrun_hooks is nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
1155 /* Call the function BFUN with no arguments, catching errors within it |
|
346d4cf758f5
(run_hook_with_args): Do nothing if Vrun_hooks is nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
1156 according to HANDLERS. If there is an error, call HFUN with |
|
346d4cf758f5
(run_hook_with_args): Do nothing if Vrun_hooks is nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
1157 one argument which is the data that describes the error: |
|
346d4cf758f5
(run_hook_with_args): Do nothing if Vrun_hooks is nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
1158 (SIGNALNAME . DATA) |
|
346d4cf758f5
(run_hook_with_args): Do nothing if Vrun_hooks is nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
1159 |
|
346d4cf758f5
(run_hook_with_args): Do nothing if Vrun_hooks is nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
1160 HANDLERS can be a list of conditions to catch. |
|
346d4cf758f5
(run_hook_with_args): Do nothing if Vrun_hooks is nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
1161 If HANDLERS is Qt, catch all errors. |
|
346d4cf758f5
(run_hook_with_args): Do nothing if Vrun_hooks is nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
1162 If HANDLERS is Qerror, catch all errors |
|
346d4cf758f5
(run_hook_with_args): Do nothing if Vrun_hooks is nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
1163 but allow the debugger to run if that is enabled. */ |
|
346d4cf758f5
(run_hook_with_args): Do nothing if Vrun_hooks is nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
1164 |
| 272 | 1165 Lisp_Object |
| 1166 internal_condition_case (bfun, handlers, hfun) | |
| 1167 Lisp_Object (*bfun) (); | |
| 1168 Lisp_Object handlers; | |
| 1169 Lisp_Object (*hfun) (); | |
| 1170 { | |
| 1171 Lisp_Object val; | |
| 1172 struct catchtag c; | |
| 1173 struct handler h; | |
| 1174 | |
|
30058
cbdbc61ee760
(internal_condition_case): Comment out abort if
Andrew Innes <andrewi@gnu.org>
parents:
30047
diff
changeset
|
1175 #if 0 /* Can't do this check anymore because realize_basic_faces has |
|
cbdbc61ee760
(internal_condition_case): Comment out abort if
Andrew Innes <andrewi@gnu.org>
parents:
30047
diff
changeset
|
1176 to BLOCK_INPUT, and can call Lisp. What's really needed is a |
|
cbdbc61ee760
(internal_condition_case): Comment out abort if
Andrew Innes <andrewi@gnu.org>
parents:
30047
diff
changeset
|
1177 flag indicating that we're currently handling a signal. */ |
|
11365
1e2290c04cce
(internal_condition_case): Abort if interrupt_input_blocked>0.
Richard M. Stallman <rms@gnu.org>
parents:
11251
diff
changeset
|
1178 /* Since Fsignal resets this to 0, it had better be 0 now |
|
1e2290c04cce
(internal_condition_case): Abort if interrupt_input_blocked>0.
Richard M. Stallman <rms@gnu.org>
parents:
11251
diff
changeset
|
1179 or else we have a potential bug. */ |
|
1e2290c04cce
(internal_condition_case): Abort if interrupt_input_blocked>0.
Richard M. Stallman <rms@gnu.org>
parents:
11251
diff
changeset
|
1180 if (interrupt_input_blocked != 0) |
|
1e2290c04cce
(internal_condition_case): Abort if interrupt_input_blocked>0.
Richard M. Stallman <rms@gnu.org>
parents:
11251
diff
changeset
|
1181 abort (); |
|
30058
cbdbc61ee760
(internal_condition_case): Comment out abort if
Andrew Innes <andrewi@gnu.org>
parents:
30047
diff
changeset
|
1182 #endif |
|
11365
1e2290c04cce
(internal_condition_case): Abort if interrupt_input_blocked>0.
Richard M. Stallman <rms@gnu.org>
parents:
11251
diff
changeset
|
1183 |
| 272 | 1184 c.tag = Qnil; |
| 1185 c.val = Qnil; | |
| 1186 c.backlist = backtrace_list; | |
| 1187 c.handlerlist = handlerlist; | |
| 1188 c.lisp_eval_depth = lisp_eval_depth; | |
| 1189 c.pdlcount = specpdl_ptr - specpdl; | |
| 1190 c.poll_suppress_count = poll_suppress_count; | |
| 1191 c.gcpro = gcprolist; | |
|
26365
6527989cb214
(struct catchtag): Add member byte_stack.
Gerd Moellmann <gerd@gnu.org>
parents:
26307
diff
changeset
|
1192 c.byte_stack = byte_stack_list; |
| 272 | 1193 if (_setjmp (c.jmp)) |
| 1194 { | |
|
6132
ddf57829cf03
(Fsignal): If DATA is memory_signal_data, don't add to it.
Richard M. Stallman <rms@gnu.org>
parents:
5807
diff
changeset
|
1195 return (*hfun) (c.val); |
| 272 | 1196 } |
| 1197 c.next = catchlist; | |
| 1198 catchlist = &c; | |
| 1199 h.handler = handlers; | |
| 1200 h.var = Qnil; | |
| 1201 h.next = handlerlist; | |
| 1202 h.tag = &c; | |
| 1203 handlerlist = &h; | |
| 1204 | |
| 1205 val = (*bfun) (); | |
| 1206 catchlist = c.next; | |
| 1207 handlerlist = h.next; | |
| 1208 return val; | |
| 1209 } | |
| 1210 | |
|
14218
346d4cf758f5
(run_hook_with_args): Do nothing if Vrun_hooks is nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
1211 /* Like internal_condition_case but call HFUN with ARG as its argument. */ |
|
346d4cf758f5
(run_hook_with_args): Do nothing if Vrun_hooks is nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
1212 |
|
5807
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1213 Lisp_Object |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1214 internal_condition_case_1 (bfun, arg, handlers, hfun) |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1215 Lisp_Object (*bfun) (); |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1216 Lisp_Object arg; |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1217 Lisp_Object handlers; |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1218 Lisp_Object (*hfun) (); |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1219 { |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1220 Lisp_Object val; |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1221 struct catchtag c; |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1222 struct handler h; |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1223 |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1224 c.tag = Qnil; |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1225 c.val = Qnil; |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1226 c.backlist = backtrace_list; |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1227 c.handlerlist = handlerlist; |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1228 c.lisp_eval_depth = lisp_eval_depth; |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1229 c.pdlcount = specpdl_ptr - specpdl; |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1230 c.poll_suppress_count = poll_suppress_count; |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1231 c.gcpro = gcprolist; |
|
26365
6527989cb214
(struct catchtag): Add member byte_stack.
Gerd Moellmann <gerd@gnu.org>
parents:
26307
diff
changeset
|
1232 c.byte_stack = byte_stack_list; |
|
5807
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1233 if (_setjmp (c.jmp)) |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1234 { |
|
6132
ddf57829cf03
(Fsignal): If DATA is memory_signal_data, don't add to it.
Richard M. Stallman <rms@gnu.org>
parents:
5807
diff
changeset
|
1235 return (*hfun) (c.val); |
|
5807
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1236 } |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1237 c.next = catchlist; |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1238 catchlist = &c; |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1239 h.handler = handlers; |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1240 h.var = Qnil; |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1241 h.next = handlerlist; |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1242 h.tag = &c; |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1243 handlerlist = &h; |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1244 |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1245 val = (*bfun) (arg); |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1246 catchlist = c.next; |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1247 handlerlist = h.next; |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1248 return val; |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1249 } |
|
cc9d9ab24008
(internal_condition_case_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5567
diff
changeset
|
1250 |
| 272 | 1251 static Lisp_Object find_handler_clause (); |
| 1252 | |
| 1253 DEFUN ("signal", Fsignal, Ssignal, 2, 2, 0, | |
|
5566
e2925466c923
(Fsignal): Rename 1st arg to error_symbol.
Richard M. Stallman <rms@gnu.org>
parents:
5563
diff
changeset
|
1254 "Signal an error. Args are ERROR-SYMBOL and associated DATA.\n\ |
| 272 | 1255 This function does not return.\n\n\ |
|
5566
e2925466c923
(Fsignal): Rename 1st arg to error_symbol.
Richard M. Stallman <rms@gnu.org>
parents:
5563
diff
changeset
|
1256 An error symbol is a symbol with an `error-conditions' property\n\ |
| 272 | 1257 that is a list of condition names.\n\ |
| 1258 A handler for any of those names will get to handle this signal.\n\ | |
| 1259 The symbol `error' should normally be one of them.\n\ | |
| 1260 \n\ | |
| 1261 DATA should be a list. Its elements are printed as part of the error message.\n\ | |
| 1262 If the signal is handled, DATA is made available to the handler.\n\ | |
| 1263 See also the function `condition-case'.") | |
|
5566
e2925466c923
(Fsignal): Rename 1st arg to error_symbol.
Richard M. Stallman <rms@gnu.org>
parents:
5563
diff
changeset
|
1264 (error_symbol, data) |
|
e2925466c923
(Fsignal): Rename 1st arg to error_symbol.
Richard M. Stallman <rms@gnu.org>
parents:
5563
diff
changeset
|
1265 Lisp_Object error_symbol, data; |
| 272 | 1266 { |
|
24171
44241f56675a
(Fsignal): Move comment to avoid confusing make-docfile.
Andreas Schwab <schwab@suse.de>
parents:
24054
diff
changeset
|
1267 /* When memory is full, ERROR-SYMBOL is nil, |
|
44241f56675a
(Fsignal): Move comment to avoid confusing make-docfile.
Andreas Schwab <schwab@suse.de>
parents:
24054
diff
changeset
|
1268 and DATA is (REAL-ERROR-SYMBOL . REAL-DATA). */ |
| 272 | 1269 register struct handler *allhandlers = handlerlist; |
| 1270 Lisp_Object conditions; | |
| 1271 extern int gc_in_progress; | |
| 1272 extern int waiting_for_input; | |
| 1273 Lisp_Object debugger_value; | |
|
16895
32945f27ed20
(Fsignal): Call fatal if no error handlers and no catch.
Richard M. Stallman <rms@gnu.org>
parents:
16485
diff
changeset
|
1274 Lisp_Object string; |
|
18636
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1275 Lisp_Object real_error_symbol; |
|
25008
39dd5c98a114
(Fsignal): Reset redisplaying_p to zero.
Gerd Moellmann <gerd@gnu.org>
parents:
24605
diff
changeset
|
1276 extern int display_busy_cursor_p; |
|
39dd5c98a114
(Fsignal): Reset redisplaying_p to zero.
Gerd Moellmann <gerd@gnu.org>
parents:
24605
diff
changeset
|
1277 |
| 272 | 1278 immediate_quit = 0; |
| 1279 if (gc_in_progress || waiting_for_input) | |
| 1280 abort (); | |
| 1281 | |
| 1282 TOTALLY_UNBLOCK_INPUT; | |
| 1283 | |
|
18636
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1284 if (NILP (error_symbol)) |
|
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1285 real_error_symbol = Fcar (data); |
|
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1286 else |
|
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1287 real_error_symbol = error_symbol; |
|
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1288 |
|
25008
39dd5c98a114
(Fsignal): Reset redisplaying_p to zero.
Gerd Moellmann <gerd@gnu.org>
parents:
24605
diff
changeset
|
1289 #ifdef HAVE_X_WINDOWS |
|
39dd5c98a114
(Fsignal): Reset redisplaying_p to zero.
Gerd Moellmann <gerd@gnu.org>
parents:
24605
diff
changeset
|
1290 if (display_busy_cursor_p) |
|
27860
5cf4fd1963fc
(Fsignal): Call cancel_busy_cursor instead of
Gerd Moellmann <gerd@gnu.org>
parents:
27819
diff
changeset
|
1291 cancel_busy_cursor (); |
|
25008
39dd5c98a114
(Fsignal): Reset redisplaying_p to zero.
Gerd Moellmann <gerd@gnu.org>
parents:
24605
diff
changeset
|
1292 #endif |
|
39dd5c98a114
(Fsignal): Reset redisplaying_p to zero.
Gerd Moellmann <gerd@gnu.org>
parents:
24605
diff
changeset
|
1293 |
|
16355
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
1294 /* This hook is used by edebug. */ |
|
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
1295 if (! NILP (Vsignal_hook_function)) |
|
18018
2a11f1e4bd6b
(Fsignal): Use call2 to call Vsignal_hook_function.
Richard M. Stallman <rms@gnu.org>
parents:
17872
diff
changeset
|
1296 call2 (Vsignal_hook_function, error_symbol, data); |
|
16355
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
1297 |
|
18636
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1298 conditions = Fget (real_error_symbol, Qerror_conditions); |
| 272 | 1299 |
| 1300 for (; handlerlist; handlerlist = handlerlist->next) | |
| 1301 { | |
| 1302 register Lisp_Object clause; | |
|
28779
ac31ccbeef6d
(Fsignal): If lisp_eval_depth or spepdl_size are near
Gerd Moellmann <gerd@gnu.org>
parents:
28383
diff
changeset
|
1303 |
|
ac31ccbeef6d
(Fsignal): If lisp_eval_depth or spepdl_size are near
Gerd Moellmann <gerd@gnu.org>
parents:
28383
diff
changeset
|
1304 if (lisp_eval_depth + 20 > max_lisp_eval_depth) |
|
ac31ccbeef6d
(Fsignal): If lisp_eval_depth or spepdl_size are near
Gerd Moellmann <gerd@gnu.org>
parents:
28383
diff
changeset
|
1305 max_lisp_eval_depth = lisp_eval_depth + 20; |
|
ac31ccbeef6d
(Fsignal): If lisp_eval_depth or spepdl_size are near
Gerd Moellmann <gerd@gnu.org>
parents:
28383
diff
changeset
|
1306 |
|
ac31ccbeef6d
(Fsignal): If lisp_eval_depth or spepdl_size are near
Gerd Moellmann <gerd@gnu.org>
parents:
28383
diff
changeset
|
1307 if (specpdl_size + 40 > max_specpdl_size) |
|
ac31ccbeef6d
(Fsignal): If lisp_eval_depth or spepdl_size are near
Gerd Moellmann <gerd@gnu.org>
parents:
28383
diff
changeset
|
1308 max_specpdl_size = specpdl_size + 40; |
|
ac31ccbeef6d
(Fsignal): If lisp_eval_depth or spepdl_size are near
Gerd Moellmann <gerd@gnu.org>
parents:
28383
diff
changeset
|
1309 |
| 272 | 1310 clause = find_handler_clause (handlerlist->handler, conditions, |
|
5566
e2925466c923
(Fsignal): Rename 1st arg to error_symbol.
Richard M. Stallman <rms@gnu.org>
parents:
5563
diff
changeset
|
1311 error_symbol, data, &debugger_value); |
| 272 | 1312 |
| 1313 #if 0 /* Most callers are not prepared to handle gc if this returns. | |
| 1314 So, since this feature is not very useful, take it out. */ | |
| 1315 /* If have called debugger and user wants to continue, | |
| 1316 just return nil. */ | |
| 1317 if (EQ (clause, Qlambda)) | |
| 1318 return debugger_value; | |
| 1319 #else | |
| 1320 if (EQ (clause, Qlambda)) | |
|
1196
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1321 { |
|
13945
6a653c300631
(syms_of_eval): Doc fix for inhibit-quit.
Karl Heuer <kwzh@gnu.org>
parents:
13768
diff
changeset
|
1322 /* We can't return values to code which signaled an error, but we |
|
6a653c300631
(syms_of_eval): Doc fix for inhibit-quit.
Karl Heuer <kwzh@gnu.org>
parents:
13768
diff
changeset
|
1323 can continue code which has signaled a quit. */ |
|
18636
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1324 if (EQ (real_error_symbol, Qquit)) |
|
1196
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1325 return Qnil; |
|
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1326 else |
|
3973
ab06b106c490
(Fsignal): Clarify error message.
Richard M. Stallman <rms@gnu.org>
parents:
3703
diff
changeset
|
1327 error ("Cannot return from the debugger in an error"); |
|
1196
65e2edefe748
* eval.c (Fcondition_case): Rearranged for clarity. Don't worry
Jim Blandy <jimb@redhat.com>
parents:
940
diff
changeset
|
1328 } |
| 272 | 1329 #endif |
| 1330 | |
| 485 | 1331 if (!NILP (clause)) |
| 272 | 1332 { |
|
6132
ddf57829cf03
(Fsignal): If DATA is memory_signal_data, don't add to it.
Richard M. Stallman <rms@gnu.org>
parents:
5807
diff
changeset
|
1333 Lisp_Object unwind_data; |
| 272 | 1334 struct handler *h = handlerlist; |
|
6132
ddf57829cf03
(Fsignal): If DATA is memory_signal_data, don't add to it.
Richard M. Stallman <rms@gnu.org>
parents:
5807
diff
changeset
|
1335 |
| 272 | 1336 handlerlist = allhandlers; |
|
18636
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1337 |
|
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1338 if (NILP (error_symbol)) |
|
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1339 unwind_data = data; |
|
6132
ddf57829cf03
(Fsignal): If DATA is memory_signal_data, don't add to it.
Richard M. Stallman <rms@gnu.org>
parents:
5807
diff
changeset
|
1340 else |
|
ddf57829cf03
(Fsignal): If DATA is memory_signal_data, don't add to it.
Richard M. Stallman <rms@gnu.org>
parents:
5807
diff
changeset
|
1341 unwind_data = Fcons (error_symbol, data); |
|
ddf57829cf03
(Fsignal): If DATA is memory_signal_data, don't add to it.
Richard M. Stallman <rms@gnu.org>
parents:
5807
diff
changeset
|
1342 h->chosen_clause = clause; |
|
ddf57829cf03
(Fsignal): If DATA is memory_signal_data, don't add to it.
Richard M. Stallman <rms@gnu.org>
parents:
5807
diff
changeset
|
1343 unwind_to_catch (h->tag, unwind_data); |
| 272 | 1344 } |
| 1345 } | |
| 1346 | |
| 1347 handlerlist = allhandlers; | |
| 1348 /* If no handler is present now, try to run the debugger, | |
| 1349 and if that fails, throw to top level. */ | |
|
5566
e2925466c923
(Fsignal): Rename 1st arg to error_symbol.
Richard M. Stallman <rms@gnu.org>
parents:
5563
diff
changeset
|
1350 find_handler_clause (Qerror, conditions, error_symbol, data, &debugger_value); |
|
16895
32945f27ed20
(Fsignal): Call fatal if no error handlers and no catch.
Richard M. Stallman <rms@gnu.org>
parents:
16485
diff
changeset
|
1351 if (catchlist != 0) |
|
32945f27ed20
(Fsignal): Call fatal if no error handlers and no catch.
Richard M. Stallman <rms@gnu.org>
parents:
16485
diff
changeset
|
1352 Fthrow (Qtop_level, Qt); |
|
32945f27ed20
(Fsignal): Call fatal if no error handlers and no catch.
Richard M. Stallman <rms@gnu.org>
parents:
16485
diff
changeset
|
1353 |
|
18636
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1354 if (! NILP (error_symbol)) |
|
16895
32945f27ed20
(Fsignal): Call fatal if no error handlers and no catch.
Richard M. Stallman <rms@gnu.org>
parents:
16485
diff
changeset
|
1355 data = Fcons (error_symbol, data); |
|
32945f27ed20
(Fsignal): Call fatal if no error handlers and no catch.
Richard M. Stallman <rms@gnu.org>
parents:
16485
diff
changeset
|
1356 |
|
32945f27ed20
(Fsignal): Call fatal if no error handlers and no catch.
Richard M. Stallman <rms@gnu.org>
parents:
16485
diff
changeset
|
1357 string = Ferror_message_string (data); |
|
23578
a4b29402f761
(Fsignal): Use a separate format string when passing
Andreas Schwab <schwab@suse.de>
parents:
23206
diff
changeset
|
1358 fatal ("%s", XSTRING (string)->data, 0); |
| 272 | 1359 } |
| 1360 | |
| 684 | 1361 /* Return nonzero iff LIST is a non-nil atom or |
| 1362 a list containing one of CONDITIONS. */ | |
| 1363 | |
| 1364 static int | |
| 1365 wants_debugger (list, conditions) | |
| 1366 Lisp_Object list, conditions; | |
| 1367 { | |
|
706
86cb5db0b6c3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
687
diff
changeset
|
1368 if (NILP (list)) |
| 684 | 1369 return 0; |
| 1370 if (! CONSP (list)) | |
| 1371 return 1; | |
| 1372 | |
|
878
5b1c5b4286e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
863
diff
changeset
|
1373 while (CONSP (conditions)) |
| 684 | 1374 { |
|
878
5b1c5b4286e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
863
diff
changeset
|
1375 Lisp_Object this, tail; |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
1376 this = XCAR (conditions); |
|
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
1377 for (tail = list; CONSP (tail); tail = XCDR (tail)) |
|
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
1378 if (EQ (XCAR (tail), this)) |
| 684 | 1379 return 1; |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
1380 conditions = XCDR (conditions); |
| 684 | 1381 } |
|
878
5b1c5b4286e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
863
diff
changeset
|
1382 return 0; |
| 684 | 1383 } |
| 1384 | |
| 13768 | 1385 /* Return 1 if an error with condition-symbols CONDITIONS, |
| 1386 and described by SIGNAL-DATA, should skip the debugger | |
| 1387 according to debugger-ignore-errors. */ | |
| 1388 | |
| 1389 static int | |
| 1390 skip_debugger (conditions, data) | |
| 1391 Lisp_Object conditions, data; | |
| 1392 { | |
| 1393 Lisp_Object tail; | |
| 1394 int first_string = 1; | |
| 1395 Lisp_Object error_message; | |
| 1396 | |
| 1397 for (tail = Vdebug_ignored_errors; CONSP (tail); | |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
1398 tail = XCDR (tail)) |
| 13768 | 1399 { |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
1400 if (STRINGP (XCAR (tail))) |
| 13768 | 1401 { |
| 1402 if (first_string) | |
| 1403 { | |
| 1404 error_message = Ferror_message_string (data); | |
| 1405 first_string = 0; | |
| 1406 } | |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
1407 if (fast_string_match (XCAR (tail), error_message) >= 0) |
| 13768 | 1408 return 1; |
| 1409 } | |
| 1410 else | |
| 1411 { | |
| 1412 Lisp_Object contail; | |
| 1413 | |
| 1414 for (contail = conditions; CONSP (contail); | |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
1415 contail = XCDR (contail)) |
|
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
1416 if (EQ (XCAR (tail), XCAR (contail))) |
| 13768 | 1417 return 1; |
| 1418 } | |
| 1419 } | |
| 1420 | |
| 1421 return 0; | |
| 1422 } | |
| 1423 | |
| 684 | 1424 /* Value of Qlambda means we have called debugger and user has continued. |
|
18636
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1425 There are two ways to pass SIG and DATA: |
|
24054
19ff7845d5f7
(find_handler_clause): If SIG is nil (memory full error),
Richard M. Stallman <rms@gnu.org>
parents:
23578
diff
changeset
|
1426 = SIG is the error symbol, and DATA is the rest of the data. |
|
18636
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1427 = SIG is nil, and DATA is (SYMBOL . REST-OF-DATA). |
|
24054
19ff7845d5f7
(find_handler_clause): If SIG is nil (memory full error),
Richard M. Stallman <rms@gnu.org>
parents:
23578
diff
changeset
|
1428 This is for memory-full errors only. |
|
18636
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1429 |
| 684 | 1430 Store value returned from debugger into *DEBUGGER_VALUE_PTR. */ |
| 272 | 1431 |
| 1432 static Lisp_Object | |
| 1433 find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr) | |
| 1434 Lisp_Object handlers, conditions, sig, data; | |
| 1435 Lisp_Object *debugger_value_ptr; | |
| 1436 { | |
| 1437 register Lisp_Object h; | |
| 1438 register Lisp_Object tem; | |
| 1439 | |
| 1440 if (EQ (handlers, Qt)) /* t is used by handlers for all conditions, set up by C code. */ | |
| 1441 return Qt; | |
|
16355
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
1442 /* error is used similarly, but means print an error message |
|
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
1443 and run the debugger if that is enabled. */ |
|
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
1444 if (EQ (handlers, Qerror) |
|
16443
0128b923d281
(Vdebug_on_signal): Renamed from Vdebug_force.
Richard M. Stallman <rms@gnu.org>
parents:
16355
diff
changeset
|
1445 || !NILP (Vdebug_on_signal)) /* This says call debugger even if |
|
0128b923d281
(Vdebug_on_signal): Renamed from Vdebug_force.
Richard M. Stallman <rms@gnu.org>
parents:
16355
diff
changeset
|
1446 there is a handler. */ |
| 272 | 1447 { |
|
16355
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
1448 int count = specpdl_ptr - specpdl; |
|
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
1449 int debugger_called = 0; |
|
18636
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1450 Lisp_Object sig_symbol, combined_data; |
|
24054
19ff7845d5f7
(find_handler_clause): If SIG is nil (memory full error),
Richard M. Stallman <rms@gnu.org>
parents:
23578
diff
changeset
|
1451 /* This is set to 1 if we are handling a memory-full error, |
|
19ff7845d5f7
(find_handler_clause): If SIG is nil (memory full error),
Richard M. Stallman <rms@gnu.org>
parents:
23578
diff
changeset
|
1452 because these must not run the debugger. |
|
19ff7845d5f7
(find_handler_clause): If SIG is nil (memory full error),
Richard M. Stallman <rms@gnu.org>
parents:
23578
diff
changeset
|
1453 (There is no room in memory to do that!) */ |
|
19ff7845d5f7
(find_handler_clause): If SIG is nil (memory full error),
Richard M. Stallman <rms@gnu.org>
parents:
23578
diff
changeset
|
1454 int no_debugger = 0; |
|
18636
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1455 |
|
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1456 if (NILP (sig)) |
|
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1457 { |
|
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1458 combined_data = data; |
|
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1459 sig_symbol = Fcar (data); |
|
24054
19ff7845d5f7
(find_handler_clause): If SIG is nil (memory full error),
Richard M. Stallman <rms@gnu.org>
parents:
23578
diff
changeset
|
1460 no_debugger = 1; |
|
18636
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1461 } |
|
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1462 else |
|
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1463 { |
|
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1464 combined_data = Fcons (sig, data); |
|
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1465 sig_symbol = sig; |
|
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1466 } |
|
16355
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
1467 |
| 684 | 1468 if (wants_debugger (Vstack_trace_on_error, conditions)) |
|
21853
6e93713b7d30
(find_handler_clause): Cast Fbacktrace to proper type.
Richard M. Stallman <rms@gnu.org>
parents:
21699
diff
changeset
|
1469 { |
|
28056
9ae3ef3133b8
(find_handler_clause): Use PROTOTYPES.
Dave Love <fx@gnu.org>
parents:
27860
diff
changeset
|
1470 #ifdef PROTOTYPES |
|
21853
6e93713b7d30
(find_handler_clause): Cast Fbacktrace to proper type.
Richard M. Stallman <rms@gnu.org>
parents:
21699
diff
changeset
|
1471 internal_with_output_to_temp_buffer ("*Backtrace*", |
|
6e93713b7d30
(find_handler_clause): Cast Fbacktrace to proper type.
Richard M. Stallman <rms@gnu.org>
parents:
21699
diff
changeset
|
1472 (Lisp_Object (*) (Lisp_Object)) Fbacktrace, |
|
6e93713b7d30
(find_handler_clause): Cast Fbacktrace to proper type.
Richard M. Stallman <rms@gnu.org>
parents:
21699
diff
changeset
|
1473 Qnil); |
|
6e93713b7d30
(find_handler_clause): Cast Fbacktrace to proper type.
Richard M. Stallman <rms@gnu.org>
parents:
21699
diff
changeset
|
1474 #else |
|
6e93713b7d30
(find_handler_clause): Cast Fbacktrace to proper type.
Richard M. Stallman <rms@gnu.org>
parents:
21699
diff
changeset
|
1475 internal_with_output_to_temp_buffer ("*Backtrace*", |
|
6e93713b7d30
(find_handler_clause): Cast Fbacktrace to proper type.
Richard M. Stallman <rms@gnu.org>
parents:
21699
diff
changeset
|
1476 Fbacktrace, Qnil); |
|
6e93713b7d30
(find_handler_clause): Cast Fbacktrace to proper type.
Richard M. Stallman <rms@gnu.org>
parents:
21699
diff
changeset
|
1477 #endif |
|
6e93713b7d30
(find_handler_clause): Cast Fbacktrace to proper type.
Richard M. Stallman <rms@gnu.org>
parents:
21699
diff
changeset
|
1478 } |
|
24054
19ff7845d5f7
(find_handler_clause): If SIG is nil (memory full error),
Richard M. Stallman <rms@gnu.org>
parents:
23578
diff
changeset
|
1479 if (! no_debugger |
|
19ff7845d5f7
(find_handler_clause): If SIG is nil (memory full error),
Richard M. Stallman <rms@gnu.org>
parents:
23578
diff
changeset
|
1480 && (EQ (sig_symbol, Qquit) |
|
19ff7845d5f7
(find_handler_clause): If SIG is nil (memory full error),
Richard M. Stallman <rms@gnu.org>
parents:
23578
diff
changeset
|
1481 ? debug_on_quit |
|
19ff7845d5f7
(find_handler_clause): If SIG is nil (memory full error),
Richard M. Stallman <rms@gnu.org>
parents:
23578
diff
changeset
|
1482 : wants_debugger (Vdebug_on_error, conditions)) |
|
18636
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1483 && ! skip_debugger (conditions, combined_data) |
|
17872
31b2c6763574
(num_nonmacro_input_events):
Richard M. Stallman <rms@gnu.org>
parents:
17275
diff
changeset
|
1484 && when_entered_debugger < num_nonmacro_input_events) |
| 272 | 1485 { |
| 1486 specbind (Qdebug_on_error, Qnil); | |
| 13768 | 1487 *debugger_value_ptr |
| 1488 = call_debugger (Fcons (Qerror, | |
|
18636
b3f3cd32fa70
(Fsignal, find_handler_clause): If ERROR_SYMBOL
Richard M. Stallman <rms@gnu.org>
parents:
18018
diff
changeset
|
1489 Fcons (combined_data, Qnil))); |
|
16355
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
1490 debugger_called = 1; |
| 272 | 1491 } |
|
16355
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
1492 /* If there is no handler, return saying whether we ran the debugger. */ |
|
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
1493 if (EQ (handlers, Qerror)) |
|
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
1494 { |
|
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
1495 if (debugger_called) |
|
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
1496 return unbind_to (count, Qlambda); |
|
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
1497 return Qt; |
|
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
1498 } |
| 272 | 1499 } |
| 1500 for (h = handlers; CONSP (h); h = Fcdr (h)) | |
| 1501 { | |
|
5563
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1502 Lisp_Object handler, condit; |
|
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1503 |
|
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1504 handler = Fcar (h); |
|
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1505 if (!CONSP (handler)) |
| 272 | 1506 continue; |
|
5563
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1507 condit = Fcar (handler); |
|
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1508 /* Handle a single condition name in handler HANDLER. */ |
|
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1509 if (SYMBOLP (condit)) |
|
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1510 { |
|
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1511 tem = Fmemq (Fcar (handler), conditions); |
|
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1512 if (!NILP (tem)) |
|
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1513 return handler; |
|
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1514 } |
|
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1515 /* Handle a list of condition names in handler HANDLER. */ |
|
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1516 else if (CONSP (condit)) |
|
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1517 { |
|
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1518 while (CONSP (condit)) |
|
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1519 { |
|
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1520 tem = Fmemq (Fcar (condit), conditions); |
|
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1521 if (!NILP (tem)) |
|
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1522 return handler; |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
1523 condit = XCDR (condit); |
|
5563
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1524 } |
|
50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
Richard M. Stallman <rms@gnu.org>
parents:
5254
diff
changeset
|
1525 } |
| 272 | 1526 } |
| 1527 return Qnil; | |
| 1528 } | |
| 1529 | |
| 1530 /* dump an error message; called like printf */ | |
| 1531 | |
| 1532 /* VARARGS 1 */ | |
| 1533 void | |
| 1534 error (m, a1, a2, a3) | |
| 1535 char *m; | |
|
6225
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1536 char *a1, *a2, *a3; |
| 272 | 1537 { |
| 1538 char buf[200]; | |
|
6225
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1539 int size = 200; |
|
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1540 int mlen; |
|
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1541 char *buffer = buf; |
|
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1542 char *args[3]; |
|
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1543 int allocated = 0; |
|
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1544 Lisp_Object string; |
|
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1545 |
|
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1546 args[0] = a1; |
|
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1547 args[1] = a2; |
|
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1548 args[2] = a3; |
|
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1549 |
|
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1550 mlen = strlen (m); |
| 272 | 1551 |
| 1552 while (1) | |
|
6225
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1553 { |
|
23206
a9090a71e969
(error): After enlarging buffer, write to it, not to buf.
Karl Heuer <kwzh@gnu.org>
parents:
21853
diff
changeset
|
1554 int used = doprnt (buffer, size, m, m + mlen, 3, args); |
|
6225
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1555 if (used < size) |
|
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1556 break; |
|
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1557 size *= 2; |
|
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1558 if (allocated) |
|
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1559 buffer = (char *) xrealloc (buffer, size); |
|
7353
334cececa42d
(error): Fix logic in call to xmalloc/xrealloc.
Richard M. Stallman <rms@gnu.org>
parents:
7307
diff
changeset
|
1560 else |
|
334cececa42d
(error): Fix logic in call to xmalloc/xrealloc.
Richard M. Stallman <rms@gnu.org>
parents:
7307
diff
changeset
|
1561 { |
|
334cececa42d
(error): Fix logic in call to xmalloc/xrealloc.
Richard M. Stallman <rms@gnu.org>
parents:
7307
diff
changeset
|
1562 buffer = (char *) xmalloc (size); |
|
334cececa42d
(error): Fix logic in call to xmalloc/xrealloc.
Richard M. Stallman <rms@gnu.org>
parents:
7307
diff
changeset
|
1563 allocated = 1; |
|
334cececa42d
(error): Fix logic in call to xmalloc/xrealloc.
Richard M. Stallman <rms@gnu.org>
parents:
7307
diff
changeset
|
1564 } |
|
6225
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1565 } |
|
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1566 |
|
23206
a9090a71e969
(error): After enlarging buffer, write to it, not to buf.
Karl Heuer <kwzh@gnu.org>
parents:
21853
diff
changeset
|
1567 string = build_string (buffer); |
|
6225
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1568 if (allocated) |
|
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1569 free (buffer); |
|
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1570 |
|
8f92cf89ed7c
(error): Use doprnt. Make buffer larger as necessary.
Richard M. Stallman <rms@gnu.org>
parents:
6132
diff
changeset
|
1571 Fsignal (Qerror, Fcons (string, Qnil)); |
| 272 | 1572 } |
| 1573 | |
| 1574 DEFUN ("commandp", Fcommandp, Scommandp, 1, 1, 0, | |
| 1575 "T if FUNCTION makes provisions for interactive calling.\n\ | |
| 1576 This means it contains a description for how to read arguments to give it.\n\ | |
| 1577 The value is nil for an invalid function or a symbol with no function\n\ | |
| 1578 definition.\n\ | |
| 1579 \n\ | |
| 1580 Interactively callable functions include strings and vectors (treated\n\ | |
| 1581 as keyboard macros), lambda-expressions that contain a top-level call\n\ | |
| 1582 to `interactive', autoload definitions made by `autoload' with non-nil\n\ | |
| 1583 fourth argument, and some of the built-in functions of Lisp.\n\ | |
| 1584 \n\ | |
| 1585 Also, a symbol satisfies `commandp' if its function definition does so.") | |
| 1586 (function) | |
| 1587 Lisp_Object function; | |
| 1588 { | |
| 1589 register Lisp_Object fun; | |
| 1590 register Lisp_Object funcar; | |
| 1591 | |
| 1592 fun = function; | |
| 1593 | |
| 648 | 1594 fun = indirect_function (fun); |
| 1595 if (EQ (fun, Qunbound)) | |
| 1596 return Qnil; | |
| 272 | 1597 |
| 1598 /* Emacs primitives are interactive if their DEFUN specifies an | |
| 1599 interactive spec. */ | |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
1600 if (SUBRP (fun)) |
| 272 | 1601 { |
| 1602 if (XSUBR (fun)->prompt) | |
| 1603 return Qt; | |
| 1604 else | |
| 1605 return Qnil; | |
| 1606 } | |
| 1607 | |
| 1608 /* Bytecode objects are interactive if they are long enough to | |
| 1609 have an element whose index is COMPILED_INTERACTIVE, which is | |
| 1610 where the interactive spec is stored. */ | |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
1611 else if (COMPILEDP (fun)) |
| 10345 | 1612 return ((XVECTOR (fun)->size & PSEUDOVECTOR_SIZE_MASK) > COMPILED_INTERACTIVE |
| 272 | 1613 ? Qt : Qnil); |
| 1614 | |
| 1615 /* Strings and vectors are keyboard macros. */ | |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
1616 if (STRINGP (fun) || VECTORP (fun)) |
| 272 | 1617 return Qt; |
| 1618 | |
| 1619 /* Lists may represent commands. */ | |
| 1620 if (!CONSP (fun)) | |
| 1621 return Qnil; | |
| 1622 funcar = Fcar (fun); | |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
1623 if (!SYMBOLP (funcar)) |
| 272 | 1624 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); |
| 1625 if (EQ (funcar, Qlambda)) | |
| 1626 return Fassq (Qinteractive, Fcdr (Fcdr (fun))); | |
| 1627 if (EQ (funcar, Qmocklisp)) | |
| 1628 return Qt; /* All mocklisp functions can be called interactively */ | |
| 1629 if (EQ (funcar, Qautoload)) | |
| 1630 return Fcar (Fcdr (Fcdr (Fcdr (fun)))); | |
| 1631 else | |
| 1632 return Qnil; | |
| 1633 } | |
| 1634 | |
| 1635 /* ARGSUSED */ | |
| 1636 DEFUN ("autoload", Fautoload, Sautoload, 2, 5, 0, | |
| 1637 "Define FUNCTION to autoload from FILE.\n\ | |
| 1638 FUNCTION is a symbol; FILE is a file name string to pass to `load'.\n\ | |
| 1639 Third arg DOCSTRING is documentation for the function.\n\ | |
| 1640 Fourth arg INTERACTIVE if non-nil says function can be called interactively.\n\ | |
|
1564
b327816041d1
* eval.c (Fautoload): Renamed fifth argument TYPE. Document the
Jim Blandy <jimb@redhat.com>
parents:
1452
diff
changeset
|
1641 Fifth arg TYPE indicates the type of the object:\n\ |
|
b327816041d1
* eval.c (Fautoload): Renamed fifth argument TYPE. Document the
Jim Blandy <jimb@redhat.com>
parents:
1452
diff
changeset
|
1642 nil or omitted says FUNCTION is a function,\n\ |
|
b327816041d1
* eval.c (Fautoload): Renamed fifth argument TYPE. Document the
Jim Blandy <jimb@redhat.com>
parents:
1452
diff
changeset
|
1643 `keymap' says FUNCTION is really a keymap, and\n\ |
|
b327816041d1
* eval.c (Fautoload): Renamed fifth argument TYPE. Document the
Jim Blandy <jimb@redhat.com>
parents:
1452
diff
changeset
|
1644 `macro' or t says FUNCTION is really a macro.\n\ |
| 272 | 1645 Third through fifth args give info about the real definition.\n\ |
| 1646 They default to nil.\n\ | |
| 1647 If FUNCTION is already defined other than as an autoload,\n\ | |
| 1648 this does nothing and returns nil.") | |
|
1564
b327816041d1
* eval.c (Fautoload): Renamed fifth argument TYPE. Document the
Jim Blandy <jimb@redhat.com>
parents:
1452
diff
changeset
|
1649 (function, file, docstring, interactive, type) |
|
b327816041d1
* eval.c (Fautoload): Renamed fifth argument TYPE. Document the
Jim Blandy <jimb@redhat.com>
parents:
1452
diff
changeset
|
1650 Lisp_Object function, file, docstring, interactive, type; |
| 272 | 1651 { |
| 1652 #ifdef NO_ARG_ARRAY | |
| 1653 Lisp_Object args[4]; | |
| 1654 #endif | |
| 1655 | |
| 1656 CHECK_SYMBOL (function, 0); | |
| 1657 CHECK_STRING (file, 1); | |
| 1658 | |
| 1659 /* If function is defined and not as an autoload, don't override */ | |
| 1660 if (!EQ (XSYMBOL (function)->function, Qunbound) | |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
1661 && !(CONSP (XSYMBOL (function)->function) |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
1662 && EQ (XCAR (XSYMBOL (function)->function), Qautoload))) |
| 272 | 1663 return Qnil; |
| 1664 | |
|
28297
f37b25e59751
* eval.c (Fautoload): Add entry in load-history (if after dump).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28056
diff
changeset
|
1665 if (NILP (Vpurify_flag)) |
|
f37b25e59751
* eval.c (Fautoload): Add entry in load-history (if after dump).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28056
diff
changeset
|
1666 /* Only add entries after dumping, because the ones before are |
|
f37b25e59751
* eval.c (Fautoload): Add entry in load-history (if after dump).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28056
diff
changeset
|
1667 not useful and else we get loads of them from the loaddefs.el. */ |
|
f37b25e59751
* eval.c (Fautoload): Add entry in load-history (if after dump).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28056
diff
changeset
|
1668 LOADHIST_ATTACH (Fcons (Qautoload, function)); |
|
f37b25e59751
* eval.c (Fautoload): Add entry in load-history (if after dump).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28056
diff
changeset
|
1669 |
| 272 | 1670 #ifdef NO_ARG_ARRAY |
| 1671 args[0] = file; | |
| 1672 args[1] = docstring; | |
| 1673 args[2] = interactive; | |
|
1564
b327816041d1
* eval.c (Fautoload): Renamed fifth argument TYPE. Document the
Jim Blandy <jimb@redhat.com>
parents:
1452
diff
changeset
|
1674 args[3] = type; |
| 272 | 1675 |
| 1676 return Ffset (function, Fcons (Qautoload, Flist (4, &args[0]))); | |
| 1677 #else /* NO_ARG_ARRAY */ | |
| 1678 return Ffset (function, Fcons (Qautoload, Flist (4, &file))); | |
| 1679 #endif /* not NO_ARG_ARRAY */ | |
| 1680 } | |
| 1681 | |
| 1682 Lisp_Object | |
| 1683 un_autoload (oldqueue) | |
| 1684 Lisp_Object oldqueue; | |
| 1685 { | |
| 1686 register Lisp_Object queue, first, second; | |
| 1687 | |
| 1688 /* Queue to unwind is current value of Vautoload_queue. | |
| 1689 oldqueue is the shadowed value to leave in Vautoload_queue. */ | |
| 1690 queue = Vautoload_queue; | |
| 1691 Vautoload_queue = oldqueue; | |
| 1692 while (CONSP (queue)) | |
| 1693 { | |
| 1694 first = Fcar (queue); | |
| 1695 second = Fcdr (first); | |
| 1696 first = Fcar (first); | |
| 1697 if (EQ (second, Qnil)) | |
| 1698 Vfeatures = first; | |
| 1699 else | |
| 1700 Ffset (first, second); | |
| 1701 queue = Fcdr (queue); | |
| 1702 } | |
| 1703 return Qnil; | |
| 1704 } | |
| 1705 | |
|
16108
2c9c0c867e00
(Fmacroexpand): gcpro form while calling do_autoload.
Richard M. Stallman <rms@gnu.org>
parents:
15275
diff
changeset
|
1706 /* Load an autoloaded function. |
|
2c9c0c867e00
(Fmacroexpand): gcpro form while calling do_autoload.
Richard M. Stallman <rms@gnu.org>
parents:
15275
diff
changeset
|
1707 FUNNAME is the symbol which is the function's name. |
|
2c9c0c867e00
(Fmacroexpand): gcpro form while calling do_autoload.
Richard M. Stallman <rms@gnu.org>
parents:
15275
diff
changeset
|
1708 FUNDEF is the autoload definition (a list). */ |
|
2c9c0c867e00
(Fmacroexpand): gcpro form while calling do_autoload.
Richard M. Stallman <rms@gnu.org>
parents:
15275
diff
changeset
|
1709 |
|
20378
cf1b52f5c34a
(do_autoload): Return void.
Andreas Schwab <schwab@suse.de>
parents:
20312
diff
changeset
|
1710 void |
| 272 | 1711 do_autoload (fundef, funname) |
| 1712 Lisp_Object fundef, funname; | |
| 1713 { | |
| 1714 int count = specpdl_ptr - specpdl; | |
|
25783
17eb5827f07b
(Fsignal): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25662
diff
changeset
|
1715 Lisp_Object fun, queue, first, second; |
|
16108
2c9c0c867e00
(Fmacroexpand): gcpro form while calling do_autoload.
Richard M. Stallman <rms@gnu.org>
parents:
15275
diff
changeset
|
1716 struct gcpro gcpro1, gcpro2, gcpro3; |
| 272 | 1717 |
| 1718 fun = funname; | |
| 1719 CHECK_SYMBOL (funname, 0); | |
|
16108
2c9c0c867e00
(Fmacroexpand): gcpro form while calling do_autoload.
Richard M. Stallman <rms@gnu.org>
parents:
15275
diff
changeset
|
1720 GCPRO3 (fun, funname, fundef); |
| 272 | 1721 |
|
24605
f378efa4aa8a
(do_autoload): Preserve match data.
Richard M. Stallman <rms@gnu.org>
parents:
24427
diff
changeset
|
1722 /* Preserve the match data. */ |
|
f378efa4aa8a
(do_autoload): Preserve match data.
Richard M. Stallman <rms@gnu.org>
parents:
24427
diff
changeset
|
1723 record_unwind_protect (Fset_match_data, Fmatch_data (Qnil, Qnil)); |
|
f378efa4aa8a
(do_autoload): Preserve match data.
Richard M. Stallman <rms@gnu.org>
parents:
24427
diff
changeset
|
1724 |
|
f378efa4aa8a
(do_autoload): Preserve match data.
Richard M. Stallman <rms@gnu.org>
parents:
24427
diff
changeset
|
1725 /* Value saved here is to be restored into Vautoload_queue. */ |
| 272 | 1726 record_unwind_protect (un_autoload, Vautoload_queue); |
| 1727 Vautoload_queue = Qt; | |
|
19237
42cc2b7bc6c6
(do_autoload): Require a suffix for the file.
Richard M. Stallman <rms@gnu.org>
parents:
19116
diff
changeset
|
1728 Fload (Fcar (Fcdr (fundef)), Qnil, noninteractive ? Qt : Qnil, Qnil, Qt); |
|
2547
c73c68a87cd5
(defun, defmacro, defvar, defconst):
Richard M. Stallman <rms@gnu.org>
parents:
2439
diff
changeset
|
1729 |
|
24605
f378efa4aa8a
(do_autoload): Preserve match data.
Richard M. Stallman <rms@gnu.org>
parents:
24427
diff
changeset
|
1730 /* Save the old autoloads, in case we ever do an unload. */ |
|
2547
c73c68a87cd5
(defun, defmacro, defvar, defconst):
Richard M. Stallman <rms@gnu.org>
parents:
2439
diff
changeset
|
1731 queue = Vautoload_queue; |
|
c73c68a87cd5
(defun, defmacro, defvar, defconst):
Richard M. Stallman <rms@gnu.org>
parents:
2439
diff
changeset
|
1732 while (CONSP (queue)) |
|
c73c68a87cd5
(defun, defmacro, defvar, defconst):
Richard M. Stallman <rms@gnu.org>
parents:
2439
diff
changeset
|
1733 { |
|
c73c68a87cd5
(defun, defmacro, defvar, defconst):
Richard M. Stallman <rms@gnu.org>
parents:
2439
diff
changeset
|
1734 first = Fcar (queue); |
|
c73c68a87cd5
(defun, defmacro, defvar, defconst):
Richard M. Stallman <rms@gnu.org>
parents:
2439
diff
changeset
|
1735 second = Fcdr (first); |
|
c73c68a87cd5
(defun, defmacro, defvar, defconst):
Richard M. Stallman <rms@gnu.org>
parents:
2439
diff
changeset
|
1736 first = Fcar (first); |
|
2599
5122736c0a03
(do_autoload): Fixed the bug in the autoload-saving code.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2596
diff
changeset
|
1737 |
|
5122736c0a03
(do_autoload): Fixed the bug in the autoload-saving code.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2596
diff
changeset
|
1738 /* Note: This test is subtle. The cdr of an autoload-queue entry |
|
5122736c0a03
(do_autoload): Fixed the bug in the autoload-saving code.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2596
diff
changeset
|
1739 may be an atom if the autoload entry was generated by a defalias |
|
24605
f378efa4aa8a
(do_autoload): Preserve match data.
Richard M. Stallman <rms@gnu.org>
parents:
24427
diff
changeset
|
1740 or fset. */ |
|
2599
5122736c0a03
(do_autoload): Fixed the bug in the autoload-saving code.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2596
diff
changeset
|
1741 if (CONSP (second)) |
| 4782 | 1742 Fput (first, Qautoload, (Fcdr (second))); |
|
2599
5122736c0a03
(do_autoload): Fixed the bug in the autoload-saving code.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2596
diff
changeset
|
1743 |
|
2547
c73c68a87cd5
(defun, defmacro, defvar, defconst):
Richard M. Stallman <rms@gnu.org>
parents:
2439
diff
changeset
|
1744 queue = Fcdr (queue); |
|
c73c68a87cd5
(defun, defmacro, defvar, defconst):
Richard M. Stallman <rms@gnu.org>
parents:
2439
diff
changeset
|
1745 } |
|
c73c68a87cd5
(defun, defmacro, defvar, defconst):
Richard M. Stallman <rms@gnu.org>
parents:
2439
diff
changeset
|
1746 |
| 272 | 1747 /* Once loading finishes, don't undo it. */ |
| 1748 Vautoload_queue = Qt; | |
| 1749 unbind_to (count, Qnil); | |
| 1750 | |
| 648 | 1751 fun = Findirect_function (fun); |
| 1752 | |
|
4462
9fbc6c74cab5
(do_autoload): Don't report autoload failure
Richard M. Stallman <rms@gnu.org>
parents:
4167
diff
changeset
|
1753 if (!NILP (Fequal (fun, fundef))) |
| 272 | 1754 error ("Autoloading failed to define function %s", |
| 1755 XSYMBOL (funname)->name->data); | |
|
16108
2c9c0c867e00
(Fmacroexpand): gcpro form while calling do_autoload.
Richard M. Stallman <rms@gnu.org>
parents:
15275
diff
changeset
|
1756 UNGCPRO; |
| 272 | 1757 } |
| 1758 | |
| 1759 DEFUN ("eval", Feval, Seval, 1, 1, 0, | |
| 1760 "Evaluate FORM and return its value.") | |
| 1761 (form) | |
| 1762 Lisp_Object form; | |
| 1763 { | |
| 1764 Lisp_Object fun, val, original_fun, original_args; | |
| 1765 Lisp_Object funcar; | |
| 1766 struct backtrace backtrace; | |
| 1767 struct gcpro gcpro1, gcpro2, gcpro3; | |
| 1768 | |
|
30047
86eaa645e6bc
(Feval): Put check for interrupt_input_block in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28779
diff
changeset
|
1769 #if 0 /* Can't do this check anymore because realize_basic_faces has |
|
86eaa645e6bc
(Feval): Put check for interrupt_input_block in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28779
diff
changeset
|
1770 to BLOCK_INPUT, and can call Lisp. What's really needed is a |
|
86eaa645e6bc
(Feval): Put check for interrupt_input_block in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28779
diff
changeset
|
1771 flag indicating that we're currently handling a signal. */ |
|
25008
39dd5c98a114
(Fsignal): Reset redisplaying_p to zero.
Gerd Moellmann <gerd@gnu.org>
parents:
24605
diff
changeset
|
1772 /* Since Fsignal resets this to 0, it had better be 0 now |
|
39dd5c98a114
(Fsignal): Reset redisplaying_p to zero.
Gerd Moellmann <gerd@gnu.org>
parents:
24605
diff
changeset
|
1773 or else we have a potential bug. */ |
|
39dd5c98a114
(Fsignal): Reset redisplaying_p to zero.
Gerd Moellmann <gerd@gnu.org>
parents:
24605
diff
changeset
|
1774 if (interrupt_input_blocked != 0) |
|
39dd5c98a114
(Fsignal): Reset redisplaying_p to zero.
Gerd Moellmann <gerd@gnu.org>
parents:
24605
diff
changeset
|
1775 abort (); |
|
30047
86eaa645e6bc
(Feval): Put check for interrupt_input_block in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28779
diff
changeset
|
1776 #endif |
|
25008
39dd5c98a114
(Fsignal): Reset redisplaying_p to zero.
Gerd Moellmann <gerd@gnu.org>
parents:
24605
diff
changeset
|
1777 |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
1778 if (SYMBOLP (form)) |
| 272 | 1779 { |
| 1780 if (EQ (Vmocklisp_arguments, Qt)) | |
| 1781 return Fsymbol_value (form); | |
| 1782 val = Fsymbol_value (form); | |
| 485 | 1783 if (NILP (val)) |
|
9306
ac852c183fa1
(Feval, Ffuncall, funcall_lambda, Fbacktrace): Don't use XFASTINT as an
Karl Heuer <kwzh@gnu.org>
parents:
9148
diff
changeset
|
1784 XSETFASTINT (val, 0); |
| 272 | 1785 else if (EQ (val, Qt)) |
|
9306
ac852c183fa1
(Feval, Ffuncall, funcall_lambda, Fbacktrace): Don't use XFASTINT as an
Karl Heuer <kwzh@gnu.org>
parents:
9148
diff
changeset
|
1786 XSETFASTINT (val, 1); |
| 272 | 1787 return val; |
| 1788 } | |
| 1789 if (!CONSP (form)) | |
| 1790 return form; | |
| 1791 | |
| 1792 QUIT; | |
| 1793 if (consing_since_gc > gc_cons_threshold) | |
| 1794 { | |
| 1795 GCPRO1 (form); | |
| 1796 Fgarbage_collect (); | |
| 1797 UNGCPRO; | |
| 1798 } | |
| 1799 | |
| 1800 if (++lisp_eval_depth > max_lisp_eval_depth) | |
| 1801 { | |
| 1802 if (max_lisp_eval_depth < 100) | |
| 1803 max_lisp_eval_depth = 100; | |
| 1804 if (lisp_eval_depth > max_lisp_eval_depth) | |
| 1805 error ("Lisp nesting exceeds max-lisp-eval-depth"); | |
| 1806 } | |
| 1807 | |
| 1808 original_fun = Fcar (form); | |
| 1809 original_args = Fcdr (form); | |
| 1810 | |
| 1811 backtrace.next = backtrace_list; | |
| 1812 backtrace_list = &backtrace; | |
| 1813 backtrace.function = &original_fun; /* This also protects them from gc */ | |
| 1814 backtrace.args = &original_args; | |
| 1815 backtrace.nargs = UNEVALLED; | |
| 1816 backtrace.evalargs = 1; | |
| 1817 backtrace.debug_on_exit = 0; | |
| 1818 | |
| 1819 if (debug_on_next_call) | |
| 1820 do_debug_on_call (Qt); | |
| 1821 | |
| 1822 /* At this point, only original_fun and original_args | |
| 1823 have values that will be used below */ | |
| 1824 retry: | |
| 648 | 1825 fun = Findirect_function (original_fun); |
| 272 | 1826 |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
1827 if (SUBRP (fun)) |
| 272 | 1828 { |
| 1829 Lisp_Object numargs; | |
|
19544
fc0bb24597ba
(Feval): Handle a subr which takes 8 arguments.
Kenichi Handa <handa@m17n.org>
parents:
19237
diff
changeset
|
1830 Lisp_Object argvals[8]; |
| 272 | 1831 Lisp_Object args_left; |
| 1832 register int i, maxargs; | |
| 1833 | |
| 1834 args_left = original_args; | |
| 1835 numargs = Flength (args_left); | |
| 1836 | |
| 1837 if (XINT (numargs) < XSUBR (fun)->min_args || | |
| 1838 (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < XINT (numargs))) | |
| 1839 return Fsignal (Qwrong_number_of_arguments, Fcons (fun, Fcons (numargs, Qnil))); | |
| 1840 | |
| 1841 if (XSUBR (fun)->max_args == UNEVALLED) | |
| 1842 { | |
| 1843 backtrace.evalargs = 0; | |
| 1844 val = (*XSUBR (fun)->function) (args_left); | |
| 1845 goto done; | |
| 1846 } | |
| 1847 | |
| 1848 if (XSUBR (fun)->max_args == MANY) | |
| 1849 { | |
| 1850 /* Pass a vector of evaluated arguments */ | |
| 1851 Lisp_Object *vals; | |
| 1852 register int argnum = 0; | |
| 1853 | |
| 1854 vals = (Lisp_Object *) alloca (XINT (numargs) * sizeof (Lisp_Object)); | |
| 1855 | |
| 1856 GCPRO3 (args_left, fun, fun); | |
| 1857 gcpro3.var = vals; | |
| 1858 gcpro3.nvars = 0; | |
| 1859 | |
| 485 | 1860 while (!NILP (args_left)) |
| 272 | 1861 { |
| 1862 vals[argnum++] = Feval (Fcar (args_left)); | |
| 1863 args_left = Fcdr (args_left); | |
| 1864 gcpro3.nvars = argnum; | |
| 1865 } | |
| 1866 | |
| 1867 backtrace.args = vals; | |
| 1868 backtrace.nargs = XINT (numargs); | |
| 1869 | |
| 1870 val = (*XSUBR (fun)->function) (XINT (numargs), vals); | |
| 323 | 1871 UNGCPRO; |
| 272 | 1872 goto done; |
| 1873 } | |
| 1874 | |
| 1875 GCPRO3 (args_left, fun, fun); | |
| 1876 gcpro3.var = argvals; | |
| 1877 gcpro3.nvars = 0; | |
| 1878 | |
| 1879 maxargs = XSUBR (fun)->max_args; | |
| 1880 for (i = 0; i < maxargs; args_left = Fcdr (args_left)) | |
| 1881 { | |
| 1882 argvals[i] = Feval (Fcar (args_left)); | |
| 1883 gcpro3.nvars = ++i; | |
| 1884 } | |
| 1885 | |
| 1886 UNGCPRO; | |
| 1887 | |
| 1888 backtrace.args = argvals; | |
| 1889 backtrace.nargs = XINT (numargs); | |
| 1890 | |
| 1891 switch (i) | |
| 1892 { | |
| 1893 case 0: | |
| 1894 val = (*XSUBR (fun)->function) (); | |
| 1895 goto done; | |
| 1896 case 1: | |
| 1897 val = (*XSUBR (fun)->function) (argvals[0]); | |
| 1898 goto done; | |
| 1899 case 2: | |
| 1900 val = (*XSUBR (fun)->function) (argvals[0], argvals[1]); | |
| 1901 goto done; | |
| 1902 case 3: | |
| 1903 val = (*XSUBR (fun)->function) (argvals[0], argvals[1], | |
| 1904 argvals[2]); | |
| 1905 goto done; | |
| 1906 case 4: | |
| 1907 val = (*XSUBR (fun)->function) (argvals[0], argvals[1], | |
| 1908 argvals[2], argvals[3]); | |
| 1909 goto done; | |
| 1910 case 5: | |
| 1911 val = (*XSUBR (fun)->function) (argvals[0], argvals[1], argvals[2], | |
| 1912 argvals[3], argvals[4]); | |
| 1913 goto done; | |
| 1914 case 6: | |
| 1915 val = (*XSUBR (fun)->function) (argvals[0], argvals[1], argvals[2], | |
| 1916 argvals[3], argvals[4], argvals[5]); | |
| 1917 goto done; | |
|
863
427299469901
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
753
diff
changeset
|
1918 case 7: |
|
427299469901
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
753
diff
changeset
|
1919 val = (*XSUBR (fun)->function) (argvals[0], argvals[1], argvals[2], |
|
427299469901
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
753
diff
changeset
|
1920 argvals[3], argvals[4], argvals[5], |
|
427299469901
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
753
diff
changeset
|
1921 argvals[6]); |
|
427299469901
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
753
diff
changeset
|
1922 goto done; |
| 272 | 1923 |
|
19544
fc0bb24597ba
(Feval): Handle a subr which takes 8 arguments.
Kenichi Handa <handa@m17n.org>
parents:
19237
diff
changeset
|
1924 case 8: |
|
fc0bb24597ba
(Feval): Handle a subr which takes 8 arguments.
Kenichi Handa <handa@m17n.org>
parents:
19237
diff
changeset
|
1925 val = (*XSUBR (fun)->function) (argvals[0], argvals[1], argvals[2], |
|
fc0bb24597ba
(Feval): Handle a subr which takes 8 arguments.
Kenichi Handa <handa@m17n.org>
parents:
19237
diff
changeset
|
1926 argvals[3], argvals[4], argvals[5], |
|
fc0bb24597ba
(Feval): Handle a subr which takes 8 arguments.
Kenichi Handa <handa@m17n.org>
parents:
19237
diff
changeset
|
1927 argvals[6], argvals[7]); |
|
fc0bb24597ba
(Feval): Handle a subr which takes 8 arguments.
Kenichi Handa <handa@m17n.org>
parents:
19237
diff
changeset
|
1928 goto done; |
|
fc0bb24597ba
(Feval): Handle a subr which takes 8 arguments.
Kenichi Handa <handa@m17n.org>
parents:
19237
diff
changeset
|
1929 |
| 272 | 1930 default: |
| 604 | 1931 /* Someone has created a subr that takes more arguments than |
| 1932 is supported by this code. We need to either rewrite the | |
| 1933 subr to use a different argument protocol, or add more | |
| 1934 cases to this switch. */ | |
| 1935 abort (); | |
| 272 | 1936 } |
| 1937 } | |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
1938 if (COMPILEDP (fun)) |
| 272 | 1939 val = apply_lambda (fun, original_args, 1); |
| 1940 else | |
| 1941 { | |
| 1942 if (!CONSP (fun)) | |
| 1943 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); | |
| 1944 funcar = Fcar (fun); | |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
1945 if (!SYMBOLP (funcar)) |
| 272 | 1946 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); |
| 1947 if (EQ (funcar, Qautoload)) | |
| 1948 { | |
| 1949 do_autoload (fun, original_fun); | |
| 1950 goto retry; | |
| 1951 } | |
| 1952 if (EQ (funcar, Qmacro)) | |
| 1953 val = Feval (apply1 (Fcdr (fun), original_args)); | |
| 1954 else if (EQ (funcar, Qlambda)) | |
| 1955 val = apply_lambda (fun, original_args, 1); | |
| 1956 else if (EQ (funcar, Qmocklisp)) | |
| 1957 val = ml_apply (fun, original_args); | |
| 1958 else | |
| 1959 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); | |
| 1960 } | |
| 1961 done: | |
| 1962 if (!EQ (Vmocklisp_arguments, Qt)) | |
| 1963 { | |
| 485 | 1964 if (NILP (val)) |
|
9306
ac852c183fa1
(Feval, Ffuncall, funcall_lambda, Fbacktrace): Don't use XFASTINT as an
Karl Heuer <kwzh@gnu.org>
parents:
9148
diff
changeset
|
1965 XSETFASTINT (val, 0); |
| 272 | 1966 else if (EQ (val, Qt)) |
|
9306
ac852c183fa1
(Feval, Ffuncall, funcall_lambda, Fbacktrace): Don't use XFASTINT as an
Karl Heuer <kwzh@gnu.org>
parents:
9148
diff
changeset
|
1967 XSETFASTINT (val, 1); |
| 272 | 1968 } |
| 1969 lisp_eval_depth--; | |
| 1970 if (backtrace.debug_on_exit) | |
| 1971 val = call_debugger (Fcons (Qexit, Fcons (val, Qnil))); | |
| 1972 backtrace_list = backtrace.next; | |
| 1973 return val; | |
| 1974 } | |
| 1975 | |
| 1976 DEFUN ("apply", Fapply, Sapply, 2, MANY, 0, | |
| 1977 "Call FUNCTION with our remaining args, using our last arg as list of args.\n\ | |
|
12583
73ac42b9be24
(Ffuncall, Fapply): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11481
diff
changeset
|
1978 Then return the value FUNCTION returns.\n\ |
| 272 | 1979 Thus, (apply '+ 1 2 '(3 4)) returns 10.") |
| 1980 (nargs, args) | |
| 1981 int nargs; | |
| 1982 Lisp_Object *args; | |
| 1983 { | |
| 1984 register int i, numargs; | |
| 1985 register Lisp_Object spread_arg; | |
| 1986 register Lisp_Object *funcall_args; | |
| 1987 Lisp_Object fun; | |
| 323 | 1988 struct gcpro gcpro1; |
| 272 | 1989 |
| 1990 fun = args [0]; | |
| 1991 funcall_args = 0; | |
| 1992 spread_arg = args [nargs - 1]; | |
| 1993 CHECK_LIST (spread_arg, nargs); | |
| 1994 | |
| 1995 numargs = XINT (Flength (spread_arg)); | |
| 1996 | |
| 1997 if (numargs == 0) | |
| 1998 return Ffuncall (nargs - 1, args); | |
| 1999 else if (numargs == 1) | |
| 2000 { | |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
2001 args [nargs - 1] = XCAR (spread_arg); |
| 272 | 2002 return Ffuncall (nargs, args); |
| 2003 } | |
| 2004 | |
| 323 | 2005 numargs += nargs - 2; |
| 272 | 2006 |
| 648 | 2007 fun = indirect_function (fun); |
| 2008 if (EQ (fun, Qunbound)) | |
| 272 | 2009 { |
| 648 | 2010 /* Let funcall get the error */ |
| 2011 fun = args[0]; | |
| 2012 goto funcall; | |
| 272 | 2013 } |
| 2014 | |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
2015 if (SUBRP (fun)) |
| 272 | 2016 { |
| 2017 if (numargs < XSUBR (fun)->min_args | |
| 2018 || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs)) | |
| 2019 goto funcall; /* Let funcall get the error */ | |
| 2020 else if (XSUBR (fun)->max_args > numargs) | |
| 2021 { | |
| 2022 /* Avoid making funcall cons up a yet another new vector of arguments | |
| 2023 by explicitly supplying nil's for optional values */ | |
| 2024 funcall_args = (Lisp_Object *) alloca ((1 + XSUBR (fun)->max_args) | |
| 2025 * sizeof (Lisp_Object)); | |
| 2026 for (i = numargs; i < XSUBR (fun)->max_args;) | |
| 2027 funcall_args[++i] = Qnil; | |
| 323 | 2028 GCPRO1 (*funcall_args); |
| 2029 gcpro1.nvars = 1 + XSUBR (fun)->max_args; | |
| 272 | 2030 } |
| 2031 } | |
| 2032 funcall: | |
| 2033 /* We add 1 to numargs because funcall_args includes the | |
| 2034 function itself as well as its arguments. */ | |
| 2035 if (!funcall_args) | |
| 323 | 2036 { |
| 2037 funcall_args = (Lisp_Object *) alloca ((1 + numargs) | |
| 2038 * sizeof (Lisp_Object)); | |
| 2039 GCPRO1 (*funcall_args); | |
| 2040 gcpro1.nvars = 1 + numargs; | |
| 2041 } | |
| 2042 | |
| 272 | 2043 bcopy (args, funcall_args, nargs * sizeof (Lisp_Object)); |
| 2044 /* Spread the last arg we got. Its first element goes in | |
| 2045 the slot that it used to occupy, hence this value of I. */ | |
| 2046 i = nargs - 1; | |
| 485 | 2047 while (!NILP (spread_arg)) |
| 272 | 2048 { |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
2049 funcall_args [i++] = XCAR (spread_arg); |
|
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
2050 spread_arg = XCDR (spread_arg); |
| 272 | 2051 } |
| 323 | 2052 |
| 2053 RETURN_UNGCPRO (Ffuncall (gcpro1.nvars, funcall_args)); | |
| 272 | 2054 } |
| 2055 | |
|
12732
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2056 /* Run hook variables in various ways. */ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2057 |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2058 enum run_hooks_condition {to_completion, until_success, until_failure}; |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2059 |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2060 DEFUN ("run-hooks", Frun_hooks, Srun_hooks, 1, MANY, 0, |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2061 "Run each hook in HOOKS. Major mode functions use this.\n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2062 Each argument should be a symbol, a hook variable.\n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2063 These symbols are processed in the order specified.\n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2064 If a hook symbol has a non-nil value, that value may be a function\n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2065 or a list of functions to be called to run the hook.\n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2066 If the value is a function, it is called with no arguments.\n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2067 If it is a list, the elements are called, in order, with no arguments.\n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2068 \n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2069 To make a hook variable buffer-local, use `make-local-hook',\n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2070 not `make-local-variable'.") |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2071 (nargs, args) |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2072 int nargs; |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2073 Lisp_Object *args; |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2074 { |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2075 Lisp_Object hook[1]; |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2076 register int i; |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2077 |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2078 for (i = 0; i < nargs; i++) |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2079 { |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2080 hook[0] = args[i]; |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2081 run_hook_with_args (1, hook, to_completion); |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2082 } |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2083 |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2084 return Qnil; |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2085 } |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2086 |
|
16485
9b919c5464a4
Reorganize function definitions so etags finds them.
Erik Naggum <erik@naggum.no>
parents:
16443
diff
changeset
|
2087 DEFUN ("run-hook-with-args", Frun_hook_with_args, |
|
9b919c5464a4
Reorganize function definitions so etags finds them.
Erik Naggum <erik@naggum.no>
parents:
16443
diff
changeset
|
2088 Srun_hook_with_args, 1, MANY, 0, |
|
12654
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2089 "Run HOOK with the specified arguments ARGS.\n\ |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2090 HOOK should be a symbol, a hook variable. If HOOK has a non-nil\n\ |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2091 value, that value may be a function or a list of functions to be\n\ |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2092 called to run the hook. If the value is a function, it is called with\n\ |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2093 the given arguments and its return value is returned. If it is a list\n\ |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2094 of functions, those functions are called, in order,\n\ |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2095 with the given arguments ARGS.\n\ |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2096 It is best not to depend on the value return by `run-hook-with-args',\n\ |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2097 as that may change.\n\ |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2098 \n\ |
|
12732
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2099 To make a hook variable buffer-local, use `make-local-hook',\n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2100 not `make-local-variable'.") |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2101 (nargs, args) |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2102 int nargs; |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2103 Lisp_Object *args; |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2104 { |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2105 return run_hook_with_args (nargs, args, to_completion); |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2106 } |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2107 |
|
16485
9b919c5464a4
Reorganize function definitions so etags finds them.
Erik Naggum <erik@naggum.no>
parents:
16443
diff
changeset
|
2108 DEFUN ("run-hook-with-args-until-success", Frun_hook_with_args_until_success, |
|
9b919c5464a4
Reorganize function definitions so etags finds them.
Erik Naggum <erik@naggum.no>
parents:
16443
diff
changeset
|
2109 Srun_hook_with_args_until_success, 1, MANY, 0, |
|
12732
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2110 "Run HOOK with the specified arguments ARGS.\n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2111 HOOK should be a symbol, a hook variable. Its value should\n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2112 be a list of functions. We call those functions, one by one,\n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2113 passing arguments ARGS to each of them, until one of them\n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2114 returns a non-nil value. Then we return that value.\n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2115 If all the functions return nil, we return nil.\n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2116 \n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2117 To make a hook variable buffer-local, use `make-local-hook',\n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2118 not `make-local-variable'.") |
|
12654
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2119 (nargs, args) |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2120 int nargs; |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2121 Lisp_Object *args; |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2122 { |
|
12732
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2123 return run_hook_with_args (nargs, args, until_success); |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2124 } |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2125 |
|
16485
9b919c5464a4
Reorganize function definitions so etags finds them.
Erik Naggum <erik@naggum.no>
parents:
16443
diff
changeset
|
2126 DEFUN ("run-hook-with-args-until-failure", Frun_hook_with_args_until_failure, |
|
9b919c5464a4
Reorganize function definitions so etags finds them.
Erik Naggum <erik@naggum.no>
parents:
16443
diff
changeset
|
2127 Srun_hook_with_args_until_failure, 1, MANY, 0, |
|
12732
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2128 "Run HOOK with the specified arguments ARGS.\n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2129 HOOK should be a symbol, a hook variable. Its value should\n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2130 be a list of functions. We call those functions, one by one,\n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2131 passing arguments ARGS to each of them, until one of them\n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2132 returns nil. Then we return nil.\n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2133 If all the functions return non-nil, we return non-nil.\n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2134 \n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2135 To make a hook variable buffer-local, use `make-local-hook',\n\ |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2136 not `make-local-variable'.") |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2137 (nargs, args) |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2138 int nargs; |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2139 Lisp_Object *args; |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2140 { |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2141 return run_hook_with_args (nargs, args, until_failure); |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2142 } |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2143 |
|
12781
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2144 /* ARGS[0] should be a hook symbol. |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2145 Call each of the functions in the hook value, passing each of them |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2146 as arguments all the rest of ARGS (all NARGS - 1 elements). |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2147 COND specifies a condition to test after each call |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2148 to decide whether to stop. |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2149 The caller (or its caller, etc) must gcpro all of ARGS, |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2150 except that it isn't necessary to gcpro ARGS[0]. */ |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2151 |
|
12732
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2152 Lisp_Object |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2153 run_hook_with_args (nargs, args, cond) |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2154 int nargs; |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2155 Lisp_Object *args; |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2156 enum run_hooks_condition cond; |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2157 { |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2158 Lisp_Object sym, val, ret; |
|
25257
0be923a80096
(run_hook_list_with_args): Gcpro `globals'.
Karl Heuer <kwzh@gnu.org>
parents:
25008
diff
changeset
|
2159 Lisp_Object globals; |
|
0be923a80096
(run_hook_list_with_args): Gcpro `globals'.
Karl Heuer <kwzh@gnu.org>
parents:
25008
diff
changeset
|
2160 struct gcpro gcpro1, gcpro2, gcpro3; |
|
12654
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2161 |
|
14218
346d4cf758f5
(run_hook_with_args): Do nothing if Vrun_hooks is nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
2162 /* If we are dying or still initializing, |
|
346d4cf758f5
(run_hook_with_args): Do nothing if Vrun_hooks is nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
2163 don't do anything--it would probably crash if we tried. */ |
|
346d4cf758f5
(run_hook_with_args): Do nothing if Vrun_hooks is nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
2164 if (NILP (Vrun_hooks)) |
|
27226
44dc06740e6c
(Fuser_variable_p): Check customizability too.
Dave Love <fx@gnu.org>
parents:
27031
diff
changeset
|
2165 return Qnil; |
|
14218
346d4cf758f5
(run_hook_with_args): Do nothing if Vrun_hooks is nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
2166 |
|
12654
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2167 sym = args[0]; |
|
12663
14d407b83eb3
(run-hook-with-args): Fix previous code.
Karl Heuer <kwzh@gnu.org>
parents:
12654
diff
changeset
|
2168 val = find_symbol_value (sym); |
|
12732
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2169 ret = (cond == until_failure ? Qt : Qnil); |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2170 |
|
12654
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2171 if (EQ (val, Qunbound) || NILP (val)) |
|
12732
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2172 return ret; |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
2173 else if (!CONSP (val) || EQ (XCAR (val), Qlambda)) |
|
12654
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2174 { |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2175 args[0] = val; |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2176 return Ffuncall (nargs, args); |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2177 } |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2178 else |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2179 { |
|
25257
0be923a80096
(run_hook_list_with_args): Gcpro `globals'.
Karl Heuer <kwzh@gnu.org>
parents:
25008
diff
changeset
|
2180 globals = Qnil; |
|
0be923a80096
(run_hook_list_with_args): Gcpro `globals'.
Karl Heuer <kwzh@gnu.org>
parents:
25008
diff
changeset
|
2181 GCPRO3 (sym, val, globals); |
|
12788
eceb3f25e115
(run_hook_with_args): Move the GCPRO2; add UNGCPRO.
Richard M. Stallman <rms@gnu.org>
parents:
12781
diff
changeset
|
2182 |
|
12732
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2183 for (; |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2184 CONSP (val) && ((cond == to_completion) |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2185 || (cond == until_success ? NILP (ret) |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2186 : !NILP (ret))); |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
2187 val = XCDR (val)) |
|
12654
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2188 { |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
2189 if (EQ (XCAR (val), Qt)) |
|
12654
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2190 { |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2191 /* t indicates this hook has a local binding; |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2192 it means to run the global binding too. */ |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2193 |
|
12732
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2194 for (globals = Fdefault_value (sym); |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2195 CONSP (globals) && ((cond == to_completion) |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2196 || (cond == until_success ? NILP (ret) |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2197 : !NILP (ret))); |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
2198 globals = XCDR (globals)) |
|
12654
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2199 { |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
2200 args[0] = XCAR (globals); |
|
13444
17f3f1c1bdf8
(run-hook-with-args, run-hook-list-with-args): Safeguard
Richard M. Stallman <rms@gnu.org>
parents:
13314
diff
changeset
|
2201 /* In a global value, t should not occur. If it does, we |
|
17f3f1c1bdf8
(run-hook-with-args, run-hook-list-with-args): Safeguard
Richard M. Stallman <rms@gnu.org>
parents:
13314
diff
changeset
|
2202 must ignore it to avoid an endless loop. */ |
|
17f3f1c1bdf8
(run-hook-with-args, run-hook-list-with-args): Safeguard
Richard M. Stallman <rms@gnu.org>
parents:
13314
diff
changeset
|
2203 if (!EQ (args[0], Qt)) |
|
17f3f1c1bdf8
(run-hook-with-args, run-hook-list-with-args): Safeguard
Richard M. Stallman <rms@gnu.org>
parents:
13314
diff
changeset
|
2204 ret = Ffuncall (nargs, args); |
|
12654
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2205 } |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2206 } |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2207 else |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2208 { |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
2209 args[0] = XCAR (val); |
|
12732
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2210 ret = Ffuncall (nargs, args); |
|
12654
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2211 } |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2212 } |
|
12788
eceb3f25e115
(run_hook_with_args): Move the GCPRO2; add UNGCPRO.
Richard M. Stallman <rms@gnu.org>
parents:
12781
diff
changeset
|
2213 |
|
eceb3f25e115
(run_hook_with_args): Move the GCPRO2; add UNGCPRO.
Richard M. Stallman <rms@gnu.org>
parents:
12781
diff
changeset
|
2214 UNGCPRO; |
|
12732
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2215 return ret; |
|
12654
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2216 } |
|
14721fd8dcc1
(Frun_hook_with_args): New C function, formerly in subr.el.
Karl Heuer <kwzh@gnu.org>
parents:
12583
diff
changeset
|
2217 } |
|
12781
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2218 |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2219 /* Run a hook symbol ARGS[0], but use FUNLIST instead of the actual |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2220 present value of that symbol. |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2221 Call each element of FUNLIST, |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2222 passing each of them the rest of ARGS. |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2223 The caller (or its caller, etc) must gcpro all of ARGS, |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2224 except that it isn't necessary to gcpro ARGS[0]. */ |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2225 |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2226 Lisp_Object |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2227 run_hook_list_with_args (funlist, nargs, args) |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2228 Lisp_Object funlist; |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2229 int nargs; |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2230 Lisp_Object *args; |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2231 { |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2232 Lisp_Object sym; |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2233 Lisp_Object val; |
|
25257
0be923a80096
(run_hook_list_with_args): Gcpro `globals'.
Karl Heuer <kwzh@gnu.org>
parents:
25008
diff
changeset
|
2234 Lisp_Object globals; |
|
0be923a80096
(run_hook_list_with_args): Gcpro `globals'.
Karl Heuer <kwzh@gnu.org>
parents:
25008
diff
changeset
|
2235 struct gcpro gcpro1, gcpro2, gcpro3; |
|
12781
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2236 |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2237 sym = args[0]; |
|
25257
0be923a80096
(run_hook_list_with_args): Gcpro `globals'.
Karl Heuer <kwzh@gnu.org>
parents:
25008
diff
changeset
|
2238 globals = Qnil; |
|
0be923a80096
(run_hook_list_with_args): Gcpro `globals'.
Karl Heuer <kwzh@gnu.org>
parents:
25008
diff
changeset
|
2239 GCPRO3 (sym, val, globals); |
|
12781
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2240 |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
2241 for (val = funlist; CONSP (val); val = XCDR (val)) |
|
12781
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2242 { |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
2243 if (EQ (XCAR (val), Qt)) |
|
12781
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2244 { |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2245 /* t indicates this hook has a local binding; |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2246 it means to run the global binding too. */ |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2247 |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2248 for (globals = Fdefault_value (sym); |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2249 CONSP (globals); |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
2250 globals = XCDR (globals)) |
|
12781
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2251 { |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
2252 args[0] = XCAR (globals); |
|
13444
17f3f1c1bdf8
(run-hook-with-args, run-hook-list-with-args): Safeguard
Richard M. Stallman <rms@gnu.org>
parents:
13314
diff
changeset
|
2253 /* In a global value, t should not occur. If it does, we |
|
17f3f1c1bdf8
(run-hook-with-args, run-hook-list-with-args): Safeguard
Richard M. Stallman <rms@gnu.org>
parents:
13314
diff
changeset
|
2254 must ignore it to avoid an endless loop. */ |
|
17f3f1c1bdf8
(run-hook-with-args, run-hook-list-with-args): Safeguard
Richard M. Stallman <rms@gnu.org>
parents:
13314
diff
changeset
|
2255 if (!EQ (args[0], Qt)) |
|
17f3f1c1bdf8
(run-hook-with-args, run-hook-list-with-args): Safeguard
Richard M. Stallman <rms@gnu.org>
parents:
13314
diff
changeset
|
2256 Ffuncall (nargs, args); |
|
12781
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2257 } |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2258 } |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2259 else |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2260 { |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
2261 args[0] = XCAR (val); |
|
12781
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2262 Ffuncall (nargs, args); |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2263 } |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2264 } |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2265 UNGCPRO; |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2266 return Qnil; |
|
2a8036f0b585
(run_hook_with_args): Add gcpros.
Richard M. Stallman <rms@gnu.org>
parents:
12732
diff
changeset
|
2267 } |
|
13103
a537b52d6668
(run_hook_with_args_2): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12788
diff
changeset
|
2268 |
|
a537b52d6668
(run_hook_with_args_2): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12788
diff
changeset
|
2269 /* Run the hook HOOK, giving each function the two args ARG1 and ARG2. */ |
|
a537b52d6668
(run_hook_with_args_2): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12788
diff
changeset
|
2270 |
|
a537b52d6668
(run_hook_with_args_2): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12788
diff
changeset
|
2271 void |
|
a537b52d6668
(run_hook_with_args_2): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12788
diff
changeset
|
2272 run_hook_with_args_2 (hook, arg1, arg2) |
|
a537b52d6668
(run_hook_with_args_2): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12788
diff
changeset
|
2273 Lisp_Object hook, arg1, arg2; |
|
a537b52d6668
(run_hook_with_args_2): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12788
diff
changeset
|
2274 { |
|
a537b52d6668
(run_hook_with_args_2): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12788
diff
changeset
|
2275 Lisp_Object temp[3]; |
|
a537b52d6668
(run_hook_with_args_2): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12788
diff
changeset
|
2276 temp[0] = hook; |
|
a537b52d6668
(run_hook_with_args_2): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12788
diff
changeset
|
2277 temp[1] = arg1; |
|
a537b52d6668
(run_hook_with_args_2): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12788
diff
changeset
|
2278 temp[2] = arg2; |
|
a537b52d6668
(run_hook_with_args_2): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12788
diff
changeset
|
2279 |
|
a537b52d6668
(run_hook_with_args_2): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12788
diff
changeset
|
2280 Frun_hook_with_args (3, temp); |
|
a537b52d6668
(run_hook_with_args_2): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12788
diff
changeset
|
2281 } |
|
12732
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
2282 |
| 272 | 2283 /* Apply fn to arg */ |
| 2284 Lisp_Object | |
| 2285 apply1 (fn, arg) | |
| 2286 Lisp_Object fn, arg; | |
| 2287 { | |
| 323 | 2288 struct gcpro gcpro1; |
| 2289 | |
| 2290 GCPRO1 (fn); | |
| 485 | 2291 if (NILP (arg)) |
| 323 | 2292 RETURN_UNGCPRO (Ffuncall (1, &fn)); |
| 2293 gcpro1.nvars = 2; | |
| 272 | 2294 #ifdef NO_ARG_ARRAY |
| 2295 { | |
| 2296 Lisp_Object args[2]; | |
| 2297 args[0] = fn; | |
| 2298 args[1] = arg; | |
| 323 | 2299 gcpro1.var = args; |
| 2300 RETURN_UNGCPRO (Fapply (2, args)); | |
| 272 | 2301 } |
| 2302 #else /* not NO_ARG_ARRAY */ | |
| 323 | 2303 RETURN_UNGCPRO (Fapply (2, &fn)); |
| 272 | 2304 #endif /* not NO_ARG_ARRAY */ |
| 2305 } | |
| 2306 | |
| 2307 /* Call function fn on no arguments */ | |
| 2308 Lisp_Object | |
| 2309 call0 (fn) | |
| 2310 Lisp_Object fn; | |
| 2311 { | |
| 323 | 2312 struct gcpro gcpro1; |
| 2313 | |
| 2314 GCPRO1 (fn); | |
| 2315 RETURN_UNGCPRO (Ffuncall (1, &fn)); | |
| 272 | 2316 } |
| 2317 | |
|
3703
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2318 /* Call function fn with 1 argument arg1 */ |
| 272 | 2319 /* ARGSUSED */ |
| 2320 Lisp_Object | |
|
3703
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2321 call1 (fn, arg1) |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2322 Lisp_Object fn, arg1; |
| 272 | 2323 { |
| 323 | 2324 struct gcpro gcpro1; |
| 272 | 2325 #ifdef NO_ARG_ARRAY |
| 323 | 2326 Lisp_Object args[2]; |
| 2327 | |
| 272 | 2328 args[0] = fn; |
|
3703
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2329 args[1] = arg1; |
| 323 | 2330 GCPRO1 (args[0]); |
| 2331 gcpro1.nvars = 2; | |
| 2332 RETURN_UNGCPRO (Ffuncall (2, args)); | |
| 272 | 2333 #else /* not NO_ARG_ARRAY */ |
| 323 | 2334 GCPRO1 (fn); |
| 2335 gcpro1.nvars = 2; | |
| 2336 RETURN_UNGCPRO (Ffuncall (2, &fn)); | |
| 272 | 2337 #endif /* not NO_ARG_ARRAY */ |
| 2338 } | |
| 2339 | |
|
3703
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2340 /* Call function fn with 2 arguments arg1, arg2 */ |
| 272 | 2341 /* ARGSUSED */ |
| 2342 Lisp_Object | |
|
3703
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2343 call2 (fn, arg1, arg2) |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2344 Lisp_Object fn, arg1, arg2; |
| 272 | 2345 { |
| 323 | 2346 struct gcpro gcpro1; |
| 272 | 2347 #ifdef NO_ARG_ARRAY |
| 2348 Lisp_Object args[3]; | |
| 2349 args[0] = fn; | |
|
3703
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2350 args[1] = arg1; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2351 args[2] = arg2; |
| 323 | 2352 GCPRO1 (args[0]); |
| 2353 gcpro1.nvars = 3; | |
| 2354 RETURN_UNGCPRO (Ffuncall (3, args)); | |
| 272 | 2355 #else /* not NO_ARG_ARRAY */ |
| 323 | 2356 GCPRO1 (fn); |
| 2357 gcpro1.nvars = 3; | |
| 2358 RETURN_UNGCPRO (Ffuncall (3, &fn)); | |
| 272 | 2359 #endif /* not NO_ARG_ARRAY */ |
| 2360 } | |
| 2361 | |
|
3703
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2362 /* Call function fn with 3 arguments arg1, arg2, arg3 */ |
| 272 | 2363 /* ARGSUSED */ |
| 2364 Lisp_Object | |
|
3703
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2365 call3 (fn, arg1, arg2, arg3) |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2366 Lisp_Object fn, arg1, arg2, arg3; |
| 272 | 2367 { |
| 323 | 2368 struct gcpro gcpro1; |
| 272 | 2369 #ifdef NO_ARG_ARRAY |
| 2370 Lisp_Object args[4]; | |
| 2371 args[0] = fn; | |
|
3703
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2372 args[1] = arg1; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2373 args[2] = arg2; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2374 args[3] = arg3; |
| 323 | 2375 GCPRO1 (args[0]); |
| 2376 gcpro1.nvars = 4; | |
| 2377 RETURN_UNGCPRO (Ffuncall (4, args)); | |
| 272 | 2378 #else /* not NO_ARG_ARRAY */ |
| 323 | 2379 GCPRO1 (fn); |
| 2380 gcpro1.nvars = 4; | |
| 2381 RETURN_UNGCPRO (Ffuncall (4, &fn)); | |
| 272 | 2382 #endif /* not NO_ARG_ARRAY */ |
| 2383 } | |
| 2384 | |
|
3703
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2385 /* Call function fn with 4 arguments arg1, arg2, arg3, arg4 */ |
|
3598
3c4b5489d2b4
* fileio.c (Frename_file): Pass all arguments to the file name handler.
Jim Blandy <jimb@redhat.com>
parents:
2961
diff
changeset
|
2386 /* ARGSUSED */ |
|
3c4b5489d2b4
* fileio.c (Frename_file): Pass all arguments to the file name handler.
Jim Blandy <jimb@redhat.com>
parents:
2961
diff
changeset
|
2387 Lisp_Object |
|
3703
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2388 call4 (fn, arg1, arg2, arg3, arg4) |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2389 Lisp_Object fn, arg1, arg2, arg3, arg4; |
|
3598
3c4b5489d2b4
* fileio.c (Frename_file): Pass all arguments to the file name handler.
Jim Blandy <jimb@redhat.com>
parents:
2961
diff
changeset
|
2390 { |
|
3c4b5489d2b4
* fileio.c (Frename_file): Pass all arguments to the file name handler.
Jim Blandy <jimb@redhat.com>
parents:
2961
diff
changeset
|
2391 struct gcpro gcpro1; |
|
3c4b5489d2b4
* fileio.c (Frename_file): Pass all arguments to the file name handler.
Jim Blandy <jimb@redhat.com>
parents:
2961
diff
changeset
|
2392 #ifdef NO_ARG_ARRAY |
|
3c4b5489d2b4
* fileio.c (Frename_file): Pass all arguments to the file name handler.
Jim Blandy <jimb@redhat.com>
parents:
2961
diff
changeset
|
2393 Lisp_Object args[5]; |
|
3c4b5489d2b4
* fileio.c (Frename_file): Pass all arguments to the file name handler.
Jim Blandy <jimb@redhat.com>
parents:
2961
diff
changeset
|
2394 args[0] = fn; |
|
3703
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2395 args[1] = arg1; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2396 args[2] = arg2; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2397 args[3] = arg3; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2398 args[4] = arg4; |
|
3598
3c4b5489d2b4
* fileio.c (Frename_file): Pass all arguments to the file name handler.
Jim Blandy <jimb@redhat.com>
parents:
2961
diff
changeset
|
2399 GCPRO1 (args[0]); |
|
3c4b5489d2b4
* fileio.c (Frename_file): Pass all arguments to the file name handler.
Jim Blandy <jimb@redhat.com>
parents:
2961
diff
changeset
|
2400 gcpro1.nvars = 5; |
|
3c4b5489d2b4
* fileio.c (Frename_file): Pass all arguments to the file name handler.
Jim Blandy <jimb@redhat.com>
parents:
2961
diff
changeset
|
2401 RETURN_UNGCPRO (Ffuncall (5, args)); |
|
3c4b5489d2b4
* fileio.c (Frename_file): Pass all arguments to the file name handler.
Jim Blandy <jimb@redhat.com>
parents:
2961
diff
changeset
|
2402 #else /* not NO_ARG_ARRAY */ |
|
3c4b5489d2b4
* fileio.c (Frename_file): Pass all arguments to the file name handler.
Jim Blandy <jimb@redhat.com>
parents:
2961
diff
changeset
|
2403 GCPRO1 (fn); |
|
3c4b5489d2b4
* fileio.c (Frename_file): Pass all arguments to the file name handler.
Jim Blandy <jimb@redhat.com>
parents:
2961
diff
changeset
|
2404 gcpro1.nvars = 5; |
|
3c4b5489d2b4
* fileio.c (Frename_file): Pass all arguments to the file name handler.
Jim Blandy <jimb@redhat.com>
parents:
2961
diff
changeset
|
2405 RETURN_UNGCPRO (Ffuncall (5, &fn)); |
|
3c4b5489d2b4
* fileio.c (Frename_file): Pass all arguments to the file name handler.
Jim Blandy <jimb@redhat.com>
parents:
2961
diff
changeset
|
2406 #endif /* not NO_ARG_ARRAY */ |
|
3c4b5489d2b4
* fileio.c (Frename_file): Pass all arguments to the file name handler.
Jim Blandy <jimb@redhat.com>
parents:
2961
diff
changeset
|
2407 } |
|
3c4b5489d2b4
* fileio.c (Frename_file): Pass all arguments to the file name handler.
Jim Blandy <jimb@redhat.com>
parents:
2961
diff
changeset
|
2408 |
|
3703
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2409 /* Call function fn with 5 arguments arg1, arg2, arg3, arg4, arg5 */ |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2410 /* ARGSUSED */ |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2411 Lisp_Object |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2412 call5 (fn, arg1, arg2, arg3, arg4, arg5) |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2413 Lisp_Object fn, arg1, arg2, arg3, arg4, arg5; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2414 { |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2415 struct gcpro gcpro1; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2416 #ifdef NO_ARG_ARRAY |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2417 Lisp_Object args[6]; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2418 args[0] = fn; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2419 args[1] = arg1; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2420 args[2] = arg2; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2421 args[3] = arg3; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2422 args[4] = arg4; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2423 args[5] = arg5; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2424 GCPRO1 (args[0]); |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2425 gcpro1.nvars = 6; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2426 RETURN_UNGCPRO (Ffuncall (6, args)); |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2427 #else /* not NO_ARG_ARRAY */ |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2428 GCPRO1 (fn); |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2429 gcpro1.nvars = 6; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2430 RETURN_UNGCPRO (Ffuncall (6, &fn)); |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2431 #endif /* not NO_ARG_ARRAY */ |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2432 } |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2433 |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2434 /* Call function fn with 6 arguments arg1, arg2, arg3, arg4, arg5, arg6 */ |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2435 /* ARGSUSED */ |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2436 Lisp_Object |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2437 call6 (fn, arg1, arg2, arg3, arg4, arg5, arg6) |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2438 Lisp_Object fn, arg1, arg2, arg3, arg4, arg5, arg6; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2439 { |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2440 struct gcpro gcpro1; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2441 #ifdef NO_ARG_ARRAY |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2442 Lisp_Object args[7]; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2443 args[0] = fn; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2444 args[1] = arg1; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2445 args[2] = arg2; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2446 args[3] = arg3; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2447 args[4] = arg4; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2448 args[5] = arg5; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2449 args[6] = arg6; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2450 GCPRO1 (args[0]); |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2451 gcpro1.nvars = 7; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2452 RETURN_UNGCPRO (Ffuncall (7, args)); |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2453 #else /* not NO_ARG_ARRAY */ |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2454 GCPRO1 (fn); |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2455 gcpro1.nvars = 7; |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2456 RETURN_UNGCPRO (Ffuncall (7, &fn)); |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2457 #endif /* not NO_ARG_ARRAY */ |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2458 } |
|
6930e8f81c88
(call5, call6): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
3598
diff
changeset
|
2459 |
| 272 | 2460 DEFUN ("funcall", Ffuncall, Sfuncall, 1, MANY, 0, |
| 2461 "Call first argument as a function, passing remaining arguments to it.\n\ | |
|
12583
73ac42b9be24
(Ffuncall, Fapply): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11481
diff
changeset
|
2462 Return the value that function returns.\n\ |
| 272 | 2463 Thus, (funcall 'cons 'x 'y) returns (x . y).") |
| 2464 (nargs, args) | |
| 2465 int nargs; | |
| 2466 Lisp_Object *args; | |
| 2467 { | |
| 2468 Lisp_Object fun; | |
| 2469 Lisp_Object funcar; | |
| 2470 int numargs = nargs - 1; | |
| 2471 Lisp_Object lisp_numargs; | |
| 2472 Lisp_Object val; | |
| 2473 struct backtrace backtrace; | |
| 2474 register Lisp_Object *internal_args; | |
| 2475 register int i; | |
| 2476 | |
| 2477 QUIT; | |
| 2478 if (consing_since_gc > gc_cons_threshold) | |
| 323 | 2479 Fgarbage_collect (); |
| 272 | 2480 |
| 2481 if (++lisp_eval_depth > max_lisp_eval_depth) | |
| 2482 { | |
| 2483 if (max_lisp_eval_depth < 100) | |
| 2484 max_lisp_eval_depth = 100; | |
| 2485 if (lisp_eval_depth > max_lisp_eval_depth) | |
| 2486 error ("Lisp nesting exceeds max-lisp-eval-depth"); | |
| 2487 } | |
| 2488 | |
| 2489 backtrace.next = backtrace_list; | |
| 2490 backtrace_list = &backtrace; | |
| 2491 backtrace.function = &args[0]; | |
| 2492 backtrace.args = &args[1]; | |
| 2493 backtrace.nargs = nargs - 1; | |
| 2494 backtrace.evalargs = 0; | |
| 2495 backtrace.debug_on_exit = 0; | |
| 2496 | |
| 2497 if (debug_on_next_call) | |
| 2498 do_debug_on_call (Qlambda); | |
| 2499 | |
| 2500 retry: | |
| 2501 | |
| 2502 fun = args[0]; | |
| 648 | 2503 |
| 2504 fun = Findirect_function (fun); | |
| 272 | 2505 |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
2506 if (SUBRP (fun)) |
| 272 | 2507 { |
| 2508 if (numargs < XSUBR (fun)->min_args | |
| 2509 || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs)) | |
| 2510 { | |
|
9306
ac852c183fa1
(Feval, Ffuncall, funcall_lambda, Fbacktrace): Don't use XFASTINT as an
Karl Heuer <kwzh@gnu.org>
parents:
9148
diff
changeset
|
2511 XSETFASTINT (lisp_numargs, numargs); |
| 272 | 2512 return Fsignal (Qwrong_number_of_arguments, Fcons (fun, Fcons (lisp_numargs, Qnil))); |
| 2513 } | |
| 2514 | |
| 2515 if (XSUBR (fun)->max_args == UNEVALLED) | |
| 2516 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); | |
| 2517 | |
| 2518 if (XSUBR (fun)->max_args == MANY) | |
| 2519 { | |
| 2520 val = (*XSUBR (fun)->function) (numargs, args + 1); | |
| 2521 goto done; | |
| 2522 } | |
| 2523 | |
| 2524 if (XSUBR (fun)->max_args > numargs) | |
| 2525 { | |
| 2526 internal_args = (Lisp_Object *) alloca (XSUBR (fun)->max_args * sizeof (Lisp_Object)); | |
| 2527 bcopy (args + 1, internal_args, numargs * sizeof (Lisp_Object)); | |
| 2528 for (i = numargs; i < XSUBR (fun)->max_args; i++) | |
| 2529 internal_args[i] = Qnil; | |
| 2530 } | |
| 2531 else | |
| 2532 internal_args = args + 1; | |
| 2533 switch (XSUBR (fun)->max_args) | |
| 2534 { | |
| 2535 case 0: | |
| 2536 val = (*XSUBR (fun)->function) (); | |
| 2537 goto done; | |
| 2538 case 1: | |
| 2539 val = (*XSUBR (fun)->function) (internal_args[0]); | |
| 2540 goto done; | |
| 2541 case 2: | |
| 2542 val = (*XSUBR (fun)->function) (internal_args[0], | |
| 2543 internal_args[1]); | |
| 2544 goto done; | |
| 2545 case 3: | |
| 2546 val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1], | |
| 2547 internal_args[2]); | |
| 2548 goto done; | |
| 2549 case 4: | |
| 2550 val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1], | |
| 2551 internal_args[2], | |
| 2552 internal_args[3]); | |
| 2553 goto done; | |
| 2554 case 5: | |
| 2555 val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1], | |
| 2556 internal_args[2], internal_args[3], | |
| 2557 internal_args[4]); | |
| 2558 goto done; | |
| 2559 case 6: | |
| 2560 val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1], | |
| 2561 internal_args[2], internal_args[3], | |
| 2562 internal_args[4], internal_args[5]); | |
| 2563 goto done; | |
|
863
427299469901
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
753
diff
changeset
|
2564 case 7: |
|
427299469901
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
753
diff
changeset
|
2565 val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1], |
|
427299469901
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
753
diff
changeset
|
2566 internal_args[2], internal_args[3], |
|
427299469901
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
753
diff
changeset
|
2567 internal_args[4], internal_args[5], |
|
427299469901
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
753
diff
changeset
|
2568 internal_args[6]); |
|
427299469901
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
753
diff
changeset
|
2569 goto done; |
| 272 | 2570 |
|
19544
fc0bb24597ba
(Feval): Handle a subr which takes 8 arguments.
Kenichi Handa <handa@m17n.org>
parents:
19237
diff
changeset
|
2571 case 8: |
|
fc0bb24597ba
(Feval): Handle a subr which takes 8 arguments.
Kenichi Handa <handa@m17n.org>
parents:
19237
diff
changeset
|
2572 val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1], |
|
fc0bb24597ba
(Feval): Handle a subr which takes 8 arguments.
Kenichi Handa <handa@m17n.org>
parents:
19237
diff
changeset
|
2573 internal_args[2], internal_args[3], |
|
fc0bb24597ba
(Feval): Handle a subr which takes 8 arguments.
Kenichi Handa <handa@m17n.org>
parents:
19237
diff
changeset
|
2574 internal_args[4], internal_args[5], |
|
fc0bb24597ba
(Feval): Handle a subr which takes 8 arguments.
Kenichi Handa <handa@m17n.org>
parents:
19237
diff
changeset
|
2575 internal_args[6], internal_args[7]); |
|
fc0bb24597ba
(Feval): Handle a subr which takes 8 arguments.
Kenichi Handa <handa@m17n.org>
parents:
19237
diff
changeset
|
2576 goto done; |
|
fc0bb24597ba
(Feval): Handle a subr which takes 8 arguments.
Kenichi Handa <handa@m17n.org>
parents:
19237
diff
changeset
|
2577 |
| 272 | 2578 default: |
| 573 | 2579 |
|
19544
fc0bb24597ba
(Feval): Handle a subr which takes 8 arguments.
Kenichi Handa <handa@m17n.org>
parents:
19237
diff
changeset
|
2580 /* If a subr takes more than 8 arguments without using MANY |
| 573 | 2581 or UNEVALLED, we need to extend this function to support it. |
| 2582 Until this is done, there is no way to call the function. */ | |
| 2583 abort (); | |
| 272 | 2584 } |
| 2585 } | |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
2586 if (COMPILEDP (fun)) |
| 272 | 2587 val = funcall_lambda (fun, numargs, args + 1); |
| 2588 else | |
| 2589 { | |
| 2590 if (!CONSP (fun)) | |
| 2591 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); | |
| 2592 funcar = Fcar (fun); | |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
2593 if (!SYMBOLP (funcar)) |
| 272 | 2594 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); |
| 2595 if (EQ (funcar, Qlambda)) | |
| 2596 val = funcall_lambda (fun, numargs, args + 1); | |
| 2597 else if (EQ (funcar, Qmocklisp)) | |
| 2598 val = ml_apply (fun, Flist (numargs, args + 1)); | |
| 2599 else if (EQ (funcar, Qautoload)) | |
| 2600 { | |
| 2601 do_autoload (fun, args[0]); | |
| 2602 goto retry; | |
| 2603 } | |
| 2604 else | |
| 2605 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); | |
| 2606 } | |
| 2607 done: | |
| 2608 lisp_eval_depth--; | |
| 2609 if (backtrace.debug_on_exit) | |
| 2610 val = call_debugger (Fcons (Qexit, Fcons (val, Qnil))); | |
| 2611 backtrace_list = backtrace.next; | |
| 2612 return val; | |
| 2613 } | |
| 2614 | |
| 2615 Lisp_Object | |
| 2616 apply_lambda (fun, args, eval_flag) | |
| 2617 Lisp_Object fun, args; | |
| 2618 int eval_flag; | |
| 2619 { | |
| 2620 Lisp_Object args_left; | |
| 2621 Lisp_Object numargs; | |
| 2622 register Lisp_Object *arg_vector; | |
| 2623 struct gcpro gcpro1, gcpro2, gcpro3; | |
| 2624 register int i; | |
| 2625 register Lisp_Object tem; | |
| 2626 | |
| 2627 numargs = Flength (args); | |
| 2628 arg_vector = (Lisp_Object *) alloca (XINT (numargs) * sizeof (Lisp_Object)); | |
| 2629 args_left = args; | |
| 2630 | |
| 2631 GCPRO3 (*arg_vector, args_left, fun); | |
| 2632 gcpro1.nvars = 0; | |
| 2633 | |
| 2634 for (i = 0; i < XINT (numargs);) | |
| 2635 { | |
| 2636 tem = Fcar (args_left), args_left = Fcdr (args_left); | |
| 2637 if (eval_flag) tem = Feval (tem); | |
| 2638 arg_vector[i++] = tem; | |
| 2639 gcpro1.nvars = i; | |
| 2640 } | |
| 2641 | |
| 2642 UNGCPRO; | |
| 2643 | |
| 2644 if (eval_flag) | |
| 2645 { | |
| 2646 backtrace_list->args = arg_vector; | |
| 2647 backtrace_list->nargs = i; | |
| 2648 } | |
| 2649 backtrace_list->evalargs = 0; | |
| 2650 tem = funcall_lambda (fun, XINT (numargs), arg_vector); | |
| 2651 | |
| 2652 /* Do the debug-on-exit now, while arg_vector still exists. */ | |
| 2653 if (backtrace_list->debug_on_exit) | |
| 2654 tem = call_debugger (Fcons (Qexit, Fcons (tem, Qnil))); | |
| 2655 /* Don't do it again when we return to eval. */ | |
| 2656 backtrace_list->debug_on_exit = 0; | |
| 2657 return tem; | |
| 2658 } | |
| 2659 | |
| 2660 /* Apply a Lisp function FUN to the NARGS evaluated arguments in ARG_VECTOR | |
| 2661 and return the result of evaluation. | |
| 2662 FUN must be either a lambda-expression or a compiled-code object. */ | |
| 2663 | |
| 2664 Lisp_Object | |
| 2665 funcall_lambda (fun, nargs, arg_vector) | |
| 2666 Lisp_Object fun; | |
| 2667 int nargs; | |
| 2668 register Lisp_Object *arg_vector; | |
| 2669 { | |
|
27781
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2670 Lisp_Object val, syms_left, next; |
| 272 | 2671 int count = specpdl_ptr - specpdl; |
|
27781
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2672 int i, optional, rest; |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2673 |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2674 if (NILP (Vmocklisp_arguments)) |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2675 specbind (Qmocklisp_arguments, Qt); /* t means NOT mocklisp! */ |
| 272 | 2676 |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
2677 if (CONSP (fun)) |
|
27781
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2678 { |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2679 syms_left = XCDR (fun); |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2680 if (CONSP (syms_left)) |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2681 syms_left = XCAR (syms_left); |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2682 else |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2683 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2684 } |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
2685 else if (COMPILEDP (fun)) |
| 272 | 2686 syms_left = XVECTOR (fun)->contents[COMPILED_ARGLIST]; |
|
27781
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2687 else |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2688 abort (); |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2689 |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2690 i = optional = rest = 0; |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2691 for (; CONSP (syms_left); syms_left = XCDR (syms_left)) |
| 272 | 2692 { |
| 2693 QUIT; | |
|
27781
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2694 |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2695 next = XCAR (syms_left); |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
2696 while (!SYMBOLP (next)) |
| 431 | 2697 next = Fsignal (Qinvalid_function, Fcons (fun, Qnil)); |
|
27781
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2698 |
| 272 | 2699 if (EQ (next, Qand_rest)) |
| 2700 rest = 1; | |
| 2701 else if (EQ (next, Qand_optional)) | |
| 2702 optional = 1; | |
| 2703 else if (rest) | |
| 2704 { | |
| 431 | 2705 specbind (next, Flist (nargs - i, &arg_vector[i])); |
| 272 | 2706 i = nargs; |
| 2707 } | |
| 2708 else if (i < nargs) | |
|
27781
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2709 specbind (next, arg_vector[i++]); |
| 272 | 2710 else if (!optional) |
|
27781
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2711 return Fsignal (Qwrong_number_of_arguments, |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2712 Fcons (fun, Fcons (make_number (nargs), Qnil))); |
| 272 | 2713 else |
| 2714 specbind (next, Qnil); | |
| 2715 } | |
| 2716 | |
|
27781
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2717 if (!NILP (syms_left)) |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2718 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2719 else if (i < nargs) |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2720 return Fsignal (Qwrong_number_of_arguments, |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2721 Fcons (fun, Fcons (make_number (nargs), Qnil))); |
| 272 | 2722 |
|
9148
e7ab930bb7eb
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Karl Heuer <kwzh@gnu.org>
parents:
8980
diff
changeset
|
2723 if (CONSP (fun)) |
|
27781
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2724 val = Fprogn (XCDR (XCDR (fun))); |
| 272 | 2725 else |
|
10201
03f3a1f4264a
(Fdefvar): Fix minor error in previous change.
Richard M. Stallman <rms@gnu.org>
parents:
10161
diff
changeset
|
2726 { |
|
03f3a1f4264a
(Fdefvar): Fix minor error in previous change.
Richard M. Stallman <rms@gnu.org>
parents:
10161
diff
changeset
|
2727 /* If we have not actually read the bytecode string |
|
03f3a1f4264a
(Fdefvar): Fix minor error in previous change.
Richard M. Stallman <rms@gnu.org>
parents:
10161
diff
changeset
|
2728 and constants vector yet, fetch them from the file. */ |
|
03f3a1f4264a
(Fdefvar): Fix minor error in previous change.
Richard M. Stallman <rms@gnu.org>
parents:
10161
diff
changeset
|
2729 if (CONSP (XVECTOR (fun)->contents[COMPILED_BYTECODE])) |
|
11205
81a008df9184
(Ffetch_bytecode): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11007
diff
changeset
|
2730 Ffetch_bytecode (fun); |
|
10201
03f3a1f4264a
(Fdefvar): Fix minor error in previous change.
Richard M. Stallman <rms@gnu.org>
parents:
10161
diff
changeset
|
2731 val = Fbyte_code (XVECTOR (fun)->contents[COMPILED_BYTECODE], |
|
03f3a1f4264a
(Fdefvar): Fix minor error in previous change.
Richard M. Stallman <rms@gnu.org>
parents:
10161
diff
changeset
|
2732 XVECTOR (fun)->contents[COMPILED_CONSTANTS], |
|
03f3a1f4264a
(Fdefvar): Fix minor error in previous change.
Richard M. Stallman <rms@gnu.org>
parents:
10161
diff
changeset
|
2733 XVECTOR (fun)->contents[COMPILED_STACK_DEPTH]); |
|
03f3a1f4264a
(Fdefvar): Fix minor error in previous change.
Richard M. Stallman <rms@gnu.org>
parents:
10161
diff
changeset
|
2734 } |
|
27781
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2735 |
| 272 | 2736 return unbind_to (count, val); |
| 2737 } | |
|
11205
81a008df9184
(Ffetch_bytecode): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11007
diff
changeset
|
2738 |
|
81a008df9184
(Ffetch_bytecode): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11007
diff
changeset
|
2739 DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode, |
|
81a008df9184
(Ffetch_bytecode): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11007
diff
changeset
|
2740 1, 1, 0, |
|
81a008df9184
(Ffetch_bytecode): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11007
diff
changeset
|
2741 "If byte-compiled OBJECT is lazy-loaded, fetch it now.") |
|
81a008df9184
(Ffetch_bytecode): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11007
diff
changeset
|
2742 (object) |
|
81a008df9184
(Ffetch_bytecode): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11007
diff
changeset
|
2743 Lisp_Object object; |
|
81a008df9184
(Ffetch_bytecode): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11007
diff
changeset
|
2744 { |
|
81a008df9184
(Ffetch_bytecode): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11007
diff
changeset
|
2745 Lisp_Object tem; |
|
81a008df9184
(Ffetch_bytecode): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11007
diff
changeset
|
2746 |
|
81a008df9184
(Ffetch_bytecode): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11007
diff
changeset
|
2747 if (COMPILEDP (object) |
|
81a008df9184
(Ffetch_bytecode): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11007
diff
changeset
|
2748 && CONSP (XVECTOR (object)->contents[COMPILED_BYTECODE])) |
|
81a008df9184
(Ffetch_bytecode): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11007
diff
changeset
|
2749 { |
|
81a008df9184
(Ffetch_bytecode): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11007
diff
changeset
|
2750 tem = read_doc_string (XVECTOR (object)->contents[COMPILED_BYTECODE]); |
|
11481
af7833ecb551
(Ffetch_bytecode): Check the type of the object being read from the file.
Richard M. Stallman <rms@gnu.org>
parents:
11365
diff
changeset
|
2751 if (!CONSP (tem)) |
|
af7833ecb551
(Ffetch_bytecode): Check the type of the object being read from the file.
Richard M. Stallman <rms@gnu.org>
parents:
11365
diff
changeset
|
2752 error ("invalid byte code"); |
|
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
2753 XVECTOR (object)->contents[COMPILED_BYTECODE] = XCAR (tem); |
|
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25314
diff
changeset
|
2754 XVECTOR (object)->contents[COMPILED_CONSTANTS] = XCDR (tem); |
|
11205
81a008df9184
(Ffetch_bytecode): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11007
diff
changeset
|
2755 } |
|
81a008df9184
(Ffetch_bytecode): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11007
diff
changeset
|
2756 return object; |
|
81a008df9184
(Ffetch_bytecode): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11007
diff
changeset
|
2757 } |
| 272 | 2758 |
| 2759 void | |
| 2760 grow_specpdl () | |
| 2761 { | |
| 2762 register int count = specpdl_ptr - specpdl; | |
| 2763 if (specpdl_size >= max_specpdl_size) | |
| 2764 { | |
| 2765 if (max_specpdl_size < 400) | |
| 2766 max_specpdl_size = 400; | |
| 2767 if (specpdl_size >= max_specpdl_size) | |
| 2768 { | |
|
1452
ed79bb8047e8
(grow_specpdl): Increase max_specpdl_size before Fsignal.
Richard M. Stallman <rms@gnu.org>
parents:
1199
diff
changeset
|
2769 if (!NILP (Vdebug_on_error)) |
|
ed79bb8047e8
(grow_specpdl): Increase max_specpdl_size before Fsignal.
Richard M. Stallman <rms@gnu.org>
parents:
1199
diff
changeset
|
2770 /* Leave room for some specpdl in the debugger. */ |
|
ed79bb8047e8
(grow_specpdl): Increase max_specpdl_size before Fsignal.
Richard M. Stallman <rms@gnu.org>
parents:
1199
diff
changeset
|
2771 max_specpdl_size = specpdl_size + 100; |
| 272 | 2772 Fsignal (Qerror, |
| 2773 Fcons (build_string ("Variable binding depth exceeds max-specpdl-size"), Qnil)); | |
| 2774 } | |
| 2775 } | |
| 2776 specpdl_size *= 2; | |
| 2777 if (specpdl_size > max_specpdl_size) | |
| 2778 specpdl_size = max_specpdl_size; | |
| 2779 specpdl = (struct specbinding *) xrealloc (specpdl, specpdl_size * sizeof (struct specbinding)); | |
| 2780 specpdl_ptr = specpdl + count; | |
| 2781 } | |
| 2782 | |
| 2783 void | |
| 2784 specbind (symbol, value) | |
| 2785 Lisp_Object symbol, value; | |
| 2786 { | |
| 2787 Lisp_Object ovalue; | |
| 2788 | |
| 431 | 2789 CHECK_SYMBOL (symbol, 0); |
| 272 | 2790 if (specpdl_ptr == specpdl + specpdl_size) |
| 2791 grow_specpdl (); | |
|
27781
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2792 |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2793 /* The most common case is that a non-constant symbol with a trivial |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2794 value. Make that as fast as we can. */ |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2795 if (!MISCP (XSYMBOL (symbol)->value) |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2796 && !EQ (symbol, Qnil) |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2797 && !EQ (symbol, Qt) |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2798 && !(XSYMBOL (symbol)->name->data[0] == ':' |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2799 && EQ (XSYMBOL (symbol)->obarray, initial_obarray) |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2800 && !EQ (value, symbol))) |
|
27295
1e2af531f308
(specbind): Record buffer-local variables specially,
Richard M. Stallman <rms@gnu.org>
parents:
27226
diff
changeset
|
2801 { |
|
27781
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2802 specpdl_ptr->symbol = symbol; |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2803 specpdl_ptr->old_value = XSYMBOL (symbol)->value; |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2804 specpdl_ptr->func = NULL; |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2805 ++specpdl_ptr; |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2806 XSYMBOL (symbol)->value = value; |
|
27295
1e2af531f308
(specbind): Record buffer-local variables specially,
Richard M. Stallman <rms@gnu.org>
parents:
27226
diff
changeset
|
2807 } |
|
1e2af531f308
(specbind): Record buffer-local variables specially,
Richard M. Stallman <rms@gnu.org>
parents:
27226
diff
changeset
|
2808 else |
|
27781
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2809 { |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2810 ovalue = find_symbol_value (symbol); |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2811 specpdl_ptr->func = 0; |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2812 specpdl_ptr->old_value = ovalue; |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2813 |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2814 if (BUFFER_LOCAL_VALUEP (XSYMBOL (symbol)->value) |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2815 || SOME_BUFFER_LOCAL_VALUEP (XSYMBOL (symbol)->value) |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2816 || BUFFER_OBJFWDP (XSYMBOL (symbol)->value)) |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2817 { |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2818 Lisp_Object current_buffer, binding_buffer; |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2819 /* For a local variable, record both the symbol and which |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2820 buffer's value we are saving. */ |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2821 current_buffer = Fcurrent_buffer (); |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2822 binding_buffer = current_buffer; |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2823 /* If the variable is not local in this buffer, |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2824 we are saving the global value, so restore that. */ |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2825 if (NILP (Flocal_variable_p (symbol, binding_buffer))) |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2826 binding_buffer = Qnil; |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2827 specpdl_ptr->symbol |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2828 = Fcons (symbol, Fcons (binding_buffer, current_buffer)); |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2829 } |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2830 else |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2831 specpdl_ptr->symbol = symbol; |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2832 |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2833 specpdl_ptr++; |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2834 if (BUFFER_OBJFWDP (ovalue) || KBOARD_OBJFWDP (ovalue)) |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2835 store_symval_forwarding (symbol, ovalue, value); |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2836 else |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2837 set_internal (symbol, value, 0, 1); |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2838 } |
| 272 | 2839 } |
| 2840 | |
| 2841 void | |
| 2842 record_unwind_protect (function, arg) | |
|
20312
d75a1b915e20
(record_unwind_protect): Protoize parameter.
Andreas Schwab <schwab@suse.de>
parents:
19544
diff
changeset
|
2843 Lisp_Object (*function) P_ ((Lisp_Object)); |
| 272 | 2844 Lisp_Object arg; |
| 2845 { | |
| 2846 if (specpdl_ptr == specpdl + specpdl_size) | |
| 2847 grow_specpdl (); | |
| 2848 specpdl_ptr->func = function; | |
| 2849 specpdl_ptr->symbol = Qnil; | |
| 2850 specpdl_ptr->old_value = arg; | |
| 2851 specpdl_ptr++; | |
| 2852 } | |
| 2853 | |
| 2854 Lisp_Object | |
| 2855 unbind_to (count, value) | |
| 2856 int count; | |
| 2857 Lisp_Object value; | |
| 2858 { | |
| 485 | 2859 int quitf = !NILP (Vquit_flag); |
| 272 | 2860 struct gcpro gcpro1; |
| 2861 | |
| 2862 GCPRO1 (value); | |
| 2863 Vquit_flag = Qnil; | |
| 2864 | |
| 2865 while (specpdl_ptr != specpdl + count) | |
| 2866 { | |
| 2867 --specpdl_ptr; | |
|
27781
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2868 |
| 272 | 2869 if (specpdl_ptr->func != 0) |
| 2870 (*specpdl_ptr->func) (specpdl_ptr->old_value); | |
| 2871 /* Note that a "binding" of nil is really an unwind protect, | |
|
27295
1e2af531f308
(specbind): Record buffer-local variables specially,
Richard M. Stallman <rms@gnu.org>
parents:
27226
diff
changeset
|
2872 so in that case the "old value" is a list of forms to evaluate. */ |
| 485 | 2873 else if (NILP (specpdl_ptr->symbol)) |
| 272 | 2874 Fprogn (specpdl_ptr->old_value); |
|
27704
e809aae28ae6
(specbind): For buffer-local value, record the current buffer also.
Richard M. Stallman <rms@gnu.org>
parents:
27554
diff
changeset
|
2875 /* If the symbol is a list, it is really |
|
e809aae28ae6
(specbind): For buffer-local value, record the current buffer also.
Richard M. Stallman <rms@gnu.org>
parents:
27554
diff
changeset
|
2876 (SYMBOL BINDING_BUFFER . CURRENT_BUFFER) |
|
e809aae28ae6
(specbind): For buffer-local value, record the current buffer also.
Richard M. Stallman <rms@gnu.org>
parents:
27554
diff
changeset
|
2877 and it indicates we bound a variable that has |
|
e809aae28ae6
(specbind): For buffer-local value, record the current buffer also.
Richard M. Stallman <rms@gnu.org>
parents:
27554
diff
changeset
|
2878 buffer-local bindings. */ |
|
27295
1e2af531f308
(specbind): Record buffer-local variables specially,
Richard M. Stallman <rms@gnu.org>
parents:
27226
diff
changeset
|
2879 else if (CONSP (specpdl_ptr->symbol)) |
|
1e2af531f308
(specbind): Record buffer-local variables specially,
Richard M. Stallman <rms@gnu.org>
parents:
27226
diff
changeset
|
2880 { |
|
1e2af531f308
(specbind): Record buffer-local variables specially,
Richard M. Stallman <rms@gnu.org>
parents:
27226
diff
changeset
|
2881 Lisp_Object symbol, buffer; |
|
1e2af531f308
(specbind): Record buffer-local variables specially,
Richard M. Stallman <rms@gnu.org>
parents:
27226
diff
changeset
|
2882 |
|
1e2af531f308
(specbind): Record buffer-local variables specially,
Richard M. Stallman <rms@gnu.org>
parents:
27226
diff
changeset
|
2883 symbol = XCAR (specpdl_ptr->symbol); |
|
27704
e809aae28ae6
(specbind): For buffer-local value, record the current buffer also.
Richard M. Stallman <rms@gnu.org>
parents:
27554
diff
changeset
|
2884 buffer = XCAR (XCDR (specpdl_ptr->symbol)); |
|
27295
1e2af531f308
(specbind): Record buffer-local variables specially,
Richard M. Stallman <rms@gnu.org>
parents:
27226
diff
changeset
|
2885 |
|
1e2af531f308
(specbind): Record buffer-local variables specially,
Richard M. Stallman <rms@gnu.org>
parents:
27226
diff
changeset
|
2886 /* Handle restoring a default value. */ |
|
1e2af531f308
(specbind): Record buffer-local variables specially,
Richard M. Stallman <rms@gnu.org>
parents:
27226
diff
changeset
|
2887 if (NILP (buffer)) |
|
1e2af531f308
(specbind): Record buffer-local variables specially,
Richard M. Stallman <rms@gnu.org>
parents:
27226
diff
changeset
|
2888 Fset_default (symbol, specpdl_ptr->old_value); |
|
1e2af531f308
(specbind): Record buffer-local variables specially,
Richard M. Stallman <rms@gnu.org>
parents:
27226
diff
changeset
|
2889 /* Handle restoring a value saved from a live buffer. */ |
|
1e2af531f308
(specbind): Record buffer-local variables specially,
Richard M. Stallman <rms@gnu.org>
parents:
27226
diff
changeset
|
2890 else |
|
1e2af531f308
(specbind): Record buffer-local variables specially,
Richard M. Stallman <rms@gnu.org>
parents:
27226
diff
changeset
|
2891 set_internal (symbol, specpdl_ptr->old_value, XBUFFER (buffer), 1); |
|
1e2af531f308
(specbind): Record buffer-local variables specially,
Richard M. Stallman <rms@gnu.org>
parents:
27226
diff
changeset
|
2892 } |
| 272 | 2893 else |
|
27781
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2894 { |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2895 /* If variable has a trivial value (no forwarding), we can |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2896 just set it. No need to check for constant symbols here, |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2897 since that was already done by specbind. */ |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2898 if (!MISCP (XSYMBOL (specpdl_ptr->symbol)->value)) |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2899 XSYMBOL (specpdl_ptr->symbol)->value = specpdl_ptr->old_value; |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2900 else |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2901 set_internal (specpdl_ptr->symbol, specpdl_ptr->old_value, 0, 1); |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2902 } |
| 272 | 2903 } |
|
27781
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2904 |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2905 if (NILP (Vquit_flag) && quitf) |
|
f84c7b8308c5
(funcall_lambda): Don't bind Qmocklisp_arguments unless
Gerd Moellmann <gerd@gnu.org>
parents:
27704
diff
changeset
|
2906 Vquit_flag = Qt; |
| 272 | 2907 |
| 2908 UNGCPRO; | |
| 2909 return value; | |
| 2910 } | |
| 2911 | |
| 2912 #if 0 | |
| 2913 | |
| 2914 /* Get the value of symbol's global binding, even if that binding | |
| 2915 is not now dynamically visible. */ | |
| 2916 | |
| 2917 Lisp_Object | |
| 2918 top_level_value (symbol) | |
| 2919 Lisp_Object symbol; | |
| 2920 { | |
| 2921 register struct specbinding *ptr = specpdl; | |
| 2922 | |
| 2923 CHECK_SYMBOL (symbol, 0); | |
| 2924 for (; ptr != specpdl_ptr; ptr++) | |
| 2925 { | |
| 2926 if (EQ (ptr->symbol, symbol)) | |
| 2927 return ptr->old_value; | |
| 2928 } | |
| 2929 return Fsymbol_value (symbol); | |
| 2930 } | |
| 2931 | |
| 2932 Lisp_Object | |
| 2933 top_level_set (symbol, newval) | |
| 2934 Lisp_Object symbol, newval; | |
| 2935 { | |
| 2936 register struct specbinding *ptr = specpdl; | |
| 2937 | |
| 2938 CHECK_SYMBOL (symbol, 0); | |
| 2939 for (; ptr != specpdl_ptr; ptr++) | |
| 2940 { | |
| 2941 if (EQ (ptr->symbol, symbol)) | |
| 2942 { | |
| 2943 ptr->old_value = newval; | |
| 2944 return newval; | |
| 2945 } | |
| 2946 } | |
| 2947 return Fset (symbol, newval); | |
| 2948 } | |
| 2949 | |
| 2950 #endif /* 0 */ | |
| 2951 | |
| 2952 DEFUN ("backtrace-debug", Fbacktrace_debug, Sbacktrace_debug, 2, 2, 0, | |
| 2953 "Set the debug-on-exit flag of eval frame LEVEL levels down to FLAG.\n\ | |
| 2954 The debugger is entered when that frame exits, if the flag is non-nil.") | |
| 2955 (level, flag) | |
| 2956 Lisp_Object level, flag; | |
| 2957 { | |
| 2958 register struct backtrace *backlist = backtrace_list; | |
| 2959 register int i; | |
| 2960 | |
| 2961 CHECK_NUMBER (level, 0); | |
| 2962 | |
| 2963 for (i = 0; backlist && i < XINT (level); i++) | |
| 2964 { | |
| 2965 backlist = backlist->next; | |
| 2966 } | |
| 2967 | |
| 2968 if (backlist) | |
| 485 | 2969 backlist->debug_on_exit = !NILP (flag); |
| 272 | 2970 |
| 2971 return flag; | |
| 2972 } | |
| 2973 | |
| 2974 DEFUN ("backtrace", Fbacktrace, Sbacktrace, 0, 0, "", | |
| 2975 "Print a trace of Lisp function calls currently active.\n\ | |
| 2976 Output stream used is value of `standard-output'.") | |
| 2977 () | |
| 2978 { | |
| 2979 register struct backtrace *backlist = backtrace_list; | |
| 2980 register int i; | |
| 2981 Lisp_Object tail; | |
| 2982 Lisp_Object tem; | |
| 2983 extern Lisp_Object Vprint_level; | |
| 2984 struct gcpro gcpro1; | |
| 2985 | |
|
9306
ac852c183fa1
(Feval, Ffuncall, funcall_lambda, Fbacktrace): Don't use XFASTINT as an
Karl Heuer <kwzh@gnu.org>
parents:
9148
diff
changeset
|
2986 XSETFASTINT (Vprint_level, 3); |
| 272 | 2987 |
| 2988 tail = Qnil; | |
| 2989 GCPRO1 (tail); | |
| 2990 | |
| 2991 while (backlist) | |
| 2992 { | |
| 2993 write_string (backlist->debug_on_exit ? "* " : " ", 2); | |
| 2994 if (backlist->nargs == UNEVALLED) | |
| 2995 { | |
| 2996 Fprin1 (Fcons (*backlist->function, *backlist->args), Qnil); | |
|
7533
62e3e25bc8f6
(Fbacktrace): Properly nest parentheses.
Karl Heuer <kwzh@gnu.org>
parents:
7511
diff
changeset
|
2997 write_string ("\n", -1); |
| 272 | 2998 } |
| 2999 else | |
| 3000 { | |
| 3001 tem = *backlist->function; | |
| 3002 Fprin1 (tem, Qnil); /* This can QUIT */ | |
| 3003 write_string ("(", -1); | |
| 3004 if (backlist->nargs == MANY) | |
| 3005 { | |
| 3006 for (tail = *backlist->args, i = 0; | |
| 485 | 3007 !NILP (tail); |
| 272 | 3008 tail = Fcdr (tail), i++) |
| 3009 { | |
| 3010 if (i) write_string (" ", -1); | |
| 3011 Fprin1 (Fcar (tail), Qnil); | |
| 3012 } | |
| 3013 } | |
| 3014 else | |
| 3015 { | |
| 3016 for (i = 0; i < backlist->nargs; i++) | |
| 3017 { | |
| 3018 if (i) write_string (" ", -1); | |
| 3019 Fprin1 (backlist->args[i], Qnil); | |
| 3020 } | |
| 3021 } | |
|
7533
62e3e25bc8f6
(Fbacktrace): Properly nest parentheses.
Karl Heuer <kwzh@gnu.org>
parents:
7511
diff
changeset
|
3022 write_string (")\n", -1); |
| 272 | 3023 } |
| 3024 backlist = backlist->next; | |
| 3025 } | |
| 3026 | |
| 3027 Vprint_level = Qnil; | |
| 3028 UNGCPRO; | |
| 3029 return Qnil; | |
| 3030 } | |
| 3031 | |
| 3032 DEFUN ("backtrace-frame", Fbacktrace_frame, Sbacktrace_frame, 1, 1, "", | |
|
14073
0df4b4f2a2a1
(Fmacroexpand, Fthrow, Fbacktrace_frame): Harmonize arguments with
Erik Naggum <erik@naggum.no>
parents:
13945
diff
changeset
|
3033 "Return the function and arguments NFRAMES up from current execution point.\n\ |
| 272 | 3034 If that frame has not evaluated the arguments yet (or is a special form),\n\ |
| 3035 the value is (nil FUNCTION ARG-FORMS...).\n\ | |
| 3036 If that frame has evaluated its arguments and called its function already,\n\ | |
| 3037 the value is (t FUNCTION ARG-VALUES...).\n\ | |
| 3038 A &rest arg is represented as the tail of the list ARG-VALUES.\n\ | |
| 3039 FUNCTION is whatever was supplied as car of evaluated list,\n\ | |
| 3040 or a lambda expression for macro calls.\n\ | |
|
14073
0df4b4f2a2a1
(Fmacroexpand, Fthrow, Fbacktrace_frame): Harmonize arguments with
Erik Naggum <erik@naggum.no>
parents:
13945
diff
changeset
|
3041 If NFRAMES is more than the number of frames, the value is nil.") |
| 272 | 3042 (nframes) |
| 3043 Lisp_Object nframes; | |
| 3044 { | |
| 3045 register struct backtrace *backlist = backtrace_list; | |
| 3046 register int i; | |
| 3047 Lisp_Object tem; | |
| 3048 | |
| 3049 CHECK_NATNUM (nframes, 0); | |
| 3050 | |
| 3051 /* Find the frame requested. */ | |
|
7533
62e3e25bc8f6
(Fbacktrace): Properly nest parentheses.
Karl Heuer <kwzh@gnu.org>
parents:
7511
diff
changeset
|
3052 for (i = 0; backlist && i < XFASTINT (nframes); i++) |
| 272 | 3053 backlist = backlist->next; |
| 3054 | |
| 3055 if (!backlist) | |
| 3056 return Qnil; | |
| 3057 if (backlist->nargs == UNEVALLED) | |
| 3058 return Fcons (Qnil, Fcons (*backlist->function, *backlist->args)); | |
| 3059 else | |
| 3060 { | |
| 3061 if (backlist->nargs == MANY) | |
| 3062 tem = *backlist->args; | |
| 3063 else | |
| 3064 tem = Flist (backlist->nargs, backlist->args); | |
| 3065 | |
| 3066 return Fcons (Qt, Fcons (*backlist->function, tem)); | |
| 3067 } | |
| 3068 } | |
| 3069 | |
| 21514 | 3070 void |
| 272 | 3071 syms_of_eval () |
| 3072 { | |
| 3073 DEFVAR_INT ("max-specpdl-size", &max_specpdl_size, | |
|
18920
9c03cae980ed
(syms_of_eval): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18636
diff
changeset
|
3074 "*Limit on number of Lisp variable bindings & unwind-protects.\n\ |
|
9c03cae980ed
(syms_of_eval): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18636
diff
changeset
|
3075 If Lisp code tries to make more than this many at once,\n\ |
|
9c03cae980ed
(syms_of_eval): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18636
diff
changeset
|
3076 an error is signaled."); |
| 272 | 3077 |
| 3078 DEFVAR_INT ("max-lisp-eval-depth", &max_lisp_eval_depth, | |
|
18920
9c03cae980ed
(syms_of_eval): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18636
diff
changeset
|
3079 "*Limit on depth in `eval', `apply' and `funcall' before error.\n\ |
| 272 | 3080 This limit is to catch infinite recursions for you before they cause\n\ |
| 3081 actual stack overflow in C, which would be fatal for Emacs.\n\ | |
| 3082 You can safely make it considerably larger than its default value,\n\ | |
| 3083 if that proves inconveniently small."); | |
| 3084 | |
| 3085 DEFVAR_LISP ("quit-flag", &Vquit_flag, | |
| 3086 "Non-nil causes `eval' to abort, unless `inhibit-quit' is non-nil.\n\ | |
|
7511
9ec3fc16ab3a
(syms_of_eval): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
7353
diff
changeset
|
3087 Typing C-g sets `quit-flag' non-nil, regardless of `inhibit-quit'."); |
| 272 | 3088 Vquit_flag = Qnil; |
| 3089 | |
| 3090 DEFVAR_LISP ("inhibit-quit", &Vinhibit_quit, | |
| 3091 "Non-nil inhibits C-g quitting from happening immediately.\n\ | |
| 3092 Note that `quit-flag' will still be set by typing C-g,\n\ | |
|
13945
6a653c300631
(syms_of_eval): Doc fix for inhibit-quit.
Karl Heuer <kwzh@gnu.org>
parents:
13768
diff
changeset
|
3093 so a quit will be signaled as soon as `inhibit-quit' is nil.\n\ |
| 272 | 3094 To prevent this happening, set `quit-flag' to nil\n\ |
| 3095 before making `inhibit-quit' nil."); | |
| 3096 Vinhibit_quit = Qnil; | |
| 3097 | |
| 381 | 3098 Qinhibit_quit = intern ("inhibit-quit"); |
| 3099 staticpro (&Qinhibit_quit); | |
| 3100 | |
| 272 | 3101 Qautoload = intern ("autoload"); |
| 3102 staticpro (&Qautoload); | |
| 3103 | |
| 3104 Qdebug_on_error = intern ("debug-on-error"); | |
| 3105 staticpro (&Qdebug_on_error); | |
| 3106 | |
| 3107 Qmacro = intern ("macro"); | |
| 3108 staticpro (&Qmacro); | |
| 3109 | |
| 3110 /* Note that the process handling also uses Qexit, but we don't want | |
| 3111 to staticpro it twice, so we just do it here. */ | |
| 3112 Qexit = intern ("exit"); | |
| 3113 staticpro (&Qexit); | |
| 3114 | |
| 3115 Qinteractive = intern ("interactive"); | |
| 3116 staticpro (&Qinteractive); | |
| 3117 | |
| 3118 Qcommandp = intern ("commandp"); | |
| 3119 staticpro (&Qcommandp); | |
| 3120 | |
| 3121 Qdefun = intern ("defun"); | |
| 3122 staticpro (&Qdefun); | |
| 3123 | |
| 3124 Qand_rest = intern ("&rest"); | |
| 3125 staticpro (&Qand_rest); | |
| 3126 | |
| 3127 Qand_optional = intern ("&optional"); | |
| 3128 staticpro (&Qand_optional); | |
| 3129 | |
| 684 | 3130 DEFVAR_LISP ("stack-trace-on-error", &Vstack_trace_on_error, |
| 272 | 3131 "*Non-nil means automatically display a backtrace buffer\n\ |
| 684 | 3132 after any error that is handled by the editor command loop.\n\ |
| 3133 If the value is a list, an error only means to display a backtrace\n\ | |
| 3134 if one of its condition symbols appears in the list."); | |
| 3135 Vstack_trace_on_error = Qnil; | |
| 272 | 3136 |
| 684 | 3137 DEFVAR_LISP ("debug-on-error", &Vdebug_on_error, |
| 272 | 3138 "*Non-nil means enter debugger if an error is signaled.\n\ |
| 3139 Does not apply to errors handled by `condition-case'.\n\ | |
| 684 | 3140 If the value is a list, an error only means to enter the debugger\n\ |
| 3141 if one of its condition symbols appears in the list.\n\ | |
| 272 | 3142 See also variable `debug-on-quit'."); |
| 684 | 3143 Vdebug_on_error = Qnil; |
| 272 | 3144 |
| 13768 | 3145 DEFVAR_LISP ("debug-ignored-errors", &Vdebug_ignored_errors, |
| 3146 "*List of errors for which the debugger should not be called.\n\ | |
| 3147 Each element may be a condition-name or a regexp that matches error messages.\n\ | |
| 3148 If any element applies to a given error, that error skips the debugger\n\ | |
| 3149 and just returns to top level.\n\ | |
| 3150 This overrides the variable `debug-on-error'.\n\ | |
| 3151 It does not apply to errors handled by `condition-case'."); | |
| 3152 Vdebug_ignored_errors = Qnil; | |
| 3153 | |
| 272 | 3154 DEFVAR_BOOL ("debug-on-quit", &debug_on_quit, |
|
7511
9ec3fc16ab3a
(syms_of_eval): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
7353
diff
changeset
|
3155 "*Non-nil means enter debugger if quit is signaled (C-g, for example).\n\ |
| 940 | 3156 Does not apply if quit is handled by a `condition-case'."); |
| 272 | 3157 debug_on_quit = 0; |
| 3158 | |
| 3159 DEFVAR_BOOL ("debug-on-next-call", &debug_on_next_call, | |
| 3160 "Non-nil means enter debugger before next `eval', `apply' or `funcall'."); | |
| 3161 | |
|
26947
7987a6499aaa
(debugger_may_continue): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
26764
diff
changeset
|
3162 DEFVAR_BOOL ("debugger-may-continue", &debugger_may_continue, |
|
7987a6499aaa
(debugger_may_continue): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
26764
diff
changeset
|
3163 "Non-nil means debugger may continue execution.\n\ |
|
7987a6499aaa
(debugger_may_continue): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
26764
diff
changeset
|
3164 This is nil when the debugger is called under circumstances where it\n\ |
|
7987a6499aaa
(debugger_may_continue): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
26764
diff
changeset
|
3165 might not be safe to continue."); |
|
27031
083866c85a33
(syms_of_eval): Initialize debug_may_continue.
Gerd Moellmann <gerd@gnu.org>
parents:
26947
diff
changeset
|
3166 debugger_may_continue = 1; |
|
26947
7987a6499aaa
(debugger_may_continue): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
26764
diff
changeset
|
3167 |
| 272 | 3168 DEFVAR_LISP ("debugger", &Vdebugger, |
| 3169 "Function to call to invoke debugger.\n\ | |
| 3170 If due to frame exit, args are `exit' and the value being returned;\n\ | |
| 3171 this function's value will be returned instead of that.\n\ | |
| 3172 If due to error, args are `error' and a list of the args to `signal'.\n\ | |
| 3173 If due to `apply' or `funcall' entry, one arg, `lambda'.\n\ | |
| 3174 If due to `eval' entry, one arg, t."); | |
| 3175 Vdebugger = Qnil; | |
| 3176 | |
|
16355
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
3177 DEFVAR_LISP ("signal-hook-function", &Vsignal_hook_function, |
|
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
3178 "If non-nil, this is a function for `signal' to call.\n\ |
|
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
3179 It receives the same arguments that `signal' was given.\n\ |
|
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
3180 The Edebug package uses this to regain control."); |
|
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
3181 Vsignal_hook_function = Qnil; |
|
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
3182 |
| 272 | 3183 Qmocklisp_arguments = intern ("mocklisp-arguments"); |
| 3184 staticpro (&Qmocklisp_arguments); | |
| 3185 DEFVAR_LISP ("mocklisp-arguments", &Vmocklisp_arguments, | |
| 3186 "While in a mocklisp function, the list of its unevaluated args."); | |
| 3187 Vmocklisp_arguments = Qt; | |
| 3188 | |
|
16443
0128b923d281
(Vdebug_on_signal): Renamed from Vdebug_force.
Richard M. Stallman <rms@gnu.org>
parents:
16355
diff
changeset
|
3189 DEFVAR_LISP ("debug-on-signal", &Vdebug_on_signal, |
|
16355
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
3190 "*Non-nil means call the debugger regardless of condition handlers.\n\ |
|
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
3191 Note that `debug-on-error', `debug-on-quit' and friends\n\ |
|
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
3192 still determine whether to handle the particular condition."); |
|
16443
0128b923d281
(Vdebug_on_signal): Renamed from Vdebug_force.
Richard M. Stallman <rms@gnu.org>
parents:
16355
diff
changeset
|
3193 Vdebug_on_signal = Qnil; |
|
16355
1d85b2698564
(Vdebug_force): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16296
diff
changeset
|
3194 |
|
16296
584310941e70
(syms_of_eval): Initialize Vrun_hooks here.
Richard M. Stallman <rms@gnu.org>
parents:
16113
diff
changeset
|
3195 Vrun_hooks = intern ("run-hooks"); |
|
584310941e70
(syms_of_eval): Initialize Vrun_hooks here.
Richard M. Stallman <rms@gnu.org>
parents:
16113
diff
changeset
|
3196 staticpro (&Vrun_hooks); |
| 272 | 3197 |
| 3198 staticpro (&Vautoload_queue); | |
| 3199 Vautoload_queue = Qnil; | |
| 3200 | |
| 3201 defsubr (&Sor); | |
| 3202 defsubr (&Sand); | |
| 3203 defsubr (&Sif); | |
| 3204 defsubr (&Scond); | |
| 3205 defsubr (&Sprogn); | |
| 3206 defsubr (&Sprog1); | |
| 3207 defsubr (&Sprog2); | |
| 3208 defsubr (&Ssetq); | |
| 3209 defsubr (&Squote); | |
| 3210 defsubr (&Sfunction); | |
| 3211 defsubr (&Sdefun); | |
| 3212 defsubr (&Sdefmacro); | |
| 3213 defsubr (&Sdefvar); | |
| 3214 defsubr (&Sdefconst); | |
| 3215 defsubr (&Suser_variable_p); | |
| 3216 defsubr (&Slet); | |
| 3217 defsubr (&SletX); | |
| 3218 defsubr (&Swhile); | |
| 3219 defsubr (&Smacroexpand); | |
| 3220 defsubr (&Scatch); | |
| 3221 defsubr (&Sthrow); | |
| 3222 defsubr (&Sunwind_protect); | |
| 3223 defsubr (&Scondition_case); | |
| 3224 defsubr (&Ssignal); | |
| 3225 defsubr (&Sinteractive_p); | |
| 3226 defsubr (&Scommandp); | |
| 3227 defsubr (&Sautoload); | |
| 3228 defsubr (&Seval); | |
| 3229 defsubr (&Sapply); | |
|
12732
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
3230 defsubr (&Sfuncall); |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
3231 defsubr (&Srun_hooks); |
|
12711
a8feaa42d775
(syms_of_eval): Add missing defsubr.
Karl Heuer <kwzh@gnu.org>
parents:
12663
diff
changeset
|
3232 defsubr (&Srun_hook_with_args); |
|
12732
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
3233 defsubr (&Srun_hook_with_args_until_success); |
|
981b924c832b
Add Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success, Frun_hook_with_args_until_failure in terms of run_hook_with_args.
Simon Marshall <simon@gnu.org>
parents:
12711
diff
changeset
|
3234 defsubr (&Srun_hook_with_args_until_failure); |
|
11205
81a008df9184
(Ffetch_bytecode): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11007
diff
changeset
|
3235 defsubr (&Sfetch_bytecode); |
| 272 | 3236 defsubr (&Sbacktrace_debug); |
| 3237 defsubr (&Sbacktrace); | |
| 3238 defsubr (&Sbacktrace_frame); | |
| 3239 } |
