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