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