histlib.h revision 21308
1130803Smarcel/* histlib.h -- internal definitions for the history library. */
2130803Smarcel/* Copyright (C) 1989, 1992 Free Software Foundation, Inc.
3130803Smarcel
4130803Smarcel   This file contains the GNU History Library (the Library), a set of
5130803Smarcel   routines for managing the text of previously typed lines.
6130803Smarcel
7130803Smarcel   The Library is free software; you can redistribute it and/or modify
8130803Smarcel   it under the terms of the GNU General Public License as published by
9130803Smarcel   the Free Software Foundation; either version 1, or (at your option)
10130803Smarcel   any later version.
11130803Smarcel
12130803Smarcel   The Library is distributed in the hope that it will be useful, but
13130803Smarcel   WITHOUT ANY WARRANTY; without even the implied warranty of
14130803Smarcel   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15130803Smarcel   General Public License for more details.
16130803Smarcel
17130803Smarcel   The GNU General Public License is often shipped with GNU software, and
18130803Smarcel   is generally kept in a file called COPYING or LICENSE.  If you do not
19130803Smarcel   have a copy of the license, write to the Free Software Foundation,
20130803Smarcel   675 Mass Ave, Cambridge, MA 02139, USA. */
21130803Smarcel
22130803Smarcel#if !defined (_HISTLIB_H_)
23130803Smarcel#define _HISTLIB_H_
24130803Smarcel
25130803Smarcel/* Function pointers can be declared as (Function *)foo. */
26130803Smarcel#if !defined (_FUNCTION_DEF)
27130803Smarcel#  define _FUNCTION_DEF
28130803Smarceltypedef int Function ();
29130803Smarceltypedef void VFunction ();
30130803Smarceltypedef char *CPFunction ();
31130803Smarceltypedef char **CPPFunction ();
32130803Smarcel#endif /* _FUNCTION_DEF */
33130803Smarcel
34130803Smarcel#define STREQ(a, b)	(((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))
35130803Smarcel#define STREQN(a, b, n)	(((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
36130803Smarcel
37130803Smarcel#ifndef savestring
38130803Smarcel#  ifndef strcpy
39130803Smarcelextern char *strcpy ();
40130803Smarcel#  endif
41130803Smarcel#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
42130803Smarcel#endif
43130803Smarcel
44130803Smarcel#ifndef whitespace
45130803Smarcel#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
46130803Smarcel#endif
47130803Smarcel
48130803Smarcel#ifndef _rl_digit_p
49130803Smarcel#define _rl_digit_p(c)  ((c) >= '0' && (c) <= '9')
50130803Smarcel#endif
51130803Smarcel
52130803Smarcel#ifndef _rl_digit_value
53130803Smarcel#define _rl_digit_value(c) ((c) - '0')
54130803Smarcel#endif
55130803Smarcel
56130803Smarcel#ifndef member
57130803Smarcel#  ifndef strchr
58130803Smarcelextern char *strchr ();
59130803Smarcel#  endif
60130803Smarcel#define member(c, s) ((c) ? ((char *)strchr ((s), (c)) != (char *)NULL) : 0)
61130803Smarcel#endif
62130803Smarcel
63130803Smarcel#ifndef FREE
64130803Smarcel#  define FREE(x)	if (x) free (x)
65130803Smarcel#endif
66130803Smarcel
67130803Smarcel/* Possible history errors passed to hist_error. */
68130803Smarcel#define EVENT_NOT_FOUND 0
69130803Smarcel#define BAD_WORD_SPEC	1
70130803Smarcel#define SUBST_FAILED	2
71130803Smarcel#define BAD_MODIFIER	3
72130803Smarcel
73130803Smarcel/* Possible definitions for history starting point specification. */
74130803Smarcel#define ANCHORED_SEARCH 1
75130803Smarcel#define NON_ANCHORED_SEARCH 0
76130803Smarcel
77130803Smarcel/* Possible definitions for what style of writing the history file we want. */
78130803Smarcel#define HISTORY_APPEND 0
79130803Smarcel#define HISTORY_OVERWRITE 1
80130803Smarcel
81130803Smarcel#endif /* !_HISTLIB_H_ */
82130803Smarcel