]> code.delx.au - gnu-emacs/blob - src/systty.h
Avoid _setjmp/_longjmp problems with local nonvolatile variables.
[gnu-emacs] / src / systty.h
1 /* systty.h - System-dependent definitions for terminals.
2 Copyright (C) 1993-1994, 2001-2012 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 3 of the License, or
9 (at your option) 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. If not, see <http://www.gnu.org/licenses/>. */
18
19 /* Include the proper files. */
20 #ifndef DOS_NT
21 #ifndef NO_TERMIO
22 #include <termio.h>
23 #endif /* not NO_TERMIO */
24 #include <termios.h>
25 #include <fcntl.h>
26 #endif /* not DOS_NT */
27
28 #include <sys/ioctl.h>
29
30 #ifdef HPUX
31 #include <sys/bsdtty.h>
32 #include <sys/ptyio.h>
33 #endif
34
35 #ifdef AIX
36 #include <sys/pty.h>
37 #endif /* AIX */
38
39 #include <unistd.h>
40
41 \f
42 /* Special cases - inhibiting the use of certain features. */
43
44 /* Allow configure to inhibit use of FIONREAD. */
45 #ifdef BROKEN_FIONREAD
46 #undef FIONREAD
47 #undef ASYNC
48 #endif
49
50 \f
51 /* Try to establish the correct character to disable terminal functions
52 in a system-independent manner. Note that USG (at least) define
53 _POSIX_VDISABLE as 0! */
54
55 #ifdef _POSIX_VDISABLE
56 #define CDISABLE _POSIX_VDISABLE
57 #else /* not _POSIX_VDISABLE */
58 #ifdef CDEL
59 #undef CDISABLE
60 #define CDISABLE CDEL
61 #else /* not CDEL */
62 #define CDISABLE 255
63 #endif /* not CDEL */
64 #endif /* not _POSIX_VDISABLE */
65 \f
66 /* Get the number of characters queued for output. */
67
68 /* EMACS_OUTQSIZE(FD, int *SIZE) stores the number of characters
69 queued for output to the terminal FD in *SIZE, if FD is a tty.
70 Returns -1 if there was an error (i.e. FD is not a tty), 0
71 otherwise. */
72 #ifdef TIOCOUTQ
73 #define EMACS_OUTQSIZE(fd, size) (ioctl ((fd), TIOCOUTQ, (size)))
74 #endif
75
76 \f
77 /* Manipulate a terminal's current process group. */
78
79 /* EMACS_GETPGRP (arg) returns the process group of the process. */
80
81 #if defined (GETPGRP_VOID)
82 # define EMACS_GETPGRP(x) getpgrp()
83 #else /* !GETPGRP_VOID */
84 # define EMACS_GETPGRP(x) getpgrp(x)
85 #endif /* !GETPGRP_VOID */
86 \f
87 /* Manipulate a TTY's input/output processing parameters. */
88
89 /* struct emacs_tty is a structure used to hold the current tty
90 parameters. If the terminal has several structures describing its
91 state, for example a struct tchars, a struct sgttyb, a struct
92 tchars, a struct ltchars, and a struct pagechars, struct
93 emacs_tty should contain an element for each parameter struct
94 that Emacs may change. */
95
96
97 /* For each tty parameter structure that Emacs might want to save and restore,
98 - include an element for it in this structure, and
99 - extend the emacs_{get,set}_tty functions in sysdep.c to deal with the
100 new members. */
101
102 struct emacs_tty {
103
104 /* There is always one of the following elements, so there is no need
105 for dummy get and set definitions. */
106 #ifndef DOS_NT
107 struct termios main;
108 #else /* DOS_NT */
109 int main;
110 #endif /* DOS_NT */
111 };
112 \f
113 /* From sysdep.c or w32.c */
114 extern int serial_open (char *);
115 extern void serial_configure (struct Lisp_Process *, Lisp_Object);