]>
Commit | Line | Data |
---|---|---|
d60d9f65 SS |
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 | |
1b17e766 | 13 | the Free Software Foundation; either version 2, or (at your option) |
d60d9f65 SS |
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, | |
1b17e766 | 24 | 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ |
d60d9f65 SS |
25 | |
26 | #if !defined (_RLDEFS_H_) | |
27 | #define _RLDEFS_H_ | |
28 | ||
29 | #if defined (HAVE_CONFIG_H) | |
30 | # include "config.h" | |
31 | #endif | |
32 | ||
9255ee31 EZ |
33 | #include "rlstdc.h" |
34 | ||
d60d9f65 SS |
35 | #if defined (_POSIX_VERSION) && !defined (TERMIOS_MISSING) |
36 | # define TERMIOS_TTY_DRIVER | |
37 | #else | |
38 | # if defined (HAVE_TERMIO_H) | |
39 | # define TERMIO_TTY_DRIVER | |
40 | # else | |
41 | # define NEW_TTY_DRIVER | |
42 | # endif | |
43 | #endif | |
44 | ||
45 | /* Posix macro to check file in statbuf for directory-ness. | |
46 | This requires that <sys/stat.h> be included before this test. */ | |
47 | #if defined (S_IFDIR) && !defined (S_ISDIR) | |
48 | # define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) | |
49 | #endif | |
50 | ||
51 | /* Decide which flavor of the header file describing the C library | |
52 | string functions to include and include it. */ | |
53 | ||
54 | #if defined (HAVE_STRING_H) | |
55 | # include <string.h> | |
56 | #else /* !HAVE_STRING_H */ | |
57 | # include <strings.h> | |
58 | #endif /* !HAVE_STRING_H */ | |
59 | ||
60 | #if !defined (strchr) && !defined (__STDC__) | |
61 | extern char *strchr (), *strrchr (); | |
62 | #endif /* !strchr && !__STDC__ */ | |
63 | ||
64 | #if defined (PREFER_STDARG) | |
65 | # include <stdarg.h> | |
66 | #else | |
67 | # if defined (PREFER_VARARGS) | |
68 | # include <varargs.h> | |
69 | # endif | |
70 | #endif | |
71 | ||
72 | #if defined (HAVE_STRCASECMP) | |
73 | #define _rl_stricmp strcasecmp | |
74 | #define _rl_strnicmp strncasecmp | |
75 | #else | |
9255ee31 EZ |
76 | extern int _rl_stricmp PARAMS((char *, char *)); |
77 | extern int _rl_strnicmp PARAMS((char *, char *, int)); | |
78 | #endif | |
79 | ||
80 | #if defined (HAVE_STRPBRK) | |
81 | # define _rl_strpbrk(a,b) strpbrk((a),(b)) | |
82 | #else | |
83 | extern char *_rl_strpbrk PARAMS((const char *, const char *)); | |
d60d9f65 SS |
84 | #endif |
85 | ||
86 | #if !defined (emacs_mode) | |
87 | # define no_mode -1 | |
88 | # define vi_mode 0 | |
89 | # define emacs_mode 1 | |
90 | #endif | |
91 | ||
9255ee31 EZ |
92 | #if !defined (RL_IM_INSERT) |
93 | # define RL_IM_INSERT 1 | |
94 | # define RL_IM_OVERWRITE 0 | |
95 | # | |
96 | # define RL_IM_DEFAULT RL_IM_INSERT | |
97 | #endif | |
98 | ||
d60d9f65 SS |
99 | /* If you cast map[key].function to type (Keymap) on a Cray, |
100 | the compiler takes the value of map[key].function and | |
101 | divides it by 4 to convert between pointer types (pointers | |
102 | to functions and pointers to structs are different sizes). | |
103 | This is not what is wanted. */ | |
104 | #if defined (CRAY) | |
105 | # define FUNCTION_TO_KEYMAP(map, key) (Keymap)((int)map[key].function) | |
9255ee31 | 106 | # define KEYMAP_TO_FUNCTION(data) (rl_command_func_t *)((int)(data)) |
d60d9f65 SS |
107 | #else |
108 | # define FUNCTION_TO_KEYMAP(map, key) (Keymap)(map[key].function) | |
9255ee31 | 109 | # define KEYMAP_TO_FUNCTION(data) (rl_command_func_t *)(data) |
d60d9f65 SS |
110 | #endif |
111 | ||
112 | #ifndef savestring | |
9255ee31 | 113 | #define savestring(x) strcpy ((char *)xmalloc (1 + strlen (x)), (x)) |
d60d9f65 SS |
114 | #endif |
115 | ||
116 | /* Possible values for _rl_bell_preference. */ | |
117 | #define NO_BELL 0 | |
118 | #define AUDIBLE_BELL 1 | |
119 | #define VISIBLE_BELL 2 | |
120 | ||
121 | /* Definitions used when searching the line for characters. */ | |
122 | /* NOTE: it is necessary that opposite directions are inverses */ | |
123 | #define FTO 1 /* forward to */ | |
124 | #define BTO -1 /* backward to */ | |
125 | #define FFIND 2 /* forward find */ | |
126 | #define BFIND -2 /* backward find */ | |
127 | ||
128 | /* Possible values for the found_quote flags word used by the completion | |
129 | functions. It says what kind of (shell-like) quoting we found anywhere | |
130 | in the line. */ | |
9255ee31 EZ |
131 | #define RL_QF_SINGLE_QUOTE 0x01 |
132 | #define RL_QF_DOUBLE_QUOTE 0x02 | |
133 | #define RL_QF_BACKSLASH 0x04 | |
134 | #define RL_QF_OTHER_QUOTE 0x08 | |
d60d9f65 SS |
135 | |
136 | /* Default readline line buffer length. */ | |
137 | #define DEFAULT_BUFFER_SIZE 256 | |
138 | ||
139 | #if !defined (STREQ) | |
140 | #define STREQ(a, b) (((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0)) | |
1b17e766 EZ |
141 | #define STREQN(a, b, n) (((n) == 0) ? (1) \ |
142 | : ((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0)) | |
d60d9f65 SS |
143 | #endif |
144 | ||
145 | #if !defined (FREE) | |
146 | # define FREE(x) if (x) free (x) | |
147 | #endif | |
148 | ||
9255ee31 EZ |
149 | #if !defined (SWAP) |
150 | # define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0) | |
151 | #endif | |
152 | ||
d60d9f65 SS |
153 | /* CONFIGURATION SECTION */ |
154 | #include "rlconf.h" | |
155 | ||
156 | #endif /* !_RLDEFS_H_ */ |