[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/process.c [lexbind]
From: |
Miles Bader |
Subject: |
[Emacs-diffs] Changes to emacs/src/process.c [lexbind] |
Date: |
Sat, 04 Sep 2004 05:41:17 -0400 |
Index: emacs/src/process.c
diff -c emacs/src/process.c:1.373.2.13 emacs/src/process.c:1.373.2.14
*** emacs/src/process.c:1.373.2.13 Sat Sep 4 09:24:36 2004
--- emacs/src/process.c Sat Sep 4 09:26:26 2004
***************
*** 3777,3789 ****
else
seconds = NILP (process) ? -1 : 0;
- if (NILP (process))
- XSETFASTINT (process, 0);
-
return
! (wait_reading_process_input (seconds, useconds, process,
! NILP (just_this_one) ? 0 :
! !INTEGERP (just_this_one) ? -1 : -2)
? Qt : Qnil);
}
--- 3777,3788 ----
else
seconds = NILP (process) ? -1 : 0;
return
! (wait_reading_process_output (seconds, useconds, 0, 0,
! Qnil,
! !NILP (process) ? XPROCESS (process) : NULL,
! NILP (just_this_one) ? 0 :
! !INTEGERP (just_this_one) ? 1 : -1)
? Qt : Qnil);
}
***************
*** 3983,3994 ****
lisp code is being evalled.
This is also used in record_asynch_buffer_change.
For that purpose, this must be 0
! when not inside wait_reading_process_input. */
static int waiting_for_user_input_p;
/* This is here so breakpoints can be put on it. */
static void
! wait_reading_process_input_1 ()
{
}
--- 3982,3993 ----
lisp code is being evalled.
This is also used in record_asynch_buffer_change.
For that purpose, this must be 0
! when not inside wait_reading_process_output. */
static int waiting_for_user_input_p;
/* This is here so breakpoints can be put on it. */
static void
! wait_reading_process_output_1 ()
{
}
***************
*** 4010,4037 ****
1 to return when input is available, or
-1 meaning caller will actually read the input, so don't throw to
the quit handler, or
! a cons cell, meaning wait until its car is non-nil
! (and gobble terminal input into the buffer if any arrives), or
! a process object, meaning wait until something arrives from that
! process. The return value is true iff we read some input from
! that process.
!
! If READ_KBD is a process object, DO_DISPLAY < 0 means handle only
! output from that process (suspending output from other processes)
! and DO_DISPLAY == -2 specifically means don't run any timers either.
! Otherwise, != 0 means redisplay should be done to show subprocess
output that arrives.
! If READ_KBD is a pointer to a struct Lisp_Process, then the
! function returns true iff we received input from that process
! before the timeout elapsed.
Otherwise, return true iff we received input from any process. */
int
! wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
! int time_limit, microsecs;
! Lisp_Object read_kbd;
! int do_display;
{
register int channel, nfds;
SELECT_TYPE Available;
--- 4009,4040 ----
1 to return when input is available, or
-1 meaning caller will actually read the input, so don't throw to
the quit handler, or
!
! DO_DISPLAY != 0 means redisplay should be done to show subprocess
output that arrives.
! If WAIT_FOR_CELL is a cons cell, wait until its car is non-nil
! (and gobble terminal input into the buffer if any arrives).
!
! If WAIT_PROC is specified, wait until something arrives from that
! process. The return value is true iff we read some input from
! that process.
!
! If JUST_WAIT_PROC is non-nil, handle only output from WAIT_PROC
! (suspending output from other processes). A negative value
! means don't run any timers either.
!
! If WAIT_PROC is specified, then the function returns true iff we
! received input from that process before the timeout elapsed.
Otherwise, return true iff we received input from any process. */
int
! wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
! wait_for_cell, wait_proc, just_wait_proc)
! int time_limit, microsecs, read_kbd, do_display;
! Lisp_Object wait_for_cell;
! struct Lisp_Process *wait_proc;
! int just_wait_proc;
{
register int channel, nfds;
SELECT_TYPE Available;
***************
*** 4041,4079 ****
Lisp_Object proc;
EMACS_TIME timeout, end_time;
int wait_channel = -1;
- struct Lisp_Process *wait_proc = 0;
- int just_wait_proc = 0;
int got_some_input = 0;
/* Either nil or a cons cell, the car of which is of interest and
may be changed outside of this routine. */
- Lisp_Object wait_for_cell = Qnil;
int saved_waiting_for_user_input_p = waiting_for_user_input_p;
FD_ZERO (&Available);
FD_ZERO (&Connecting);
! /* If read_kbd is a process to watch, set wait_proc and wait_channel
! accordingly. */
! if (PROCESSP (read_kbd))
! {
! wait_proc = XPROCESS (read_kbd);
! wait_channel = XINT (wait_proc->infd);
! XSETFASTINT (read_kbd, 0);
! if (do_display < 0)
! {
! just_wait_proc = do_display;
! do_display = 0;
! }
! }
!
! /* If waiting for non-nil in a cell, record where. */
! if (CONSP (read_kbd))
! {
! wait_for_cell = read_kbd;
! XSETFASTINT (read_kbd, 0);
! }
! waiting_for_user_input_p = XINT (read_kbd);
/* Since we may need to wait several times,
compute the absolute time to return at. */
--- 4044,4062 ----
Lisp_Object proc;
EMACS_TIME timeout, end_time;
int wait_channel = -1;
int got_some_input = 0;
/* Either nil or a cons cell, the car of which is of interest and
may be changed outside of this routine. */
int saved_waiting_for_user_input_p = waiting_for_user_input_p;
FD_ZERO (&Available);
FD_ZERO (&Connecting);
! /* If wait_proc is a process to watch, set wait_channel accordingly. */
! if (wait_proc != NULL)
! wait_channel = XINT (wait_proc->infd);
! waiting_for_user_input_p = read_kbd;
/* Since we may need to wait several times,
compute the absolute time to return at. */
***************
*** 4101,4107 ****
/* If calling from keyboard input, do not quit
since we want to return C-g as an input character.
Otherwise, do pending quit if requested. */
! if (XINT (read_kbd) >= 0)
QUIT;
#ifdef SYNC_INPUT
else if (interrupt_input_pending)
--- 4084,4090 ----
/* If calling from keyboard input, do not quit
since we want to return C-g as an input character.
Otherwise, do pending quit if requested. */
! if (read_kbd >= 0)
QUIT;
#ifdef SYNC_INPUT
else if (interrupt_input_pending)
***************
*** 4139,4145 ****
the wait is supposed to be short,
and those callers cannot handle running arbitrary Lisp code here. */
if (NILP (wait_for_cell)
! && just_wait_proc != -2)
{
EMACS_TIME timer_delay;
--- 4122,4128 ----
the wait is supposed to be short,
and those callers cannot handle running arbitrary Lisp code here. */
if (NILP (wait_for_cell)
! && just_wait_proc >= 0)
{
EMACS_TIME timer_delay;
***************
*** 4167,4173 ****
while (!detect_input_pending ());
/* If there is unread keyboard input, also return. */
! if (XINT (read_kbd) != 0
&& requeued_events_pending_p ())
break;
--- 4150,4156 ----
while (!detect_input_pending ());
/* If there is unread keyboard input, also return. */
! if (read_kbd != 0
&& requeued_events_pending_p ())
break;
***************
*** 4185,4191 ****
else if (time_limit != -1)
{
/* This is so a breakpoint can be put here. */
! wait_reading_process_input_1 ();
}
}
--- 4168,4174 ----
else if (time_limit != -1)
{
/* This is so a breakpoint can be put here. */
! wait_reading_process_output_1 ();
}
}
***************
*** 4195,4201 ****
It is important that we do this before checking for process
activity. If we get a SIGCHLD after the explicit checks for
process activity, timeout is the only way we will know. */
! if (XINT (read_kbd) < 0)
set_waiting_for_input (&timeout);
/* If status of something has changed, and no input is
--- 4178,4184 ----
It is important that we do this before checking for process
activity. If we get a SIGCHLD after the explicit checks for
process activity, timeout is the only way we will know. */
! if (read_kbd < 0)
set_waiting_for_input (&timeout);
/* If status of something has changed, and no input is
***************
*** 4275,4282 ****
/* Wait till there is something to do */
! if (just_wait_proc)
{
FD_SET (XINT (wait_proc->infd), &Available);
check_connect = check_delay = 0;
}
--- 4258,4267 ----
/* Wait till there is something to do */
! if (wait_proc && just_wait_proc)
{
+ if (XINT (wait_proc->infd) < 0) /* Terminated */
+ break;
FD_SET (XINT (wait_proc->infd), &Available);
check_connect = check_delay = 0;
}
***************
*** 4287,4293 ****
}
else
{
! if (! XINT (read_kbd))
Available = non_keyboard_wait_mask;
else
Available = input_wait_mask;
--- 4272,4278 ----
}
else
{
! if (! read_kbd)
Available = non_keyboard_wait_mask;
else
Available = input_wait_mask;
***************
*** 4304,4315 ****
{
clear_waiting_for_input ();
redisplay_preserve_echo_area (11);
! if (XINT (read_kbd) < 0)
set_waiting_for_input (&timeout);
}
no_avail = 0;
! if (XINT (read_kbd) && detect_input_pending ())
{
nfds = 0;
no_avail = 1;
--- 4289,4300 ----
{
clear_waiting_for_input ();
redisplay_preserve_echo_area (11);
! if (read_kbd < 0)
set_waiting_for_input (&timeout);
}
no_avail = 0;
! if (read_kbd && detect_input_pending ())
{
nfds = 0;
no_avail = 1;
***************
*** 4426,4435 ****
/* If we are using polling for input,
and we see input available, make it get read now.
Otherwise it might not actually get read for a second.
! And on hpux, since we turn off polling in wait_reading_process_input,
it might never get read at all if we don't spend much time
! outside of wait_reading_process_input. */
! if (XINT (read_kbd) && interrupt_input
&& keyboard_bit_set (&Available)
&& input_polling_used ())
kill (getpid (), SIGALRM);
--- 4411,4420 ----
/* If we are using polling for input,
and we see input available, make it get read now.
Otherwise it might not actually get read for a second.
! And on hpux, since we turn off polling in wait_reading_process_output,
it might never get read at all if we don't spend much time
! outside of wait_reading_process_output. */
! if (read_kbd && interrupt_input
&& keyboard_bit_set (&Available)
&& input_polling_used ())
kill (getpid (), SIGALRM);
***************
*** 4439,4445 ****
/* If there is any, return immediately
to give it higher priority than subprocesses */
! if (XINT (read_kbd) != 0)
{
int old_timers_run = timers_run;
struct buffer *old_buffer = current_buffer;
--- 4424,4430 ----
/* If there is any, return immediately
to give it higher priority than subprocesses */
! if (read_kbd != 0)
{
int old_timers_run = timers_run;
struct buffer *old_buffer = current_buffer;
***************
*** 4464,4470 ****
}
/* If there is unread keyboard input, also return. */
! if (XINT (read_kbd) != 0
&& requeued_events_pending_p ())
break;
--- 4449,4455 ----
}
/* If there is unread keyboard input, also return. */
! if (read_kbd != 0
&& requeued_events_pending_p ())
break;
***************
*** 4475,4481 ****
That would causes delays in pasting selections, for example.
(We used to do this only if wait_for_cell.) */
! if (XINT (read_kbd) == 0 && detect_input_pending ())
{
swallow_events (do_display);
#if 0 /* Exiting when read_kbd doesn't request that seems wrong, though. */
--- 4460,4466 ----
That would causes delays in pasting selections, for example.
(We used to do this only if wait_for_cell.) */
! if (read_kbd == 0 && detect_input_pending ())
{
swallow_events (do_display);
#if 0 /* Exiting when read_kbd doesn't request that seems wrong, though. */
***************
*** 4494,4500 ****
In that case, there really is no input and no SIGIO,
but select says there is input. */
! if (XINT (read_kbd) && interrupt_input
&& keyboard_bit_set (&Available) && ! noninteractive)
kill (getpid (), SIGIO);
#endif
--- 4479,4485 ----
In that case, there really is no input and no SIGIO,
but select says there is input. */
! if (read_kbd && interrupt_input
&& keyboard_bit_set (&Available) && ! noninteractive)
kill (getpid (), SIGIO);
#endif
***************
*** 4504,4510 ****
/* If checking input just got us a size-change event from X,
obey it now if we should. */
! if (XINT (read_kbd) || ! NILP (wait_for_cell))
do_pending_window_change (0);
/* Check for data from a process. */
--- 4489,4495 ----
/* If checking input just got us a size-change event from X,
obey it now if we should. */
! if (read_kbd || ! NILP (wait_for_cell))
do_pending_window_change (0);
/* Check for data from a process. */
***************
*** 4679,4685 ****
/* If calling from keyboard input, do not quit
since we want to return C-g as an input character.
Otherwise, do pending quit if requested. */
! if (XINT (read_kbd) >= 0)
{
/* Prevent input_pending from remaining set if we quit. */
clear_input_pending ();
--- 4664,4670 ----
/* If calling from keyboard input, do not quit
since we want to return C-g as an input character.
Otherwise, do pending quit if requested. */
! if (read_kbd >= 0)
{
/* Prevent input_pending from remaining set if we quit. */
clear_input_pending ();
***************
*** 5326,5332 ****
that may allow the program
to finish doing output and read more. */
{
- Lisp_Object zero;
int offset = 0;
#ifdef BROKEN_PTY_READ_AFTER_EAGAIN
--- 5311,5316 ----
***************
*** 5361,5371 ****
else if (STRINGP (object))
offset = buf - SDATA (object);
- XSETFASTINT (zero, 0);
#ifdef EMACS_HAS_USECS
! wait_reading_process_input (0, 20000, zero, 0);
#else
! wait_reading_process_input (1, 0, zero, 0);
#endif
if (BUFFERP (object))
--- 5345,5354 ----
else if (STRINGP (object))
offset = buf - SDATA (object);
#ifdef EMACS_HAS_USECS
! wait_reading_process_output (0, 20000, 0, 0, Qnil, NULL,
0);
#else
! wait_reading_process_output (1, 0, 0, 0, Qnil, NULL, 0);
#endif
if (BUFFERP (object))
***************
*** 5594,5610 ****
break;
}
! #ifndef _POSIX_VDISABLE
! #ifdef CVDISABLE
! #define _POSIX_VDISABLE CVDISABLE
! #else
! #define _POSIX_VDISABLE '\0'
! #endif
! #endif
!
! if (sig_char && *sig_char != _POSIX_VDISABLE)
! send_process (proc, sig_char, 1, Qnil);
! return;
#else /* ! HAVE_TERMIOS */
/* On Berkeley descendants, the following IOCTL's retrieve the
--- 5577,5589 ----
break;
}
! if (sig_char && *sig_char != CDISABLE)
! {
! send_process (proc, sig_char, 1, Qnil);
! return;
! }
! /* If we can't send the signal with a character,
! fall through and send it another way. */
#else /* ! HAVE_TERMIOS */
/* On Berkeley descendants, the following IOCTL's retrieve the
***************
*** 5661,5669 ****
you'd better be using one of the alternatives above! */
#endif /* ! defined (TCGETA) */
#endif /* ! defined (TIOCGLTC) && defined (TIOCGETC) */
! #endif /* ! defined HAVE_TERMIOS */
abort ();
! /* The code above always returns from the function. */
#endif /* defined (SIGNALS_VIA_CHARACTERS) */
#ifdef TIOCGPGRP
--- 5640,5651 ----
you'd better be using one of the alternatives above! */
#endif /* ! defined (TCGETA) */
#endif /* ! defined (TIOCGLTC) && defined (TIOCGETC) */
! /* In this case, the code above should alway returns. */
abort ();
! #endif /* ! defined HAVE_TERMIOS */
!
! /* The code above may fall through if it can't
! handle the signal. */
#endif /* defined (SIGNALS_VIA_CHARACTERS) */
#ifdef TIOCGPGRP
***************
*** 6235,6241 ****
FD_CLR (XINT (p->infd), &non_keyboard_wait_mask);
}
! /* Tell wait_reading_process_input that it needs to wake up and
look around. */
if (input_available_clear_time)
EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0);
--- 6217,6223 ----
FD_CLR (XINT (p->infd), &non_keyboard_wait_mask);
}
! /* Tell wait_reading_process_output that it needs to wake up and
look around. */
if (input_available_clear_time)
EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0);
***************
*** 6253,6259 ****
else if (WIFSIGNALED (w))
synch_process_termsig = WTERMSIG (w);
! /* Tell wait_reading_process_input that it needs to wake up and
look around. */
if (input_available_clear_time)
EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0);
--- 6235,6241 ----
else if (WIFSIGNALED (w))
synch_process_termsig = WTERMSIG (w);
! /* Tell wait_reading_process_output that it needs to wake up and
look around. */
if (input_available_clear_time)
EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0);
***************
*** 6895,6904 ****
1 to return when input is available, or
-1 means caller will actually read the input, so don't throw to
the quit handler.
! a cons cell, meaning wait until its car is non-nil
! (and gobble terminal input into the buffer if any arrives), or
! We know that read_kbd will never be a Lisp_Process, since
! `subprocesses' isn't defined.
do_display != 0 means redisplay should be done to show subprocess
output that arrives.
--- 6877,6885 ----
1 to return when input is available, or
-1 means caller will actually read the input, so don't throw to
the quit handler.
!
! see full version for other parameters. We know that wait_proc will
! always be NULL, since `subprocesses' isn't defined.
do_display != 0 means redisplay should be done to show subprocess
output that arrives.
***************
*** 6906,6932 ****
Return true iff we received input from any process. */
int
! wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
! int time_limit, microsecs;
! Lisp_Object read_kbd;
! int do_display;
{
register int nfds;
EMACS_TIME end_time, timeout;
SELECT_TYPE waitchannels;
int xerrno;
- /* Either nil or a cons cell, the car of which is of interest and
- may be changed outside of this routine. */
- Lisp_Object wait_for_cell;
-
- wait_for_cell = Qnil;
-
- /* If waiting for non-nil in a cell, record where. */
- if (CONSP (read_kbd))
- {
- wait_for_cell = read_kbd;
- XSETFASTINT (read_kbd, 0);
- }
/* What does time_limit really mean? */
if (time_limit || microsecs)
--- 6887,6903 ----
Return true iff we received input from any process. */
int
! wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
! wait_for_cell, wait_proc, just_wait_proc)
! int time_limit, microsecs, read_kbd, do_display;
! Lisp_Object wait_for_cell;
! struct Lisp_Process *wait_proc;
! int just_wait_proc;
{
register int nfds;
EMACS_TIME end_time, timeout;
SELECT_TYPE waitchannels;
int xerrno;
/* What does time_limit really mean? */
if (time_limit || microsecs)
***************
*** 6949,6955 ****
/* If calling from keyboard input, do not quit
since we want to return C-g as an input character.
Otherwise, do pending quit if requested. */
! if (XINT (read_kbd) >= 0)
QUIT;
/* Exit now if the cell we're waiting for became non-nil. */
--- 6920,6926 ----
/* If calling from keyboard input, do not quit
since we want to return C-g as an input character.
Otherwise, do pending quit if requested. */
! if (read_kbd >= 0)
QUIT;
/* Exit now if the cell we're waiting for became non-nil. */
***************
*** 7000,7006 ****
while (!detect_input_pending ());
/* If there is unread keyboard input, also return. */
! if (XINT (read_kbd) != 0
&& requeued_events_pending_p ())
break;
--- 6971,6977 ----
while (!detect_input_pending ());
/* If there is unread keyboard input, also return. */
! if (read_kbd != 0
&& requeued_events_pending_p ())
break;
***************
*** 7018,7029 ****
/* Cause C-g and alarm signals to take immediate action,
and cause input available signals to zero out timeout. */
! if (XINT (read_kbd) < 0)
set_waiting_for_input (&timeout);
/* Wait till there is something to do. */
! if (! XINT (read_kbd) && NILP (wait_for_cell))
FD_ZERO (&waitchannels);
else
FD_SET (0, &waitchannels);
--- 6989,7000 ----
/* Cause C-g and alarm signals to take immediate action,
and cause input available signals to zero out timeout. */
! if (read_kbd < 0)
set_waiting_for_input (&timeout);
/* Wait till there is something to do. */
! if (! read_kbd && NILP (wait_for_cell))
FD_ZERO (&waitchannels);
else
FD_SET (0, &waitchannels);
***************
*** 7034,7044 ****
{
clear_waiting_for_input ();
redisplay_preserve_echo_area (15);
! if (XINT (read_kbd) < 0)
set_waiting_for_input (&timeout);
}
! if (XINT (read_kbd) && detect_input_pending ())
{
nfds = 0;
FD_ZERO (&waitchannels);
--- 7005,7015 ----
{
clear_waiting_for_input ();
redisplay_preserve_echo_area (15);
! if (read_kbd < 0)
set_waiting_for_input (&timeout);
}
! if (read_kbd && detect_input_pending ())
{
nfds = 0;
FD_ZERO (&waitchannels);
***************
*** 7074,7086 ****
kill (getpid (), SIGIO);
#endif
#ifdef SIGIO
! if (XINT (read_kbd) && interrupt_input && (waitchannels & 1))
kill (getpid (), SIGIO);
#endif
/* Check for keyboard input */
! if ((XINT (read_kbd) != 0)
&& detect_input_pending_run_timers (do_display))
{
swallow_events (do_display);
--- 7045,7057 ----
kill (getpid (), SIGIO);
#endif
#ifdef SIGIO
! if (read_kbd && interrupt_input && (waitchannels & 1))
kill (getpid (), SIGIO);
#endif
/* Check for keyboard input */
! if (read_kbd
&& detect_input_pending_run_timers (do_display))
{
swallow_events (do_display);
***************
*** 7089,7095 ****
}
/* If there is unread keyboard input, also return. */
! if (XINT (read_kbd) != 0
&& requeued_events_pending_p ())
break;
--- 7060,7066 ----
}
/* If there is unread keyboard input, also return. */
! if (read_kbd
&& requeued_events_pending_p ())
break;
- [Emacs-diffs] Changes to emacs/src/process.c [lexbind],
Miles Bader <=