diff options
| author | Richard M. Stallman | 1993-09-08 17:53:11 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-09-08 17:53:11 +0000 |
| commit | dd2281ae2a204fe83ccdcae665e34cedb4a480de (patch) | |
| tree | 9beb59b1b2c6b46032f2141f800d7bcd80246cd2 /src/process.c | |
| parent | 64e971c33be459710a200492cf1e398197828095 (diff) | |
| download | emacs-dd2281ae2a204fe83ccdcae665e34cedb4a480de.tar.gz emacs-dd2281ae2a204fe83ccdcae665e34cedb4a480de.zip | |
(keyboard_descriptor): New variable.
(wait_reading_process_input, init_keyboard): Use it.
Also call change_input_fd.
(change_keyboard_wait_descriptor): New function.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 51 |
1 files changed, 35 insertions, 16 deletions
diff --git a/src/process.c b/src/process.c index 45fec280cce..a7e4a07e5d8 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -73,6 +73,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 73 | #include "commands.h" | 73 | #include "commands.h" |
| 74 | #include "frame.h" | 74 | #include "frame.h" |
| 75 | 75 | ||
| 76 | Lisp_Object Qprocessp; | ||
| 76 | Lisp_Object Qrun, Qstop, Qsignal, Qopen, Qclosed; | 77 | Lisp_Object Qrun, Qstop, Qsignal, Qopen, Qclosed; |
| 77 | /* Qexit is declared and initialized in eval.c. */ | 78 | /* Qexit is declared and initialized in eval.c. */ |
| 78 | 79 | ||
| @@ -150,7 +151,7 @@ char *sys_siglist[] = | |||
| 150 | 151 | ||
| 151 | /* t means use pty, nil means use a pipe, | 152 | /* t means use pty, nil means use a pipe, |
| 152 | maybe other values to come. */ | 153 | maybe other values to come. */ |
| 153 | Lisp_Object Vprocess_connection_type; | 154 | static Lisp_Object Vprocess_connection_type; |
| 154 | 155 | ||
| 155 | #ifdef SKTPAIR | 156 | #ifdef SKTPAIR |
| 156 | #ifndef HAVE_SOCKETS | 157 | #ifndef HAVE_SOCKETS |
| @@ -159,10 +160,10 @@ Lisp_Object Vprocess_connection_type; | |||
| 159 | #endif /* SKTPAIR */ | 160 | #endif /* SKTPAIR */ |
| 160 | 161 | ||
| 161 | /* Number of events of change of status of a process. */ | 162 | /* Number of events of change of status of a process. */ |
| 162 | int process_tick; | 163 | static int process_tick; |
| 163 | 164 | ||
| 164 | /* Number of events for which the user or sentinel has been notified. */ | 165 | /* Number of events for which the user or sentinel has been notified. */ |
| 165 | int update_tick; | 166 | static int update_tick; |
| 166 | 167 | ||
| 167 | #ifdef FD_SET | 168 | #ifdef FD_SET |
| 168 | /* We could get this from param.h, but better not to depend on finding that. | 169 | /* We could get this from param.h, but better not to depend on finding that. |
| @@ -187,19 +188,19 @@ int update_tick; | |||
| 187 | 188 | ||
| 188 | /* Mask of bits indicating the descriptors that we wait for input on */ | 189 | /* Mask of bits indicating the descriptors that we wait for input on */ |
| 189 | 190 | ||
| 190 | SELECT_TYPE input_wait_mask; | 191 | static SELECT_TYPE input_wait_mask; |
| 192 | |||
| 193 | /* Descriptor to use for keyboard input. */ | ||
| 194 | static int keyboard_descriptor; | ||
| 191 | 195 | ||
| 192 | int delete_exited_processes; | 196 | /* Nonzero means delete a process right away if it exits. */ |
| 197 | static int delete_exited_processes; | ||
| 193 | 198 | ||
| 194 | /* Indexed by descriptor, gives the process (if any) for that descriptor */ | 199 | /* Indexed by descriptor, gives the process (if any) for that descriptor */ |
| 195 | Lisp_Object chan_process[MAXDESC]; | 200 | static Lisp_Object chan_process[MAXDESC]; |
| 196 | 201 | ||
| 197 | /* Alist of elements (NAME . PROCESS) */ | 202 | /* Alist of elements (NAME . PROCESS) */ |
| 198 | Lisp_Object Vprocess_alist; | 203 | static Lisp_Object Vprocess_alist; |
| 199 | |||
| 200 | Lisp_Object Qprocessp; | ||
| 201 | |||
| 202 | Lisp_Object get_process (); | ||
| 203 | 204 | ||
| 204 | /* Buffered-ahead input char from process, indexed by channel. | 205 | /* Buffered-ahead input char from process, indexed by channel. |
| 205 | -1 means empty (no char is buffered). | 206 | -1 means empty (no char is buffered). |
| @@ -207,7 +208,9 @@ Lisp_Object get_process (); | |||
| 207 | output from the process is to read at least one char. | 208 | output from the process is to read at least one char. |
| 208 | Always -1 on systems that support FIONREAD. */ | 209 | Always -1 on systems that support FIONREAD. */ |
| 209 | 210 | ||
| 210 | int proc_buffered_char[MAXDESC]; | 211 | static int proc_buffered_char[MAXDESC]; |
| 212 | |||
| 213 | static Lisp_Object get_process (); | ||
| 211 | 214 | ||
| 212 | /* Compute the Lisp form of the process status, p->status, from | 215 | /* Compute the Lisp form of the process status, p->status, from |
| 213 | the numeric status that was returned by `wait'. */ | 216 | the numeric status that was returned by `wait'. */ |
| @@ -1753,7 +1756,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) | |||
| 1753 | but that led to lossage handling selection_request events: | 1756 | but that led to lossage handling selection_request events: |
| 1754 | within one, we would start to handle another. */ | 1757 | within one, we would start to handle another. */ |
| 1755 | if (! XINT (read_kbd)) | 1758 | if (! XINT (read_kbd)) |
| 1756 | FD_CLR (0, &Available); | 1759 | FD_CLR (keyboard_descriptor, &Available); |
| 1757 | 1760 | ||
| 1758 | /* If frame size has changed or the window is newly mapped, | 1761 | /* If frame size has changed or the window is newly mapped, |
| 1759 | redisplay now, before we start to wait. There is a race | 1762 | redisplay now, before we start to wait. There is a race |
| @@ -1816,7 +1819,8 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) | |||
| 1816 | error("select error: %s", sys_errlist[xerrno]); | 1819 | error("select error: %s", sys_errlist[xerrno]); |
| 1817 | } | 1820 | } |
| 1818 | #if defined(sun) && !defined(USG5_4) | 1821 | #if defined(sun) && !defined(USG5_4) |
| 1819 | else if (nfds > 0 && FD_ISSET (0, &Available) && interrupt_input) | 1822 | else if (nfds > 0 && FD_ISSET (keyboard_descriptor, &Available) |
| 1823 | && interrupt_input) | ||
| 1820 | /* System sometimes fails to deliver SIGIO. | 1824 | /* System sometimes fails to deliver SIGIO. |
| 1821 | 1825 | ||
| 1822 | David J. Mackenzie says that Emacs doesn't compile under | 1826 | David J. Mackenzie says that Emacs doesn't compile under |
| @@ -1851,7 +1855,8 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) | |||
| 1851 | In that case, there really is no input and no SIGIO, | 1855 | In that case, there really is no input and no SIGIO, |
| 1852 | but select says there is input. */ | 1856 | but select says there is input. */ |
| 1853 | 1857 | ||
| 1854 | if (XINT (read_kbd) && interrupt_input && (FD_ISSET (fileno (stdin), &Available))) | 1858 | if (XINT (read_kbd) && interrupt_input |
| 1859 | && (FD_ISSET (keyboard_descriptor, &Available))) | ||
| 1855 | kill (0, SIGIO); | 1860 | kill (0, SIGIO); |
| 1856 | #endif | 1861 | #endif |
| 1857 | 1862 | ||
| @@ -2930,7 +2935,10 @@ init_process () | |||
| 2930 | #endif | 2935 | #endif |
| 2931 | 2936 | ||
| 2932 | FD_ZERO (&input_wait_mask); | 2937 | FD_ZERO (&input_wait_mask); |
| 2933 | FD_SET (0, &input_wait_mask); | 2938 | |
| 2939 | keyboard_descriptor = 0; | ||
| 2940 | FD_SET (keyboard_descriptor, &input_wait_mask); | ||
| 2941 | |||
| 2934 | Vprocess_alist = Qnil; | 2942 | Vprocess_alist = Qnil; |
| 2935 | for (i = 0; i < MAXDESC; i++) | 2943 | for (i = 0; i < MAXDESC; i++) |
| 2936 | { | 2944 | { |
| @@ -2939,6 +2947,17 @@ init_process () | |||
| 2939 | } | 2947 | } |
| 2940 | } | 2948 | } |
| 2941 | 2949 | ||
| 2950 | /* From now on, assume keyboard input comes from descriptor DESC. */ | ||
| 2951 | |||
| 2952 | void | ||
| 2953 | change_keyboard_wait_descriptor (desc) | ||
| 2954 | int desc; | ||
| 2955 | { | ||
| 2956 | FD_CLR (keyboard_descriptor, &input_wait_mask); | ||
| 2957 | keyboard_descriptor = desc; | ||
| 2958 | FD_SET (keyboard_descriptor, &input_wait_mask); | ||
| 2959 | } | ||
| 2960 | |||
| 2942 | syms_of_process () | 2961 | syms_of_process () |
| 2943 | { | 2962 | { |
| 2944 | #ifdef HAVE_SOCKETS | 2963 | #ifdef HAVE_SOCKETS |