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 | ||
33 | #if defined (_POSIX_VERSION) && !defined (TERMIOS_MISSING) | |
34 | # define TERMIOS_TTY_DRIVER | |
35 | #else | |
36 | # if defined (HAVE_TERMIO_H) | |
37 | # define TERMIO_TTY_DRIVER | |
38 | # else | |
39 | # define NEW_TTY_DRIVER | |
40 | # endif | |
41 | #endif | |
42 | ||
43 | /* Posix macro to check file in statbuf for directory-ness. | |
44 | This requires that <sys/stat.h> be included before this test. */ | |
45 | #if defined (S_IFDIR) && !defined (S_ISDIR) | |
46 | # define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) | |
47 | #endif | |
48 | ||
49 | /* Decide which flavor of the header file describing the C library | |
50 | string functions to include and include it. */ | |
51 | ||
52 | #if defined (HAVE_STRING_H) | |
53 | # include <string.h> | |
54 | #else /* !HAVE_STRING_H */ | |
55 | # include <strings.h> | |
56 | #endif /* !HAVE_STRING_H */ | |
57 | ||
58 | #if !defined (strchr) && !defined (__STDC__) | |
59 | extern char *strchr (), *strrchr (); | |
60 | #endif /* !strchr && !__STDC__ */ | |
61 | ||
62 | #if defined (PREFER_STDARG) | |
63 | # include <stdarg.h> | |
64 | #else | |
65 | # if defined (PREFER_VARARGS) | |
66 | # include <varargs.h> | |
67 | # endif | |
68 | #endif | |
69 | ||
70 | #if defined (HAVE_STRCASECMP) | |
71 | #define _rl_stricmp strcasecmp | |
72 | #define _rl_strnicmp strncasecmp | |
73 | #else | |
74 | extern int _rl_stricmp (), _rl_strnicmp (); | |
75 | #endif | |
76 | ||
77 | #if !defined (emacs_mode) | |
78 | # define no_mode -1 | |
79 | # define vi_mode 0 | |
80 | # define emacs_mode 1 | |
81 | #endif | |
82 | ||
83 | /* If you cast map[key].function to type (Keymap) on a Cray, | |
84 | the compiler takes the value of map[key].function and | |
85 | divides it by 4 to convert between pointer types (pointers | |
86 | to functions and pointers to structs are different sizes). | |
87 | This is not what is wanted. */ | |
88 | #if defined (CRAY) | |
89 | # define FUNCTION_TO_KEYMAP(map, key) (Keymap)((int)map[key].function) | |
90 | # define KEYMAP_TO_FUNCTION(data) (Function *)((int)(data)) | |
91 | #else | |
92 | # define FUNCTION_TO_KEYMAP(map, key) (Keymap)(map[key].function) | |
93 | # define KEYMAP_TO_FUNCTION(data) (Function *)(data) | |
94 | #endif | |
95 | ||
96 | #ifndef savestring | |
97 | extern char *xmalloc (); | |
98 | #define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x)) | |
99 | #endif | |
100 | ||
101 | /* Possible values for _rl_bell_preference. */ | |
102 | #define NO_BELL 0 | |
103 | #define AUDIBLE_BELL 1 | |
104 | #define VISIBLE_BELL 2 | |
105 | ||
106 | /* Definitions used when searching the line for characters. */ | |
107 | /* NOTE: it is necessary that opposite directions are inverses */ | |
108 | #define FTO 1 /* forward to */ | |
109 | #define BTO -1 /* backward to */ | |
110 | #define FFIND 2 /* forward find */ | |
111 | #define BFIND -2 /* backward find */ | |
112 | ||
113 | /* Possible values for the found_quote flags word used by the completion | |
114 | functions. It says what kind of (shell-like) quoting we found anywhere | |
115 | in the line. */ | |
116 | #define RL_QF_SINGLE_QUOTE 0x1 | |
117 | #define RL_QF_DOUBLE_QUOTE 0x2 | |
118 | #define RL_QF_BACKSLASH 0x4 | |
119 | ||
120 | /* Default readline line buffer length. */ | |
121 | #define DEFAULT_BUFFER_SIZE 256 | |
122 | ||
123 | #if !defined (STREQ) | |
124 | #define STREQ(a, b) (((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0)) | |
1b17e766 EZ |
125 | #define STREQN(a, b, n) (((n) == 0) ? (1) \ |
126 | : ((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0)) | |
d60d9f65 SS |
127 | #endif |
128 | ||
129 | #if !defined (FREE) | |
130 | # define FREE(x) if (x) free (x) | |
131 | #endif | |
132 | ||
133 | /* CONFIGURATION SECTION */ | |
134 | #include "rlconf.h" | |
135 | ||
136 | #endif /* !_RLDEFS_H_ */ |