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