Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/pcre2/src/pcre2.h
21758 views
1
/*************************************************
2
* Perl-Compatible Regular Expressions *
3
*************************************************/
4
5
/* This is the public header file for the PCRE library, second API, to be
6
#included by applications that call PCRE2 functions.
7
8
Copyright (c) 2016-2024 University of Cambridge
9
10
-----------------------------------------------------------------------------
11
Redistribution and use in source and binary forms, with or without
12
modification, are permitted provided that the following conditions are met:
13
14
* Redistributions of source code must retain the above copyright notice,
15
this list of conditions and the following disclaimer.
16
17
* Redistributions in binary form must reproduce the above copyright
18
notice, this list of conditions and the following disclaimer in the
19
documentation and/or other materials provided with the distribution.
20
21
* Neither the name of the University of Cambridge nor the names of its
22
contributors may be used to endorse or promote products derived from
23
this software without specific prior written permission.
24
25
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35
POSSIBILITY OF SUCH DAMAGE.
36
-----------------------------------------------------------------------------
37
*/
38
39
#ifndef PCRE2_H_IDEMPOTENT_GUARD
40
#define PCRE2_H_IDEMPOTENT_GUARD
41
42
/* The current PCRE version information. */
43
44
#define PCRE2_MAJOR 10
45
#define PCRE2_MINOR 47
46
#define PCRE2_PRERELEASE
47
#define PCRE2_DATE 2025-10-21
48
49
/* When an application links to a PCRE2 DLL in Windows, the symbols that are
50
imported have to be identified as such. When building PCRE2, the appropriate
51
export setting is defined in pcre2_internal.h, which includes this file. So, we
52
don't change existing definitions of PCRE2_EXP_DECL.
53
54
By default, we use the standard "extern" declarations. */
55
56
#ifndef PCRE2_EXP_DECL
57
# if defined(_WIN32) && !defined(PCRE2_STATIC)
58
# define PCRE2_EXP_DECL extern __declspec(dllimport)
59
# elif defined __cplusplus
60
# define PCRE2_EXP_DECL extern "C"
61
# else
62
# define PCRE2_EXP_DECL extern
63
# endif
64
#endif
65
66
/* When compiling with the MSVC compiler, it is sometimes necessary to include
67
a "calling convention" before exported function names. For example:
68
69
void __cdecl function(....)
70
71
might be needed. In order to make this easy, all the exported functions have
72
PCRE2_CALL_CONVENTION just before their names.
73
74
PCRE2 normally uses the platform's standard calling convention, so this should
75
not be set unless you know you need it. */
76
77
#ifndef PCRE2_CALL_CONVENTION
78
#define PCRE2_CALL_CONVENTION
79
#endif
80
81
/* Have to include limits.h, stdlib.h, and inttypes.h to ensure that size_t and
82
uint8_t, UCHAR_MAX, etc are defined. Some systems that do have inttypes.h do
83
not have stdint.h, which is why we use inttypes.h, which according to the C
84
standard is a superset of stdint.h. If inttypes.h is not available the build
85
will break and the relevant values must be provided by some other means. */
86
87
#include <limits.h>
88
#include <stdlib.h>
89
#include <inttypes.h>
90
91
/* Allow for C++ users compiling this directly. */
92
93
#ifdef __cplusplus
94
extern "C" {
95
#endif
96
97
/* The following option bits can be passed to pcre2_compile(), pcre2_match(),
98
or pcre2_dfa_match(). PCRE2_NO_UTF_CHECK affects only the function to which it
99
is passed. Put these bits at the most significant end of the options word so
100
others can be added next to them */
101
102
#define PCRE2_ANCHORED 0x80000000u
103
#define PCRE2_NO_UTF_CHECK 0x40000000u
104
#define PCRE2_ENDANCHORED 0x20000000u
105
106
/* The following option bits can be passed only to pcre2_compile(). However,
107
they may affect compilation, JIT compilation, and/or interpretive execution.
108
The following tags indicate which:
109
110
C alters what is compiled by pcre2_compile()
111
J alters what is compiled by pcre2_jit_compile()
112
M is inspected during pcre2_match() execution
113
D is inspected during pcre2_dfa_match() execution
114
*/
115
116
#define PCRE2_ALLOW_EMPTY_CLASS 0x00000001u /* C */
117
#define PCRE2_ALT_BSUX 0x00000002u /* C */
118
#define PCRE2_AUTO_CALLOUT 0x00000004u /* C */
119
#define PCRE2_CASELESS 0x00000008u /* C */
120
#define PCRE2_DOLLAR_ENDONLY 0x00000010u /* J M D */
121
#define PCRE2_DOTALL 0x00000020u /* C */
122
#define PCRE2_DUPNAMES 0x00000040u /* C */
123
#define PCRE2_EXTENDED 0x00000080u /* C */
124
#define PCRE2_FIRSTLINE 0x00000100u /* J M D */
125
#define PCRE2_MATCH_UNSET_BACKREF 0x00000200u /* C J M */
126
#define PCRE2_MULTILINE 0x00000400u /* C */
127
#define PCRE2_NEVER_UCP 0x00000800u /* C */
128
#define PCRE2_NEVER_UTF 0x00001000u /* C */
129
#define PCRE2_NO_AUTO_CAPTURE 0x00002000u /* C */
130
#define PCRE2_NO_AUTO_POSSESS 0x00004000u /* C */
131
#define PCRE2_NO_DOTSTAR_ANCHOR 0x00008000u /* C */
132
#define PCRE2_NO_START_OPTIMIZE 0x00010000u /* J M D */
133
#define PCRE2_UCP 0x00020000u /* C J M D */
134
#define PCRE2_UNGREEDY 0x00040000u /* C */
135
#define PCRE2_UTF 0x00080000u /* C J M D */
136
#define PCRE2_NEVER_BACKSLASH_C 0x00100000u /* C */
137
#define PCRE2_ALT_CIRCUMFLEX 0x00200000u /* J M D */
138
#define PCRE2_ALT_VERBNAMES 0x00400000u /* C */
139
#define PCRE2_USE_OFFSET_LIMIT 0x00800000u /* J M D */
140
#define PCRE2_EXTENDED_MORE 0x01000000u /* C */
141
#define PCRE2_LITERAL 0x02000000u /* C */
142
#define PCRE2_MATCH_INVALID_UTF 0x04000000u /* J M D */
143
#define PCRE2_ALT_EXTENDED_CLASS 0x08000000u /* C */
144
145
/* An additional compile options word is available in the compile context. */
146
147
#define PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES 0x00000001u /* C */
148
#define PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL 0x00000002u /* C */
149
#define PCRE2_EXTRA_MATCH_WORD 0x00000004u /* C */
150
#define PCRE2_EXTRA_MATCH_LINE 0x00000008u /* C */
151
#define PCRE2_EXTRA_ESCAPED_CR_IS_LF 0x00000010u /* C */
152
#define PCRE2_EXTRA_ALT_BSUX 0x00000020u /* C */
153
#define PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK 0x00000040u /* C */
154
#define PCRE2_EXTRA_CASELESS_RESTRICT 0x00000080u /* C */
155
#define PCRE2_EXTRA_ASCII_BSD 0x00000100u /* C */
156
#define PCRE2_EXTRA_ASCII_BSS 0x00000200u /* C */
157
#define PCRE2_EXTRA_ASCII_BSW 0x00000400u /* C */
158
#define PCRE2_EXTRA_ASCII_POSIX 0x00000800u /* C */
159
#define PCRE2_EXTRA_ASCII_DIGIT 0x00001000u /* C */
160
#define PCRE2_EXTRA_PYTHON_OCTAL 0x00002000u /* C */
161
#define PCRE2_EXTRA_NO_BS0 0x00004000u /* C */
162
#define PCRE2_EXTRA_NEVER_CALLOUT 0x00008000u /* C */
163
#define PCRE2_EXTRA_TURKISH_CASING 0x00010000u /* C */
164
165
/* These are for pcre2_jit_compile(). */
166
167
#define PCRE2_JIT_COMPLETE 0x00000001u /* For full matching */
168
#define PCRE2_JIT_PARTIAL_SOFT 0x00000002u
169
#define PCRE2_JIT_PARTIAL_HARD 0x00000004u
170
#define PCRE2_JIT_INVALID_UTF 0x00000100u
171
#define PCRE2_JIT_TEST_ALLOC 0x00000200u
172
173
/* These are for pcre2_match(), pcre2_dfa_match(), pcre2_jit_match(), and
174
pcre2_substitute(). Some are allowed only for one of the functions, and in
175
these cases it is noted below. Note that PCRE2_ANCHORED, PCRE2_ENDANCHORED and
176
PCRE2_NO_UTF_CHECK can also be passed to these functions (though
177
pcre2_jit_match() ignores the latter since it bypasses all sanity checks). */
178
179
#define PCRE2_NOTBOL 0x00000001u
180
#define PCRE2_NOTEOL 0x00000002u
181
#define PCRE2_NOTEMPTY 0x00000004u /* ) These two must be kept */
182
#define PCRE2_NOTEMPTY_ATSTART 0x00000008u /* ) adjacent to each other. */
183
#define PCRE2_PARTIAL_SOFT 0x00000010u
184
#define PCRE2_PARTIAL_HARD 0x00000020u
185
#define PCRE2_DFA_RESTART 0x00000040u /* pcre2_dfa_match() only */
186
#define PCRE2_DFA_SHORTEST 0x00000080u /* pcre2_dfa_match() only */
187
#define PCRE2_SUBSTITUTE_GLOBAL 0x00000100u /* pcre2_substitute() only */
188
#define PCRE2_SUBSTITUTE_EXTENDED 0x00000200u /* pcre2_substitute() only */
189
#define PCRE2_SUBSTITUTE_UNSET_EMPTY 0x00000400u /* pcre2_substitute() only */
190
#define PCRE2_SUBSTITUTE_UNKNOWN_UNSET 0x00000800u /* pcre2_substitute() only */
191
#define PCRE2_SUBSTITUTE_OVERFLOW_LENGTH 0x00001000u /* pcre2_substitute() only */
192
#define PCRE2_NO_JIT 0x00002000u /* not for pcre2_dfa_match() */
193
#define PCRE2_COPY_MATCHED_SUBJECT 0x00004000u
194
#define PCRE2_SUBSTITUTE_LITERAL 0x00008000u /* pcre2_substitute() only */
195
#define PCRE2_SUBSTITUTE_MATCHED 0x00010000u /* pcre2_substitute() only */
196
#define PCRE2_SUBSTITUTE_REPLACEMENT_ONLY 0x00020000u /* pcre2_substitute() only */
197
#define PCRE2_DISABLE_RECURSELOOP_CHECK 0x00040000u /* not for pcre2_dfa_match() or pcre2_jit_match() */
198
199
/* Options for pcre2_pattern_convert(). */
200
201
#define PCRE2_CONVERT_UTF 0x00000001u
202
#define PCRE2_CONVERT_NO_UTF_CHECK 0x00000002u
203
#define PCRE2_CONVERT_POSIX_BASIC 0x00000004u
204
#define PCRE2_CONVERT_POSIX_EXTENDED 0x00000008u
205
#define PCRE2_CONVERT_GLOB 0x00000010u
206
#define PCRE2_CONVERT_GLOB_NO_WILD_SEPARATOR 0x00000030u
207
#define PCRE2_CONVERT_GLOB_NO_STARSTAR 0x00000050u
208
209
/* Newline and \R settings, for use in compile contexts. The newline values
210
must be kept in step with values set in config.h and both sets must all be
211
greater than zero. */
212
213
#define PCRE2_NEWLINE_CR 1
214
#define PCRE2_NEWLINE_LF 2
215
#define PCRE2_NEWLINE_CRLF 3
216
#define PCRE2_NEWLINE_ANY 4
217
#define PCRE2_NEWLINE_ANYCRLF 5
218
#define PCRE2_NEWLINE_NUL 6
219
220
#define PCRE2_BSR_UNICODE 1
221
#define PCRE2_BSR_ANYCRLF 2
222
223
/* Error codes for pcre2_compile(). Some of these are also used by
224
pcre2_pattern_convert(). */
225
226
#define PCRE2_ERROR_END_BACKSLASH 101
227
#define PCRE2_ERROR_END_BACKSLASH_C 102
228
#define PCRE2_ERROR_UNKNOWN_ESCAPE 103
229
#define PCRE2_ERROR_QUANTIFIER_OUT_OF_ORDER 104
230
#define PCRE2_ERROR_QUANTIFIER_TOO_BIG 105
231
#define PCRE2_ERROR_MISSING_SQUARE_BRACKET 106
232
#define PCRE2_ERROR_ESCAPE_INVALID_IN_CLASS 107
233
#define PCRE2_ERROR_CLASS_RANGE_ORDER 108
234
#define PCRE2_ERROR_QUANTIFIER_INVALID 109
235
#define PCRE2_ERROR_INTERNAL_UNEXPECTED_REPEAT 110
236
#define PCRE2_ERROR_INVALID_AFTER_PARENS_QUERY 111
237
#define PCRE2_ERROR_POSIX_CLASS_NOT_IN_CLASS 112
238
#define PCRE2_ERROR_POSIX_NO_SUPPORT_COLLATING 113
239
#define PCRE2_ERROR_MISSING_CLOSING_PARENTHESIS 114
240
#define PCRE2_ERROR_BAD_SUBPATTERN_REFERENCE 115
241
#define PCRE2_ERROR_NULL_PATTERN 116
242
#define PCRE2_ERROR_BAD_OPTIONS 117
243
#define PCRE2_ERROR_MISSING_COMMENT_CLOSING 118
244
#define PCRE2_ERROR_PARENTHESES_NEST_TOO_DEEP 119
245
#define PCRE2_ERROR_PATTERN_TOO_LARGE 120
246
#define PCRE2_ERROR_HEAP_FAILED 121
247
#define PCRE2_ERROR_UNMATCHED_CLOSING_PARENTHESIS 122
248
#define PCRE2_ERROR_INTERNAL_CODE_OVERFLOW 123
249
#define PCRE2_ERROR_MISSING_CONDITION_CLOSING 124
250
#define PCRE2_ERROR_LOOKBEHIND_NOT_FIXED_LENGTH 125
251
#define PCRE2_ERROR_ZERO_RELATIVE_REFERENCE 126
252
#define PCRE2_ERROR_TOO_MANY_CONDITION_BRANCHES 127
253
#define PCRE2_ERROR_CONDITION_ASSERTION_EXPECTED 128
254
#define PCRE2_ERROR_BAD_RELATIVE_REFERENCE 129
255
#define PCRE2_ERROR_UNKNOWN_POSIX_CLASS 130
256
#define PCRE2_ERROR_INTERNAL_STUDY_ERROR 131
257
#define PCRE2_ERROR_UNICODE_NOT_SUPPORTED 132
258
#define PCRE2_ERROR_PARENTHESES_STACK_CHECK 133
259
#define PCRE2_ERROR_CODE_POINT_TOO_BIG 134
260
#define PCRE2_ERROR_LOOKBEHIND_TOO_COMPLICATED 135
261
#define PCRE2_ERROR_LOOKBEHIND_INVALID_BACKSLASH_C 136
262
#define PCRE2_ERROR_UNSUPPORTED_ESCAPE_SEQUENCE 137
263
#define PCRE2_ERROR_CALLOUT_NUMBER_TOO_BIG 138
264
#define PCRE2_ERROR_MISSING_CALLOUT_CLOSING 139
265
#define PCRE2_ERROR_ESCAPE_INVALID_IN_VERB 140
266
#define PCRE2_ERROR_UNRECOGNIZED_AFTER_QUERY_P 141
267
#define PCRE2_ERROR_MISSING_NAME_TERMINATOR 142
268
#define PCRE2_ERROR_DUPLICATE_SUBPATTERN_NAME 143
269
#define PCRE2_ERROR_INVALID_SUBPATTERN_NAME 144
270
#define PCRE2_ERROR_UNICODE_PROPERTIES_UNAVAILABLE 145
271
#define PCRE2_ERROR_MALFORMED_UNICODE_PROPERTY 146
272
#define PCRE2_ERROR_UNKNOWN_UNICODE_PROPERTY 147
273
#define PCRE2_ERROR_SUBPATTERN_NAME_TOO_LONG 148
274
#define PCRE2_ERROR_TOO_MANY_NAMED_SUBPATTERNS 149
275
#define PCRE2_ERROR_CLASS_INVALID_RANGE 150
276
#define PCRE2_ERROR_OCTAL_BYTE_TOO_BIG 151
277
#define PCRE2_ERROR_INTERNAL_OVERRAN_WORKSPACE 152
278
#define PCRE2_ERROR_INTERNAL_MISSING_SUBPATTERN 153
279
#define PCRE2_ERROR_DEFINE_TOO_MANY_BRANCHES 154
280
#define PCRE2_ERROR_BACKSLASH_O_MISSING_BRACE 155
281
#define PCRE2_ERROR_INTERNAL_UNKNOWN_NEWLINE 156
282
#define PCRE2_ERROR_BACKSLASH_G_SYNTAX 157
283
#define PCRE2_ERROR_PARENS_QUERY_R_MISSING_CLOSING 158
284
/* Error 159 is obsolete and should now never occur */
285
#define PCRE2_ERROR_VERB_ARGUMENT_NOT_ALLOWED 159
286
#define PCRE2_ERROR_VERB_UNKNOWN 160
287
#define PCRE2_ERROR_SUBPATTERN_NUMBER_TOO_BIG 161
288
#define PCRE2_ERROR_SUBPATTERN_NAME_EXPECTED 162
289
#define PCRE2_ERROR_INTERNAL_PARSED_OVERFLOW 163
290
#define PCRE2_ERROR_INVALID_OCTAL 164
291
#define PCRE2_ERROR_SUBPATTERN_NAMES_MISMATCH 165
292
#define PCRE2_ERROR_MARK_MISSING_ARGUMENT 166
293
#define PCRE2_ERROR_INVALID_HEXADECIMAL 167
294
#define PCRE2_ERROR_BACKSLASH_C_SYNTAX 168
295
#define PCRE2_ERROR_BACKSLASH_K_SYNTAX 169
296
#define PCRE2_ERROR_INTERNAL_BAD_CODE_LOOKBEHINDS 170
297
#define PCRE2_ERROR_BACKSLASH_N_IN_CLASS 171
298
#define PCRE2_ERROR_CALLOUT_STRING_TOO_LONG 172
299
#define PCRE2_ERROR_UNICODE_DISALLOWED_CODE_POINT 173
300
#define PCRE2_ERROR_UTF_IS_DISABLED 174
301
#define PCRE2_ERROR_UCP_IS_DISABLED 175
302
#define PCRE2_ERROR_VERB_NAME_TOO_LONG 176
303
#define PCRE2_ERROR_BACKSLASH_U_CODE_POINT_TOO_BIG 177
304
#define PCRE2_ERROR_MISSING_OCTAL_OR_HEX_DIGITS 178
305
#define PCRE2_ERROR_VERSION_CONDITION_SYNTAX 179
306
#define PCRE2_ERROR_INTERNAL_BAD_CODE_AUTO_POSSESS 180
307
#define PCRE2_ERROR_CALLOUT_NO_STRING_DELIMITER 181
308
#define PCRE2_ERROR_CALLOUT_BAD_STRING_DELIMITER 182
309
#define PCRE2_ERROR_BACKSLASH_C_CALLER_DISABLED 183
310
#define PCRE2_ERROR_QUERY_BARJX_NEST_TOO_DEEP 184
311
#define PCRE2_ERROR_BACKSLASH_C_LIBRARY_DISABLED 185
312
#define PCRE2_ERROR_PATTERN_TOO_COMPLICATED 186
313
#define PCRE2_ERROR_LOOKBEHIND_TOO_LONG 187
314
#define PCRE2_ERROR_PATTERN_STRING_TOO_LONG 188
315
#define PCRE2_ERROR_INTERNAL_BAD_CODE 189
316
#define PCRE2_ERROR_INTERNAL_BAD_CODE_IN_SKIP 190
317
#define PCRE2_ERROR_NO_SURROGATES_IN_UTF16 191
318
#define PCRE2_ERROR_BAD_LITERAL_OPTIONS 192
319
#define PCRE2_ERROR_SUPPORTED_ONLY_IN_UNICODE 193
320
#define PCRE2_ERROR_INVALID_HYPHEN_IN_OPTIONS 194
321
#define PCRE2_ERROR_ALPHA_ASSERTION_UNKNOWN 195
322
#define PCRE2_ERROR_SCRIPT_RUN_NOT_AVAILABLE 196
323
#define PCRE2_ERROR_TOO_MANY_CAPTURES 197
324
#define PCRE2_ERROR_MISSING_OCTAL_DIGIT 198
325
#define PCRE2_ERROR_BACKSLASH_K_IN_LOOKAROUND 199
326
#define PCRE2_ERROR_MAX_VAR_LOOKBEHIND_EXCEEDED 200
327
#define PCRE2_ERROR_PATTERN_COMPILED_SIZE_TOO_BIG 201
328
#define PCRE2_ERROR_OVERSIZE_PYTHON_OCTAL 202
329
#define PCRE2_ERROR_CALLOUT_CALLER_DISABLED 203
330
#define PCRE2_ERROR_EXTRA_CASING_REQUIRES_UNICODE 204
331
#define PCRE2_ERROR_TURKISH_CASING_REQUIRES_UTF 205
332
#define PCRE2_ERROR_EXTRA_CASING_INCOMPATIBLE 206
333
#define PCRE2_ERROR_ECLASS_NEST_TOO_DEEP 207
334
#define PCRE2_ERROR_ECLASS_INVALID_OPERATOR 208
335
#define PCRE2_ERROR_ECLASS_UNEXPECTED_OPERATOR 209
336
#define PCRE2_ERROR_ECLASS_EXPECTED_OPERAND 210
337
#define PCRE2_ERROR_ECLASS_MIXED_OPERATORS 211
338
#define PCRE2_ERROR_ECLASS_HINT_SQUARE_BRACKET 212
339
#define PCRE2_ERROR_PERL_ECLASS_UNEXPECTED_EXPR 213
340
#define PCRE2_ERROR_PERL_ECLASS_EMPTY_EXPR 214
341
#define PCRE2_ERROR_PERL_ECLASS_MISSING_CLOSE 215
342
#define PCRE2_ERROR_PERL_ECLASS_UNEXPECTED_CHAR 216
343
#define PCRE2_ERROR_EXPECTED_CAPTURE_GROUP 217
344
#define PCRE2_ERROR_MISSING_OPENING_PARENTHESIS 218
345
#define PCRE2_ERROR_MISSING_NUMBER_TERMINATOR 219
346
#define PCRE2_ERROR_NULL_ERROROFFSET 220
347
348
/* "Expected" matching error codes: no match and partial match. */
349
350
#define PCRE2_ERROR_NOMATCH (-1)
351
#define PCRE2_ERROR_PARTIAL (-2)
352
353
/* Error codes for UTF-8 validity checks */
354
355
#define PCRE2_ERROR_UTF8_ERR1 (-3)
356
#define PCRE2_ERROR_UTF8_ERR2 (-4)
357
#define PCRE2_ERROR_UTF8_ERR3 (-5)
358
#define PCRE2_ERROR_UTF8_ERR4 (-6)
359
#define PCRE2_ERROR_UTF8_ERR5 (-7)
360
#define PCRE2_ERROR_UTF8_ERR6 (-8)
361
#define PCRE2_ERROR_UTF8_ERR7 (-9)
362
#define PCRE2_ERROR_UTF8_ERR8 (-10)
363
#define PCRE2_ERROR_UTF8_ERR9 (-11)
364
#define PCRE2_ERROR_UTF8_ERR10 (-12)
365
#define PCRE2_ERROR_UTF8_ERR11 (-13)
366
#define PCRE2_ERROR_UTF8_ERR12 (-14)
367
#define PCRE2_ERROR_UTF8_ERR13 (-15)
368
#define PCRE2_ERROR_UTF8_ERR14 (-16)
369
#define PCRE2_ERROR_UTF8_ERR15 (-17)
370
#define PCRE2_ERROR_UTF8_ERR16 (-18)
371
#define PCRE2_ERROR_UTF8_ERR17 (-19)
372
#define PCRE2_ERROR_UTF8_ERR18 (-20)
373
#define PCRE2_ERROR_UTF8_ERR19 (-21)
374
#define PCRE2_ERROR_UTF8_ERR20 (-22)
375
#define PCRE2_ERROR_UTF8_ERR21 (-23)
376
377
/* Error codes for UTF-16 validity checks */
378
379
#define PCRE2_ERROR_UTF16_ERR1 (-24)
380
#define PCRE2_ERROR_UTF16_ERR2 (-25)
381
#define PCRE2_ERROR_UTF16_ERR3 (-26)
382
383
/* Error codes for UTF-32 validity checks */
384
385
#define PCRE2_ERROR_UTF32_ERR1 (-27)
386
#define PCRE2_ERROR_UTF32_ERR2 (-28)
387
388
/* Miscellaneous error codes for pcre2[_dfa]_match(), substring extraction
389
functions, context functions, and serializing functions. They are in numerical
390
order. Originally they were in alphabetical order too, but now that PCRE2 is
391
released, the numbers must not be changed. */
392
393
#define PCRE2_ERROR_BADDATA (-29)
394
#define PCRE2_ERROR_MIXEDTABLES (-30) /* Name was changed */
395
#define PCRE2_ERROR_BADMAGIC (-31)
396
#define PCRE2_ERROR_BADMODE (-32)
397
#define PCRE2_ERROR_BADOFFSET (-33)
398
#define PCRE2_ERROR_BADOPTION (-34)
399
#define PCRE2_ERROR_BADREPLACEMENT (-35)
400
#define PCRE2_ERROR_BADUTFOFFSET (-36)
401
#define PCRE2_ERROR_CALLOUT (-37) /* Never used by PCRE2 itself */
402
#define PCRE2_ERROR_DFA_BADRESTART (-38)
403
#define PCRE2_ERROR_DFA_RECURSE (-39)
404
#define PCRE2_ERROR_DFA_UCOND (-40)
405
#define PCRE2_ERROR_DFA_UFUNC (-41)
406
#define PCRE2_ERROR_DFA_UITEM (-42)
407
#define PCRE2_ERROR_DFA_WSSIZE (-43)
408
#define PCRE2_ERROR_INTERNAL (-44)
409
#define PCRE2_ERROR_JIT_BADOPTION (-45)
410
#define PCRE2_ERROR_JIT_STACKLIMIT (-46)
411
#define PCRE2_ERROR_MATCHLIMIT (-47)
412
#define PCRE2_ERROR_NOMEMORY (-48)
413
#define PCRE2_ERROR_NOSUBSTRING (-49)
414
#define PCRE2_ERROR_NOUNIQUESUBSTRING (-50)
415
#define PCRE2_ERROR_NULL (-51)
416
#define PCRE2_ERROR_RECURSELOOP (-52)
417
#define PCRE2_ERROR_DEPTHLIMIT (-53)
418
#define PCRE2_ERROR_RECURSIONLIMIT (-53) /* Obsolete synonym */
419
#define PCRE2_ERROR_UNAVAILABLE (-54)
420
#define PCRE2_ERROR_UNSET (-55)
421
#define PCRE2_ERROR_BADOFFSETLIMIT (-56)
422
#define PCRE2_ERROR_BADREPESCAPE (-57)
423
#define PCRE2_ERROR_REPMISSINGBRACE (-58)
424
#define PCRE2_ERROR_BADSUBSTITUTION (-59)
425
#define PCRE2_ERROR_BADSUBSPATTERN (-60)
426
#define PCRE2_ERROR_TOOMANYREPLACE (-61)
427
#define PCRE2_ERROR_BADSERIALIZEDDATA (-62)
428
#define PCRE2_ERROR_HEAPLIMIT (-63)
429
#define PCRE2_ERROR_CONVERT_SYNTAX (-64)
430
#define PCRE2_ERROR_INTERNAL_DUPMATCH (-65)
431
#define PCRE2_ERROR_DFA_UINVALID_UTF (-66)
432
#define PCRE2_ERROR_INVALIDOFFSET (-67)
433
#define PCRE2_ERROR_JIT_UNSUPPORTED (-68)
434
#define PCRE2_ERROR_REPLACECASE (-69)
435
#define PCRE2_ERROR_TOOLARGEREPLACE (-70)
436
#define PCRE2_ERROR_DIFFSUBSPATTERN (-71)
437
#define PCRE2_ERROR_DIFFSUBSSUBJECT (-72)
438
#define PCRE2_ERROR_DIFFSUBSOFFSET (-73)
439
#define PCRE2_ERROR_DIFFSUBSOPTIONS (-74)
440
#define PCRE2_ERROR_BAD_BACKSLASH_K (-75)
441
442
443
/* Request types for pcre2_pattern_info() */
444
445
#define PCRE2_INFO_ALLOPTIONS 0
446
#define PCRE2_INFO_ARGOPTIONS 1
447
#define PCRE2_INFO_BACKREFMAX 2
448
#define PCRE2_INFO_BSR 3
449
#define PCRE2_INFO_CAPTURECOUNT 4
450
#define PCRE2_INFO_FIRSTCODEUNIT 5
451
#define PCRE2_INFO_FIRSTCODETYPE 6
452
#define PCRE2_INFO_FIRSTBITMAP 7
453
#define PCRE2_INFO_HASCRORLF 8
454
#define PCRE2_INFO_JCHANGED 9
455
#define PCRE2_INFO_JITSIZE 10
456
#define PCRE2_INFO_LASTCODEUNIT 11
457
#define PCRE2_INFO_LASTCODETYPE 12
458
#define PCRE2_INFO_MATCHEMPTY 13
459
#define PCRE2_INFO_MATCHLIMIT 14
460
#define PCRE2_INFO_MAXLOOKBEHIND 15
461
#define PCRE2_INFO_MINLENGTH 16
462
#define PCRE2_INFO_NAMECOUNT 17
463
#define PCRE2_INFO_NAMEENTRYSIZE 18
464
#define PCRE2_INFO_NAMETABLE 19
465
#define PCRE2_INFO_NEWLINE 20
466
#define PCRE2_INFO_DEPTHLIMIT 21
467
#define PCRE2_INFO_RECURSIONLIMIT 21 /* Obsolete synonym */
468
#define PCRE2_INFO_SIZE 22
469
#define PCRE2_INFO_HASBACKSLASHC 23
470
#define PCRE2_INFO_FRAMESIZE 24
471
#define PCRE2_INFO_HEAPLIMIT 25
472
#define PCRE2_INFO_EXTRAOPTIONS 26
473
474
/* Request types for pcre2_config(). */
475
476
#define PCRE2_CONFIG_BSR 0
477
#define PCRE2_CONFIG_JIT 1
478
#define PCRE2_CONFIG_JITTARGET 2
479
#define PCRE2_CONFIG_LINKSIZE 3
480
#define PCRE2_CONFIG_MATCHLIMIT 4
481
#define PCRE2_CONFIG_NEWLINE 5
482
#define PCRE2_CONFIG_PARENSLIMIT 6
483
#define PCRE2_CONFIG_DEPTHLIMIT 7
484
#define PCRE2_CONFIG_RECURSIONLIMIT 7 /* Obsolete synonym */
485
#define PCRE2_CONFIG_STACKRECURSE 8 /* Obsolete */
486
#define PCRE2_CONFIG_UNICODE 9
487
#define PCRE2_CONFIG_UNICODE_VERSION 10
488
#define PCRE2_CONFIG_VERSION 11
489
#define PCRE2_CONFIG_HEAPLIMIT 12
490
#define PCRE2_CONFIG_NEVER_BACKSLASH_C 13
491
#define PCRE2_CONFIG_COMPILED_WIDTHS 14
492
#define PCRE2_CONFIG_TABLES_LENGTH 15
493
#define PCRE2_CONFIG_EFFECTIVE_LINKSIZE 16
494
495
/* Optimization directives for pcre2_set_optimize().
496
For binary compatibility, only add to this list; do not renumber. */
497
498
#define PCRE2_OPTIMIZATION_NONE 0
499
#define PCRE2_OPTIMIZATION_FULL 1
500
501
#define PCRE2_AUTO_POSSESS 64
502
#define PCRE2_AUTO_POSSESS_OFF 65
503
#define PCRE2_DOTSTAR_ANCHOR 66
504
#define PCRE2_DOTSTAR_ANCHOR_OFF 67
505
#define PCRE2_START_OPTIMIZE 68
506
#define PCRE2_START_OPTIMIZE_OFF 69
507
508
/* Types used in pcre2_set_substitute_case_callout().
509
510
PCRE2_SUBSTITUTE_CASE_LOWER and PCRE2_SUBSTITUTE_CASE_UPPER are passed to the
511
callout to indicate that the case of the entire callout input should be
512
case-transformed. PCRE2_SUBSTITUTE_CASE_TITLE_FIRST is passed to indicate that
513
only the first character or glyph should be transformed to Unicode titlecase,
514
and the rest to lowercase. */
515
516
#define PCRE2_SUBSTITUTE_CASE_LOWER 1
517
#define PCRE2_SUBSTITUTE_CASE_UPPER 2
518
#define PCRE2_SUBSTITUTE_CASE_TITLE_FIRST 3
519
520
/* Types for code units in patterns and subject strings. */
521
522
typedef uint8_t PCRE2_UCHAR8;
523
typedef uint16_t PCRE2_UCHAR16;
524
typedef uint32_t PCRE2_UCHAR32;
525
526
typedef const PCRE2_UCHAR8 *PCRE2_SPTR8;
527
typedef const PCRE2_UCHAR16 *PCRE2_SPTR16;
528
typedef const PCRE2_UCHAR32 *PCRE2_SPTR32;
529
530
/* The PCRE2_SIZE type is used for all string lengths and offsets in PCRE2,
531
including pattern offsets for errors and subject offsets after a match. We
532
define special values to indicate zero-terminated strings and unset offsets in
533
the offset vector (ovector). */
534
535
#define PCRE2_SIZE size_t
536
#define PCRE2_SIZE_MAX SIZE_MAX
537
#define PCRE2_ZERO_TERMINATED (~(PCRE2_SIZE)0)
538
#define PCRE2_UNSET (~(PCRE2_SIZE)0)
539
540
/* Generic types for opaque structures and JIT callback functions. These
541
declarations are defined in a macro that is expanded for each width later. */
542
543
#define PCRE2_TYPES_LIST \
544
struct pcre2_real_general_context; \
545
typedef struct pcre2_real_general_context pcre2_general_context; \
546
\
547
struct pcre2_real_compile_context; \
548
typedef struct pcre2_real_compile_context pcre2_compile_context; \
549
\
550
struct pcre2_real_match_context; \
551
typedef struct pcre2_real_match_context pcre2_match_context; \
552
\
553
struct pcre2_real_convert_context; \
554
typedef struct pcre2_real_convert_context pcre2_convert_context; \
555
\
556
struct pcre2_real_code; \
557
typedef struct pcre2_real_code pcre2_code; \
558
\
559
struct pcre2_real_match_data; \
560
typedef struct pcre2_real_match_data pcre2_match_data; \
561
\
562
struct pcre2_real_jit_stack; \
563
typedef struct pcre2_real_jit_stack pcre2_jit_stack; \
564
\
565
typedef pcre2_jit_stack *(*pcre2_jit_callback)(void *);
566
567
568
/* The structures for passing out data via callout functions. We use structures
569
so that new fields can be added on the end in future versions, without changing
570
the API of the function, thereby allowing old clients to work without
571
modification. Define the generic versions in a macro; the width-specific
572
versions are generated from this macro below. */
573
574
/* Flags for the callout_flags field. These are cleared after a callout. */
575
576
#define PCRE2_CALLOUT_STARTMATCH 0x00000001u /* Set for each bumpalong */
577
#define PCRE2_CALLOUT_BACKTRACK 0x00000002u /* Set after a backtrack */
578
579
#define PCRE2_STRUCTURE_LIST \
580
typedef struct pcre2_callout_block { \
581
uint32_t version; /* Identifies version of block */ \
582
/* ------------------------ Version 0 ------------------------------- */ \
583
uint32_t callout_number; /* Number compiled into pattern */ \
584
uint32_t capture_top; /* Max current capture */ \
585
uint32_t capture_last; /* Most recently closed capture */ \
586
PCRE2_SIZE *offset_vector; /* The offset vector */ \
587
PCRE2_SPTR mark; /* Pointer to current mark or NULL */ \
588
PCRE2_SPTR subject; /* The subject being matched */ \
589
PCRE2_SIZE subject_length; /* The length of the subject */ \
590
PCRE2_SIZE start_match; /* Offset to start of this match attempt */ \
591
PCRE2_SIZE current_position; /* Where we currently are in the subject */ \
592
PCRE2_SIZE pattern_position; /* Offset to next item in the pattern */ \
593
PCRE2_SIZE next_item_length; /* Length of next item in the pattern */ \
594
/* ------------------- Added for Version 1 -------------------------- */ \
595
PCRE2_SIZE callout_string_offset; /* Offset to string within pattern */ \
596
PCRE2_SIZE callout_string_length; /* Length of string compiled into pattern */ \
597
PCRE2_SPTR callout_string; /* String compiled into pattern */ \
598
/* ------------------- Added for Version 2 -------------------------- */ \
599
uint32_t callout_flags; /* See above for list */ \
600
/* ------------------------------------------------------------------ */ \
601
} pcre2_callout_block; \
602
\
603
typedef struct pcre2_callout_enumerate_block { \
604
uint32_t version; /* Identifies version of block */ \
605
/* ------------------------ Version 0 ------------------------------- */ \
606
PCRE2_SIZE pattern_position; /* Offset to next item in the pattern */ \
607
PCRE2_SIZE next_item_length; /* Length of next item in the pattern */ \
608
uint32_t callout_number; /* Number compiled into pattern */ \
609
PCRE2_SIZE callout_string_offset; /* Offset to string within pattern */ \
610
PCRE2_SIZE callout_string_length; /* Length of string compiled into pattern */ \
611
PCRE2_SPTR callout_string; /* String compiled into pattern */ \
612
/* ------------------------------------------------------------------ */ \
613
} pcre2_callout_enumerate_block; \
614
\
615
typedef struct pcre2_substitute_callout_block { \
616
uint32_t version; /* Identifies version of block */ \
617
/* ------------------------ Version 0 ------------------------------- */ \
618
PCRE2_SPTR input; /* Pointer to input subject string */ \
619
PCRE2_SPTR output; /* Pointer to output buffer */ \
620
PCRE2_SIZE output_offsets[2]; /* Changed portion of the output */ \
621
PCRE2_SIZE *ovector; /* Pointer to current ovector */ \
622
uint32_t oveccount; /* Count of pairs set in ovector */ \
623
uint32_t subscount; /* Substitution number */ \
624
/* ------------------------------------------------------------------ */ \
625
} pcre2_substitute_callout_block;
626
627
628
/* List the generic forms of all other functions in macros, which will be
629
expanded for each width below. Start with functions that give general
630
information. */
631
632
#define PCRE2_GENERAL_INFO_FUNCTIONS \
633
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION pcre2_config(uint32_t, void *);
634
635
636
/* Functions for manipulating contexts. */
637
638
#define PCRE2_GENERAL_CONTEXT_FUNCTIONS \
639
PCRE2_EXP_DECL pcre2_general_context *PCRE2_CALL_CONVENTION \
640
pcre2_general_context_copy(pcre2_general_context *); \
641
PCRE2_EXP_DECL pcre2_general_context *PCRE2_CALL_CONVENTION \
642
pcre2_general_context_create(void *(*)(size_t, void *), \
643
void (*)(void *, void *), void *); \
644
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
645
pcre2_general_context_free(pcre2_general_context *);
646
647
#define PCRE2_COMPILE_CONTEXT_FUNCTIONS \
648
PCRE2_EXP_DECL pcre2_compile_context *PCRE2_CALL_CONVENTION \
649
pcre2_compile_context_copy(pcre2_compile_context *); \
650
PCRE2_EXP_DECL pcre2_compile_context *PCRE2_CALL_CONVENTION \
651
pcre2_compile_context_create(pcre2_general_context *);\
652
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
653
pcre2_compile_context_free(pcre2_compile_context *); \
654
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
655
pcre2_set_bsr(pcre2_compile_context *, uint32_t); \
656
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
657
pcre2_set_character_tables(pcre2_compile_context *, const uint8_t *); \
658
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
659
pcre2_set_compile_extra_options(pcre2_compile_context *, uint32_t); \
660
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
661
pcre2_set_max_pattern_length(pcre2_compile_context *, PCRE2_SIZE); \
662
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
663
pcre2_set_max_pattern_compiled_length(pcre2_compile_context *, PCRE2_SIZE); \
664
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
665
pcre2_set_max_varlookbehind(pcre2_compile_context *, uint32_t); \
666
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
667
pcre2_set_newline(pcre2_compile_context *, uint32_t); \
668
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
669
pcre2_set_parens_nest_limit(pcre2_compile_context *, uint32_t); \
670
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
671
pcre2_set_compile_recursion_guard(pcre2_compile_context *, \
672
int (*)(uint32_t, void *), void *); \
673
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
674
pcre2_set_optimize(pcre2_compile_context *, uint32_t);
675
676
#define PCRE2_MATCH_CONTEXT_FUNCTIONS \
677
PCRE2_EXP_DECL pcre2_match_context *PCRE2_CALL_CONVENTION \
678
pcre2_match_context_copy(pcre2_match_context *); \
679
PCRE2_EXP_DECL pcre2_match_context *PCRE2_CALL_CONVENTION \
680
pcre2_match_context_create(pcre2_general_context *); \
681
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
682
pcre2_match_context_free(pcre2_match_context *); \
683
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
684
pcre2_set_callout(pcre2_match_context *, \
685
int (*)(pcre2_callout_block *, void *), void *); \
686
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
687
pcre2_set_substitute_callout(pcre2_match_context *, \
688
int (*)(pcre2_substitute_callout_block *, void *), void *); \
689
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
690
pcre2_set_substitute_case_callout(pcre2_match_context *, \
691
PCRE2_SIZE (*)(PCRE2_SPTR, PCRE2_SIZE, PCRE2_UCHAR *, PCRE2_SIZE, int, \
692
void *), \
693
void *); \
694
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
695
pcre2_set_depth_limit(pcre2_match_context *, uint32_t); \
696
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
697
pcre2_set_heap_limit(pcre2_match_context *, uint32_t); \
698
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
699
pcre2_set_match_limit(pcre2_match_context *, uint32_t); \
700
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
701
pcre2_set_offset_limit(pcre2_match_context *, PCRE2_SIZE); \
702
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
703
pcre2_set_recursion_limit(pcre2_match_context *, uint32_t); \
704
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
705
pcre2_set_recursion_memory_management(pcre2_match_context *, \
706
void *(*)(size_t, void *), void (*)(void *, void *), void *);
707
708
#define PCRE2_CONVERT_CONTEXT_FUNCTIONS \
709
PCRE2_EXP_DECL pcre2_convert_context *PCRE2_CALL_CONVENTION \
710
pcre2_convert_context_copy(pcre2_convert_context *); \
711
PCRE2_EXP_DECL pcre2_convert_context *PCRE2_CALL_CONVENTION \
712
pcre2_convert_context_create(pcre2_general_context *); \
713
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
714
pcre2_convert_context_free(pcre2_convert_context *); \
715
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
716
pcre2_set_glob_escape(pcre2_convert_context *, uint32_t); \
717
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
718
pcre2_set_glob_separator(pcre2_convert_context *, uint32_t);
719
720
721
/* Functions concerned with compiling a pattern to PCRE internal code. */
722
723
#define PCRE2_COMPILE_FUNCTIONS \
724
PCRE2_EXP_DECL pcre2_code *PCRE2_CALL_CONVENTION \
725
pcre2_compile(PCRE2_SPTR, PCRE2_SIZE, uint32_t, int *, PCRE2_SIZE *, \
726
pcre2_compile_context *); \
727
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
728
pcre2_code_free(pcre2_code *); \
729
PCRE2_EXP_DECL pcre2_code *PCRE2_CALL_CONVENTION \
730
pcre2_code_copy(const pcre2_code *); \
731
PCRE2_EXP_DECL pcre2_code *PCRE2_CALL_CONVENTION \
732
pcre2_code_copy_with_tables(const pcre2_code *);
733
734
735
/* Functions that give information about a compiled pattern. */
736
737
#define PCRE2_PATTERN_INFO_FUNCTIONS \
738
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
739
pcre2_pattern_info(const pcre2_code *, uint32_t, void *); \
740
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
741
pcre2_callout_enumerate(const pcre2_code *, \
742
int (*)(pcre2_callout_enumerate_block *, void *), void *);
743
744
745
/* Functions for running a match and inspecting the result. */
746
747
#define PCRE2_MATCH_FUNCTIONS \
748
PCRE2_EXP_DECL pcre2_match_data *PCRE2_CALL_CONVENTION \
749
pcre2_match_data_create(uint32_t, pcre2_general_context *); \
750
PCRE2_EXP_DECL pcre2_match_data *PCRE2_CALL_CONVENTION \
751
pcre2_match_data_create_from_pattern(const pcre2_code *, \
752
pcre2_general_context *); \
753
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
754
pcre2_match_data_free(pcre2_match_data *); \
755
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
756
pcre2_dfa_match(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \
757
uint32_t, pcre2_match_data *, pcre2_match_context *, int *, PCRE2_SIZE); \
758
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
759
pcre2_match(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \
760
uint32_t, pcre2_match_data *, pcre2_match_context *); \
761
PCRE2_EXP_DECL PCRE2_SPTR PCRE2_CALL_CONVENTION \
762
pcre2_get_mark(pcre2_match_data *); \
763
PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
764
pcre2_get_match_data_size(pcre2_match_data *); \
765
PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
766
pcre2_get_match_data_heapframes_size(pcre2_match_data *); \
767
PCRE2_EXP_DECL uint32_t PCRE2_CALL_CONVENTION \
768
pcre2_get_ovector_count(pcre2_match_data *); \
769
PCRE2_EXP_DECL PCRE2_SIZE *PCRE2_CALL_CONVENTION \
770
pcre2_get_ovector_pointer(pcre2_match_data *); \
771
PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
772
pcre2_get_startchar(pcre2_match_data *); \
773
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
774
pcre2_next_match(pcre2_match_data *, PCRE2_SIZE *, uint32_t *);
775
776
777
/* Convenience functions for handling matched substrings. */
778
779
#define PCRE2_SUBSTRING_FUNCTIONS \
780
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
781
pcre2_substring_copy_byname(pcre2_match_data *, PCRE2_SPTR, PCRE2_UCHAR *, \
782
PCRE2_SIZE *); \
783
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
784
pcre2_substring_copy_bynumber(pcre2_match_data *, uint32_t, PCRE2_UCHAR *, \
785
PCRE2_SIZE *); \
786
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
787
pcre2_substring_free(PCRE2_UCHAR *); \
788
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
789
pcre2_substring_get_byname(pcre2_match_data *, PCRE2_SPTR, PCRE2_UCHAR **, \
790
PCRE2_SIZE *); \
791
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
792
pcre2_substring_get_bynumber(pcre2_match_data *, uint32_t, PCRE2_UCHAR **, \
793
PCRE2_SIZE *); \
794
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
795
pcre2_substring_length_byname(pcre2_match_data *, PCRE2_SPTR, PCRE2_SIZE *); \
796
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
797
pcre2_substring_length_bynumber(pcre2_match_data *, uint32_t, PCRE2_SIZE *); \
798
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
799
pcre2_substring_nametable_scan(const pcre2_code *, PCRE2_SPTR, PCRE2_SPTR *, \
800
PCRE2_SPTR *); \
801
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
802
pcre2_substring_number_from_name(const pcre2_code *, PCRE2_SPTR); \
803
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
804
pcre2_substring_list_free(PCRE2_UCHAR **); \
805
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
806
pcre2_substring_list_get(pcre2_match_data *, PCRE2_UCHAR ***, PCRE2_SIZE **);
807
808
809
/* Functions for serializing / deserializing compiled patterns. */
810
811
#define PCRE2_SERIALIZE_FUNCTIONS \
812
PCRE2_EXP_DECL int32_t PCRE2_CALL_CONVENTION \
813
pcre2_serialize_encode(const pcre2_code **, int32_t, uint8_t **, \
814
PCRE2_SIZE *, pcre2_general_context *); \
815
PCRE2_EXP_DECL int32_t PCRE2_CALL_CONVENTION \
816
pcre2_serialize_decode(pcre2_code **, int32_t, const uint8_t *, \
817
pcre2_general_context *); \
818
PCRE2_EXP_DECL int32_t PCRE2_CALL_CONVENTION \
819
pcre2_serialize_get_number_of_codes(const uint8_t *); \
820
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
821
pcre2_serialize_free(uint8_t *);
822
823
824
/* Convenience function for match + substitute. */
825
826
#define PCRE2_SUBSTITUTE_FUNCTION \
827
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
828
pcre2_substitute(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \
829
uint32_t, pcre2_match_data *, pcre2_match_context *, PCRE2_SPTR, \
830
PCRE2_SIZE, PCRE2_UCHAR *, PCRE2_SIZE *);
831
832
833
/* Functions for converting pattern source strings. */
834
835
#define PCRE2_CONVERT_FUNCTIONS \
836
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
837
pcre2_pattern_convert(PCRE2_SPTR, PCRE2_SIZE, uint32_t, PCRE2_UCHAR **, \
838
PCRE2_SIZE *, pcre2_convert_context *); \
839
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
840
pcre2_converted_pattern_free(PCRE2_UCHAR *);
841
842
843
/* Functions for JIT processing */
844
845
#define PCRE2_JIT_FUNCTIONS \
846
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
847
pcre2_jit_compile(pcre2_code *, uint32_t); \
848
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
849
pcre2_jit_match(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \
850
uint32_t, pcre2_match_data *, pcre2_match_context *); \
851
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
852
pcre2_jit_free_unused_memory(pcre2_general_context *); \
853
PCRE2_EXP_DECL pcre2_jit_stack *PCRE2_CALL_CONVENTION \
854
pcre2_jit_stack_create(size_t, size_t, pcre2_general_context *); \
855
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
856
pcre2_jit_stack_assign(pcre2_match_context *, pcre2_jit_callback, void *); \
857
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
858
pcre2_jit_stack_free(pcre2_jit_stack *);
859
860
861
/* Other miscellaneous functions. */
862
863
#define PCRE2_OTHER_FUNCTIONS \
864
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
865
pcre2_get_error_message(int, PCRE2_UCHAR *, PCRE2_SIZE); \
866
PCRE2_EXP_DECL const uint8_t *PCRE2_CALL_CONVENTION \
867
pcre2_maketables(pcre2_general_context *); \
868
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
869
pcre2_maketables_free(pcre2_general_context *, const uint8_t *);
870
871
/* Define macros that generate width-specific names from generic versions. The
872
three-level macro scheme is necessary to get the macros expanded when we want
873
them to be. First we get the width from PCRE2_LOCAL_WIDTH, which is used for
874
generating three versions of everything below. After that, PCRE2_SUFFIX will be
875
re-defined to use PCRE2_CODE_UNIT_WIDTH, for use when macros such as
876
pcre2_compile are called by application code. */
877
878
#define PCRE2_JOIN(a,b) a ## b
879
#define PCRE2_GLUE(a,b) PCRE2_JOIN(a,b)
880
#define PCRE2_SUFFIX(a) PCRE2_GLUE(a,PCRE2_LOCAL_WIDTH)
881
882
883
/* Data types */
884
885
#define PCRE2_UCHAR PCRE2_SUFFIX(PCRE2_UCHAR)
886
#define PCRE2_SPTR PCRE2_SUFFIX(PCRE2_SPTR)
887
888
#define pcre2_code PCRE2_SUFFIX(pcre2_code_)
889
#define pcre2_jit_callback PCRE2_SUFFIX(pcre2_jit_callback_)
890
#define pcre2_jit_stack PCRE2_SUFFIX(pcre2_jit_stack_)
891
892
#define pcre2_real_code PCRE2_SUFFIX(pcre2_real_code_)
893
#define pcre2_real_general_context PCRE2_SUFFIX(pcre2_real_general_context_)
894
#define pcre2_real_compile_context PCRE2_SUFFIX(pcre2_real_compile_context_)
895
#define pcre2_real_convert_context PCRE2_SUFFIX(pcre2_real_convert_context_)
896
#define pcre2_real_match_context PCRE2_SUFFIX(pcre2_real_match_context_)
897
#define pcre2_real_jit_stack PCRE2_SUFFIX(pcre2_real_jit_stack_)
898
#define pcre2_real_match_data PCRE2_SUFFIX(pcre2_real_match_data_)
899
900
901
/* Data blocks */
902
903
#define pcre2_callout_block PCRE2_SUFFIX(pcre2_callout_block_)
904
#define pcre2_callout_enumerate_block PCRE2_SUFFIX(pcre2_callout_enumerate_block_)
905
#define pcre2_substitute_callout_block PCRE2_SUFFIX(pcre2_substitute_callout_block_)
906
#define pcre2_general_context PCRE2_SUFFIX(pcre2_general_context_)
907
#define pcre2_compile_context PCRE2_SUFFIX(pcre2_compile_context_)
908
#define pcre2_convert_context PCRE2_SUFFIX(pcre2_convert_context_)
909
#define pcre2_match_context PCRE2_SUFFIX(pcre2_match_context_)
910
#define pcre2_match_data PCRE2_SUFFIX(pcre2_match_data_)
911
912
913
/* Functions: the complete list in alphabetical order */
914
915
#define pcre2_callout_enumerate PCRE2_SUFFIX(pcre2_callout_enumerate_)
916
#define pcre2_code_copy PCRE2_SUFFIX(pcre2_code_copy_)
917
#define pcre2_code_copy_with_tables PCRE2_SUFFIX(pcre2_code_copy_with_tables_)
918
#define pcre2_code_free PCRE2_SUFFIX(pcre2_code_free_)
919
#define pcre2_compile PCRE2_SUFFIX(pcre2_compile_)
920
#define pcre2_compile_context_copy PCRE2_SUFFIX(pcre2_compile_context_copy_)
921
#define pcre2_compile_context_create PCRE2_SUFFIX(pcre2_compile_context_create_)
922
#define pcre2_compile_context_free PCRE2_SUFFIX(pcre2_compile_context_free_)
923
#define pcre2_config PCRE2_SUFFIX(pcre2_config_)
924
#define pcre2_convert_context_copy PCRE2_SUFFIX(pcre2_convert_context_copy_)
925
#define pcre2_convert_context_create PCRE2_SUFFIX(pcre2_convert_context_create_)
926
#define pcre2_convert_context_free PCRE2_SUFFIX(pcre2_convert_context_free_)
927
#define pcre2_converted_pattern_free PCRE2_SUFFIX(pcre2_converted_pattern_free_)
928
#define pcre2_dfa_match PCRE2_SUFFIX(pcre2_dfa_match_)
929
#define pcre2_general_context_copy PCRE2_SUFFIX(pcre2_general_context_copy_)
930
#define pcre2_general_context_create PCRE2_SUFFIX(pcre2_general_context_create_)
931
#define pcre2_general_context_free PCRE2_SUFFIX(pcre2_general_context_free_)
932
#define pcre2_get_error_message PCRE2_SUFFIX(pcre2_get_error_message_)
933
#define pcre2_get_mark PCRE2_SUFFIX(pcre2_get_mark_)
934
#define pcre2_get_match_data_heapframes_size PCRE2_SUFFIX(pcre2_get_match_data_heapframes_size_)
935
#define pcre2_get_match_data_size PCRE2_SUFFIX(pcre2_get_match_data_size_)
936
#define pcre2_get_ovector_pointer PCRE2_SUFFIX(pcre2_get_ovector_pointer_)
937
#define pcre2_get_ovector_count PCRE2_SUFFIX(pcre2_get_ovector_count_)
938
#define pcre2_get_startchar PCRE2_SUFFIX(pcre2_get_startchar_)
939
#define pcre2_jit_compile PCRE2_SUFFIX(pcre2_jit_compile_)
940
#define pcre2_jit_match PCRE2_SUFFIX(pcre2_jit_match_)
941
#define pcre2_jit_free_unused_memory PCRE2_SUFFIX(pcre2_jit_free_unused_memory_)
942
#define pcre2_jit_stack_assign PCRE2_SUFFIX(pcre2_jit_stack_assign_)
943
#define pcre2_jit_stack_create PCRE2_SUFFIX(pcre2_jit_stack_create_)
944
#define pcre2_jit_stack_free PCRE2_SUFFIX(pcre2_jit_stack_free_)
945
#define pcre2_maketables PCRE2_SUFFIX(pcre2_maketables_)
946
#define pcre2_maketables_free PCRE2_SUFFIX(pcre2_maketables_free_)
947
#define pcre2_match PCRE2_SUFFIX(pcre2_match_)
948
#define pcre2_match_context_copy PCRE2_SUFFIX(pcre2_match_context_copy_)
949
#define pcre2_match_context_create PCRE2_SUFFIX(pcre2_match_context_create_)
950
#define pcre2_match_context_free PCRE2_SUFFIX(pcre2_match_context_free_)
951
#define pcre2_match_data_create PCRE2_SUFFIX(pcre2_match_data_create_)
952
#define pcre2_match_data_create_from_pattern PCRE2_SUFFIX(pcre2_match_data_create_from_pattern_)
953
#define pcre2_match_data_free PCRE2_SUFFIX(pcre2_match_data_free_)
954
#define pcre2_next_match PCRE2_SUFFIX(pcre2_next_match_)
955
#define pcre2_pattern_convert PCRE2_SUFFIX(pcre2_pattern_convert_)
956
#define pcre2_pattern_info PCRE2_SUFFIX(pcre2_pattern_info_)
957
#define pcre2_serialize_decode PCRE2_SUFFIX(pcre2_serialize_decode_)
958
#define pcre2_serialize_encode PCRE2_SUFFIX(pcre2_serialize_encode_)
959
#define pcre2_serialize_free PCRE2_SUFFIX(pcre2_serialize_free_)
960
#define pcre2_serialize_get_number_of_codes PCRE2_SUFFIX(pcre2_serialize_get_number_of_codes_)
961
#define pcre2_set_bsr PCRE2_SUFFIX(pcre2_set_bsr_)
962
#define pcre2_set_callout PCRE2_SUFFIX(pcre2_set_callout_)
963
#define pcre2_set_character_tables PCRE2_SUFFIX(pcre2_set_character_tables_)
964
#define pcre2_set_compile_extra_options PCRE2_SUFFIX(pcre2_set_compile_extra_options_)
965
#define pcre2_set_compile_recursion_guard PCRE2_SUFFIX(pcre2_set_compile_recursion_guard_)
966
#define pcre2_set_depth_limit PCRE2_SUFFIX(pcre2_set_depth_limit_)
967
#define pcre2_set_glob_escape PCRE2_SUFFIX(pcre2_set_glob_escape_)
968
#define pcre2_set_glob_separator PCRE2_SUFFIX(pcre2_set_glob_separator_)
969
#define pcre2_set_heap_limit PCRE2_SUFFIX(pcre2_set_heap_limit_)
970
#define pcre2_set_match_limit PCRE2_SUFFIX(pcre2_set_match_limit_)
971
#define pcre2_set_max_varlookbehind PCRE2_SUFFIX(pcre2_set_max_varlookbehind_)
972
#define pcre2_set_max_pattern_length PCRE2_SUFFIX(pcre2_set_max_pattern_length_)
973
#define pcre2_set_max_pattern_compiled_length PCRE2_SUFFIX(pcre2_set_max_pattern_compiled_length_)
974
#define pcre2_set_newline PCRE2_SUFFIX(pcre2_set_newline_)
975
#define pcre2_set_parens_nest_limit PCRE2_SUFFIX(pcre2_set_parens_nest_limit_)
976
#define pcre2_set_offset_limit PCRE2_SUFFIX(pcre2_set_offset_limit_)
977
#define pcre2_set_optimize PCRE2_SUFFIX(pcre2_set_optimize_)
978
#define pcre2_set_substitute_callout PCRE2_SUFFIX(pcre2_set_substitute_callout_)
979
#define pcre2_set_substitute_case_callout PCRE2_SUFFIX(pcre2_set_substitute_case_callout_)
980
#define pcre2_substitute PCRE2_SUFFIX(pcre2_substitute_)
981
#define pcre2_substring_copy_byname PCRE2_SUFFIX(pcre2_substring_copy_byname_)
982
#define pcre2_substring_copy_bynumber PCRE2_SUFFIX(pcre2_substring_copy_bynumber_)
983
#define pcre2_substring_free PCRE2_SUFFIX(pcre2_substring_free_)
984
#define pcre2_substring_get_byname PCRE2_SUFFIX(pcre2_substring_get_byname_)
985
#define pcre2_substring_get_bynumber PCRE2_SUFFIX(pcre2_substring_get_bynumber_)
986
#define pcre2_substring_length_byname PCRE2_SUFFIX(pcre2_substring_length_byname_)
987
#define pcre2_substring_length_bynumber PCRE2_SUFFIX(pcre2_substring_length_bynumber_)
988
#define pcre2_substring_list_get PCRE2_SUFFIX(pcre2_substring_list_get_)
989
#define pcre2_substring_list_free PCRE2_SUFFIX(pcre2_substring_list_free_)
990
#define pcre2_substring_nametable_scan PCRE2_SUFFIX(pcre2_substring_nametable_scan_)
991
#define pcre2_substring_number_from_name PCRE2_SUFFIX(pcre2_substring_number_from_name_)
992
993
/* Keep this old function name for backwards compatibility */
994
#define pcre2_set_recursion_limit PCRE2_SUFFIX(pcre2_set_recursion_limit_)
995
996
/* Keep this obsolete function for backwards compatibility: it is now a noop. */
997
#define pcre2_set_recursion_memory_management PCRE2_SUFFIX(pcre2_set_recursion_memory_management_)
998
999
/* Now generate all three sets of width-specific structures and function
1000
prototypes. */
1001
1002
#define PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS \
1003
PCRE2_TYPES_LIST \
1004
PCRE2_STRUCTURE_LIST \
1005
PCRE2_GENERAL_INFO_FUNCTIONS \
1006
PCRE2_GENERAL_CONTEXT_FUNCTIONS \
1007
PCRE2_COMPILE_CONTEXT_FUNCTIONS \
1008
PCRE2_CONVERT_CONTEXT_FUNCTIONS \
1009
PCRE2_CONVERT_FUNCTIONS \
1010
PCRE2_MATCH_CONTEXT_FUNCTIONS \
1011
PCRE2_COMPILE_FUNCTIONS \
1012
PCRE2_PATTERN_INFO_FUNCTIONS \
1013
PCRE2_MATCH_FUNCTIONS \
1014
PCRE2_SUBSTRING_FUNCTIONS \
1015
PCRE2_SERIALIZE_FUNCTIONS \
1016
PCRE2_SUBSTITUTE_FUNCTION \
1017
PCRE2_JIT_FUNCTIONS \
1018
PCRE2_OTHER_FUNCTIONS
1019
1020
#define PCRE2_LOCAL_WIDTH 8
1021
PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
1022
#undef PCRE2_LOCAL_WIDTH
1023
1024
#define PCRE2_LOCAL_WIDTH 16
1025
PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
1026
#undef PCRE2_LOCAL_WIDTH
1027
1028
#define PCRE2_LOCAL_WIDTH 32
1029
PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
1030
#undef PCRE2_LOCAL_WIDTH
1031
1032
/* Undefine the list macros; they are no longer needed. */
1033
1034
#undef PCRE2_TYPES_LIST
1035
#undef PCRE2_STRUCTURE_LIST
1036
#undef PCRE2_GENERAL_INFO_FUNCTIONS
1037
#undef PCRE2_GENERAL_CONTEXT_FUNCTIONS
1038
#undef PCRE2_COMPILE_CONTEXT_FUNCTIONS
1039
#undef PCRE2_CONVERT_CONTEXT_FUNCTIONS
1040
#undef PCRE2_MATCH_CONTEXT_FUNCTIONS
1041
#undef PCRE2_COMPILE_FUNCTIONS
1042
#undef PCRE2_PATTERN_INFO_FUNCTIONS
1043
#undef PCRE2_MATCH_FUNCTIONS
1044
#undef PCRE2_SUBSTRING_FUNCTIONS
1045
#undef PCRE2_SERIALIZE_FUNCTIONS
1046
#undef PCRE2_SUBSTITUTE_FUNCTION
1047
#undef PCRE2_JIT_FUNCTIONS
1048
#undef PCRE2_OTHER_FUNCTIONS
1049
#undef PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
1050
1051
/* PCRE2_CODE_UNIT_WIDTH must be defined. If it is 8, 16, or 32, redefine
1052
PCRE2_SUFFIX to use it. If it is 0, undefine the other macros and make
1053
PCRE2_SUFFIX a no-op. Otherwise, generate an error. */
1054
1055
#undef PCRE2_SUFFIX
1056
#ifndef PCRE2_CODE_UNIT_WIDTH
1057
#error PCRE2_CODE_UNIT_WIDTH must be defined before including pcre2.h.
1058
#error Use 8, 16, or 32; or 0 for a multi-width application.
1059
#else /* PCRE2_CODE_UNIT_WIDTH is defined */
1060
#if PCRE2_CODE_UNIT_WIDTH == 8 || \
1061
PCRE2_CODE_UNIT_WIDTH == 16 || \
1062
PCRE2_CODE_UNIT_WIDTH == 32
1063
#define PCRE2_SUFFIX(a) PCRE2_GLUE(a, PCRE2_CODE_UNIT_WIDTH)
1064
#elif PCRE2_CODE_UNIT_WIDTH == 0
1065
#undef PCRE2_JOIN
1066
#undef PCRE2_GLUE
1067
#define PCRE2_SUFFIX(a) a
1068
#else
1069
#error PCRE2_CODE_UNIT_WIDTH must be 0, 8, 16, or 32.
1070
#endif
1071
#endif /* PCRE2_CODE_UNIT_WIDTH is defined */
1072
1073
#ifdef __cplusplus
1074
} /* extern "C" */
1075
#endif
1076
1077
#endif /* PCRE2_H_IDEMPOTENT_GUARD */
1078
1079
/* End of pcre2.h */
1080
1081