Imported from ../bash-1.14.7.tar.gz.
[platform/upstream/bash.git] / lib / 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 (HAVE_CONFIG_H)
30 #  include "config.h"
31 #endif
32
33 #if !defined (PRAGMA_ALLOCA)
34 #  include "memalloc.h"
35 #endif
36
37 #define NEW_TTY_DRIVER
38 #define HAVE_BSD_SIGNALS
39 /* #define USE_XON_XOFF */
40
41 #if defined (__linux__) || defined (HAVE_TERMCAP_H)
42 #  include <termcap.h>
43 #endif /* __linux__ || HAVE_TERMCAP_H */
44
45 /* Some USG machines have BSD signal handling (sigblock, sigsetmask, etc.) */
46 #if defined (USG) && !defined (hpux)
47 #  undef HAVE_BSD_SIGNALS
48 #endif
49
50 /* System V machines use termio. */
51 #if !defined (_POSIX_VERSION)
52 #  if defined (USG) || defined (hpux) || defined (Xenix) || defined (sgi) || \
53       defined (DGUX) || defined (HAVE_TERMIO_H)
54 #    undef NEW_TTY_DRIVER
55 #    define TERMIO_TTY_DRIVER
56 #    include <termio.h>
57 #    if !defined (TCOON)
58 #      define TCOON 1
59 #    endif
60 #  endif /* USG || hpux || Xenix || sgi || DUGX || HAVE_TERMIO_H */
61 #endif /* !_POSIX_VERSION */
62
63 /* Posix systems use termios and the Posix signal functions. */
64 #if defined (_POSIX_VERSION)
65 #  if !defined (TERMIOS_MISSING)
66 #    undef NEW_TTY_DRIVER
67 #    define TERMIOS_TTY_DRIVER
68 #    include <termios.h>
69 #  endif /* !TERMIOS_MISSING */
70 #  define HAVE_POSIX_SIGNALS
71 #  if !defined (O_NDELAY)
72 #    define O_NDELAY O_NONBLOCK /* Posix-style non-blocking i/o */
73 #  endif /* O_NDELAY */
74 #endif /* _POSIX_VERSION */
75
76 /* System V.3 machines have the old 4.1 BSD `reliable' signal interface. */
77 #if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
78 #  if defined (USGr3) && !defined (XENIX_22)
79 #    if !defined (HAVE_USG_SIGHOLD)
80 #      define HAVE_USG_SIGHOLD
81 #    endif /* !HAVE_USG_SIGHOLD */
82 #  endif /* USGr3 && !XENIX_22 */
83 #endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */
84
85 /* Other (BSD) machines use sgtty. */
86 #if defined (NEW_TTY_DRIVER)
87 #  include <sgtty.h>
88 #endif
89
90 #if !defined (SHELL) && (defined (_POSIX_VERSION) || defined (USGr3))
91 #  if !defined (HAVE_DIRENT_H)
92 #    define HAVE_DIRENT_H
93 #  endif /* !HAVE_DIRENT_H */
94 #endif /* !SHELL && (_POSIX_VERSION || USGr3) */
95
96 #if defined (HAVE_DIRENT_H)
97 #  include <dirent.h>
98 #  define D_NAMLEN(d) strlen ((d)->d_name)
99 #else /* !HAVE_DIRENT_H */
100 #  define D_NAMLEN(d) ((d)->d_namlen)
101 #  if defined (USG)
102 #    if defined (Xenix)
103 #      include <sys/ndir.h>
104 #    else /* !Xenix (but USG...) */
105 #      include "ndir.h"
106 #    endif /* !Xenix */
107 #  else /* !USG */
108 #    include <sys/dir.h>
109 #  endif /* !USG */
110 #  if !defined (dirent)
111 #    define dirent direct
112 #  endif /* !dirent */
113 #endif /* !HAVE_DIRENT_H */
114
115 #if defined (USG) && defined (TIOCGWINSZ) && !defined (Linux)
116 #  if defined (HAVE_SYS_STREAM_H)
117 #    include <sys/stream.h>
118 #  endif /* HAVE_SYS_STREAM_H */
119 #  if defined (HAVE_SYS_PTEM_H)
120 #    include <sys/ptem.h>
121 #  endif /* HAVE_SYS_PTEM_H */
122 #  if defined (HAVE_SYS_PTE_H)
123 #    include <sys/pte.h>
124 #  endif /* HAVE_SYS_PTE_H */
125 #endif /* USG && TIOCGWINSZ && !Linux */
126
127 /* Posix macro to check file in statbuf for directory-ness.
128    This requires that <sys/stat.h> be included before this test. */
129 #if defined (S_IFDIR) && !defined (S_ISDIR)
130 #  define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
131 #endif
132
133 /* Decide which flavor of the header file describing the C library
134    string functions to include and include it. */
135
136 #if defined (USG) || defined (NeXT)
137 #  if !defined (HAVE_STRING_H)
138 #    define HAVE_STRING_H
139 #  endif /* !HAVE_STRING_H */
140 #endif /* USG || NeXT */
141
142 #if defined (HAVE_STRING_H)
143 #  include <string.h>
144 #else /* !HAVE_STRING_H */
145 #  include <strings.h>
146 #endif /* !HAVE_STRING_H */
147
148 #if !defined (strchr) && !defined (__STDC__)
149 extern char *strchr (), *strrchr ();
150 #endif /* !strchr && !__STDC__ */
151
152 #if defined (HAVE_VARARGS_H)
153 #  include <varargs.h>
154 #endif /* HAVE_VARARGS_H */
155
156 /* This is needed to include support for TIOCGWINSZ and window resizing. */
157 #if defined (OSF1) || defined (BSD386) || defined (NetBSD) || \
158     defined (__BSD_4_4__) || defined (FreeBSD) || defined (_386BSD) || \
159     defined (AIX)
160 #  define GWINSZ_IN_SYS_IOCTL
161 #endif
162
163 /* Define _POSIX_VDISABLE if we are not using the `new' tty driver and
164    it is not already defined.  It is used both to determine if a
165    special character is disabled and to disable certain special
166    characters.  Posix systems should set to 0, USG systems to -1. */
167 #if !defined (NEW_TTY_DRIVER) && !defined (_POSIX_VDISABLE)
168 #  if defined (_SVR4_VDISABLE)
169 #    define _POSIX_VDISABLE _SVR4_VDISABLE
170 #  else
171 #    if defined (_POSIX_VERSION)
172 #      define _POSIX_VDISABLE 0
173 #    else /* !_POSIX_VERSION */
174 #      define _POSIX_VDISABLE -1
175 #    endif /* !_POSIX_VERSION */
176 #  endif /* !_SVR4_VDISABLE */
177 #endif /* !NEW_TTY_DRIVER && !_POSIX_VDISABLE */
178
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 */