Mercurial > emacs
annotate src/systty.h @ 3137:1e7d462c176f
(hexlify-command, dehexlify-command): Use exec-directory.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 26 May 1993 21:17:31 +0000 |
parents | e94a593c3952 |
children | 84825e357019 |
rev | line source |
---|---|
1597 | 1 /* systty.h - System-dependent definitions for terminals. |
2961 | 2 Copyright (C) 1993 Free Software Foundation, Inc. |
578 | 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 | |
2943
be86b41a0661
* systty.h [SYSV_PTYS]: #include <sys/types.h>. Francesco
Jim Blandy <jimb@redhat.com>
parents:
2917
diff
changeset
|
111 #include <sys/types.h> |
621 | 112 #include <sys/tty.h> |
648 | 113 #ifdef titan |
114 #include <sys/ttyhw.h> | |
115 #include <sys/stream.h> | |
116 #endif | |
2414
9994dd2e75c9
[NO_PTY_H]: Don't include pty.h.
Richard M. Stallman <rms@gnu.org>
parents:
2264
diff
changeset
|
117 #ifndef NO_PTY_H |
621 | 118 #include <sys/pty.h> |
119 #endif | |
2414
9994dd2e75c9
[NO_PTY_H]: Don't include pty.h.
Richard M. Stallman <rms@gnu.org>
parents:
2264
diff
changeset
|
120 #endif |
621 | 121 |
122 /* saka@pfu.fujitsu.co.JP writes: | |
123 FASYNC defined in this file. But, FASYNC don't working. | |
124 so no problem, because unrequest_sigio only need. */ | |
125 #if defined (pfa) | |
126 #include <sys/file.h> | |
127 #endif | |
128 | |
578 | 129 |
130 /* Special cases - inhibiting the use of certain features. */ | |
131 | |
132 #ifdef APOLLO | |
133 #undef TIOCSTART | |
134 #endif | |
135 | |
648 | 136 #ifdef XENIX |
137 #undef TIOCGETC /* Avoid confusing some conditionals that test this. */ | |
138 #endif | |
139 | |
578 | 140 #ifdef BROKEN_TIOCGETC |
141 #undef TIOCGETC /* Avoid confusing some conditionals that test this. */ | |
142 #endif | |
143 | |
144 /* UNIPLUS systems may have FIONREAD. */ | |
145 #ifdef UNIPLUS | |
146 #include <sys.ioctl.h> | |
147 #endif | |
148 | |
149 /* Allow m- file to inhibit use of FIONREAD. */ | |
150 #ifdef BROKEN_FIONREAD | |
151 #undef FIONREAD | |
152 #undef ASYNC | |
153 #endif | |
154 | |
155 /* Interupt input is not used if there is no FIONREAD. */ | |
156 #ifndef FIONREAD | |
157 #undef SIGIO | |
158 #endif | |
159 | |
160 | |
1101 | 161 /* Try to establish the correct character to disable terminal functions |
162 in a system-independent manner. Note that USG (at least) define | |
163 _POSIX_VDISABLE as 0! */ | |
164 | |
165 #ifdef _POSIX_VDISABLE | |
166 #define CDISABLE _POSIX_VDISABLE | |
167 #else /* not _POSIX_VDISABLE */ | |
168 #ifdef CDEL | |
169 #define CDISABLE CDEL | |
170 #else /* not CDEL */ | |
171 #define CDISABLE 255 | |
172 #endif /* not CDEL */ | |
173 #endif /* not _POSIX_VDISABLE */ | |
174 | |
578 | 175 /* Get the number of characters queued for output. */ |
176 | |
177 /* EMACS_OUTQSIZE(FD, int *SIZE) stores the number of characters | |
178 queued for output to the terminal FD in *SIZE, if FD is a tty. | |
179 Returns -1 if there was an error (i.e. FD is not a tty), 0 | |
180 otherwise. */ | |
181 #ifdef TIOCOUTQ | |
182 #define EMACS_OUTQSIZE(fd, size) (ioctl ((fd), TIOCOUTQ, (size))) | |
183 #endif | |
184 | |
185 #ifdef HAVE_TERMIO | |
186 #ifdef TCOUTQ | |
187 #undef EMACS_OUTQSIZE | |
188 #define EMACS_OUTQSIZE(fd, size) (ioctl ((fd), TCOUTQ, (size))) | |
189 #endif | |
190 #endif | |
191 | |
192 | |
193 /* Manipulate a terminal's current process group. */ | |
194 | |
195 /* EMACS_HAVE_TTY_PGRP is true if we can get and set the tty's current | |
196 controlling process group. | |
197 | |
198 EMACS_GET_TTY_PGRP(int FD, int *PGID) sets *PGID the terminal FD's | |
199 current process group. Return -1 if there is an error. | |
200 | |
201 EMACS_SET_TTY_PGRP(int FD, int *PGID) sets the terminal FD's | |
202 current process group to *PGID. Return -1 if there is an error. */ | |
203 | |
648 | 204 #ifdef HPUX |
205 /* HPUX tty process group stuff doesn't work, says the anonymous voice | |
206 from the past. */ | |
207 #else | |
578 | 208 #ifdef TIOCGPGRP |
209 #define EMACS_HAVE_TTY_PGRP | |
210 #else | |
211 #ifdef HAVE_TERMIOS | |
212 #define EMACS_HAVE_TTY_PGRP | |
213 #endif | |
214 #endif | |
648 | 215 #endif |
578 | 216 |
217 #ifdef EMACS_HAVE_TTY_PGRP | |
218 | |
219 #ifdef HAVE_TERMIOS | |
220 | |
221 #define EMACS_GET_TTY_PGRP(fd, pgid) (*(pgid) = tcgetpgrp ((fd))) | |
2917
725698689fbd
Some more changes from Michael K. Johnson for Linux.
Jim Blandy <jimb@redhat.com>
parents:
2912
diff
changeset
|
222 #define EMACS_SET_TTY_PGRP(fd, pgid) (tcsetpgrp ((fd), *(pgid))) |
578 | 223 |
224 #else | |
225 #ifdef TIOCSPGRP | |
226 | |
227 #define EMACS_GET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCGPGRP, (pgid))) | |
228 #define EMACS_SET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCSPGRP, (pgid))) | |
229 | |
230 #endif | |
231 #endif | |
232 | |
233 #else | |
234 | |
235 /* Just ignore this for now and hope for the best */ | |
236 #define EMACS_GET_TTY_PGRP(fd, pgid) 0 | |
999 | 237 #define EMACS_SET_TTY_PGRP(fd, pgif) 0 |
578 | 238 |
239 #endif | |
240 | |
241 | |
242 /* Manipulate a TTY's input/output processing parameters. */ | |
243 | |
244 /* struct emacs_tty is a structure used to hold the current tty | |
245 parameters. If the terminal has several structures describing its | |
246 state, for example a struct tchars, a struct sgttyb, a struct | |
247 tchars, a struct ltchars, and a struct pagechars, struct | |
248 emacs_tty should contain an element for each parameter struct | |
249 that Emacs may change. | |
250 | |
2873
f1cd54cf1b67
* sysdep.c (reset_sys_modes): Test the return value of
Jim Blandy <jimb@redhat.com>
parents:
2658
diff
changeset
|
251 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
|
252 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
|
253 into an error we couldn't deal with. |
578 | 254 |
255 EMACS_SET_TTY (int FD, struct emacs_tty *P, int waitp) | |
256 sets the parameters of the tty on FD according to the contents of | |
257 *P. If waitp is non-zero, we wait for all queued output to be | |
258 written before making the change; otherwise, we forget any queued | |
259 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
|
260 Return 0 if all went well, and -1 if anything failed. |
578 | 261 |
262 EMACS_TTY_TABS_OK (struct emacs_tty *P) is false iff the kernel | |
263 expands tabs to spaces upon output; in that case, there is no | |
264 advantage to using tabs over spaces. */ | |
265 | |
266 | |
267 /* 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
|
268 - 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
|
269 - 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
|
270 new members. */ |
578 | 271 |
272 struct emacs_tty { | |
273 | |
274 /* There is always one of the following elements, so there is no need | |
275 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
|
276 #ifdef HAVE_TCATTR |
578 | 277 struct termios main; |
278 #else | |
279 #ifdef HAVE_TERMIO | |
280 struct termio main; | |
281 #else | |
282 #ifdef VMS | |
283 struct sensemode main; | |
284 #else | |
285 struct sgttyb main; | |
286 #endif | |
287 #endif | |
288 #endif | |
2095
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
289 #ifdef TIOCGLTC |
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
290 struct ltchars ltchars; |
578 | 291 #endif |
2095
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
292 #ifdef TIOCGETC |
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
293 struct tchars tchars; |
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
294 int lmode; |
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
295 #endif |
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 |
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
298 /* 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
|
299 the macros for reading and setting parts of `struct emacs_tty'. |
578 | 300 |
2658
8be0a57686cb
* systty.h (EMACS_GET_TTY, EMACS_SET_TTY): Move these into
Jim Blandy <jimb@redhat.com>
parents:
2414
diff
changeset
|
301 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
|
302 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
|
303 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
|
304 #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
|
305 #define EMACS_SET_TTY(fd, p, waitp) (emacs_set_tty ((fd), (p), (waitp))) |
578 | 306 |
2095
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
307 |
139f87bcbaf1
Define HAVE_TCATTR based on HAVE_TERMIOS earlier.
Richard M. Stallman <rms@gnu.org>
parents:
1929
diff
changeset
|
308 /* Define EMACS_TTY_TABS_OK. */ |
578 | 309 |
310 #ifdef HAVE_TERMIOS | |
311 | |
312 #define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3) | |
313 | |
314 #else /* not def HAVE_TERMIOS */ | |
315 #ifdef HAVE_TERMIO | |
316 | |
317 #define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3) | |
318 | |
319 #else /* neither HAVE_TERMIO nor HAVE_TERMIOS */ | |
320 #ifdef VMS | |
321 | |
322 #define EMACS_TTY_TABS_OK(p) (((p)->main.tt_char & TT$M_MECHTAB) != 0) | |
323 | |
324 #else | |
325 | |
326 #define EMACS_TTY_TABS_OK(p) (((p)->main.sg_flags & XTABS) != XTABS) | |
327 | |
328 #endif /* not def VMS */ | |
329 #endif /* not def HAVE_TERMIO */ | |
330 #endif /* not def HAVE_TERMIOS */ |