Fix warning generated under AIX 4.1.4
[deliverable/binutils-gdb.git] / readline / rldefs.h
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 #if !defined (_RLDEFS_H)
27 #define _RLDEFS_H
28
29 #if defined (__GNUC__)
30 # undef alloca
31 # define alloca __builtin_alloca
32 #else
33 # if defined (sparc) || defined (HAVE_ALLOCA_H)
34 # include <alloca.h>
35 # endif
36 #endif
37
38
39 #define NEW_TTY_DRIVER
40 #define HAVE_BSD_SIGNALS
41 /* #define USE_XON_XOFF */
42
43 #if defined(__MSDOS__) || defined(_MSC_VER)
44 #define NO_SYS_FILE
45 #define SIGALRM 1234
46 #undef NEW_TTY_DRIVER
47 #undef HAVE_BSD_SIGNALS
48 #define MINIMAL
49 #endif
50
51 #if defined (__linux__)
52 # include <termcap.h>
53 #endif /* __linux__ */
54
55 /* Some USG machines have BSD signal handling (sigblock, sigsetmask, etc.) */
56 /* CYGNUS LOCAL accept __hpux as well as hpux for HP compiler in ANSI mode. */
57 #if defined (USG) && !(defined (hpux) || defined (__hpux))
58 # undef HAVE_BSD_SIGNALS
59 #endif
60
61 #if defined (__WIN32__) && !defined(_MSC_VER)
62 #undef NEW_TTY_DRIVER
63 #define MINIMAL
64 #undef HAVE_BSD_SIGNALS
65 #define TERMIOS_TTY_DRIVER
66 #undef HANDLE_SIGNALS
67 #include <termios.h>
68 /*#define HAVE_POSIX_SIGNALS*/
69 #endif
70
71 /* System V machines use termio. */
72 #if !defined (_POSIX_VERSION)
73 /* CYGNUS LOCAL accept __hpux as well as hpux for HP compiler in ANSI mode. */
74 # if defined (USG) || defined (hpux) || defined (__hpux) || defined (Xenix) || defined (sgi) || defined (DGUX)
75 # undef NEW_TTY_DRIVER
76 # define TERMIO_TTY_DRIVER
77 # include <termio.h>
78 # if !defined (TCOON)
79 # define TCOON 1
80 # endif
81 # endif /* USG || hpux || Xenix || sgi || DUGX */
82 #endif /* !_POSIX_VERSION */
83
84 /* Posix systems use termios and the Posix signal functions. */
85 #if defined (_POSIX_VERSION)
86 # if !defined (TERMIOS_MISSING)
87 # undef NEW_TTY_DRIVER
88 # define TERMIOS_TTY_DRIVER
89 # include <termios.h>
90 # endif /* !TERMIOS_MISSING */
91 # define HAVE_POSIX_SIGNALS
92 # if !defined (O_NDELAY)
93 # define O_NDELAY O_NONBLOCK /* Posix-style non-blocking i/o */
94 # endif /* O_NDELAY */
95 #endif /* _POSIX_VERSION */
96
97 /* System V.3 machines have the old 4.1 BSD `reliable' signal interface. */
98 #if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
99 # if defined (USGr3)
100 # if !defined (HAVE_USG_SIGHOLD)
101 # define HAVE_USG_SIGHOLD
102 # endif /* !HAVE_USG_SIGHOLD */
103 # endif /* USGr3 */
104 #endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */
105
106 /* Other (BSD) machines use sgtty. */
107 #if defined (NEW_TTY_DRIVER)
108 # include <sgtty.h>
109 #endif
110
111 /* Define _POSIX_VDISABLE if we are not using the `new' tty driver and
112 it is not already defined. It is used both to determine if a
113 special character is disabled and to disable certain special
114 characters. Posix systems should set to 0, USG systems to -1. */
115 #if !defined (NEW_TTY_DRIVER) && !defined (_POSIX_VDISABLE)
116 # if defined (_POSIX_VERSION)
117 # define _POSIX_VDISABLE 0
118 # else /* !_POSIX_VERSION */
119 # define _POSIX_VDISABLE -1
120 # endif /* !_POSIX_VERSION */
121 #endif /* !NEW_TTY_DRIVER && !_POSIX_VDISABLE */
122
123 #if 1
124 # define D_NAMLEN(d) strlen ((d)->d_name)
125 #else /* !1 */
126
127 #if !defined (SHELL) && (defined (_POSIX_VERSION) || defined (USGr3))
128 # if !defined (HAVE_DIRENT_H)
129 # define HAVE_DIRENT_H
130 # endif /* !HAVE_DIRENT_H */
131 #endif /* !SHELL && (_POSIX_VERSION || USGr3) */
132
133 #if defined (HAVE_DIRENT_H)
134 # include <dirent.h>
135 # if !defined (direct)
136 # define direct dirent
137 # endif /* !direct */
138 # define D_NAMLEN(d) strlen ((d)->d_name)
139 #else /* !HAVE_DIRENT_H */
140 # define D_NAMLEN(d) ((d)->d_namlen)
141 # if defined (USG)
142 # if defined (Xenix)
143 # include <sys/ndir.h>
144 # else /* !Xenix (but USG...) */
145 # include "ndir.h"
146 # endif /* !Xenix */
147 # else /* !USG */
148 # include <sys/dir.h>
149 # endif /* !USG */
150 #endif /* !HAVE_DIRENT_H */
151 #endif /* !1 */
152
153 #if defined (USG) && defined (TIOCGWINSZ) && !defined (Linux)
154 # if defined (_AIX)
155 /* AIX 4.x seems to reference struct uio within a prototype
156 in stream.h, but doesn't cause the uio include file to
157 be included. */
158 # include <sys/uio.h>
159 # endif
160 # include <sys/stream.h>
161 # if defined (HAVE_SYS_PTEM_H)
162 # include <sys/ptem.h>
163 # endif /* HAVE_SYS_PTEM_H */
164 # if defined (HAVE_SYS_PTE_H)
165 # include <sys/pte.h>
166 # endif /* HAVE_SYS_PTE_H */
167 #endif /* USG && TIOCGWINSZ && !Linux */
168
169 /* Posix macro to check file in statbuf for directory-ness.
170 This requires that <sys/stat.h> be included before this test. */
171 #if defined (S_IFDIR) && !defined (S_ISDIR)
172 #define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
173 #endif
174 /* Posix macro to check file in statbuf for file-ness.
175 This requires that <sys/stat.h> be included before this test. */
176 #if defined (S_IFREG) && !defined (S_ISREG)
177 #define S_ISREG(m) (((m)&S_IFMT) == S_IFREG)
178 #endif
179
180 #if !defined (strchr) && !defined (__STDC__)
181 extern char *strchr (), *strrchr ();
182 #endif /* !strchr && !__STDC__ */
183
184 #if defined (HAVE_VARARGS_H)
185 # include <varargs.h>
186 #endif /* HAVE_VARARGS_H */
187
188 /* This definition is needed by readline.c, rltty.c, and signals.c. */
189 /* If on, then readline handles signals in a way that doesn't screw. */
190 #define HANDLE_SIGNALS
191
192 #if defined(__WIN32__) || defined(__MSDOS__)
193 #undef HANDLE_SIGNALS
194 #endif
195
196
197 #if !defined (emacs_mode)
198 # define no_mode -1
199 # define vi_mode 0
200 # define emacs_mode 1
201 #endif
202
203 /* Define some macros for dealing with assorted signalling disciplines.
204
205 These macros provide a way to use signal blocking and disabling
206 without smothering your code in a pile of #ifdef's.
207
208 SIGNALS_UNBLOCK; Stop blocking all signals.
209
210 {
211 SIGNALS_DECLARE_SAVED (name); Declare a variable to save the
212 signal blocking state.
213 ...
214 SIGNALS_BLOCK (SIGSTOP, name); Block a signal, and save the previous
215 state for restoration later.
216 ...
217 SIGNALS_RESTORE (name); Restore previous signals.
218 }
219
220 */
221
222 #ifdef HAVE_POSIX_SIGNALS
223 /* POSIX signals */
224
225 #define SIGNALS_UNBLOCK \
226 do { sigset_t set; \
227 sigemptyset (&set); \
228 sigprocmask (SIG_SETMASK, &set, (sigset_t *)NULL); \
229 } while (0)
230
231 #define SIGNALS_DECLARE_SAVED(name) sigset_t name
232
233 #define SIGNALS_BLOCK(SIG, saved) \
234 do { sigset_t set; \
235 sigemptyset (&set); \
236 sigaddset (&set, SIG); \
237 sigprocmask (SIG_BLOCK, &set, &saved); \
238 } while (0)
239
240 #define SIGNALS_RESTORE(saved) \
241 sigprocmask (SIG_SETMASK, &saved, (sigset_t *)NULL)
242
243
244 #else /* HAVE_POSIX_SIGNALS */
245 #ifdef HAVE_BSD_SIGNALS
246 /* BSD signals */
247
248 #define SIGNALS_UNBLOCK sigsetmask (0)
249 #define SIGNALS_DECLARE_SAVED(name) int name
250 #define SIGNALS_BLOCK(SIG, saved) saved = sigblock (sigmask (SIG))
251 #define SIGNALS_RESTORE(saved) sigsetmask (saved)
252
253
254 #else /* HAVE_BSD_SIGNALS */
255 /* None of the Above */
256
257 #define SIGNALS_UNBLOCK /* nothing */
258 #define SIGNALS_DECLARE_SAVED(name) /* nothing */
259 #define SIGNALS_BLOCK(SIG, saved) /* nothing */
260 #define SIGNALS_RESTORE(saved) /* nothing */
261
262
263 #endif /* HAVE_BSD_SIGNALS */
264 #endif /* HAVE_POSIX_SIGNALS */
265
266 #if !defined (strchr)
267 extern char *strchr ();
268 #endif
269 #if !defined (strrchr)
270 extern char *strrchr ();
271 #endif
272 #ifdef __STDC__
273 #include <stddef.h>
274 extern size_t strlen (const char *s);
275 #endif /* __STDC__ */
276
277 /* End of signal handling definitions. */
278 #endif /* !_RLDEFS_H */
This page took 0.038601 seconds and 5 git commands to generate.