aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c42
1 files changed, 12 insertions, 30 deletions
diff --git a/src/eval.c b/src/eval.c
index 8a8a507a1b6..1c565e233c6 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -19,7 +19,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#include <config.h> 20#include <config.h>
21#include <limits.h> 21#include <limits.h>
22#include <setjmp.h>
23#include <stdio.h> 22#include <stdio.h>
24#include "lisp.h" 23#include "lisp.h"
25#include "blockinput.h" 24#include "blockinput.h"
@@ -118,12 +117,6 @@ static EMACS_INT when_entered_debugger;
118 117
119Lisp_Object Vsignaling_function; 118Lisp_Object Vsignaling_function;
120 119
121/* Set to non-zero while processing X events. Checked in Feval to
122 make sure the Lisp interpreter isn't called from a signal handler,
123 which is unsafe because the interpreter isn't reentrant. */
124
125int handling_signal;
126
127/* If non-nil, Lisp code must not be run since some part of Emacs is 120/* If non-nil, Lisp code must not be run since some part of Emacs is
128 in an inconsistent state. Currently, x-create-frame uses this to 121 in an inconsistent state. Currently, x-create-frame uses this to
129 avoid triggering window-configuration-change-hook while the new 122 avoid triggering window-configuration-change-hook while the new
@@ -707,7 +700,7 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
707 else 700 else
708 { /* Check if there is really a global binding rather than just a let 701 { /* Check if there is really a global binding rather than just a let
709 binding that shadows the global unboundness of the var. */ 702 binding that shadows the global unboundness of the var. */
710 volatile struct specbinding *pdl = specpdl_ptr; 703 struct specbinding *pdl = specpdl_ptr;
711 while (pdl > specpdl) 704 while (pdl > specpdl)
712 { 705 {
713 if (EQ ((--pdl)->symbol, sym) && !pdl->func 706 if (EQ ((--pdl)->symbol, sym) && !pdl->func
@@ -1072,7 +1065,7 @@ internal_catch (Lisp_Object tag, Lisp_Object (*func) (Lisp_Object), Lisp_Object
1072 catchlist = &c; 1065 catchlist = &c;
1073 1066
1074 /* Call FUNC. */ 1067 /* Call FUNC. */
1075 if (! _setjmp (c.jmp)) 1068 if (! sys_setjmp (c.jmp))
1076 c.val = (*func) (arg); 1069 c.val = (*func) (arg);
1077 1070
1078 /* Throw works by a longjmp that comes right here. */ 1071 /* Throw works by a longjmp that comes right here. */
@@ -1107,7 +1100,6 @@ unwind_to_catch (struct catchtag *catch, Lisp_Object value)
1107 /* Restore certain special C variables. */ 1100 /* Restore certain special C variables. */
1108 set_poll_suppress_count (catch->poll_suppress_count); 1101 set_poll_suppress_count (catch->poll_suppress_count);
1109 UNBLOCK_INPUT_TO (catch->interrupt_input_blocked); 1102 UNBLOCK_INPUT_TO (catch->interrupt_input_blocked);
1110 handling_signal = 0;
1111 immediate_quit = 0; 1103 immediate_quit = 0;
1112 1104
1113 do 1105 do
@@ -1140,7 +1132,7 @@ unwind_to_catch (struct catchtag *catch, Lisp_Object value)
1140 backtrace_list = catch->backlist; 1132 backtrace_list = catch->backlist;
1141 lisp_eval_depth = catch->lisp_eval_depth; 1133 lisp_eval_depth = catch->lisp_eval_depth;
1142 1134
1143 _longjmp (catch->jmp, 1); 1135 sys_longjmp (catch->jmp, 1);
1144} 1136}
1145 1137
1146DEFUN ("throw", Fthrow, Sthrow, 2, 2, 0, 1138DEFUN ("throw", Fthrow, Sthrow, 2, 2, 0,
@@ -1204,12 +1196,9 @@ See also the function `signal' for more info.
1204usage: (condition-case VAR BODYFORM &rest HANDLERS) */) 1196usage: (condition-case VAR BODYFORM &rest HANDLERS) */)
1205 (Lisp_Object args) 1197 (Lisp_Object args)
1206{ 1198{
1207 register Lisp_Object bodyform, handlers; 1199 Lisp_Object var = Fcar (args);
1208 volatile Lisp_Object var; 1200 Lisp_Object bodyform = Fcar (Fcdr (args));
1209 1201 Lisp_Object handlers = Fcdr (Fcdr (args));
1210 var = Fcar (args);
1211 bodyform = Fcar (Fcdr (args));
1212 handlers = Fcdr (Fcdr (args));
1213 1202
1214 return internal_lisp_condition_case (var, bodyform, handlers); 1203 return internal_lisp_condition_case (var, bodyform, handlers);
1215} 1204}
@@ -1249,7 +1238,7 @@ internal_lisp_condition_case (volatile Lisp_Object var, Lisp_Object bodyform,
1249 c.interrupt_input_blocked = interrupt_input_blocked; 1238 c.interrupt_input_blocked = interrupt_input_blocked;
1250 c.gcpro = gcprolist; 1239 c.gcpro = gcprolist;
1251 c.byte_stack = byte_stack_list; 1240 c.byte_stack = byte_stack_list;
1252 if (_setjmp (c.jmp)) 1241 if (sys_setjmp (c.jmp))
1253 { 1242 {
1254 if (!NILP (h.var)) 1243 if (!NILP (h.var))
1255 specbind (h.var, c.val); 1244 specbind (h.var, c.val);
@@ -1304,7 +1293,7 @@ internal_condition_case (Lisp_Object (*bfun) (void), Lisp_Object handlers,
1304 c.interrupt_input_blocked = interrupt_input_blocked; 1293 c.interrupt_input_blocked = interrupt_input_blocked;
1305 c.gcpro = gcprolist; 1294 c.gcpro = gcprolist;
1306 c.byte_stack = byte_stack_list; 1295 c.byte_stack = byte_stack_list;
1307 if (_setjmp (c.jmp)) 1296 if (sys_setjmp (c.jmp))
1308 { 1297 {
1309 return (*hfun) (c.val); 1298 return (*hfun) (c.val);
1310 } 1299 }
@@ -1342,7 +1331,7 @@ internal_condition_case_1 (Lisp_Object (*bfun) (Lisp_Object), Lisp_Object arg,
1342 c.interrupt_input_blocked = interrupt_input_blocked; 1331 c.interrupt_input_blocked = interrupt_input_blocked;
1343 c.gcpro = gcprolist; 1332 c.gcpro = gcprolist;
1344 c.byte_stack = byte_stack_list; 1333 c.byte_stack = byte_stack_list;
1345 if (_setjmp (c.jmp)) 1334 if (sys_setjmp (c.jmp))
1346 { 1335 {
1347 return (*hfun) (c.val); 1336 return (*hfun) (c.val);
1348 } 1337 }
@@ -1384,7 +1373,7 @@ internal_condition_case_2 (Lisp_Object (*bfun) (Lisp_Object, Lisp_Object),
1384 c.interrupt_input_blocked = interrupt_input_blocked; 1373 c.interrupt_input_blocked = interrupt_input_blocked;
1385 c.gcpro = gcprolist; 1374 c.gcpro = gcprolist;
1386 c.byte_stack = byte_stack_list; 1375 c.byte_stack = byte_stack_list;
1387 if (_setjmp (c.jmp)) 1376 if (sys_setjmp (c.jmp))
1388 { 1377 {
1389 return (*hfun) (c.val); 1378 return (*hfun) (c.val);
1390 } 1379 }
@@ -1428,7 +1417,7 @@ internal_condition_case_n (Lisp_Object (*bfun) (ptrdiff_t, Lisp_Object *),
1428 c.interrupt_input_blocked = interrupt_input_blocked; 1417 c.interrupt_input_blocked = interrupt_input_blocked;
1429 c.gcpro = gcprolist; 1418 c.gcpro = gcprolist;
1430 c.byte_stack = byte_stack_list; 1419 c.byte_stack = byte_stack_list;
1431 if (_setjmp (c.jmp)) 1420 if (sys_setjmp (c.jmp))
1432 { 1421 {
1433 return (*hfun) (c.val, nargs, args); 1422 return (*hfun) (c.val, nargs, args);
1434 } 1423 }
@@ -1490,7 +1479,7 @@ See also the function `condition-case'. */)
1490 struct handler *h; 1479 struct handler *h;
1491 struct backtrace *bp; 1480 struct backtrace *bp;
1492 1481
1493 immediate_quit = handling_signal = 0; 1482 immediate_quit = 0;
1494 abort_on_gc = 0; 1483 abort_on_gc = 0;
1495 if (gc_in_progress || waiting_for_input) 1484 if (gc_in_progress || waiting_for_input)
1496 emacs_abort (); 1485 emacs_abort ();
@@ -2043,9 +2032,6 @@ eval_sub (Lisp_Object form)
2043 struct backtrace backtrace; 2032 struct backtrace backtrace;
2044 struct gcpro gcpro1, gcpro2, gcpro3; 2033 struct gcpro gcpro1, gcpro2, gcpro3;
2045 2034
2046 if (handling_signal)
2047 emacs_abort ();
2048
2049 if (SYMBOLP (form)) 2035 if (SYMBOLP (form))
2050 { 2036 {
2051 /* Look up its binding in the lexical environment. 2037 /* Look up its binding in the lexical environment.
@@ -3108,8 +3094,6 @@ specbind (Lisp_Object symbol, Lisp_Object value)
3108{ 3094{
3109 struct Lisp_Symbol *sym; 3095 struct Lisp_Symbol *sym;
3110 3096
3111 eassert (!handling_signal);
3112
3113 CHECK_SYMBOL (symbol); 3097 CHECK_SYMBOL (symbol);
3114 sym = XSYMBOL (symbol); 3098 sym = XSYMBOL (symbol);
3115 if (specpdl_ptr == specpdl + specpdl_size) 3099 if (specpdl_ptr == specpdl + specpdl_size)
@@ -3203,8 +3187,6 @@ specbind (Lisp_Object symbol, Lisp_Object value)
3203void 3187void
3204record_unwind_protect (Lisp_Object (*function) (Lisp_Object), Lisp_Object arg) 3188record_unwind_protect (Lisp_Object (*function) (Lisp_Object), Lisp_Object arg)
3205{ 3189{
3206 eassert (!handling_signal);
3207
3208 if (specpdl_ptr == specpdl + specpdl_size) 3190 if (specpdl_ptr == specpdl + specpdl_size)
3209 grow_specpdl (); 3191 grow_specpdl ();
3210 specpdl_ptr->func = function; 3192 specpdl_ptr->func = function;