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)
39 #define NEW_TTY_DRIVER
40 #define HAVE_BSD_SIGNALS
41 /* #define USE_XON_XOFF */
43 #if defined(__MSDOS__) || defined(_WIN32)
47 #undef HAVE_BSD_SIGNALS
51 #if defined (__linux__)
53 #endif /* __linux__ */
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
61 #define ScreenCols() 80
62 #define ScreenRows() 24
63 #define ScreenSetCursor() abort();
64 #define ScreenGetCursor() abort();
66 /* System V machines use termio. */
67 #if !defined (_POSIX_VERSION)
68 /* CYGNUS LOCAL accept __hpux as well as hpux for HP compiler in ANSI mode.
69 Add __osf__ to list of machines to force use of termio.h */
70 # if defined (USG) || defined (hpux) || defined (__hpux) || defined (Xenix) || defined (sgi) || defined (DGUX) || defined (__osf__)
71 # undef NEW_TTY_DRIVER
72 # define TERMIO_TTY_DRIVER
77 # endif /* USG || hpux || Xenix || sgi || DUGX || __osf__ */
78 #endif /* !_POSIX_VERSION */
80 /* Posix systems use termios and the Posix signal functions. */
81 #if defined (_POSIX_VERSION)
82 # if !defined (TERMIOS_MISSING)
83 # undef NEW_TTY_DRIVER
84 # define TERMIOS_TTY_DRIVER
86 # endif /* !TERMIOS_MISSING */
87 # define HAVE_POSIX_SIGNALS
88 # if !defined (O_NDELAY)
89 # define O_NDELAY O_NONBLOCK /* Posix-style non-blocking i/o */
90 # endif /* O_NDELAY */
91 #endif /* _POSIX_VERSION */
93 /* System V.3 machines have the old 4.1 BSD `reliable' signal interface. */
94 #if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
96 # if !defined (HAVE_USG_SIGHOLD)
97 # define HAVE_USG_SIGHOLD
98 # endif /* !HAVE_USG_SIGHOLD */
100 #endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */
102 /* Other (BSD) machines use sgtty. */
103 #if defined (NEW_TTY_DRIVER)
107 /* Define _POSIX_VDISABLE if we are not using the `new' tty driver and
108 it is not already defined. It is used both to determine if a
109 special character is disabled and to disable certain special
110 characters. Posix systems should set to 0, USG systems to -1. */
111 #if !defined (NEW_TTY_DRIVER) && !defined (_POSIX_VDISABLE)
112 # if defined (_POSIX_VERSION)
113 # define _POSIX_VDISABLE 0
114 # else /* !_POSIX_VERSION */
115 # define _POSIX_VDISABLE -1
116 # endif /* !_POSIX_VERSION */
117 #endif /* !NEW_TTY_DRIVER && !_POSIX_VDISABLE */
120 # define D_NAMLEN(d) strlen ((d)->d_name)
123 #if !defined (SHELL) && (defined (_POSIX_VERSION) || defined (USGr3))
124 # if !defined (HAVE_DIRENT_H)
125 # define HAVE_DIRENT_H
126 # endif /* !HAVE_DIRENT_H */
127 #endif /* !SHELL && (_POSIX_VERSION || USGr3) */
129 #if defined (HAVE_DIRENT_H)
131 # if !defined (direct)
132 # define direct dirent
133 # endif /* !direct */
134 # define D_NAMLEN(d) strlen ((d)->d_name)
135 #else /* !HAVE_DIRENT_H */
136 # define D_NAMLEN(d) ((d)->d_namlen)
139 # include <sys/ndir.h>
140 # else /* !Xenix (but USG...) */
144 # include <sys/dir.h>
146 #endif /* !HAVE_DIRENT_H */
149 #if defined (USG) && defined (TIOCGWINSZ) && !defined (Linux)
151 /* AIX 4.x seems to reference struct uio within a prototype
152 in stream.h, but doesn't cause the uio include file to
154 # include <sys/uio.h>
156 # include <sys/stream.h>
157 # if defined (HAVE_SYS_PTEM_H)
158 # include <sys/ptem.h>
159 # endif /* HAVE_SYS_PTEM_H */
160 # if defined (HAVE_SYS_PTE_H)
161 # include <sys/pte.h>
162 # endif /* HAVE_SYS_PTE_H */
163 #endif /* USG && TIOCGWINSZ && !Linux */
165 /* Posix macro to check file in statbuf for directory-ness.
166 This requires that <sys/stat.h> be included before this test. */
167 #if defined (S_IFDIR) && !defined (S_ISDIR)
168 #define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
170 /* Posix macro to check file in statbuf for file-ness.
171 This requires that <sys/stat.h> be included before this test. */
172 #if defined (S_IFREG) && !defined (S_ISREG)
173 #define S_ISREG(m) (((m)&S_IFMT) == S_IFREG)
176 #if !defined (strchr) && !defined (__STDC__)
177 extern char *strchr (), *strrchr ();
178 #endif /* !strchr && !__STDC__ */
180 #if defined (HAVE_VARARGS_H)
181 # include <varargs.h>
182 #endif /* HAVE_VARARGS_H */
184 /* This definition is needed by readline.c, rltty.c, and signals.c. */
185 /* If on, then readline handles signals in a way that doesn't screw. */
186 #define HANDLE_SIGNALS
188 #if defined(_WIN32) || defined(__MSDOS__)
189 #undef HANDLE_SIGNALS
193 #if !defined (emacs_mode)
196 # define emacs_mode 1
199 /* Define some macros for dealing with assorted signalling disciplines.
201 These macros provide a way to use signal blocking and disabling
202 without smothering your code in a pile of #ifdef's.
204 SIGNALS_UNBLOCK; Stop blocking all signals.
207 SIGNALS_DECLARE_SAVED (name); Declare a variable to save the
208 signal blocking state.
210 SIGNALS_BLOCK (SIGSTOP, name); Block a signal, and save the previous
211 state for restoration later.
213 SIGNALS_RESTORE (name); Restore previous signals.
218 #ifdef HAVE_POSIX_SIGNALS
221 #define SIGNALS_UNBLOCK \
223 sigemptyset (&set); \
224 sigprocmask (SIG_SETMASK, &set, (sigset_t *)NULL); \
227 #define SIGNALS_DECLARE_SAVED(name) sigset_t name
229 #define SIGNALS_BLOCK(SIG, saved) \
231 sigemptyset (&set); \
232 sigaddset (&set, SIG); \
233 sigprocmask (SIG_BLOCK, &set, &saved); \
236 #define SIGNALS_RESTORE(saved) \
237 sigprocmask (SIG_SETMASK, &saved, (sigset_t *)NULL)
240 #else /* HAVE_POSIX_SIGNALS */
241 #ifdef HAVE_BSD_SIGNALS
244 #define SIGNALS_UNBLOCK sigsetmask (0)
245 #define SIGNALS_DECLARE_SAVED(name) int name
246 #define SIGNALS_BLOCK(SIG, saved) saved = sigblock (sigmask (SIG))
247 #define SIGNALS_RESTORE(saved) sigsetmask (saved)
250 #else /* HAVE_BSD_SIGNALS */
251 /* None of the Above */
253 #define SIGNALS_UNBLOCK /* nothing */
254 #define SIGNALS_DECLARE_SAVED(name) /* nothing */
255 #define SIGNALS_BLOCK(SIG, saved) /* nothing */
256 #define SIGNALS_RESTORE(saved) /* nothing */
259 #endif /* HAVE_BSD_SIGNALS */
260 #endif /* HAVE_POSIX_SIGNALS */
262 #if !defined (strchr)
263 extern char *strchr ();
265 #if !defined (strrchr)
266 extern char *strrchr ();
270 extern size_t strlen (const char *s
);
271 #endif /* __STDC__ */
273 /* End of signal handling definitions. */
274 #endif /* !_RLDEFS_H */
This page took 0.033697 seconds and 4 git commands to generate.