aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaroly Lorentey2006-01-29 00:17:11 +0000
committerKaroly Lorentey2006-01-29 00:17:11 +0000
commit9688ff534500a278871366f699cd0ead3524b68a (patch)
treeccbd2eb6198e55f7dae0c2b70b5adb0f3c761b71
parent67ddbec3529fd15915d09a196321f7d081dfc610 (diff)
downloademacs-9688ff534500a278871366f699cd0ead3524b68a.tar.gz
emacs-9688ff534500a278871366f699cd0ead3524b68a.zip
Eliminate wrong_kboard_jmpbuf.
* src/keyboard.c (read_char, read_char_minibuf_menu_prompt) (read_key_sequence, read_filtered_event): Eliminate wrong_kboard_jmpbuf. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-500
-rw-r--r--README.multi-tty9
-rw-r--r--src/keyboard.c60
-rw-r--r--src/lread.c11
3 files changed, 37 insertions, 43 deletions
diff --git a/README.multi-tty b/README.multi-tty
index 261aa84ae78..ac5d5667c52 100644
--- a/README.multi-tty
+++ b/README.multi-tty
@@ -404,10 +404,6 @@ THINGS TO DO
404** Understand how `quit_throw_to_read_char' works, and fix any bugs 404** Understand how `quit_throw_to_read_char' works, and fix any bugs
405 that come to light. 405 that come to light.
406 406
407** Replace wrong_kboard_jmpbuf with a special return value of
408 read_char. It is absurd that we use setjmp/longjmp just to return
409 to the immediate caller.
410
411** See if getcjmp can be eliminated somehow. Why does Emacs allow 407** See if getcjmp can be eliminated somehow. Why does Emacs allow
412 asynchronous input processing while it's reading input anyway? 408 asynchronous input processing while it's reading input anyway?
413 409
@@ -1452,6 +1448,11 @@ DIARY OF CHANGES
1452 `getcjmp' when Emacs was waiting for input when the C-g event 1448 `getcjmp' when Emacs was waiting for input when the C-g event
1453 arrived.) 1449 arrived.)
1454 1450
1451-- Replace wrong_kboard_jmpbuf with a special return value of
1452 read_char. It is absurd that we use setjmp/longjmp just to return
1453 to the immediate caller.
1454
1455 (Done in patch-500.)
1455 1456
1456;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d 1457;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d
1457 1458
diff --git a/src/keyboard.c b/src/keyboard.c
index 142a0f3c26c..cbf0987048a 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -651,8 +651,7 @@ static Lisp_Object read_char_x_menu_prompt P_ ((int, Lisp_Object *,
651 Lisp_Object, int *)); 651 Lisp_Object, int *));
652static Lisp_Object read_char_x_menu_prompt (); 652static Lisp_Object read_char_x_menu_prompt ();
653static Lisp_Object read_char_minibuf_menu_prompt P_ ((int, int, 653static Lisp_Object read_char_minibuf_menu_prompt P_ ((int, int,
654 Lisp_Object *, 654 Lisp_Object *));
655 jmp_buf *));
656static Lisp_Object make_lispy_event P_ ((struct input_event *)); 655static Lisp_Object make_lispy_event P_ ((struct input_event *));
657#ifdef HAVE_MOUSE 656#ifdef HAVE_MOUSE
658static Lisp_Object make_lispy_movement P_ ((struct frame *, Lisp_Object, 657static Lisp_Object make_lispy_movement P_ ((struct frame *, Lisp_Object,
@@ -678,7 +677,7 @@ static void timer_start_idle P_ ((void));
678static void timer_stop_idle P_ ((void)); 677static void timer_stop_idle P_ ((void));
679static void timer_resume_idle P_ ((void)); 678static void timer_resume_idle P_ ((void));
680 679
681Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, int *, jmp_buf *)); 680Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, int *));
682 681
683/* Nonzero means don't try to suspend even if the operating system seems 682/* Nonzero means don't try to suspend even if the operating system seems
684 to support it. */ 683 to support it. */
@@ -2460,19 +2459,18 @@ do { if (polling_stopped_here) start_polling (); \
2460 if we used a mouse menu to read the input, or zero otherwise. If 2459 if we used a mouse menu to read the input, or zero otherwise. If
2461 USED_MOUSE_MENU is null, we don't dereference it. 2460 USED_MOUSE_MENU is null, we don't dereference it.
2462 2461
2463 WRONG_KBOARD_JMPBUF should be a stack context to longjmp to in case 2462 Value is -2 when we find input on another keyboard. A second call
2464 we find input on another keyboard. 2463 to read_char will read it.
2465 2464
2466 Value is t if we showed a menu and the user rejected it. */ 2465 Value is t if we showed a menu and the user rejected it. */
2467 2466
2468Lisp_Object 2467Lisp_Object
2469read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, wrong_kboard_jmpbuf) 2468read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2470 int commandflag; 2469 int commandflag;
2471 int nmaps; 2470 int nmaps;
2472 Lisp_Object *maps; 2471 Lisp_Object *maps;
2473 Lisp_Object prev_event; 2472 Lisp_Object prev_event;
2474 int *used_mouse_menu; 2473 int *used_mouse_menu;
2475 jmp_buf *wrong_kboard_jmpbuf;
2476{ 2474{
2477 volatile Lisp_Object c; 2475 volatile Lisp_Object c;
2478 int count; 2476 int count;
@@ -2688,8 +2686,11 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, wrong_kboard_j
2688 && unread_command_char < 0 2686 && unread_command_char < 0
2689 && !detect_input_pending_run_timers (0)) 2687 && !detect_input_pending_run_timers (0))
2690 { 2688 {
2691 c = read_char_minibuf_menu_prompt (commandflag, nmaps, maps, 2689 c = read_char_minibuf_menu_prompt (commandflag, nmaps, maps);
2692 wrong_kboard_jmpbuf); 2690
2691 if (INTEGERP (c) && XINT (c) == -2)
2692 return c; /* wrong_kboard_jmpbuf */
2693
2693 if (! NILP (c)) 2694 if (! NILP (c))
2694 { 2695 {
2695 key_already_recorded = 1; 2696 key_already_recorded = 1;
@@ -2742,9 +2743,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, wrong_kboard_j
2742 /* This is going to exit from read_char 2743 /* This is going to exit from read_char
2743 so we had better get rid of this frame's stuff. */ 2744 so we had better get rid of this frame's stuff. */
2744 UNGCPRO; 2745 UNGCPRO;
2745 if (wrong_kboard_jmpbuf == NULL) 2746 return make_number (-2); /* wrong_kboard_jmpbuf */
2746 abort ();
2747 longjmp (*wrong_kboard_jmpbuf, 1);
2748 } 2747 }
2749 } 2748 }
2750#endif 2749#endif
@@ -2888,9 +2887,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, wrong_kboard_j
2888 if (NILP (c) && current_kboard != orig_kboard) 2887 if (NILP (c) && current_kboard != orig_kboard)
2889 { 2888 {
2890 UNGCPRO; 2889 UNGCPRO;
2891 if (wrong_kboard_jmpbuf == NULL) 2890 return make_number (-2); /* wrong_kboard_jmpbuf */
2892 abort ();
2893 longjmp (*wrong_kboard_jmpbuf, 1);
2894 } 2891 }
2895 2892
2896 /* If this has become non-nil here, it has been set by a timer 2893 /* If this has become non-nil here, it has been set by a timer
@@ -2941,9 +2938,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, wrong_kboard_j
2941 /* This is going to exit from read_char 2938 /* This is going to exit from read_char
2942 so we had better get rid of this frame's stuff. */ 2939 so we had better get rid of this frame's stuff. */
2943 UNGCPRO; 2940 UNGCPRO;
2944 if (wrong_kboard_jmpbuf == NULL) 2941 return make_number (-2); /* wrong_kboard_jmpbuf */
2945 abort ();
2946 longjmp (*wrong_kboard_jmpbuf, 1);
2947 } 2942 }
2948 } 2943 }
2949#endif 2944#endif
@@ -2990,9 +2985,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, wrong_kboard_j
2990 /* This is going to exit from read_char 2985 /* This is going to exit from read_char
2991 so we had better get rid of this frame's stuff. */ 2986 so we had better get rid of this frame's stuff. */
2992 UNGCPRO; 2987 UNGCPRO;
2993 if (wrong_kboard_jmpbuf == NULL) 2988 return make_number (-2);
2994 abort ();
2995 longjmp (*wrong_kboard_jmpbuf, 1);
2996 } 2989 }
2997#endif 2990#endif
2998 } 2991 }
@@ -3310,7 +3303,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, wrong_kboard_j
3310 3303
3311 cancel_echoing (); 3304 cancel_echoing ();
3312 do 3305 do
3313 c = read_char (0, 0, 0, Qnil, 0, wrong_kboard_jmpbuf); 3306 c = read_char (0, 0, 0, Qnil, 0);
3314 while (BUFFERP (c)); 3307 while (BUFFERP (c));
3315 /* Remove the help from the frame */ 3308 /* Remove the help from the frame */
3316 unbind_to (count, Qnil); 3309 unbind_to (count, Qnil);
@@ -3320,7 +3313,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, wrong_kboard_j
3320 { 3313 {
3321 cancel_echoing (); 3314 cancel_echoing ();
3322 do 3315 do
3323 c = read_char (0, 0, 0, Qnil, 0, wrong_kboard_jmpbuf); 3316 c = read_char (0, 0, 0, Qnil, 0);
3324 while (BUFFERP (c)); 3317 while (BUFFERP (c));
3325 } 3318 }
3326 } 3319 }
@@ -8241,11 +8234,10 @@ static char *read_char_minibuf_menu_text;
8241static int read_char_minibuf_menu_width; 8234static int read_char_minibuf_menu_width;
8242 8235
8243static Lisp_Object 8236static Lisp_Object
8244read_char_minibuf_menu_prompt (commandflag, nmaps, maps, wrong_kboard_jmpbuf) 8237read_char_minibuf_menu_prompt (commandflag, nmaps, maps)
8245 int commandflag ; 8238 int commandflag ;
8246 int nmaps; 8239 int nmaps;
8247 Lisp_Object *maps; 8240 Lisp_Object *maps;
8248 jmp_buf *wrong_kboard_jmpbuf;
8249{ 8241{
8250 int mapno; 8242 int mapno;
8251 register Lisp_Object name; 8243 register Lisp_Object name;
@@ -8468,12 +8460,14 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps, wrong_kboard_jmpbuf)
8468 orig_defn_macro = current_kboard->defining_kbd_macro; 8460 orig_defn_macro = current_kboard->defining_kbd_macro;
8469 current_kboard->defining_kbd_macro = Qnil; 8461 current_kboard->defining_kbd_macro = Qnil;
8470 do 8462 do
8471 obj = read_char (commandflag, 0, 0, Qt, 0, wrong_kboard_jmpbuf); 8463 obj = read_char (commandflag, 0, 0, Qt, 0);
8472 while (BUFFERP (obj)); 8464 while (BUFFERP (obj));
8473 current_kboard->defining_kbd_macro = orig_defn_macro; 8465 current_kboard->defining_kbd_macro = orig_defn_macro;
8474 8466
8475 if (!INTEGERP (obj)) 8467 if (!INTEGERP (obj))
8476 return obj; 8468 return obj;
8469 else if (XINT (obj) == -2)
8470 return obj;
8477 else 8471 else
8478 ch = XINT (obj); 8472 ch = XINT (obj);
8479 8473
@@ -8838,7 +8832,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
8838 /* Read the first char of the sequence specially, before setting 8832 /* Read the first char of the sequence specially, before setting
8839 up any keymaps, in case a filter runs and switches buffers on us. */ 8833 up any keymaps, in case a filter runs and switches buffers on us. */
8840 first_event = read_char (NILP (prompt), 0, submaps, last_nonmenu_event, 8834 first_event = read_char (NILP (prompt), 0, submaps, last_nonmenu_event,
8841 &junk, NULL); 8835 &junk);
8842#endif /* GOBBLE_FIRST_EVENT */ 8836#endif /* GOBBLE_FIRST_EVENT */
8843 8837
8844 orig_local_map = get_local_map (PT, current_buffer, Qlocal_map); 8838 orig_local_map = get_local_map (PT, current_buffer, Qlocal_map);
@@ -9014,7 +9008,12 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
9014#ifdef MULTI_KBOARD 9008#ifdef MULTI_KBOARD
9015 KBOARD *interrupted_kboard = current_kboard; 9009 KBOARD *interrupted_kboard = current_kboard;
9016 struct frame *interrupted_frame = SELECTED_FRAME (); 9010 struct frame *interrupted_frame = SELECTED_FRAME ();
9017 if (setjmp (*wrong_kboard_jmpbuf)) 9011#endif
9012 key = read_char (NILP (prompt), nmaps,
9013 (Lisp_Object *) submaps, last_nonmenu_event,
9014 &used_mouse_menu);
9015#ifdef MULTI_KBOARD
9016 if (INTEGERP (key) && XINT (key) == -2) /* wrong_kboard_jmpbuf */
9018 { 9017 {
9019 int found = 0; 9018 int found = 0;
9020 struct kboard *k; 9019 struct kboard *k;
@@ -9063,9 +9062,6 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
9063 goto replay_sequence; 9062 goto replay_sequence;
9064 } 9063 }
9065#endif 9064#endif
9066 key = read_char (NILP (prompt), nmaps,
9067 (Lisp_Object *) submaps, last_nonmenu_event,
9068 &used_mouse_menu, wrong_kboard_jmpbuf);
9069 } 9065 }
9070 9066
9071 /* read_char returns t when it shows a menu and the user rejects it. 9067 /* read_char returns t when it shows a menu and the user rejects it.
diff --git a/src/lread.c b/src/lread.c
index 0eb54393482..345af109050 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -435,7 +435,7 @@ static void substitute_in_interval P_ ((INTERVAL, Lisp_Object));
435 435
436/* Get a character from the tty. */ 436/* Get a character from the tty. */
437 437
438extern Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, int *, jmp_buf *)); 438extern Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, int *));
439 439
440/* Read input events until we get one that's acceptable for our purposes. 440/* Read input events until we get one that's acceptable for our purposes.
441 441
@@ -461,7 +461,6 @@ read_filtered_event (no_switch_frame, ascii_required, error_nonascii,
461 int no_switch_frame, ascii_required, error_nonascii, input_method; 461 int no_switch_frame, ascii_required, error_nonascii, input_method;
462{ 462{
463 volatile register Lisp_Object val, delayed_switch_frame; 463 volatile register Lisp_Object val, delayed_switch_frame;
464 jmp_buf *volatile wrong_kboard_jmpbuf = alloca (sizeof (jmp_buf));
465 464
466#ifdef HAVE_WINDOW_SYSTEM 465#ifdef HAVE_WINDOW_SYSTEM
467 if (display_hourglass_p) 466 if (display_hourglass_p)
@@ -472,12 +471,10 @@ read_filtered_event (no_switch_frame, ascii_required, error_nonascii,
472 471
473 /* Read until we get an acceptable event. */ 472 /* Read until we get an acceptable event. */
474 retry: 473 retry:
475 setjmp (*wrong_kboard_jmpbuf); 474 do
475 val = read_char (0, 0, 0, (input_method ? Qnil : Qt), 0);
476 while (INTEGERP (val) && XINT (val) == -2); /* wrong_kboard_jmpbuf */
476 477
477 val = read_char (0, 0, 0,
478 (input_method ? Qnil : Qt),
479 0, wrong_kboard_jmpbuf);
480
481 if (BUFFERP (val)) 478 if (BUFFERP (val))
482 goto retry; 479 goto retry;
483 480