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-2009 Free Software Foundation, Inc.
7 This file is part of the GNU Readline Library (Readline), a library
8 for reading lines of text with interactive input and history editing.
10 Readline is free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
15 Readline is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with Readline. If not, see <http://www.gnu.org/licenses/>.
24 #if !defined (_RLDEFS_H_)
27 #if defined (HAVE_CONFIG_H)
33 #if defined (STRCOLL_BROKEN)
37 #if defined (_POSIX_VERSION) && !defined (TERMIOS_MISSING)
38 # define TERMIOS_TTY_DRIVER
40 # if defined (HAVE_TERMIO_H)
41 # define TERMIO_TTY_DRIVER
43 # if !defined (__MINGW32__)
44 # define NEW_TTY_DRIVER
46 # define NO_TTY_DRIVER
51 /* Posix macro to check file in statbuf for directory-ness.
52 This requires that <sys/stat.h> be included before this test. */
53 #if defined (S_IFDIR) && !defined (S_ISDIR)
54 # define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
57 /* Decide which flavor of the header file describing the C library
58 string functions to include and include it. */
60 #if defined (HAVE_STRING_H)
62 #else /* !HAVE_STRING_H */
64 #endif /* !HAVE_STRING_H */
66 #if !defined (strchr) && !defined (__STDC__)
67 extern char *strchr (), *strrchr ();
68 #endif /* !strchr && !__STDC__ */
70 #if defined (PREFER_STDARG)
73 # if defined (PREFER_VARARGS)
78 #if defined (HAVE_STRCASECMP)
79 #define _rl_stricmp strcasecmp
80 #define _rl_strnicmp strncasecmp
82 extern int _rl_stricmp PARAMS((char *, char *));
83 extern int _rl_strnicmp PARAMS((char *, char *, int));
86 #if defined (HAVE_STRPBRK) && !defined (HAVE_MULTIBYTE)
87 # define _rl_strpbrk(a,b) strpbrk((a),(b))
89 extern char *_rl_strpbrk PARAMS((const char *, const char *));
92 #if !defined (emacs_mode)
98 #if !defined (RL_IM_INSERT)
99 # define RL_IM_INSERT 1
100 # define RL_IM_OVERWRITE 0
102 # define RL_IM_DEFAULT RL_IM_INSERT
105 /* If you cast map[key].function to type (Keymap) on a Cray,
106 the compiler takes the value of map[key].function and
107 divides it by 4 to convert between pointer types (pointers
108 to functions and pointers to structs are different sizes).
109 This is not what is wanted. */
111 # define FUNCTION_TO_KEYMAP(map, key) (Keymap)((int)map[key].function)
112 # define KEYMAP_TO_FUNCTION(data) (rl_command_func_t *)((int)(data))
114 # define FUNCTION_TO_KEYMAP(map, key) (Keymap)(map[key].function)
115 # define KEYMAP_TO_FUNCTION(data) (rl_command_func_t *)(data)
119 #define savestring(x) strcpy ((char *)xmalloc (1 + strlen (x)), (x))
122 /* Possible values for _rl_bell_preference. */
124 #define AUDIBLE_BELL 1
125 #define VISIBLE_BELL 2
127 /* Definitions used when searching the line for characters. */
128 /* NOTE: it is necessary that opposite directions are inverses */
129 #define FTO 1 /* forward to */
130 #define BTO -1 /* backward to */
131 #define FFIND 2 /* forward find */
132 #define BFIND -2 /* backward find */
134 /* Possible values for the found_quote flags word used by the completion
135 functions. It says what kind of (shell-like) quoting we found anywhere
137 #define RL_QF_SINGLE_QUOTE 0x01
138 #define RL_QF_DOUBLE_QUOTE 0x02
139 #define RL_QF_BACKSLASH 0x04
140 #define RL_QF_OTHER_QUOTE 0x08
142 /* Default readline line buffer length. */
143 #define DEFAULT_BUFFER_SIZE 256
146 #define STREQ(a, b) (((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))
147 #define STREQN(a, b, n) (((n) == 0) ? (1) \
148 : ((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
152 # define FREE(x) if (x) free (x)
156 # define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
159 /* CONFIGURATION SECTION */
162 #endif /* !_RLDEFS_H_ */