]> git.ipfire.org Git - thirdparty/bash.git/blame - lib/readline/rldefs.h
Bash-5.2 patch 26: fix typo when specifying readline's custom color prefix
[thirdparty/bash.git] / lib / readline / rldefs.h
CommitLineData
726f6388
JA
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
74091dd4 5/* Copyright (C) 1987-2021 Free Software Foundation, Inc.
726f6388 6
3185942a
JA
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.
726f6388 9
3185942a 10 Readline is free software: you can redistribute it and/or modify
726f6388 11 it under the terms of the GNU General Public License as published by
3185942a
JA
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
726f6388 14
3185942a
JA
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.
726f6388 19
3185942a
JA
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/>.
22*/
726f6388 23
ccc6cda3
JA
24#if !defined (_RLDEFS_H_)
25#define _RLDEFS_H_
726f6388
JA
26
27#if defined (HAVE_CONFIG_H)
28# include "config.h"
29#endif
30
28ef6c31
JA
31#include "rlstdc.h"
32
3185942a
JA
33#if defined (STRCOLL_BROKEN)
34# undef HAVE_STRCOLL
35#endif
36
ccc6cda3
JA
37#if defined (_POSIX_VERSION) && !defined (TERMIOS_MISSING)
38# define TERMIOS_TTY_DRIVER
39#else
40# if defined (HAVE_TERMIO_H)
726f6388 41# define TERMIO_TTY_DRIVER
ccc6cda3 42# else
95732b49
JA
43# if !defined (__MINGW32__)
44# define NEW_TTY_DRIVER
45# else
46# define NO_TTY_DRIVER
47# endif
ccc6cda3 48# endif
726f6388
JA
49#endif
50
726f6388
JA
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)
55#endif
56
57/* Decide which flavor of the header file describing the C library
58 string functions to include and include it. */
59
726f6388
JA
60#if defined (HAVE_STRING_H)
61# include <string.h>
62#else /* !HAVE_STRING_H */
63# include <strings.h>
64#endif /* !HAVE_STRING_H */
65
66#if !defined (strchr) && !defined (__STDC__)
67extern char *strchr (), *strrchr ();
68#endif /* !strchr && !__STDC__ */
69
ccc6cda3
JA
70#if defined (PREFER_STDARG)
71# include <stdarg.h>
72#else
73# if defined (PREFER_VARARGS)
74# include <varargs.h>
75# endif
726f6388
JA
76#endif
77
ccc6cda3
JA
78#if defined (HAVE_STRCASECMP)
79#define _rl_stricmp strcasecmp
80#define _rl_strnicmp strncasecmp
81#else
74091dd4
CR
82extern int _rl_stricmp (const char *, const char *);
83extern int _rl_strnicmp (const char *, const char *, int);
f73dda09
JA
84#endif
85
b80f6443 86#if defined (HAVE_STRPBRK) && !defined (HAVE_MULTIBYTE)
f73dda09
JA
87# define _rl_strpbrk(a,b) strpbrk((a),(b))
88#else
74091dd4 89extern char *_rl_strpbrk (const char *, const char *);
ccc6cda3 90#endif
726f6388
JA
91
92#if !defined (emacs_mode)
93# define no_mode -1
94# define vi_mode 0
95# define emacs_mode 1
96#endif
97
7117c2d2
JA
98#if !defined (RL_IM_INSERT)
99# define RL_IM_INSERT 1
100# define RL_IM_OVERWRITE 0
101#
102# define RL_IM_DEFAULT RL_IM_INSERT
103#endif
104
726f6388
JA
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. */
110#if defined (CRAY)
111# define FUNCTION_TO_KEYMAP(map, key) (Keymap)((int)map[key].function)
28ef6c31 112# define KEYMAP_TO_FUNCTION(data) (rl_command_func_t *)((int)(data))
726f6388
JA
113#else
114# define FUNCTION_TO_KEYMAP(map, key) (Keymap)(map[key].function)
28ef6c31 115# define KEYMAP_TO_FUNCTION(data) (rl_command_func_t *)(data)
726f6388
JA
116#endif
117
118#ifndef savestring
f73dda09 119#define savestring(x) strcpy ((char *)xmalloc (1 + strlen (x)), (x))
726f6388
JA
120#endif
121
122/* Possible values for _rl_bell_preference. */
123#define NO_BELL 0
124#define AUDIBLE_BELL 1
125#define VISIBLE_BELL 2
126
ccc6cda3
JA
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 */
133
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
136 in the line. */
7117c2d2
JA
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
ccc6cda3
JA
141
142/* Default readline line buffer length. */
143#define DEFAULT_BUFFER_SIZE 256
144
145#if !defined (STREQ)
146#define STREQ(a, b) (((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))
bb70624e
JA
147#define STREQN(a, b, n) (((n) == 0) ? (1) \
148 : ((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
ccc6cda3
JA
149#endif
150
ac50fbac
CR
151#if !defined (RL_STRLEN)
152# define RL_STRLEN(s) (((s) && (s)[0]) ? ((s)[1] ? ((s)[2] ? strlen(s) : 2) : 1) : 0)
153#endif
154
ccc6cda3
JA
155#if !defined (FREE)
156# define FREE(x) if (x) free (x)
157#endif
158
7117c2d2
JA
159#if !defined (SWAP)
160# define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
161#endif
162
726f6388
JA
163/* CONFIGURATION SECTION */
164#include "rlconf.h"
165
ccc6cda3 166#endif /* !_RLDEFS_H_ */