00001 /*- 00002 * Copyright (c) 1992 Henry Spencer. 00003 * Copyright (c) 1992, 1993 00004 * The Regents of the University of California. All rights reserved. 00005 * 00006 * This code is derived from software contributed to Berkeley by 00007 * Henry Spencer of the University of Toronto. 00008 * 00009 * Redistribution and use in source and binary forms, with or without 00010 * modification, are permitted provided that the following conditions 00011 * are met: 00012 * 1. Redistributions of source code must retain the above copyright 00013 * notice, this list of conditions and the following disclaimer. 00014 * 2. Redistributions in binary form must reproduce the above copyright 00015 * notice, this list of conditions and the following disclaimer in the 00016 * documentation and/or other materials provided with the distribution. 00017 * 3. All advertising materials mentioning features or use of this software 00018 * must display the following acknowledgement: 00019 * This product includes software developed by the University of 00020 * California, Berkeley and its contributors. 00021 * 4. Neither the name of the University nor the names of its contributors 00022 * may be used to endorse or promote products derived from this software 00023 * without specific prior written permission. 00024 * 00025 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 00026 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00028 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 00029 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00030 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00031 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00032 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00033 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00034 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00035 * SUCH DAMAGE. 00036 * 00037 * @(#)regex.h 8.2 (Berkeley) 1/3/94 00038 * $FreeBSD: src/include/regex.h,v 1.11 2004/07/12 06:07:26 tjr Exp $ 00039 */ 00040 00041 #ifndef _REGEX_H_ 00042 #define _REGEX_H_ 00043 00044 #include <sys/cdefs.h> 00045 #include <sys/_types.h> 00046 00047 /* types */ 00048 typedef __off_t regoff_t; 00049 00050 #ifndef _SIZE_T_DECLARED 00051 typedef __size_t size_t; 00052 #define _SIZE_T_DECLARED 00053 #endif 00054 00055 typedef struct { 00056 int re_magic; 00057 size_t re_nsub; /* number of parenthesized subexpressions */ 00058 __const char *re_endp; /* end pointer for REG_PEND */ 00059 struct re_guts *re_g; /* none of your business :-) */ 00060 } regex_t; 00061 00062 typedef struct { 00063 regoff_t rm_so; /* start of match */ 00064 regoff_t rm_eo; /* end of match */ 00065 } regmatch_t; 00066 00067 /* regcomp() flags */ 00068 #define REG_BASIC 0000 00069 #define REG_EXTENDED 0001 00070 #define REG_ICASE 0002 00071 #define REG_NOSUB 0004 00072 #define REG_NEWLINE 0010 00073 #define REG_NOSPEC 0020 00074 #define REG_PEND 0040 00075 #define REG_DUMP 0200 00076 00077 /* regerror() flags */ 00078 #define REG_ENOSYS (-1) 00079 #define REG_NOMATCH 1 00080 #define REG_BADPAT 2 00081 #define REG_ECOLLATE 3 00082 #define REG_ECTYPE 4 00083 #define REG_EESCAPE 5 00084 #define REG_ESUBREG 6 00085 #define REG_EBRACK 7 00086 #define REG_EPAREN 8 00087 #define REG_EBRACE 9 00088 #define REG_BADBR 10 00089 #define REG_ERANGE 11 00090 #define REG_ESPACE 12 00091 #define REG_BADRPT 13 00092 #define REG_EMPTY 14 00093 #define REG_ASSERT 15 00094 #define REG_INVARG 16 00095 #define REG_ILLSEQ 17 00096 #define REG_ATOI 255 /* convert name to number (!) */ 00097 #define REG_ITOA 0400 /* convert number to name (!) */ 00098 00099 /* regexec() flags */ 00100 #define REG_NOTBOL 00001 00101 #define REG_NOTEOL 00002 00102 #define REG_STARTEND 00004 00103 #define REG_TRACE 00400 /* tracing of execution */ 00104 #define REG_LARGE 01000 /* force large representation */ 00105 #define REG_BACKR 02000 /* force use of backref code */ 00106 00107 __BEGIN_DECLS 00108 IMPORT_C int regcomp(regex_t * __restrict, const char * __restrict, int); 00109 IMPORT_C size_t regerror(int, const regex_t * __restrict, char * __restrict, size_t); 00110 /* 00111 * XXX forth parameter should be `regmatch_t [__restrict]', but isn't because 00112 * of a bug in GCC 3.2 (when -std=c99 is specified) which perceives this as a 00113 * syntax error. 00114 */ 00115 IMPORT_C int regexec(const regex_t * __restrict, const char * __restrict, size_t, 00116 regmatch_t * __restrict, int); 00117 IMPORT_C void regfree(regex_t *); 00118 __END_DECLS 00119 00120 #endif /* !_REGEX_H_ */