00001 /* $NetBSD: regex.h,v 1.4 1994/10/26 00:56:14 cgd Exp $ */ 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.1 (Berkeley) 6/2/93 00040 */ 00041 00042 #ifndef _REGEX_H_ 00043 #define _REGEX_H_ 00044 00045 #include "common.h" 00046 00047 #ifndef SYSV_EXPORT 00048 # if defined(_WIN32) && !defined(__CYGWIN__) && defined(BRLCAD_DLL) 00049 # ifdef SYSV_EXPORT_DLL 00050 # define SYSV_EXPORT __declspec(dllexport) 00051 # else 00052 # define SYSV_EXPORT __declspec(dllimport) 00053 # endif 00054 # else 00055 # define SYSV_EXPORT 00056 # endif 00057 #endif 00058 00059 #include <sys/types.h> 00060 00061 /* types */ 00062 00063 /* ugly hack to make non-MS windows compilers work */ 00064 #if defined(_WIN32) && !defined(_MSC_VER) && !defined(_OFF_T_) 00065 #define _OFF_T_ 00066 typedef long off_t; 00067 #endif 00068 00069 typedef off_t regoff_t; 00070 00071 typedef struct { 00072 int re_magic; 00073 size_t re_nsub; /* number of parenthesized subexpressions */ 00074 const char *re_endp; /* end pointer for REG_PEND */ 00075 struct re_guts *re_g; /* none of your business :-) */ 00076 } regex_t; 00077 00078 typedef struct { 00079 regoff_t rm_so; /* start of match */ 00080 regoff_t rm_eo; /* end of match */ 00081 } regmatch_t; 00082 00083 /* regcomp() flags */ 00084 #define REG_BASIC 0000 00085 #define REG_EXTENDED 0001 00086 #define REG_ICASE 0002 00087 #define REG_NOSUB 0004 00088 #define REG_NEWLINE 0010 00089 #define REG_NOSPEC 0020 00090 #define REG_PEND 0040 00091 #define REG_DUMP 0200 00092 00093 /* regerror() flags */ 00094 #define REG_NOMATCH 1 00095 #define REG_BADPAT 2 00096 #define REG_ECOLLATE 3 00097 #define REG_ECTYPE 4 00098 #define REG_EESCAPE 5 00099 #define REG_ESUBREG 6 00100 #define REG_EBRACK 7 00101 #define REG_EPAREN 8 00102 #define REG_EBRACE 9 00103 #define REG_BADBR 10 00104 #define REG_ERANGE 11 00105 #define REG_ESPACE 12 00106 #define REG_BADRPT 13 00107 #define REG_EMPTY 14 00108 #define REG_ASSERT 15 00109 #define REG_INVARG 16 00110 #define REG_ATOI 255 /* convert name to number (!) */ 00111 #define REG_ITOA 0400 /* convert number to name (!) */ 00112 00113 /* regexec() flags */ 00114 #define REG_NOTBOL 00001 00115 #define REG_NOTEOL 00002 00116 #define REG_STARTEND 00004 00117 #define REG_TRACE 00400 /* tracing of execution */ 00118 #define REG_LARGE 01000 /* force large representation */ 00119 #define REG_BACKR 02000 /* force use of backref code */ 00120 00121 __BEGIN_DECLS 00122 SYSV_EXPORT int regcomp (regex_t *, const char *, int); 00123 SYSV_EXPORT size_t regerror (int, const regex_t *, char *, size_t); 00124 SYSV_EXPORT int regexec (const regex_t *, const char *, size_t, regmatch_t [], int); 00125 SYSV_EXPORT void regfree (regex_t *); 00126 __END_DECLS 00127 00128 #endif /* !_REGEX_H_ */ 00129 00130 /* 00131 * Local Variables: 00132 * mode: C 00133 * tab-width: 8 00134 * c-basic-offset: 4 00135 * indent-tabs-mode: t 00136 * End: 00137 * ex: shiftwidth=4 tabstop=8 00138 */