1#ifndef regexp_h
2#define regexp_h
3
4#define regcompx js_regcompx
5#define regfreex js_regfreex
6#define regcomp js_regcomp
7#define regexec js_regexec
8#define regfree js_regfree
9
10typedef struct Reprog Reprog;
11typedef struct Resub Resub;
12
13Reprog *regcompx(void *(*alloc)(void *ctx, void *p, int n), void *ctx,
14 const char *pattern, int cflags, const char **errorp);
15void regfreex(void *(*alloc)(void *ctx, void *p, int n), void *ctx,
16 Reprog *prog);
17
18Reprog *regcomp(const char *pattern, int cflags, const char **errorp);
19int regexec(Reprog *prog, const char *string, Resub *sub, int eflags);
20void regfree(Reprog *prog);
21
22enum {
23 /* regcomp flags */
24 REG_ICASE = 1,
25 REG_NEWLINE = 2,
26
27 /* regexec flags */
28 REG_NOTBOL = 4,
29
30 /* limits */
31 REG_MAXSUB = 10
32};
33
34struct Resub {
35 int nsub;
36 struct {
37 const char *sp;
38 const char *ep;
39 } sub[REG_MAXSUB];
40};
41
42#endif
43