Update to latest pcre2
[TortoiseGit.git] / ext / build / pcre2 / pcre2.h
blob7e01fbddb19dacc8939b033e7def68212841088f
1 /*************************************************
2 * Perl-Compatible Regular Expressions *
3 *************************************************/
5 /* This is the public header file for the PCRE library, second API, to be
6 #included by applications that call PCRE2 functions.
8 Copyright (c) 2016-2018 University of Cambridge
10 -----------------------------------------------------------------------------
11 Redistribution and use in source and binary forms, with or without
12 modification, are permitted provided that the following conditions are met:
14 * Redistributions of source code must retain the above copyright notice,
15 this list of conditions and the following disclaimer.
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.
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.
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 -----------------------------------------------------------------------------
39 #ifndef PCRE2_H_IDEMPOTENT_GUARD
40 #define PCRE2_H_IDEMPOTENT_GUARD
42 /* The current PCRE version information. */
44 #define PCRE2_MAJOR 10
45 #define PCRE2_MINOR 33
46 #define PCRE2_PRERELEASE -RC1
47 #define PCRE2_DATE 2018-09-14
49 /* When an application links to a PCRE 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. */
54 #if defined(_WIN32) && !defined(PCRE2_STATIC)
55 # ifndef PCRE2_EXP_DECL
56 # define PCRE2_EXP_DECL extern __declspec(dllimport)
57 # endif
58 #endif
60 /* By default, we use the standard "extern" declarations. */
62 #ifndef PCRE2_EXP_DECL
63 # ifdef __cplusplus
64 # define PCRE2_EXP_DECL extern "C"
65 # else
66 # define PCRE2_EXP_DECL extern
67 # endif
68 #endif
70 /* When compiling with the MSVC compiler, it is sometimes necessary to include
71 a "calling convention" before exported function names. (This is secondhand
72 information; I know nothing about MSVC myself). For example, something like
74 void __cdecl function(....)
76 might be needed. In order so make this easy, all the exported functions have
77 PCRE2_CALL_CONVENTION just before their names. It is rarely needed; if not
78 set, we ensure here that it has no effect. */
80 #ifndef PCRE2_CALL_CONVENTION
81 #define PCRE2_CALL_CONVENTION
82 #endif
84 /* Have to include limits.h, stdlib.h, and inttypes.h to ensure that size_t and
85 uint8_t, UCHAR_MAX, etc are defined. Some systems that do have inttypes.h do
86 not have stdint.h, which is why we use inttypes.h, which according to the C
87 standard is a superset of stdint.h. If none of these headers are available,
88 the relevant values must be provided by some other means. */
90 #include <limits.h>
91 #include <stdlib.h>
92 #include <inttypes.h>
94 /* Allow for C++ users compiling this directly. */
96 #ifdef __cplusplus
97 extern "C" {
98 #endif
100 /* The following option bits can be passed to pcre2_compile(), pcre2_match(),
101 or pcre2_dfa_match(). PCRE2_NO_UTF_CHECK affects only the function to which it
102 is passed. Put these bits at the most significant end of the options word so
103 others can be added next to them */
105 #define PCRE2_ANCHORED 0x80000000u
106 #define PCRE2_NO_UTF_CHECK 0x40000000u
107 #define PCRE2_ENDANCHORED 0x20000000u
109 /* The following option bits can be passed only to pcre2_compile(). However,
110 they may affect compilation, JIT compilation, and/or interpretive execution.
111 The following tags indicate which:
113 C alters what is compiled by pcre2_compile()
114 J alters what is compiled by pcre2_jit_compile()
115 M is inspected during pcre2_match() execution
116 D is inspected during pcre2_dfa_match() execution
119 #define PCRE2_ALLOW_EMPTY_CLASS 0x00000001u /* C */
120 #define PCRE2_ALT_BSUX 0x00000002u /* C */
121 #define PCRE2_AUTO_CALLOUT 0x00000004u /* C */
122 #define PCRE2_CASELESS 0x00000008u /* C */
123 #define PCRE2_DOLLAR_ENDONLY 0x00000010u /* J M D */
124 #define PCRE2_DOTALL 0x00000020u /* C */
125 #define PCRE2_DUPNAMES 0x00000040u /* C */
126 #define PCRE2_EXTENDED 0x00000080u /* C */
127 #define PCRE2_FIRSTLINE 0x00000100u /* J M D */
128 #define PCRE2_MATCH_UNSET_BACKREF 0x00000200u /* C J M */
129 #define PCRE2_MULTILINE 0x00000400u /* C */
130 #define PCRE2_NEVER_UCP 0x00000800u /* C */
131 #define PCRE2_NEVER_UTF 0x00001000u /* C */
132 #define PCRE2_NO_AUTO_CAPTURE 0x00002000u /* C */
133 #define PCRE2_NO_AUTO_POSSESS 0x00004000u /* C */
134 #define PCRE2_NO_DOTSTAR_ANCHOR 0x00008000u /* C */
135 #define PCRE2_NO_START_OPTIMIZE 0x00010000u /* J M D */
136 #define PCRE2_UCP 0x00020000u /* C J M D */
137 #define PCRE2_UNGREEDY 0x00040000u /* C */
138 #define PCRE2_UTF 0x00080000u /* C J M D */
139 #define PCRE2_NEVER_BACKSLASH_C 0x00100000u /* C */
140 #define PCRE2_ALT_CIRCUMFLEX 0x00200000u /* J M D */
141 #define PCRE2_ALT_VERBNAMES 0x00400000u /* C */
142 #define PCRE2_USE_OFFSET_LIMIT 0x00800000u /* J M D */
143 #define PCRE2_EXTENDED_MORE 0x01000000u /* C */
144 #define PCRE2_LITERAL 0x02000000u /* C */
146 /* An additional compile options word is available in the compile context. */
148 #define PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES 0x00000001u /* C */
149 #define PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL 0x00000002u /* C */
150 #define PCRE2_EXTRA_MATCH_WORD 0x00000004u /* C */
151 #define PCRE2_EXTRA_MATCH_LINE 0x00000008u /* C */
152 #define PCRE2_EXTRA_ESCAPED_CR_IS_LF 0x00000010u /* C */
154 /* These are for pcre2_jit_compile(). */
156 #define PCRE2_JIT_COMPLETE 0x00000001u /* For full matching */
157 #define PCRE2_JIT_PARTIAL_SOFT 0x00000002u
158 #define PCRE2_JIT_PARTIAL_HARD 0x00000004u
159 #define PCRE2_JIT_INVALID_UTF 0x00000100u
161 /* These are for pcre2_match(), pcre2_dfa_match(), pcre2_jit_match(), and
162 pcre2_substitute(). Some are allowed only for one of the functions, and in
163 these cases it is noted below. Note that PCRE2_ANCHORED, PCRE2_ENDANCHORED and
164 PCRE2_NO_UTF_CHECK can also be passed to these functions (though
165 pcre2_jit_match() ignores the latter since it bypasses all sanity checks). */
167 #define PCRE2_NOTBOL 0x00000001u
168 #define PCRE2_NOTEOL 0x00000002u
169 #define PCRE2_NOTEMPTY 0x00000004u /* ) These two must be kept */
170 #define PCRE2_NOTEMPTY_ATSTART 0x00000008u /* ) adjacent to each other. */
171 #define PCRE2_PARTIAL_SOFT 0x00000010u
172 #define PCRE2_PARTIAL_HARD 0x00000020u
173 #define PCRE2_DFA_RESTART 0x00000040u /* pcre2_dfa_match() only */
174 #define PCRE2_DFA_SHORTEST 0x00000080u /* pcre2_dfa_match() only */
175 #define PCRE2_SUBSTITUTE_GLOBAL 0x00000100u /* pcre2_substitute() only */
176 #define PCRE2_SUBSTITUTE_EXTENDED 0x00000200u /* pcre2_substitute() only */
177 #define PCRE2_SUBSTITUTE_UNSET_EMPTY 0x00000400u /* pcre2_substitute() only */
178 #define PCRE2_SUBSTITUTE_UNKNOWN_UNSET 0x00000800u /* pcre2_substitute() only */
179 #define PCRE2_SUBSTITUTE_OVERFLOW_LENGTH 0x00001000u /* pcre2_substitute() only */
180 #define PCRE2_NO_JIT 0x00002000u /* Not for pcre2_dfa_match() */
181 #define PCRE2_COPY_MATCHED_SUBJECT 0x00004000u
183 /* Options for pcre2_pattern_convert(). */
185 #define PCRE2_CONVERT_UTF 0x00000001u
186 #define PCRE2_CONVERT_NO_UTF_CHECK 0x00000002u
187 #define PCRE2_CONVERT_POSIX_BASIC 0x00000004u
188 #define PCRE2_CONVERT_POSIX_EXTENDED 0x00000008u
189 #define PCRE2_CONVERT_GLOB 0x00000010u
190 #define PCRE2_CONVERT_GLOB_NO_WILD_SEPARATOR 0x00000030u
191 #define PCRE2_CONVERT_GLOB_NO_STARSTAR 0x00000050u
193 /* Newline and \R settings, for use in compile contexts. The newline values
194 must be kept in step with values set in config.h and both sets must all be
195 greater than zero. */
197 #define PCRE2_NEWLINE_CR 1
198 #define PCRE2_NEWLINE_LF 2
199 #define PCRE2_NEWLINE_CRLF 3
200 #define PCRE2_NEWLINE_ANY 4
201 #define PCRE2_NEWLINE_ANYCRLF 5
202 #define PCRE2_NEWLINE_NUL 6
204 #define PCRE2_BSR_UNICODE 1
205 #define PCRE2_BSR_ANYCRLF 2
207 /* Error codes for pcre2_compile(). Some of these are also used by
208 pcre2_pattern_convert(). */
210 #define PCRE2_ERROR_END_BACKSLASH 101
211 #define PCRE2_ERROR_END_BACKSLASH_C 102
212 #define PCRE2_ERROR_UNKNOWN_ESCAPE 103
213 #define PCRE2_ERROR_QUANTIFIER_OUT_OF_ORDER 104
214 #define PCRE2_ERROR_QUANTIFIER_TOO_BIG 105
215 #define PCRE2_ERROR_MISSING_SQUARE_BRACKET 106
216 #define PCRE2_ERROR_ESCAPE_INVALID_IN_CLASS 107
217 #define PCRE2_ERROR_CLASS_RANGE_ORDER 108
218 #define PCRE2_ERROR_QUANTIFIER_INVALID 109
219 #define PCRE2_ERROR_INTERNAL_UNEXPECTED_REPEAT 110
220 #define PCRE2_ERROR_INVALID_AFTER_PARENS_QUERY 111
221 #define PCRE2_ERROR_POSIX_CLASS_NOT_IN_CLASS 112
222 #define PCRE2_ERROR_POSIX_NO_SUPPORT_COLLATING 113
223 #define PCRE2_ERROR_MISSING_CLOSING_PARENTHESIS 114
224 #define PCRE2_ERROR_BAD_SUBPATTERN_REFERENCE 115
225 #define PCRE2_ERROR_NULL_PATTERN 116
226 #define PCRE2_ERROR_BAD_OPTIONS 117
227 #define PCRE2_ERROR_MISSING_COMMENT_CLOSING 118
228 #define PCRE2_ERROR_PARENTHESES_NEST_TOO_DEEP 119
229 #define PCRE2_ERROR_PATTERN_TOO_LARGE 120
230 #define PCRE2_ERROR_HEAP_FAILED 121
231 #define PCRE2_ERROR_UNMATCHED_CLOSING_PARENTHESIS 122
232 #define PCRE2_ERROR_INTERNAL_CODE_OVERFLOW 123
233 #define PCRE2_ERROR_MISSING_CONDITION_CLOSING 124
234 #define PCRE2_ERROR_LOOKBEHIND_NOT_FIXED_LENGTH 125
235 #define PCRE2_ERROR_ZERO_RELATIVE_REFERENCE 126
236 #define PCRE2_ERROR_TOO_MANY_CONDITION_BRANCHES 127
237 #define PCRE2_ERROR_CONDITION_ASSERTION_EXPECTED 128
238 #define PCRE2_ERROR_BAD_RELATIVE_REFERENCE 129
239 #define PCRE2_ERROR_UNKNOWN_POSIX_CLASS 130
240 #define PCRE2_ERROR_INTERNAL_STUDY_ERROR 131
241 #define PCRE2_ERROR_UNICODE_NOT_SUPPORTED 132
242 #define PCRE2_ERROR_PARENTHESES_STACK_CHECK 133
243 #define PCRE2_ERROR_CODE_POINT_TOO_BIG 134
244 #define PCRE2_ERROR_LOOKBEHIND_TOO_COMPLICATED 135
245 #define PCRE2_ERROR_LOOKBEHIND_INVALID_BACKSLASH_C 136
246 #define PCRE2_ERROR_UNSUPPORTED_ESCAPE_SEQUENCE 137
247 #define PCRE2_ERROR_CALLOUT_NUMBER_TOO_BIG 138
248 #define PCRE2_ERROR_MISSING_CALLOUT_CLOSING 139
249 #define PCRE2_ERROR_ESCAPE_INVALID_IN_VERB 140
250 #define PCRE2_ERROR_UNRECOGNIZED_AFTER_QUERY_P 141
251 #define PCRE2_ERROR_MISSING_NAME_TERMINATOR 142
252 #define PCRE2_ERROR_DUPLICATE_SUBPATTERN_NAME 143
253 #define PCRE2_ERROR_INVALID_SUBPATTERN_NAME 144
254 #define PCRE2_ERROR_UNICODE_PROPERTIES_UNAVAILABLE 145
255 #define PCRE2_ERROR_MALFORMED_UNICODE_PROPERTY 146
256 #define PCRE2_ERROR_UNKNOWN_UNICODE_PROPERTY 147
257 #define PCRE2_ERROR_SUBPATTERN_NAME_TOO_LONG 148
258 #define PCRE2_ERROR_TOO_MANY_NAMED_SUBPATTERNS 149
259 #define PCRE2_ERROR_CLASS_INVALID_RANGE 150
260 #define PCRE2_ERROR_OCTAL_BYTE_TOO_BIG 151
261 #define PCRE2_ERROR_INTERNAL_OVERRAN_WORKSPACE 152
262 #define PCRE2_ERROR_INTERNAL_MISSING_SUBPATTERN 153
263 #define PCRE2_ERROR_DEFINE_TOO_MANY_BRANCHES 154
264 #define PCRE2_ERROR_BACKSLASH_O_MISSING_BRACE 155
265 #define PCRE2_ERROR_INTERNAL_UNKNOWN_NEWLINE 156
266 #define PCRE2_ERROR_BACKSLASH_G_SYNTAX 157
267 #define PCRE2_ERROR_PARENS_QUERY_R_MISSING_CLOSING 158
268 /* Error 159 is obsolete and should now never occur */
269 #define PCRE2_ERROR_VERB_ARGUMENT_NOT_ALLOWED 159
270 #define PCRE2_ERROR_VERB_UNKNOWN 160
271 #define PCRE2_ERROR_SUBPATTERN_NUMBER_TOO_BIG 161
272 #define PCRE2_ERROR_SUBPATTERN_NAME_EXPECTED 162
273 #define PCRE2_ERROR_INTERNAL_PARSED_OVERFLOW 163
274 #define PCRE2_ERROR_INVALID_OCTAL 164
275 #define PCRE2_ERROR_SUBPATTERN_NAMES_MISMATCH 165
276 #define PCRE2_ERROR_MARK_MISSING_ARGUMENT 166
277 #define PCRE2_ERROR_INVALID_HEXADECIMAL 167
278 #define PCRE2_ERROR_BACKSLASH_C_SYNTAX 168
279 #define PCRE2_ERROR_BACKSLASH_K_SYNTAX 169
280 #define PCRE2_ERROR_INTERNAL_BAD_CODE_LOOKBEHINDS 170
281 #define PCRE2_ERROR_BACKSLASH_N_IN_CLASS 171
282 #define PCRE2_ERROR_CALLOUT_STRING_TOO_LONG 172
283 #define PCRE2_ERROR_UNICODE_DISALLOWED_CODE_POINT 173
284 #define PCRE2_ERROR_UTF_IS_DISABLED 174
285 #define PCRE2_ERROR_UCP_IS_DISABLED 175
286 #define PCRE2_ERROR_VERB_NAME_TOO_LONG 176
287 #define PCRE2_ERROR_BACKSLASH_U_CODE_POINT_TOO_BIG 177
288 #define PCRE2_ERROR_MISSING_OCTAL_OR_HEX_DIGITS 178
289 #define PCRE2_ERROR_VERSION_CONDITION_SYNTAX 179
290 #define PCRE2_ERROR_INTERNAL_BAD_CODE_AUTO_POSSESS 180
291 #define PCRE2_ERROR_CALLOUT_NO_STRING_DELIMITER 181
292 #define PCRE2_ERROR_CALLOUT_BAD_STRING_DELIMITER 182
293 #define PCRE2_ERROR_BACKSLASH_C_CALLER_DISABLED 183
294 #define PCRE2_ERROR_QUERY_BARJX_NEST_TOO_DEEP 184
295 #define PCRE2_ERROR_BACKSLASH_C_LIBRARY_DISABLED 185
296 #define PCRE2_ERROR_PATTERN_TOO_COMPLICATED 186
297 #define PCRE2_ERROR_LOOKBEHIND_TOO_LONG 187
298 #define PCRE2_ERROR_PATTERN_STRING_TOO_LONG 188
299 #define PCRE2_ERROR_INTERNAL_BAD_CODE 189
300 #define PCRE2_ERROR_INTERNAL_BAD_CODE_IN_SKIP 190
301 #define PCRE2_ERROR_NO_SURROGATES_IN_UTF16 191
302 #define PCRE2_ERROR_BAD_LITERAL_OPTIONS 192
303 #define PCRE2_ERROR_SUPPORTED_ONLY_IN_UNICODE 193
304 #define PCRE2_ERROR_INVALID_HYPHEN_IN_OPTIONS 194
305 #define PCRE2_ERROR_ALPHA_ASSERTION_UNKNOWN 195
306 #define PCRE2_ERROR_SCRIPT_RUN_NOT_AVAILABLE 196
309 /* "Expected" matching error codes: no match and partial match. */
311 #define PCRE2_ERROR_NOMATCH (-1)
312 #define PCRE2_ERROR_PARTIAL (-2)
314 /* Error codes for UTF-8 validity checks */
316 #define PCRE2_ERROR_UTF8_ERR1 (-3)
317 #define PCRE2_ERROR_UTF8_ERR2 (-4)
318 #define PCRE2_ERROR_UTF8_ERR3 (-5)
319 #define PCRE2_ERROR_UTF8_ERR4 (-6)
320 #define PCRE2_ERROR_UTF8_ERR5 (-7)
321 #define PCRE2_ERROR_UTF8_ERR6 (-8)
322 #define PCRE2_ERROR_UTF8_ERR7 (-9)
323 #define PCRE2_ERROR_UTF8_ERR8 (-10)
324 #define PCRE2_ERROR_UTF8_ERR9 (-11)
325 #define PCRE2_ERROR_UTF8_ERR10 (-12)
326 #define PCRE2_ERROR_UTF8_ERR11 (-13)
327 #define PCRE2_ERROR_UTF8_ERR12 (-14)
328 #define PCRE2_ERROR_UTF8_ERR13 (-15)
329 #define PCRE2_ERROR_UTF8_ERR14 (-16)
330 #define PCRE2_ERROR_UTF8_ERR15 (-17)
331 #define PCRE2_ERROR_UTF8_ERR16 (-18)
332 #define PCRE2_ERROR_UTF8_ERR17 (-19)
333 #define PCRE2_ERROR_UTF8_ERR18 (-20)
334 #define PCRE2_ERROR_UTF8_ERR19 (-21)
335 #define PCRE2_ERROR_UTF8_ERR20 (-22)
336 #define PCRE2_ERROR_UTF8_ERR21 (-23)
338 /* Error codes for UTF-16 validity checks */
340 #define PCRE2_ERROR_UTF16_ERR1 (-24)
341 #define PCRE2_ERROR_UTF16_ERR2 (-25)
342 #define PCRE2_ERROR_UTF16_ERR3 (-26)
344 /* Error codes for UTF-32 validity checks */
346 #define PCRE2_ERROR_UTF32_ERR1 (-27)
347 #define PCRE2_ERROR_UTF32_ERR2 (-28)
349 /* Miscellaneous error codes for pcre2[_dfa]_match(), substring extraction
350 functions, context functions, and serializing functions. They are in numerical
351 order. Originally they were in alphabetical order too, but now that PCRE2 is
352 released, the numbers must not be changed. */
354 #define PCRE2_ERROR_BADDATA (-29)
355 #define PCRE2_ERROR_MIXEDTABLES (-30) /* Name was changed */
356 #define PCRE2_ERROR_BADMAGIC (-31)
357 #define PCRE2_ERROR_BADMODE (-32)
358 #define PCRE2_ERROR_BADOFFSET (-33)
359 #define PCRE2_ERROR_BADOPTION (-34)
360 #define PCRE2_ERROR_BADREPLACEMENT (-35)
361 #define PCRE2_ERROR_BADUTFOFFSET (-36)
362 #define PCRE2_ERROR_CALLOUT (-37) /* Never used by PCRE2 itself */
363 #define PCRE2_ERROR_DFA_BADRESTART (-38)
364 #define PCRE2_ERROR_DFA_RECURSE (-39)
365 #define PCRE2_ERROR_DFA_UCOND (-40)
366 #define PCRE2_ERROR_DFA_UFUNC (-41)
367 #define PCRE2_ERROR_DFA_UITEM (-42)
368 #define PCRE2_ERROR_DFA_WSSIZE (-43)
369 #define PCRE2_ERROR_INTERNAL (-44)
370 #define PCRE2_ERROR_JIT_BADOPTION (-45)
371 #define PCRE2_ERROR_JIT_STACKLIMIT (-46)
372 #define PCRE2_ERROR_MATCHLIMIT (-47)
373 #define PCRE2_ERROR_NOMEMORY (-48)
374 #define PCRE2_ERROR_NOSUBSTRING (-49)
375 #define PCRE2_ERROR_NOUNIQUESUBSTRING (-50)
376 #define PCRE2_ERROR_NULL (-51)
377 #define PCRE2_ERROR_RECURSELOOP (-52)
378 #define PCRE2_ERROR_DEPTHLIMIT (-53)
379 #define PCRE2_ERROR_RECURSIONLIMIT (-53) /* Obsolete synonym */
380 #define PCRE2_ERROR_UNAVAILABLE (-54)
381 #define PCRE2_ERROR_UNSET (-55)
382 #define PCRE2_ERROR_BADOFFSETLIMIT (-56)
383 #define PCRE2_ERROR_BADREPESCAPE (-57)
384 #define PCRE2_ERROR_REPMISSINGBRACE (-58)
385 #define PCRE2_ERROR_BADSUBSTITUTION (-59)
386 #define PCRE2_ERROR_BADSUBSPATTERN (-60)
387 #define PCRE2_ERROR_TOOMANYREPLACE (-61)
388 #define PCRE2_ERROR_BADSERIALIZEDDATA (-62)
389 #define PCRE2_ERROR_HEAPLIMIT (-63)
390 #define PCRE2_ERROR_CONVERT_SYNTAX (-64)
391 #define PCRE2_ERROR_INTERNAL_DUPMATCH (-65)
394 /* Request types for pcre2_pattern_info() */
396 #define PCRE2_INFO_ALLOPTIONS 0
397 #define PCRE2_INFO_ARGOPTIONS 1
398 #define PCRE2_INFO_BACKREFMAX 2
399 #define PCRE2_INFO_BSR 3
400 #define PCRE2_INFO_CAPTURECOUNT 4
401 #define PCRE2_INFO_FIRSTCODEUNIT 5
402 #define PCRE2_INFO_FIRSTCODETYPE 6
403 #define PCRE2_INFO_FIRSTBITMAP 7
404 #define PCRE2_INFO_HASCRORLF 8
405 #define PCRE2_INFO_JCHANGED 9
406 #define PCRE2_INFO_JITSIZE 10
407 #define PCRE2_INFO_LASTCODEUNIT 11
408 #define PCRE2_INFO_LASTCODETYPE 12
409 #define PCRE2_INFO_MATCHEMPTY 13
410 #define PCRE2_INFO_MATCHLIMIT 14
411 #define PCRE2_INFO_MAXLOOKBEHIND 15
412 #define PCRE2_INFO_MINLENGTH 16
413 #define PCRE2_INFO_NAMECOUNT 17
414 #define PCRE2_INFO_NAMEENTRYSIZE 18
415 #define PCRE2_INFO_NAMETABLE 19
416 #define PCRE2_INFO_NEWLINE 20
417 #define PCRE2_INFO_DEPTHLIMIT 21
418 #define PCRE2_INFO_RECURSIONLIMIT 21 /* Obsolete synonym */
419 #define PCRE2_INFO_SIZE 22
420 #define PCRE2_INFO_HASBACKSLASHC 23
421 #define PCRE2_INFO_FRAMESIZE 24
422 #define PCRE2_INFO_HEAPLIMIT 25
423 #define PCRE2_INFO_EXTRAOPTIONS 26
425 /* Request types for pcre2_config(). */
427 #define PCRE2_CONFIG_BSR 0
428 #define PCRE2_CONFIG_JIT 1
429 #define PCRE2_CONFIG_JITTARGET 2
430 #define PCRE2_CONFIG_LINKSIZE 3
431 #define PCRE2_CONFIG_MATCHLIMIT 4
432 #define PCRE2_CONFIG_NEWLINE 5
433 #define PCRE2_CONFIG_PARENSLIMIT 6
434 #define PCRE2_CONFIG_DEPTHLIMIT 7
435 #define PCRE2_CONFIG_RECURSIONLIMIT 7 /* Obsolete synonym */
436 #define PCRE2_CONFIG_STACKRECURSE 8 /* Obsolete */
437 #define PCRE2_CONFIG_UNICODE 9
438 #define PCRE2_CONFIG_UNICODE_VERSION 10
439 #define PCRE2_CONFIG_VERSION 11
440 #define PCRE2_CONFIG_HEAPLIMIT 12
441 #define PCRE2_CONFIG_NEVER_BACKSLASH_C 13
442 #define PCRE2_CONFIG_COMPILED_WIDTHS 14
445 /* Types for code units in patterns and subject strings. */
447 typedef uint8_t PCRE2_UCHAR8;
448 typedef uint16_t PCRE2_UCHAR16;
449 typedef uint32_t PCRE2_UCHAR32;
451 typedef const PCRE2_UCHAR8 *PCRE2_SPTR8;
452 typedef const PCRE2_UCHAR16 *PCRE2_SPTR16;
453 typedef const PCRE2_UCHAR32 *PCRE2_SPTR32;
455 /* The PCRE2_SIZE type is used for all string lengths and offsets in PCRE2,
456 including pattern offsets for errors and subject offsets after a match. We
457 define special values to indicate zero-terminated strings and unset offsets in
458 the offset vector (ovector). */
460 #define PCRE2_SIZE size_t
461 #define PCRE2_SIZE_MAX SIZE_MAX
462 #define PCRE2_ZERO_TERMINATED (~(PCRE2_SIZE)0)
463 #define PCRE2_UNSET (~(PCRE2_SIZE)0)
465 /* Generic types for opaque structures and JIT callback functions. These
466 declarations are defined in a macro that is expanded for each width later. */
468 #define PCRE2_TYPES_LIST \
469 struct pcre2_real_general_context; \
470 typedef struct pcre2_real_general_context pcre2_general_context; \
472 struct pcre2_real_compile_context; \
473 typedef struct pcre2_real_compile_context pcre2_compile_context; \
475 struct pcre2_real_match_context; \
476 typedef struct pcre2_real_match_context pcre2_match_context; \
478 struct pcre2_real_convert_context; \
479 typedef struct pcre2_real_convert_context pcre2_convert_context; \
481 struct pcre2_real_code; \
482 typedef struct pcre2_real_code pcre2_code; \
484 struct pcre2_real_match_data; \
485 typedef struct pcre2_real_match_data pcre2_match_data; \
487 struct pcre2_real_jit_stack; \
488 typedef struct pcre2_real_jit_stack pcre2_jit_stack; \
490 typedef pcre2_jit_stack *(*pcre2_jit_callback)(void *);
493 /* The structures for passing out data via callout functions. We use structures
494 so that new fields can be added on the end in future versions, without changing
495 the API of the function, thereby allowing old clients to work without
496 modification. Define the generic versions in a macro; the width-specific
497 versions are generated from this macro below. */
499 /* Flags for the callout_flags field. These are cleared after a callout. */
501 #define PCRE2_CALLOUT_STARTMATCH 0x00000001u /* Set for each bumpalong */
502 #define PCRE2_CALLOUT_BACKTRACK 0x00000002u /* Set after a backtrack */
504 #define PCRE2_STRUCTURE_LIST \
505 typedef struct pcre2_callout_block { \
506 uint32_t version; /* Identifies version of block */ \
507 /* ------------------------ Version 0 ------------------------------- */ \
508 uint32_t callout_number; /* Number compiled into pattern */ \
509 uint32_t capture_top; /* Max current capture */ \
510 uint32_t capture_last; /* Most recently closed capture */ \
511 PCRE2_SIZE *offset_vector; /* The offset vector */ \
512 PCRE2_SPTR mark; /* Pointer to current mark or NULL */ \
513 PCRE2_SPTR subject; /* The subject being matched */ \
514 PCRE2_SIZE subject_length; /* The length of the subject */ \
515 PCRE2_SIZE start_match; /* Offset to start of this match attempt */ \
516 PCRE2_SIZE current_position; /* Where we currently are in the subject */ \
517 PCRE2_SIZE pattern_position; /* Offset to next item in the pattern */ \
518 PCRE2_SIZE next_item_length; /* Length of next item in the pattern */ \
519 /* ------------------- Added for Version 1 -------------------------- */ \
520 PCRE2_SIZE callout_string_offset; /* Offset to string within pattern */ \
521 PCRE2_SIZE callout_string_length; /* Length of string compiled into pattern */ \
522 PCRE2_SPTR callout_string; /* String compiled into pattern */ \
523 /* ------------------- Added for Version 2 -------------------------- */ \
524 uint32_t callout_flags; /* See above for list */ \
525 /* ------------------------------------------------------------------ */ \
526 } pcre2_callout_block; \
528 typedef struct pcre2_callout_enumerate_block { \
529 uint32_t version; /* Identifies version of block */ \
530 /* ------------------------ Version 0 ------------------------------- */ \
531 PCRE2_SIZE pattern_position; /* Offset to next item in the pattern */ \
532 PCRE2_SIZE next_item_length; /* Length of next item in the pattern */ \
533 uint32_t callout_number; /* Number compiled into pattern */ \
534 PCRE2_SIZE callout_string_offset; /* Offset to string within pattern */ \
535 PCRE2_SIZE callout_string_length; /* Length of string compiled into pattern */ \
536 PCRE2_SPTR callout_string; /* String compiled into pattern */ \
537 /* ------------------------------------------------------------------ */ \
538 } pcre2_callout_enumerate_block; \
540 typedef struct pcre2_substitute_callout_block { \
541 uint32_t version; /* Identifies version of block */ \
542 /* ------------------------ Version 0 ------------------------------- */ \
543 PCRE2_SPTR input; /* Pointer to input subject string */ \
544 PCRE2_SPTR output; /* Pointer to output buffer */ \
545 PCRE2_SIZE output_offsets[2]; /* Changed portion of the output */ \
546 PCRE2_SIZE *ovector; /* Pointer to current ovector */ \
547 uint32_t oveccount; /* Count of pairs set in ovector */ \
548 uint32_t subscount; /* Substitution number */ \
549 /* ------------------------------------------------------------------ */ \
550 } pcre2_substitute_callout_block;
553 /* List the generic forms of all other functions in macros, which will be
554 expanded for each width below. Start with functions that give general
555 information. */
557 #define PCRE2_GENERAL_INFO_FUNCTIONS \
558 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION pcre2_config(uint32_t, void *);
561 /* Functions for manipulating contexts. */
563 #define PCRE2_GENERAL_CONTEXT_FUNCTIONS \
564 PCRE2_EXP_DECL pcre2_general_context PCRE2_CALL_CONVENTION \
565 *pcre2_general_context_copy(pcre2_general_context *); \
566 PCRE2_EXP_DECL pcre2_general_context PCRE2_CALL_CONVENTION \
567 *pcre2_general_context_create(void *(*)(PCRE2_SIZE, void *), \
568 void (*)(void *, void *), void *); \
569 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
570 pcre2_general_context_free(pcre2_general_context *);
572 #define PCRE2_COMPILE_CONTEXT_FUNCTIONS \
573 PCRE2_EXP_DECL pcre2_compile_context PCRE2_CALL_CONVENTION \
574 *pcre2_compile_context_copy(pcre2_compile_context *); \
575 PCRE2_EXP_DECL pcre2_compile_context PCRE2_CALL_CONVENTION \
576 *pcre2_compile_context_create(pcre2_general_context *);\
577 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
578 pcre2_compile_context_free(pcre2_compile_context *); \
579 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
580 pcre2_set_bsr(pcre2_compile_context *, uint32_t); \
581 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
582 pcre2_set_character_tables(pcre2_compile_context *, const unsigned char *); \
583 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
584 pcre2_set_compile_extra_options(pcre2_compile_context *, uint32_t); \
585 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
586 pcre2_set_max_pattern_length(pcre2_compile_context *, PCRE2_SIZE); \
587 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
588 pcre2_set_newline(pcre2_compile_context *, uint32_t); \
589 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
590 pcre2_set_parens_nest_limit(pcre2_compile_context *, uint32_t); \
591 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
592 pcre2_set_compile_recursion_guard(pcre2_compile_context *, \
593 int (*)(uint32_t, void *), void *);
595 #define PCRE2_MATCH_CONTEXT_FUNCTIONS \
596 PCRE2_EXP_DECL pcre2_match_context PCRE2_CALL_CONVENTION \
597 *pcre2_match_context_copy(pcre2_match_context *); \
598 PCRE2_EXP_DECL pcre2_match_context PCRE2_CALL_CONVENTION \
599 *pcre2_match_context_create(pcre2_general_context *); \
600 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
601 pcre2_match_context_free(pcre2_match_context *); \
602 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
603 pcre2_set_callout(pcre2_match_context *, \
604 int (*)(pcre2_callout_block *, void *), void *); \
605 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
606 pcre2_set_substitute_callout(pcre2_match_context *, \
607 int (*)(pcre2_substitute_callout_block *, void *), void *); \
608 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
609 pcre2_set_depth_limit(pcre2_match_context *, uint32_t); \
610 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
611 pcre2_set_heap_limit(pcre2_match_context *, uint32_t); \
612 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
613 pcre2_set_match_limit(pcre2_match_context *, uint32_t); \
614 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
615 pcre2_set_offset_limit(pcre2_match_context *, PCRE2_SIZE); \
616 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
617 pcre2_set_recursion_limit(pcre2_match_context *, uint32_t); \
618 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
619 pcre2_set_recursion_memory_management(pcre2_match_context *, \
620 void *(*)(PCRE2_SIZE, void *), void (*)(void *, void *), void *);
622 #define PCRE2_CONVERT_CONTEXT_FUNCTIONS \
623 PCRE2_EXP_DECL pcre2_convert_context PCRE2_CALL_CONVENTION \
624 *pcre2_convert_context_copy(pcre2_convert_context *); \
625 PCRE2_EXP_DECL pcre2_convert_context PCRE2_CALL_CONVENTION \
626 *pcre2_convert_context_create(pcre2_general_context *); \
627 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
628 pcre2_convert_context_free(pcre2_convert_context *); \
629 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
630 pcre2_set_glob_escape(pcre2_convert_context *, uint32_t); \
631 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
632 pcre2_set_glob_separator(pcre2_convert_context *, uint32_t);
635 /* Functions concerned with compiling a pattern to PCRE internal code. */
637 #define PCRE2_COMPILE_FUNCTIONS \
638 PCRE2_EXP_DECL pcre2_code PCRE2_CALL_CONVENTION \
639 *pcre2_compile(PCRE2_SPTR, PCRE2_SIZE, uint32_t, int *, PCRE2_SIZE *, \
640 pcre2_compile_context *); \
641 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
642 pcre2_code_free(pcre2_code *); \
643 PCRE2_EXP_DECL pcre2_code PCRE2_CALL_CONVENTION \
644 *pcre2_code_copy(const pcre2_code *); \
645 PCRE2_EXP_DECL pcre2_code PCRE2_CALL_CONVENTION \
646 *pcre2_code_copy_with_tables(const pcre2_code *);
649 /* Functions that give information about a compiled pattern. */
651 #define PCRE2_PATTERN_INFO_FUNCTIONS \
652 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
653 pcre2_pattern_info(const pcre2_code *, uint32_t, void *); \
654 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
655 pcre2_callout_enumerate(const pcre2_code *, \
656 int (*)(pcre2_callout_enumerate_block *, void *), void *);
659 /* Functions for running a match and inspecting the result. */
661 #define PCRE2_MATCH_FUNCTIONS \
662 PCRE2_EXP_DECL pcre2_match_data PCRE2_CALL_CONVENTION \
663 *pcre2_match_data_create(uint32_t, pcre2_general_context *); \
664 PCRE2_EXP_DECL pcre2_match_data PCRE2_CALL_CONVENTION \
665 *pcre2_match_data_create_from_pattern(const pcre2_code *, \
666 pcre2_general_context *); \
667 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
668 pcre2_dfa_match(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \
669 uint32_t, pcre2_match_data *, pcre2_match_context *, int *, PCRE2_SIZE); \
670 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
671 pcre2_match(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \
672 uint32_t, pcre2_match_data *, pcre2_match_context *); \
673 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
674 pcre2_match_data_free(pcre2_match_data *); \
675 PCRE2_EXP_DECL PCRE2_SPTR PCRE2_CALL_CONVENTION \
676 pcre2_get_mark(pcre2_match_data *); \
677 PCRE2_EXP_DECL uint32_t PCRE2_CALL_CONVENTION \
678 pcre2_get_ovector_count(pcre2_match_data *); \
679 PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
680 *pcre2_get_ovector_pointer(pcre2_match_data *); \
681 PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
682 pcre2_get_startchar(pcre2_match_data *);
685 /* Convenience functions for handling matched substrings. */
687 #define PCRE2_SUBSTRING_FUNCTIONS \
688 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
689 pcre2_substring_copy_byname(pcre2_match_data *, PCRE2_SPTR, PCRE2_UCHAR *, \
690 PCRE2_SIZE *); \
691 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
692 pcre2_substring_copy_bynumber(pcre2_match_data *, uint32_t, PCRE2_UCHAR *, \
693 PCRE2_SIZE *); \
694 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
695 pcre2_substring_free(PCRE2_UCHAR *); \
696 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
697 pcre2_substring_get_byname(pcre2_match_data *, PCRE2_SPTR, PCRE2_UCHAR **, \
698 PCRE2_SIZE *); \
699 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
700 pcre2_substring_get_bynumber(pcre2_match_data *, uint32_t, PCRE2_UCHAR **, \
701 PCRE2_SIZE *); \
702 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
703 pcre2_substring_length_byname(pcre2_match_data *, PCRE2_SPTR, PCRE2_SIZE *); \
704 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
705 pcre2_substring_length_bynumber(pcre2_match_data *, uint32_t, PCRE2_SIZE *); \
706 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
707 pcre2_substring_nametable_scan(const pcre2_code *, PCRE2_SPTR, PCRE2_SPTR *, \
708 PCRE2_SPTR *); \
709 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
710 pcre2_substring_number_from_name(const pcre2_code *, PCRE2_SPTR); \
711 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
712 pcre2_substring_list_free(PCRE2_SPTR *); \
713 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
714 pcre2_substring_list_get(pcre2_match_data *, PCRE2_UCHAR ***, PCRE2_SIZE **);
716 /* Functions for serializing / deserializing compiled patterns. */
718 #define PCRE2_SERIALIZE_FUNCTIONS \
719 PCRE2_EXP_DECL int32_t PCRE2_CALL_CONVENTION \
720 pcre2_serialize_encode(const pcre2_code **, int32_t, uint8_t **, \
721 PCRE2_SIZE *, pcre2_general_context *); \
722 PCRE2_EXP_DECL int32_t PCRE2_CALL_CONVENTION \
723 pcre2_serialize_decode(pcre2_code **, int32_t, const uint8_t *, \
724 pcre2_general_context *); \
725 PCRE2_EXP_DECL int32_t PCRE2_CALL_CONVENTION \
726 pcre2_serialize_get_number_of_codes(const uint8_t *); \
727 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
728 pcre2_serialize_free(uint8_t *);
731 /* Convenience function for match + substitute. */
733 #define PCRE2_SUBSTITUTE_FUNCTION \
734 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
735 pcre2_substitute(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \
736 uint32_t, pcre2_match_data *, pcre2_match_context *, PCRE2_SPTR, \
737 PCRE2_SIZE, PCRE2_UCHAR *, PCRE2_SIZE *);
740 /* Functions for converting pattern source strings. */
742 #define PCRE2_CONVERT_FUNCTIONS \
743 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
744 pcre2_pattern_convert(PCRE2_SPTR, PCRE2_SIZE, uint32_t, PCRE2_UCHAR **, \
745 PCRE2_SIZE *, pcre2_convert_context *); \
746 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
747 pcre2_converted_pattern_free(PCRE2_UCHAR *);
750 /* Functions for JIT processing */
752 #define PCRE2_JIT_FUNCTIONS \
753 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
754 pcre2_jit_compile(pcre2_code *, uint32_t); \
755 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
756 pcre2_jit_match(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \
757 uint32_t, pcre2_match_data *, pcre2_match_context *); \
758 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
759 pcre2_jit_free_unused_memory(pcre2_general_context *); \
760 PCRE2_EXP_DECL pcre2_jit_stack PCRE2_CALL_CONVENTION \
761 *pcre2_jit_stack_create(PCRE2_SIZE, PCRE2_SIZE, pcre2_general_context *); \
762 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
763 pcre2_jit_stack_assign(pcre2_match_context *, pcre2_jit_callback, void *); \
764 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
765 pcre2_jit_stack_free(pcre2_jit_stack *);
768 /* Other miscellaneous functions. */
770 #define PCRE2_OTHER_FUNCTIONS \
771 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
772 pcre2_get_error_message(int, PCRE2_UCHAR *, PCRE2_SIZE); \
773 PCRE2_EXP_DECL const uint8_t PCRE2_CALL_CONVENTION \
774 *pcre2_maketables(pcre2_general_context *); \
777 /* Define macros that generate width-specific names from generic versions. The
778 three-level macro scheme is necessary to get the macros expanded when we want
779 them to be. First we get the width from PCRE2_LOCAL_WIDTH, which is used for
780 generating three versions of everything below. After that, PCRE2_SUFFIX will be
781 re-defined to use PCRE2_CODE_UNIT_WIDTH, for use when macros such as
782 pcre2_compile are called by application code. */
784 #define PCRE2_JOIN(a,b) a ## b
785 #define PCRE2_GLUE(a,b) PCRE2_JOIN(a,b)
786 #define PCRE2_SUFFIX(a) PCRE2_GLUE(a,PCRE2_LOCAL_WIDTH)
789 /* Data types */
791 #define PCRE2_UCHAR PCRE2_SUFFIX(PCRE2_UCHAR)
792 #define PCRE2_SPTR PCRE2_SUFFIX(PCRE2_SPTR)
794 #define pcre2_code PCRE2_SUFFIX(pcre2_code_)
795 #define pcre2_jit_callback PCRE2_SUFFIX(pcre2_jit_callback_)
796 #define pcre2_jit_stack PCRE2_SUFFIX(pcre2_jit_stack_)
798 #define pcre2_real_code PCRE2_SUFFIX(pcre2_real_code_)
799 #define pcre2_real_general_context PCRE2_SUFFIX(pcre2_real_general_context_)
800 #define pcre2_real_compile_context PCRE2_SUFFIX(pcre2_real_compile_context_)
801 #define pcre2_real_convert_context PCRE2_SUFFIX(pcre2_real_convert_context_)
802 #define pcre2_real_match_context PCRE2_SUFFIX(pcre2_real_match_context_)
803 #define pcre2_real_jit_stack PCRE2_SUFFIX(pcre2_real_jit_stack_)
804 #define pcre2_real_match_data PCRE2_SUFFIX(pcre2_real_match_data_)
807 /* Data blocks */
809 #define pcre2_callout_block PCRE2_SUFFIX(pcre2_callout_block_)
810 #define pcre2_callout_enumerate_block PCRE2_SUFFIX(pcre2_callout_enumerate_block_)
811 #define pcre2_substitute_callout_block PCRE2_SUFFIX(pcre2_substitute_callout_block_)
812 #define pcre2_general_context PCRE2_SUFFIX(pcre2_general_context_)
813 #define pcre2_compile_context PCRE2_SUFFIX(pcre2_compile_context_)
814 #define pcre2_convert_context PCRE2_SUFFIX(pcre2_convert_context_)
815 #define pcre2_match_context PCRE2_SUFFIX(pcre2_match_context_)
816 #define pcre2_match_data PCRE2_SUFFIX(pcre2_match_data_)
819 /* Functions: the complete list in alphabetical order */
821 #define pcre2_callout_enumerate PCRE2_SUFFIX(pcre2_callout_enumerate_)
822 #define pcre2_code_copy PCRE2_SUFFIX(pcre2_code_copy_)
823 #define pcre2_code_copy_with_tables PCRE2_SUFFIX(pcre2_code_copy_with_tables_)
824 #define pcre2_code_free PCRE2_SUFFIX(pcre2_code_free_)
825 #define pcre2_compile PCRE2_SUFFIX(pcre2_compile_)
826 #define pcre2_compile_context_copy PCRE2_SUFFIX(pcre2_compile_context_copy_)
827 #define pcre2_compile_context_create PCRE2_SUFFIX(pcre2_compile_context_create_)
828 #define pcre2_compile_context_free PCRE2_SUFFIX(pcre2_compile_context_free_)
829 #define pcre2_config PCRE2_SUFFIX(pcre2_config_)
830 #define pcre2_convert_context_copy PCRE2_SUFFIX(pcre2_convert_context_copy_)
831 #define pcre2_convert_context_create PCRE2_SUFFIX(pcre2_convert_context_create_)
832 #define pcre2_convert_context_free PCRE2_SUFFIX(pcre2_convert_context_free_)
833 #define pcre2_converted_pattern_free PCRE2_SUFFIX(pcre2_converted_pattern_free_)
834 #define pcre2_dfa_match PCRE2_SUFFIX(pcre2_dfa_match_)
835 #define pcre2_general_context_copy PCRE2_SUFFIX(pcre2_general_context_copy_)
836 #define pcre2_general_context_create PCRE2_SUFFIX(pcre2_general_context_create_)
837 #define pcre2_general_context_free PCRE2_SUFFIX(pcre2_general_context_free_)
838 #define pcre2_get_error_message PCRE2_SUFFIX(pcre2_get_error_message_)
839 #define pcre2_get_mark PCRE2_SUFFIX(pcre2_get_mark_)
840 #define pcre2_get_ovector_pointer PCRE2_SUFFIX(pcre2_get_ovector_pointer_)
841 #define pcre2_get_ovector_count PCRE2_SUFFIX(pcre2_get_ovector_count_)
842 #define pcre2_get_startchar PCRE2_SUFFIX(pcre2_get_startchar_)
843 #define pcre2_jit_compile PCRE2_SUFFIX(pcre2_jit_compile_)
844 #define pcre2_jit_match PCRE2_SUFFIX(pcre2_jit_match_)
845 #define pcre2_jit_free_unused_memory PCRE2_SUFFIX(pcre2_jit_free_unused_memory_)
846 #define pcre2_jit_stack_assign PCRE2_SUFFIX(pcre2_jit_stack_assign_)
847 #define pcre2_jit_stack_create PCRE2_SUFFIX(pcre2_jit_stack_create_)
848 #define pcre2_jit_stack_free PCRE2_SUFFIX(pcre2_jit_stack_free_)
849 #define pcre2_maketables PCRE2_SUFFIX(pcre2_maketables_)
850 #define pcre2_match PCRE2_SUFFIX(pcre2_match_)
851 #define pcre2_match_context_copy PCRE2_SUFFIX(pcre2_match_context_copy_)
852 #define pcre2_match_context_create PCRE2_SUFFIX(pcre2_match_context_create_)
853 #define pcre2_match_context_free PCRE2_SUFFIX(pcre2_match_context_free_)
854 #define pcre2_match_data_create PCRE2_SUFFIX(pcre2_match_data_create_)
855 #define pcre2_match_data_create_from_pattern PCRE2_SUFFIX(pcre2_match_data_create_from_pattern_)
856 #define pcre2_match_data_free PCRE2_SUFFIX(pcre2_match_data_free_)
857 #define pcre2_pattern_convert PCRE2_SUFFIX(pcre2_pattern_convert_)
858 #define pcre2_pattern_info PCRE2_SUFFIX(pcre2_pattern_info_)
859 #define pcre2_serialize_decode PCRE2_SUFFIX(pcre2_serialize_decode_)
860 #define pcre2_serialize_encode PCRE2_SUFFIX(pcre2_serialize_encode_)
861 #define pcre2_serialize_free PCRE2_SUFFIX(pcre2_serialize_free_)
862 #define pcre2_serialize_get_number_of_codes PCRE2_SUFFIX(pcre2_serialize_get_number_of_codes_)
863 #define pcre2_set_bsr PCRE2_SUFFIX(pcre2_set_bsr_)
864 #define pcre2_set_callout PCRE2_SUFFIX(pcre2_set_callout_)
865 #define pcre2_set_character_tables PCRE2_SUFFIX(pcre2_set_character_tables_)
866 #define pcre2_set_compile_extra_options PCRE2_SUFFIX(pcre2_set_compile_extra_options_)
867 #define pcre2_set_compile_recursion_guard PCRE2_SUFFIX(pcre2_set_compile_recursion_guard_)
868 #define pcre2_set_depth_limit PCRE2_SUFFIX(pcre2_set_depth_limit_)
869 #define pcre2_set_glob_escape PCRE2_SUFFIX(pcre2_set_glob_escape_)
870 #define pcre2_set_glob_separator PCRE2_SUFFIX(pcre2_set_glob_separator_)
871 #define pcre2_set_heap_limit PCRE2_SUFFIX(pcre2_set_heap_limit_)
872 #define pcre2_set_match_limit PCRE2_SUFFIX(pcre2_set_match_limit_)
873 #define pcre2_set_max_pattern_length PCRE2_SUFFIX(pcre2_set_max_pattern_length_)
874 #define pcre2_set_newline PCRE2_SUFFIX(pcre2_set_newline_)
875 #define pcre2_set_parens_nest_limit PCRE2_SUFFIX(pcre2_set_parens_nest_limit_)
876 #define pcre2_set_offset_limit PCRE2_SUFFIX(pcre2_set_offset_limit_)
877 #define pcre2_set_substitute_callout PCRE2_SUFFIX(pcre2_set_substitute_callout_)
878 #define pcre2_substitute PCRE2_SUFFIX(pcre2_substitute_)
879 #define pcre2_substring_copy_byname PCRE2_SUFFIX(pcre2_substring_copy_byname_)
880 #define pcre2_substring_copy_bynumber PCRE2_SUFFIX(pcre2_substring_copy_bynumber_)
881 #define pcre2_substring_free PCRE2_SUFFIX(pcre2_substring_free_)
882 #define pcre2_substring_get_byname PCRE2_SUFFIX(pcre2_substring_get_byname_)
883 #define pcre2_substring_get_bynumber PCRE2_SUFFIX(pcre2_substring_get_bynumber_)
884 #define pcre2_substring_length_byname PCRE2_SUFFIX(pcre2_substring_length_byname_)
885 #define pcre2_substring_length_bynumber PCRE2_SUFFIX(pcre2_substring_length_bynumber_)
886 #define pcre2_substring_list_get PCRE2_SUFFIX(pcre2_substring_list_get_)
887 #define pcre2_substring_list_free PCRE2_SUFFIX(pcre2_substring_list_free_)
888 #define pcre2_substring_nametable_scan PCRE2_SUFFIX(pcre2_substring_nametable_scan_)
889 #define pcre2_substring_number_from_name PCRE2_SUFFIX(pcre2_substring_number_from_name_)
891 /* Keep this old function name for backwards compatibility */
892 #define pcre2_set_recursion_limit PCRE2_SUFFIX(pcre2_set_recursion_limit_)
894 /* Keep this obsolete function for backwards compatibility: it is now a noop. */
895 #define pcre2_set_recursion_memory_management PCRE2_SUFFIX(pcre2_set_recursion_memory_management_)
897 /* Now generate all three sets of width-specific structures and function
898 prototypes. */
900 #define PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS \
901 PCRE2_TYPES_LIST \
902 PCRE2_STRUCTURE_LIST \
903 PCRE2_GENERAL_INFO_FUNCTIONS \
904 PCRE2_GENERAL_CONTEXT_FUNCTIONS \
905 PCRE2_COMPILE_CONTEXT_FUNCTIONS \
906 PCRE2_CONVERT_CONTEXT_FUNCTIONS \
907 PCRE2_CONVERT_FUNCTIONS \
908 PCRE2_MATCH_CONTEXT_FUNCTIONS \
909 PCRE2_COMPILE_FUNCTIONS \
910 PCRE2_PATTERN_INFO_FUNCTIONS \
911 PCRE2_MATCH_FUNCTIONS \
912 PCRE2_SUBSTRING_FUNCTIONS \
913 PCRE2_SERIALIZE_FUNCTIONS \
914 PCRE2_SUBSTITUTE_FUNCTION \
915 PCRE2_JIT_FUNCTIONS \
916 PCRE2_OTHER_FUNCTIONS
918 #define PCRE2_LOCAL_WIDTH 8
919 PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
920 #undef PCRE2_LOCAL_WIDTH
922 #define PCRE2_LOCAL_WIDTH 16
923 PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
924 #undef PCRE2_LOCAL_WIDTH
926 #define PCRE2_LOCAL_WIDTH 32
927 PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
928 #undef PCRE2_LOCAL_WIDTH
930 /* Undefine the list macros; they are no longer needed. */
932 #undef PCRE2_TYPES_LIST
933 #undef PCRE2_STRUCTURE_LIST
934 #undef PCRE2_GENERAL_INFO_FUNCTIONS
935 #undef PCRE2_GENERAL_CONTEXT_FUNCTIONS
936 #undef PCRE2_COMPILE_CONTEXT_FUNCTIONS
937 #undef PCRE2_CONVERT_CONTEXT_FUNCTIONS
938 #undef PCRE2_MATCH_CONTEXT_FUNCTIONS
939 #undef PCRE2_COMPILE_FUNCTIONS
940 #undef PCRE2_PATTERN_INFO_FUNCTIONS
941 #undef PCRE2_MATCH_FUNCTIONS
942 #undef PCRE2_SUBSTRING_FUNCTIONS
943 #undef PCRE2_SERIALIZE_FUNCTIONS
944 #undef PCRE2_SUBSTITUTE_FUNCTION
945 #undef PCRE2_JIT_FUNCTIONS
946 #undef PCRE2_OTHER_FUNCTIONS
947 #undef PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
949 /* PCRE2_CODE_UNIT_WIDTH must be defined. If it is 8, 16, or 32, redefine
950 PCRE2_SUFFIX to use it. If it is 0, undefine the other macros and make
951 PCRE2_SUFFIX a no-op. Otherwise, generate an error. */
953 #undef PCRE2_SUFFIX
954 #ifndef PCRE2_CODE_UNIT_WIDTH
955 #error PCRE2_CODE_UNIT_WIDTH must be defined before including pcre2.h.
956 #error Use 8, 16, or 32; or 0 for a multi-width application.
957 #else /* PCRE2_CODE_UNIT_WIDTH is defined */
958 #if PCRE2_CODE_UNIT_WIDTH == 8 || \
959 PCRE2_CODE_UNIT_WIDTH == 16 || \
960 PCRE2_CODE_UNIT_WIDTH == 32
961 #define PCRE2_SUFFIX(a) PCRE2_GLUE(a, PCRE2_CODE_UNIT_WIDTH)
962 #elif PCRE2_CODE_UNIT_WIDTH == 0
963 #undef PCRE2_JOIN
964 #undef PCRE2_GLUE
965 #define PCRE2_SUFFIX(a) a
966 #else
967 #error PCRE2_CODE_UNIT_WIDTH must be 0, 8, 16, or 32.
968 #endif
969 #endif /* PCRE2_CODE_UNIT_WIDTH is defined */
971 #ifdef __cplusplus
972 } /* extern "C" */
973 #endif
975 #endif /* PCRE2_H_IDEMPOTENT_GUARD */
977 /* End of pcre2.h */