dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / lib / libast / i386 / include / ast / regex.h
blob9b7299c8142cb85e5f05ee0284d8e6a6563c3bf9
2 /* : : generated by proto : : */
4 #if !defined(__PROTO__)
5 #include <prototyped.h>
6 #endif
7 #if !defined(__LINKAGE__)
8 #define __LINKAGE__ /* 2004-08-11 transition */
9 #endif
10 #ifdef _AST_STD_I
11 #define _REGEX_H -1
12 #define regex_t int
13 #define regmatch_t int
14 #endif
15 #ifndef _REGEX_H
16 #define _REGEX_H 1
17 #undef regex_t
18 #undef regmatch_t
20 #include <ast_common.h>
22 #define REG_VERSION 20030916L
24 /* regcomp flags */
26 #define REG_AUGMENTED 0x00000001 /* enable ! & < > */
27 #define REG_EXTENDED 0x00000002 /* enable ( | ) */
28 #define REG_ICASE 0x00000004 /* ignore case in match */
29 #define REG_NEWLINE 0x00000008 /* ^/$ match embedded \n */
30 #define REG_NOSUB 0x00000010 /* don't report subexp matches */
31 #define REG_SHELL 0x00000020 /* shell pattern syntax */
33 /* nonstandard regcomp flags */
35 #define REG_LEFT 0x00000100 /* implicit ^... */
36 #define REG_LITERAL 0x00000200 /* no operators */
37 #define REG_MINIMAL 0x00000400 /* minimal match */
38 #define REG_NULL 0x00000800 /* allow null patterns */
39 #define REG_RIGHT 0x00001000 /* implicit ...$ */
40 #define REG_LENIENT 0x00002000 /* look the other way */
41 #define REG_ESCAPE 0x00004000 /* \ escapes delimiter in [...] */
42 #define REG_FIRST 0x00008000 /* first match found will do */
43 #define REG_MULTIPLE 0x00010000 /* multiple \n sep patterns */
44 #define REG_DISCIPLINE 0x00020000 /* regex_t.re_disc is valid */
45 #define REG_SPAN 0x00040000 /* . matches \n */
46 #define REG_COMMENT 0x00080000 /* ignore pattern space & #...\n*/
47 #define REG_MULTIREF 0x00100000 /* multiple digit backrefs */
48 #define REG_MUSTDELIM 0x08000000 /* all delimiters required */
49 #define REG_DELIMITED 0x10000000 /* pattern[0] is delimiter */
50 #define REG_CLASS_ESCAPE 0x80000000 /* \ escapes in [...] */
52 #define REG_SHELL_DOT 0x00200000 /* explicit leading . match */
53 #define REG_SHELL_ESCAPED 0x00400000 /* \ not special */
54 #define REG_SHELL_GROUP 0x20000000 /* (|&) inside [@|&](...) only */
55 #define REG_SHELL_PATH 0x00800000 /* explicit / match */
57 #define REG_REGEXP 0x40000000 /* <regexp.h> compatibility */
59 /* regexec flags */
61 #define REG_NOTBOL 0x00000040 /* ^ is not a special char */
62 #define REG_NOTEOL 0x00000080 /* $ is not a special char */
64 /* nonstandard regexec flags */
66 #define REG_INVERT 0x01000000 /* invert regrexec match sense */
67 #define REG_STARTEND 0x02000000 /* subject==match[0].rm_{so,eo} */
68 #define REG_ADVANCE 0x04000000 /* advance match[0].rm_{so,eo} */
70 /* regalloc flags */
72 #define REG_NOFREE 0x00000001 /* don't free */
74 /* regsub flags */
76 #define REG_SUB_ALL 0x00000001 /* substitute all occurrences */
77 #define REG_SUB_LOWER 0x00000002 /* substitute to lower case */
78 #define REG_SUB_UPPER 0x00000004 /* substitute to upper case */
79 #define REG_SUB_PRINT 0x00000010 /* internal no-op */
80 #define REG_SUB_NUMBER 0x00000020 /* internal no-op */
81 #define REG_SUB_STOP 0x00000040 /* internal no-op */
82 #define REG_SUB_WRITE 0x00000080 /* internal no-op */
83 #define REG_SUB_LAST 0x00000100 /* last substitution option */
84 #define REG_SUB_FULL 0x00000200 /* fully delimited */
85 #define REG_SUB_USER 0x00001000 /* first user flag bit */
87 /* regex error codes */
89 #define REG_ENOSYS (-1) /* not supported */
90 #define REG_NOMATCH 1 /* regexec didn't match */
91 #define REG_BADPAT 2 /* invalid regular expression */
92 #define REG_ECOLLATE 3 /* invalid collation element */
93 #define REG_ECTYPE 4 /* invalid character class */
94 #define REG_EESCAPE 5 /* trailing \ in pattern */
95 #define REG_ESUBREG 6 /* invalid \digit backreference */
96 #define REG_EBRACK 7 /* [...] imbalance */
97 #define REG_EPAREN 8 /* \(...\) or (...) imbalance */
98 #define REG_EBRACE 9 /* \{...\} or {...} imbalance */
99 #define REG_BADBR 10 /* invalid {...} digits */
100 #define REG_ERANGE 11 /* invalid [...] range endpoint */
101 #define REG_ESPACE 12 /* out of space */
102 #define REG_BADRPT 13 /* unary op not preceded by re */
103 #define REG_ENULL 14 /* empty subexpr in pattern */
104 #define REG_ECOUNT 15 /* re component count overflow */
105 #define REG_BADESC 16 /* invalid \char escape */
106 #define REG_VERSIONID 17 /* version id (pseudo error) */
107 #define REG_EFLAGS 18 /* flags conflict */
108 #define REG_EDELIM 19 /* invalid or omitted delimiter */
109 #define REG_PANIC 20 /* unrecoverable internal error */
111 struct regex_s; typedef struct regex_s regex_t;
112 struct regdisc_s; typedef struct regdisc_s regdisc_t;
114 typedef int (*regclass_t) __PROTO__((int));
115 typedef uint32_t regflags_t;
116 typedef int regoff_t;
117 typedef int (*regerror_t) __PROTO__((const regex_t*, regdisc_t*, int, ...));
118 typedef __V_* (*regcomp_t) __PROTO__((const regex_t*, const char*, size_t, regdisc_t*));
119 typedef int (*regexec_t) __PROTO__((const regex_t*, __V_*, const char*, size_t, const char*, size_t, char**, regdisc_t*));
120 typedef __V_* (*regresize_t) __PROTO__((__V_*, __V_*, size_t));
121 typedef int (*regrecord_t) __PROTO__((__V_*, const char*, size_t));
123 typedef struct regmatch_s
125 regoff_t rm_so; /* offset of start */
126 regoff_t rm_eo; /* offset of end */
127 } regmatch_t;
129 typedef struct regsub_s
131 regflags_t re_flags; /* regsubcomp() flags */
132 char* re_buf; /* regsubexec() output buffer */
133 size_t re_len; /* re_buf length */
134 int re_min; /* regsubcomp() min matches */
135 #ifdef _REG_SUB_PRIVATE_
136 _REG_SUB_PRIVATE_
137 #endif
138 } regsub_t;
140 struct regdisc_s
142 unsigned long re_version; /* discipline version */
143 regflags_t re_flags; /* discipline flags */
144 regerror_t re_errorf; /* error function */
145 int re_errorlevel; /* errorf level */
146 regresize_t re_resizef; /* alloc/free function */
147 __V_* re_resizehandle;/* resizef handle */
148 regcomp_t re_compf; /* (?{...}) compile function */
149 regexec_t re_execf; /* (?{...}) execute function */
150 unsigned char* re_map; /* external to native ccode map */
153 typedef struct regstat_s
155 regflags_t re_flags; /* REG_LEFT|REG_RIGHT */
156 ssize_t re_min; /* min anchored match length */
157 ssize_t re_max; /* max anchored match length */
158 ssize_t re_record; /* regrexec() match length */
159 } regstat_t;
161 struct regex_s
163 size_t re_nsub; /* number of subexpressions */
164 struct reglib_s*re_info; /* library private info */
165 size_t re_npat; /* number of pattern chars used */
166 regdisc_t* re_disc; /* REG_DISCIPLINE discipline */
167 regsub_t* re_sub; /* regsubcomp() data */
170 #define reginit(disc) (memset(disc,0,sizeof(*(disc))),(disc)->re_version=REG_VERSION)
172 #if _BLD_ast && defined(__EXPORT__)
173 #undef __MANGLE__
174 #define __MANGLE__ __LINKAGE__ __EXPORT__
175 #endif
177 extern __MANGLE__ int regcomp __PROTO__((regex_t*, const char*, regflags_t));
178 extern __MANGLE__ size_t regerror __PROTO__((int, const regex_t*, char*, size_t));
179 extern __MANGLE__ int regexec __PROTO__((const regex_t*, const char*, size_t, regmatch_t*, regflags_t));
180 extern __MANGLE__ void regfree __PROTO__((regex_t*));
182 /* nonstandard hooks */
184 #define _REG_cache 1 /* have regcache() */
185 #define _REG_class 1 /* have regclass() */
186 #define _REG_collate 1 /* have regcollate(), regclass() */
187 #define _REG_comb 1 /* have regcomb() */
188 #define _REG_decomp 1 /* have regdecomp() */
189 #define _REG_dup 1 /* have regdup() */
190 #define _REG_fatal 1 /* have regfatal(), regfatalpat() */
191 #define _REG_ncomp 1 /* have regncomp() */
192 #define _REG_nexec 1 /* have regnexec() */
193 #define _REG_rexec 1 /* have regrexec(), regrecord() */
194 #define _REG_stat 1 /* have regstat() */
195 #define _REG_subcomp 1 /* have regsubcomp(), regsubexec() */
197 extern __MANGLE__ regclass_t regclass __PROTO__((const char*, char**));
198 extern __MANGLE__ int regaddclass __PROTO__((const char*, regclass_t));
199 extern __MANGLE__ int regcollate __PROTO__((const char*, char**, char*, int));
200 extern __MANGLE__ int regcomb __PROTO__((regex_t*, regex_t*));
201 extern __MANGLE__ size_t regdecomp __PROTO__((regex_t*, regflags_t, char*, size_t));
202 extern __MANGLE__ int regdup __PROTO__((regex_t*, regex_t*));
203 extern __MANGLE__ int regncomp __PROTO__((regex_t*, const char*, size_t, regflags_t));
204 extern __MANGLE__ int regnexec __PROTO__((const regex_t*, const char*, size_t, size_t, regmatch_t*, regflags_t));
205 extern __MANGLE__ void regfatal __PROTO__((regex_t*, int, int));
206 extern __MANGLE__ void regfatalpat __PROTO__((regex_t*, int, int, const char*));
207 extern __MANGLE__ int regrecord __PROTO__((const regex_t*));
208 extern __MANGLE__ int regrexec __PROTO__((const regex_t*, const char*, size_t, size_t, regmatch_t*, regflags_t, int, __V_*, regrecord_t));
209 extern __MANGLE__ regstat_t* regstat __PROTO__((const regex_t*));
211 extern __MANGLE__ regex_t* regcache __PROTO__((const char*, regflags_t, int*));
213 extern __MANGLE__ int regsubcomp __PROTO__((regex_t*, const char*, const regflags_t*, int, regflags_t));
214 extern __MANGLE__ int regsubexec __PROTO__((const regex_t*, const char*, size_t, regmatch_t*));
215 extern __MANGLE__ int regsubflags __PROTO__((regex_t*, const char*, char**, int, const regflags_t*, int*, regflags_t*));
216 extern __MANGLE__ void regsubfree __PROTO__((regex_t*));
218 /* obsolete hooks */
220 #ifndef _SFIO_H
221 struct _sfio_s;
222 #endif
224 extern __MANGLE__ void regalloc __PROTO__((__V_*, regresize_t, regflags_t));
225 extern __MANGLE__ int regsub __PROTO__((const regex_t*, struct _sfio_s*, const char*, const char*, size_t, regmatch_t*, regflags_t));
227 #undef __MANGLE__
228 #define __MANGLE__ __LINKAGE__
230 #endif