aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorPaul Eggert2012-09-02 10:10:35 -0700
committerPaul Eggert2012-09-02 10:10:35 -0700
commit1882aa387874f0ac0965fa7bec1c5760dc37e48f (patch)
tree27cfcfb9f16c55a0bf84a5c91a5efd20f495ef55 /src/eval.c
parenta411ac43d3667d042fa36361275eccbe9aca80af (diff)
downloademacs-1882aa387874f0ac0965fa7bec1c5760dc37e48f.tar.gz
emacs-1882aa387874f0ac0965fa7bec1c5760dc37e48f.zip
* emacs.c, eval.c: Use bool for boolean.
* emacs.c (initialized, inhibit_window_system, running_asynch_code): (malloc_using_checking) [DOUG_LEA_MALLOC]: (display_arg) [HAVE_X_WINDOWS || HAVE_NS]: (noninteractive, no_site_lisp, fatal_error_in_progress, argmatch) (main, decode_env_path, Fdaemon_initialized): * eval.c (call_debugger, Finteractive_p, interactive_p): (unwind_to_catch, Fsignal, wants_debugger, skip_debugger) (maybe_call_debugger, Fbacktrace): * process.c (read_process_output, exec_sentinel): Use bool for booleans. * emacs.c (shut_down_emacs): Omit unused boolean argument NO_X. All callers changed. * eval.c (interactive_p): Omit always-true boolean argument EXCLUDE_SUBRS_P. All callers changed. * dispextern.h, lisp.h: Reflect above API changes. * firstfile.c (dummy): Use the address of 'main', whose signature won't change, instead of the address of 'initialize', whose signature just changed from int to bool. * lisp.h (fatal_error_in_progress): New decl of boolean, moved here ... * msdos.c (fatal_error_in_progress): ... from here. * xdisp.c (redisplaying_p): Now a boolean. Set it to 1 instead of incrementing it. (redisplay_internal, unwind_redisplay): Simply clear REDISPLAYING_P when unwinding, instead of saving its previous, always-false value and then restoring it.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c58
1 files changed, 28 insertions, 30 deletions
diff --git a/src/eval.c b/src/eval.c
index ad1daf721b8..3a4953665e3 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -131,7 +131,7 @@ int handling_signal;
131Lisp_Object inhibit_lisp_code; 131Lisp_Object inhibit_lisp_code;
132 132
133static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *); 133static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *);
134static int interactive_p (int); 134static bool interactive_p (void);
135static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args); 135static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args);
136 136
137/* Functions to set Lisp_Object slots of struct specbinding. */ 137/* Functions to set Lisp_Object slots of struct specbinding. */
@@ -194,7 +194,7 @@ restore_stack_limits (Lisp_Object data)
194static Lisp_Object 194static Lisp_Object
195call_debugger (Lisp_Object arg) 195call_debugger (Lisp_Object arg)
196{ 196{
197 int debug_while_redisplaying; 197 bool debug_while_redisplaying;
198 ptrdiff_t count = SPECPDL_INDEX (); 198 ptrdiff_t count = SPECPDL_INDEX ();
199 Lisp_Object val; 199 Lisp_Object val;
200 EMACS_INT old_max = max_specpdl_size; 200 EMACS_INT old_max = max_specpdl_size;
@@ -525,7 +525,7 @@ spec that specifies non-nil unconditionally (such as \"p\"); or (ii)
525use `called-interactively-p'. */) 525use `called-interactively-p'. */)
526 (void) 526 (void)
527{ 527{
528 return interactive_p (1) ? Qt : Qnil; 528 return interactive_p () ? Qt : Qnil;
529} 529}
530 530
531 531
@@ -550,19 +550,17 @@ non-nil unconditionally (\"p\" is a good way to do this), or via
550\(not (or executing-kbd-macro noninteractive)). */) 550\(not (or executing-kbd-macro noninteractive)). */)
551 (Lisp_Object kind) 551 (Lisp_Object kind)
552{ 552{
553 return ((INTERACTIVE || !EQ (kind, intern ("interactive"))) 553 return (((INTERACTIVE || !EQ (kind, intern ("interactive")))
554 && interactive_p (1)) ? Qt : Qnil; 554 && interactive_p ())
555 ? Qt : Qnil);
555} 556}
556 557
557 558
558/* Return 1 if function in which this appears was called using 559/* Return true if function in which this appears was called using
559 call-interactively. 560 call-interactively and is not a built-in. */
560 561
561 EXCLUDE_SUBRS_P non-zero means always return 0 if the function 562static bool
562 called is a built-in. */ 563interactive_p (void)
563
564static int
565interactive_p (int exclude_subrs_p)
566{ 564{
567 struct backtrace *btp; 565 struct backtrace *btp;
568 Lisp_Object fun; 566 Lisp_Object fun;
@@ -591,9 +589,9 @@ interactive_p (int exclude_subrs_p)
591 /* `btp' now points at the frame of the innermost function that isn't 589 /* `btp' now points at the frame of the innermost function that isn't
592 a special form, ignoring frames for Finteractive_p and/or 590 a special form, ignoring frames for Finteractive_p and/or
593 Fbytecode at the top. If this frame is for a built-in function 591 Fbytecode at the top. If this frame is for a built-in function
594 (such as load or eval-region) return nil. */ 592 (such as load or eval-region) return false. */
595 fun = Findirect_function (*btp->function, Qnil); 593 fun = Findirect_function (*btp->function, Qnil);
596 if (exclude_subrs_p && SUBRP (fun)) 594 if (SUBRP (fun))
597 return 0; 595 return 0;
598 596
599 /* `btp' points to the frame of a Lisp function that called interactive-p. 597 /* `btp' points to the frame of a Lisp function that called interactive-p.
@@ -1101,7 +1099,7 @@ internal_catch (Lisp_Object tag, Lisp_Object (*func) (Lisp_Object), Lisp_Object
1101static _Noreturn void 1099static _Noreturn void
1102unwind_to_catch (struct catchtag *catch, Lisp_Object value) 1100unwind_to_catch (struct catchtag *catch, Lisp_Object value)
1103{ 1101{
1104 int last_time; 1102 bool last_time;
1105 1103
1106 /* Save the value in the tag. */ 1104 /* Save the value in the tag. */
1107 catch->val = value; 1105 catch->val = value;
@@ -1450,8 +1448,8 @@ internal_condition_case_n (Lisp_Object (*bfun) (ptrdiff_t, Lisp_Object *),
1450 1448
1451 1449
1452static Lisp_Object find_handler_clause (Lisp_Object, Lisp_Object); 1450static Lisp_Object find_handler_clause (Lisp_Object, Lisp_Object);
1453static int maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, 1451static bool maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig,
1454 Lisp_Object data); 1452 Lisp_Object data);
1455 1453
1456void 1454void
1457process_quit_flag (void) 1455process_quit_flag (void)
@@ -1556,7 +1554,7 @@ See also the function `condition-case'. */)
1556 if requested". */ 1554 if requested". */
1557 || EQ (h->handler, Qerror))) 1555 || EQ (h->handler, Qerror)))
1558 { 1556 {
1559 int debugger_called 1557 bool debugger_called
1560 = maybe_call_debugger (conditions, error_symbol, data); 1558 = maybe_call_debugger (conditions, error_symbol, data);
1561 /* We can't return values to code which signaled an error, but we 1559 /* We can't return values to code which signaled an error, but we
1562 can continue code which has signaled a quit. */ 1560 can continue code which has signaled a quit. */
@@ -1650,10 +1648,10 @@ signal_error (const char *s, Lisp_Object arg)
1650} 1648}
1651 1649
1652 1650
1653/* Return nonzero if LIST is a non-nil atom or 1651/* Return true if LIST is a non-nil atom or
1654 a list containing one of CONDITIONS. */ 1652 a list containing one of CONDITIONS. */
1655 1653
1656static int 1654static bool
1657wants_debugger (Lisp_Object list, Lisp_Object conditions) 1655wants_debugger (Lisp_Object list, Lisp_Object conditions)
1658{ 1656{
1659 if (NILP (list)) 1657 if (NILP (list))
@@ -1673,15 +1671,15 @@ wants_debugger (Lisp_Object list, Lisp_Object conditions)
1673 return 0; 1671 return 0;
1674} 1672}
1675 1673
1676/* Return 1 if an error with condition-symbols CONDITIONS, 1674/* Return true if an error with condition-symbols CONDITIONS,
1677 and described by SIGNAL-DATA, should skip the debugger 1675 and described by SIGNAL-DATA, should skip the debugger
1678 according to debugger-ignored-errors. */ 1676 according to debugger-ignored-errors. */
1679 1677
1680static int 1678static bool
1681skip_debugger (Lisp_Object conditions, Lisp_Object data) 1679skip_debugger (Lisp_Object conditions, Lisp_Object data)
1682{ 1680{
1683 Lisp_Object tail; 1681 Lisp_Object tail;
1684 int first_string = 1; 1682 bool first_string = 1;
1685 Lisp_Object error_message; 1683 Lisp_Object error_message;
1686 1684
1687 error_message = Qnil; 1685 error_message = Qnil;
@@ -1716,7 +1714,7 @@ skip_debugger (Lisp_Object conditions, Lisp_Object data)
1716 = SIG is the error symbol, and DATA is the rest of the data. 1714 = SIG is the error symbol, and DATA is the rest of the data.
1717 = SIG is nil, and DATA is (SYMBOL . REST-OF-DATA). 1715 = SIG is nil, and DATA is (SYMBOL . REST-OF-DATA).
1718 This is for memory-full errors only. */ 1716 This is for memory-full errors only. */
1719static int 1717static bool
1720maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, Lisp_Object data) 1718maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, Lisp_Object data)
1721{ 1719{
1722 Lisp_Object combined_data; 1720 Lisp_Object combined_data;
@@ -2939,7 +2937,7 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs,
2939 Lisp_Object val, syms_left, next, lexenv; 2937 Lisp_Object val, syms_left, next, lexenv;
2940 ptrdiff_t count = SPECPDL_INDEX (); 2938 ptrdiff_t count = SPECPDL_INDEX ();
2941 ptrdiff_t i; 2939 ptrdiff_t i;
2942 int optional, rest; 2940 bool optional, rest;
2943 2941
2944 if (CONSP (fun)) 2942 if (CONSP (fun))
2945 { 2943 {
@@ -3342,13 +3340,13 @@ Output stream used is value of `standard-output'. */)
3342 write_string ("(", -1); 3340 write_string ("(", -1);
3343 if (backlist->nargs == MANY) 3341 if (backlist->nargs == MANY)
3344 { /* FIXME: Can this happen? */ 3342 { /* FIXME: Can this happen? */
3345 int i; 3343 bool later_arg = 0;
3346 for (tail = *backlist->args, i = 0; 3344 for (tail = *backlist->args; !NILP (tail); tail = Fcdr (tail))
3347 !NILP (tail);
3348 tail = Fcdr (tail), i = 1)
3349 { 3345 {
3350 if (i) write_string (" ", -1); 3346 if (later_arg)
3347 write_string (" ", -1);
3351 Fprin1 (Fcar (tail), Qnil); 3348 Fprin1 (Fcar (tail), Qnil);
3349 later_arg = 1;
3352 } 3350 }
3353 } 3351 }
3354 else 3352 else