Mercurial > emacs
annotate src/systty.h @ 2913:409c1022bad5
Some changes from Michael K. Johnson for Linux.
* sysdep.c (sys_siglist): Don't define this if HAVE_SYS_SIGLIST is
#defined. That lets the system provide it, if it has it.
* syssignal.h (sigmask): Only define this if <signal.h> hasn't
given us a definition already.
* syssignal.h (sys_sigpause): Fix argument in prototype.
* sysdep.c (init_signals): The masks are called empty_mask and
full_mask, not signal_empty_mask and signal_full_mask.
(signal_handler_t): Moved ....
* syssignal.h: ... to here.
* systty.h (EMACS_SET_TTY_PGRP): Call tcsetpgrp with the correct
arguments.
* emacs.c (main): Don't try to establish signal handlers for
SIGBUS and SIGSYS unless they're actually #defined.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Wed, 19 May 1993 22:01:35 +0000 |
parents | 32106dbf6d01 |
children | 725698689fbd |
rev | line source |
---|---|
1597 | 1 /* systty.h - System-dependent definitions for terminals. |
578 | 2 Copyright (C) 1992 Free Software Foundation, Inc. |
3 | |
4 This file is part of GNU Emacs. | |
5 | |
6 GNU Emacs 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 1, or (at your option) | |
9 any later version. | |
10 | |
11 GNU Emacs 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. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with GNU Emacs; see the file COPYING. If not, write to | |
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
19 | |
2095
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
20 #ifdef HAVE_TERMIOS |
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
21 #define HAVE_TCATTR |
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
22 #endif |
578 | 23 |
24 /* Include the proper files. */ | |
25 #ifdef HAVE_TERMIO | |
2912
32106dbf6d01
Some changes from Michael K. Johnson for Linux.
Jim Blandy <jimb@redhat.com>
parents:
2873
diff
changeset
|
26 #ifdef __DGUX |
32106dbf6d01
Some changes from Michael K. Johnson for Linux.
Jim Blandy <jimb@redhat.com>
parents:
2873
diff
changeset
|
27 #include <sys/ioctl.h> |
32106dbf6d01
Some changes from Michael K. Johnson for Linux.
Jim Blandy <jimb@redhat.com>
parents:
2873
diff
changeset
|
28 #endif |
578 | 29 #include <termio.h> |
30 #include <fcntl.h> | |
31 #else | |
32 #ifdef HAVE_TERMIOS | |
33 #include <termio.h> | |
34 #include <termios.h> | |
1929
8ca19160362b
* systty.h [HAVE_TERMIOS]: Include fcntl.h.
Jim Blandy <jimb@redhat.com>
parents:
1597
diff
changeset
|
35 #include <fcntl.h> |
578 | 36 #else /* neither HAVE_TERMIO nor HAVE_TERMIOS */ |
37 #ifndef VMS | |
38 #include <sgtty.h> | |
1597 | 39 #else /* VMS */ |
40 #include <descrip.h> | |
41 static struct iosb | |
42 { | |
43 short status; | |
44 short offset; | |
45 short termlen; | |
46 short term; | |
47 } input_iosb; | |
48 | |
49 extern int waiting_for_ast; | |
50 extern int stop_input; | |
2264
87934d212841
Some VMS changes from Richard Levitte <levitte@e.kth.se>:
Jim Blandy <jimb@redhat.com>
parents:
2095
diff
changeset
|
51 #if 0 /* VAX C doeasn't understand initializing declarations */ |
1597 | 52 extern int input_ef = 0; |
53 extern int timer_ef = 0; | |
54 extern int process_ef = 0; | |
2264
87934d212841
Some VMS changes from Richard Levitte <levitte@e.kth.se>:
Jim Blandy <jimb@redhat.com>
parents:
2095
diff
changeset
|
55 #else |
87934d212841
Some VMS changes from Richard Levitte <levitte@e.kth.se>:
Jim Blandy <jimb@redhat.com>
parents:
2095
diff
changeset
|
56 extern int input_ef; |
87934d212841
Some VMS changes from Richard Levitte <levitte@e.kth.se>:
Jim Blandy <jimb@redhat.com>
parents:
2095
diff
changeset
|
57 extern int timer_ef; |
87934d212841
Some VMS changes from Richard Levitte <levitte@e.kth.se>:
Jim Blandy <jimb@redhat.com>
parents:
2095
diff
changeset
|
58 extern int process_ef; |
87934d212841
Some VMS changes from Richard Levitte <levitte@e.kth.se>:
Jim Blandy <jimb@redhat.com>
parents:
2095
diff
changeset
|
59 #endif |
1597 | 60 extern int input_eflist; |
61 extern int timer_eflist; | |
62 | |
63 static $DESCRIPTOR (input_dsc, "TT"); | |
64 static int terminator_mask[2] = { 0, 0 }; | |
65 | |
66 static struct sensemode { | |
67 short status; | |
68 unsigned char xmit_baud; | |
69 unsigned char rcv_baud; | |
70 unsigned char crfill; | |
71 unsigned char lffill; | |
72 unsigned char parity; | |
73 unsigned char unused; | |
74 char class; | |
75 char type; | |
76 short scr_wid; | |
77 unsigned long tt_char : 24, scr_len : 8; | |
78 unsigned long tt2_char; | |
79 } sensemode_iosb; | |
80 #endif /* VMS */ | |
578 | 81 #endif /* not HAVE_TERMIOS */ |
82 #endif /* not HAVE_TERMIO */ | |
83 | |
621 | 84 #ifdef AIX |
85 /* Get files for keyboard remapping */ | |
86 #define HFNKEYS 2 | |
87 #include <sys/hft.h> | |
88 #include <sys/devinfo.h> | |
89 #endif | |
90 | |
91 /* Get rid of LLITOUT in 4.1, since it is said to stimulate kernel bugs. */ | |
92 #ifdef BSD4_1 | |
93 #undef LLITOUT | |
94 #define LLITOUT 0 | |
95 #endif /* 4.1 */ | |
96 | |
97 #ifdef NEED_BSDTTY | |
98 #include <sys/bsdtty.h> | |
99 #endif | |
100 | |
101 #if defined (HPUX) && defined (HAVE_PTYS) | |
102 #include <sys/ptyio.h> | |
103 #endif | |
104 | |
105 #ifdef AIX | |
106 #include <sys/pty.h> | |
107 #include <unistd.h> | |
108 #endif /* AIX */ | |
109 | |
110 #ifdef SYSV_PTYS | |
111 #include <sys/tty.h> | |
648 | 112 #ifdef titan |
113 #include <sys/ttyhw.h> | |
114 #include <sys/stream.h> | |
115 #endif | |
2414
9994dd2e75c9
[NO_PTY_H]: Don't include pty.h.
Richard M. Stallman <rms@gnu.org>
parents:
2264
diff
changeset
|
116 #ifndef NO_PTY_H |
621 | 117 #include <sys/pty.h> |
118 #endif | |
2414
9994dd2e75c9
[NO_PTY_H]: Don't include pty.h.
Richard M. Stallman <rms@gnu.org>
parents:
2264
diff
changeset
|
119 #endif |
621 | 120 |
121 /* saka@pfu.fujitsu.co.JP writes: | |
122 FASYNC defined in this file. But, FASYNC don't working. | |
123 so no problem, because unrequest_sigio only need. */ | |
124 #if defined (pfa) | |
125 #include <sys/file.h> | |
126 #endif | |
127 | |
578 | 128 |
129 /* Special cases - inhibiting the use of certain features. */ | |
130 | |
131 #ifdef APOLLO | |
132 #undef TIOCSTART | |
133 #endif | |
134 | |
648 | 135 #ifdef XENIX |
136 #undef TIOCGETC /* Avoid confusing some conditionals that test this. */ | |
137 #endif | |
138 | |
578 | 139 #ifdef BROKEN_TIOCGETC |
140 #undef TIOCGETC /* Avoid confusing some conditionals that test this. */ | |
141 #endif | |
142 | |
143 /* UNIPLUS systems may have FIONREAD. */ | |
144 #ifdef UNIPLUS | |
145 #include <sys.ioctl.h> | |
146 #endif | |
147 | |
148 /* Allow m- file to inhibit use of FIONREAD. */ | |
149 #ifdef BROKEN_FIONREAD | |
150 #undef FIONREAD | |
151 #undef ASYNC | |
152 #endif | |
153 | |
154 /* Interupt input is not used if there is no FIONREAD. */ | |
155 #ifndef FIONREAD | |
156 #undef SIGIO | |
157 #endif | |
158 | |
159 | |
1101 | 160 /* Try to establish the correct character to disable terminal functions |
161 in a system-independent manner. Note that USG (at least) define | |
162 _POSIX_VDISABLE as 0! */ | |
163 | |
164 #ifdef _POSIX_VDISABLE | |
165 #define CDISABLE _POSIX_VDISABLE | |
166 #else /* not _POSIX_VDISABLE */ | |
167 #ifdef CDEL | |
168 #define CDISABLE CDEL | |
169 #else /* not CDEL */ | |
170 #define CDISABLE 255 | |
171 #endif /* not CDEL */ | |
172 #endif /* not _POSIX_VDISABLE */ | |
173 | |
578 | 174 /* Get the number of characters queued for output. */ |
175 | |
176 /* EMACS_OUTQSIZE(FD, int *SIZE) stores the number of characters | |
177 queued for output to the terminal FD in *SIZE, if FD is a tty. | |
178 Returns -1 if there was an error (i.e. FD is not a tty), 0 | |
179 otherwise. */ | |
180 #ifdef TIOCOUTQ | |
181 #define EMACS_OUTQSIZE(fd, size) (ioctl ((fd), TIOCOUTQ, (size))) | |
182 #endif | |
183 | |
184 #ifdef HAVE_TERMIO | |
185 #ifdef TCOUTQ | |
186 #undef EMACS_OUTQSIZE | |
187 #define EMACS_OUTQSIZE(fd, size) (ioctl ((fd), TCOUTQ, (size))) | |
188 #endif | |
189 #endif | |
190 | |
191 | |
192 /* Manipulate a terminal's current process group. */ | |
193 | |
194 /* EMACS_HAVE_TTY_PGRP is true if we can get and set the tty's current | |
195 controlling process group. | |
196 | |
197 EMACS_GET_TTY_PGRP(int FD, int *PGID) sets *PGID the terminal FD's | |
198 current process group. Return -1 if there is an error. | |
199 | |
200 EMACS_SET_TTY_PGRP(int FD, int *PGID) sets the terminal FD's | |
201 current process group to *PGID. Return -1 if there is an error. */ | |
202 | |
648 | 203 #ifdef HPUX |
204 /* HPUX tty process group stuff doesn't work, says the anonymous voice | |
205 from the past. */ | |
206 #else | |
578 | 207 #ifdef TIOCGPGRP |
208 #define EMACS_HAVE_TTY_PGRP | |
209 #else | |
210 #ifdef HAVE_TERMIOS | |
211 #define EMACS_HAVE_TTY_PGRP | |
212 #endif | |
213 #endif | |
648 | 214 #endif |
578 | 215 |
216 #ifdef EMACS_HAVE_TTY_PGRP | |
217 | |
218 #ifdef HAVE_TERMIOS | |
219 | |
220 #define EMACS_GET_TTY_PGRP(fd, pgid) (*(pgid) = tcgetpgrp ((fd))) | |
2912
32106dbf6d01
Some changes from Michael K. Johnson for Linux.
Jim Blandy <jimb@redhat.com>
parents:
2873
diff
changeset
|
221 #define EMACS_SET_TTY_PGRP(fd, pgid) (*(pgid) = tcsetpgrp ((fd), *(pgid))) |
578 | 222 |
223 #else | |
224 #ifdef TIOCSPGRP | |
225 | |
226 #define EMACS_GET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCGPGRP, (pgid))) | |
227 #define EMACS_SET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCSPGRP, (pgid))) | |
228 | |
229 #endif | |
230 #endif | |
231 | |
232 #else | |
233 | |
234 /* Just ignore this for now and hope for the best */ | |
235 #define EMACS_GET_TTY_PGRP(fd, pgid) 0 | |
999 | 236 #define EMACS_SET_TTY_PGRP(fd, pgif) 0 |
578 | 237 |
238 #endif | |
239 | |
240 | |
241 /* Manipulate a TTY's input/output processing parameters. */ | |
242 | |
243 /* struct emacs_tty is a structure used to hold the current tty | |
244 parameters. If the terminal has several structures describing its | |
245 state, for example a struct tchars, a struct sgttyb, a struct | |
246 tchars, a struct ltchars, and a struct pagechars, struct | |
247 emacs_tty should contain an element for each parameter struct | |
248 that Emacs may change. | |
249 | |
2873
f1cd54cf1b67
* sysdep.c (reset_sys_modes): Test the return value of
Jim Blandy <jimb@redhat.com>
parents:
2658
diff
changeset
|
250 EMACS_GET_TTY (int FD, struct emacs_tty *P) stores the parameters |
f1cd54cf1b67
* sysdep.c (reset_sys_modes): Test the return value of
Jim Blandy <jimb@redhat.com>
parents:
2658
diff
changeset
|
251 of the tty on FD in *P. Return zero if all's well, or -1 if we ran |
f1cd54cf1b67
* sysdep.c (reset_sys_modes): Test the return value of
Jim Blandy <jimb@redhat.com>
parents:
2658
diff
changeset
|
252 into an error we couldn't deal with. |
578 | 253 |
254 EMACS_SET_TTY (int FD, struct emacs_tty *P, int waitp) | |
255 sets the parameters of the tty on FD according to the contents of | |
256 *P. If waitp is non-zero, we wait for all queued output to be | |
257 written before making the change; otherwise, we forget any queued | |
258 input and make the change immediately. | |
2873
f1cd54cf1b67
* sysdep.c (reset_sys_modes): Test the return value of
Jim Blandy <jimb@redhat.com>
parents:
2658
diff
changeset
|
259 Return 0 if all went well, and -1 if anything failed. |
578 | 260 |
261 EMACS_TTY_TABS_OK (struct emacs_tty *P) is false iff the kernel | |
262 expands tabs to spaces upon output; in that case, there is no | |
263 advantage to using tabs over spaces. */ | |
264 | |
265 | |
266 /* For each tty parameter structure that Emacs might want to save and restore, | |
2873
f1cd54cf1b67
* sysdep.c (reset_sys_modes): Test the return value of
Jim Blandy <jimb@redhat.com>
parents:
2658
diff
changeset
|
267 - include an element for it in this structure, and |
f1cd54cf1b67
* sysdep.c (reset_sys_modes): Test the return value of
Jim Blandy <jimb@redhat.com>
parents:
2658
diff
changeset
|
268 - extend the emacs_{get,set}_tty functions in sysdep.c to deal with the |
f1cd54cf1b67
* sysdep.c (reset_sys_modes): Test the return value of
Jim Blandy <jimb@redhat.com>
parents:
2658
diff
changeset
|
269 new members. */ |
578 | 270 |
271 struct emacs_tty { | |
272 | |
273 /* There is always one of the following elements, so there is no need | |
274 for dummy get and set definitions. */ | |
2095
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
275 #ifdef HAVE_TCATTR |
578 | 276 struct termios main; |
277 #else | |
278 #ifdef HAVE_TERMIO | |
279 struct termio main; | |
280 #else | |
281 #ifdef VMS | |
282 struct sensemode main; | |
283 #else | |
284 struct sgttyb main; | |
285 #endif | |
286 #endif | |
287 #endif | |
2095
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
288 #ifdef TIOCGLTC |
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
289 struct ltchars ltchars; |
578 | 290 #endif |
2095
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
291 #ifdef TIOCGETC |
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
292 struct tchars tchars; |
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
293 int lmode; |
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
294 #endif |
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
295 }; |
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
296 |
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
297 /* Define EMACS_GET_TTY and EMACS_SET_TTY, |
2658
8be0a57686cb
* systty.h (EMACS_GET_TTY, EMACS_SET_TTY): Move these into
Jim Blandy <jimb@redhat.com>
parents:
2414
diff
changeset
|
298 the macros for reading and setting parts of `struct emacs_tty'. |
578 | 299 |
2658
8be0a57686cb
* systty.h (EMACS_GET_TTY, EMACS_SET_TTY): Move these into
Jim Blandy <jimb@redhat.com>
parents:
2414
diff
changeset
|
300 These got pretty unmanageable (huge macros are hard to debug), and |
8be0a57686cb
* systty.h (EMACS_GET_TTY, EMACS_SET_TTY): Move these into
Jim Blandy <jimb@redhat.com>
parents:
2414
diff
changeset
|
301 finally needed some code which couldn't be done as part of an |
8be0a57686cb
* systty.h (EMACS_GET_TTY, EMACS_SET_TTY): Move these into
Jim Blandy <jimb@redhat.com>
parents:
2414
diff
changeset
|
302 expression, so we moved them out to their own functions in sysdep.c. */ |
8be0a57686cb
* systty.h (EMACS_GET_TTY, EMACS_SET_TTY): Move these into
Jim Blandy <jimb@redhat.com>
parents:
2414
diff
changeset
|
303 #define EMACS_GET_TTY(fd, p) (emacs_get_tty ((fd), (p))) |
8be0a57686cb
* systty.h (EMACS_GET_TTY, EMACS_SET_TTY): Move these into
Jim Blandy <jimb@redhat.com>
parents:
2414
diff
changeset
|
304 #define EMACS_SET_TTY(fd, p, waitp) (emacs_set_tty ((fd), (p), (waitp))) |
578 | 305 |
2095
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
306 |
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
307 /* Define EMACS_TTY_TABS_OK. */ |
578 | 308 |
309 #ifdef HAVE_TERMIOS | |
310 | |
311 #define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3) | |
312 | |
313 #else /* not def HAVE_TERMIOS */ | |
314 #ifdef HAVE_TERMIO | |
315 | |
316 #define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3) | |
317 | |
318 #else /* neither HAVE_TERMIO nor HAVE_TERMIOS */ | |
319 #ifdef VMS | |
320 | |
321 #define EMACS_TTY_TABS_OK(p) (((p)->main.tt_char & TT$M_MECHTAB) != 0) | |
322 | |
323 #else | |
324 | |
325 #define EMACS_TTY_TABS_OK(p) (((p)->main.sg_flags & XTABS) != XTABS) | |
326 | |
327 #endif /* not def VMS */ | |
328 #endif /* not def HAVE_TERMIO */ | |
329 #endif /* not def HAVE_TERMIOS */ |