1 /* systty.h - System-dependent definitions for terminals.
2    Copyright (C) 1993-1994, 2001-2021 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 (at
9 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 <https://www.gnu.org/licenses/>.  */
18 
19 #ifndef EMACS_SYSTTY_H
20 #define EMACS_SYSTTY_H
21 
22 /* Include the proper files.  */
23 
24 #ifndef DOS_NT
25 #include <termios.h>
26 #include <fcntl.h>
27 #endif /* not DOS_NT */
28 
29 #include <sys/ioctl.h>
30 
31 #ifdef HPUX
32 #include <sys/bsdtty.h>
33 #include <sys/ptyio.h>
34 #endif
35 
36 #ifdef AIX
37 #include <sys/pty.h>
38 #endif /* AIX */
39 
40 #include <unistd.h>
41 
42 #include "lisp.h"
43 
44 
45 /* Try to establish the correct character to disable terminal functions
46    in a system-independent manner.  Note that USG (at least) define
47    _POSIX_VDISABLE as 0!  */
48 
49 #ifdef _POSIX_VDISABLE
50 #define CDISABLE _POSIX_VDISABLE
51 #else /* not _POSIX_VDISABLE */
52 #ifdef CDEL
53 #undef CDISABLE
54 #define CDISABLE CDEL
55 #else /* not CDEL */
56 #define CDISABLE 255
57 #endif /* not CDEL */
58 #endif /* not _POSIX_VDISABLE */
59 
60 /* Manipulate a TTY's input/output processing parameters.  */
61 
62 /* struct emacs_tty is a structure used to hold the current tty
63    parameters.  If the terminal has several structures describing its
64    state, for example a struct tchars, a struct sgttyb, a struct
65    tchars, a struct ltchars, and a struct pagechars, struct
66    emacs_tty should contain an element for each parameter struct
67    that Emacs may change.  */
68 
69 
70 /* For each tty parameter structure that Emacs might want to save and restore,
71    - include an element for it in this structure, and
72    - extend the emacs_{get,set}_tty functions in sysdep.c to deal with the
73      new members.  */
74 
75 struct emacs_tty {
76 
77 /* There is always one of the following elements, so there is no need
78    for dummy get and set definitions.  */
79 #ifndef DOS_NT
80   struct termios main;
81 #else /* DOS_NT */
82   unsigned main;
83 #endif /* DOS_NT */
84 };
85 
86 /* From sysdep.c or w32.c  */
87 extern int emacs_get_tty (int, struct emacs_tty *) EXTERNALLY_VISIBLE;
88 extern int emacs_set_tty (int, struct emacs_tty *, bool) EXTERNALLY_VISIBLE;
89 extern void suppress_echo_on_tty (int);
90 extern int serial_open (Lisp_Object);
91 extern void serial_configure (struct Lisp_Process *, Lisp_Object);
92 
93 #endif /* EMACS_SYSTTY_H */
94