source: trunk/src/emx/include/regex.h@ 2123

Last change on this file since 2123 was 2123, checked in by bird, 20 years ago

o Added REG_NOERROR to regex.h to make GLIBC code happy.

  • Property cvs2svn:cvs-rev set to 1.4
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 4.4 KB
Line 
1/* regex.h,v 1.2 2004/09/14 22:27:35 bird Exp */
2/** @file
3 * FreeBSD 5.3
4 * @changed bird: Added REG_NOMATCH.
5 */
6/*-
7 * Copyright (c) 1992 Henry Spencer.
8 * Copyright (c) 1992, 1993
9 * The Regents of the University of California. All rights reserved.
10 *
11 * This code is derived from software contributed to Berkeley by
12 * Henry Spencer of the University of Toronto.
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 * 3. All advertising materials mentioning features or use of this software
23 * must display the following acknowledgement:
24 * This product includes software developed by the University of
25 * California, Berkeley and its contributors.
26 * 4. Neither the name of the University nor the names of its contributors
27 * may be used to endorse or promote products derived from this software
28 * without specific prior written permission.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
31 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
34 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
35 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
36 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
37 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
39 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40 * SUCH DAMAGE.
41 *
42 * @(#)regex.h 8.2 (Berkeley) 1/3/94
43 * $FreeBSD: src/include/regex.h,v 1.11 2004/07/12 06:07:26 tjr Exp $
44 */
45
46#ifndef _REGEX_H_
47#define _REGEX_H_
48
49#include <sys/cdefs.h>
50#include <sys/_types.h>
51
52/* types */
53typedef __off_t regoff_t;
54
55#if !defined(_SIZE_T_DECLARED) && !defined(_SIZE_T) /* bird: emx */
56typedef __size_t size_t;
57#define _SIZE_T_DECLARED
58#define _SIZE_T /* bird: emx */
59#endif
60
61typedef struct {
62 int re_magic;
63 size_t re_nsub; /* number of parenthesized subexpressions */
64 __const char *re_endp; /* end pointer for REG_PEND */
65 struct re_guts *re_g; /* none of your business :-) */
66} regex_t;
67
68typedef struct {
69 regoff_t rm_so; /* start of match */
70 regoff_t rm_eo; /* end of match */
71} regmatch_t;
72
73/* regcomp() flags */
74#define REG_BASIC 0000
75#define REG_EXTENDED 0001
76#define REG_ICASE 0002
77#define REG_NOSUB 0004
78#define REG_NEWLINE 0010
79#define REG_NOSPEC 0020
80#define REG_PEND 0040
81#define REG_DUMP 0200
82
83/* regerror() flags */
84#define REG_ENOSYS (-1)
85#if !defined(REG_NOMATCH) && __USE_GNU /* bird */
86#define REG_NOERROR 0 /* bird */
87#endif /* bird */
88#define REG_NOMATCH 1
89#define REG_BADPAT 2
90#define REG_ECOLLATE 3
91#define REG_ECTYPE 4
92#define REG_EESCAPE 5
93#define REG_ESUBREG 6
94#define REG_EBRACK 7
95#define REG_EPAREN 8
96#define REG_EBRACE 9
97#define REG_BADBR 10
98#define REG_ERANGE 11
99#define REG_ESPACE 12
100#define REG_BADRPT 13
101#define REG_EMPTY 14
102#define REG_ASSERT 15
103#define REG_INVARG 16
104#define REG_ILLSEQ 17
105#define REG_ATOI 255 /* convert name to number (!) */
106#define REG_ITOA 0400 /* convert number to name (!) */
107
108/* regexec() flags */
109#define REG_NOTBOL 00001
110#define REG_NOTEOL 00002
111#define REG_STARTEND 00004
112#define REG_TRACE 00400 /* tracing of execution */
113#define REG_LARGE 01000 /* force large representation */
114#define REG_BACKR 02000 /* force use of backref code */
115
116__BEGIN_DECLS
117int regcomp(regex_t * __restrict, const char * __restrict, int);
118size_t regerror(int, const regex_t * __restrict, char * __restrict, size_t);
119/*
120 * XXX forth parameter should be `regmatch_t [__restrict]', but isn't because
121 * of a bug in GCC 3.2 (when -std=c99 is specified) which perceives this as a
122 * syntax error.
123 */
124int regexec(const regex_t * __restrict, const char * __restrict, size_t,
125 regmatch_t * __restrict, int);
126void regfree(regex_t *);
127__END_DECLS
128
129#endif /* !_REGEX_H_ */
Note: See TracBrowser for help on using the repository browser.