1 /* Processes implementation header
2 Copyright (C) 1985, 1992, 1993, 1994 Free Software Foundation, Inc.
4 This file is part of SXEmacs
6 SXEmacs is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 SXEmacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* This file must be only included by the process implementation files:
21 process-unix.c, process-msw.c etc. The Lisp_Process structure and other
22 contents of this file is not exported to the rest of the world */
24 #ifndef INCLUDED_procimpl_h_
25 #define INCLUDED_procimpl_h_
28 * Structure which keeps methods of the process implementation.
29 * There is only one object of this class exists in a particular
30 * XEmacs implementation.
33 /* #### Comment me... */
35 struct process_methods {
36 void (*mark_process_data) (Lisp_Process * proc);
37 void (*print_process_data) (Lisp_Process * proc,
38 Lisp_Object printcharfun);
39 void (*finalize_process_data) (Lisp_Process * proc, int for_disksave);
40 void (*alloc_process_data) (Lisp_Process * p);
41 void (*init_process_io_handles) (Lisp_Process * p,
42 void *in, void *out, int flags);
43 int (*create_process) (Lisp_Process * p,
44 Lisp_Object * argv, int nargv,
45 Lisp_Object program, Lisp_Object cur_dir);
46 int (*tooltalk_connection_p) (Lisp_Process * p);
48 void (*open_network_stream) (Lisp_Object name, Lisp_Object host,
49 Lisp_Object service, Lisp_Object protocol,
50 void **vinfd, void **voutfd);
51 void (*open_network_server_stream) (Lisp_Object name, Lisp_Object host,
52 Lisp_Object service, Lisp_Object protocol,
53 void **vinfd, void **voutfd);
54 void (*network_server_accept) (Lisp_Object process);
55 Lisp_Object (*network_process_listener) (Lisp_Object process);
57 void (*open_multicast_group) (Lisp_Object name, Lisp_Object dest,
58 Lisp_Object port, Lisp_Object ttl,
59 void **vinfd, void **voutfd);
60 #endif /* HAVE_MULTICAST */
61 #endif /* HAVE_SOCKETS */
62 Lisp_Object(*canonicalize_host_name) (Lisp_Object host);
63 int (*set_window_size) (Lisp_Process * p, int height, int width);
64 void (*send_process) (Lisp_Object proc, lstream_t lstream);
65 void (*reap_exited_processes) (void);
66 void (*update_status_if_terminated) (Lisp_Process * p);
67 void (*kill_child_process) (Lisp_Object proc, int signo,
68 int current_group, int nomsg);
69 int (*kill_process_by_pid) (int pid, int sigcode);
70 int (*process_send_eof) (Lisp_Object proc);
71 Lisp_Object(*get_tty_name) (Lisp_Process * p);
72 USID(*deactivate_process) (Lisp_Process * p);
73 void (*init_process) (void);
76 extern struct process_methods the_process_methods;
79 * Accessors for process_methods
82 #define HAS_PROCMETH_P(name) (the_process_methods.name != 0)
83 #define PROCMETH(name, par) ((the_process_methods.name) par)
84 #define PROCMETH_OR_GIVEN(name, par, given) (HAS_PROCMETH_P(name) ? PROCMETH(name, par) : (given))
85 #define MAYBE_PROCMETH(name, par) do { if (HAS_PROCMETH_P(name)) PROCMETH(name, par); } while (0);
86 #define MAYBE_LISP_PROCMETH(name, par) PROCMETH_OR_GIVEN(name, par, Qnil)
87 #define MAYBE_INT_PROCMETH(name, par) PROCMETH_OR_GIVEN(name, par, 0)
88 #define PROCESS_HAS_METHOD(os, name) the_process_methods.name = os##_##name
91 * Structure records pertinent information about open channels.
92 * There is one channel associated with each process.
96 struct lcrecord_header header;
97 /* Name of this process */
99 /* List of command arguments that this process was run with */
101 /* (funcall FILTER PROC STRING) (if FILTER is non-nil)
102 to dispose of a bunch of chars from the process all at once */
104 /* (funcall SENTINEL PROCESS) when process state changes */
105 Lisp_Object sentinel;
106 /* Buffer that output is going to */
108 /* Marker set to end of last buffer-inserted output from this process */
110 /* Lisp_Int of subprocess' PID, or a cons of
111 service/host if this is really a network connection */
114 /* Symbol indicating status of process.
115 This may be a symbol: run, stop, exit, signal */
116 Lisp_Object status_symbol;
118 /* Exit code if process has terminated,
119 signal which stopped/interrupted process
120 or 0 if process is running */
122 /* Non-false if process has exited and "dumped core" on its way down */
125 /* This next field is only actually used #ifdef ENERGIZE */
126 /* if this flag is not NIL, then filter will do the read on the
127 channel, rather than having a call to make_string.
128 This only works if the filter is a subr. */
129 char filter_does_read;
130 /* Non-nil means kill silently if Emacs is exited. */
131 char kill_without_query;
133 /* Event-count of last event in which this process changed status. */
135 /* Event-count of last such event reported. */
137 /* Low level streams used in input and output, connected to child */
138 Lisp_Object pipe_instream;
139 Lisp_Object pipe_outstream;
141 /* Data end streams, decoding and encoding pipe_* streams */
142 Lisp_Object coding_instream;
143 Lisp_Object coding_outstream;
146 /* This field now finally holds the purpose of the process.
147 * In the past there were just two types.
148 * Further, there's a generic Lisp_Object which can hold data
149 * specific for the process type
152 Lisp_Object process_type_data;
154 /* Implementation dependent data */
158 /* Macros to refer to data connection streams */
160 #define DATA_INSTREAM(p) (p)->coding_instream
161 #define DATA_OUTSTREAM(p) (p)->coding_outstream
163 #define DATA_INSTREAM(p) (p)->pipe_instream
164 #define DATA_OUTSTREAM(p) (p)->pipe_outstream
167 /* Random externs from process.c */
169 extern Lisp_Object Qip_any, Qlocalhost,Qauto;
171 extern Lisp_Object Qrun, Qstop, Qopen, Qclosed;
172 extern Lisp_Object Qtcp, Qudp;
173 extern Lisp_Object Vprocess_connection_type;
174 extern Lisp_Object Vprocess_list;
176 extern struct hash_table *usid_to_process;
178 extern volatile int process_tick;
180 extern int windowed_process_io;
182 #ifdef HAVE_MULTICAST
183 extern Lisp_Object Qmulticast;
186 #ifdef PROCESS_IO_BLOCKING
187 extern Lisp_Object network_stream_blocking_port_list;
188 #endif /* PROCESS_IO_BLOCKING */
190 Lisp_Object make_process_internal(Lisp_Object name);
191 void init_process_io_handles(Lisp_Process * p, void *in, void *out, int flags);
192 void send_process(Lisp_Object proc,
193 Lisp_Object relocatable,
194 const Bufbyte * nonrelocatable, int start, int len);
196 #endif /* INCLUDED_procimpl_h_ */