Source to include/regex.h
0001 /*-
0002 * Copyright (c) 1992 Henry Spencer.
0003 * Copyright (c) 1992, 1993
0004 * The Regents of the University of California. All rights reserved.
0005 *
0006 * This code is derived from software contributed to Berkeley by
0007 * Henry Spencer of the University of Toronto.
0008 *
0009 * Redistribution and use in source and binary forms, with or without
0010 * modification, are permitted provided that the following conditions
0011 * are met:
0012 * 1. Redistributions of source code must retain the above copyright
0013 * notice, this list of conditions and the following disclaimer.
0014 * 2. Redistributions in binary form must reproduce the above copyright
0015 * notice, this list of conditions and the following disclaimer in the
0016 * documentation and/or other materials provided with the distribution.
0017 * 3. All advertising materials mentioning features or use of this software
0018 * must display the following acknowledgement:
0019 * This product includes software developed by the University of
0020 * California, Berkeley and its contributors.
0021 * 4. Neither the name of the University nor the names of its contributors
0022 * may be used to endorse or promote products derived from this software
0023 * without specific prior written permission.
0024 *
0025 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
0026 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0027 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0028 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
0029 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0030 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
0031 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0032 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0033 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
0034 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0035 * SUCH DAMAGE.
0036 *
0037 * @(#)regex.h 8.2 (Berkeley) 1/3/94
0038 */
0039
0040 #ifndef _REGEX_H_
0041 #define _REGEX_H_
0042
0043 #include <cdefs.h>
0044
0045 /* types */
0046 typedef long regoff_t;
0047
0048 typedef struct {
0049 int re_magic;
0050 size_t re_nsub; /* number of parenthesized subexpressions */
0051 __const char *re_endp; /* end pointer for REG_PEND */
0052 struct re_guts *re_g; /* none of your business :-) */
0053 } regex_t;
0054
0055 typedef struct {
0056 regoff_t rm_so; /* start of match */
0057 regoff_t rm_eo; /* end of match */
0058 } regmatch_t;
0059
0060 /* regcomp() flags */
0061 #define REG_BASIC 0000
0062 #define REG_EXTENDED 0001
0063 #define REG_ICASE 0002
0064 #define REG_NOSUB 0004
0065 #define REG_NEWLINE 0010
0066 #define REG_NOSPEC 0020
0067 #define REG_PEND 0040
0068 #define REG_DUMP 0200
0069
0070 /* regerror() flags */
0071 #define REG_NOMATCH 1
0072 #define REG_BADPAT 2
0073 #define REG_ECOLLATE 3
0074 #define REG_ECTYPE 4
0075 #define REG_EESCAPE 5
0076 #define REG_ESUBREG 6
0077 #define REG_EBRACK 7
0078 #define REG_EPAREN 8
0079 #define REG_EBRACE 9
0080 #define REG_BADBR 10
0081 #define REG_ERANGE 11
0082 #define REG_ESPACE 12
0083 #define REG_BADRPT 13
0084 #define REG_EMPTY 14
0085 #define REG_ASSERT 15
0086 #define REG_INVARG 16
0087 #define REG_ATOI 255 /* convert name to number (!) */
0088 #define REG_ITOA 0400 /* convert number to name (!) */
0089
0090 /* regexec() flags */
0091 #define REG_NOTBOL 00001
0092 #define REG_NOTEOL 00002
0093 #define REG_STARTEND 00004
0094 #define REG_TRACE 00400 /* tracing of execution */
0095 #define REG_LARGE 01000 /* force large representation */
0096 #define REG_BACKR 02000 /* force use of backref code */
0097
0098 __BEGIN_DECLS
0099 int regcomp __P((regex_t *, const char *, int));
0100 size_t regerror __P((int, const regex_t *, char *, size_t));
0101 int regexec __P((const regex_t *,
0102 const char *, size_t, regmatch_t [], int));
0103 void regfree __P((regex_t *));
0104 __END_DECLS
0105
0106 #endif /* !_REGEX_H_ */