1 #ifndef __lwre_h_ 2 #define __lwre_h_ 3 4 #include <setjmp.h> 5 #include <ejdb2/iowow/basedefs.h> 6 7 struct RE_Insn; 8 9 struct RE_Compiled { 10 int size; 11 struct RE_Insn *first; 12 struct RE_Insn *last; 13 }; 14 15 #define RE_COMPILED_INITIALISER { 0, 0, 0 } 16 17 struct re { 18 const char *expression; 19 const char *position; 20 jmp_buf *error_env; 21 int error_code; 22 char *error_message; 23 struct RE_Compiled code; 24 char **matches; 25 int nmatches; 26 #ifdef RE_EXTRA_MEMBERS 27 RE_MEMBERS 28 #endif 29 }; 30 31 #define RE_INITIALISER(EXPR) { (EXPR), 0, 0, 0, 0, RE_COMPILED_INITIALISER, 0, 0 } 32 33 #define RE_ERROR_NONE 0 34 #define RE_ERROR_NOMATCH -1 35 #define RE_ERROR_NOMEM -2 36 #define RE_ERROR_CHARSET -3 37 #define RE_ERROR_SUBEXP -4 38 #define RE_ERROR_SUBMATCH -5 39 #define RE_ERROR_ENGINE -6 40 41 IW_EXPORT struct re *lwre_new(const char *expression); 42 IW_EXPORT int lwre_match(struct re *re, char *input); 43 IW_EXPORT void lwre_release(struct re *re); 44 IW_EXPORT void lwre_reset(struct re *re, const char *expression); 45 IW_EXPORT void lwre_free(struct re *re); 46 IW_EXPORT char *lwre_escape(char *string, int liberal); 47 48 #endif /* __lwre_h_ */ 49