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