home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 2 / RISC_DISC_2.iso / pd_share / utilities / cli / gnuinfo / Source / h / search < prev    next >
Encoding:
Text File  |  1994-08-20  |  2.9 KB  |  81 lines

  1. /* search.h -- Structure used to search large bodies of text, with bounds. */
  2.  
  3. /* This file is part of GNU Info, a program for reading online documentation
  4.    stored in Info format.
  5.  
  6.    Copyright (C) 1993 Free Software Foundation, Inc.
  7.  
  8.    This program is free software; you can redistribute it and/or modify
  9.    it under the terms of the GNU General Public License as published by
  10.    the Free Software Foundation; either version 2, or (at your option)
  11.    any later version.
  12.  
  13.    This program is distributed in the hope that it will be useful,
  14.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.    GNU General Public License for more details.
  17.  
  18.    You should have received a copy of the GNU General Public License
  19.    along with this program; if not, write to the Free Software
  20.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  
  22.    Written by Brian Fox (bfox@ai.mit.edu). */
  23.  
  24. /* The search functions take two arguments:
  25.  
  26.      1) a string to search for, and
  27.  
  28.      2) a pointer to a SEARCH_BINDING which contains the buffer, start,
  29.         and end of the search.
  30.  
  31.    They return a long, which is the offset from the start of the buffer
  32.    at which the match was found.  An offset of -1 indicates failure. */
  33.  
  34. #if !defined (_SEARCH_H_)
  35. #define _SEARCH_H_
  36.  
  37. typedef struct {
  38.   char *buffer;            /* The buffer of text to search. */
  39.   long start;            /* Offset of the start of the search. */
  40.   long end;            /* Offset of the end of the searh. */
  41.   int flags;            /* Flags controlling the type of search. */
  42. } SEARCH_BINDING;
  43.  
  44. #define S_FoldCase    0x01    /* Set means fold case in searches. */
  45. #define S_SkipDest    0x02    /* Set means return pointing after the dest. */
  46.  
  47. SEARCH_BINDING *make_binding (), *copy_binding ();
  48. extern long search_forward (), search_backward (), search ();
  49. extern int looking_at ();
  50.  
  51. /* Note that STRING_IN_LINE () always returns the offset of the 1st character
  52.    after the string. */
  53. extern int string_in_line ();
  54.  
  55. #if 0
  56. /* Unix doesn't have stricmp () functions. */
  57. /* strcmp (), but caseless. */
  58. extern int stricmp (char *,char *);
  59.  
  60. /* Compare at most COUNT characters from STRING1 to STRING2.  Case
  61.    doesn't matter. */
  62. extern int strnicmp (char *,char *, int);
  63. #endif
  64.  
  65. /* Function names that start with "skip" are passed a string, and return
  66.    an offset from the start of that string.  Function names that start
  67.    with "find" are passed a SEARCH_BINDING, and return an absolute position
  68.    marker of the item being searched for.  "Find" functions return a value
  69.    of -1 if the item being looked for couldn't be found. */
  70. extern int skip_whitespace (), skip_non_whitespace ();
  71. extern int skip_whitespace_and_newlines (), skip_line ();
  72. extern int skip_node_characters (), skip_node_separator ();
  73. #define DONT_SKIP_NEWLINES 0
  74. #define SKIP_NEWLINES 1
  75.  
  76. extern long find_node_separator (), find_tags_table ();
  77. extern long find_node_in_binding ();
  78.  
  79. #endif /* !_SEARCH_H_ */
  80.  
  81.