VirtualBox

source: kBuild/vendor/grep/2.12/src/kwset.h@ 3576

Last change on this file since 3576 was 2595, checked in by bird, 13 years ago

gnu grep version 2.12 (grep-2.12.tar.xz, md5sum=8d2f0346d08b13c18afb81f0e8aa1e2f)

  • Property svn:eol-style set to native
File size: 2.5 KB
Line 
1/* kwset.h - header declaring the keyword set library.
2 Copyright (C) 1989, 1998, 2005, 2007, 2009-2012 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 The author may be reached (Email) at the address [email protected],
22 or (US mail) as Mike Haertel c/o Free Software Foundation. */
23
24struct kwsmatch
25{
26 size_t index; /* Index number of matching keyword. */
27 size_t offset[1]; /* Offset of each submatch. */
28 size_t size[1]; /* Length of each submatch. */
29};
30
31#include "arg-nonnull.h"
32
33struct kwset;
34typedef struct kwset *kwset_t;
35
36/* Return an opaque pointer to a newly allocated keyword set, or NULL
37 if enough memory cannot be obtained. The argument if non-NULL
38 specifies a table of character translations to be applied to all
39 pattern and search text. */
40extern kwset_t kwsalloc (char const *);
41
42/* Incrementally extend the keyword set to include the given string.
43 Return NULL for success, or an error message. Remember an index
44 number for each keyword included in the set. */
45extern const char *kwsincr (kwset_t, char const *, size_t);
46
47/* When the keyword set has been completely built, prepare it for
48 use. Return NULL for success, or an error message. */
49extern const char *kwsprep (kwset_t);
50
51/* Search through the given buffer for a member of the keyword set.
52 Return a pointer to the leftmost longest match found, or NULL if
53 no match is found. If foundlen is non-NULL, store the length of
54 the matching substring in the integer it points to. Similarly,
55 if foundindex is non-NULL, store the index of the particular
56 keyword found therein. */
57extern size_t kwsexec (kwset_t, char const *, size_t, struct kwsmatch *)
58 _GL_ARG_NONNULL ((4));
59
60/* Deallocate the given keyword set and all its associated storage. */
61extern void kwsfree (kwset_t);
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette