mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-22 18:35:09 +00:00
Use INTERNAL_FIELD for processes.
* src/process.h (PVAR): New macro. Adjust style. (struct Lisp_Process): Change Lisp_Object members to INTERNAL_FIELD. * src/print.c, src/process.c, src/sysdep.c, src/w32.c: * src/xdisp.c: Users changed. * admin/coccinelle/process.cocci: Semantic patch to replace direct access to Lisp_Object members of struct Lisp_Process to PVAR.
This commit is contained in:
parent
3a45383a47
commit
3193acd258
@ -1,3 +1,8 @@
|
||||
2012-08-01 Dmitry Antipov <dmantipov@yandex.ru>
|
||||
|
||||
* coccinelle/process.cocci: Semantic patch to replace direct
|
||||
access to Lisp_Object members of struct Lisp_Process to PVAR.
|
||||
|
||||
2012-08-01 Dmitry Antipov <dmantipov@yandex.ru>
|
||||
|
||||
* coccinelle/window.cocci: Semantic patch to replace direct
|
||||
|
110
admin/coccinelle/process.cocci
Normal file
110
admin/coccinelle/process.cocci
Normal file
@ -0,0 +1,110 @@
|
||||
// Change direct access to Lisp_Object fields of struct Lisp_Process to PVAR.
|
||||
@@
|
||||
struct Lisp_Process *P;
|
||||
Lisp_Object O;
|
||||
@@
|
||||
(
|
||||
- P->tty_name
|
||||
+ PVAR (P, tty_name)
|
||||
|
|
||||
- P->name
|
||||
+ PVAR (P, name)
|
||||
|
|
||||
- P->command
|
||||
+ PVAR (P, command)
|
||||
|
|
||||
- P->filter
|
||||
+ PVAR (P, filter)
|
||||
|
|
||||
- P->sentinel
|
||||
+ PVAR (P, sentinel)
|
||||
|
|
||||
- P->log
|
||||
+ PVAR (P, log)
|
||||
|
|
||||
- P->buffer
|
||||
+ PVAR (P, buffer)
|
||||
|
|
||||
- P->childp
|
||||
+ PVAR (P, childp)
|
||||
|
|
||||
- P->plist
|
||||
+ PVAR (P, plist)
|
||||
|
|
||||
- P->type
|
||||
+ PVAR (P, type)
|
||||
|
|
||||
- P->mark
|
||||
+ PVAR (P, mark)
|
||||
|
|
||||
- P->status
|
||||
+ PVAR (P, status)
|
||||
|
|
||||
- P->decode_coding_system
|
||||
+ PVAR (P, decode_coding_system)
|
||||
|
|
||||
- P->decoding_buf
|
||||
+ PVAR (P, decoding_buf)
|
||||
|
|
||||
- P->encode_coding_system
|
||||
+ PVAR (P, encode_coding_system)
|
||||
|
|
||||
- P->encoding_buf
|
||||
+ PVAR (P, encoding_buf)
|
||||
|
|
||||
- P->write_queue
|
||||
+ PVAR (P, write_queue)
|
||||
|
||||
|
|
||||
|
||||
- XPROCESS (O)->tty_name
|
||||
+ PVAR (XPROCESS (O), tty_name)
|
||||
|
|
||||
- XPROCESS (O)->name
|
||||
+ PVAR (XPROCESS (O), name)
|
||||
|
|
||||
- XPROCESS (O)->command
|
||||
+ PVAR (XPROCESS (O), command)
|
||||
|
|
||||
- XPROCESS (O)->filter
|
||||
+ PVAR (XPROCESS (O), filter)
|
||||
|
|
||||
- XPROCESS (O)->sentinel
|
||||
+ PVAR (XPROCESS (O), sentinel)
|
||||
|
|
||||
- XPROCESS (O)->log
|
||||
+ PVAR (XPROCESS (O), log)
|
||||
|
|
||||
- XPROCESS (O)->buffer
|
||||
+ PVAR (XPROCESS (O), buffer)
|
||||
|
|
||||
- XPROCESS (O)->childp
|
||||
+ PVAR (XPROCESS (O), childp)
|
||||
|
|
||||
- XPROCESS (O)->plist
|
||||
+ PVAR (XPROCESS (O), plist)
|
||||
|
|
||||
- XPROCESS (O)->type
|
||||
+ PVAR (XPROCESS (O), type)
|
||||
|
|
||||
- XPROCESS (O)->mark
|
||||
+ PVAR (XPROCESS (O), mark)
|
||||
|
|
||||
- XPROCESS (O)->status
|
||||
+ PVAR (XPROCESS (O), status)
|
||||
|
|
||||
- XPROCESS (O)->decode_coding_system
|
||||
+ PVAR (XPROCESS (O), decode_coding_system)
|
||||
|
|
||||
- XPROCESS (O)->decoding_buf
|
||||
+ PVAR (XPROCESS (O), decoding_buf)
|
||||
|
|
||||
- XPROCESS (O)->encode_coding_system
|
||||
+ PVAR (XPROCESS (O), encode_coding_system)
|
||||
|
|
||||
- XPROCESS (O)->encoding_buf
|
||||
+ PVAR (XPROCESS (O), encoding_buf)
|
||||
|
|
||||
- XPROCESS (O)->write_queue
|
||||
+ PVAR (XPROCESS (O), write_queue)
|
||||
)
|
@ -1,3 +1,10 @@
|
||||
2012-08-01 Dmitry Antipov <dmantipov@yandex.ru>
|
||||
|
||||
Use INTERNAL_FIELD for processes.
|
||||
* process.h (PVAR): New macro. Adjust style.
|
||||
(struct Lisp_Process): Change Lisp_Object members to INTERNAL_FIELD.
|
||||
* print.c, process.c, sysdep.c, w32.c, xdisp.c: Users changed.
|
||||
|
||||
2012-08-01 Dmitry Antipov <dmantipov@yandex.ru>
|
||||
|
||||
Use INTERNAL_FIELD for windows.
|
||||
|
@ -1699,11 +1699,11 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
|
||||
if (escapeflag)
|
||||
{
|
||||
strout ("#<process ", -1, -1, printcharfun);
|
||||
print_string (XPROCESS (obj)->name, printcharfun);
|
||||
print_string (PVAR (XPROCESS (obj), name), printcharfun);
|
||||
PRINTCHAR ('>');
|
||||
}
|
||||
else
|
||||
print_string (XPROCESS (obj)->name, printcharfun);
|
||||
print_string (PVAR (XPROCESS (obj), name), printcharfun);
|
||||
}
|
||||
else if (BOOL_VECTOR_P (obj))
|
||||
{
|
||||
|
444
src/process.c
444
src/process.c
File diff suppressed because it is too large
Load Diff
@ -26,59 +26,78 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
||||
#include "gnutls.h"
|
||||
#endif
|
||||
|
||||
/* This structure records information about a subprocess
|
||||
or network connection.
|
||||
/* Most code should use this macro to access
|
||||
Lisp fields in struct Lisp_Process. */
|
||||
|
||||
Every field in this structure except for the header
|
||||
must be a Lisp_Object, for GC's sake. */
|
||||
#define PVAR(w, field) ((w)->INTERNAL_FIELD (field))
|
||||
|
||||
/* This structure records information about a subprocess
|
||||
or network connection. */
|
||||
|
||||
struct Lisp_Process
|
||||
{
|
||||
struct vectorlike_header header;
|
||||
|
||||
/* Name of subprocess terminal. */
|
||||
Lisp_Object tty_name;
|
||||
Lisp_Object INTERNAL_FIELD (tty_name);
|
||||
|
||||
/* Name of this process */
|
||||
Lisp_Object name;
|
||||
Lisp_Object INTERNAL_FIELD (name);
|
||||
|
||||
/* List of command arguments that this process was run with.
|
||||
Is set to t for a stopped network process; nil otherwise. */
|
||||
Lisp_Object command;
|
||||
Lisp_Object INTERNAL_FIELD (command);
|
||||
|
||||
/* (funcall FILTER PROC STRING) (if FILTER is non-nil)
|
||||
to dispose of a bunch of chars from the process all at once */
|
||||
Lisp_Object filter;
|
||||
Lisp_Object INTERNAL_FIELD (filter);
|
||||
|
||||
/* (funcall SENTINEL PROCESS) when process state changes */
|
||||
Lisp_Object sentinel;
|
||||
Lisp_Object INTERNAL_FIELD (sentinel);
|
||||
|
||||
/* (funcall LOG SERVER CLIENT MESSAGE) when a server process
|
||||
accepts a connection from a client. */
|
||||
Lisp_Object log;
|
||||
Lisp_Object INTERNAL_FIELD (log);
|
||||
|
||||
/* Buffer that output is going to */
|
||||
Lisp_Object buffer;
|
||||
Lisp_Object INTERNAL_FIELD (buffer);
|
||||
|
||||
/* t if this is a real child process. For a network or serial
|
||||
connection, it is a plist based on the arguments to
|
||||
make-network-process or make-serial-process. */
|
||||
Lisp_Object childp;
|
||||
|
||||
Lisp_Object INTERNAL_FIELD (childp);
|
||||
|
||||
/* Plist for programs to keep per-process state information, parameters, etc. */
|
||||
Lisp_Object plist;
|
||||
Lisp_Object INTERNAL_FIELD (plist);
|
||||
|
||||
/* Symbol indicating the type of process: real, network, serial */
|
||||
Lisp_Object type;
|
||||
Lisp_Object INTERNAL_FIELD (type);
|
||||
|
||||
/* Marker set to end of last buffer-inserted output from this process */
|
||||
Lisp_Object mark;
|
||||
Lisp_Object INTERNAL_FIELD (mark);
|
||||
|
||||
/* Symbol indicating status of process.
|
||||
This may be a symbol: run, open, or closed.
|
||||
Or it may be a list, whose car is stop, exit or signal
|
||||
and whose cdr is a pair (EXIT_CODE . COREDUMP_FLAG)
|
||||
or (SIGNAL_NUMBER . COREDUMP_FLAG). */
|
||||
Lisp_Object status;
|
||||
Lisp_Object INTERNAL_FIELD (status);
|
||||
|
||||
/* Coding-system for decoding the input from this process. */
|
||||
Lisp_Object decode_coding_system;
|
||||
Lisp_Object INTERNAL_FIELD (decode_coding_system);
|
||||
|
||||
/* Working buffer for decoding. */
|
||||
Lisp_Object decoding_buf;
|
||||
Lisp_Object INTERNAL_FIELD (decoding_buf);
|
||||
|
||||
/* Coding-system for encoding the output to this process. */
|
||||
Lisp_Object encode_coding_system;
|
||||
Lisp_Object INTERNAL_FIELD (encode_coding_system);
|
||||
|
||||
/* Working buffer for encoding. */
|
||||
Lisp_Object encoding_buf;
|
||||
Lisp_Object INTERNAL_FIELD (encoding_buf);
|
||||
|
||||
/* Queue for storing waiting writes */
|
||||
Lisp_Object write_queue;
|
||||
Lisp_Object INTERNAL_FIELD (write_queue);
|
||||
|
||||
#ifdef HAVE_GNUTLS
|
||||
Lisp_Object gnutls_cred_type;
|
||||
|
14
src/sysdep.c
14
src/sysdep.c
@ -2156,7 +2156,7 @@ serial_configure (struct Lisp_Process *p,
|
||||
int err = -1;
|
||||
char summary[4] = "???"; /* This usually becomes "8N1". */
|
||||
|
||||
childp2 = Fcopy_sequence (p->childp);
|
||||
childp2 = Fcopy_sequence (PVAR (p, childp));
|
||||
|
||||
/* Read port attributes and prepare default configuration. */
|
||||
err = tcgetattr (p->outfd, &attr);
|
||||
@ -2174,7 +2174,7 @@ serial_configure (struct Lisp_Process *p,
|
||||
if (!NILP (Fplist_member (contact, QCspeed)))
|
||||
tem = Fplist_get (contact, QCspeed);
|
||||
else
|
||||
tem = Fplist_get (p->childp, QCspeed);
|
||||
tem = Fplist_get (PVAR (p, childp), QCspeed);
|
||||
CHECK_NUMBER (tem);
|
||||
err = cfsetspeed (&attr, XINT (tem));
|
||||
if (err != 0)
|
||||
@ -2186,7 +2186,7 @@ serial_configure (struct Lisp_Process *p,
|
||||
if (!NILP (Fplist_member (contact, QCbytesize)))
|
||||
tem = Fplist_get (contact, QCbytesize);
|
||||
else
|
||||
tem = Fplist_get (p->childp, QCbytesize);
|
||||
tem = Fplist_get (PVAR (p, childp), QCbytesize);
|
||||
if (NILP (tem))
|
||||
tem = make_number (8);
|
||||
CHECK_NUMBER (tem);
|
||||
@ -2207,7 +2207,7 @@ serial_configure (struct Lisp_Process *p,
|
||||
if (!NILP (Fplist_member (contact, QCparity)))
|
||||
tem = Fplist_get (contact, QCparity);
|
||||
else
|
||||
tem = Fplist_get (p->childp, QCparity);
|
||||
tem = Fplist_get (PVAR (p, childp), QCparity);
|
||||
if (!NILP (tem) && !EQ (tem, Qeven) && !EQ (tem, Qodd))
|
||||
error (":parity must be nil (no parity), `even', or `odd'");
|
||||
#if defined (PARENB) && defined (PARODD) && defined (IGNPAR) && defined (INPCK)
|
||||
@ -2240,7 +2240,7 @@ serial_configure (struct Lisp_Process *p,
|
||||
if (!NILP (Fplist_member (contact, QCstopbits)))
|
||||
tem = Fplist_get (contact, QCstopbits);
|
||||
else
|
||||
tem = Fplist_get (p->childp, QCstopbits);
|
||||
tem = Fplist_get (PVAR (p, childp), QCstopbits);
|
||||
if (NILP (tem))
|
||||
tem = make_number (1);
|
||||
CHECK_NUMBER (tem);
|
||||
@ -2262,7 +2262,7 @@ serial_configure (struct Lisp_Process *p,
|
||||
if (!NILP (Fplist_member (contact, QCflowcontrol)))
|
||||
tem = Fplist_get (contact, QCflowcontrol);
|
||||
else
|
||||
tem = Fplist_get (p->childp, QCflowcontrol);
|
||||
tem = Fplist_get (PVAR (p, childp), QCflowcontrol);
|
||||
if (!NILP (tem) && !EQ (tem, Qhw) && !EQ (tem, Qsw))
|
||||
error (":flowcontrol must be nil (no flowcontrol), `hw', or `sw'");
|
||||
#if defined (CRTSCTS)
|
||||
@ -2304,7 +2304,7 @@ serial_configure (struct Lisp_Process *p,
|
||||
error ("tcsetattr() failed: %s", emacs_strerror (errno));
|
||||
|
||||
childp2 = Fplist_put (childp2, QCsummary, build_string (summary));
|
||||
p->childp = childp2;
|
||||
PVAR (p, childp) = childp2;
|
||||
|
||||
}
|
||||
#endif /* not DOS_NT */
|
||||
|
14
src/w32.c
14
src/w32.c
@ -6144,7 +6144,7 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact)
|
||||
error ("Not a serial process");
|
||||
hnd = fd_info[ p->outfd ].hnd;
|
||||
|
||||
childp2 = Fcopy_sequence (p->childp);
|
||||
childp2 = Fcopy_sequence (PVAR (p, childp));
|
||||
|
||||
/* Initialize timeouts for blocking read and blocking write. */
|
||||
if (!GetCommTimeouts (hnd, &ct))
|
||||
@ -6173,7 +6173,7 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact)
|
||||
if (!NILP (Fplist_member (contact, QCspeed)))
|
||||
tem = Fplist_get (contact, QCspeed);
|
||||
else
|
||||
tem = Fplist_get (p->childp, QCspeed);
|
||||
tem = Fplist_get (PVAR (p, childp), QCspeed);
|
||||
CHECK_NUMBER (tem);
|
||||
dcb.BaudRate = XINT (tem);
|
||||
childp2 = Fplist_put (childp2, QCspeed, tem);
|
||||
@ -6182,7 +6182,7 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact)
|
||||
if (!NILP (Fplist_member (contact, QCbytesize)))
|
||||
tem = Fplist_get (contact, QCbytesize);
|
||||
else
|
||||
tem = Fplist_get (p->childp, QCbytesize);
|
||||
tem = Fplist_get (PVAR (p, childp), QCbytesize);
|
||||
if (NILP (tem))
|
||||
tem = make_number (8);
|
||||
CHECK_NUMBER (tem);
|
||||
@ -6196,7 +6196,7 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact)
|
||||
if (!NILP (Fplist_member (contact, QCparity)))
|
||||
tem = Fplist_get (contact, QCparity);
|
||||
else
|
||||
tem = Fplist_get (p->childp, QCparity);
|
||||
tem = Fplist_get (PVAR (p, childp), QCparity);
|
||||
if (!NILP (tem) && !EQ (tem, Qeven) && !EQ (tem, Qodd))
|
||||
error (":parity must be nil (no parity), `even', or `odd'");
|
||||
dcb.fParity = FALSE;
|
||||
@ -6226,7 +6226,7 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact)
|
||||
if (!NILP (Fplist_member (contact, QCstopbits)))
|
||||
tem = Fplist_get (contact, QCstopbits);
|
||||
else
|
||||
tem = Fplist_get (p->childp, QCstopbits);
|
||||
tem = Fplist_get (PVAR (p, childp), QCstopbits);
|
||||
if (NILP (tem))
|
||||
tem = make_number (1);
|
||||
CHECK_NUMBER (tem);
|
||||
@ -6243,7 +6243,7 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact)
|
||||
if (!NILP (Fplist_member (contact, QCflowcontrol)))
|
||||
tem = Fplist_get (contact, QCflowcontrol);
|
||||
else
|
||||
tem = Fplist_get (p->childp, QCflowcontrol);
|
||||
tem = Fplist_get (PVAR (p, childp), QCflowcontrol);
|
||||
if (!NILP (tem) && !EQ (tem, Qhw) && !EQ (tem, Qsw))
|
||||
error (":flowcontrol must be nil (no flowcontrol), `hw', or `sw'");
|
||||
dcb.fOutxCtsFlow = FALSE;
|
||||
@ -6277,7 +6277,7 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact)
|
||||
error ("SetCommState() failed");
|
||||
|
||||
childp2 = Fplist_put (childp2, QCsummary, build_string (summary));
|
||||
p->childp = childp2;
|
||||
PVAR (p, childp) = childp2;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GNUTLS
|
||||
|
@ -21678,10 +21678,10 @@ decode_mode_spec (struct window *w, register int c, int field_width,
|
||||
obj = Fget_buffer_process (Fcurrent_buffer ());
|
||||
if (PROCESSP (obj))
|
||||
{
|
||||
p = decode_mode_spec_coding (XPROCESS (obj)->decode_coding_system,
|
||||
p, eol_flag);
|
||||
p = decode_mode_spec_coding (XPROCESS (obj)->encode_coding_system,
|
||||
p, eol_flag);
|
||||
p = decode_mode_spec_coding
|
||||
(PVAR (XPROCESS (obj), decode_coding_system), p, eol_flag);
|
||||
p = decode_mode_spec_coding
|
||||
(PVAR (XPROCESS (obj), encode_coding_system), p, eol_flag);
|
||||
}
|
||||
#endif /* subprocesses */
|
||||
#endif /* 0 */
|
||||
|
Loading…
Reference in New Issue
Block a user