Merge from vendor branch NTPD:
[dragonfly.git] / contrib / texinfo / info / search.h
1 /* search.h -- Structure used to search large bodies of text, with bounds.
2    $Id: search.h,v 1.4 1998/04/19 20:50:23 karl Exp $
3
4    Copyright (C) 1993, 97, 98 Free Software Foundation, Inc.
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2, or (at your option)
9    any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20    Written by Brian Fox (bfox@ai.mit.edu). */
21
22 /* The search functions take two arguments:
23
24      1) a string to search for, and
25
26      2) a pointer to a SEARCH_BINDING which contains the buffer, start,
27         and end of the search.
28
29    They return a long, which is the offset from the start of the buffer
30    at which the match was found.  An offset of -1 indicates failure. */
31
32 #ifndef INFO_SEARCH_H
33 #define INFO_SEARCH_H
34
35 typedef struct {
36   char *buffer;                 /* The buffer of text to search. */
37   long start;                   /* Offset of the start of the search. */
38   long end;                     /* Offset of the end of the searh. */
39   int flags;                    /* Flags controlling the type of search. */
40 } SEARCH_BINDING;
41
42 #define S_FoldCase      0x01    /* Set means fold case in searches. */
43 #define S_SkipDest      0x02    /* Set means return pointing after the dest. */
44
45 SEARCH_BINDING *make_binding (), *copy_binding ();
46 extern long search_forward (), search_backward (), search ();
47 extern int looking_at ();
48
49 /* Note that STRING_IN_LINE () always returns the offset of the 1st character
50    after the string. */
51 extern int string_in_line ();
52
53 /* Function names that start with "skip" are passed a string, and return
54    an offset from the start of that string.  Function names that start
55    with "find" are passed a SEARCH_BINDING, and return an absolute position
56    marker of the item being searched for.  "Find" functions return a value
57    of -1 if the item being looked for couldn't be found. */
58 extern int skip_whitespace (), skip_non_whitespace ();
59 extern int skip_whitespace_and_newlines (), skip_line ();
60 extern int skip_node_characters (), skip_node_separator ();
61 #define DONT_SKIP_NEWLINES 0
62 #define SKIP_NEWLINES 1
63
64 extern long find_node_separator (), find_tags_table ();
65 extern long find_node_in_binding ();
66
67 #endif /* not INFO_SEARCH_H */