PostgreSQL Source Code: src/include/regex/regex.h Source File (original) (raw)

1#ifndef _PG_REGEX_H_

2#define _PG_REGEX_H_

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45#ifndef _WIN32

47#endif

48

49

50#undef REG_UBACKREF

51#undef REG_ULOOKAROUND

52#undef REG_UBOUNDS

53#undef REG_UBRACES

54#undef REG_UBSALNUM

55#undef REG_UPBOTCH

56#undef REG_UBBS

57#undef REG_UNONPOSIX

58#undef REG_UUNSPEC

59#undef REG_UUNPORT

60#undef REG_ULOCALE

61#undef REG_UEMPTYMATCH

62#undef REG_UIMPOSSIBLE

63#undef REG_USHORTEST

64#undef REG_BASIC

65#undef REG_EXTENDED

66#undef REG_ADVF

67#undef REG_ADVANCED

68#undef REG_QUOTE

69#undef REG_NOSPEC

70#undef REG_ICASE

71#undef REG_NOSUB

72#undef REG_EXPANDED

73#undef REG_NLSTOP

74#undef REG_NLANCH

75#undef REG_NEWLINE

76#undef REG_PEND

77#undef REG_EXPECT

78#undef REG_BOSONLY

79#undef REG_DUMP

80#undef REG_FAKE

81#undef REG_PROGRESS

82#undef REG_NOTBOL

83#undef REG_NOTEOL

84#undef REG_STARTEND

85#undef REG_FTRACE

86#undef REG_MTRACE

87#undef REG_SMALL

88#undef REG_OKAY

89#undef REG_NOMATCH

90#undef REG_BADPAT

91#undef REG_ECOLLATE

92#undef REG_ECTYPE

93#undef REG_EESCAPE

94#undef REG_ESUBREG

95#undef REG_EBRACK

96#undef REG_EPAREN

97#undef REG_EBRACE

98#undef REG_BADBR

99#undef REG_ERANGE

100#undef REG_ESPACE

101#undef REG_BADRPT

102#undef REG_ASSERT

103#undef REG_INVARG

104#undef REG_MIXED

105#undef REG_BADOPT

106#undef REG_ETOOBIG

107#undef REG_ECOLORS

108#undef REG_ATOI

109#undef REG_ITOA

110#undef REG_PREFIX

111#undef REG_EXACT

112

113

114

115

117

118

119

120

121

122

123

124

125

127

128

129

130

131

132

133typedef struct

134{

136 size_t re_nsub;

137 long re_info;

138#define REG_UBACKREF 000001

139#define REG_ULOOKAROUND 000002

140#define REG_UBOUNDS 000004

141#define REG_UBRACES 000010

142#define REG_UBSALNUM 000020

143#define REG_UPBOTCH 000040

144

145#define REG_UBBS 000100

146#define REG_UNONPOSIX 000200

147#define REG_UUNSPEC 000400

148

149#define REG_UUNPORT 001000

150#define REG_ULOCALE 002000

151#define REG_UEMPTYMATCH 004000

152#define REG_UIMPOSSIBLE 010000

153#define REG_USHORTEST 020000

154 int re_csize;

155 char *re_endp;

156 Oid re_collation;

157

158 char *re_guts;

159 char *re_fns;

162

163typedef struct

165 pg_regoff_t rm_so;

166 pg_regoff_t rm_eo;

169

170typedef struct

171{

174

175

176

177

178

180#define REG_BASIC 000000

181#define REG_EXTENDED 000001

182#define REG_ADVF 000002

183#define REG_ADVANCED 000003

184#define REG_QUOTE 000004

185#define REG_NOSPEC REG_QUOTE

186#define REG_ICASE 000010

187#define REG_NOSUB 000020

188#define REG_EXPANDED 000040

189#define REG_NLSTOP 000100

190#define REG_NLANCH 000200

191#define REG_NEWLINE 000300

192#define REG_PEND 000400

193#define REG_EXPECT 001000

194#define REG_BOSONLY 002000

195#define REG_DUMP 004000

196#define REG_FAKE 010000

197#define REG_PROGRESS 020000

198

199

200

201

202

204#define REG_NOTBOL 0001

205#define REG_NOTEOL 0002

206#define REG_STARTEND 0004

207#define REG_FTRACE 0010

208#define REG_MTRACE 0020

209#define REG_SMALL 0040

210

211

212

213

214

215

217#define REG_OKAY 0

218#define REG_NOMATCH 1

219#define REG_BADPAT 2

220#define REG_ECOLLATE 3

221#define REG_ECTYPE 4

222#define REG_EESCAPE 5

223#define REG_ESUBREG 6

224#define REG_EBRACK 7

225#define REG_EPAREN 8

226#define REG_EBRACE 9

227#define REG_BADBR 10

228#define REG_ERANGE 11

229#define REG_ESPACE 12

230#define REG_BADRPT 13

231#define REG_ASSERT 15

232#define REG_INVARG 16

233#define REG_MIXED 17

234#define REG_BADOPT 18

235#define REG_ETOOBIG 19

236#define REG_ECOLORS 20

237

238#define REG_ATOI 101

239#define REG_ITOA 102

240

241#define REG_PREFIX (-1)

242#define REG_EXACT (-2)

243

245

246#define regoff_t pg_regoff_t

247#define regex_t pg_regex_t

248#define regmatch_t pg_regmatch_t

249

250

251

252

253

254

255

257 int flags, Oid collation);

259 size_t search_start, rm_detail_t *details,

260 size_t nmatch, regmatch_t pmatch[], int flags);

264 size_t errbuf_size);

265

266

269 int cflags, Oid collation,

271

272#endif

int errcode(int sqlerrcode)

regex_t * RE_compile_and_cache(text *text_re, int cflags, Oid collation)

bool RE_compile_and_execute(text *text_re, char *dat, int dat_len, int cflags, Oid collation, int nmatch, regmatch_t *pmatch)

size_t pg_regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)

int pg_regprefix(regex_t *re, pg_wchar **string, size_t *slength)

int pg_regcomp(regex_t *re, const pg_wchar *string, size_t len, int flags, Oid collation)

int pg_regexec(regex_t *re, const pg_wchar *string, size_t len, size_t search_start, rm_detail_t *details, size_t nmatch, regmatch_t pmatch[], int flags)

void pg_regfree(regex_t *re)