1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/include/regex.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,116 @@
1.4 +/*-
1.5 + * Copyright (c) 1992 Henry Spencer.
1.6 + * Copyright (c) 1992, 1993
1.7 + * The Regents of the University of California. All rights reserved.
1.8 + *
1.9 + * This code is derived from software contributed to Berkeley by
1.10 + * Henry Spencer of the University of Toronto.
1.11 + *
1.12 + * Redistribution and use in source and binary forms, with or without
1.13 + * modification, are permitted provided that the following conditions
1.14 + * are met:
1.15 + * 1. Redistributions of source code must retain the above copyright
1.16 + * notice, this list of conditions and the following disclaimer.
1.17 + * 2. Redistributions in binary form must reproduce the above copyright
1.18 + * notice, this list of conditions and the following disclaimer in the
1.19 + * documentation and/or other materials provided with the distribution.
1.20 + * 4. Neither the name of the University nor the names of its contributors
1.21 + * may be used to endorse or promote products derived from this software
1.22 + * without specific prior written permission.
1.23 + *
1.24 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1.25 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1.26 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1.27 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1.28 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1.29 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1.30 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1.31 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1.32 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1.33 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1.34 + * SUCH DAMAGE.
1.35 + *
1.36 + * @(#)regex.h 8.2 (Berkeley) 1/3/94
1.37 + * $FreeBSD: src/include/regex.h,v 1.11 2004/07/12 06:07:26 tjr Exp $
1.38 + */
1.39 +
1.40 +#ifndef _REGEX_H_
1.41 +#define _REGEX_H_
1.42 +
1.43 +#include <sys/cdefs.h>
1.44 +#include <sys/_types.h>
1.45 +
1.46 +/* types */
1.47 +typedef __off_t regoff_t;
1.48 +
1.49 +#ifndef _SIZE_T_DECLARED
1.50 +typedef __size_t size_t;
1.51 +#define _SIZE_T_DECLARED
1.52 +#endif
1.53 +
1.54 +typedef struct {
1.55 + int re_magic;
1.56 + size_t re_nsub; /* number of parenthesized subexpressions */
1.57 + __const char *re_endp; /* end pointer for REG_PEND */
1.58 + struct re_guts *re_g; /* none of your business :-) */
1.59 +} regex_t;
1.60 +
1.61 +typedef struct {
1.62 + regoff_t rm_so; /* start of match */
1.63 + regoff_t rm_eo; /* end of match */
1.64 +} regmatch_t;
1.65 +
1.66 +/* regcomp() flags */
1.67 +#define REG_BASIC 0000
1.68 +#define REG_EXTENDED 0001
1.69 +#define REG_ICASE 0002
1.70 +#define REG_NOSUB 0004
1.71 +#define REG_NEWLINE 0010
1.72 +#define REG_NOSPEC 0020
1.73 +#define REG_PEND 0040
1.74 +#define REG_DUMP 0200
1.75 +
1.76 +/* regerror() flags */
1.77 +#define REG_ENOSYS (-1)
1.78 +#define REG_NOMATCH 1
1.79 +#define REG_BADPAT 2
1.80 +#define REG_ECOLLATE 3
1.81 +#define REG_ECTYPE 4
1.82 +#define REG_EESCAPE 5
1.83 +#define REG_ESUBREG 6
1.84 +#define REG_EBRACK 7
1.85 +#define REG_EPAREN 8
1.86 +#define REG_EBRACE 9
1.87 +#define REG_BADBR 10
1.88 +#define REG_ERANGE 11
1.89 +#define REG_ESPACE 12
1.90 +#define REG_BADRPT 13
1.91 +#define REG_EMPTY 14
1.92 +#define REG_ASSERT 15
1.93 +#define REG_INVARG 16
1.94 +#define REG_ILLSEQ 17
1.95 +#define REG_ATOI 255 /* convert name to number (!) */
1.96 +#define REG_ITOA 0400 /* convert number to name (!) */
1.97 +
1.98 +/* regexec() flags */
1.99 +#define REG_NOTBOL 00001
1.100 +#define REG_NOTEOL 00002
1.101 +#define REG_STARTEND 00004
1.102 +#define REG_TRACE 00400 /* tracing of execution */
1.103 +#define REG_LARGE 01000 /* force large representation */
1.104 +#define REG_BACKR 02000 /* force use of backref code */
1.105 +
1.106 +__BEGIN_DECLS
1.107 +IMPORT_C int regcomp(regex_t * __restrict, const char * __restrict, int);
1.108 +IMPORT_C size_t regerror(int, const regex_t * __restrict, char * __restrict, size_t);
1.109 +/*
1.110 + * XXX forth parameter should be `regmatch_t [__restrict]', but isn't because
1.111 + * of a bug in GCC 3.2 (when -std=c99 is specified) which perceives this as a
1.112 + * syntax error.
1.113 + */
1.114 +IMPORT_C int regexec(const regex_t * __restrict, const char * __restrict, size_t,
1.115 + regmatch_t * __restrict, int);
1.116 +IMPORT_C void regfree(regex_t *);
1.117 +__END_DECLS
1.118 +
1.119 +#endif /* !_REGEX_H_ */