1 /* $FreeBSD$ */ 2 3 #ifndef FASTMATCH_H 4 #define FASTMATCH_H 1 5 6 #include <limits.h> 7 #include <regex.h> 8 #include <stdbool.h> 9 #include <wchar.h> 10 11 typedef struct { 12 size_t wlen; 13 size_t len; 14 wchar_t *wpattern; 15 bool *wescmap; 16 unsigned int qsBc[UCHAR_MAX + 1]; 17 unsigned int *bmGs; 18 char *pattern; 19 bool *escmap; 20 unsigned int defBc; 21 void *qsBc_table; 22 unsigned int *sbmGs; 23 const char *re_endp; 24 25 /* flags */ 26 bool hasdot; 27 bool bol; 28 bool eol; 29 bool word; 30 bool icase; 31 bool newline; 32 bool nosub; 33 bool matchall; 34 bool reversed; 35 } fastmatch_t; 36 37 extern int 38 tre_fixcomp(fastmatch_t *preg, const char *regex, int cflags); 39 40 extern int 41 tre_fastcomp(fastmatch_t *preg, const char *regex, int cflags); 42 43 extern int 44 tre_fastexec(const fastmatch_t *preg, const char *string, size_t nmatch, 45 regmatch_t pmatch[], int eflags); 46 47 extern void 48 tre_fastfree(fastmatch_t *preg); 49 50 extern int 51 tre_fixwcomp(fastmatch_t *preg, const wchar_t *regex, int cflags); 52 53 extern int 54 tre_fastwcomp(fastmatch_t *preg, const wchar_t *regex, int cflags); 55 56 extern int 57 tre_fastwexec(const fastmatch_t *preg, const wchar_t *string, 58 size_t nmatch, regmatch_t pmatch[], int eflags); 59 60 /* Versions with a maximum length argument and therefore the capability to 61 handle null characters in the middle of the strings. */ 62 extern int 63 tre_fixncomp(fastmatch_t *preg, const char *regex, size_t len, int cflags); 64 65 extern int 66 tre_fastncomp(fastmatch_t *preg, const char *regex, size_t len, int cflags); 67 68 extern int 69 tre_fastnexec(const fastmatch_t *preg, const char *string, size_t len, 70 size_t nmatch, regmatch_t pmatch[], int eflags); 71 72 extern int 73 tre_fixwncomp(fastmatch_t *preg, const wchar_t *regex, size_t len, int cflags); 74 75 extern int 76 tre_fastwncomp(fastmatch_t *preg, const wchar_t *regex, size_t len, int cflags); 77 78 extern int 79 tre_fastwnexec(const fastmatch_t *preg, const wchar_t *string, size_t len, 80 size_t nmatch, regmatch_t pmatch[], int eflags); 81 82 #define fixncomp tre_fixncomp 83 #define fastncomp tre_fastncomp 84 #define fixcomp tre_fixcomp 85 #define fastcomp tre_fastcomp 86 #define fixwncomp tre_fixwncomp 87 #define fastwncomp tre_fastwncomp 88 #define fixwcomp tre_fixwcomp 89 #define fastwcomp tre_fastwcomp 90 #define fastfree tre_fastfree 91 #define fastnexec tre_fastnexec 92 #define fastexec tre_fastexec 93 #define fastwnexec tre_fastwnexec 94 #define fastwexec tre_fastwexec 95 #define fixcomp tre_fixcomp 96 #define fastcomp tre_fastcomp 97 #define fastexec tre_fastexec 98 #define fastfree tre_fastfree 99 #define fixwcomp tre_fixwcomp 100 #define fastwcomp tre_fastwcomp 101 #define fastwexec tre_fastwexec 102 #define fixncomp tre_fixncomp 103 #define fastncomp tre_fastncomp 104 #define fastnexec tre_fastnexec 105 #define fixwncomp tre_fixwncomp 106 #define fastwncomp tre_fastwncomp 107 #define fastwnexec tre_fastwnexec 108 #endif /* FASTMATCH_H */ 109