regex.h revision 1.1.1.1 1 1.1.1.1 perry /*-
2 1.1.1.1 perry * Copyright (c) 1992 Henry Spencer.
3 1.1.1.1 perry * Copyright (c) 1992, 1993
4 1.1.1.1 perry * The Regents of the University of California. All rights reserved.
5 1.1.1.1 perry *
6 1.1.1.1 perry * This code is derived from software contributed to Berkeley by
7 1.1.1.1 perry * Henry Spencer of the University of Toronto.
8 1.1.1.1 perry *
9 1.1.1.1 perry * Redistribution and use in source and binary forms, with or without
10 1.1.1.1 perry * modification, are permitted provided that the following conditions
11 1.1.1.1 perry * are met:
12 1.1.1.1 perry * 1. Redistributions of source code must retain the above copyright
13 1.1.1.1 perry * notice, this list of conditions and the following disclaimer.
14 1.1.1.1 perry * 2. Redistributions in binary form must reproduce the above copyright
15 1.1.1.1 perry * notice, this list of conditions and the following disclaimer in the
16 1.1.1.1 perry * documentation and/or other materials provided with the distribution.
17 1.1.1.1 perry * 3. All advertising materials mentioning features or use of this software
18 1.1.1.1 perry * must display the following acknowledgement:
19 1.1.1.1 perry * This product includes software developed by the University of
20 1.1.1.1 perry * California, Berkeley and its contributors.
21 1.1.1.1 perry * 4. Neither the name of the University nor the names of its contributors
22 1.1.1.1 perry * may be used to endorse or promote products derived from this software
23 1.1.1.1 perry * without specific prior written permission.
24 1.1.1.1 perry *
25 1.1.1.1 perry * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 1.1.1.1 perry * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 1.1.1.1 perry * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 1.1.1.1 perry * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 1.1.1.1 perry * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 1.1.1.1 perry * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 1.1.1.1 perry * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 1.1.1.1 perry * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 1.1.1.1 perry * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 1.1.1.1 perry * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 1.1.1.1 perry * SUCH DAMAGE.
36 1.1.1.1 perry *
37 1.1.1.1 perry * @(#)regex.h 8.2 (Berkeley) 1/3/94
38 1.1.1.1 perry */
39 1.1.1.1 perry
40 1.1 jtc #ifndef _REGEX_H_
41 1.1.1.1 perry #define _REGEX_H_
42 1.1.1.1 perry
43 1.1.1.1 perry #include <sys/cdefs.h>
44 1.1 jtc
45 1.1.1.1 perry /* types */
46 1.1 jtc typedef off_t regoff_t;
47 1.1.1.1 perry
48 1.1 jtc typedef struct {
49 1.1 jtc int re_magic;
50 1.1 jtc size_t re_nsub; /* number of parenthesized subexpressions */
51 1.1.1.1 perry __const char *re_endp; /* end pointer for REG_PEND */
52 1.1 jtc struct re_guts *re_g; /* none of your business :-) */
53 1.1 jtc } regex_t;
54 1.1.1.1 perry
55 1.1 jtc typedef struct {
56 1.1 jtc regoff_t rm_so; /* start of match */
57 1.1 jtc regoff_t rm_eo; /* end of match */
58 1.1 jtc } regmatch_t;
59 1.1 jtc
60 1.1.1.1 perry /* regcomp() flags */
61 1.1 jtc #define REG_BASIC 0000
62 1.1 jtc #define REG_EXTENDED 0001
63 1.1 jtc #define REG_ICASE 0002
64 1.1 jtc #define REG_NOSUB 0004
65 1.1 jtc #define REG_NEWLINE 0010
66 1.1 jtc #define REG_NOSPEC 0020
67 1.1 jtc #define REG_PEND 0040
68 1.1 jtc #define REG_DUMP 0200
69 1.1 jtc
70 1.1.1.1 perry /* regerror() flags */
71 1.1 jtc #define REG_NOMATCH 1
72 1.1 jtc #define REG_BADPAT 2
73 1.1 jtc #define REG_ECOLLATE 3
74 1.1 jtc #define REG_ECTYPE 4
75 1.1 jtc #define REG_EESCAPE 5
76 1.1 jtc #define REG_ESUBREG 6
77 1.1 jtc #define REG_EBRACK 7
78 1.1 jtc #define REG_EPAREN 8
79 1.1 jtc #define REG_EBRACE 9
80 1.1 jtc #define REG_BADBR 10
81 1.1 jtc #define REG_ERANGE 11
82 1.1 jtc #define REG_ESPACE 12
83 1.1 jtc #define REG_BADRPT 13
84 1.1 jtc #define REG_EMPTY 14
85 1.1 jtc #define REG_ASSERT 15
86 1.1 jtc #define REG_INVARG 16
87 1.1 jtc #define REG_ATOI 255 /* convert name to number (!) */
88 1.1 jtc #define REG_ITOA 0400 /* convert number to name (!) */
89 1.1 jtc
90 1.1.1.1 perry /* regexec() flags */
91 1.1 jtc #define REG_NOTBOL 00001
92 1.1 jtc #define REG_NOTEOL 00002
93 1.1 jtc #define REG_STARTEND 00004
94 1.1 jtc #define REG_TRACE 00400 /* tracing of execution */
95 1.1 jtc #define REG_LARGE 01000 /* force large representation */
96 1.1 jtc #define REG_BACKR 02000 /* force use of backref code */
97 1.1 jtc
98 1.1.1.1 perry __BEGIN_DECLS
99 1.1.1.1 perry int regcomp __P((regex_t *, const char *, int));
100 1.1.1.1 perry size_t regerror __P((int, const regex_t *, char *, size_t));
101 1.1.1.1 perry int regexec __P((const regex_t *,
102 1.1.1.1 perry const char *, size_t, regmatch_t [], int));
103 1.1.1.1 perry void regfree __P((regex_t *));
104 1.1.1.1 perry __END_DECLS
105 1.1 jtc
106 1.1.1.1 perry #endif /* !_REGEX_H_ */
107