/* Asynchronous subprocess control for XEmacs.
- Copyright (C) 1985, 1986, 1987, 1988, 1992, 1993, 1994, 1995
+ Copyright (C) 1985, 1986, 1987, 1988, 1992, 1993, 1994, 1995, 2003
Free Software Foundation, Inc.
Copyright (C) 1995 Sun Microsystems, Inc.
Copyright (C) 1995, 1996 Ben Wing.
#include "systty.h"
#include "syswait.h"
-Lisp_Object Qprocessp, Qprocess_live_p;
+Lisp_Object Qprocessp, Qprocess_live_p, Qprocess_readable_p;
/* Process methods */
struct process_methods the_process_methods;
? Qt : Qnil;
}
+#if 0
+/* This is a reasonable definition for this new primitive. Kyle sez:
+
+ "The patch looks OK to me except for the creation and exporting of the
+ Fprocess_readable_p function. I don't think a new Lisp function
+ should be created until we know something actually needs it. If
+ we later want to give process-readable-p different semantics it
+ may be hard to do it and stay compatible with what we hastily
+ create today."
+
+ He's right, not yet. Let's discuss the semantics on XEmacs Design
+ before enabling this.
+*/
+DEFUN ("process-readable-p", Fprocess_readable_p, 1, 1, 0, /*
+Return t if OBJECT is a process from which input may be available.
+*/
+ (object))
+{
+ return PROCESSP (object) && PROCESS_READABLE_P (XPROCESS (object))
+ ? Qt : Qnil;
+}
+#endif
+
DEFUN ("process-list", Fprocess_list, 0, 0, 0, /*
Return a list of all processes.
*/
#endif
/* This may be called during a GC from process_send_signal() from
- kill_buffer_processes() if emacs decides to abort(). */
+ kill_buffer_processes() if emacs decides to ABORT(). */
if (PROCESSP (name))
return name;
else if (STRINGP (name))
pid = PROCMETH (create_process, (p, argv, nargv, program, cur_dir));
p->pid = make_int (pid);
- if (PROCESS_LIVE_P (p))
+ if (PROCESS_READABLE_P (p))
event_stream_select_process (p);
}
with any buffer
Third arg is program file name. It is searched for as in the shell.
Remaining arguments are strings to give program as arguments.
-INCODE and OUTCODE specify the coding-system objects used in input/output
- from/to the process.
+If bound, `coding-system-for-read' and `coding-system-for-write' specify
+ the coding-system objects used in input from and output to the process.
*/
(int nargs, Lisp_Object *args))
{
/* !!#### This function has not been Mule-ized */
Lisp_Object buffer, name, program, process, current_dir;
Lisp_Object tem;
+ int i;
int speccount = specpdl_depth ();
struct gcpro gcpro1, gcpro2, gcpro3;
CHECK_STRING (name);
CHECK_STRING (program);
+ for (i = 3; i < nargs; ++i)
+ CHECK_STRING (args[i]);
/* Make sure that the child will be able to chdir to the current
buffer's current directory, or its unhandled equivalent. We
event_stream_select_process (XPROCESS (process));
- UNGCPRO;
NUNGCPRO;
+ UNGCPRO;
return process;
}
Really, the loop in execute_internal_event() should check itself
for a process-filter change, like in status_notify(); but the
struct Lisp_Process is not exported outside of this file. */
- if (!PROCESS_LIVE_P (p))
+ if (!PROCESS_READABLE_P (p))
return -1; /* already closed */
if (!NILP (p->filter) && (p->filter_does_read))
set_process_filter (Lisp_Object process, Lisp_Object filter, int filter_does_read)
{
CHECK_PROCESS (process);
- if (PROCESS_LIVE_P (XPROCESS (process))) {
+ if (PROCESS_READABLE_P (XPROCESS (process))) {
if (EQ (filter, Qt))
event_stream_unselect_process (XPROCESS (process));
else
(process))
{
process = get_process (process);
- CHECK_LIVE_PROCESS (process);
+ CHECK_READABLE_PROCESS (process);
return decoding_stream_coding_system (XLSTREAM (XPROCESS (process)->coding_instream) );
}
(process))
{
process = get_process (process);
- CHECK_LIVE_PROCESS (process);
+ CHECK_READABLE_PROCESS (process);
return Fcons (decoding_stream_coding_system
(XLSTREAM (XPROCESS (process)->coding_instream)),
encoding_stream_coding_system
{
codesys = Fget_coding_system (codesys);
process = get_process (process);
- CHECK_LIVE_PROCESS (process);
+ CHECK_READABLE_PROCESS (process);
set_decoding_stream_coding_system
(XLSTREAM (XPROCESS (process)->coding_instream), codesys);
defsymbol (&Qprocessp, "processp");
defsymbol (&Qprocess_live_p, "process-live-p");
+#if 0
+ /* see comment at Fprocess_readable_p */
+ defsymbol (&Qprocess_readable_p, "process-readable-p");
+#endif
defsymbol (&Qrun, "run");
defsymbol (&Qstop, "stop");
defsymbol (&Qopen, "open");
DEFSUBR (Fprocessp);
DEFSUBR (Fprocess_live_p);
+#if 0
+ /* see comment at Fprocess_readable_p */
+ DEFSUBR (Fprocess_readable_p);
+#endif
DEFSUBR (Fget_process);
DEFSUBR (Fget_buffer_process);
DEFSUBR (Fdelete_process);