xref: /PHP-5.5/ext/ereg/regex/regex.h (revision 07586f68)
1 #ifndef _HSREGEX_H_
2 #define _HSREGEX_H_
3 #ifndef _HSREGEX_H
4 #define	_HSREGEX_H	/* never again */
5 /* ========= begin header generated by ././mkh ========= */
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9 
10 /* === regex2.h === */
11 #ifdef WIN32
12 #define API_EXPORT(type)    __declspec(dllexport) type __stdcall
13 #elif defined(__GNUC__) && __GNUC__ >= 4
14 #define API_EXPORT(type)    __attribute__ ((visibility("default"))) type
15 #else
16 #define API_EXPORT(type)    type
17 #endif
18 
19 typedef off_t regoff_t;
20 typedef struct {
21 	int re_magic;
22 	size_t re_nsub;		/* number of parenthesized subexpressions */
23 	const char *re_endp;	/* end pointer for REG_PEND */
24 	struct re_guts *re_g;	/* none of your business :-) */
25 } regex_t;
26 typedef struct {
27 	regoff_t rm_so;		/* start of match */
28 	regoff_t rm_eo;		/* end of match */
29 } regmatch_t;
30 
31 
32 /* === regcomp.c === */
33 API_EXPORT(int) regcomp(regex_t *, const char *, int);
34 #define	REG_BASIC	0000
35 #define	REG_EXTENDED	0001
36 #define	REG_ICASE	0002
37 #define	REG_NOSUB	0004
38 #define	REG_NEWLINE	0010
39 #define	REG_NOSPEC	0020
40 #define	REG_PEND	0040
41 #define	REG_DUMP	0200
42 
43 
44 /* === regerror.c === */
45 #define	REG_OKAY	 0
46 #define	REG_NOMATCH	 1
47 #define	REG_BADPAT	 2
48 #define	REG_ECOLLATE	 3
49 #define	REG_ECTYPE	 4
50 #define	REG_EESCAPE	 5
51 #define	REG_ESUBREG	 6
52 #define	REG_EBRACK	 7
53 #define	REG_EPAREN	 8
54 #define	REG_EBRACE	 9
55 #define	REG_BADBR	10
56 #define	REG_ERANGE	11
57 #define	REG_ESPACE	12
58 #define	REG_BADRPT	13
59 #define	REG_EMPTY	14
60 #define	REG_ASSERT	15
61 #define	REG_INVARG	16
62 #define	REG_ATOI	255	/* convert name to number (!) */
63 #define	REG_ITOA	0400	/* convert number to name (!) */
64 API_EXPORT(size_t) regerror(int, const regex_t *, char *, size_t);
65 
66 
67 /* === regexec.c === */
68 API_EXPORT(int) regexec(const regex_t *, const char *, size_t, regmatch_t [], int);
69 #define	REG_NOTBOL	00001
70 #define	REG_NOTEOL	00002
71 #define	REG_STARTEND	00004
72 #define	REG_TRACE	00400	/* tracing of execution */
73 #define	REG_LARGE	01000	/* force large representation */
74 #define	REG_BACKR	02000	/* force use of backref code */
75 
76 
77 /* === regfree.c === */
78 API_EXPORT(void) regfree(regex_t *);
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 /* ========= end header generated by ././mkh ========= */
84 #endif
85 #endif
86