xref: /dflybsd-src/contrib/gdb-7/readline/histlib.h (revision 16003dcfd2baa152f5dd24794ec9f36e139eaeb8)
1*6b445a62SJohn Marino /* histlib.h -- internal definitions for the history library. */
2*6b445a62SJohn Marino 
3*6b445a62SJohn Marino /* Copyright (C) 1989-2009 Free Software Foundation, Inc.
4*6b445a62SJohn Marino 
5*6b445a62SJohn Marino    This file contains the GNU History Library (History), a set of
6*6b445a62SJohn Marino    routines for managing the text of previously typed lines.
7*6b445a62SJohn Marino 
8*6b445a62SJohn Marino    History is free software: you can redistribute it and/or modify
9*6b445a62SJohn Marino    it under the terms of the GNU General Public License as published by
10*6b445a62SJohn Marino    the Free Software Foundation, either version 3 of the License, or
11*6b445a62SJohn Marino    (at your option) any later version.
12*6b445a62SJohn Marino 
13*6b445a62SJohn Marino    History is distributed in the hope that it will be useful,
14*6b445a62SJohn Marino    but WITHOUT ANY WARRANTY; without even the implied warranty of
15*6b445a62SJohn Marino    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16*6b445a62SJohn Marino    GNU General Public License for more details.
17*6b445a62SJohn Marino 
18*6b445a62SJohn Marino    You should have received a copy of the GNU General Public License
19*6b445a62SJohn Marino    along with History.  If not, see <http://www.gnu.org/licenses/>.
20*6b445a62SJohn Marino */
21*6b445a62SJohn Marino 
22*6b445a62SJohn Marino #if !defined (_HISTLIB_H_)
23*6b445a62SJohn Marino #define _HISTLIB_H_
24*6b445a62SJohn Marino 
25*6b445a62SJohn Marino #if defined (HAVE_STRING_H)
26*6b445a62SJohn Marino #  include <string.h>
27*6b445a62SJohn Marino #else
28*6b445a62SJohn Marino #  include <strings.h>
29*6b445a62SJohn Marino #endif /* !HAVE_STRING_H */
30*6b445a62SJohn Marino 
31*6b445a62SJohn Marino #if !defined (STREQ)
32*6b445a62SJohn Marino #define STREQ(a, b)	(((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))
33*6b445a62SJohn Marino #define STREQN(a, b, n) (((n) == 0) ? (1) \
34*6b445a62SJohn Marino 				    : ((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
35*6b445a62SJohn Marino #endif
36*6b445a62SJohn Marino 
37*6b445a62SJohn Marino #ifndef savestring
38*6b445a62SJohn Marino #define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
39*6b445a62SJohn Marino #endif
40*6b445a62SJohn Marino 
41*6b445a62SJohn Marino #ifndef whitespace
42*6b445a62SJohn Marino #define whitespace(c) (((c) == ' ') || ((c) == '\t'))
43*6b445a62SJohn Marino #endif
44*6b445a62SJohn Marino 
45*6b445a62SJohn Marino #ifndef _rl_digit_p
46*6b445a62SJohn Marino #define _rl_digit_p(c)  ((c) >= '0' && (c) <= '9')
47*6b445a62SJohn Marino #endif
48*6b445a62SJohn Marino 
49*6b445a62SJohn Marino #ifndef _rl_digit_value
50*6b445a62SJohn Marino #define _rl_digit_value(c) ((c) - '0')
51*6b445a62SJohn Marino #endif
52*6b445a62SJohn Marino 
53*6b445a62SJohn Marino #ifndef member
54*6b445a62SJohn Marino #  ifndef strchr
55*6b445a62SJohn Marino extern char *strchr ();
56*6b445a62SJohn Marino #  endif
57*6b445a62SJohn Marino #define member(c, s) ((c) ? ((char *)strchr ((s), (c)) != (char *)NULL) : 0)
58*6b445a62SJohn Marino #endif
59*6b445a62SJohn Marino 
60*6b445a62SJohn Marino #ifndef FREE
61*6b445a62SJohn Marino #  define FREE(x)	if (x) free (x)
62*6b445a62SJohn Marino #endif
63*6b445a62SJohn Marino 
64*6b445a62SJohn Marino /* Possible history errors passed to hist_error. */
65*6b445a62SJohn Marino #define EVENT_NOT_FOUND 0
66*6b445a62SJohn Marino #define BAD_WORD_SPEC	1
67*6b445a62SJohn Marino #define SUBST_FAILED	2
68*6b445a62SJohn Marino #define BAD_MODIFIER	3
69*6b445a62SJohn Marino #define NO_PREV_SUBST	4
70*6b445a62SJohn Marino 
71*6b445a62SJohn Marino /* Possible definitions for history starting point specification. */
72*6b445a62SJohn Marino #define ANCHORED_SEARCH 1
73*6b445a62SJohn Marino #define NON_ANCHORED_SEARCH 0
74*6b445a62SJohn Marino 
75*6b445a62SJohn Marino /* Possible definitions for what style of writing the history file we want. */
76*6b445a62SJohn Marino #define HISTORY_APPEND 0
77*6b445a62SJohn Marino #define HISTORY_OVERWRITE 1
78*6b445a62SJohn Marino 
79*6b445a62SJohn Marino /* Some variable definitions shared across history source files. */
80*6b445a62SJohn Marino extern int history_offset;
81*6b445a62SJohn Marino 
82*6b445a62SJohn Marino #endif /* !_HISTLIB_H_ */
83