histlib.h revision 58310
121308Sache/* histlib.h -- internal definitions for the history library. */
221308Sache/* Copyright (C) 1989, 1992 Free Software Foundation, Inc.
321308Sache
421308Sache   This file contains the GNU History Library (the Library), a set of
521308Sache   routines for managing the text of previously typed lines.
621308Sache
721308Sache   The Library is free software; you can redistribute it and/or modify
821308Sache   it under the terms of the GNU General Public License as published by
958310Sache   the Free Software Foundation; either version 2, or (at your option)
1021308Sache   any later version.
1121308Sache
1221308Sache   The Library is distributed in the hope that it will be useful, but
1321308Sache   WITHOUT ANY WARRANTY; without even the implied warranty of
1421308Sache   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1521308Sache   General Public License for more details.
1621308Sache
1721308Sache   The GNU General Public License is often shipped with GNU software, and
1821308Sache   is generally kept in a file called COPYING or LICENSE.  If you do not
1921308Sache   have a copy of the license, write to the Free Software Foundation,
2058310Sache   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
2121308Sache
2221308Sache#if !defined (_HISTLIB_H_)
2321308Sache#define _HISTLIB_H_
2421308Sache
2521308Sache/* Function pointers can be declared as (Function *)foo. */
2621308Sache#if !defined (_FUNCTION_DEF)
2721308Sache#  define _FUNCTION_DEF
2821308Sachetypedef int Function ();
2921308Sachetypedef void VFunction ();
3021308Sachetypedef char *CPFunction ();
3121308Sachetypedef char **CPPFunction ();
3221308Sache#endif /* _FUNCTION_DEF */
3321308Sache
3458310Sache#if !defined (STREQ)
3521308Sache#define STREQ(a, b)	(((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))
3658310Sache#define STREQN(a, b, n) (((n) == 0) ? (1) \
3758310Sache				    : ((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
3858310Sache#endif
3921308Sache
4021308Sache#ifndef savestring
4121308Sache#  ifndef strcpy
4221308Sacheextern char *strcpy ();
4321308Sache#  endif
4421308Sache#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
4521308Sache#endif
4621308Sache
4721308Sache#ifndef whitespace
4821308Sache#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
4921308Sache#endif
5021308Sache
5121308Sache#ifndef _rl_digit_p
5221308Sache#define _rl_digit_p(c)  ((c) >= '0' && (c) <= '9')
5321308Sache#endif
5421308Sache
5521308Sache#ifndef _rl_digit_value
5621308Sache#define _rl_digit_value(c) ((c) - '0')
5721308Sache#endif
5821308Sache
5921308Sache#ifndef member
6021308Sache#  ifndef strchr
6121308Sacheextern char *strchr ();
6221308Sache#  endif
6321308Sache#define member(c, s) ((c) ? ((char *)strchr ((s), (c)) != (char *)NULL) : 0)
6421308Sache#endif
6521308Sache
6621308Sache#ifndef FREE
6721308Sache#  define FREE(x)	if (x) free (x)
6821308Sache#endif
6921308Sache
7021308Sache/* Possible history errors passed to hist_error. */
7121308Sache#define EVENT_NOT_FOUND 0
7221308Sache#define BAD_WORD_SPEC	1
7321308Sache#define SUBST_FAILED	2
7421308Sache#define BAD_MODIFIER	3
7547558Sache#define NO_PREV_SUBST	4
7621308Sache
7721308Sache/* Possible definitions for history starting point specification. */
7821308Sache#define ANCHORED_SEARCH 1
7921308Sache#define NON_ANCHORED_SEARCH 0
8021308Sache
8121308Sache/* Possible definitions for what style of writing the history file we want. */
8221308Sache#define HISTORY_APPEND 0
8321308Sache#define HISTORY_OVERWRITE 1
8421308Sache
8558310Sache/* Some variable definitions shared across history source files. */
8658310Sacheextern int history_offset;
8758310Sache
8821308Sache#endif /* !_HISTLIB_H_ */
89