home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / OS2 / gnuinfo.zip / info / search.h < prev    next >
C/C++ Source or Header  |  1997-07-15  |  3KB  |  76 lines

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