| 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 | |
| 10 | typedef struct Reprog Reprog; |
| 11 | typedef struct Resub Resub; |
| 12 | |
| 13 | Reprog *regcompx(void *(*alloc)(void *ctx, void *p, int n), void *ctx, |
| 14 | const char *pattern, int cflags, const char **errorp); |
| 15 | void regfreex(void *(*alloc)(void *ctx, void *p, int n), void *ctx, |
| 16 | Reprog *prog); |
| 17 | |
| 18 | Reprog *regcomp(const char *pattern, int cflags, const char **errorp); |
| 19 | int regexec(Reprog *prog, const char *string, Resub *sub, int eflags); |
| 20 | void regfree(Reprog *prog); |
| 21 | |
| 22 | enum { |
| 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 | |
| 34 | struct Resub { |
| 35 | int nsub; |
| 36 | struct { |
| 37 | const char *sp; |
| 38 | const char *ep; |
| 39 | } sub[REG_MAXSUB]; |
| 40 | }; |
| 41 | |
| 42 | #endif |
| 43 | |