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. */
5 /* Copyright (C) 1987,1989 Free Software Foundation, Inc.
7 This file contains the Readline Library (the Library), a set of
8 routines for providing Emacs style line input to programs that ask
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)
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.
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. */
26 #if !defined (_RLDEFS_H)
29 #if defined (__GNUC__)
31 # define alloca __builtin_alloca
33 # if defined (sparc) || defined (HAVE_ALLOCA_H)
38 #define NEW_TTY_DRIVER
39 #define HAVE_BSD_SIGNALS
40 /* #define USE_XON_XOFF */
44 #undef HAVE_BSD_SIGNALS
47 #if defined (__linux__)
49 #endif /* __linux__ */
51 /* Some USG machines have BSD signal handling (sigblock, sigsetmask, etc.) */
52 /* CYGNUS LOCAL accept __hpux as well as hpux for HP compiler in ANSI mode. */
53 #if defined (USG) && !(defined (hpux) || defined (__hpux))
54 # undef HAVE_BSD_SIGNALS
57 /* System V machines use termio. */
58 #if !defined (_POSIX_VERSION)
59 /* CYGNUS LOCAL accept __hpux as well as hpux for HP compiler in ANSI mode. */
60 # if defined (USG) || defined (hpux) || defined (__hpux) || defined (Xenix) || defined (sgi) || defined (DGUX)
61 # undef NEW_TTY_DRIVER
62 # define TERMIO_TTY_DRIVER
67 # endif /* USG || hpux || Xenix || sgi || DUGX */
68 #endif /* !_POSIX_VERSION */
70 /* Posix systems use termios and the Posix signal functions. */
71 #if defined (_POSIX_VERSION)
72 # if !defined (TERMIOS_MISSING)
73 # undef NEW_TTY_DRIVER
74 # define TERMIOS_TTY_DRIVER
76 # endif /* !TERMIOS_MISSING */
77 # define HAVE_POSIX_SIGNALS
78 # if !defined (O_NDELAY)
79 # define O_NDELAY O_NONBLOCK /* Posix-style non-blocking i/o */
80 # endif /* O_NDELAY */
81 #endif /* _POSIX_VERSION */
83 /* System V.3 machines have the old 4.1 BSD `reliable' signal interface. */
84 #if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
86 # if !defined (HAVE_USG_SIGHOLD)
87 # define HAVE_USG_SIGHOLD
88 # endif /* !HAVE_USG_SIGHOLD */
90 #endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */
92 /* Other (BSD) machines use sgtty. */
93 #if defined (NEW_TTY_DRIVER)
97 /* Define _POSIX_VDISABLE if we are not using the `new' tty driver and
98 it is not already defined. It is used both to determine if a
99 special character is disabled and to disable certain special
100 characters. Posix systems should set to 0, USG systems to -1. */
101 #if !defined (NEW_TTY_DRIVER) && !defined (_POSIX_VDISABLE)
102 # if defined (_POSIX_VERSION)
103 # define _POSIX_VDISABLE 0
104 # else /* !_POSIX_VERSION */
105 # define _POSIX_VDISABLE -1
106 # endif /* !_POSIX_VERSION */
107 #endif /* !NEW_TTY_DRIVER && !_POSIX_VDISABLE */
110 # define D_NAMLEN(d) strlen ((d)->d_name)
113 #if !defined (SHELL) && (defined (_POSIX_VERSION) || defined (USGr3))
114 # if !defined (HAVE_DIRENT_H)
115 # define HAVE_DIRENT_H
116 # endif /* !HAVE_DIRENT_H */
117 #endif /* !SHELL && (_POSIX_VERSION || USGr3) */
119 #if defined (HAVE_DIRENT_H)
121 # if !defined (direct)
122 # define direct dirent
123 # endif /* !direct */
124 # define D_NAMLEN(d) strlen ((d)->d_name)
125 #else /* !HAVE_DIRENT_H */
126 # define D_NAMLEN(d) ((d)->d_namlen)
129 # include <sys/ndir.h>
130 # else /* !Xenix (but USG...) */
134 # include <sys/dir.h>
136 #endif /* !HAVE_DIRENT_H */
139 #if defined (USG) && defined (TIOCGWINSZ) && !defined (Linux)
140 # include <sys/stream.h>
141 # if defined (HAVE_SYS_PTEM_H)
142 # include <sys/ptem.h>
143 # endif /* HAVE_SYS_PTEM_H */
144 # if defined (HAVE_SYS_PTE_H)
145 # include <sys/pte.h>
146 # endif /* HAVE_SYS_PTE_H */
147 #endif /* USG && TIOCGWINSZ && !Linux */
149 /* Posix macro to check file in statbuf for directory-ness.
150 This requires that <sys/stat.h> be included before this test. */
151 #if defined (S_IFDIR) && !defined (S_ISDIR)
152 #define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
155 #if !defined (strchr) && !defined (__STDC__)
156 extern char *strchr (), *strrchr ();
157 #endif /* !strchr && !__STDC__ */
159 #if defined (HAVE_VARARGS_H)
160 # include <varargs.h>
161 #endif /* HAVE_VARARGS_H */
163 /* This definition is needed by readline.c, rltty.c, and signals.c. */
164 /* If on, then readline handles signals in a way that doesn't screw. */
165 #define HANDLE_SIGNALS
167 #if !defined (emacs_mode)
170 # define emacs_mode 1
173 /* Define some macros for dealing with assorted signalling disciplines.
175 These macros provide a way to use signal blocking and disabling
176 without smothering your code in a pile of #ifdef's.
178 SIGNALS_UNBLOCK; Stop blocking all signals.
181 SIGNALS_DECLARE_SAVED (name); Declare a variable to save the
182 signal blocking state.
184 SIGNALS_BLOCK (SIGSTOP, name); Block a signal, and save the previous
185 state for restoration later.
187 SIGNALS_RESTORE (name); Restore previous signals.
192 #ifdef HAVE_POSIX_SIGNALS
195 #define SIGNALS_UNBLOCK \
197 sigemptyset (&set); \
198 sigprocmask (SIG_SETMASK, &set, (sigset_t *)NULL); \
201 #define SIGNALS_DECLARE_SAVED(name) sigset_t name
203 #define SIGNALS_BLOCK(SIG, saved) \
205 sigemptyset (&set); \
206 sigaddset (&set, SIG); \
207 sigprocmask (SIG_BLOCK, &set, &saved); \
210 #define SIGNALS_RESTORE(saved) \
211 sigprocmask (SIG_SETMASK, &saved, (sigset_t *)NULL)
214 #else /* HAVE_POSIX_SIGNALS */
215 #ifdef HAVE_BSD_SIGNALS
218 #define SIGNALS_UNBLOCK sigsetmask (0)
219 #define SIGNALS_DECLARE_SAVED(name) int name
220 #define SIGNALS_BLOCK(SIG, saved) saved = sigblock (sigmask (SIG))
221 #define SIGNALS_RESTORE(saved) sigsetmask (saved)
224 #else /* HAVE_BSD_SIGNALS */
225 /* None of the Above */
227 #define SIGNALS_UNBLOCK /* nothing */
228 #define SIGNALS_DECLARE_SAVED(name) /* nothing */
229 #define SIGNALS_BLOCK(SIG, saved) /* nothing */
230 #define SIGNALS_RESTORE(saved) /* nothing */
233 #endif /* HAVE_BSD_SIGNALS */
234 #endif /* HAVE_POSIX_SIGNALS */
236 /* End of signal handling definitions. */
237 #endif /* !_RLDEFS_H */
This page took 0.033345 seconds and 4 git commands to generate.