3718 |
} |
} |
3719 |
|
|
3720 |
DEFUN ("accept-process-output", Faccept_process_output, Saccept_process_output, |
DEFUN ("accept-process-output", Faccept_process_output, Saccept_process_output, |
3721 |
0, 3, 0, |
0, 4, 0, |
3722 |
doc: /* Allow any pending output from subprocesses to be read by Emacs. |
doc: /* Allow any pending output from subprocesses to be read by Emacs. |
3723 |
It is read into the process' buffers or given to their filter functions. |
It is read into the process' buffers or given to their filter functions. |
3724 |
Non-nil arg PROCESS means do not return until some output has been received |
Non-nil arg PROCESS means do not return until some output has been received |
3726 |
Non-nil second arg TIMEOUT and third arg TIMEOUT-MSECS are number of |
Non-nil second arg TIMEOUT and third arg TIMEOUT-MSECS are number of |
3727 |
seconds and microseconds to wait; return after that much time whether |
seconds and microseconds to wait; return after that much time whether |
3728 |
or not there is input. |
or not there is input. |
3729 |
|
If optional fourth arg JUST-THIS-ONE is non-nil, only accept output |
3730 |
|
from PROCESS, suspending reading output from other processes. |
3731 |
|
If JUST-THIS-ONE is an integer, don't run any timers either. |
3732 |
Return non-nil iff we received any output before the timeout expired. */) |
Return non-nil iff we received any output before the timeout expired. */) |
3733 |
(process, timeout, timeout_msecs) |
(process, timeout, timeout_msecs, just_this_one) |
3734 |
register Lisp_Object process, timeout, timeout_msecs; |
register Lisp_Object process, timeout, timeout_msecs, just_this_one; |
3735 |
{ |
{ |
3736 |
int seconds; |
int seconds; |
3737 |
int useconds; |
int useconds; |
3738 |
|
|
3739 |
if (! NILP (process)) |
if (! NILP (process)) |
3740 |
CHECK_PROCESS (process); |
CHECK_PROCESS (process); |
3741 |
|
else |
3742 |
|
just_this_one = Qnil; |
3743 |
|
|
3744 |
if (! NILP (timeout_msecs)) |
if (! NILP (timeout_msecs)) |
3745 |
{ |
{ |
3781 |
XSETFASTINT (process, 0); |
XSETFASTINT (process, 0); |
3782 |
|
|
3783 |
return |
return |
3784 |
(wait_reading_process_input (seconds, useconds, process, 0) |
(wait_reading_process_input (seconds, useconds, process, |
3785 |
|
NILP (just_this_one) ? 0 : |
3786 |
|
!INTEGERP (just_this_one) ? -1 : -2) |
3787 |
? Qt : Qnil); |
? Qt : Qnil); |
3788 |
} |
} |
3789 |
|
|
4016 |
process. The return value is true iff we read some input from |
process. The return value is true iff we read some input from |
4017 |
that process. |
that process. |
4018 |
|
|
4019 |
DO_DISPLAY != 0 means redisplay should be done to show subprocess |
If READ_KBD is a process object, DO_DISPLAY < 0 means handle only |
4020 |
output that arrives. |
output from that process (suspending output from other processes) |
4021 |
|
and DO_DISPLAY == -2 specifically means don't run any timers either. |
4022 |
|
Otherwise, != 0 means redisplay should be done to show subprocess |
4023 |
|
output that arrives. |
4024 |
|
|
4025 |
If READ_KBD is a pointer to a struct Lisp_Process, then the |
If READ_KBD is a pointer to a struct Lisp_Process, then the |
4026 |
function returns true iff we received input from that process |
function returns true iff we received input from that process |
4042 |
EMACS_TIME timeout, end_time; |
EMACS_TIME timeout, end_time; |
4043 |
int wait_channel = -1; |
int wait_channel = -1; |
4044 |
struct Lisp_Process *wait_proc = 0; |
struct Lisp_Process *wait_proc = 0; |
4045 |
|
int just_wait_proc = 0; |
4046 |
int got_some_input = 0; |
int got_some_input = 0; |
4047 |
/* Either nil or a cons cell, the car of which is of interest and |
/* Either nil or a cons cell, the car of which is of interest and |
4048 |
may be changed outside of this routine. */ |
may be changed outside of this routine. */ |
4059 |
wait_proc = XPROCESS (read_kbd); |
wait_proc = XPROCESS (read_kbd); |
4060 |
wait_channel = XINT (wait_proc->infd); |
wait_channel = XINT (wait_proc->infd); |
4061 |
XSETFASTINT (read_kbd, 0); |
XSETFASTINT (read_kbd, 0); |
4062 |
|
if (do_display < 0) |
4063 |
|
{ |
4064 |
|
just_wait_proc = do_display; |
4065 |
|
do_display = 0; |
4066 |
|
} |
4067 |
} |
} |
4068 |
|
|
4069 |
/* If waiting for non-nil in a cell, record where. */ |
/* If waiting for non-nil in a cell, record where. */ |
4138 |
But not if wait_for_cell; in those cases, |
But not if wait_for_cell; in those cases, |
4139 |
the wait is supposed to be short, |
the wait is supposed to be short, |
4140 |
and those callers cannot handle running arbitrary Lisp code here. */ |
and those callers cannot handle running arbitrary Lisp code here. */ |
4141 |
if (NILP (wait_for_cell)) |
if (NILP (wait_for_cell) |
4142 |
|
&& just_wait_proc != -2) |
4143 |
{ |
{ |
4144 |
EMACS_TIME timer_delay; |
EMACS_TIME timer_delay; |
4145 |
|
|
4275 |
|
|
4276 |
/* Wait till there is something to do */ |
/* Wait till there is something to do */ |
4277 |
|
|
4278 |
if (!NILP (wait_for_cell)) |
if (just_wait_proc) |
4279 |
|
{ |
4280 |
|
FD_SET (XINT (wait_proc->infd), &Available); |
4281 |
|
check_connect = check_delay = 0; |
4282 |
|
} |
4283 |
|
else if (!NILP (wait_for_cell)) |
4284 |
{ |
{ |
4285 |
Available = non_process_wait_mask; |
Available = non_process_wait_mask; |
4286 |
check_connect = check_delay = 0; |
check_connect = check_delay = 0; |