xref: /dragonfly/contrib/grep/src/kwset.h (revision 8af44722)
1 /* kwset.h - header declaring the keyword set library.
2    Copyright (C) 1989, 1998, 2005, 2007, 2009-2020 Free Software Foundation,
3    Inc.
4 
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3, or (at your option)
8    any later version.
9 
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software
17    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
18    02110-1301, USA.  */
19 
20 /* Written August 1989 by Mike Haertel.  */
21 
22 #include <stddef.h>
23 #include <stdbool.h>
24 
25 struct kwsmatch
26 {
27   ptrdiff_t index;			/* Index number of matching keyword.  */
28   ptrdiff_t offset[1];		/* Offset of match.  */
29   ptrdiff_t size[1];		/* Length of match.  */
30 };
31 
32 #include "arg-nonnull.h"
33 
34 struct kwset;
35 typedef struct kwset *kwset_t;
36 
37 extern kwset_t kwsalloc (char const *);
38 extern void kwsincr (kwset_t, char const *, ptrdiff_t);
39 extern ptrdiff_t kwswords (kwset_t) _GL_ATTRIBUTE_PURE;
40 extern void kwsprep (kwset_t);
41 extern ptrdiff_t kwsexec (kwset_t, char const *, ptrdiff_t,
42                           struct kwsmatch *, bool)
43   _GL_ARG_NONNULL ((4));
44 extern void kwsfree (kwset_t);
45