xref: /netbsd/external/gpl2/xcvs/dist/lib/regex.h (revision a7c91847)
1*a7c91847Schristos /* Definitions for data structures and routines for the regular
2*a7c91847Schristos    expression library.
3*a7c91847Schristos    Copyright (C) 1985,1989-93,1995-98,2000,2001,2002,2003,2005
4*a7c91847Schristos    Free Software Foundation, Inc.
5*a7c91847Schristos    This file is part of the GNU C Library.
6*a7c91847Schristos 
7*a7c91847Schristos    This program is free software; you can redistribute it and/or modify
8*a7c91847Schristos    it under the terms of the GNU General Public License as published by
9*a7c91847Schristos    the Free Software Foundation; either version 2, or (at your option)
10*a7c91847Schristos    any later version.
11*a7c91847Schristos 
12*a7c91847Schristos    This program is distributed in the hope that it will be useful,
13*a7c91847Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
14*a7c91847Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*a7c91847Schristos    GNU General Public License for more details.
16*a7c91847Schristos 
17*a7c91847Schristos    You should have received a copy of the GNU General Public License along
18*a7c91847Schristos    with this program; if not, write to the Free Software Foundation,
19*a7c91847Schristos    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
20*a7c91847Schristos 
21*a7c91847Schristos #ifndef _REGEX_H
22*a7c91847Schristos #define _REGEX_H 1
23*a7c91847Schristos 
24*a7c91847Schristos #include <sys/types.h>
25*a7c91847Schristos 
26*a7c91847Schristos /* Allow the use in C++ code.  */
27*a7c91847Schristos #ifdef __cplusplus
28*a7c91847Schristos extern "C" {
29*a7c91847Schristos #endif
30*a7c91847Schristos 
31*a7c91847Schristos /* Define _REGEX_SOURCE to get definitions that are incompatible with
32*a7c91847Schristos    POSIX.  */
33*a7c91847Schristos #if (!defined _REGEX_SOURCE					\
34*a7c91847Schristos      && (defined _GNU_SOURCE					\
35*a7c91847Schristos 	 || (!defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE	\
36*a7c91847Schristos 	     && !defined _XOPEN_SOURCE)))
37*a7c91847Schristos # define _REGEX_SOURCE 1
38*a7c91847Schristos #endif
39*a7c91847Schristos 
40*a7c91847Schristos #if defined _REGEX_SOURCE && defined VMS
41*a7c91847Schristos /* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it
42*a7c91847Schristos    should be there.  */
43*a7c91847Schristos # include <stddef.h>
44*a7c91847Schristos #endif
45*a7c91847Schristos 
46*a7c91847Schristos #ifdef _REGEX_LARGE_OFFSETS
47*a7c91847Schristos 
48*a7c91847Schristos /* Use types and values that are wide enough to represent signed and
49*a7c91847Schristos    unsigned byte offsets in memory.  This currently works only when
50*a7c91847Schristos    the regex code is used outside of the GNU C library; it is not yet
51*a7c91847Schristos    supported within glibc itself, and glibc users should not define
52*a7c91847Schristos    _REGEX_LARGE_OFFSETS.  */
53*a7c91847Schristos 
54*a7c91847Schristos /* The type of the offset of a byte within a string.
55*a7c91847Schristos    For historical reasons POSIX 1003.1-2004 requires that regoff_t be
56*a7c91847Schristos    at least as wide as off_t.  This is a bit odd (and many common
57*a7c91847Schristos    POSIX platforms set it to the more-sensible ssize_t) but we might
58*a7c91847Schristos    as well conform.  We don't know of any hosts where ssize_t is wider
59*a7c91847Schristos    than off_t, so off_t is safe.  */
60*a7c91847Schristos typedef off_t regoff_t;
61*a7c91847Schristos 
62*a7c91847Schristos /* The type of nonnegative object indexes.  Traditionally, GNU regex
63*a7c91847Schristos    uses 'int' for these.  Code that uses __re_idx_t should work
64*a7c91847Schristos    regardless of whether the type is signed.  */
65*a7c91847Schristos typedef size_t __re_idx_t;
66*a7c91847Schristos 
67*a7c91847Schristos /* The type of object sizes.  */
68*a7c91847Schristos typedef size_t __re_size_t;
69*a7c91847Schristos 
70*a7c91847Schristos /* The type of object sizes, in places where the traditional code
71*a7c91847Schristos    uses unsigned long int.  */
72*a7c91847Schristos typedef size_t __re_long_size_t;
73*a7c91847Schristos 
74*a7c91847Schristos #else
75*a7c91847Schristos 
76*a7c91847Schristos /* Use types that are binary-compatible with the traditional GNU regex
77*a7c91847Schristos    implementation, which mishandles strings longer than INT_MAX.  */
78*a7c91847Schristos 
79*a7c91847Schristos typedef int regoff_t;
80*a7c91847Schristos typedef int __re_idx_t;
81*a7c91847Schristos typedef unsigned int __re_size_t;
82*a7c91847Schristos typedef unsigned long int __re_long_size_t;
83*a7c91847Schristos 
84*a7c91847Schristos #endif
85*a7c91847Schristos 
86*a7c91847Schristos /* The following two types have to be signed and unsigned integer type
87*a7c91847Schristos    wide enough to hold a value of a pointer.  For most ANSI compilers
88*a7c91847Schristos    ptrdiff_t and size_t should be likely OK.  Still size of these two
89*a7c91847Schristos    types is 2 for Microsoft C.  Ugh... */
90*a7c91847Schristos typedef long int s_reg_t;
91*a7c91847Schristos typedef unsigned long int active_reg_t;
92*a7c91847Schristos 
93*a7c91847Schristos /* The following bits are used to determine the regexp syntax we
94*a7c91847Schristos    recognize.  The set/not-set meanings are chosen so that Emacs syntax
95*a7c91847Schristos    remains the value 0.  The bits are given in alphabetical order, and
96*a7c91847Schristos    the definitions shifted by one from the previous bit; thus, when we
97*a7c91847Schristos    add or remove a bit, only one other definition need change.  */
98*a7c91847Schristos typedef unsigned long int reg_syntax_t;
99*a7c91847Schristos 
100*a7c91847Schristos /* If this bit is not set, then \ inside a bracket expression is literal.
101*a7c91847Schristos    If set, then such a \ quotes the following character.  */
102*a7c91847Schristos #define REG_BACKSLASH_ESCAPE_IN_LISTS 1ul
103*a7c91847Schristos 
104*a7c91847Schristos /* If this bit is not set, then + and ? are operators, and \+ and \? are
105*a7c91847Schristos      literals.
106*a7c91847Schristos    If set, then \+ and \? are operators and + and ? are literals.  */
107*a7c91847Schristos #define REG_BK_PLUS_QM (1ul << 1)
108*a7c91847Schristos 
109*a7c91847Schristos /* If this bit is set, then character classes are supported.  They are:
110*a7c91847Schristos      [:alpha:], [:upper:], [:lower:],  [:digit:], [:alnum:], [:xdigit:],
111*a7c91847Schristos      [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
112*a7c91847Schristos    If not set, then character classes are not supported.  */
113*a7c91847Schristos #define REG_CHAR_CLASSES (1ul << 2)
114*a7c91847Schristos 
115*a7c91847Schristos /* If this bit is set, then ^ and $ are always anchors (outside bracket
116*a7c91847Schristos      expressions, of course).
117*a7c91847Schristos    If this bit is not set, then it depends:
118*a7c91847Schristos         ^  is an anchor if it is at the beginning of a regular
119*a7c91847Schristos            expression or after an open-group or an alternation operator;
120*a7c91847Schristos         $  is an anchor if it is at the end of a regular expression, or
121*a7c91847Schristos            before a close-group or an alternation operator.
122*a7c91847Schristos 
123*a7c91847Schristos    This bit could be (re)combined with REG_CONTEXT_INDEP_OPS, because
124*a7c91847Schristos    POSIX draft 11.2 says that * etc. in leading positions is undefined.
125*a7c91847Schristos    We already implemented a previous draft which made those constructs
126*a7c91847Schristos    invalid, though, so we haven't changed the code back.  */
127*a7c91847Schristos #define REG_CONTEXT_INDEP_ANCHORS (1ul << 3)
128*a7c91847Schristos 
129*a7c91847Schristos /* If this bit is set, then special characters are always special
130*a7c91847Schristos      regardless of where they are in the pattern.
131*a7c91847Schristos    If this bit is not set, then special characters are special only in
132*a7c91847Schristos      some contexts; otherwise they are ordinary.  Specifically,
133*a7c91847Schristos      * + ? and intervals are only special when not after the beginning,
134*a7c91847Schristos      open-group, or alternation operator.  */
135*a7c91847Schristos #define REG_CONTEXT_INDEP_OPS (1ul << 4)
136*a7c91847Schristos 
137*a7c91847Schristos /* If this bit is set, then *, +, ?, and { cannot be first in an re or
138*a7c91847Schristos      immediately after an alternation or begin-group operator.  */
139*a7c91847Schristos #define REG_CONTEXT_INVALID_OPS (1ul << 5)
140*a7c91847Schristos 
141*a7c91847Schristos /* If this bit is set, then . matches newline.
142*a7c91847Schristos    If not set, then it doesn't.  */
143*a7c91847Schristos #define REG_DOT_NEWLINE (1ul << 6)
144*a7c91847Schristos 
145*a7c91847Schristos /* If this bit is set, then . doesn't match NUL.
146*a7c91847Schristos    If not set, then it does.  */
147*a7c91847Schristos #define REG_DOT_NOT_NULL (1ul << 7)
148*a7c91847Schristos 
149*a7c91847Schristos /* If this bit is set, nonmatching lists [^...] do not match newline.
150*a7c91847Schristos    If not set, they do.  */
151*a7c91847Schristos #define REG_HAT_LISTS_NOT_NEWLINE (1ul << 8)
152*a7c91847Schristos 
153*a7c91847Schristos /* If this bit is set, either \{...\} or {...} defines an
154*a7c91847Schristos      interval, depending on REG_NO_BK_BRACES.
155*a7c91847Schristos    If not set, \{, \}, {, and } are literals.  */
156*a7c91847Schristos #define REG_INTERVALS (1ul << 9)
157*a7c91847Schristos 
158*a7c91847Schristos /* If this bit is set, +, ? and | aren't recognized as operators.
159*a7c91847Schristos    If not set, they are.  */
160*a7c91847Schristos #define REG_LIMITED_OPS (1ul << 10)
161*a7c91847Schristos 
162*a7c91847Schristos /* If this bit is set, newline is an alternation operator.
163*a7c91847Schristos    If not set, newline is literal.  */
164*a7c91847Schristos #define REG_NEWLINE_ALT (1ul << 11)
165*a7c91847Schristos 
166*a7c91847Schristos /* If this bit is set, then `{...}' defines an interval, and \{ and \}
167*a7c91847Schristos      are literals.
168*a7c91847Schristos   If not set, then `\{...\}' defines an interval.  */
169*a7c91847Schristos #define REG_NO_BK_BRACES (1ul << 12)
170*a7c91847Schristos 
171*a7c91847Schristos /* If this bit is set, (...) defines a group, and \( and \) are literals.
172*a7c91847Schristos    If not set, \(...\) defines a group, and ( and ) are literals.  */
173*a7c91847Schristos #define REG_NO_BK_PARENS (1ul << 13)
174*a7c91847Schristos 
175*a7c91847Schristos /* If this bit is set, then \<digit> matches <digit>.
176*a7c91847Schristos    If not set, then \<digit> is a back-reference.  */
177*a7c91847Schristos #define REG_NO_BK_REFS (1ul << 14)
178*a7c91847Schristos 
179*a7c91847Schristos /* If this bit is set, then | is an alternation operator, and \| is literal.
180*a7c91847Schristos    If not set, then \| is an alternation operator, and | is literal.  */
181*a7c91847Schristos #define REG_NO_BK_VBAR (1ul << 15)
182*a7c91847Schristos 
183*a7c91847Schristos /* If this bit is set, then an ending range point collating higher
184*a7c91847Schristos      than the starting range point, as in [z-a], is invalid.
185*a7c91847Schristos    If not set, the containing range is empty and does not match any string.  */
186*a7c91847Schristos #define REG_NO_EMPTY_RANGES (1ul << 16)
187*a7c91847Schristos 
188*a7c91847Schristos /* If this bit is set, then an unmatched ) is ordinary.
189*a7c91847Schristos    If not set, then an unmatched ) is invalid.  */
190*a7c91847Schristos #define REG_UNMATCHED_RIGHT_PAREN_ORD (1ul << 17)
191*a7c91847Schristos 
192*a7c91847Schristos /* If this bit is set, succeed as soon as we match the whole pattern,
193*a7c91847Schristos    without further backtracking.  */
194*a7c91847Schristos #define REG_NO_POSIX_BACKTRACKING (1ul << 18)
195*a7c91847Schristos 
196*a7c91847Schristos /* If this bit is set, do not process the GNU regex operators.
197*a7c91847Schristos    If not set, then the GNU regex operators are recognized. */
198*a7c91847Schristos #define REG_NO_GNU_OPS (1ul << 19)
199*a7c91847Schristos 
200*a7c91847Schristos /* If this bit is set, turn on internal regex debugging.
201*a7c91847Schristos    If not set, and debugging was on, turn it off.
202*a7c91847Schristos    This only works if regex.c is compiled -DDEBUG.
203*a7c91847Schristos    We define this bit always, so that all that's needed to turn on
204*a7c91847Schristos    debugging is to recompile regex.c; the calling code can always have
205*a7c91847Schristos    this bit set, and it won't affect anything in the normal case. */
206*a7c91847Schristos #define REG_DEBUG (1ul << 20)
207*a7c91847Schristos 
208*a7c91847Schristos /* If this bit is set, a syntactically invalid interval is treated as
209*a7c91847Schristos    a string of ordinary characters.  For example, the ERE 'a{1' is
210*a7c91847Schristos    treated as 'a\{1'.  */
211*a7c91847Schristos #define REG_INVALID_INTERVAL_ORD (1ul << 21)
212*a7c91847Schristos 
213*a7c91847Schristos /* If this bit is set, then ignore case when matching.
214*a7c91847Schristos    If not set, then case is significant.  */
215*a7c91847Schristos #define REG_IGNORE_CASE (1ul << 22)
216*a7c91847Schristos 
217*a7c91847Schristos /* This bit is used internally like REG_CONTEXT_INDEP_ANCHORS but only
218*a7c91847Schristos    for ^, because it is difficult to scan the regex backwards to find
219*a7c91847Schristos    whether ^ should be special.  */
220*a7c91847Schristos #define REG_CARET_ANCHORS_HERE (1ul << 23)
221*a7c91847Schristos 
222*a7c91847Schristos /* If this bit is set, then \{ cannot be first in an bre or
223*a7c91847Schristos    immediately after an alternation or begin-group operator.  */
224*a7c91847Schristos #define REG_CONTEXT_INVALID_DUP (1ul << 24)
225*a7c91847Schristos 
226*a7c91847Schristos /* If this bit is set, then no_sub will be set to 1 during
227*a7c91847Schristos    re_compile_pattern.  */
228*a7c91847Schristos #define REG_NO_SUB (1ul << 25)
229*a7c91847Schristos 
230*a7c91847Schristos /* This global variable defines the particular regexp syntax to use (for
231*a7c91847Schristos    some interfaces).  When a regexp is compiled, the syntax used is
232*a7c91847Schristos    stored in the pattern buffer, so changing this does not affect
233*a7c91847Schristos    already-compiled regexps.  */
234*a7c91847Schristos extern reg_syntax_t re_syntax_options;
235*a7c91847Schristos 
236*a7c91847Schristos /* Define combinations of the above bits for the standard possibilities.
237*a7c91847Schristos    (The [[[ comments delimit what gets put into the Texinfo file, so
238*a7c91847Schristos    don't delete them!)  */
239*a7c91847Schristos /* [[[begin syntaxes]]] */
240*a7c91847Schristos #define REG_SYNTAX_EMACS 0
241*a7c91847Schristos 
242*a7c91847Schristos #define REG_SYNTAX_AWK							\
243*a7c91847Schristos   (REG_BACKSLASH_ESCAPE_IN_LISTS   | REG_DOT_NOT_NULL			\
244*a7c91847Schristos    | REG_NO_BK_PARENS		   | REG_NO_BK_REFS			\
245*a7c91847Schristos    | REG_NO_BK_VBAR		   | REG_NO_EMPTY_RANGES		\
246*a7c91847Schristos    | REG_DOT_NEWLINE		   | REG_CONTEXT_INDEP_ANCHORS		\
247*a7c91847Schristos    | REG_UNMATCHED_RIGHT_PAREN_ORD | REG_NO_GNU_OPS)
248*a7c91847Schristos 
249*a7c91847Schristos #define REG_SYNTAX_GNU_AWK						\
250*a7c91847Schristos   ((REG_SYNTAX_POSIX_EXTENDED | REG_BACKSLASH_ESCAPE_IN_LISTS		\
251*a7c91847Schristos     | REG_DEBUG)							\
252*a7c91847Schristos    & ~(REG_DOT_NOT_NULL | REG_INTERVALS | REG_CONTEXT_INDEP_OPS		\
253*a7c91847Schristos        | REG_CONTEXT_INVALID_OPS ))
254*a7c91847Schristos 
255*a7c91847Schristos #define REG_SYNTAX_POSIX_AWK						\
256*a7c91847Schristos   (REG_SYNTAX_POSIX_EXTENDED | REG_BACKSLASH_ESCAPE_IN_LISTS		\
257*a7c91847Schristos    | REG_INTERVALS	     | REG_NO_GNU_OPS)
258*a7c91847Schristos 
259*a7c91847Schristos #define REG_SYNTAX_GREP							\
260*a7c91847Schristos   (REG_BK_PLUS_QM	       | REG_CHAR_CLASSES			\
261*a7c91847Schristos    | REG_HAT_LISTS_NOT_NEWLINE | REG_INTERVALS				\
262*a7c91847Schristos    | REG_NEWLINE_ALT)
263*a7c91847Schristos 
264*a7c91847Schristos #define REG_SYNTAX_EGREP						\
265*a7c91847Schristos   (REG_CHAR_CLASSES	   | REG_CONTEXT_INDEP_ANCHORS			\
266*a7c91847Schristos    | REG_CONTEXT_INDEP_OPS | REG_HAT_LISTS_NOT_NEWLINE			\
267*a7c91847Schristos    | REG_NEWLINE_ALT	   | REG_NO_BK_PARENS				\
268*a7c91847Schristos    | REG_NO_BK_VBAR)
269*a7c91847Schristos 
270*a7c91847Schristos #define REG_SYNTAX_POSIX_EGREP						\
271*a7c91847Schristos   (REG_SYNTAX_EGREP | REG_INTERVALS | REG_NO_BK_BRACES			\
272*a7c91847Schristos    | REG_INVALID_INTERVAL_ORD)
273*a7c91847Schristos 
274*a7c91847Schristos /* P1003.2/D11.2, section 4.20.7.1, lines 5078ff.  */
275*a7c91847Schristos #define REG_SYNTAX_ED REG_SYNTAX_POSIX_BASIC
276*a7c91847Schristos 
277*a7c91847Schristos #define REG_SYNTAX_SED REG_SYNTAX_POSIX_BASIC
278*a7c91847Schristos 
279*a7c91847Schristos /* Syntax bits common to both basic and extended POSIX regex syntax.  */
280*a7c91847Schristos #define _REG_SYNTAX_POSIX_COMMON					\
281*a7c91847Schristos   (REG_CHAR_CLASSES | REG_DOT_NEWLINE	 | REG_DOT_NOT_NULL		\
282*a7c91847Schristos    | REG_INTERVALS  | REG_NO_EMPTY_RANGES)
283*a7c91847Schristos 
284*a7c91847Schristos #define REG_SYNTAX_POSIX_BASIC						\
285*a7c91847Schristos   (_REG_SYNTAX_POSIX_COMMON | REG_BK_PLUS_QM | REG_CONTEXT_INVALID_DUP)
286*a7c91847Schristos 
287*a7c91847Schristos /* Differs from ..._POSIX_BASIC only in that REG_BK_PLUS_QM becomes
288*a7c91847Schristos    REG_LIMITED_OPS, i.e., \? \+ \| are not recognized.  Actually, this
289*a7c91847Schristos    isn't minimal, since other operators, such as \`, aren't disabled.  */
290*a7c91847Schristos #define REG_SYNTAX_POSIX_MINIMAL_BASIC					\
291*a7c91847Schristos   (_REG_SYNTAX_POSIX_COMMON | REG_LIMITED_OPS)
292*a7c91847Schristos 
293*a7c91847Schristos #define REG_SYNTAX_POSIX_EXTENDED					\
294*a7c91847Schristos   (_REG_SYNTAX_POSIX_COMMON  | REG_CONTEXT_INDEP_ANCHORS		\
295*a7c91847Schristos    | REG_CONTEXT_INDEP_OPS   | REG_NO_BK_BRACES				\
296*a7c91847Schristos    | REG_NO_BK_PARENS	     | REG_NO_BK_VBAR				\
297*a7c91847Schristos    | REG_CONTEXT_INVALID_OPS | REG_UNMATCHED_RIGHT_PAREN_ORD)
298*a7c91847Schristos 
299*a7c91847Schristos /* Differs from ..._POSIX_EXTENDED in that REG_CONTEXT_INDEP_OPS is
300*a7c91847Schristos    removed and REG_NO_BK_REFS is added.  */
301*a7c91847Schristos #define REG_SYNTAX_POSIX_MINIMAL_EXTENDED				\
302*a7c91847Schristos   (_REG_SYNTAX_POSIX_COMMON  | REG_CONTEXT_INDEP_ANCHORS		\
303*a7c91847Schristos    | REG_CONTEXT_INVALID_OPS | REG_NO_BK_BRACES				\
304*a7c91847Schristos    | REG_NO_BK_PARENS	     | REG_NO_BK_REFS				\
305*a7c91847Schristos    | REG_NO_BK_VBAR	     | REG_UNMATCHED_RIGHT_PAREN_ORD)
306*a7c91847Schristos /* [[[end syntaxes]]] */
307*a7c91847Schristos 
308*a7c91847Schristos /* Maximum number of duplicates an interval can allow.  This is
309*a7c91847Schristos    distinct from RE_DUP_MAX, to conform to POSIX name space rules and
310*a7c91847Schristos    to avoid collisions with <limits.h>.  */
311*a7c91847Schristos #define REG_DUP_MAX 32767
312*a7c91847Schristos 
313*a7c91847Schristos 
314*a7c91847Schristos /* POSIX `cflags' bits (i.e., information for `regcomp').  */
315*a7c91847Schristos 
316*a7c91847Schristos /* If this bit is set, then use extended regular expression syntax.
317*a7c91847Schristos    If not set, then use basic regular expression syntax.  */
318*a7c91847Schristos #define REG_EXTENDED 1
319*a7c91847Schristos 
320*a7c91847Schristos /* If this bit is set, then ignore case when matching.
321*a7c91847Schristos    If not set, then case is significant.  */
322*a7c91847Schristos #define REG_ICASE (1 << 1)
323*a7c91847Schristos 
324*a7c91847Schristos /* If this bit is set, then anchors do not match at newline
325*a7c91847Schristos      characters in the string.
326*a7c91847Schristos    If not set, then anchors do match at newlines.  */
327*a7c91847Schristos #define REG_NEWLINE (1 << 2)
328*a7c91847Schristos 
329*a7c91847Schristos /* If this bit is set, then report only success or fail in regexec.
330*a7c91847Schristos    If not set, then returns differ between not matching and errors.  */
331*a7c91847Schristos #define REG_NOSUB (1 << 3)
332*a7c91847Schristos 
333*a7c91847Schristos 
334*a7c91847Schristos /* POSIX `eflags' bits (i.e., information for regexec).  */
335*a7c91847Schristos 
336*a7c91847Schristos /* If this bit is set, then the beginning-of-line operator doesn't match
337*a7c91847Schristos      the beginning of the string (presumably because it's not the
338*a7c91847Schristos      beginning of a line).
339*a7c91847Schristos    If not set, then the beginning-of-line operator does match the
340*a7c91847Schristos      beginning of the string.  */
341*a7c91847Schristos #define REG_NOTBOL 1
342*a7c91847Schristos 
343*a7c91847Schristos /* Like REG_NOTBOL, except for the end-of-line.  */
344*a7c91847Schristos #define REG_NOTEOL (1 << 1)
345*a7c91847Schristos 
346*a7c91847Schristos /* Use PMATCH[0] to delimit the start and end of the search in the
347*a7c91847Schristos    buffer.  */
348*a7c91847Schristos #define REG_STARTEND (1 << 2)
349*a7c91847Schristos 
350*a7c91847Schristos 
351*a7c91847Schristos /* If any error codes are removed, changed, or added, update the
352*a7c91847Schristos    `__re_error_msgid' table in regcomp.c.  */
353*a7c91847Schristos 
354*a7c91847Schristos typedef enum
355*a7c91847Schristos {
356*a7c91847Schristos   _REG_ENOSYS = -1,	/* This will never happen for this implementation.  */
357*a7c91847Schristos #define REG_ENOSYS	_REG_ENOSYS
358*a7c91847Schristos 
359*a7c91847Schristos   _REG_NOERROR,		/* Success.  */
360*a7c91847Schristos #define REG_NOERROR	_REG_NOERROR
361*a7c91847Schristos 
362*a7c91847Schristos   _REG_NOMATCH,		/* Didn't find a match (for regexec).  */
363*a7c91847Schristos #define REG_NOMATCH	_REG_NOMATCH
364*a7c91847Schristos 
365*a7c91847Schristos   /* POSIX regcomp return error codes.  (In the order listed in the
366*a7c91847Schristos      standard.)  */
367*a7c91847Schristos 
368*a7c91847Schristos   _REG_BADPAT,		/* Invalid pattern.  */
369*a7c91847Schristos #define REG_BADPAT	_REG_BADPAT
370*a7c91847Schristos 
371*a7c91847Schristos   _REG_ECOLLATE,	/* Inalid collating element.  */
372*a7c91847Schristos #define REG_ECOLLATE	_REG_ECOLLATE
373*a7c91847Schristos 
374*a7c91847Schristos   _REG_ECTYPE,		/* Invalid character class name.  */
375*a7c91847Schristos #define REG_ECTYPE	_REG_ECTYPE
376*a7c91847Schristos 
377*a7c91847Schristos   _REG_EESCAPE,		/* Trailing backslash.  */
378*a7c91847Schristos #define REG_EESCAPE	_REG_EESCAPE
379*a7c91847Schristos 
380*a7c91847Schristos   _REG_ESUBREG,		/* Invalid back reference.  */
381*a7c91847Schristos #define REG_ESUBREG	_REG_ESUBREG
382*a7c91847Schristos 
383*a7c91847Schristos   _REG_EBRACK,		/* Unmatched left bracket.  */
384*a7c91847Schristos #define REG_EBRACK	_REG_EBRACK
385*a7c91847Schristos 
386*a7c91847Schristos   _REG_EPAREN,		/* Parenthesis imbalance.  */
387*a7c91847Schristos #define REG_EPAREN	_REG_EPAREN
388*a7c91847Schristos 
389*a7c91847Schristos   _REG_EBRACE,		/* Unmatched \{.  */
390*a7c91847Schristos #define REG_EBRACE	_REG_EBRACE
391*a7c91847Schristos 
392*a7c91847Schristos   _REG_BADBR,		/* Invalid contents of \{\}.  */
393*a7c91847Schristos #define REG_BADBR	_REG_BADBR
394*a7c91847Schristos 
395*a7c91847Schristos   _REG_ERANGE,		/* Invalid range end.  */
396*a7c91847Schristos #define REG_ERANGE	_REG_ERANGE
397*a7c91847Schristos 
398*a7c91847Schristos   _REG_ESPACE,		/* Ran out of memory.  */
399*a7c91847Schristos #define REG_ESPACE	_REG_ESPACE
400*a7c91847Schristos 
401*a7c91847Schristos   _REG_BADRPT,		/* No preceding re for repetition op.  */
402*a7c91847Schristos #define REG_BADRPT	_REG_BADRPT
403*a7c91847Schristos 
404*a7c91847Schristos   /* Error codes we've added.  */
405*a7c91847Schristos 
406*a7c91847Schristos   _REG_EEND,		/* Premature end.  */
407*a7c91847Schristos #define REG_EEND	_REG_EEND
408*a7c91847Schristos 
409*a7c91847Schristos   _REG_ESIZE,		/* Compiled pattern bigger than 2^16 bytes.  */
410*a7c91847Schristos #define REG_ESIZE	_REG_ESIZE
411*a7c91847Schristos 
412*a7c91847Schristos   _REG_ERPAREN		/* Unmatched ) or \); not returned from regcomp.  */
413*a7c91847Schristos #define REG_ERPAREN	_REG_ERPAREN
414*a7c91847Schristos 
415*a7c91847Schristos } reg_errcode_t;
416*a7c91847Schristos 
417*a7c91847Schristos /* In the traditional GNU implementation, regex.h defined member names
418*a7c91847Schristos    like `buffer' that POSIX does not allow.  These members now have
419*a7c91847Schristos    names with leading `re_' (e.g., `re_buffer').  Support the old
420*a7c91847Schristos    names only if _REGEX_SOURCE is defined.  New programs should use
421*a7c91847Schristos    the new names.  */
422*a7c91847Schristos #ifdef _REGEX_SOURCE
423*a7c91847Schristos # define _REG_RE_NAME(id) id
424*a7c91847Schristos # define _REG_RM_NAME(id) id
425*a7c91847Schristos #else
426*a7c91847Schristos # define _REG_RE_NAME(id) re_##id
427*a7c91847Schristos # define _REG_RM_NAME(id) rm_##id
428*a7c91847Schristos #endif
429*a7c91847Schristos 
430*a7c91847Schristos /* The user can specify the type of the re_translate member by
431*a7c91847Schristos    defining the macro REG_TRANSLATE_TYPE.  In the traditional GNU
432*a7c91847Schristos    implementation, this macro was named RE_TRANSLATE_TYPE, but POSIX
433*a7c91847Schristos    does not allow this.  Support the old name only if _REGEX_SOURCE
434*a7c91847Schristos    and if the new name is not defined. New programs should use the new
435*a7c91847Schristos    name.  */
436*a7c91847Schristos #ifndef REG_TRANSLATE_TYPE
437*a7c91847Schristos # if defined _REGEX_SOURCE && defined RE_TRANSLATE_TYPE
438*a7c91847Schristos #  define REG_TRANSLATE_TYPE RE_TRANSLATE_TYPE
439*a7c91847Schristos # else
440*a7c91847Schristos #  define REG_TRANSLATE_TYPE char *
441*a7c91847Schristos # endif
442*a7c91847Schristos #endif
443*a7c91847Schristos 
444*a7c91847Schristos /* This data structure represents a compiled pattern.  Before calling
445*a7c91847Schristos    the pattern compiler), the fields `re_buffer', `re_allocated', `re_fastmap',
446*a7c91847Schristos    `re_translate', and `re_no_sub' can be set.  After the pattern has been
447*a7c91847Schristos    compiled, the `re_nsub' field is available.  All other fields are
448*a7c91847Schristos    private to the regex routines.  */
449*a7c91847Schristos 
450*a7c91847Schristos struct re_pattern_buffer
451*a7c91847Schristos {
452*a7c91847Schristos /* [[[begin pattern_buffer]]] */
453*a7c91847Schristos 	/* Space that holds the compiled pattern.  It is declared as
454*a7c91847Schristos           `unsigned char *' because its elements are
455*a7c91847Schristos            sometimes used as array indexes.  */
456*a7c91847Schristos   unsigned char *_REG_RE_NAME (buffer);
457*a7c91847Schristos 
458*a7c91847Schristos 	/* Number of bytes to which `re_buffer' points.  */
459*a7c91847Schristos   __re_long_size_t _REG_RE_NAME (allocated);
460*a7c91847Schristos 
461*a7c91847Schristos 	/* Number of bytes actually used in `re_buffer'.  */
462*a7c91847Schristos   __re_long_size_t _REG_RE_NAME (used);
463*a7c91847Schristos 
464*a7c91847Schristos         /* Syntax setting with which the pattern was compiled.  */
465*a7c91847Schristos   reg_syntax_t _REG_RE_NAME (syntax);
466*a7c91847Schristos 
467*a7c91847Schristos         /* Pointer to a fastmap, if any, otherwise zero.  re_search uses
468*a7c91847Schristos            the fastmap, if there is one, to skip over impossible
469*a7c91847Schristos            starting points for matches.  */
470*a7c91847Schristos   char *_REG_RE_NAME (fastmap);
471*a7c91847Schristos 
472*a7c91847Schristos         /* Either a translate table to apply to all characters before
473*a7c91847Schristos            comparing them, or zero for no translation.  The translation
474*a7c91847Schristos            is applied to a pattern when it is compiled and to a string
475*a7c91847Schristos            when it is matched.  */
476*a7c91847Schristos   REG_TRANSLATE_TYPE _REG_RE_NAME (translate);
477*a7c91847Schristos 
478*a7c91847Schristos 	/* Number of subexpressions found by the compiler.  */
479*a7c91847Schristos   size_t re_nsub;
480*a7c91847Schristos 
481*a7c91847Schristos         /* Zero if this pattern cannot match the empty string, one else.
482*a7c91847Schristos            Well, in truth it's used only in `re_search_2', to see
483*a7c91847Schristos            whether or not we should use the fastmap, so we don't set
484*a7c91847Schristos            this absolutely perfectly; see `re_compile_fastmap' (the
485*a7c91847Schristos            `duplicate' case).  */
486*a7c91847Schristos   unsigned int _REG_RE_NAME (can_be_null) : 1;
487*a7c91847Schristos 
488*a7c91847Schristos         /* If REG_UNALLOCATED, allocate space in the `regs' structure
489*a7c91847Schristos              for `max (REG_NREGS, re_nsub + 1)' groups.
490*a7c91847Schristos            If REG_REALLOCATE, reallocate space if necessary.
491*a7c91847Schristos            If REG_FIXED, use what's there.  */
492*a7c91847Schristos #define REG_UNALLOCATED 0
493*a7c91847Schristos #define REG_REALLOCATE 1
494*a7c91847Schristos #define REG_FIXED 2
495*a7c91847Schristos   unsigned int _REG_RE_NAME (regs_allocated) : 2;
496*a7c91847Schristos 
497*a7c91847Schristos         /* Set to zero when `regex_compile' compiles a pattern; set to one
498*a7c91847Schristos            by `re_compile_fastmap' if it updates the fastmap.  */
499*a7c91847Schristos   unsigned int _REG_RE_NAME (fastmap_accurate) : 1;
500*a7c91847Schristos 
501*a7c91847Schristos         /* If set, `re_match_2' does not return information about
502*a7c91847Schristos            subexpressions.  */
503*a7c91847Schristos   unsigned int _REG_RE_NAME (no_sub) : 1;
504*a7c91847Schristos 
505*a7c91847Schristos         /* If set, a beginning-of-line anchor doesn't match at the
506*a7c91847Schristos            beginning of the string.  */
507*a7c91847Schristos   unsigned int _REG_RE_NAME (not_bol) : 1;
508*a7c91847Schristos 
509*a7c91847Schristos         /* Similarly for an end-of-line anchor.  */
510*a7c91847Schristos   unsigned int _REG_RE_NAME (not_eol) : 1;
511*a7c91847Schristos 
512*a7c91847Schristos         /* If true, an anchor at a newline matches.  */
513*a7c91847Schristos   unsigned int _REG_RE_NAME (newline_anchor) : 1;
514*a7c91847Schristos 
515*a7c91847Schristos /* [[[end pattern_buffer]]] */
516*a7c91847Schristos };
517*a7c91847Schristos 
518*a7c91847Schristos typedef struct re_pattern_buffer regex_t;
519*a7c91847Schristos 
520*a7c91847Schristos /* This is the structure we store register match data in.  See
521*a7c91847Schristos    regex.texinfo for a full description of what registers match.  */
522*a7c91847Schristos struct re_registers
523*a7c91847Schristos {
524*a7c91847Schristos   __re_size_t _REG_RM_NAME (num_regs);
525*a7c91847Schristos   regoff_t *_REG_RM_NAME (start);
526*a7c91847Schristos   regoff_t *_REG_RM_NAME (end);
527*a7c91847Schristos };
528*a7c91847Schristos 
529*a7c91847Schristos 
530*a7c91847Schristos /* If `regs_allocated' is REG_UNALLOCATED in the pattern buffer,
531*a7c91847Schristos    `re_match_2' returns information about at least this many registers
532*a7c91847Schristos    the first time a `regs' structure is passed.  */
533*a7c91847Schristos #ifndef REG_NREGS
534*a7c91847Schristos # define REG_NREGS 30
535*a7c91847Schristos #endif
536*a7c91847Schristos 
537*a7c91847Schristos 
538*a7c91847Schristos /* POSIX specification for registers.  Aside from the different names than
539*a7c91847Schristos    `re_registers', POSIX uses an array of structures, instead of a
540*a7c91847Schristos    structure of arrays.  */
541*a7c91847Schristos typedef struct
542*a7c91847Schristos {
543*a7c91847Schristos   regoff_t rm_so;  /* Byte offset from string's start to substring's start.  */
544*a7c91847Schristos   regoff_t rm_eo;  /* Byte offset from string's start to substring's end.  */
545*a7c91847Schristos } regmatch_t;
546*a7c91847Schristos 
547*a7c91847Schristos /* Declarations for routines.  */
548*a7c91847Schristos 
549*a7c91847Schristos /* Sets the current default syntax to SYNTAX, and return the old syntax.
550*a7c91847Schristos    You can also simply assign to the `re_syntax_options' variable.  */
551*a7c91847Schristos extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax);
552*a7c91847Schristos 
553*a7c91847Schristos /* Compile the regular expression PATTERN, with length LENGTH
554*a7c91847Schristos    and syntax given by the global `re_syntax_options', into the buffer
555*a7c91847Schristos    BUFFER.  Return NULL if successful, and an error string if not.  */
556*a7c91847Schristos extern const char *re_compile_pattern (const char *__pattern, size_t __length,
557*a7c91847Schristos 				       struct re_pattern_buffer *__buffer);
558*a7c91847Schristos 
559*a7c91847Schristos 
560*a7c91847Schristos /* Compile a fastmap for the compiled pattern in BUFFER; used to
561*a7c91847Schristos    accelerate searches.  Return 0 if successful and -2 if was an
562*a7c91847Schristos    internal error.  */
563*a7c91847Schristos extern int re_compile_fastmap (struct re_pattern_buffer *__buffer);
564*a7c91847Schristos 
565*a7c91847Schristos 
566*a7c91847Schristos /* Search in the string STRING (with length LENGTH) for the pattern
567*a7c91847Schristos    compiled into BUFFER.  Start searching at position START, for RANGE
568*a7c91847Schristos    characters.  Return the starting position of the match, -1 for no
569*a7c91847Schristos    match, or -2 for an internal error.  Also return register
570*a7c91847Schristos    information in REGS (if REGS and BUFFER->re_no_sub are nonzero).  */
571*a7c91847Schristos extern regoff_t re_search (struct re_pattern_buffer *__buffer,
572*a7c91847Schristos 			   const char *__string, __re_idx_t __length,
573*a7c91847Schristos 			   __re_idx_t __start, regoff_t __range,
574*a7c91847Schristos 			   struct re_registers *__regs);
575*a7c91847Schristos 
576*a7c91847Schristos 
577*a7c91847Schristos /* Like `re_search', but search in the concatenation of STRING1 and
578*a7c91847Schristos    STRING2.  Also, stop searching at index START + STOP.  */
579*a7c91847Schristos extern regoff_t re_search_2 (struct re_pattern_buffer *__buffer,
580*a7c91847Schristos 			     const char *__string1, __re_idx_t __length1,
581*a7c91847Schristos 			     const char *__string2, __re_idx_t __length2,
582*a7c91847Schristos 			     __re_idx_t __start, regoff_t __range,
583*a7c91847Schristos 			     struct re_registers *__regs,
584*a7c91847Schristos 			     __re_idx_t __stop);
585*a7c91847Schristos 
586*a7c91847Schristos 
587*a7c91847Schristos /* Like `re_search', but return how many characters in STRING the regexp
588*a7c91847Schristos    in BUFFER matched, starting at position START.  */
589*a7c91847Schristos extern regoff_t re_match (struct re_pattern_buffer *__buffer,
590*a7c91847Schristos 			  const char *__string, __re_idx_t __length,
591*a7c91847Schristos 			  __re_idx_t __start, struct re_registers *__regs);
592*a7c91847Schristos 
593*a7c91847Schristos 
594*a7c91847Schristos /* Relates to `re_match' as `re_search_2' relates to `re_search'.  */
595*a7c91847Schristos extern regoff_t re_match_2 (struct re_pattern_buffer *__buffer,
596*a7c91847Schristos 			    const char *__string1, __re_idx_t __length1,
597*a7c91847Schristos 			    const char *__string2, __re_idx_t __length2,
598*a7c91847Schristos 			    __re_idx_t __start, struct re_registers *__regs,
599*a7c91847Schristos 			    __re_idx_t __stop);
600*a7c91847Schristos 
601*a7c91847Schristos 
602*a7c91847Schristos /* Set REGS to hold NUM_REGS registers, storing them in STARTS and
603*a7c91847Schristos    ENDS.  Subsequent matches using BUFFER and REGS will use this memory
604*a7c91847Schristos    for recording register information.  STARTS and ENDS must be
605*a7c91847Schristos    allocated with malloc, and must each be at least `NUM_REGS * sizeof
606*a7c91847Schristos    (regoff_t)' bytes long.
607*a7c91847Schristos 
608*a7c91847Schristos    If NUM_REGS == 0, then subsequent matches should allocate their own
609*a7c91847Schristos    register data.
610*a7c91847Schristos 
611*a7c91847Schristos    Unless this function is called, the first search or match using
612*a7c91847Schristos    PATTERN_BUFFER will allocate its own register data, without
613*a7c91847Schristos    freeing the old data.  */
614*a7c91847Schristos extern void re_set_registers (struct re_pattern_buffer *__buffer,
615*a7c91847Schristos 			      struct re_registers *__regs,
616*a7c91847Schristos 			      __re_size_t __num_regs,
617*a7c91847Schristos 			      regoff_t *__starts, regoff_t *__ends);
618*a7c91847Schristos 
619*a7c91847Schristos #if defined _REGEX_RE_COMP || defined _LIBC
620*a7c91847Schristos # ifndef _CRAY
621*a7c91847Schristos /* 4.2 bsd compatibility.  */
622*a7c91847Schristos extern char *re_comp (const char *);
623*a7c91847Schristos extern int re_exec (const char *);
624*a7c91847Schristos # endif
625*a7c91847Schristos #endif
626*a7c91847Schristos 
627*a7c91847Schristos /* GCC 2.95 and later have "__restrict"; C99 compilers have
628*a7c91847Schristos    "restrict", and "configure" may have defined "restrict".  */
629*a7c91847Schristos #ifndef __restrict
630*a7c91847Schristos # if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__))
631*a7c91847Schristos #  if defined restrict || 199901L <= __STDC_VERSION__
632*a7c91847Schristos #   define __restrict restrict
633*a7c91847Schristos #  else
634*a7c91847Schristos #   define __restrict
635*a7c91847Schristos #  endif
636*a7c91847Schristos # endif
637*a7c91847Schristos #endif
638*a7c91847Schristos /* gcc 3.1 and up support the [restrict] syntax, but g++ doesn't.  */
639*a7c91847Schristos #ifndef __restrict_arr
640*a7c91847Schristos # if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) && !defined __cplusplus
641*a7c91847Schristos #  define __restrict_arr __restrict
642*a7c91847Schristos # else
643*a7c91847Schristos #  define __restrict_arr
644*a7c91847Schristos # endif
645*a7c91847Schristos #endif
646*a7c91847Schristos 
647*a7c91847Schristos /* POSIX compatibility.  */
648*a7c91847Schristos extern int regcomp (regex_t *__restrict __preg,
649*a7c91847Schristos 		    const char *__restrict __pattern,
650*a7c91847Schristos 		    int __cflags);
651*a7c91847Schristos 
652*a7c91847Schristos extern int regexec (const regex_t *__restrict __preg,
653*a7c91847Schristos 		    const char *__restrict __string, size_t __nmatch,
654*a7c91847Schristos 		    regmatch_t __pmatch[__restrict_arr],
655*a7c91847Schristos 		    int __eflags);
656*a7c91847Schristos 
657*a7c91847Schristos extern size_t regerror (int __errcode, const regex_t *__restrict __preg,
658*a7c91847Schristos 			char *__restrict __errbuf, size_t __errbuf_size);
659*a7c91847Schristos 
660*a7c91847Schristos extern void regfree (regex_t *__preg);
661*a7c91847Schristos 
662*a7c91847Schristos 
663*a7c91847Schristos #ifdef _REGEX_SOURCE
664*a7c91847Schristos 
665*a7c91847Schristos /* Define the POSIX-compatible member names in terms of the
666*a7c91847Schristos    incompatible (and deprecated) names established by _REG_RE_NAME.
667*a7c91847Schristos    New programs should use the re_* names.  */
668*a7c91847Schristos 
669*a7c91847Schristos # define re_allocated allocated
670*a7c91847Schristos # define re_buffer buffer
671*a7c91847Schristos # define re_can_be_null can_be_null
672*a7c91847Schristos # define re_fastmap fastmap
673*a7c91847Schristos # define re_fastmap_accurate fastmap_accurate
674*a7c91847Schristos # define re_newline_anchor newline_anchor
675*a7c91847Schristos # define re_no_sub no_sub
676*a7c91847Schristos # define re_not_bol not_bol
677*a7c91847Schristos # define re_not_eol not_eol
678*a7c91847Schristos # define re_regs_allocated regs_allocated
679*a7c91847Schristos # define re_syntax syntax
680*a7c91847Schristos # define re_translate translate
681*a7c91847Schristos # define re_used used
682*a7c91847Schristos 
683*a7c91847Schristos /* Similarly for _REG_RM_NAME.  */
684*a7c91847Schristos 
685*a7c91847Schristos # define rm_end end
686*a7c91847Schristos # define rm_num_regs num_regs
687*a7c91847Schristos # define rm_start start
688*a7c91847Schristos 
689*a7c91847Schristos /* Undef RE_DUP_MAX first, in case the user has already included a
690*a7c91847Schristos    <limits.h> with an incompatible definition.
691*a7c91847Schristos 
692*a7c91847Schristos    On GNU systems, the most common spelling for RE_DUP_MAX's value in
693*a7c91847Schristos    <limits.h> is (0x7ffff), so define RE_DUP_MAX to that, not to
694*a7c91847Schristos    REG_DUP_MAX.  This avoid some duplicate-macro-definition warnings
695*a7c91847Schristos    with programs that include <limits.h> after this file.
696*a7c91847Schristos 
697*a7c91847Schristos    New programs should not assume that regex.h defines RE_DUP_MAX; to
698*a7c91847Schristos    get the value of RE_DUP_MAX, they should instead include <limits.h>
699*a7c91847Schristos    and possibly invoke the sysconf function.  */
700*a7c91847Schristos 
701*a7c91847Schristos # undef RE_DUP_MAX
702*a7c91847Schristos # define RE_DUP_MAX (0x7fff)
703*a7c91847Schristos 
704*a7c91847Schristos /* Define the following symbols for backward source compatibility.
705*a7c91847Schristos    These symbols violate the POSIX name space rules, and new programs
706*a7c91847Schristos    should avoid them.  */
707*a7c91847Schristos 
708*a7c91847Schristos # define REGS_FIXED REG_FIXED
709*a7c91847Schristos # define REGS_REALLOCATE REG_REALLOCATE
710*a7c91847Schristos # define REGS_UNALLOCATED REG_UNALLOCATED
711*a7c91847Schristos # define RE_BACKSLASH_ESCAPE_IN_LISTS REG_BACKSLASH_ESCAPE_IN_LISTS
712*a7c91847Schristos # define RE_BK_PLUS_QM REG_BK_PLUS_QM
713*a7c91847Schristos # define RE_CARET_ANCHORS_HERE REG_CARET_ANCHORS_HERE
714*a7c91847Schristos # define RE_CHAR_CLASSES REG_CHAR_CLASSES
715*a7c91847Schristos # define RE_CONTEXT_INDEP_ANCHORS REG_CONTEXT_INDEP_ANCHORS
716*a7c91847Schristos # define RE_CONTEXT_INDEP_OPS REG_CONTEXT_INDEP_OPS
717*a7c91847Schristos # define RE_CONTEXT_INVALID_DUP REG_CONTEXT_INVALID_DUP
718*a7c91847Schristos # define RE_CONTEXT_INVALID_OPS REG_CONTEXT_INVALID_OPS
719*a7c91847Schristos # define RE_DEBUG REG_DEBUG
720*a7c91847Schristos # define RE_DOT_NEWLINE REG_DOT_NEWLINE
721*a7c91847Schristos # define RE_DOT_NOT_NULL REG_DOT_NOT_NULL
722*a7c91847Schristos # define RE_HAT_LISTS_NOT_NEWLINE REG_HAT_LISTS_NOT_NEWLINE
723*a7c91847Schristos # define RE_ICASE REG_IGNORE_CASE /* avoid collision with REG_ICASE */
724*a7c91847Schristos # define RE_INTERVALS REG_INTERVALS
725*a7c91847Schristos # define RE_INVALID_INTERVAL_ORD REG_INVALID_INTERVAL_ORD
726*a7c91847Schristos # define RE_LIMITED_OPS REG_LIMITED_OPS
727*a7c91847Schristos # define RE_NEWLINE_ALT REG_NEWLINE_ALT
728*a7c91847Schristos # define RE_NO_BK_BRACES REG_NO_BK_BRACES
729*a7c91847Schristos # define RE_NO_BK_PARENS REG_NO_BK_PARENS
730*a7c91847Schristos # define RE_NO_BK_REFS REG_NO_BK_REFS
731*a7c91847Schristos # define RE_NO_BK_VBAR REG_NO_BK_VBAR
732*a7c91847Schristos # define RE_NO_EMPTY_RANGES REG_NO_EMPTY_RANGES
733*a7c91847Schristos # define RE_NO_GNU_OPS REG_NO_GNU_OPS
734*a7c91847Schristos # define RE_NO_POSIX_BACKTRACKING REG_NO_POSIX_BACKTRACKING
735*a7c91847Schristos # define RE_NO_SUB REG_NO_SUB
736*a7c91847Schristos # define RE_NREGS REG_NREGS
737*a7c91847Schristos # define RE_SYNTAX_AWK REG_SYNTAX_AWK
738*a7c91847Schristos # define RE_SYNTAX_ED REG_SYNTAX_ED
739*a7c91847Schristos # define RE_SYNTAX_EGREP REG_SYNTAX_EGREP
740*a7c91847Schristos # define RE_SYNTAX_EMACS REG_SYNTAX_EMACS
741*a7c91847Schristos # define RE_SYNTAX_GNU_AWK REG_SYNTAX_GNU_AWK
742*a7c91847Schristos # define RE_SYNTAX_GREP REG_SYNTAX_GREP
743*a7c91847Schristos # define RE_SYNTAX_POSIX_AWK REG_SYNTAX_POSIX_AWK
744*a7c91847Schristos # define RE_SYNTAX_POSIX_BASIC REG_SYNTAX_POSIX_BASIC
745*a7c91847Schristos # define RE_SYNTAX_POSIX_EGREP REG_SYNTAX_POSIX_EGREP
746*a7c91847Schristos # define RE_SYNTAX_POSIX_EXTENDED REG_SYNTAX_POSIX_EXTENDED
747*a7c91847Schristos # define RE_SYNTAX_POSIX_MINIMAL_BASIC REG_SYNTAX_POSIX_MINIMAL_BASIC
748*a7c91847Schristos # define RE_SYNTAX_POSIX_MINIMAL_EXTENDED REG_SYNTAX_POSIX_MINIMAL_EXTENDED
749*a7c91847Schristos # define RE_SYNTAX_SED REG_SYNTAX_SED
750*a7c91847Schristos # define RE_UNMATCHED_RIGHT_PAREN_ORD REG_UNMATCHED_RIGHT_PAREN_ORD
751*a7c91847Schristos # ifndef RE_TRANSLATE_TYPE
752*a7c91847Schristos #  define RE_TRANSLATE_TYPE REG_TRANSLATE_TYPE
753*a7c91847Schristos # endif
754*a7c91847Schristos 
755*a7c91847Schristos #endif /* defined _REGEX_SOURCE */
756*a7c91847Schristos 
757*a7c91847Schristos #ifdef __cplusplus
758*a7c91847Schristos }
759*a7c91847Schristos #endif	/* C++ */
760*a7c91847Schristos 
761*a7c91847Schristos #endif /* regex.h */
762*a7c91847Schristos 
763*a7c91847Schristos /*
764*a7c91847Schristos Local variables:
765*a7c91847Schristos make-backup-files: t
766*a7c91847Schristos version-control: t
767*a7c91847Schristos trim-versions-without-asking: nil
768*a7c91847Schristos End:
769*a7c91847Schristos */
770