diff options
| author | Kim F. Storm | 2003-01-14 09:55:50 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2003-01-14 09:55:50 +0000 |
| commit | faa7db081a33990da003b874789993fbe939c5bb (patch) | |
| tree | ba33889c94d2ec8a4c0d7c39fa034dc96d9af830 /src/process.c | |
| parent | 59be51d7f2e526db5180e69396dd4b2909bcba50 (diff) | |
| download | emacs-faa7db081a33990da003b874789993fbe939c5bb.tar.gz emacs-faa7db081a33990da003b874789993fbe939c5bb.zip | |
Reworked 2003-01-12 change -- call a plist a plist!
(QCplist): Renamed from QCvars. All uses changed.
(Fprocess_plist): Replaces Fprocess_variable. Simplified.
(Fset_process_plist): Replaces Fset_process_variable. Simplified.
(syms_of_process): Intern, staticpro, defsubr these.
(Fmake_network_process): Describe :plist arg. Removed :vars arg.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 58 |
1 files changed, 23 insertions, 35 deletions
diff --git a/src/process.c b/src/process.c index 24782504f05..160883f0786 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -132,7 +132,7 @@ Lisp_Object Qlocal, Qdatagram; | |||
| 132 | Lisp_Object QCname, QCbuffer, QChost, QCservice, QCtype; | 132 | Lisp_Object QCname, QCbuffer, QChost, QCservice, QCtype; |
| 133 | Lisp_Object QClocal, QCremote, QCcoding; | 133 | Lisp_Object QClocal, QCremote, QCcoding; |
| 134 | Lisp_Object QCserver, QCnowait, QCnoquery, QCstop; | 134 | Lisp_Object QCserver, QCnowait, QCnoquery, QCstop; |
| 135 | Lisp_Object QCsentinel, QClog, QCoptions, QCvars; | 135 | Lisp_Object QCsentinel, QClog, QCoptions, QCplist; |
| 136 | Lisp_Object Qlast_nonmenu_event; | 136 | Lisp_Object Qlast_nonmenu_event; |
| 137 | /* QCfamily is declared and initialized in xfaces.c, | 137 | /* QCfamily is declared and initialized in xfaces.c, |
| 138 | QCfilter in keyboard.c. */ | 138 | QCfilter in keyboard.c. */ |
| @@ -1037,36 +1037,26 @@ See `make-network-process' for a list of keywords. */) | |||
| 1037 | return Fplist_get (contact, key); | 1037 | return Fplist_get (contact, key); |
| 1038 | } | 1038 | } |
| 1039 | 1039 | ||
| 1040 | DEFUN ("process-variable", Fprocess_variable, Sprocess_variable, | 1040 | DEFUN ("process-plist", Fprocess_plist, Sprocess_plist, |
| 1041 | 1, 2, 0, | 1041 | 1, 1, 0, |
| 1042 | doc: /* Return the value of PROCESS' private variable VAR. | 1042 | doc: /* Return the plist of PROCESS. */) |
| 1043 | If VARIABLE is omitted or nil, return plist with all PROCESS variables. */) | 1043 | (process) |
| 1044 | (process, var) | 1044 | register Lisp_Object process; |
| 1045 | register Lisp_Object process, var; | ||
| 1046 | { | 1045 | { |
| 1047 | CHECK_PROCESS (process); | 1046 | CHECK_PROCESS (process); |
| 1048 | 1047 | return XPROCESS (process)->plist; | |
| 1049 | if (NILP (var)) | ||
| 1050 | return XPROCESS (process)->private_vars; | ||
| 1051 | |||
| 1052 | return Fplist_get (XPROCESS (process)->private_vars, var); | ||
| 1053 | } | 1048 | } |
| 1054 | 1049 | ||
| 1055 | DEFUN ("set-process-variable", Fset_process_variable, Sset_process_variable, | 1050 | DEFUN ("set-process-plist", Fset_process_plist, Sset_process_plist, |
| 1056 | 3, 3, 0, | 1051 | 2, 2, 0, |
| 1057 | doc: /* Change value of PROCESS' private variable VAR to VAL, and return VAL. | 1052 | doc: /* Replace the plist of PROCESS with PLIST. */) |
| 1058 | If VAR is nil, set all PROCESS' private variables according to plist VAL. */) | 1053 | (process, plist) |
| 1059 | (process, var, val) | 1054 | register Lisp_Object process, plist; |
| 1060 | register Lisp_Object process, var, val; | ||
| 1061 | { | 1055 | { |
| 1062 | CHECK_PROCESS (process); | 1056 | CHECK_PROCESS (process); |
| 1057 | CHECK_LIST (plist); | ||
| 1063 | 1058 | ||
| 1064 | XPROCESS (process)->private_vars | 1059 | XPROCESS (process)->plist = plist; |
| 1065 | = (NILP (var) | ||
| 1066 | ? val | ||
| 1067 | : Fplist_put (XPROCESS (process)->private_vars, var, val)); | ||
| 1068 | |||
| 1069 | return val; | ||
| 1070 | } | 1060 | } |
| 1071 | 1061 | ||
| 1072 | #if 0 /* Turned off because we don't currently record this info | 1062 | #if 0 /* Turned off because we don't currently record this info |
| @@ -1434,7 +1424,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) | |||
| 1434 | record_unwind_protect (start_process_unwind, proc); | 1424 | record_unwind_protect (start_process_unwind, proc); |
| 1435 | 1425 | ||
| 1436 | XPROCESS (proc)->childp = Qt; | 1426 | XPROCESS (proc)->childp = Qt; |
| 1437 | XPROCESS (proc)->private_vars = Qnil; | 1427 | XPROCESS (proc)->plist = Qnil; |
| 1438 | XPROCESS (proc)->command_channel_p = Qnil; | 1428 | XPROCESS (proc)->command_channel_p = Qnil; |
| 1439 | XPROCESS (proc)->buffer = buffer; | 1429 | XPROCESS (proc)->buffer = buffer; |
| 1440 | XPROCESS (proc)->sentinel = Qnil; | 1430 | XPROCESS (proc)->sentinel = Qnil; |
| @@ -2599,8 +2589,7 @@ client. The arguments are SERVER, CLIENT, and MESSAGE, where SERVER | |||
| 2599 | is the server process, CLIENT is the new process for the connection, | 2589 | is the server process, CLIENT is the new process for the connection, |
| 2600 | and MESSAGE is a string. | 2590 | and MESSAGE is a string. |
| 2601 | 2591 | ||
| 2602 | :vars VARS -- Initialize the process' private variables according to | 2592 | :plist PLIST -- Install PLIST as the new process' initial plist. |
| 2603 | a list of variable/value pairs (VAR1 VAL1 VAR2 VAL2...). | ||
| 2604 | 2593 | ||
| 2605 | :server BOOL -- if BOOL is non-nil, create a server process for the | 2594 | :server BOOL -- if BOOL is non-nil, create a server process for the |
| 2606 | specified FAMILY, SERVICE, and connection type (stream or datagram). | 2595 | specified FAMILY, SERVICE, and connection type (stream or datagram). |
| @@ -2619,8 +2608,7 @@ NAME concatenated with the client identification string. | |||
| 2619 | inherited from the server process' TYPE, FILTER and SENTINEL. | 2608 | inherited from the server process' TYPE, FILTER and SENTINEL. |
| 2620 | - The client process' contact info is set according to the client's | 2609 | - The client process' contact info is set according to the client's |
| 2621 | addressing information (typically an IP address and a port number). | 2610 | addressing information (typically an IP address and a port number). |
| 2622 | - The client process' private variables are initialized from the | 2611 | - The client process' plist is initialized from the server's plist. |
| 2623 | server's private variables. | ||
| 2624 | 2612 | ||
| 2625 | Notice that the FILTER and SENTINEL args are never used directly by | 2613 | Notice that the FILTER and SENTINEL args are never used directly by |
| 2626 | the server process. Also, the BUFFER argument is not used directly by | 2614 | the server process. Also, the BUFFER argument is not used directly by |
| @@ -3183,7 +3171,7 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3183 | p = XPROCESS (proc); | 3171 | p = XPROCESS (proc); |
| 3184 | 3172 | ||
| 3185 | p->childp = contact; | 3173 | p->childp = contact; |
| 3186 | p->private_vars = Fcopy_sequence (Fplist_get (contact, QCvars)); | 3174 | p->plist = Fcopy_sequence (Fplist_get (contact, QCplist)); |
| 3187 | 3175 | ||
| 3188 | p->buffer = buffer; | 3176 | p->buffer = buffer; |
| 3189 | p->sentinel = sentinel; | 3177 | p->sentinel = sentinel; |
| @@ -3616,7 +3604,7 @@ server_accept_connection (server, channel) | |||
| 3616 | #endif | 3604 | #endif |
| 3617 | 3605 | ||
| 3618 | p->childp = contact; | 3606 | p->childp = contact; |
| 3619 | p->private_vars = Fcopy_sequence (ps->private_vars); | 3607 | p->plist = Fcopy_sequence (ps->plist); |
| 3620 | 3608 | ||
| 3621 | p->buffer = buffer; | 3609 | p->buffer = buffer; |
| 3622 | p->sentinel = ps->sentinel; | 3610 | p->sentinel = ps->sentinel; |
| @@ -6343,8 +6331,8 @@ syms_of_process () | |||
| 6343 | staticpro (&QCstop); | 6331 | staticpro (&QCstop); |
| 6344 | QCoptions = intern (":options"); | 6332 | QCoptions = intern (":options"); |
| 6345 | staticpro (&QCoptions); | 6333 | staticpro (&QCoptions); |
| 6346 | QCvars = intern (":vars"); | 6334 | QCplist = intern (":plist"); |
| 6347 | staticpro (&QCvars); | 6335 | staticpro (&QCplist); |
| 6348 | 6336 | ||
| 6349 | Qlast_nonmenu_event = intern ("last-nonmenu-event"); | 6337 | Qlast_nonmenu_event = intern ("last-nonmenu-event"); |
| 6350 | staticpro (&Qlast_nonmenu_event); | 6338 | staticpro (&Qlast_nonmenu_event); |
| @@ -6388,8 +6376,8 @@ The value takes effect when `start-process' is called. */); | |||
| 6388 | defsubr (&Sset_process_query_on_exit_flag); | 6376 | defsubr (&Sset_process_query_on_exit_flag); |
| 6389 | defsubr (&Sprocess_query_on_exit_flag); | 6377 | defsubr (&Sprocess_query_on_exit_flag); |
| 6390 | defsubr (&Sprocess_contact); | 6378 | defsubr (&Sprocess_contact); |
| 6391 | defsubr (&Sprocess_variable); | 6379 | defsubr (&Sprocess_plist); |
| 6392 | defsubr (&Sset_process_variable); | 6380 | defsubr (&Sset_process_plist); |
| 6393 | defsubr (&Slist_processes); | 6381 | defsubr (&Slist_processes); |
| 6394 | defsubr (&Sprocess_list); | 6382 | defsubr (&Sprocess_list); |
| 6395 | defsubr (&Sstart_process); | 6383 | defsubr (&Sstart_process); |