aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2012-10-10 13:09:47 -0700
committerPaul Eggert2012-10-10 13:09:47 -0700
commit9fa1de305acd530060062a1470f3018de7937bb1 (patch)
treebb182ee666aef3b52b046d56e10ab282cad65bc9 /src
parente738ca5624ba0f3703095e0ad48b4ef7b97973bf (diff)
downloademacs-9fa1de305acd530060062a1470f3018de7937bb1.tar.gz
emacs-9fa1de305acd530060062a1470f3018de7937bb1.zip
keyboard.c, keymap.c: Use bool for booleans.
* dispnew.c (sit_for): Distinguish between 3-way display_option and boolean do_display. * keyboard.c (single_kboard, this_command_key_count_reset) (waiting_for_input, echoing, immediate_quit, input_pending) (interrupt_input, interrupts_deferred, pop_kboard) (temporarily_switch_to_single_kboard, ignore_mouse_drag_p) (command_loop_1, adjust_point_for_property) (safe_run_hooks_error, input_polling_used, read_char): (help_char_p, readable_events, kbd_buffer_events_waiting) (kbd_buffer_get_event, timer_check_2, make_lispy_event) (lucid_event_type_list_p, get_input_pending): (gobble_input, menu_separator_name_p, menu_bar_item) (parse_menu_item, parse_tool_bar_item, read_char_x_menu_prompt) (read_char_minibuf_menu_prompt, access_keymap_keyremap) (keyremap_step, test_undefined, read_key_sequence) (detect_input_pending, detect_input_pending_ignore_squeezables) (detect_input_pending_run_timers, requeued_events_pending_p) (quit_throw_to_read_char, Fset_input_interrupt_mode): * keymap.c (get_keymap, keymap_parent, keymap_memberp) (access_keymap_1, access_keymap, map_keymap, get_keyelt) (Fdefine_key, Flookup_key, struct accessible_keymaps_data) (accessible_keymaps_1, Fkey_description, push_key_description): (shadow_lookup, struct where_is_internal_data) (where_is_internal, Fwhere_is_internal, where_is_internal_1) (Fdescribe_buffer_bindings, describe_map_tree, struct describe_map_elt) (describe_map, describe_vector): * menu.c (single_menu_item): * nsmenu.m (ns_update_menubar): * process.c (wait_reading_process_output): * search.c (scan_buffer, scan_newline): Use bool for boolean. * keyboard.c (timers_run, swallow_events) (detect_input_pending_run_timers): * process.c (wait_reading_process_output): Use unsigned for counter where wraparound-on-overflow is desired, since unsigned is guaranteed to have that behavior and signed is not. (read_char): Use ptrdiff_t for string length. (get_input_pending): Remove first argument, since it was always the same pointer-to-int (now pointer-to-boolean) &input_pending, and behave as if it had that value. Return new value of input_pending. All callers changed. * keyboard.h (struct kboard): Use unsigned : 1 for boolean member immediate_echo. Use ptrdiff_t for echo_after_prompt, since it's a string length. * keymap.c (push_key_description): Omit last arg, which was always 1. All callers changed.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog48
-rw-r--r--src/dispnew.c9
-rw-r--r--src/keyboard.c312
-rw-r--r--src/keyboard.h28
-rw-r--r--src/keymap.c159
-rw-r--r--src/keymap.h13
-rw-r--r--src/lisp.h17
-rw-r--r--src/menu.c2
-rw-r--r--src/nsmenu.m2
-rw-r--r--src/process.c14
-rw-r--r--src/search.c16
-rw-r--r--src/termopts.h4
12 files changed, 319 insertions, 305 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index a05c426a452..daa370105ee 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,53 @@
12012-10-10 Paul Eggert <eggert@cs.ucla.edu> 12012-10-10 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 keyboard.c, keymap.c: Use bool for booleans.
4 * dispnew.c (sit_for): Distinguish between 3-way display_option
5 and boolean do_display.
6 * keyboard.c (single_kboard, this_command_key_count_reset)
7 (waiting_for_input, echoing, immediate_quit, input_pending)
8 (interrupt_input, interrupts_deferred, pop_kboard)
9 (temporarily_switch_to_single_kboard, ignore_mouse_drag_p)
10 (command_loop_1, adjust_point_for_property)
11 (safe_run_hooks_error, input_polling_used, read_char):
12 (help_char_p, readable_events, kbd_buffer_events_waiting)
13 (kbd_buffer_get_event, timer_check_2, make_lispy_event)
14 (lucid_event_type_list_p, get_input_pending):
15 (gobble_input, menu_separator_name_p, menu_bar_item)
16 (parse_menu_item, parse_tool_bar_item, read_char_x_menu_prompt)
17 (read_char_minibuf_menu_prompt, access_keymap_keyremap)
18 (keyremap_step, test_undefined, read_key_sequence)
19 (detect_input_pending, detect_input_pending_ignore_squeezables)
20 (detect_input_pending_run_timers, requeued_events_pending_p)
21 (quit_throw_to_read_char, Fset_input_interrupt_mode):
22 * keymap.c (get_keymap, keymap_parent, keymap_memberp)
23 (access_keymap_1, access_keymap, map_keymap, get_keyelt)
24 (Fdefine_key, Flookup_key, struct accessible_keymaps_data)
25 (accessible_keymaps_1, Fkey_description, push_key_description):
26 (shadow_lookup, struct where_is_internal_data)
27 (where_is_internal, Fwhere_is_internal, where_is_internal_1)
28 (Fdescribe_buffer_bindings, describe_map_tree, struct describe_map_elt)
29 (describe_map, describe_vector):
30 * menu.c (single_menu_item):
31 * nsmenu.m (ns_update_menubar):
32 * process.c (wait_reading_process_output):
33 * search.c (scan_buffer, scan_newline):
34 Use bool for boolean.
35 * keyboard.c (timers_run, swallow_events)
36 (detect_input_pending_run_timers):
37 * process.c (wait_reading_process_output):
38 Use unsigned for counter where wraparound-on-overflow is desired,
39 since unsigned is guaranteed to have that behavior and signed is not.
40 (read_char): Use ptrdiff_t for string length.
41 (get_input_pending): Remove first argument, since it was always
42 the same pointer-to-int (now pointer-to-boolean) &input_pending,
43 and behave as if it had that value. Return new value of
44 input_pending. All callers changed.
45 * keyboard.h (struct kboard): Use unsigned : 1 for boolean member
46 immediate_echo. Use ptrdiff_t for echo_after_prompt, since it's
47 a string length.
48 * keymap.c (push_key_description): Omit last arg, which was always 1.
49 All callers changed.
50
3 * regex.c (immediate_quit) [emacs]: Remove duplicate decl. 51 * regex.c (immediate_quit) [emacs]: Remove duplicate decl.
4 52
52012-10-10 Juanma Barranquero <lekktu@gmail.com> 532012-10-10 Juanma Barranquero <lekktu@gmail.com>
diff --git a/src/dispnew.c b/src/dispnew.c
index fd4985452ae..0956e3f2905 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -5918,15 +5918,16 @@ additional wait period, in milliseconds; this is for backwards compatibility.
5918 TIMEOUT is number of seconds to wait (float or integer), 5918 TIMEOUT is number of seconds to wait (float or integer),
5919 or t to wait forever. 5919 or t to wait forever.
5920 READING is true if reading input. 5920 READING is true if reading input.
5921 If DO_DISPLAY is >0 display process output while waiting. 5921 If DISPLAY_OPTION is >0 display process output while waiting.
5922 If DO_DISPLAY is >1 perform an initial redisplay before waiting. 5922 If DISPLAY_OPTION is >1 perform an initial redisplay before waiting.
5923*/ 5923*/
5924 5924
5925Lisp_Object 5925Lisp_Object
5926sit_for (Lisp_Object timeout, bool reading, int do_display) 5926sit_for (Lisp_Object timeout, bool reading, int display_option)
5927{ 5927{
5928 intmax_t sec; 5928 intmax_t sec;
5929 int nsec; 5929 int nsec;
5930 bool do_display = display_option > 0;
5930 5931
5931 swallow_events (do_display); 5932 swallow_events (do_display);
5932 5933
@@ -5934,7 +5935,7 @@ sit_for (Lisp_Object timeout, bool reading, int do_display)
5934 || !NILP (Vexecuting_kbd_macro)) 5935 || !NILP (Vexecuting_kbd_macro))
5935 return Qnil; 5936 return Qnil;
5936 5937
5937 if (do_display >= 2) 5938 if (display_option > 1)
5938 redisplay_preserve_echo_area (2); 5939 redisplay_preserve_echo_area (2);
5939 5940
5940 if (INTEGERP (timeout)) 5941 if (INTEGERP (timeout))
diff --git a/src/keyboard.c b/src/keyboard.c
index 61481c5f0f6..d58178b7561 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -86,8 +86,8 @@ KBOARD *initial_kboard;
86KBOARD *current_kboard; 86KBOARD *current_kboard;
87KBOARD *all_kboards; 87KBOARD *all_kboards;
88 88
89/* Nonzero in the single-kboard state, 0 in the any-kboard state. */ 89/* True in the single-kboard state, false in the any-kboard state. */
90static int single_kboard; 90static bool single_kboard;
91 91
92/* Non-nil disable property on a command means 92/* Non-nil disable property on a command means
93 do not execute it; call disabled-command-function's value instead. */ 93 do not execute it; call disabled-command-function's value instead. */
@@ -113,9 +113,9 @@ static Lisp_Object recent_keys;
113Lisp_Object this_command_keys; 113Lisp_Object this_command_keys;
114ptrdiff_t this_command_key_count; 114ptrdiff_t this_command_key_count;
115 115
116/* 1 after calling Freset_this_command_lengths. 116/* True after calling Freset_this_command_lengths.
117 Usually it is 0. */ 117 Usually it is false. */
118static int this_command_key_count_reset; 118static bool this_command_key_count_reset;
119 119
120/* This vector is used as a buffer to record the events that were actually read 120/* This vector is used as a buffer to record the events that were actually read
121 by read_key_sequence. */ 121 by read_key_sequence. */
@@ -140,11 +140,11 @@ static ptrdiff_t before_command_echo_length;
140static sys_jmp_buf getcjmp; 140static sys_jmp_buf getcjmp;
141 141
142/* True while doing kbd input. */ 142/* True while doing kbd input. */
143int waiting_for_input; 143bool waiting_for_input;
144 144
145/* True while displaying for echoing. Delays C-g throwing. */ 145/* True while displaying for echoing. Delays C-g throwing. */
146 146
147static int echoing; 147static bool echoing;
148 148
149/* Non-null means we can start echoing at the next input pause even 149/* Non-null means we can start echoing at the next input pause even
150 though there is something in the echo area. */ 150 though there is something in the echo area. */
@@ -163,8 +163,8 @@ struct kboard *echo_kboard;
163 163
164Lisp_Object echo_message_buffer; 164Lisp_Object echo_message_buffer;
165 165
166/* Nonzero means C-g should cause immediate error-signal. */ 166/* True means C-g should cause immediate error-signal. */
167int immediate_quit; 167bool immediate_quit;
168 168
169/* Character that causes a quit. Normally C-g. 169/* Character that causes a quit. Normally C-g.
170 170
@@ -270,7 +270,7 @@ static Lisp_Object Qhelp_form_show;
270static FILE *dribble; 270static FILE *dribble;
271 271
272/* Nonzero if input is available. */ 272/* Nonzero if input is available. */
273int input_pending; 273bool input_pending;
274 274
275/* Circular buffer for pre-read keyboard input. */ 275/* Circular buffer for pre-read keyboard input. */
276 276
@@ -372,18 +372,18 @@ static ptrdiff_t echo_length (void);
372static Lisp_Object Qpolling_period; 372static Lisp_Object Qpolling_period;
373 373
374/* Incremented whenever a timer is run. */ 374/* Incremented whenever a timer is run. */
375int timers_run; 375unsigned timers_run;
376 376
377/* Address (if not 0) of EMACS_TIME to zero out if a SIGIO interrupt 377/* Address (if not 0) of EMACS_TIME to zero out if a SIGIO interrupt
378 happens. */ 378 happens. */
379EMACS_TIME *input_available_clear_time; 379EMACS_TIME *input_available_clear_time;
380 380
381/* Nonzero means use SIGIO interrupts; zero means use CBREAK mode. 381/* True means use SIGIO interrupts; false means use CBREAK mode.
382 Default is 1 if INTERRUPT_INPUT is defined. */ 382 Default is true if INTERRUPT_INPUT is defined. */
383int interrupt_input; 383bool interrupt_input;
384 384
385/* Nonzero while interrupts are temporarily deferred during redisplay. */ 385/* Nonzero while interrupts are temporarily deferred during redisplay. */
386int interrupts_deferred; 386bool interrupts_deferred;
387 387
388/* If we support a window system, turn on the code to poll periodically 388/* If we support a window system, turn on the code to poll periodically
389 to detect C-g. It isn't actually used when doing interrupt input. */ 389 to detect C-g. It isn't actually used when doing interrupt input. */
@@ -411,10 +411,10 @@ static EMACS_TIME timer_last_idleness_start_time;
411/* Function for init_keyboard to call with no args (if nonzero). */ 411/* Function for init_keyboard to call with no args (if nonzero). */
412static void (*keyboard_init_hook) (void); 412static void (*keyboard_init_hook) (void);
413 413
414static void get_input_pending (int *, int); 414static bool get_input_pending (int);
415static int readable_events (int); 415static bool readable_events (int);
416static Lisp_Object read_char_x_menu_prompt (ptrdiff_t, Lisp_Object *, 416static Lisp_Object read_char_x_menu_prompt (ptrdiff_t, Lisp_Object *,
417 Lisp_Object, int *); 417 Lisp_Object, bool *);
418static Lisp_Object read_char_minibuf_menu_prompt (int, ptrdiff_t, 418static Lisp_Object read_char_minibuf_menu_prompt (int, ptrdiff_t,
419 Lisp_Object *); 419 Lisp_Object *);
420static Lisp_Object make_lispy_event (struct input_event *); 420static Lisp_Object make_lispy_event (struct input_event *);
@@ -428,7 +428,7 @@ static Lisp_Object modify_event_symbol (ptrdiff_t, int, Lisp_Object,
428 Lisp_Object, const char *const *, 428 Lisp_Object, const char *const *,
429 Lisp_Object *, ptrdiff_t); 429 Lisp_Object *, ptrdiff_t);
430static Lisp_Object make_lispy_switch_frame (Lisp_Object); 430static Lisp_Object make_lispy_switch_frame (Lisp_Object);
431static int help_char_p (Lisp_Object); 431static bool help_char_p (Lisp_Object);
432static void save_getcjmp (sys_jmp_buf); 432static void save_getcjmp (sys_jmp_buf);
433static void restore_getcjmp (sys_jmp_buf); 433static void restore_getcjmp (sys_jmp_buf);
434static Lisp_Object apply_modifiers (int, Lisp_Object); 434static Lisp_Object apply_modifiers (int, Lisp_Object);
@@ -438,7 +438,7 @@ static Lisp_Object restore_kboard_configuration (Lisp_Object);
438static void deliver_input_available_signal (int signo); 438static void deliver_input_available_signal (int signo);
439#endif 439#endif
440static void handle_interrupt (bool); 440static void handle_interrupt (bool);
441static _Noreturn void quit_throw_to_read_char (int); 441static _Noreturn void quit_throw_to_read_char (bool);
442static void process_special_events (void); 442static void process_special_events (void);
443static void timer_start_idle (void); 443static void timer_start_idle (void);
444static void timer_stop_idle (void); 444static void timer_stop_idle (void);
@@ -516,7 +516,7 @@ echo_char (Lisp_Object c)
516 516
517 if (INTEGERP (c)) 517 if (INTEGERP (c))
518 { 518 {
519 ptr = push_key_description (XINT (c), ptr, 1); 519 ptr = push_key_description (XINT (c), ptr);
520 } 520 }
521 else if (SYMBOLP (c)) 521 else if (SYMBOLP (c))
522 { 522 {
@@ -925,7 +925,7 @@ pop_kboard (void)
925{ 925{
926 struct terminal *t; 926 struct terminal *t;
927 struct kboard_stack *p = kboard_stack; 927 struct kboard_stack *p = kboard_stack;
928 int found = 0; 928 bool found = 0;
929 for (t = terminal_list; t; t = t->next_terminal) 929 for (t = terminal_list; t; t = t->next_terminal)
930 { 930 {
931 if (t->kboard == p->kboard) 931 if (t->kboard == p->kboard)
@@ -958,7 +958,7 @@ pop_kboard (void)
958void 958void
959temporarily_switch_to_single_kboard (struct frame *f) 959temporarily_switch_to_single_kboard (struct frame *f)
960{ 960{
961 int was_locked = single_kboard; 961 bool was_locked = single_kboard;
962 if (was_locked) 962 if (was_locked)
963 { 963 {
964 if (f != NULL && FRAME_KBOARD (f) != current_kboard) 964 if (f != NULL && FRAME_KBOARD (f) != current_kboard)
@@ -1057,12 +1057,7 @@ cmd_error (Lisp_Object data)
1057 Vprint_length = old_length; 1057 Vprint_length = old_length;
1058 1058
1059 Vquit_flag = Qnil; 1059 Vquit_flag = Qnil;
1060
1061 Vinhibit_quit = Qnil; 1060 Vinhibit_quit = Qnil;
1062#if 0 /* This shouldn't be necessary anymore. --lorentey */
1063 if (command_loop_level == 0 && minibuf_level == 0)
1064 any_kboard_state ();
1065#endif
1066 1061
1067 return make_number (0); 1062 return make_number (0);
1068} 1063}
@@ -1149,12 +1144,6 @@ command_loop (void)
1149 while (1) 1144 while (1)
1150 { 1145 {
1151 internal_catch (Qtop_level, top_level_1, Qnil); 1146 internal_catch (Qtop_level, top_level_1, Qnil);
1152#if 0 /* This shouldn't be necessary anymore. --lorentey */
1153 /* Reset single_kboard in case top-level set it while
1154 evaluating an -f option, or we are stuck there for some
1155 other reason. */
1156 any_kboard_state ();
1157#endif
1158 internal_catch (Qtop_level, command_loop_2, Qnil); 1147 internal_catch (Qtop_level, command_loop_2, Qnil);
1159 executing_kbd_macro = Qnil; 1148 executing_kbd_macro = Qnil;
1160 1149
@@ -1265,8 +1254,7 @@ tracking_off (Lisp_Object old_value)
1265 if (!readable_events (READABLE_EVENTS_DO_TIMERS_NOW)) 1254 if (!readable_events (READABLE_EVENTS_DO_TIMERS_NOW))
1266 { 1255 {
1267 redisplay_preserve_echo_area (6); 1256 redisplay_preserve_echo_area (6);
1268 get_input_pending (&input_pending, 1257 get_input_pending (READABLE_EVENTS_DO_TIMERS_NOW);
1269 READABLE_EVENTS_DO_TIMERS_NOW);
1270 } 1258 }
1271 } 1259 }
1272 return Qnil; 1260 return Qnil;
@@ -1301,7 +1289,7 @@ usage: (track-mouse BODY...) */)
1301#if !defined HAVE_WINDOW_SYSTEM || defined USE_GTK || defined HAVE_NS 1289#if !defined HAVE_WINDOW_SYSTEM || defined USE_GTK || defined HAVE_NS
1302static 1290static
1303#endif 1291#endif
1304int ignore_mouse_drag_p; 1292bool ignore_mouse_drag_p;
1305 1293
1306static FRAME_PTR 1294static FRAME_PTR
1307some_mouse_moved (void) 1295some_mouse_moved (void)
@@ -1329,9 +1317,9 @@ some_mouse_moved (void)
1329 sans error-handling encapsulation. */ 1317 sans error-handling encapsulation. */
1330 1318
1331static int read_key_sequence (Lisp_Object *, int, Lisp_Object, 1319static int read_key_sequence (Lisp_Object *, int, Lisp_Object,
1332 int, int, int); 1320 bool, bool, bool);
1333void safe_run_hooks (Lisp_Object); 1321void safe_run_hooks (Lisp_Object);
1334static void adjust_point_for_property (ptrdiff_t, int); 1322static void adjust_point_for_property (ptrdiff_t, bool);
1335 1323
1336/* Cancel hourglass from protect_unwind. 1324/* Cancel hourglass from protect_unwind.
1337 ARG is not used. */ 1325 ARG is not used. */
@@ -1359,10 +1347,7 @@ command_loop_1 (void)
1359 int i; 1347 int i;
1360 EMACS_INT prev_modiff = 0; 1348 EMACS_INT prev_modiff = 0;
1361 struct buffer *prev_buffer = NULL; 1349 struct buffer *prev_buffer = NULL;
1362#if 0 /* This shouldn't be necessary anymore. --lorentey */ 1350 bool already_adjusted = 0;
1363 int was_locked = single_kboard;
1364#endif
1365 int already_adjusted = 0;
1366 1351
1367 kset_prefix_arg (current_kboard, Qnil); 1352 kset_prefix_arg (current_kboard, Qnil);
1368 kset_last_prefix_arg (current_kboard, Qnil); 1353 kset_last_prefix_arg (current_kboard, Qnil);
@@ -1731,10 +1716,6 @@ command_loop_1 (void)
1731 if (!NILP (KVAR (current_kboard, defining_kbd_macro)) 1716 if (!NILP (KVAR (current_kboard, defining_kbd_macro))
1732 && NILP (KVAR (current_kboard, Vprefix_arg))) 1717 && NILP (KVAR (current_kboard, Vprefix_arg)))
1733 finalize_kbd_macro_chars (); 1718 finalize_kbd_macro_chars ();
1734#if 0 /* This shouldn't be necessary anymore. --lorentey */
1735 if (!was_locked)
1736 any_kboard_state ();
1737#endif
1738 } 1719 }
1739} 1720}
1740 1721
@@ -1744,7 +1725,7 @@ command_loop_1 (void)
1744 LAST_PT is the last position of point. */ 1725 LAST_PT is the last position of point. */
1745 1726
1746static void 1727static void
1747adjust_point_for_property (ptrdiff_t last_pt, int modified) 1728adjust_point_for_property (ptrdiff_t last_pt, bool modified)
1748{ 1729{
1749 ptrdiff_t beg, end; 1730 ptrdiff_t beg, end;
1750 Lisp_Object val, overlay, tmp; 1731 Lisp_Object val, overlay, tmp;
@@ -1752,7 +1733,7 @@ adjust_point_for_property (ptrdiff_t last_pt, int modified)
1752 suppress the point adjustment for automatic composition so that a 1733 suppress the point adjustment for automatic composition so that a
1753 user can keep inserting another character at point or keep 1734 user can keep inserting another character at point or keep
1754 deleting characters around point. */ 1735 deleting characters around point. */
1755 int check_composition = ! modified, check_display = 1, check_invisible = 1; 1736 bool check_composition = ! modified, check_display = 1, check_invisible = 1;
1756 ptrdiff_t orig_pt = PT; 1737 ptrdiff_t orig_pt = PT;
1757 1738
1758 /* FIXME: cycling is probably not necessary because these properties 1739 /* FIXME: cycling is probably not necessary because these properties
@@ -1791,7 +1772,8 @@ adjust_point_for_property (ptrdiff_t last_pt, int modified)
1791 check_display = 0; 1772 check_display = 0;
1792 if (check_invisible && PT > BEGV && PT < ZV) 1773 if (check_invisible && PT > BEGV && PT < ZV)
1793 { 1774 {
1794 int inv, ellipsis = 0; 1775 int inv;
1776 bool ellipsis = 0;
1795 beg = end = PT; 1777 beg = end = PT;
1796 1778
1797 /* Find boundaries `beg' and `end' of the invisible area, if any. */ 1779 /* Find boundaries `beg' and `end' of the invisible area, if any. */
@@ -1920,7 +1902,7 @@ safe_run_hooks_error (Lisp_Object error_data)
1920 if (SYMBOLP (hook)) 1902 if (SYMBOLP (hook))
1921 { 1903 {
1922 Lisp_Object val; 1904 Lisp_Object val;
1923 int found = 0; 1905 bool found = 0;
1924 Lisp_Object newval = Qnil; 1906 Lisp_Object newval = Qnil;
1925 for (val = find_symbol_value (hook); CONSP (val); val = XCDR (val)) 1907 for (val = find_symbol_value (hook); CONSP (val); val = XCDR (val))
1926 if (EQ (fun, XCAR (val))) 1908 if (EQ (fun, XCAR (val)))
@@ -2050,9 +2032,9 @@ start_polling (void)
2050#endif 2032#endif
2051} 2033}
2052 2034
2053/* Nonzero if we are using polling to handle input asynchronously. */ 2035/* True if we are using polling to handle input asynchronously. */
2054 2036
2055int 2037bool
2056input_polling_used (void) 2038input_polling_used (void)
2057{ 2039{
2058#ifdef POLL_FOR_INPUT 2040#ifdef POLL_FOR_INPUT
@@ -2228,7 +2210,7 @@ show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object,
2228 2210
2229/* Input of single characters from keyboard */ 2211/* Input of single characters from keyboard */
2230 2212
2231static Lisp_Object kbd_buffer_get_event (KBOARD **kbp, int *used_mouse_menu, 2213static Lisp_Object kbd_buffer_get_event (KBOARD **kbp, bool *used_mouse_menu,
2232 EMACS_TIME *end_time); 2214 EMACS_TIME *end_time);
2233static void record_char (Lisp_Object c); 2215static void record_char (Lisp_Object c);
2234 2216
@@ -2265,9 +2247,9 @@ do { if (polling_stopped_here) start_polling (); \
2265 not to run input methods, but in other respects to act as if 2247 not to run input methods, but in other respects to act as if
2266 not reading a key sequence. 2248 not reading a key sequence.
2267 2249
2268 If USED_MOUSE_MENU is non-null, then we set *USED_MOUSE_MENU to 1 2250 If USED_MOUSE_MENU is non-null, then set *USED_MOUSE_MENU to true
2269 if we used a mouse menu to read the input, or zero otherwise. If 2251 if we used a mouse menu to read the input, or false otherwise. If
2270 USED_MOUSE_MENU is null, we don't dereference it. 2252 USED_MOUSE_MENU is null, don't dereference it.
2271 2253
2272 Value is -2 when we find input on another keyboard. A second call 2254 Value is -2 when we find input on another keyboard. A second call
2273 to read_char will read it. 2255 to read_char will read it.
@@ -2281,7 +2263,7 @@ do { if (polling_stopped_here) start_polling (); \
2281Lisp_Object 2263Lisp_Object
2282read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps, 2264read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2283 Lisp_Object prev_event, 2265 Lisp_Object prev_event,
2284 int *used_mouse_menu, EMACS_TIME *end_time) 2266 bool *used_mouse_menu, EMACS_TIME *end_time)
2285{ 2267{
2286 Lisp_Object c; 2268 Lisp_Object c;
2287 ptrdiff_t jmpcount; 2269 ptrdiff_t jmpcount;
@@ -2290,9 +2272,9 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2290 Lisp_Object tem, save; 2272 Lisp_Object tem, save;
2291 volatile Lisp_Object previous_echo_area_message; 2273 volatile Lisp_Object previous_echo_area_message;
2292 volatile Lisp_Object also_record; 2274 volatile Lisp_Object also_record;
2293 volatile int reread; 2275 volatile bool reread;
2294 struct gcpro gcpro1, gcpro2; 2276 struct gcpro gcpro1, gcpro2;
2295 int volatile polling_stopped_here = 0; 2277 bool volatile polling_stopped_here = 0;
2296 struct kboard *orig_kboard = current_kboard; 2278 struct kboard *orig_kboard = current_kboard;
2297 2279
2298 also_record = Qnil; 2280 also_record = Qnil;
@@ -2328,7 +2310,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2328 2310
2329 if (CONSP (Vunread_command_events)) 2311 if (CONSP (Vunread_command_events))
2330 { 2312 {
2331 int was_disabled = 0; 2313 bool was_disabled = 0;
2332 2314
2333 c = XCAR (Vunread_command_events); 2315 c = XCAR (Vunread_command_events);
2334 Vunread_command_events = XCDR (Vunread_command_events); 2316 Vunread_command_events = XCDR (Vunread_command_events);
@@ -2430,7 +2412,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2430 /* if redisplay was requested */ 2412 /* if redisplay was requested */
2431 if (commandflag >= 0) 2413 if (commandflag >= 0)
2432 { 2414 {
2433 int echo_current = EQ (echo_message_buffer, echo_area_buffer[0]); 2415 bool echo_current = EQ (echo_message_buffer, echo_area_buffer[0]);
2434 2416
2435 /* If there is pending input, process any events which are not 2417 /* If there is pending input, process any events which are not
2436 user-visible, such as X selection_request events. */ 2418 user-visible, such as X selection_request events. */
@@ -2862,12 +2844,6 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2862 if (!NILP (tem)) 2844 if (!NILP (tem))
2863 { 2845 {
2864 struct buffer *prev_buffer = current_buffer; 2846 struct buffer *prev_buffer = current_buffer;
2865#if 0 /* This shouldn't be necessary anymore. --lorentey */
2866 int was_locked = single_kboard;
2867 ptrdiff_t count = SPECPDL_INDEX ();
2868 record_single_kboard_state ();
2869#endif
2870
2871 last_input_event = c; 2847 last_input_event = c;
2872 Fcommand_execute (tem, Qnil, Fvector (1, &last_input_event), Qt); 2848 Fcommand_execute (tem, Qnil, Fvector (1, &last_input_event), Qt);
2873 2849
@@ -2878,13 +2854,6 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2878 example banishing the mouse under mouse-avoidance-mode. */ 2854 example banishing the mouse under mouse-avoidance-mode. */
2879 timer_resume_idle (); 2855 timer_resume_idle ();
2880 2856
2881#if 0 /* This shouldn't be necessary anymore. --lorentey */
2882 /* Resume allowing input from any kboard, if that was true before. */
2883 if (!was_locked)
2884 any_kboard_state ();
2885 unbind_to (count, Qnil);
2886#endif
2887
2888 if (current_buffer != prev_buffer) 2857 if (current_buffer != prev_buffer)
2889 { 2858 {
2890 /* The command may have changed the keymaps. Pretend there 2859 /* The command may have changed the keymaps. Pretend there
@@ -2992,15 +2961,15 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2992 { 2961 {
2993 Lisp_Object keys; 2962 Lisp_Object keys;
2994 ptrdiff_t key_count; 2963 ptrdiff_t key_count;
2995 int key_count_reset; 2964 bool key_count_reset;
2996 struct gcpro gcpro1; 2965 struct gcpro gcpro1;
2997 ptrdiff_t count = SPECPDL_INDEX (); 2966 ptrdiff_t count = SPECPDL_INDEX ();
2998 2967
2999 /* Save the echo status. */ 2968 /* Save the echo status. */
3000 int saved_immediate_echo = current_kboard->immediate_echo; 2969 bool saved_immediate_echo = current_kboard->immediate_echo;
3001 struct kboard *saved_ok_to_echo = ok_to_echo_at_next_pause; 2970 struct kboard *saved_ok_to_echo = ok_to_echo_at_next_pause;
3002 Lisp_Object saved_echo_string = KVAR (current_kboard, echo_string); 2971 Lisp_Object saved_echo_string = KVAR (current_kboard, echo_string);
3003 int saved_echo_after_prompt = current_kboard->echo_after_prompt; 2972 ptrdiff_t saved_echo_after_prompt = current_kboard->echo_after_prompt;
3004 2973
3005#if 0 2974#if 0
3006 if (before_command_restore_flag) 2975 if (before_command_restore_flag)
@@ -3201,9 +3170,9 @@ record_menu_key (Lisp_Object c)
3201 num_input_events++; 3170 num_input_events++;
3202} 3171}
3203 3172
3204/* Return 1 if should recognize C as "the help character". */ 3173/* Return true if should recognize C as "the help character". */
3205 3174
3206static int 3175static bool
3207help_char_p (Lisp_Object c) 3176help_char_p (Lisp_Object c)
3208{ 3177{
3209 Lisp_Object tail; 3178 Lisp_Object tail;
@@ -3375,7 +3344,7 @@ restore_getcjmp (sys_jmp_buf temp)
3375 3344
3376/* Return true if there are any events in the queue that read-char 3345/* Return true if there are any events in the queue that read-char
3377 would return. If this returns false, a read-char would block. */ 3346 would return. If this returns false, a read-char would block. */
3378static int 3347static bool
3379readable_events (int flags) 3348readable_events (int flags)
3380{ 3349{
3381 if (flags & READABLE_EVENTS_DO_TIMERS_NOW) 3350 if (flags & READABLE_EVENTS_DO_TIMERS_NOW)
@@ -3714,15 +3683,14 @@ discard_mouse_events (void)
3714} 3683}
3715 3684
3716 3685
3717/* Return non-zero if there are any real events waiting in the event 3686/* Return true if there are any real events waiting in the event
3718 buffer, not counting `NO_EVENT's. 3687 buffer, not counting `NO_EVENT's.
3719 3688
3720 If DISCARD is non-zero, discard NO_EVENT events at the front of 3689 Discard NO_EVENT events at the front of the input queue, possibly
3721 the input queue, possibly leaving the input queue empty if there 3690 leaving the input queue empty if there are no real input events. */
3722 are no real input events. */
3723 3691
3724int 3692bool
3725kbd_buffer_events_waiting (int discard) 3693kbd_buffer_events_waiting (void)
3726{ 3694{
3727 struct input_event *sp; 3695 struct input_event *sp;
3728 3696
@@ -3734,9 +3702,7 @@ kbd_buffer_events_waiting (int discard)
3734 sp = kbd_buffer; 3702 sp = kbd_buffer;
3735 } 3703 }
3736 3704
3737 if (discard) 3705 kbd_fetch_ptr = sp;
3738 kbd_fetch_ptr = sp;
3739
3740 return sp != kbd_store_ptr && sp->kind != NO_EVENT; 3706 return sp != kbd_store_ptr && sp->kind != NO_EVENT;
3741} 3707}
3742 3708
@@ -3758,7 +3724,7 @@ clear_event (struct input_event *event)
3758 3724
3759static Lisp_Object 3725static Lisp_Object
3760kbd_buffer_get_event (KBOARD **kbp, 3726kbd_buffer_get_event (KBOARD **kbp,
3761 int *used_mouse_menu, 3727 bool *used_mouse_menu,
3762 EMACS_TIME *end_time) 3728 EMACS_TIME *end_time)
3763{ 3729{
3764 Lisp_Object obj; 3730 Lisp_Object obj;
@@ -4203,14 +4169,14 @@ process_special_events (void)
4203 are ripe, and return, without reading any user-visible events. */ 4169 are ripe, and return, without reading any user-visible events. */
4204 4170
4205void 4171void
4206swallow_events (int do_display) 4172swallow_events (bool do_display)
4207{ 4173{
4208 int old_timers_run; 4174 unsigned old_timers_run;
4209 4175
4210 process_special_events (); 4176 process_special_events ();
4211 4177
4212 old_timers_run = timers_run; 4178 old_timers_run = timers_run;
4213 get_input_pending (&input_pending, READABLE_EVENTS_DO_TIMERS_NOW); 4179 get_input_pending (READABLE_EVENTS_DO_TIMERS_NOW);
4214 4180
4215 if (timers_run != old_timers_run && do_display) 4181 if (timers_run != old_timers_run && do_display)
4216 redisplay_preserve_echo_area (7); 4182 redisplay_preserve_echo_area (7);
@@ -4337,7 +4303,7 @@ timer_check_2 (Lisp_Object timers, Lisp_Object idle_timers)
4337 EMACS_TIME difference; 4303 EMACS_TIME difference;
4338 EMACS_TIME timer_difference = invalid_emacs_time (); 4304 EMACS_TIME timer_difference = invalid_emacs_time ();
4339 EMACS_TIME idle_timer_difference = invalid_emacs_time (); 4305 EMACS_TIME idle_timer_difference = invalid_emacs_time ();
4340 int ripe, timer_ripe = 0, idle_timer_ripe = 0; 4306 bool ripe, timer_ripe = 0, idle_timer_ripe = 0;
4341 4307
4342 /* Set TIMER and TIMER_DIFFERENCE 4308 /* Set TIMER and TIMER_DIFFERENCE
4343 based on the next ordinary timer. 4309 based on the next ordinary timer.
@@ -5441,7 +5407,7 @@ make_lispy_event (struct input_event *event)
5441#endif 5407#endif
5442 { 5408 {
5443 int button = event->code; 5409 int button = event->code;
5444 int is_double; 5410 bool is_double;
5445 Lisp_Object position; 5411 Lisp_Object position;
5446 Lisp_Object *start_pos_ptr; 5412 Lisp_Object *start_pos_ptr;
5447 Lisp_Object start_pos; 5413 Lisp_Object start_pos;
@@ -5722,7 +5688,7 @@ make_lispy_event (struct input_event *event)
5722 struct frame *fr; 5688 struct frame *fr;
5723 int fuzz; 5689 int fuzz;
5724 int symbol_num; 5690 int symbol_num;
5725 int is_double; 5691 bool is_double;
5726 5692
5727 if (WINDOWP (event->frame_or_window)) 5693 if (WINDOWP (event->frame_or_window))
5728 fr = XFRAME (XWINDOW (event->frame_or_window)->frame); 5694 fr = XFRAME (XWINDOW (event->frame_or_window)->frame);
@@ -6664,11 +6630,11 @@ parse_solitary_modifier (Lisp_Object symbol)
6664 return 0; 6630 return 0;
6665} 6631}
6666 6632
6667/* Return 1 if EVENT is a list whose elements are all integers or symbols. 6633/* Return true if EVENT is a list whose elements are all integers or symbols.
6668 Such a list is not valid as an event, 6634 Such a list is not valid as an event,
6669 but it can be a Lucid-style event type list. */ 6635 but it can be a Lucid-style event type list. */
6670 6636
6671int 6637bool
6672lucid_event_type_list_p (Lisp_Object object) 6638lucid_event_type_list_p (Lisp_Object object)
6673{ 6639{
6674 Lisp_Object tail; 6640 Lisp_Object tail;
@@ -6693,8 +6659,10 @@ lucid_event_type_list_p (Lisp_Object object)
6693 return NILP (tail); 6659 return NILP (tail);
6694} 6660}
6695 6661
6696/* Store into *addr a value nonzero if terminal input chars are available. 6662/* Return true if terminal input chars are available.
6697 Serves the purpose of ioctl (0, FIONREAD, addr) 6663 Also, store the return value into INPUT_PENDING.
6664
6665 Serves the purpose of ioctl (0, FIONREAD, ...)
6698 but works even if FIONREAD does not exist. 6666 but works even if FIONREAD does not exist.
6699 (In fact, this may actually read some input.) 6667 (In fact, this may actually read some input.)
6700 6668
@@ -6705,19 +6673,21 @@ lucid_event_type_list_p (Lisp_Object object)
6705 If READABLE_EVENTS_IGNORE_SQUEEZABLES is set in FLAGS, ignore mouse 6673 If READABLE_EVENTS_IGNORE_SQUEEZABLES is set in FLAGS, ignore mouse
6706 movements and toolkit scroll bar thumb drags. */ 6674 movements and toolkit scroll bar thumb drags. */
6707 6675
6708static void 6676static bool
6709get_input_pending (int *addr, int flags) 6677get_input_pending (int flags)
6710{ 6678{
6711 /* First of all, have we already counted some input? */ 6679 /* First of all, have we already counted some input? */
6712 *addr = (!NILP (Vquit_flag) || readable_events (flags)); 6680 input_pending = (!NILP (Vquit_flag) || readable_events (flags));
6713 6681
6714 /* If input is being read as it arrives, and we have none, there is none. */ 6682 /* If input is being read as it arrives, and we have none, there is none. */
6715 if (*addr > 0 || (interrupt_input && ! interrupts_deferred)) 6683 if (!input_pending && (!interrupt_input || interrupts_deferred))
6716 return; 6684 {
6685 /* Try to read some input and see how much we get. */
6686 gobble_input ();
6687 input_pending = (!NILP (Vquit_flag) || readable_events (flags));
6688 }
6717 6689
6718 /* Try to read some input and see how much we get. */ 6690 return input_pending;
6719 gobble_input ();
6720 *addr = (!NILP (Vquit_flag) || readable_events (flags));
6721} 6691}
6722 6692
6723/* Put a BUFFER_SWITCH_EVENT in the buffer 6693/* Put a BUFFER_SWITCH_EVENT in the buffer
@@ -6767,7 +6737,7 @@ int
6767gobble_input (void) 6737gobble_input (void)
6768{ 6738{
6769 int nread = 0; 6739 int nread = 0;
6770 int err = 0; 6740 bool err = 0;
6771 struct terminal *t; 6741 struct terminal *t;
6772 6742
6773 /* Store pending user signal events, if any. */ 6743 /* Store pending user signal events, if any. */
@@ -7337,9 +7307,9 @@ static const char* separator_names[] = {
7337 0, 7307 0,
7338}; 7308};
7339 7309
7340/* Return non-zero if LABEL specifies a separator. */ 7310/* Return true if LABEL specifies a separator. */
7341 7311
7342int 7312bool
7343menu_separator_name_p (const char *label) 7313menu_separator_name_p (const char *label)
7344{ 7314{
7345 if (!label) 7315 if (!label)
@@ -7514,6 +7484,7 @@ menu_bar_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy1, void *dumm
7514{ 7484{
7515 struct gcpro gcpro1; 7485 struct gcpro gcpro1;
7516 int i; 7486 int i;
7487 bool parsed;
7517 Lisp_Object tem; 7488 Lisp_Object tem;
7518 7489
7519 if (EQ (item, Qundefined)) 7490 if (EQ (item, Qundefined))
@@ -7545,9 +7516,9 @@ menu_bar_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy1, void *dumm
7545 parse_menu_item, so that if it turns out it wasn't a menu item, 7516 parse_menu_item, so that if it turns out it wasn't a menu item,
7546 it still correctly hides any further menu item. */ 7517 it still correctly hides any further menu item. */
7547 GCPRO1 (key); 7518 GCPRO1 (key);
7548 i = parse_menu_item (item, 1); 7519 parsed = parse_menu_item (item, 1);
7549 UNGCPRO; 7520 UNGCPRO;
7550 if (!i) 7521 if (!parsed)
7551 return; 7522 return;
7552 7523
7553 item = AREF (item_properties, ITEM_PROPERTY_DEF); 7524 item = AREF (item_properties, ITEM_PROPERTY_DEF);
@@ -7623,7 +7594,7 @@ menu_item_eval_property (Lisp_Object sexpr)
7623 parse_menu_item returns true if the item is a menu item and false 7594 parse_menu_item returns true if the item is a menu item and false
7624 otherwise. */ 7595 otherwise. */
7625 7596
7626int 7597bool
7627parse_menu_item (Lisp_Object item, int inmenubar) 7598parse_menu_item (Lisp_Object item, int inmenubar)
7628{ 7599{
7629 Lisp_Object def, tem, item_string, start; 7600 Lisp_Object def, tem, item_string, start;
@@ -7923,7 +7894,7 @@ static Lisp_Object QCrtl;
7923 7894
7924static void init_tool_bar_items (Lisp_Object); 7895static void init_tool_bar_items (Lisp_Object);
7925static void process_tool_bar_item (Lisp_Object, Lisp_Object, Lisp_Object, void*); 7896static void process_tool_bar_item (Lisp_Object, Lisp_Object, Lisp_Object, void*);
7926static int parse_tool_bar_item (Lisp_Object, Lisp_Object); 7897static bool parse_tool_bar_item (Lisp_Object, Lisp_Object);
7927static void append_tool_bar_item (void); 7898static void append_tool_bar_item (void);
7928 7899
7929 7900
@@ -8056,7 +8027,7 @@ set_prop (ptrdiff_t idx, Lisp_Object val)
8056 8027
8057 8028
8058/* Parse a tool bar item specification ITEM for key KEY and return the 8029/* Parse a tool bar item specification ITEM for key KEY and return the
8059 result in tool_bar_item_properties. Value is zero if ITEM is 8030 result in tool_bar_item_properties. Value is false if ITEM is
8060 invalid. 8031 invalid.
8061 8032
8062 ITEM is a list `(menu-item CAPTION BINDING PROPS...)'. 8033 ITEM is a list `(menu-item CAPTION BINDING PROPS...)'.
@@ -8101,12 +8072,13 @@ set_prop (ptrdiff_t idx, Lisp_Object val)
8101 8072
8102 A text label to show with the tool bar button if labels are enabled. */ 8073 A text label to show with the tool bar button if labels are enabled. */
8103 8074
8104static int 8075static bool
8105parse_tool_bar_item (Lisp_Object key, Lisp_Object item) 8076parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
8106{ 8077{
8107 Lisp_Object filter = Qnil; 8078 Lisp_Object filter = Qnil;
8108 Lisp_Object caption; 8079 Lisp_Object caption;
8109 int i, have_label = 0; 8080 int i;
8081 bool have_label = 0;
8110 8082
8111 /* Definition looks like `(menu-item CAPTION BINDING PROPS...)'. 8083 /* Definition looks like `(menu-item CAPTION BINDING PROPS...)'.
8112 Rule out items that aren't lists, don't start with 8084 Rule out items that aren't lists, don't start with
@@ -8363,9 +8335,9 @@ append_tool_bar_item (void)
8363 PREV_EVENT is the previous input event, or nil if we are reading 8335 PREV_EVENT is the previous input event, or nil if we are reading
8364 the first event of a key sequence. 8336 the first event of a key sequence.
8365 8337
8366 If USED_MOUSE_MENU is non-null, then we set *USED_MOUSE_MENU to 1 8338 If USED_MOUSE_MENU is non-null, set *USED_MOUSE_MENU to true
8367 if we used a mouse menu to read the input, or zero otherwise. If 8339 if we used a mouse menu to read the input, or false otherwise. If
8368 USED_MOUSE_MENU is null, we don't dereference it. 8340 USED_MOUSE_MENU is null, don't dereference it.
8369 8341
8370 The prompting is done based on the prompt-string of the map 8342 The prompting is done based on the prompt-string of the map
8371 and the strings associated with various map elements. 8343 and the strings associated with various map elements.
@@ -8378,7 +8350,7 @@ append_tool_bar_item (void)
8378 8350
8379static Lisp_Object 8351static Lisp_Object
8380read_char_x_menu_prompt (ptrdiff_t nmaps, Lisp_Object *maps, 8352read_char_x_menu_prompt (ptrdiff_t nmaps, Lisp_Object *maps,
8381 Lisp_Object prev_event, int *used_mouse_menu) 8353 Lisp_Object prev_event, bool *used_mouse_menu)
8382{ 8354{
8383#ifdef HAVE_MENUS 8355#ifdef HAVE_MENUS
8384 ptrdiff_t mapno; 8356 ptrdiff_t mapno;
@@ -8472,7 +8444,7 @@ read_char_minibuf_menu_prompt (int commandflag,
8472 /* FIXME: Use the minibuffer's frame width. */ 8444 /* FIXME: Use the minibuffer's frame width. */
8473 ptrdiff_t width = FRAME_COLS (SELECTED_FRAME ()) - 4; 8445 ptrdiff_t width = FRAME_COLS (SELECTED_FRAME ()) - 4;
8474 ptrdiff_t idx = -1; 8446 ptrdiff_t idx = -1;
8475 int nobindings = 1; 8447 bool nobindings = 1;
8476 Lisp_Object rest, vector; 8448 Lisp_Object rest, vector;
8477 char *menu; 8449 char *menu;
8478 8450
@@ -8520,7 +8492,7 @@ read_char_minibuf_menu_prompt (int commandflag,
8520 /* Present the documented bindings, a line at a time. */ 8492 /* Present the documented bindings, a line at a time. */
8521 while (1) 8493 while (1)
8522 { 8494 {
8523 int notfirst = 0; 8495 bool notfirst = 0;
8524 ptrdiff_t i = nlength; 8496 ptrdiff_t i = nlength;
8525 Lisp_Object obj; 8497 Lisp_Object obj;
8526 Lisp_Object orig_defn_macro; 8498 Lisp_Object orig_defn_macro;
@@ -8576,8 +8548,8 @@ read_char_minibuf_menu_prompt (int commandflag,
8576 /* Ignore the element if it has no prompt string. */ 8548 /* Ignore the element if it has no prompt string. */
8577 if (INTEGERP (event) && parse_menu_item (elt, -1)) 8549 if (INTEGERP (event) && parse_menu_item (elt, -1))
8578 { 8550 {
8579 /* 1 if the char to type matches the string. */ 8551 /* True if the char to type matches the string. */
8580 int char_matches; 8552 bool char_matches;
8581 Lisp_Object upcased_event, downcased_event; 8553 Lisp_Object upcased_event, downcased_event;
8582 Lisp_Object desc = Qnil; 8554 Lisp_Object desc = Qnil;
8583 Lisp_Object s 8555 Lisp_Object s
@@ -8629,7 +8601,7 @@ read_char_minibuf_menu_prompt (int commandflag,
8629 i += 2; 8601 i += 2;
8630 } 8602 }
8631 notfirst = 1; 8603 notfirst = 1;
8632 nobindings = 0 ; 8604 nobindings = 0;
8633 8605
8634 /* If the char to type doesn't match the string's 8606 /* If the char to type doesn't match the string's
8635 first char, explicitly show what char to type. */ 8607 first char, explicitly show what char to type. */
@@ -8763,14 +8735,14 @@ typedef struct keyremap
8763 8735
8764/* Lookup KEY in MAP. 8736/* Lookup KEY in MAP.
8765 MAP is a keymap mapping keys to key vectors or functions. 8737 MAP is a keymap mapping keys to key vectors or functions.
8766 If the mapping is a function and DO_FUNCTION is non-zero, then 8738 If the mapping is a function and DO_FUNCALL is true,
8767 the function is called with PROMPT as parameter and its return 8739 the function is called with PROMPT as parameter and its return
8768 value is used as the return value of this function (after checking 8740 value is used as the return value of this function (after checking
8769 that it is indeed a vector). */ 8741 that it is indeed a vector). */
8770 8742
8771static Lisp_Object 8743static Lisp_Object
8772access_keymap_keyremap (Lisp_Object map, Lisp_Object key, Lisp_Object prompt, 8744access_keymap_keyremap (Lisp_Object map, Lisp_Object key, Lisp_Object prompt,
8773 int do_funcall) 8745 bool do_funcall)
8774{ 8746{
8775 Lisp_Object next; 8747 Lisp_Object next;
8776 8748
@@ -8809,15 +8781,15 @@ access_keymap_keyremap (Lisp_Object map, Lisp_Object key, Lisp_Object prompt,
8809 BUFSIZE is its maximum size. 8781 BUFSIZE is its maximum size.
8810 FKEY is a pointer to the keyremap structure to use. 8782 FKEY is a pointer to the keyremap structure to use.
8811 INPUT is the index of the last element in KEYBUF. 8783 INPUT is the index of the last element in KEYBUF.
8812 DOIT if non-zero says that the remapping can actually take place. 8784 DOIT if true says that the remapping can actually take place.
8813 DIFF is used to return the number of keys added/removed by the remapping. 8785 DIFF is used to return the number of keys added/removed by the remapping.
8814 PARENT is the root of the keymap. 8786 PARENT is the root of the keymap.
8815 PROMPT is the prompt to use if the remapping happens through a function. 8787 PROMPT is the prompt to use if the remapping happens through a function.
8816 The return value is non-zero if the remapping actually took place. */ 8788 Return true if the remapping actually took place. */
8817 8789
8818static int 8790static bool
8819keyremap_step (Lisp_Object *keybuf, int bufsize, volatile keyremap *fkey, 8791keyremap_step (Lisp_Object *keybuf, int bufsize, volatile keyremap *fkey,
8820 int input, int doit, int *diff, Lisp_Object prompt) 8792 int input, bool doit, int *diff, Lisp_Object prompt)
8821{ 8793{
8822 Lisp_Object next, key; 8794 Lisp_Object next, key;
8823 8795
@@ -8871,7 +8843,7 @@ keyremap_step (Lisp_Object *keybuf, int bufsize, volatile keyremap *fkey,
8871 return 0; 8843 return 0;
8872} 8844}
8873 8845
8874static int 8846static bool
8875test_undefined (Lisp_Object binding) 8847test_undefined (Lisp_Object binding)
8876{ 8848{
8877 return (EQ (binding, Qundefined) 8849 return (EQ (binding, Qundefined)
@@ -8913,13 +8885,13 @@ test_undefined (Lisp_Object binding)
8913 off the switch-frame event until later; the next call to 8885 off the switch-frame event until later; the next call to
8914 read_char will return it. 8886 read_char will return it.
8915 8887
8916 If FIX_CURRENT_BUFFER is nonzero, we restore current_buffer 8888 If FIX_CURRENT_BUFFER, we restore current_buffer
8917 from the selected window's buffer. */ 8889 from the selected window's buffer. */
8918 8890
8919static int 8891static int
8920read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, 8892read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
8921 int dont_downcase_last, int can_return_switch_frame, 8893 bool dont_downcase_last, bool can_return_switch_frame,
8922 int fix_current_buffer) 8894 bool fix_current_buffer)
8923{ 8895{
8924 Lisp_Object from_string; 8896 Lisp_Object from_string;
8925 ptrdiff_t count = SPECPDL_INDEX (); 8897 ptrdiff_t count = SPECPDL_INDEX ();
@@ -8952,7 +8924,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
8952 key sequence. */ 8924 key sequence. */
8953 Lisp_Object orig_keymap; 8925 Lisp_Object orig_keymap;
8954 8926
8955 /* 1 if we have already considered switching to the local-map property 8927 /* Positive if we have already considered switching to the local-map property
8956 of the place where a mouse click occurred. */ 8928 of the place where a mouse click occurred. */
8957 int localized_local_map = 0; 8929 int localized_local_map = 0;
8958 8930
@@ -8992,10 +8964,10 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
8992 /* Likewise, for key_translation_map and input-decode-map. */ 8964 /* Likewise, for key_translation_map and input-decode-map. */
8993 keyremap keytran, indec; 8965 keyremap keytran, indec;
8994 8966
8995 /* Non-zero if we are trying to map a key by changing an upper-case 8967 /* True if we are trying to map a key by changing an upper-case
8996 letter to lower case, or a shifted function key to an unshifted 8968 letter to lower case, or a shifted function key to an unshifted
8997 one. */ 8969 one. */
8998 int shift_translated = 0; 8970 bool shift_translated = 0;
8999 8971
9000 /* If we receive a `switch-frame' or `select-window' event in the middle of 8972 /* If we receive a `switch-frame' or `select-window' event in the middle of
9001 a key sequence, we put it off for later. 8973 a key sequence, we put it off for later.
@@ -9011,7 +8983,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9011 int original_uppercase_position = -1; 8983 int original_uppercase_position = -1;
9012 8984
9013 /* Gets around Microsoft compiler limitations. */ 8985 /* Gets around Microsoft compiler limitations. */
9014 int dummyflag = 0; 8986 bool dummyflag = 0;
9015 8987
9016 struct buffer *starting_buffer; 8988 struct buffer *starting_buffer;
9017 8989
@@ -9173,7 +9145,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9173 : (/* indec.start < t || fkey.start < t || */ keytran.start < t)) 9145 : (/* indec.start < t || fkey.start < t || */ keytran.start < t))
9174 { 9146 {
9175 Lisp_Object key; 9147 Lisp_Object key;
9176 int used_mouse_menu = 0; 9148 bool used_mouse_menu = 0;
9177 9149
9178 /* Where the last real key started. If we need to throw away a 9150 /* Where the last real key started. If we need to throw away a
9179 key that has expanded into more than one element of keybuf 9151 key that has expanded into more than one element of keybuf
@@ -9267,7 +9239,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9267 return. Any better way to fix this? -- cyd */ 9239 return. Any better way to fix this? -- cyd */
9268 || (interrupted_kboard != current_kboard)) 9240 || (interrupted_kboard != current_kboard))
9269 { 9241 {
9270 int found = 0; 9242 bool found = 0;
9271 struct kboard *k; 9243 struct kboard *k;
9272 9244
9273 for (k = all_kboards; k; k = k->next_kboard) 9245 for (k = all_kboards; k; k = k->next_kboard)
@@ -9821,7 +9793,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9821 while (indec.end < t) 9793 while (indec.end < t)
9822 { 9794 {
9823 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 9795 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
9824 int done, diff; 9796 bool done;
9797 int diff;
9825 9798
9826 GCPRO4 (indec.map, fkey.map, keytran.map, delayed_switch_frame); 9799 GCPRO4 (indec.map, fkey.map, keytran.map, delayed_switch_frame);
9827 done = keyremap_step (keybuf, bufsize, &indec, max (t, mock_input), 9800 done = keyremap_step (keybuf, bufsize, &indec, max (t, mock_input),
@@ -9855,7 +9828,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9855 while (fkey.end < indec.start) 9828 while (fkey.end < indec.start)
9856 { 9829 {
9857 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 9830 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
9858 int done, diff; 9831 bool done;
9832 int diff;
9859 9833
9860 GCPRO4 (indec.map, fkey.map, keytran.map, delayed_switch_frame); 9834 GCPRO4 (indec.map, fkey.map, keytran.map, delayed_switch_frame);
9861 done = keyremap_step (keybuf, bufsize, &fkey, 9835 done = keyremap_step (keybuf, bufsize, &fkey,
@@ -9884,7 +9858,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9884 while (keytran.end < fkey.start) 9858 while (keytran.end < fkey.start)
9885 { 9859 {
9886 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 9860 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
9887 int done, diff; 9861 bool done;
9862 int diff;
9888 9863
9889 GCPRO4 (indec.map, fkey.map, keytran.map, delayed_switch_frame); 9864 GCPRO4 (indec.map, fkey.map, keytran.map, delayed_switch_frame);
9890 done = keyremap_step (keybuf, bufsize, &keytran, max (t, mock_input), 9865 done = keyremap_step (keybuf, bufsize, &keytran, max (t, mock_input),
@@ -10270,38 +10245,32 @@ a special event, so ignore the prefix argument and don't clear it. */)
10270 10245
10271 10246
10272 10247
10273/* Return nonzero if input events are pending. */ 10248/* Return true if input events are pending. */
10274 10249
10275int 10250bool
10276detect_input_pending (void) 10251detect_input_pending (void)
10277{ 10252{
10278 if (!input_pending) 10253 return input_pending || get_input_pending (0);
10279 get_input_pending (&input_pending, 0);
10280
10281 return input_pending;
10282} 10254}
10283 10255
10284/* Return nonzero if input events other than mouse movements are 10256/* Return true if input events other than mouse movements are
10285 pending. */ 10257 pending. */
10286 10258
10287int 10259bool
10288detect_input_pending_ignore_squeezables (void) 10260detect_input_pending_ignore_squeezables (void)
10289{ 10261{
10290 if (!input_pending) 10262 return input_pending || get_input_pending (READABLE_EVENTS_IGNORE_SQUEEZABLES);
10291 get_input_pending (&input_pending, READABLE_EVENTS_IGNORE_SQUEEZABLES);
10292
10293 return input_pending;
10294} 10263}
10295 10264
10296/* Return nonzero if input events are pending, and run any pending timers. */ 10265/* Return true if input events are pending, and run any pending timers. */
10297 10266
10298int 10267bool
10299detect_input_pending_run_timers (int do_display) 10268detect_input_pending_run_timers (bool do_display)
10300{ 10269{
10301 int old_timers_run = timers_run; 10270 unsigned old_timers_run = timers_run;
10302 10271
10303 if (!input_pending) 10272 if (!input_pending)
10304 get_input_pending (&input_pending, READABLE_EVENTS_DO_TIMERS_NOW); 10273 get_input_pending (READABLE_EVENTS_DO_TIMERS_NOW);
10305 10274
10306 if (old_timers_run != timers_run && do_display) 10275 if (old_timers_run != timers_run && do_display)
10307 { 10276 {
@@ -10332,13 +10301,13 @@ clear_input_pending (void)
10332 input_pending = 0; 10301 input_pending = 0;
10333} 10302}
10334 10303
10335/* Return nonzero if there are pending requeued events. 10304/* Return true if there are pending requeued events.
10336 This isn't used yet. The hope is to make wait_reading_process_output 10305 This isn't used yet. The hope is to make wait_reading_process_output
10337 call it, and return if it runs Lisp code that unreads something. 10306 call it, and return if it runs Lisp code that unreads something.
10338 The problem is, kbd_buffer_get_event needs to be fixed to know what 10307 The problem is, kbd_buffer_get_event needs to be fixed to know what
10339 to do in that case. It isn't trivial. */ 10308 to do in that case. It isn't trivial. */
10340 10309
10341int 10310bool
10342requeued_events_pending_p (void) 10311requeued_events_pending_p (void)
10343{ 10312{
10344 return (!NILP (Vunread_command_events)); 10313 return (!NILP (Vunread_command_events));
@@ -10359,10 +10328,9 @@ if there is a doubt, the value is t. */)
10359 /* Process non-user-visible events (Bug#10195). */ 10328 /* Process non-user-visible events (Bug#10195). */
10360 process_special_events (); 10329 process_special_events ();
10361 10330
10362 get_input_pending (&input_pending, 10331 return (get_input_pending (READABLE_EVENTS_DO_TIMERS_NOW
10363 READABLE_EVENTS_DO_TIMERS_NOW 10332 | READABLE_EVENTS_FILTER_EVENTS)
10364 | READABLE_EVENTS_FILTER_EVENTS); 10333 ? Qt : Qnil);
10365 return input_pending > 0 ? Qt : Qnil;
10366} 10334}
10367 10335
10368DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0, 10336DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0,
@@ -10868,7 +10836,7 @@ handle_interrupt (bool in_signal_handler)
10868/* Handle a C-g by making read_char return C-g. */ 10836/* Handle a C-g by making read_char return C-g. */
10869 10837
10870static void 10838static void
10871quit_throw_to_read_char (int from_signal) 10839quit_throw_to_read_char (bool from_signal)
10872{ 10840{
10873 /* When not called from a signal handler it is safe to call 10841 /* When not called from a signal handler it is safe to call
10874 Lisp. */ 10842 Lisp. */
@@ -10898,7 +10866,7 @@ otherwise Emacs uses CBREAK mode.
10898See also `current-input-mode'. */) 10866See also `current-input-mode'. */)
10899 (Lisp_Object interrupt) 10867 (Lisp_Object interrupt)
10900{ 10868{
10901 int new_interrupt_input; 10869 bool new_interrupt_input;
10902#ifdef USABLE_SIGIO 10870#ifdef USABLE_SIGIO
10903#ifdef HAVE_X_WINDOWS 10871#ifdef HAVE_X_WINDOWS
10904 if (x_display_list != NULL) 10872 if (x_display_list != NULL)
diff --git a/src/keyboard.h b/src/keyboard.h
index d78c27fbf9b..e57c8cc7193 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -169,12 +169,12 @@ struct kboard
169 reading from this KBOARD again until more input arrives. */ 169 reading from this KBOARD again until more input arrives. */
170 char kbd_queue_has_data; 170 char kbd_queue_has_data;
171 171
172 /* Nonzero means echo each character as typed. */ 172 /* True means echo each character as typed. */
173 char immediate_echo; 173 unsigned immediate_echo : 1;
174 174
175 /* If we have echoed a prompt string specified by the user, 175 /* If we have echoed a prompt string specified by the user,
176 this is its length in characters. Otherwise this is -1. */ 176 this is its length in characters. Otherwise this is -1. */
177 char echo_after_prompt; 177 ptrdiff_t echo_after_prompt;
178 }; 178 };
179 179
180KEYBOARD_INLINE void 180KEYBOARD_INLINE void
@@ -463,14 +463,14 @@ extern Lisp_Object Qhelp_echo;
463extern Lisp_Object Qmode_line, Qvertical_line, Qheader_line; 463extern Lisp_Object Qmode_line, Qvertical_line, Qheader_line;
464 464
465/* True while doing kbd input. */ 465/* True while doing kbd input. */
466extern int waiting_for_input; 466extern bool waiting_for_input;
467 467
468/* Address (if not 0) of EMACS_TIME to zero out if a SIGIO interrupt 468/* Address (if not 0) of EMACS_TIME to zero out if a SIGIO interrupt
469 happens. */ 469 happens. */
470extern EMACS_TIME *input_available_clear_time; 470extern EMACS_TIME *input_available_clear_time;
471 471
472#if defined HAVE_WINDOW_SYSTEM && !defined USE_GTK && !defined HAVE_NS 472#if defined HAVE_WINDOW_SYSTEM && !defined USE_GTK && !defined HAVE_NS
473extern int ignore_mouse_drag_p; 473extern bool ignore_mouse_drag_p;
474#endif 474#endif
475 475
476/* The primary selection. */ 476/* The primary selection. */
@@ -482,7 +482,7 @@ struct input_event;
482extern Lisp_Object parse_modifiers (Lisp_Object); 482extern Lisp_Object parse_modifiers (Lisp_Object);
483extern Lisp_Object reorder_modifiers (Lisp_Object); 483extern Lisp_Object reorder_modifiers (Lisp_Object);
484extern Lisp_Object read_char (int, ptrdiff_t, Lisp_Object *, Lisp_Object, 484extern Lisp_Object read_char (int, ptrdiff_t, Lisp_Object *, Lisp_Object,
485 int *, EMACS_TIME *); 485 bool *, EMACS_TIME *);
486extern int parse_solitary_modifier (Lisp_Object symbol); 486extern int parse_solitary_modifier (Lisp_Object symbol);
487 487
488 488
@@ -506,10 +506,10 @@ extern Time last_event_timestamp;
506 506
507extern int quit_char; 507extern int quit_char;
508 508
509extern int timers_run; 509extern unsigned int timers_run;
510 510
511extern int menu_separator_name_p (const char *); 511extern bool menu_separator_name_p (const char *);
512extern int parse_menu_item (Lisp_Object, int); 512extern bool parse_menu_item (Lisp_Object, int);
513 513
514extern void init_kboard (KBOARD *); 514extern void init_kboard (KBOARD *);
515extern void delete_kboard (KBOARD *); 515extern void delete_kboard (KBOARD *);
@@ -524,15 +524,15 @@ extern void start_polling (void);
524extern void stop_polling (void); 524extern void stop_polling (void);
525extern void set_poll_suppress_count (int); 525extern void set_poll_suppress_count (int);
526extern int gobble_input (void); 526extern int gobble_input (void);
527extern int input_polling_used (void); 527extern bool input_polling_used (void);
528extern void clear_input_pending (void); 528extern void clear_input_pending (void);
529extern int requeued_events_pending_p (void); 529extern bool requeued_events_pending_p (void);
530extern void bind_polling_period (int); 530extern void bind_polling_period (int);
531extern int make_ctrl_char (int) ATTRIBUTE_CONST; 531extern int make_ctrl_char (int) ATTRIBUTE_CONST;
532extern void stuff_buffered_input (Lisp_Object); 532extern void stuff_buffered_input (Lisp_Object);
533extern void clear_waiting_for_input (void); 533extern void clear_waiting_for_input (void);
534extern void swallow_events (int); 534extern void swallow_events (bool);
535extern int lucid_event_type_list_p (Lisp_Object); 535extern bool lucid_event_type_list_p (Lisp_Object);
536extern void kbd_buffer_store_event (struct input_event *); 536extern void kbd_buffer_store_event (struct input_event *);
537extern void kbd_buffer_store_event_hold (struct input_event *, 537extern void kbd_buffer_store_event_hold (struct input_event *,
538 struct input_event *); 538 struct input_event *);
@@ -544,7 +544,7 @@ extern void gen_help_event (Lisp_Object, Lisp_Object, Lisp_Object,
544 Lisp_Object, ptrdiff_t); 544 Lisp_Object, ptrdiff_t);
545extern void kbd_buffer_store_help_event (Lisp_Object, Lisp_Object); 545extern void kbd_buffer_store_help_event (Lisp_Object, Lisp_Object);
546extern Lisp_Object menu_item_eval_property (Lisp_Object); 546extern Lisp_Object menu_item_eval_property (Lisp_Object);
547extern int kbd_buffer_events_waiting (int); 547extern bool kbd_buffer_events_waiting (void);
548extern void add_user_signal (int, const char *); 548extern void add_user_signal (int, const char *);
549 549
550extern int tty_read_avail_input (struct terminal *, struct input_event *); 550extern int tty_read_avail_input (struct terminal *, struct input_event *);
diff --git a/src/keymap.c b/src/keymap.c
index 6ea142651bf..fbdd31e0de3 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -99,12 +99,12 @@ static void describe_command (Lisp_Object, Lisp_Object);
99static void describe_translation (Lisp_Object, Lisp_Object); 99static void describe_translation (Lisp_Object, Lisp_Object);
100static void describe_map (Lisp_Object, Lisp_Object, 100static void describe_map (Lisp_Object, Lisp_Object,
101 void (*) (Lisp_Object, Lisp_Object), 101 void (*) (Lisp_Object, Lisp_Object),
102 int, Lisp_Object, Lisp_Object*, int, int); 102 bool, Lisp_Object, Lisp_Object*, bool, bool);
103static void describe_vector (Lisp_Object, Lisp_Object, Lisp_Object, 103static void describe_vector (Lisp_Object, Lisp_Object, Lisp_Object,
104 void (*) (Lisp_Object, Lisp_Object), int, 104 void (*) (Lisp_Object, Lisp_Object), bool,
105 Lisp_Object, Lisp_Object, int, int); 105 Lisp_Object, Lisp_Object, bool, bool);
106static void silly_event_symbol_error (Lisp_Object); 106static void silly_event_symbol_error (Lisp_Object);
107static Lisp_Object get_keyelt (Lisp_Object, int); 107static Lisp_Object get_keyelt (Lisp_Object, bool);
108 108
109/* Keymap object support - constructors and predicates. */ 109/* Keymap object support - constructors and predicates. */
110 110
@@ -207,15 +207,12 @@ when reading a key-sequence to be looked-up in this keymap. */)
207/* Check that OBJECT is a keymap (after dereferencing through any 207/* Check that OBJECT is a keymap (after dereferencing through any
208 symbols). If it is, return it. 208 symbols). If it is, return it.
209 209
210 If AUTOLOAD is non-zero and OBJECT is a symbol whose function value 210 If AUTOLOAD and if OBJECT is a symbol whose function value
211 is an autoload form, do the autoload and try again. 211 is an autoload form, do the autoload and try again.
212 If AUTOLOAD is nonzero, callers must assume GC is possible. 212 If AUTOLOAD, callers must assume GC is possible.
213
214 If the map needs to be autoloaded, but AUTOLOAD is zero (and ERROR
215 is zero as well), return Qt.
216 213
217 ERROR_IF_NOT_KEYMAP controls how we respond if OBJECT isn't a keymap. 214 ERROR_IF_NOT_KEYMAP controls how we respond if OBJECT isn't a keymap.
218 If ERROR_IF_NOT_KEYMAP is non-zero, signal an error; otherwise, 215 If ERROR_IF_NOT_KEYMAP, signal an error; otherwise,
219 just return Qnil. 216 just return Qnil.
220 217
221 Note that most of the time, we don't want to pursue autoloads. 218 Note that most of the time, we don't want to pursue autoloads.
@@ -224,11 +221,11 @@ when reading a key-sequence to be looked-up in this keymap. */)
224 but it seems to me that only read_key_sequence, Flookup_key, and 221 but it seems to me that only read_key_sequence, Flookup_key, and
225 Fdefine_key should cause keymaps to be autoloaded. 222 Fdefine_key should cause keymaps to be autoloaded.
226 223
227 This function can GC when AUTOLOAD is non-zero, because it calls 224 This function can GC when AUTOLOAD is true, because it calls
228 Fautoload_do_load which can GC. */ 225 Fautoload_do_load which can GC. */
229 226
230Lisp_Object 227Lisp_Object
231get_keymap (Lisp_Object object, int error_if_not_keymap, int autoload) 228get_keymap (Lisp_Object object, bool error_if_not_keymap, bool autoload)
232{ 229{
233 Lisp_Object tem; 230 Lisp_Object tem;
234 231
@@ -280,7 +277,7 @@ get_keymap (Lisp_Object object, int error_if_not_keymap, int autoload)
280 We assume that KEYMAP is a valid keymap. */ 277 We assume that KEYMAP is a valid keymap. */
281 278
282static Lisp_Object 279static Lisp_Object
283keymap_parent (Lisp_Object keymap, int autoload) 280keymap_parent (Lisp_Object keymap, bool autoload)
284{ 281{
285 Lisp_Object list; 282 Lisp_Object list;
286 283
@@ -307,7 +304,7 @@ If KEYMAP has no parent, return nil. */)
307} 304}
308 305
309/* Check whether MAP is one of MAPS parents. */ 306/* Check whether MAP is one of MAPS parents. */
310static int 307static bool
311keymap_memberp (Lisp_Object map, Lisp_Object maps) 308keymap_memberp (Lisp_Object map, Lisp_Object maps)
312{ 309{
313 if (NILP (map)) return 0; 310 if (NILP (map)) return 0;
@@ -365,19 +362,20 @@ Return PARENT. PARENT should be nil or another keymap. */)
365 362
366 MAP must be a keymap or a list of keymaps. 363 MAP must be a keymap or a list of keymaps.
367 364
368 If T_OK is non-zero, bindings for Qt are treated as default 365 If T_OK, bindings for Qt are treated as default
369 bindings; any key left unmentioned by other tables and bindings is 366 bindings; any key left unmentioned by other tables and bindings is
370 given the binding of Qt. 367 given the binding of Qt.
371 368
372 If T_OK is zero, bindings for Qt are not treated specially. 369 If not T_OK, bindings for Qt are not treated specially.
373 370
374 If NOINHERIT, don't accept a subkeymap found in an inherited keymap. 371 If NOINHERIT, don't accept a subkeymap found in an inherited keymap.
375 372
376 Returns Qunbound if no binding was found (and returns Qnil if a nil 373 Return Qunbound if no binding was found (and return Qnil if a nil
377 binding was found). */ 374 binding was found). */
378 375
379static Lisp_Object 376static Lisp_Object
380access_keymap_1 (Lisp_Object map, Lisp_Object idx, int t_ok, int noinherit, int autoload) 377access_keymap_1 (Lisp_Object map, Lisp_Object idx,
378 bool t_ok, bool noinherit, bool autoload)
381{ 379{
382 /* If idx is a list (some sort of mouse click, perhaps?), 380 /* If idx is a list (some sort of mouse click, perhaps?),
383 the index we want to use is the car of the list, which 381 the index we want to use is the car of the list, which
@@ -547,7 +545,7 @@ access_keymap_1 (Lisp_Object map, Lisp_Object idx, int t_ok, int noinherit, int
547 545
548Lisp_Object 546Lisp_Object
549access_keymap (Lisp_Object map, Lisp_Object idx, 547access_keymap (Lisp_Object map, Lisp_Object idx,
550 int t_ok, int noinherit, int autoload) 548 bool t_ok, bool noinherit, bool autoload)
551{ 549{
552 Lisp_Object val = access_keymap_1 (map, idx, t_ok, noinherit, autoload); 550 Lisp_Object val = access_keymap_1 (map, idx, t_ok, noinherit, autoload);
553 return EQ (val, Qunbound) ? Qnil : val; 551 return EQ (val, Qunbound) ? Qnil : val;
@@ -630,9 +628,10 @@ map_keymap_call (Lisp_Object key, Lisp_Object val, Lisp_Object fun, void *dummy)
630} 628}
631 629
632/* Same as map_keymap_internal, but traverses parent keymaps as well. 630/* Same as map_keymap_internal, but traverses parent keymaps as well.
633 A non-zero AUTOLOAD indicates that autoloaded keymaps should be loaded. */ 631 AUTOLOAD indicates that autoloaded keymaps should be loaded. */
634void 632void
635map_keymap (Lisp_Object map, map_keymap_function_t fun, Lisp_Object args, void *data, int autoload) 633map_keymap (Lisp_Object map, map_keymap_function_t fun, Lisp_Object args,
634 void *data, bool autoload)
636{ 635{
637 struct gcpro gcpro1; 636 struct gcpro gcpro1;
638 GCPRO1 (args); 637 GCPRO1 (args);
@@ -711,13 +710,13 @@ usage: (map-keymap FUNCTION KEYMAP) */)
711 Also if OBJECT has a menu string as the first element, 710 Also if OBJECT has a menu string as the first element,
712 remove that. Also remove a menu help string as second element. 711 remove that. Also remove a menu help string as second element.
713 712
714 If AUTOLOAD is nonzero, load autoloadable keymaps 713 If AUTOLOAD, load autoloadable keymaps
715 that are referred to with indirection. 714 that are referred to with indirection.
716 715
717 This can GC because menu_item_eval_property calls Feval. */ 716 This can GC because menu_item_eval_property calls Feval. */
718 717
719static Lisp_Object 718static Lisp_Object
720get_keyelt (Lisp_Object object, int autoload) 719get_keyelt (Lisp_Object object, bool autoload)
721{ 720{
722 while (1) 721 while (1)
723 { 722 {
@@ -1114,10 +1113,10 @@ binding is altered. If there is no binding for KEY, the new pair
1114binding KEY to DEF is added at the front of KEYMAP. */) 1113binding KEY to DEF is added at the front of KEYMAP. */)
1115 (Lisp_Object keymap, Lisp_Object key, Lisp_Object def) 1114 (Lisp_Object keymap, Lisp_Object key, Lisp_Object def)
1116{ 1115{
1117 register ptrdiff_t idx; 1116 ptrdiff_t idx;
1118 register Lisp_Object c; 1117 Lisp_Object c;
1119 register Lisp_Object cmd; 1118 Lisp_Object cmd;
1120 int metized = 0; 1119 bool metized = 0;
1121 int meta_bit; 1120 int meta_bit;
1122 ptrdiff_t length; 1121 ptrdiff_t length;
1123 struct gcpro gcpro1, gcpro2, gcpro3; 1122 struct gcpro gcpro1, gcpro2, gcpro3;
@@ -1271,11 +1270,11 @@ third optional argument ACCEPT-DEFAULT is non-nil, `lookup-key' will
1271recognize the default bindings, just as `read-key-sequence' does. */) 1270recognize the default bindings, just as `read-key-sequence' does. */)
1272 (Lisp_Object keymap, Lisp_Object key, Lisp_Object accept_default) 1271 (Lisp_Object keymap, Lisp_Object key, Lisp_Object accept_default)
1273{ 1272{
1274 register ptrdiff_t idx; 1273 ptrdiff_t idx;
1275 register Lisp_Object cmd; 1274 Lisp_Object cmd;
1276 register Lisp_Object c; 1275 Lisp_Object c;
1277 ptrdiff_t length; 1276 ptrdiff_t length;
1278 int t_ok = !NILP (accept_default); 1277 bool t_ok = !NILP (accept_default);
1279 struct gcpro gcpro1, gcpro2; 1278 struct gcpro gcpro1, gcpro2;
1280 1279
1281 GCPRO2 (keymap, key); 1280 GCPRO2 (keymap, key);
@@ -1887,7 +1886,7 @@ DEFUN ("current-minor-mode-maps", Fcurrent_minor_mode_maps, Scurrent_minor_mode_
1887struct accessible_keymaps_data { 1886struct accessible_keymaps_data {
1888 Lisp_Object maps, tail, thisseq; 1887 Lisp_Object maps, tail, thisseq;
1889 /* Does the current sequence end in the meta-prefix-char? */ 1888 /* Does the current sequence end in the meta-prefix-char? */
1890 int is_metized; 1889 bool is_metized;
1891}; 1890};
1892 1891
1893static void 1892static void
@@ -1898,7 +1897,7 @@ accessible_keymaps_1 (Lisp_Object key, Lisp_Object cmd, Lisp_Object args, void *
1898 Lisp_Object maps = d->maps; 1897 Lisp_Object maps = d->maps;
1899 Lisp_Object tail = d->tail; 1898 Lisp_Object tail = d->tail;
1900 Lisp_Object thisseq = d->thisseq; 1899 Lisp_Object thisseq = d->thisseq;
1901 int is_metized = d->is_metized && INTEGERP (key); 1900 bool is_metized = d->is_metized && INTEGERP (key);
1902 Lisp_Object tem; 1901 Lisp_Object tem;
1903 1902
1904 cmd = get_keymap (get_keyelt (cmd, 0), 0, 0); 1903 cmd = get_keymap (get_keyelt (cmd, 0), 0, 0);
@@ -2060,7 +2059,7 @@ The `kbd' macro is an approximate inverse of this. */)
2060 Lisp_Object sep = build_string (" "); 2059 Lisp_Object sep = build_string (" ");
2061 Lisp_Object key; 2060 Lisp_Object key;
2062 Lisp_Object result; 2061 Lisp_Object result;
2063 int add_meta = 0; 2062 bool add_meta = 0;
2064 USE_SAFE_ALLOCA; 2063 USE_SAFE_ALLOCA;
2065 2064
2066 if (!NILP (prefix)) 2065 if (!NILP (prefix))
@@ -2155,9 +2154,10 @@ The `kbd' macro is an approximate inverse of this. */)
2155 2154
2156 2155
2157char * 2156char *
2158push_key_description (EMACS_INT ch, char *p, int force_multibyte) 2157push_key_description (EMACS_INT ch, char *p)
2159{ 2158{
2160 int c, c2, tab_as_ci; 2159 int c, c2;
2160 bool tab_as_ci;
2161 2161
2162 /* Clear all the meaningless bits above the meta bit. */ 2162 /* Clear all the meaningless bits above the meta bit. */
2163 c = ch & (meta_modifier | ~ - meta_modifier); 2163 c = ch & (meta_modifier | ~ - meta_modifier);
@@ -2256,21 +2256,12 @@ push_key_description (EMACS_INT ch, char *p, int force_multibyte)
2256 *p++ = 'P'; 2256 *p++ = 'P';
2257 *p++ = 'C'; 2257 *p++ = 'C';
2258 } 2258 }
2259 else if (c < 128 2259 else if (c < 128)
2260 || (NILP (BVAR (current_buffer, enable_multibyte_characters)) 2260 *p++ = c;
2261 && SINGLE_BYTE_CHAR_P (c)
2262 && !force_multibyte))
2263 {
2264 *p++ = c;
2265 }
2266 else 2261 else
2267 { 2262 {
2268 /* Now we are sure that C is a valid character code. */ 2263 /* Now we are sure that C is a valid character code. */
2269 if (NILP (BVAR (current_buffer, enable_multibyte_characters)) 2264 p += CHAR_STRING (c, (unsigned char *) p);
2270 && ! force_multibyte)
2271 *p++ = multibyte_char_to_unibyte (c);
2272 else
2273 p += CHAR_STRING (c, (unsigned char *) p);
2274 } 2265 }
2275 2266
2276 return p; 2267 return p;
@@ -2299,9 +2290,8 @@ around function keys and event symbols. */)
2299 2290
2300 if (INTEGERP (key)) /* Normal character. */ 2291 if (INTEGERP (key)) /* Normal character. */
2301 { 2292 {
2302 char tem[KEY_DESCRIPTION_SIZE], *p; 2293 char tem[KEY_DESCRIPTION_SIZE];
2303 2294 char *p = push_key_description (XINT (key), tem);
2304 p = push_key_description (XINT (key), tem, 1);
2305 *p = 0; 2295 *p = 0;
2306 return make_specified_string (tem, -1, p - tem, 1); 2296 return make_specified_string (tem, -1, p - tem, 1);
2307 } 2297 }
@@ -2429,7 +2419,7 @@ static void where_is_internal_1 (Lisp_Object key, Lisp_Object binding,
2429 2419
2430static Lisp_Object 2420static Lisp_Object
2431shadow_lookup (Lisp_Object shadow, Lisp_Object key, Lisp_Object flag, 2421shadow_lookup (Lisp_Object shadow, Lisp_Object key, Lisp_Object flag,
2432 int remap) 2422 bool remap)
2433{ 2423{
2434 Lisp_Object tail, value; 2424 Lisp_Object tail, value;
2435 2425
@@ -2461,7 +2451,7 @@ static Lisp_Object Vmouse_events;
2461 2451
2462struct where_is_internal_data { 2452struct where_is_internal_data {
2463 Lisp_Object definition, this, last; 2453 Lisp_Object definition, this, last;
2464 int last_is_meta, noindirect; 2454 bool last_is_meta, noindirect;
2465 Lisp_Object sequences; 2455 Lisp_Object sequences;
2466}; 2456};
2467 2457
@@ -2474,7 +2464,7 @@ struct where_is_internal_data {
2474 2464
2475static Lisp_Object 2465static Lisp_Object
2476where_is_internal (Lisp_Object definition, Lisp_Object keymaps, 2466where_is_internal (Lisp_Object definition, Lisp_Object keymaps,
2477 int noindirect, int nomenus) 2467 bool noindirect, bool nomenus)
2478{ 2468{
2479 Lisp_Object maps = Qnil; 2469 Lisp_Object maps = Qnil;
2480 Lisp_Object found; 2470 Lisp_Object found;
@@ -2523,7 +2513,7 @@ where_is_internal (Lisp_Object definition, Lisp_Object keymaps,
2523 [M-CHAR] sequences, check if last character of the sequence 2513 [M-CHAR] sequences, check if last character of the sequence
2524 is the meta-prefix char. */ 2514 is the meta-prefix char. */
2525 Lisp_Object last; 2515 Lisp_Object last;
2526 int last_is_meta; 2516 bool last_is_meta;
2527 2517
2528 this = Fcar (XCAR (maps)); 2518 this = Fcar (XCAR (maps));
2529 map = Fcdr (XCAR (maps)); 2519 map = Fcdr (XCAR (maps));
@@ -2606,7 +2596,7 @@ The optional 5th arg NO-REMAP alters how command remapping is handled:
2606 /* Actually relevant bindings. */ 2596 /* Actually relevant bindings. */
2607 Lisp_Object found = Qnil; 2597 Lisp_Object found = Qnil;
2608 /* 1 means ignore all menu bindings entirely. */ 2598 /* 1 means ignore all menu bindings entirely. */
2609 int nomenus = !NILP (firstonly) && !EQ (firstonly, Qnon_ascii); 2599 bool nomenus = !NILP (firstonly) && !EQ (firstonly, Qnon_ascii);
2610 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; 2600 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
2611 /* List of sequences found via remapping. Keep them in a separate 2601 /* List of sequences found via remapping. Keep them in a separate
2612 variable, so as to push them later, since we prefer 2602 variable, so as to push them later, since we prefer
@@ -2615,7 +2605,7 @@ The optional 5th arg NO-REMAP alters how command remapping is handled:
2615 /* Whether or not we're handling remapped sequences. This is needed 2605 /* Whether or not we're handling remapped sequences. This is needed
2616 because remapping is not done recursively by Fcommand_remapping: you 2606 because remapping is not done recursively by Fcommand_remapping: you
2617 can't remap a remapped command. */ 2607 can't remap a remapped command. */
2618 int remapped = 0; 2608 bool remapped = 0;
2619 Lisp_Object tem = Qnil; 2609 Lisp_Object tem = Qnil;
2620 2610
2621 /* Refresh the C version of the modifier preference. */ 2611 /* Refresh the C version of the modifier preference. */
@@ -2767,10 +2757,10 @@ where_is_internal_1 (Lisp_Object key, Lisp_Object binding, Lisp_Object args, voi
2767{ 2757{
2768 struct where_is_internal_data *d = data; /* Cast! */ 2758 struct where_is_internal_data *d = data; /* Cast! */
2769 Lisp_Object definition = d->definition; 2759 Lisp_Object definition = d->definition;
2770 int noindirect = d->noindirect; 2760 bool noindirect = d->noindirect;
2771 Lisp_Object this = d->this; 2761 Lisp_Object this = d->this;
2772 Lisp_Object last = d->last; 2762 Lisp_Object last = d->last;
2773 int last_is_meta = d->last_is_meta; 2763 bool last_is_meta = d->last_is_meta;
2774 Lisp_Object sequence; 2764 Lisp_Object sequence;
2775 2765
2776 /* Search through indirections unless that's not wanted. */ 2766 /* Search through indirections unless that's not wanted. */
@@ -2821,8 +2811,8 @@ The optional argument MENUS, if non-nil, says to mention menu bindings.
2821 (Lisp_Object buffer, Lisp_Object prefix, Lisp_Object menus) 2811 (Lisp_Object buffer, Lisp_Object prefix, Lisp_Object menus)
2822{ 2812{
2823 Lisp_Object outbuf, shadow; 2813 Lisp_Object outbuf, shadow;
2824 int nomenu = NILP (menus); 2814 bool nomenu = NILP (menus);
2825 register Lisp_Object start1; 2815 Lisp_Object start1;
2826 struct gcpro gcpro1; 2816 struct gcpro gcpro1;
2827 2817
2828 const char *alternate_heading 2818 const char *alternate_heading
@@ -2857,10 +2847,10 @@ You type Translation\n\
2857 alternate_heading = 0; 2847 alternate_heading = 0;
2858 } 2848 }
2859 2849
2860 bufend = push_key_description (translate[c], buf, 1); 2850 bufend = push_key_description (translate[c], buf);
2861 insert (buf, bufend - buf); 2851 insert (buf, bufend - buf);
2862 Findent_to (make_number (16), make_number (1)); 2852 Findent_to (make_number (16), make_number (1));
2863 bufend = push_key_description (c, buf, 1); 2853 bufend = push_key_description (c, buf);
2864 insert (buf, bufend - buf); 2854 insert (buf, bufend - buf);
2865 2855
2866 insert ("\n", 1); 2856 insert ("\n", 1);
@@ -2977,34 +2967,34 @@ You type Translation\n\
2977 2967
2978/* Insert a description of the key bindings in STARTMAP, 2968/* Insert a description of the key bindings in STARTMAP,
2979 followed by those of all maps reachable through STARTMAP. 2969 followed by those of all maps reachable through STARTMAP.
2980 If PARTIAL is nonzero, omit certain "uninteresting" commands 2970 If PARTIAL, omit certain "uninteresting" commands
2981 (such as `undefined'). 2971 (such as `undefined').
2982 If SHADOW is non-nil, it is a list of maps; 2972 If SHADOW is non-nil, it is a list of maps;
2983 don't mention keys which would be shadowed by any of them. 2973 don't mention keys which would be shadowed by any of them.
2984 PREFIX, if non-nil, says mention only keys that start with PREFIX. 2974 PREFIX, if non-nil, says mention only keys that start with PREFIX.
2985 TITLE, if not 0, is a string to insert at the beginning. 2975 TITLE, if not 0, is a string to insert at the beginning.
2986 TITLE should not end with a colon or a newline; we supply that. 2976 TITLE should not end with a colon or a newline; we supply that.
2987 If NOMENU is not 0, then omit menu-bar commands. 2977 If NOMENU, then omit menu-bar commands.
2988 2978
2989 If TRANSL is nonzero, the definitions are actually key translations 2979 If TRANSL, the definitions are actually key translations
2990 so print strings and vectors differently. 2980 so print strings and vectors differently.
2991 2981
2992 If ALWAYS_TITLE is nonzero, print the title even if there are no maps 2982 If ALWAYS_TITLE, print the title even if there are no maps
2993 to look through. 2983 to look through.
2994 2984
2995 If MENTION_SHADOW is nonzero, then when something is shadowed by SHADOW, 2985 If MENTION_SHADOW, then when something is shadowed by SHADOW,
2996 don't omit it; instead, mention it but say it is shadowed. 2986 don't omit it; instead, mention it but say it is shadowed.
2997 2987
2998 Any inserted text ends in two newlines (used by `help-make-xrefs'). */ 2988 Any inserted text ends in two newlines (used by `help-make-xrefs'). */
2999 2989
3000void 2990void
3001describe_map_tree (Lisp_Object startmap, int partial, Lisp_Object shadow, 2991describe_map_tree (Lisp_Object startmap, bool partial, Lisp_Object shadow,
3002 Lisp_Object prefix, const char *title, int nomenu, int transl, 2992 Lisp_Object prefix, const char *title, bool nomenu,
3003 int always_title, int mention_shadow) 2993 bool transl, bool always_title, bool mention_shadow)
3004{ 2994{
3005 Lisp_Object maps, orig_maps, seen, sub_shadows; 2995 Lisp_Object maps, orig_maps, seen, sub_shadows;
3006 struct gcpro gcpro1, gcpro2, gcpro3; 2996 struct gcpro gcpro1, gcpro2, gcpro3;
3007 int something = 0; 2997 bool something = 0;
3008 const char *key_heading 2998 const char *key_heading
3009 = "\ 2999 = "\
3010key binding\n\ 3000key binding\n\
@@ -3179,7 +3169,12 @@ describe_translation (Lisp_Object definition, Lisp_Object args)
3179 into an array of `struct describe_map_elt', 3169 into an array of `struct describe_map_elt',
3180 then sorts them by the events. */ 3170 then sorts them by the events. */
3181 3171
3182struct describe_map_elt { Lisp_Object event; Lisp_Object definition; int shadowed; }; 3172struct describe_map_elt
3173{
3174 Lisp_Object event;
3175 Lisp_Object definition;
3176 bool shadowed;
3177};
3183 3178
3184/* qsort comparison function for sorting `struct describe_map_elt' by 3179/* qsort comparison function for sorting `struct describe_map_elt' by
3185 the event field. */ 3180 the event field. */
@@ -3209,14 +3204,14 @@ describe_map_compare (const void *aa, const void *bb)
3209static void 3204static void
3210describe_map (Lisp_Object map, Lisp_Object prefix, 3205describe_map (Lisp_Object map, Lisp_Object prefix,
3211 void (*elt_describer) (Lisp_Object, Lisp_Object), 3206 void (*elt_describer) (Lisp_Object, Lisp_Object),
3212 int partial, Lisp_Object shadow, 3207 bool partial, Lisp_Object shadow,
3213 Lisp_Object *seen, int nomenu, int mention_shadow) 3208 Lisp_Object *seen, bool nomenu, bool mention_shadow)
3214{ 3209{
3215 Lisp_Object tail, definition, event; 3210 Lisp_Object tail, definition, event;
3216 Lisp_Object tem; 3211 Lisp_Object tem;
3217 Lisp_Object suppress; 3212 Lisp_Object suppress;
3218 Lisp_Object kludge; 3213 Lisp_Object kludge;
3219 int first = 1; 3214 bool first = 1;
3220 struct gcpro gcpro1, gcpro2, gcpro3; 3215 struct gcpro gcpro1, gcpro2, gcpro3;
3221 3216
3222 /* These accumulate the values from sparse keymap bindings, 3217 /* These accumulate the values from sparse keymap bindings,
@@ -3258,7 +3253,7 @@ describe_map (Lisp_Object map, Lisp_Object prefix,
3258 1, mention_shadow); 3253 1, mention_shadow);
3259 else if (CONSP (XCAR (tail))) 3254 else if (CONSP (XCAR (tail)))
3260 { 3255 {
3261 int this_shadowed = 0; 3256 bool this_shadowed = 0;
3262 3257
3263 event = XCAR (XCAR (tail)); 3258 event = XCAR (XCAR (tail));
3264 3259
@@ -3428,7 +3423,7 @@ DESCRIBER is the output function used; nil means use `princ'. */)
3428 of bytes that lead to the character set or portion of a character 3423 of bytes that lead to the character set or portion of a character
3429 set described by this chartable. 3424 set described by this chartable.
3430 3425
3431 If PARTIAL is nonzero, it means do not mention suppressed commands 3426 If PARTIAL, it means do not mention suppressed commands
3432 (that assumes the vector is in a keymap). 3427 (that assumes the vector is in a keymap).
3433 3428
3434 SHADOW is a list of keymaps that shadow this map. 3429 SHADOW is a list of keymaps that shadow this map.
@@ -3448,8 +3443,8 @@ DESCRIBER is the output function used; nil means use `princ'. */)
3448static void 3443static void
3449describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args, 3444describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
3450 void (*elt_describer) (Lisp_Object, Lisp_Object), 3445 void (*elt_describer) (Lisp_Object, Lisp_Object),
3451 int partial, Lisp_Object shadow, Lisp_Object entire_map, 3446 bool partial, Lisp_Object shadow, Lisp_Object entire_map,
3452 int keymap_p, int mention_shadow) 3447 bool keymap_p, bool mention_shadow)
3453{ 3448{
3454 Lisp_Object definition; 3449 Lisp_Object definition;
3455 Lisp_Object tem2; 3450 Lisp_Object tem2;
@@ -3457,7 +3452,7 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
3457 int i; 3452 int i;
3458 Lisp_Object suppress; 3453 Lisp_Object suppress;
3459 Lisp_Object kludge; 3454 Lisp_Object kludge;
3460 int first = 1; 3455 bool first = 1;
3461 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 3456 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
3462 /* Range of elements to be handled. */ 3457 /* Range of elements to be handled. */
3463 int from, to, stop; 3458 int from, to, stop;
@@ -3497,7 +3492,7 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
3497 3492
3498 for (i = from; ; i++) 3493 for (i = from; ; i++)
3499 { 3494 {
3500 int this_shadowed = 0; 3495 bool this_shadowed = 0;
3501 int range_beg, range_end; 3496 int range_beg, range_end;
3502 Lisp_Object val; 3497 Lisp_Object val;
3503 3498
diff --git a/src/keymap.h b/src/keymap.h
index 5ed70c67b85..c704ee0b050 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -34,11 +34,11 @@ extern Lisp_Object Qkeymap, Qmenu_bar;
34extern Lisp_Object Qremap; 34extern Lisp_Object Qremap;
35extern Lisp_Object Qmenu_item; 35extern Lisp_Object Qmenu_item;
36extern Lisp_Object current_global_map; 36extern Lisp_Object current_global_map;
37extern char *push_key_description (EMACS_INT, char *, int); 37extern char *push_key_description (EMACS_INT, char *);
38extern Lisp_Object access_keymap (Lisp_Object, Lisp_Object, int, int, int); 38extern Lisp_Object access_keymap (Lisp_Object, Lisp_Object, bool, bool, bool);
39extern Lisp_Object get_keymap (Lisp_Object, int, int); 39extern Lisp_Object get_keymap (Lisp_Object, bool, bool);
40extern void describe_map_tree (Lisp_Object, int, Lisp_Object, Lisp_Object, 40extern void describe_map_tree (Lisp_Object, bool, Lisp_Object, Lisp_Object,
41 const char *, int, int, int, int); 41 const char *, bool, bool, bool, bool);
42extern ptrdiff_t current_minor_maps (Lisp_Object **, Lisp_Object **); 42extern ptrdiff_t current_minor_maps (Lisp_Object **, Lisp_Object **);
43extern void initial_define_key (Lisp_Object, int, const char *); 43extern void initial_define_key (Lisp_Object, int, const char *);
44extern void initial_define_lispy_key (Lisp_Object, const char *, const char *); 44extern void initial_define_lispy_key (Lisp_Object, const char *, const char *);
@@ -47,7 +47,8 @@ extern void keys_of_keymap (void);
47 47
48typedef void (*map_keymap_function_t) 48typedef void (*map_keymap_function_t)
49 (Lisp_Object key, Lisp_Object val, Lisp_Object args, void* data); 49 (Lisp_Object key, Lisp_Object val, Lisp_Object args, void* data);
50extern void map_keymap (Lisp_Object map, map_keymap_function_t fun, Lisp_Object largs, void* cargs, int autoload); 50extern void map_keymap (Lisp_Object, map_keymap_function_t, Lisp_Object,
51 void *, bool);
51extern void map_keymap_canonical (Lisp_Object map, 52extern void map_keymap_canonical (Lisp_Object map,
52 map_keymap_function_t fun, 53 map_keymap_function_t fun,
53 Lisp_Object args, void *data); 54 Lisp_Object args, void *data);
diff --git a/src/lisp.h b/src/lisp.h
index 71e542cc769..1de9ec74d9f 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3198,9 +3198,9 @@ extern ptrdiff_t fast_string_match_ignore_case (Lisp_Object, Lisp_Object);
3198extern ptrdiff_t fast_looking_at (Lisp_Object, ptrdiff_t, ptrdiff_t, 3198extern ptrdiff_t fast_looking_at (Lisp_Object, ptrdiff_t, ptrdiff_t,
3199 ptrdiff_t, ptrdiff_t, Lisp_Object); 3199 ptrdiff_t, ptrdiff_t, Lisp_Object);
3200extern ptrdiff_t scan_buffer (int, ptrdiff_t, ptrdiff_t, ptrdiff_t, 3200extern ptrdiff_t scan_buffer (int, ptrdiff_t, ptrdiff_t, ptrdiff_t,
3201 ptrdiff_t *, int); 3201 ptrdiff_t *, bool);
3202extern EMACS_INT scan_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, 3202extern EMACS_INT scan_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t,
3203 EMACS_INT, int); 3203 EMACS_INT, bool);
3204extern ptrdiff_t find_next_newline (ptrdiff_t, int); 3204extern ptrdiff_t find_next_newline (ptrdiff_t, int);
3205extern ptrdiff_t find_next_newline_no_quit (ptrdiff_t, ptrdiff_t); 3205extern ptrdiff_t find_next_newline_no_quit (ptrdiff_t, ptrdiff_t);
3206extern ptrdiff_t find_before_next_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t); 3206extern ptrdiff_t find_before_next_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t);
@@ -3243,7 +3243,7 @@ extern Lisp_Object Qdisabled, QCfilter;
3243extern Lisp_Object Qup, Qdown, Qbottom; 3243extern Lisp_Object Qup, Qdown, Qbottom;
3244extern Lisp_Object Qtop; 3244extern Lisp_Object Qtop;
3245extern Lisp_Object last_undo_boundary; 3245extern Lisp_Object last_undo_boundary;
3246extern int input_pending; 3246extern bool input_pending;
3247extern Lisp_Object menu_bar_items (Lisp_Object); 3247extern Lisp_Object menu_bar_items (Lisp_Object);
3248extern Lisp_Object tool_bar_items (Lisp_Object, int *); 3248extern Lisp_Object tool_bar_items (Lisp_Object, int *);
3249extern void discard_mouse_events (void); 3249extern void discard_mouse_events (void);
@@ -3251,9 +3251,9 @@ extern void discard_mouse_events (void);
3251void handle_input_available_signal (int); 3251void handle_input_available_signal (int);
3252#endif 3252#endif
3253extern Lisp_Object pending_funcalls; 3253extern Lisp_Object pending_funcalls;
3254extern int detect_input_pending (void); 3254extern bool detect_input_pending (void);
3255extern int detect_input_pending_ignore_squeezables (void); 3255extern bool detect_input_pending_ignore_squeezables (void);
3256extern int detect_input_pending_run_timers (int); 3256extern bool detect_input_pending_run_timers (bool);
3257extern void safe_run_hooks (Lisp_Object); 3257extern void safe_run_hooks (Lisp_Object);
3258extern void cmd_error_internal (Lisp_Object, const char *); 3258extern void cmd_error_internal (Lisp_Object, const char *);
3259extern Lisp_Object command_loop_1 (void); 3259extern Lisp_Object command_loop_1 (void);
@@ -3332,7 +3332,7 @@ extern bool running_asynch_code;
3332extern Lisp_Object QCtype, Qlocal; 3332extern Lisp_Object QCtype, Qlocal;
3333extern Lisp_Object Qprocessp; 3333extern Lisp_Object Qprocessp;
3334extern void kill_buffer_processes (Lisp_Object); 3334extern void kill_buffer_processes (Lisp_Object);
3335extern int wait_reading_process_output (intmax_t, int, int, int, 3335extern int wait_reading_process_output (intmax_t, int, int, bool,
3336 Lisp_Object, 3336 Lisp_Object,
3337 struct Lisp_Process *, 3337 struct Lisp_Process *,
3338 int); 3338 int);
@@ -3559,7 +3559,8 @@ extern char *emacs_root_dir (void);
3559 Used during startup to detect startup of dumped Emacs. */ 3559 Used during startup to detect startup of dumped Emacs. */
3560extern bool initialized; 3560extern bool initialized;
3561 3561
3562extern int immediate_quit; /* Nonzero means ^G can quit instantly. */ 3562/* True means ^G can quit instantly. */
3563extern bool immediate_quit;
3563 3564
3564extern void *xmalloc (size_t); 3565extern void *xmalloc (size_t);
3565extern void *xzalloc (size_t); 3566extern void *xzalloc (size_t);
diff --git a/src/menu.c b/src/menu.c
index 835267b2f0c..6e052dc65a9 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -331,7 +331,7 @@ single_menu_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy, void *sk
331{ 331{
332 Lisp_Object map, item_string, enabled; 332 Lisp_Object map, item_string, enabled;
333 struct gcpro gcpro1, gcpro2; 333 struct gcpro gcpro1, gcpro2;
334 int res; 334 bool res;
335 struct skp *skp = skp_v; 335 struct skp *skp = skp_v;
336 336
337 /* Parse the menu item and leave the result in item_properties. */ 337 /* Parse the menu item and leave the result in item_properties. */
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 9af732c6c45..df8b3ea3e54 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -129,7 +129,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu)
129 BOOL needsSet = NO; 129 BOOL needsSet = NO;
130 const char *submenuTitle = [[submenu title] UTF8String]; 130 const char *submenuTitle = [[submenu title] UTF8String];
131 extern int waiting_for_input; 131 extern int waiting_for_input;
132 int owfi; 132 bool owfi;
133 Lisp_Object items; 133 Lisp_Object items;
134 widget_value *wv, *first_wv, *prev_wv = 0; 134 widget_value *wv, *first_wv, *prev_wv = 0;
135 int i; 135 int i;
diff --git a/src/process.c b/src/process.c
index c941a196539..2cbce9d28ea 100644
--- a/src/process.c
+++ b/src/process.c
@@ -4302,7 +4302,7 @@ wait_reading_process_output_1 (void)
4302 -1 meaning caller will actually read the input, so don't throw to 4302 -1 meaning caller will actually read the input, so don't throw to
4303 the quit handler, or 4303 the quit handler, or
4304 4304
4305 DO_DISPLAY != 0 means redisplay should be done to show subprocess 4305 DO_DISPLAY means redisplay should be done to show subprocess
4306 output that arrives. 4306 output that arrives.
4307 4307
4308 If WAIT_FOR_CELL is a cons cell, wait until its car is non-nil 4308 If WAIT_FOR_CELL is a cons cell, wait until its car is non-nil
@@ -4322,7 +4322,7 @@ wait_reading_process_output_1 (void)
4322 4322
4323int 4323int
4324wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, 4324wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4325 int do_display, 4325 bool do_display,
4326 Lisp_Object wait_for_cell, 4326 Lisp_Object wait_for_cell,
4327 struct Lisp_Process *wait_proc, int just_wait_proc) 4327 struct Lisp_Process *wait_proc, int just_wait_proc)
4328{ 4328{
@@ -4419,7 +4419,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4419 4419
4420 do 4420 do
4421 { 4421 {
4422 int old_timers_run = timers_run; 4422 unsigned old_timers_run = timers_run;
4423 struct buffer *old_buffer = current_buffer; 4423 struct buffer *old_buffer = current_buffer;
4424 Lisp_Object old_window = selected_window; 4424 Lisp_Object old_window = selected_window;
4425 4425
@@ -4753,7 +4753,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4753 4753
4754 if (read_kbd != 0) 4754 if (read_kbd != 0)
4755 { 4755 {
4756 int old_timers_run = timers_run; 4756 unsigned old_timers_run = timers_run;
4757 struct buffer *old_buffer = current_buffer; 4757 struct buffer *old_buffer = current_buffer;
4758 Lisp_Object old_window = selected_window; 4758 Lisp_Object old_window = selected_window;
4759 int leave = 0; 4759 int leave = 0;
@@ -6821,14 +6821,14 @@ extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *,
6821 see full version for other parameters. We know that wait_proc will 6821 see full version for other parameters. We know that wait_proc will
6822 always be NULL, since `subprocesses' isn't defined. 6822 always be NULL, since `subprocesses' isn't defined.
6823 6823
6824 DO_DISPLAY != 0 means redisplay should be done to show subprocess 6824 DO_DISPLAY means redisplay should be done to show subprocess
6825 output that arrives. 6825 output that arrives.
6826 6826
6827 Return true if we received input from any process. */ 6827 Return true if we received input from any process. */
6828 6828
6829int 6829int
6830wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, 6830wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
6831 int do_display, 6831 bool do_display,
6832 Lisp_Object wait_for_cell, 6832 Lisp_Object wait_for_cell,
6833 struct Lisp_Process *wait_proc, int just_wait_proc) 6833 struct Lisp_Process *wait_proc, int just_wait_proc)
6834{ 6834{
@@ -6904,7 +6904,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
6904 6904
6905 do 6905 do
6906 { 6906 {
6907 int old_timers_run = timers_run; 6907 unsigned old_timers_run = timers_run;
6908 timer_delay = timer_check (); 6908 timer_delay = timer_check ();
6909 if (timers_run != old_timers_run && do_display) 6909 if (timers_run != old_timers_run && do_display)
6910 /* We must retry, since a timer may have requeued itself 6910 /* We must retry, since a timer may have requeued itself
diff --git a/src/search.c b/src/search.c
index 7c084c62e28..aacdbe33eef 100644
--- a/src/search.c
+++ b/src/search.c
@@ -636,12 +636,12 @@ newline_cache_on_off (struct buffer *buf)
636 If we don't find COUNT instances before reaching END, set *SHORTAGE 636 If we don't find COUNT instances before reaching END, set *SHORTAGE
637 to the number of TARGETs left unfound, and return END. 637 to the number of TARGETs left unfound, and return END.
638 638
639 If ALLOW_QUIT is non-zero, set immediate_quit. That's good to do 639 If ALLOW_QUIT, set immediate_quit. That's good to do
640 except when inside redisplay. */ 640 except when inside redisplay. */
641 641
642ptrdiff_t 642ptrdiff_t
643scan_buffer (register int target, ptrdiff_t start, ptrdiff_t end, 643scan_buffer (int target, ptrdiff_t start, ptrdiff_t end,
644 ptrdiff_t count, ptrdiff_t *shortage, int allow_quit) 644 ptrdiff_t count, ptrdiff_t *shortage, bool allow_quit)
645{ 645{
646 struct region_cache *newline_cache; 646 struct region_cache *newline_cache;
647 int direction; 647 int direction;
@@ -837,23 +837,23 @@ scan_buffer (register int target, ptrdiff_t start, ptrdiff_t end,
837 the number of line boundaries left unfound, and position at 837 the number of line boundaries left unfound, and position at
838 the limit we bumped up against. 838 the limit we bumped up against.
839 839
840 If ALLOW_QUIT is non-zero, set immediate_quit. That's good to do 840 If ALLOW_QUIT, set immediate_quit. That's good to do
841 except in special cases. */ 841 except in special cases. */
842 842
843EMACS_INT 843EMACS_INT
844scan_newline (ptrdiff_t start, ptrdiff_t start_byte, 844scan_newline (ptrdiff_t start, ptrdiff_t start_byte,
845 ptrdiff_t limit, ptrdiff_t limit_byte, 845 ptrdiff_t limit, ptrdiff_t limit_byte,
846 register EMACS_INT count, int allow_quit) 846 EMACS_INT count, bool allow_quit)
847{ 847{
848 int direction = ((count > 0) ? 1 : -1); 848 int direction = ((count > 0) ? 1 : -1);
849 849
850 register unsigned char *cursor; 850 unsigned char *cursor;
851 unsigned char *base; 851 unsigned char *base;
852 852
853 ptrdiff_t ceiling; 853 ptrdiff_t ceiling;
854 register unsigned char *ceiling_addr; 854 unsigned char *ceiling_addr;
855 855
856 int old_immediate_quit = immediate_quit; 856 bool old_immediate_quit = immediate_quit;
857 857
858 /* The code that follows is like scan_buffer 858 /* The code that follows is like scan_buffer
859 but checks for either newline or carriage return. */ 859 but checks for either newline or carriage return. */
diff --git a/src/termopts.h b/src/termopts.h
index 49588ef0cbd..05fa0a52eee 100644
--- a/src/termopts.h
+++ b/src/termopts.h
@@ -18,7 +18,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
18 18
19 19
20/* Nonzero means use interrupt-driven input. */ 20/* Nonzero means use interrupt-driven input. */
21extern int interrupt_input; 21extern bool interrupt_input;
22 22
23/* Nonzero while interrupts are temporarily deferred during redisplay. */ 23/* Nonzero while interrupts are temporarily deferred during redisplay. */
24extern int interrupts_deferred; 24extern bool interrupts_deferred;