1 #ifndef _HSREGEX_H_
2 #define _HSREGEX_H_
3 #ifndef _HSREGEX_H
4 #define _HSREGEX_H
5
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9
10
11 #ifdef WIN32
12 #define API_EXPORT(type) __declspec(dllexport) type __stdcall
13 #elif defined(__GNUC__) && __GNUC__ >= 4
14 #define API_EXPORT(type) __attribute__ ((visibility("default"))) type
15 #else
16 #define API_EXPORT(type) type
17 #endif
18
19 typedef off_t regoff_t;
20 typedef struct {
21 int re_magic;
22 size_t re_nsub;
23 const char *re_endp;
24 struct re_guts *re_g;
25 } regex_t;
26 typedef struct {
27 regoff_t rm_so;
28 regoff_t rm_eo;
29 } regmatch_t;
30
31
32
33 API_EXPORT(int) regcomp(regex_t *, const char *, int);
34 #define REG_BASIC 0000
35 #define REG_EXTENDED 0001
36 #define REG_ICASE 0002
37 #define REG_NOSUB 0004
38 #define REG_NEWLINE 0010
39 #define REG_NOSPEC 0020
40 #define REG_PEND 0040
41 #define REG_DUMP 0200
42
43
44
45 #define REG_OKAY 0
46 #define REG_NOMATCH 1
47 #define REG_BADPAT 2
48 #define REG_ECOLLATE 3
49 #define REG_ECTYPE 4
50 #define REG_EESCAPE 5
51 #define REG_ESUBREG 6
52 #define REG_EBRACK 7
53 #define REG_EPAREN 8
54 #define REG_EBRACE 9
55 #define REG_BADBR 10
56 #define REG_ERANGE 11
57 #define REG_ESPACE 12
58 #define REG_BADRPT 13
59 #define REG_EMPTY 14
60 #define REG_ASSERT 15
61 #define REG_INVARG 16
62 #define REG_ATOI 255
63 #define REG_ITOA 0400
64 API_EXPORT(size_t) regerror(int, const regex_t *, char *, size_t);
65
66
67
68 API_EXPORT(int) regexec(const regex_t *, const char *, size_t, regmatch_t [], int);
69 #define REG_NOTBOL 00001
70 #define REG_NOTEOL 00002
71 #define REG_STARTEND 00004
72 #define REG_TRACE 00400
73 #define REG_LARGE 01000
74 #define REG_BACKR 02000
75
76
77
78 API_EXPORT(void) regfree(regex_t *);
79
80 #ifdef __cplusplus
81 }
82 #endif
83
84 #endif
85 #endif