Lisp_Object QCname, QCbuffer, QChost, QCservice, QCtype;
Lisp_Object QClocal, QCremote, QCcoding;
Lisp_Object QCserver, QCnowait, QCnoquery, QCstop;
-Lisp_Object QCsentinel, QClog, QCoptions;
+Lisp_Object QCsentinel, QClog, QCoptions, QCvars;
Lisp_Object Qlast_nonmenu_event;
/* QCfamily is declared and initialized in xfaces.c,
QCfilter in keyboard.c. */
return Fplist_get (contact, key);
}
-DEFUN ("set-process-contact", Fset_process_contact, Sset_process_contact,
- 3, 3, 0,
- doc: /* Change value in PROCESS' contact information list of KEY to VAL.
-If KEY is already a property on the list, its value is set to VAL,
-otherwise the new KEY VAL pair is added. Returns VAL. */)
- (process, key, val)
- register Lisp_Object process, key, val;
+DEFUN ("process-variable", Fprocess_variable, Sprocess_variable,
+ 1, 2, 0,
+ doc: /* Return the value of PROCESS' private variable VAR.
+If VARIABLE is omitted or nil, return plist with all PROCESS variables. */)
+ (process, var)
+ register Lisp_Object process, var;
{
- Lisp_Object contact;
+ CHECK_PROCESS (process);
+
+ if (NILP (var))
+ return XPROCESS (process)->private_vars;
+
+ return Fplist_get (XPROCESS (process)->private_vars, var);
+}
+DEFUN ("set-process-variable", Fset_process_variable, Sset_process_variable,
+ 3, 3, 0,
+ doc: /* Change value of PROCESS' private variable VAR to VAL, and return VAL.
+If VAR is nil, set all PROCESS' private variables according to plist VAL. */)
+ (process, var, val)
+ register Lisp_Object process, var, val;
+{
CHECK_PROCESS (process);
- if (NETCONN_P (process))
- XPROCESS (process)->childp = Fplist_put (XPROCESS (process)->childp, key, val);
+ XPROCESS (process)->private_vars
+ = (NILP (var)
+ ? val
+ : Fplist_put (XPROCESS (process)->private_vars, var, val));
return val;
}
record_unwind_protect (start_process_unwind, proc);
XPROCESS (proc)->childp = Qt;
+ XPROCESS (proc)->private_vars = Qnil;
XPROCESS (proc)->command_channel_p = Qnil;
XPROCESS (proc)->buffer = buffer;
XPROCESS (proc)->sentinel = Qnil;
is the server process, CLIENT is the new process for the connection,
and MESSAGE is a string.
+:vars VARS -- Initialize the process' private variables according to
+a list of variable/value pairs (VAR1 VAL1 VAR2 VAL2...).
+
:server BOOL -- if BOOL is non-nil, create a server process for the
specified FAMILY, SERVICE, and connection type (stream or datagram).
Default is a client process.
inherited from the server process' TYPE, FILTER and SENTINEL.
- The client process' contact info is set according to the client's
addressing information (typically an IP address and a port number).
+- The client process' private variables are initialized from the
+server's private variables.
Notice that the FILTER and SENTINEL args are never used directly by
the server process. Also, the BUFFER argument is not used directly by
The original argument list, modified with the actual connection
information, is available via the `process-contact' function.
-Additional arguments may be added via `set-process-contact'.
usage: (make-network-process &rest ARGS) */)
(nargs, args)
p = XPROCESS (proc);
p->childp = contact;
+ p->private_vars = Fcopy_sequence (Fplist_get (contact, QCvars));
+
p->buffer = buffer;
p->sentinel = sentinel;
p->filter = filter;
#endif
p->childp = contact;
+ p->private_vars = Fcopy_sequence (ps->private_vars);
+
p->buffer = buffer;
p->sentinel = ps->sentinel;
p->filter = ps->filter;
staticpro (&QCstop);
QCoptions = intern (":options");
staticpro (&QCoptions);
+ QCvars = intern (":vars");
+ staticpro (&QCvars);
Qlast_nonmenu_event = intern ("last-nonmenu-event");
staticpro (&Qlast_nonmenu_event);
defsubr (&Sset_process_query_on_exit_flag);
defsubr (&Sprocess_query_on_exit_flag);
defsubr (&Sprocess_contact);
- defsubr (&Sset_process_contact);
+ defsubr (&Sprocess_variable);
+ defsubr (&Sset_process_variable);
defsubr (&Slist_processes);
defsubr (&Sprocess_list);
defsubr (&Sstart_process);