1 #ifndef _REGEX_H 2 #define _REGEX_H 3 4 #ifdef __cplusplus 5 extern "C" { 6 #endif 7 8 // #include <features.h> 9 10 // #define __NEED_regoff_t 11 // #define __NEED_size_t 12 #define CHARCLASS_NAME_MAX 14 13 #define RE_DUP_MAX 255 14 15 #include <BaseTsd.h> 16 typedef SSIZE_T regoff_t; 17 // #include <bits/alltypes.h> 18 19 typedef struct re_pattern_buffer { 20 size_t re_nsub; 21 void *__opaque, *__padding[4]; 22 size_t __nsub2; 23 char __padding2; 24 } regex_t; 25 26 typedef struct { 27 regoff_t rm_so; 28 regoff_t rm_eo; 29 } regmatch_t; 30 31 #define REG_EXTENDED 1 32 #define REG_ICASE 2 33 #define REG_NEWLINE 4 34 #define REG_NOSUB 8 35 36 #define REG_NOTBOL 1 37 #define REG_NOTEOL 2 38 39 #define REG_OK 0 40 #define REG_NOMATCH 1 41 #define REG_BADPAT 2 42 #define REG_ECOLLATE 3 43 #define REG_ECTYPE 4 44 #define REG_EESCAPE 5 45 #define REG_ESUBREG 6 46 #define REG_EBRACK 7 47 #define REG_EPAREN 8 48 #define REG_EBRACE 9 49 #define REG_BADBR 10 50 #define REG_ERANGE 11 51 #define REG_ESPACE 12 52 #define REG_BADRPT 13 53 54 #define REG_ENOSYS -1 55 56 int regcomp(regex_t *__restrict, const char *__restrict, int); 57 int regexec(const regex_t *__restrict, const char *__restrict, size_t, regmatch_t *__restrict, int); 58 void regfree(regex_t *); 59 60 size_t regerror(int, const regex_t *__restrict, char *__restrict, size_t); 61 62 #ifdef __cplusplus 63 } 64 #endif 65 66 #endif