10a40d7919b9c90e1d61e7349f3db7c143d181e6
[platform/upstream/bash.git] / lib / readline / histlib.h
1 /* histlib.h -- internal definitions for the history library. */
2 /* Copyright (C) 1989, 1992 Free Software Foundation, Inc.
3
4    This file contains the GNU History Library (the Library), a set of
5    routines for managing the text of previously typed lines.
6
7    The Library is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 1, or (at your option)
10    any later version.
11
12    The Library is distributed in the hope that it will be useful, but
13    WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    General Public License for more details.
16
17    The GNU General Public License is often shipped with GNU software, and
18    is generally kept in a file called COPYING or LICENSE.  If you do not
19    have a copy of the license, write to the Free Software Foundation,
20    675 Mass Ave, Cambridge, MA 02139, USA. */
21
22 #if !defined (_HISTLIB_H_)
23 #define _HISTLIB_H_
24
25 /* Function pointers can be declared as (Function *)foo. */
26 #if !defined (_FUNCTION_DEF)
27 #  define _FUNCTION_DEF
28 typedef int Function ();
29 typedef void VFunction ();
30 typedef char *CPFunction ();
31 typedef char **CPPFunction ();
32 #endif /* _FUNCTION_DEF */
33
34 #define STREQ(a, b)     (((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))
35 #define STREQN(a, b, n) (((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
36
37 #ifndef savestring
38 #  ifndef strcpy
39 extern char *strcpy ();
40 #  endif
41 #define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
42 #endif
43
44 #ifndef whitespace
45 #define whitespace(c) (((c) == ' ') || ((c) == '\t'))
46 #endif
47
48 #ifndef _rl_digit_p
49 #define _rl_digit_p(c)  ((c) >= '0' && (c) <= '9')
50 #endif
51
52 #ifndef _rl_digit_value
53 #define _rl_digit_value(c) ((c) - '0')
54 #endif
55
56 #ifndef member
57 #  ifndef strchr
58 extern char *strchr ();
59 #  endif
60 #define member(c, s) ((c) ? ((char *)strchr ((s), (c)) != (char *)NULL) : 0)
61 #endif
62
63 #ifndef FREE
64 #  define FREE(x)       if (x) free (x)
65 #endif
66
67 /* Possible history errors passed to hist_error. */
68 #define EVENT_NOT_FOUND 0
69 #define BAD_WORD_SPEC   1
70 #define SUBST_FAILED    2
71 #define BAD_MODIFIER    3
72
73 /* Possible definitions for history starting point specification. */
74 #define ANCHORED_SEARCH 1
75 #define NON_ANCHORED_SEARCH 0
76
77 /* Possible definitions for what style of writing the history file we want. */
78 #define HISTORY_APPEND 0
79 #define HISTORY_OVERWRITE 1
80
81 #endif /* !_HISTLIB_H_ */