Debian Codegraph @

libsrc/readline/rldefs.h

raw
1 /* rldefs.h -- an attempt to isolate some of the system-specific defines
2 for readline. This should be included after any files that define
3 system-specific constants like _POSIX_VERSION or USG. */
4
5 /* Copyright (C) 1987,1989 Free Software Foundation, Inc.
6
7 This file contains the Readline Library (the Library), a set of
8 routines for providing Emacs style line input to programs that ask
9 for it.
10
11 The Library is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 1, or (at your option)
14 any later version.
15
16 The Library is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
20
21 The GNU General Public License is often shipped with GNU software, and
22 is generally kept in a file called COPYING or LICENSE. If you do not
23 have a copy of the license, write to the Free Software Foundation,
24 675 Mass Ave, Cambridge, MA 02139, USA. */
25
26 /*
27 .VERSION
28 030417 last modif
29 */
30
31
32 #if !defined (_RLDEFS_H)
33 #define _RLDEFS_H
34
35 #if !defined (PRAGMA_ALLOCA)
36 # include "memalloc.h"
37 #endif
38
39 #define NEW_TTY_DRIVER
40 #define HAVE_BSD_SIGNALS
41 /* #define USE_XON_XOFF */
42
43 #if defined (__linux__)
44 # include <termcap.h>
45 #endif /* __linux__ */
46
47 /* Some USG machines have BSD signal handling (sigblock, sigsetmask, etc.) */
48 #if defined (USG) && !defined (hpux)
49 # undef HAVE_BSD_SIGNALS
50 #endif
51
52 /* System V machines use termio. */
53 #if !defined (_POSIX_VERSION)
54 # if defined (USG) || defined (hpux) || defined (Xenix) || defined (sgi) || defined (DGUX)
55 # undef NEW_TTY_DRIVER
56 # define TERMIO_TTY_DRIVER
57 # include <termio.h>
58 # if !defined (TCOON)
59 # define TCOON 1
60 # endif
61 # endif /* USG || hpux || Xenix || sgi || DUGX */
62 #endif /* !_POSIX_VERSION */
63
64 /* Posix systems use termios and the Posix signal functions. */
65 #if defined (_POSIX_VERSION)
66 # if !defined (TERMIOS_MISSING)
67 # undef NEW_TTY_DRIVER
68 # define TERMIOS_TTY_DRIVER
69 # include <termios.h>
70 # endif /* !TERMIOS_MISSING */
71 # define HAVE_POSIX_SIGNALS
72 # if !defined (O_NDELAY)
73 # define O_NDELAY O_NONBLOCK /* Posix-style non-blocking i/o */
74 # endif /* O_NDELAY */
75 #endif /* _POSIX_VERSION */
76
77 /* System V.3 machines have the old 4.1 BSD `reliable' signal interface. */
78 #if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
79 # if defined (USGr3) && !defined (XENIX_22)
80 # if !defined (HAVE_USG_SIGHOLD)
81 # define HAVE_USG_SIGHOLD
82 # endif /* !HAVE_USG_SIGHOLD */
83 # endif /* USGr3 && !XENIX_22 */
84 #endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */
85
86 /* Other (BSD) machines use sgtty. */
87 #if defined (NEW_TTY_DRIVER)
88 # include <sgtty.h>
89 #endif
90
91 /* Define _POSIX_VDISABLE if we are not using the `new' tty driver and
92 it is not already defined. It is used both to determine if a
93 special character is disabled and to disable certain special
94 characters. Posix systems should set to 0, USG systems to -1. */
95 #if !defined (NEW_TTY_DRIVER) && !defined (_POSIX_VDISABLE)
96 # if defined (_POSIX_VERSION)
97 # define _POSIX_VDISABLE 0
98 # else /* !_POSIX_VERSION */
99 # define _POSIX_VDISABLE -1
100 # endif /* !_POSIX_VERSION */
101 #endif /* !NEW_TTY_DRIVER && !_POSIX_VDISABLE */
102
103 #if !defined (SHELL) && (defined (_POSIX_VERSION) || defined (USGr3))
104 # if !defined (HAVE_DIRENT_H)
105 # define HAVE_DIRENT_H
106 # endif /* !HAVE_DIRENT_H */
107 #endif /* !SHELL && (_POSIX_VERSION || USGr3) */
108
109 #if defined (HAVE_DIRENT_H)
110 # include <dirent.h>
111 # define D_NAMLEN(d) strlen ((d)->d_name)
112 #else /* !HAVE_DIRENT_H */
113 # define D_NAMLEN(d) ((d)->d_namlen)
114 # if defined (USG)
115 # if defined (Xenix)
116 # include <sys/ndir.h>
117 # else /* !Xenix (but USG...) */
118 # include "ndir.h"
119 # endif /* !Xenix */
120 # else /* !USG */
121 # include <sys/dir.h>
122 # endif /* !USG */
123 # if !defined (dirent)
124 # define dirent direct
125 # endif /* !dirent */
126 #endif /* !HAVE_DIRENT_H */
127
128 #if defined (USG) && defined (TIOCGWINSZ) && !defined (Linux)
129 # if defined (HAVE_SYS_STREAM_H)
130 # include <sys/stream.h>
131 # endif /* HAVE_SYS_STREAM_H */
132 # if defined (HAVE_SYS_PTEM_H)
133 # include <sys/ptem.h>
134 # endif /* HAVE_SYS_PTEM_H */
135 # if defined (HAVE_SYS_PTE_H)
136 # include <sys/pte.h>
137 # endif /* HAVE_SYS_PTE_H */
138 #endif /* USG && TIOCGWINSZ && !Linux */
139
140 /* Posix macro to check file in statbuf for directory-ness.
141 This requires that <sys/stat.h> be included before this test. */
142 #if defined (S_IFDIR) && !defined (S_ISDIR)
143 # define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
144 #endif
145
146 /* Decide which flavor of the header file describing the C library
147 string functions to include and include it. */
148
149 #if defined (USG) || defined (NeXT)
150 # if !defined (HAVE_STRING_H)
151 # define HAVE_STRING_H
152 # endif /* !HAVE_STRING_H */
153 #endif /* USG || NeXT */
154
155 #if defined (HAVE_STRING_H)
156 # include <string.h>
157 #else /* !HAVE_STRING_H */
158 # include <strings.h>
159 #endif /* !HAVE_STRING_H */
160
161 #if !defined (strchr) && !defined (__STDC__)
162 extern char *strchr (), *strrchr ();
163 #endif /* !strchr && !__STDC__ */
164
165 /* varargs.h is deprecated and replaced by stdarg.h
166 but display.c needs some editing if we change the .h file (KB)
167
168 #if defined (HAVE_VARARGS_H)
169 # include <varargs.h>
170 #endif
171 */
172
173 /* This is needed to include support for TIOCGWINSZ and window resizing. */
174 #if defined (OSF1) || defined (BSD386) || defined (NetBSD) || \
175 defined (__BSD_4_4__) || defined (FreeBSD) || defined (_386BSD) || \
176 defined (AIX)
177 # define WINSIZE_IN_IOCTL_H
178 #endif
179
180 #if !defined (emacs_mode)
181 # define no_mode -1
182 # define vi_mode 0
183 # define emacs_mode 1
184 #endif
185
186 /* If you cast map[key].function to type (Keymap) on a Cray,
187 the compiler takes the value of map[key].function and
188 divides it by 4 to convert between pointer types (pointers
189 to functions and pointers to structs are different sizes).
190 This is not what is wanted. */
191 #if defined (CRAY)
192 # define FUNCTION_TO_KEYMAP(map, key) (Keymap)((int)map[key].function)
193 # define KEYMAP_TO_FUNCTION(data) (Function *)((int)(data))
194 #else
195 # define FUNCTION_TO_KEYMAP(map, key) (Keymap)(map[key].function)
196 # define KEYMAP_TO_FUNCTION(data) (Function *)(data)
197 #endif
198
199 #ifndef savestring
200 extern char *xmalloc ();
201 #define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
202 #endif
203
204 /* Possible values for _rl_bell_preference. */
205 #define NO_BELL 0
206 #define AUDIBLE_BELL 1
207 #define VISIBLE_BELL 2
208
209 /* CONFIGURATION SECTION */
210 #include "rlconf.h"
211
212 #endif /* !_RLDEFS_H */