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