13 #define TRE_MULTIBYTE 1
14 #define HAVE_MBSTATE_T 1
16 #define TRE_CHAR(n) L##n
19 #define tre_char_t wchar_t
20 #define tre_mbrtowc(pwc, s, n, ps) (mbrtowc((pwc), (s), (n), (ps)))
21 #define tre_strlen wcslen
22 #define tre_isspace iswspace
23 #define tre_isalnum iswalnum
26 #define REG_LITERAL 0020
30 #define TRE_MB_CUR_MAX MB_CUR_MAX
35 #define DPRINT(msg) do {printf msg; fflush(stdout);} while(/*CONSTCOND*/0)
38 #define MIN(a,b) ((a > b) ? (b) : (a))
39 #define MAX(a,b) ((a > b) ? (a) : (b))
41 typedef enum { STR_WIDE, STR_BYTE, STR_MBS, STR_USER } tre_str_type_t;
43 #define CALL_WITH_OFFSET(fn) \
46 size_t slen = (size_t)(pmatch[0].rm_eo - pmatch[0].rm_so); \
47 size_t offset = pmatch[0].rm_so; \
50 if ((long long)pmatch[0].rm_eo - pmatch[0].rm_so < 0) \
53 for (unsigned i = 0; (!(eflags & REG_NOSUB) && (i < nmatch)); i++)\
55 pmatch[i].rm_so += offset; \
56 pmatch[i].rm_eo += offset; \
59 } while (0 /*CONSTCOND*/)
62 tre_convert_pattern(const char *regex, size_t n, tre_char_t **w,
66 tre_free_pattern(tre_char_t *wregex);