Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-12 08:55:22

0001 /*************************************************
0002 *       Perl-Compatible Regular Expressions      *
0003 *************************************************/
0004 
0005 /* This is the public header file for the PCRE library, second API, to be
0006 #included by applications that call PCRE2 functions.
0007 
0008            Copyright (c) 2016-2024 University of Cambridge
0009 
0010 -----------------------------------------------------------------------------
0011 Redistribution and use in source and binary forms, with or without
0012 modification, are permitted provided that the following conditions are met:
0013 
0014     * Redistributions of source code must retain the above copyright notice,
0015       this list of conditions and the following disclaimer.
0016 
0017     * Redistributions in binary form must reproduce the above copyright
0018       notice, this list of conditions and the following disclaimer in the
0019       documentation and/or other materials provided with the distribution.
0020 
0021     * Neither the name of the University of Cambridge nor the names of its
0022       contributors may be used to endorse or promote products derived from
0023       this software without specific prior written permission.
0024 
0025 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0026 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0027 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0028 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0029 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0030 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0031 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0032 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0033 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0034 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0035 POSSIBILITY OF SUCH DAMAGE.
0036 -----------------------------------------------------------------------------
0037 */
0038 
0039 #ifndef PCRE2_H_IDEMPOTENT_GUARD
0040 #define PCRE2_H_IDEMPOTENT_GUARD
0041 
0042 /* The current PCRE version information. */
0043 
0044 #define PCRE2_MAJOR           10
0045 #define PCRE2_MINOR           44
0046 #define PCRE2_PRERELEASE      
0047 #define PCRE2_DATE            2024-06-07
0048 
0049 /* When an application links to a PCRE DLL in Windows, the symbols that are
0050 imported have to be identified as such. When building PCRE2, the appropriate
0051 export setting is defined in pcre2_internal.h, which includes this file. So we
0052 don't change existing definitions of PCRE2_EXP_DECL. */
0053 
0054 #if defined(_WIN32) && !defined(PCRE2_STATIC)
0055 #  ifndef PCRE2_EXP_DECL
0056 #    define PCRE2_EXP_DECL  extern __declspec(dllimport)
0057 #  endif
0058 #endif
0059 
0060 /* By default, we use the standard "extern" declarations. */
0061 
0062 #ifndef PCRE2_EXP_DECL
0063 #  ifdef __cplusplus
0064 #    define PCRE2_EXP_DECL  extern "C"
0065 #  else
0066 #    define PCRE2_EXP_DECL  extern
0067 #  endif
0068 #endif
0069 
0070 /* When compiling with the MSVC compiler, it is sometimes necessary to include
0071 a "calling convention" before exported function names. (This is secondhand
0072 information; I know nothing about MSVC myself). For example, something like
0073 
0074   void __cdecl function(....)
0075 
0076 might be needed. In order so make this easy, all the exported functions have
0077 PCRE2_CALL_CONVENTION just before their names. It is rarely needed; if not
0078 set, we ensure here that it has no effect. */
0079 
0080 #ifndef PCRE2_CALL_CONVENTION
0081 #define PCRE2_CALL_CONVENTION
0082 #endif
0083 
0084 /* Have to include limits.h, stdlib.h, and inttypes.h to ensure that size_t and
0085 uint8_t, UCHAR_MAX, etc are defined. Some systems that do have inttypes.h do
0086 not have stdint.h, which is why we use inttypes.h, which according to the C
0087 standard is a superset of stdint.h. If inttypes.h is not available the build
0088 will break and the relevant values must be provided by some other means. */
0089 
0090 #include <limits.h>
0091 #include <stdlib.h>
0092 #include <inttypes.h>
0093 
0094 /* Allow for C++ users compiling this directly. */
0095 
0096 #ifdef __cplusplus
0097 extern "C" {
0098 #endif
0099 
0100 /* The following option bits can be passed to pcre2_compile(), pcre2_match(),
0101 or pcre2_dfa_match(). PCRE2_NO_UTF_CHECK affects only the function to which it
0102 is passed. Put these bits at the most significant end of the options word so
0103 others can be added next to them */
0104 
0105 #define PCRE2_ANCHORED            0x80000000u
0106 #define PCRE2_NO_UTF_CHECK        0x40000000u
0107 #define PCRE2_ENDANCHORED         0x20000000u
0108 
0109 /* The following option bits can be passed only to pcre2_compile(). However,
0110 they may affect compilation, JIT compilation, and/or interpretive execution.
0111 The following tags indicate which:
0112 
0113 C   alters what is compiled by pcre2_compile()
0114 J   alters what is compiled by pcre2_jit_compile()
0115 M   is inspected during pcre2_match() execution
0116 D   is inspected during pcre2_dfa_match() execution
0117 */
0118 
0119 #define PCRE2_ALLOW_EMPTY_CLASS   0x00000001u  /* C       */
0120 #define PCRE2_ALT_BSUX            0x00000002u  /* C       */
0121 #define PCRE2_AUTO_CALLOUT        0x00000004u  /* C       */
0122 #define PCRE2_CASELESS            0x00000008u  /* C       */
0123 #define PCRE2_DOLLAR_ENDONLY      0x00000010u  /*   J M D */
0124 #define PCRE2_DOTALL              0x00000020u  /* C       */
0125 #define PCRE2_DUPNAMES            0x00000040u  /* C       */
0126 #define PCRE2_EXTENDED            0x00000080u  /* C       */
0127 #define PCRE2_FIRSTLINE           0x00000100u  /*   J M D */
0128 #define PCRE2_MATCH_UNSET_BACKREF 0x00000200u  /* C J M   */
0129 #define PCRE2_MULTILINE           0x00000400u  /* C       */
0130 #define PCRE2_NEVER_UCP           0x00000800u  /* C       */
0131 #define PCRE2_NEVER_UTF           0x00001000u  /* C       */
0132 #define PCRE2_NO_AUTO_CAPTURE     0x00002000u  /* C       */
0133 #define PCRE2_NO_AUTO_POSSESS     0x00004000u  /* C       */
0134 #define PCRE2_NO_DOTSTAR_ANCHOR   0x00008000u  /* C       */
0135 #define PCRE2_NO_START_OPTIMIZE   0x00010000u  /*   J M D */
0136 #define PCRE2_UCP                 0x00020000u  /* C J M D */
0137 #define PCRE2_UNGREEDY            0x00040000u  /* C       */
0138 #define PCRE2_UTF                 0x00080000u  /* C J M D */
0139 #define PCRE2_NEVER_BACKSLASH_C   0x00100000u  /* C       */
0140 #define PCRE2_ALT_CIRCUMFLEX      0x00200000u  /*   J M D */
0141 #define PCRE2_ALT_VERBNAMES       0x00400000u  /* C       */
0142 #define PCRE2_USE_OFFSET_LIMIT    0x00800000u  /*   J M D */
0143 #define PCRE2_EXTENDED_MORE       0x01000000u  /* C       */
0144 #define PCRE2_LITERAL             0x02000000u  /* C       */
0145 #define PCRE2_MATCH_INVALID_UTF   0x04000000u  /*   J M D */
0146 
0147 /* An additional compile options word is available in the compile context. */
0148 
0149 #define PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES  0x00000001u  /* C */
0150 #define PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL    0x00000002u  /* C */
0151 #define PCRE2_EXTRA_MATCH_WORD               0x00000004u  /* C */
0152 #define PCRE2_EXTRA_MATCH_LINE               0x00000008u  /* C */
0153 #define PCRE2_EXTRA_ESCAPED_CR_IS_LF         0x00000010u  /* C */
0154 #define PCRE2_EXTRA_ALT_BSUX                 0x00000020u  /* C */
0155 #define PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK     0x00000040u  /* C */
0156 #define PCRE2_EXTRA_CASELESS_RESTRICT        0x00000080u  /* C */
0157 #define PCRE2_EXTRA_ASCII_BSD                0x00000100u  /* C */
0158 #define PCRE2_EXTRA_ASCII_BSS                0x00000200u  /* C */
0159 #define PCRE2_EXTRA_ASCII_BSW                0x00000400u  /* C */
0160 #define PCRE2_EXTRA_ASCII_POSIX              0x00000800u  /* C */
0161 #define PCRE2_EXTRA_ASCII_DIGIT              0x00001000u  /* C */
0162 
0163 /* These are for pcre2_jit_compile(). */
0164 
0165 #define PCRE2_JIT_COMPLETE        0x00000001u  /* For full matching */
0166 #define PCRE2_JIT_PARTIAL_SOFT    0x00000002u
0167 #define PCRE2_JIT_PARTIAL_HARD    0x00000004u
0168 #define PCRE2_JIT_INVALID_UTF     0x00000100u
0169 
0170 /* These are for pcre2_match(), pcre2_dfa_match(), pcre2_jit_match(), and
0171 pcre2_substitute(). Some are allowed only for one of the functions, and in
0172 these cases it is noted below. Note that PCRE2_ANCHORED, PCRE2_ENDANCHORED and
0173 PCRE2_NO_UTF_CHECK can also be passed to these functions (though
0174 pcre2_jit_match() ignores the latter since it bypasses all sanity checks). */
0175 
0176 #define PCRE2_NOTBOL                      0x00000001u
0177 #define PCRE2_NOTEOL                      0x00000002u
0178 #define PCRE2_NOTEMPTY                    0x00000004u  /* ) These two must be kept */
0179 #define PCRE2_NOTEMPTY_ATSTART            0x00000008u  /* ) adjacent to each other. */
0180 #define PCRE2_PARTIAL_SOFT                0x00000010u
0181 #define PCRE2_PARTIAL_HARD                0x00000020u
0182 #define PCRE2_DFA_RESTART                 0x00000040u  /* pcre2_dfa_match() only */
0183 #define PCRE2_DFA_SHORTEST                0x00000080u  /* pcre2_dfa_match() only */
0184 #define PCRE2_SUBSTITUTE_GLOBAL           0x00000100u  /* pcre2_substitute() only */
0185 #define PCRE2_SUBSTITUTE_EXTENDED         0x00000200u  /* pcre2_substitute() only */
0186 #define PCRE2_SUBSTITUTE_UNSET_EMPTY      0x00000400u  /* pcre2_substitute() only */
0187 #define PCRE2_SUBSTITUTE_UNKNOWN_UNSET    0x00000800u  /* pcre2_substitute() only */
0188 #define PCRE2_SUBSTITUTE_OVERFLOW_LENGTH  0x00001000u  /* pcre2_substitute() only */
0189 #define PCRE2_NO_JIT                      0x00002000u  /* not for pcre2_dfa_match() */
0190 #define PCRE2_COPY_MATCHED_SUBJECT        0x00004000u
0191 #define PCRE2_SUBSTITUTE_LITERAL          0x00008000u  /* pcre2_substitute() only */
0192 #define PCRE2_SUBSTITUTE_MATCHED          0x00010000u  /* pcre2_substitute() only */
0193 #define PCRE2_SUBSTITUTE_REPLACEMENT_ONLY 0x00020000u  /* pcre2_substitute() only */
0194 #define PCRE2_DISABLE_RECURSELOOP_CHECK   0x00040000u  /* not for pcre2_dfa_match() or pcre2_jit_match() */
0195 
0196 /* Options for pcre2_pattern_convert(). */
0197 
0198 #define PCRE2_CONVERT_UTF                    0x00000001u
0199 #define PCRE2_CONVERT_NO_UTF_CHECK           0x00000002u
0200 #define PCRE2_CONVERT_POSIX_BASIC            0x00000004u
0201 #define PCRE2_CONVERT_POSIX_EXTENDED         0x00000008u
0202 #define PCRE2_CONVERT_GLOB                   0x00000010u
0203 #define PCRE2_CONVERT_GLOB_NO_WILD_SEPARATOR 0x00000030u
0204 #define PCRE2_CONVERT_GLOB_NO_STARSTAR       0x00000050u
0205 
0206 /* Newline and \R settings, for use in compile contexts. The newline values
0207 must be kept in step with values set in config.h and both sets must all be
0208 greater than zero. */
0209 
0210 #define PCRE2_NEWLINE_CR          1
0211 #define PCRE2_NEWLINE_LF          2
0212 #define PCRE2_NEWLINE_CRLF        3
0213 #define PCRE2_NEWLINE_ANY         4
0214 #define PCRE2_NEWLINE_ANYCRLF     5
0215 #define PCRE2_NEWLINE_NUL         6
0216 
0217 #define PCRE2_BSR_UNICODE         1
0218 #define PCRE2_BSR_ANYCRLF         2
0219 
0220 /* Error codes for pcre2_compile(). Some of these are also used by
0221 pcre2_pattern_convert(). */
0222 
0223 #define PCRE2_ERROR_END_BACKSLASH                  101
0224 #define PCRE2_ERROR_END_BACKSLASH_C                102
0225 #define PCRE2_ERROR_UNKNOWN_ESCAPE                 103
0226 #define PCRE2_ERROR_QUANTIFIER_OUT_OF_ORDER        104
0227 #define PCRE2_ERROR_QUANTIFIER_TOO_BIG             105
0228 #define PCRE2_ERROR_MISSING_SQUARE_BRACKET         106
0229 #define PCRE2_ERROR_ESCAPE_INVALID_IN_CLASS        107
0230 #define PCRE2_ERROR_CLASS_RANGE_ORDER              108
0231 #define PCRE2_ERROR_QUANTIFIER_INVALID             109
0232 #define PCRE2_ERROR_INTERNAL_UNEXPECTED_REPEAT     110
0233 #define PCRE2_ERROR_INVALID_AFTER_PARENS_QUERY     111
0234 #define PCRE2_ERROR_POSIX_CLASS_NOT_IN_CLASS       112
0235 #define PCRE2_ERROR_POSIX_NO_SUPPORT_COLLATING     113
0236 #define PCRE2_ERROR_MISSING_CLOSING_PARENTHESIS    114
0237 #define PCRE2_ERROR_BAD_SUBPATTERN_REFERENCE       115
0238 #define PCRE2_ERROR_NULL_PATTERN                   116
0239 #define PCRE2_ERROR_BAD_OPTIONS                    117
0240 #define PCRE2_ERROR_MISSING_COMMENT_CLOSING        118
0241 #define PCRE2_ERROR_PARENTHESES_NEST_TOO_DEEP      119
0242 #define PCRE2_ERROR_PATTERN_TOO_LARGE              120
0243 #define PCRE2_ERROR_HEAP_FAILED                    121
0244 #define PCRE2_ERROR_UNMATCHED_CLOSING_PARENTHESIS  122
0245 #define PCRE2_ERROR_INTERNAL_CODE_OVERFLOW         123
0246 #define PCRE2_ERROR_MISSING_CONDITION_CLOSING      124
0247 #define PCRE2_ERROR_LOOKBEHIND_NOT_FIXED_LENGTH    125
0248 #define PCRE2_ERROR_ZERO_RELATIVE_REFERENCE        126
0249 #define PCRE2_ERROR_TOO_MANY_CONDITION_BRANCHES    127
0250 #define PCRE2_ERROR_CONDITION_ASSERTION_EXPECTED   128
0251 #define PCRE2_ERROR_BAD_RELATIVE_REFERENCE         129
0252 #define PCRE2_ERROR_UNKNOWN_POSIX_CLASS            130
0253 #define PCRE2_ERROR_INTERNAL_STUDY_ERROR           131
0254 #define PCRE2_ERROR_UNICODE_NOT_SUPPORTED          132
0255 #define PCRE2_ERROR_PARENTHESES_STACK_CHECK        133
0256 #define PCRE2_ERROR_CODE_POINT_TOO_BIG             134
0257 #define PCRE2_ERROR_LOOKBEHIND_TOO_COMPLICATED     135
0258 #define PCRE2_ERROR_LOOKBEHIND_INVALID_BACKSLASH_C 136
0259 #define PCRE2_ERROR_UNSUPPORTED_ESCAPE_SEQUENCE    137
0260 #define PCRE2_ERROR_CALLOUT_NUMBER_TOO_BIG         138
0261 #define PCRE2_ERROR_MISSING_CALLOUT_CLOSING        139
0262 #define PCRE2_ERROR_ESCAPE_INVALID_IN_VERB         140
0263 #define PCRE2_ERROR_UNRECOGNIZED_AFTER_QUERY_P     141
0264 #define PCRE2_ERROR_MISSING_NAME_TERMINATOR        142
0265 #define PCRE2_ERROR_DUPLICATE_SUBPATTERN_NAME      143
0266 #define PCRE2_ERROR_INVALID_SUBPATTERN_NAME        144
0267 #define PCRE2_ERROR_UNICODE_PROPERTIES_UNAVAILABLE 145
0268 #define PCRE2_ERROR_MALFORMED_UNICODE_PROPERTY     146
0269 #define PCRE2_ERROR_UNKNOWN_UNICODE_PROPERTY       147
0270 #define PCRE2_ERROR_SUBPATTERN_NAME_TOO_LONG       148
0271 #define PCRE2_ERROR_TOO_MANY_NAMED_SUBPATTERNS     149
0272 #define PCRE2_ERROR_CLASS_INVALID_RANGE            150
0273 #define PCRE2_ERROR_OCTAL_BYTE_TOO_BIG             151
0274 #define PCRE2_ERROR_INTERNAL_OVERRAN_WORKSPACE     152
0275 #define PCRE2_ERROR_INTERNAL_MISSING_SUBPATTERN    153
0276 #define PCRE2_ERROR_DEFINE_TOO_MANY_BRANCHES       154
0277 #define PCRE2_ERROR_BACKSLASH_O_MISSING_BRACE      155
0278 #define PCRE2_ERROR_INTERNAL_UNKNOWN_NEWLINE       156
0279 #define PCRE2_ERROR_BACKSLASH_G_SYNTAX             157
0280 #define PCRE2_ERROR_PARENS_QUERY_R_MISSING_CLOSING 158
0281 /* Error 159 is obsolete and should now never occur */
0282 #define PCRE2_ERROR_VERB_ARGUMENT_NOT_ALLOWED      159
0283 #define PCRE2_ERROR_VERB_UNKNOWN                   160
0284 #define PCRE2_ERROR_SUBPATTERN_NUMBER_TOO_BIG      161
0285 #define PCRE2_ERROR_SUBPATTERN_NAME_EXPECTED       162
0286 #define PCRE2_ERROR_INTERNAL_PARSED_OVERFLOW       163
0287 #define PCRE2_ERROR_INVALID_OCTAL                  164
0288 #define PCRE2_ERROR_SUBPATTERN_NAMES_MISMATCH      165
0289 #define PCRE2_ERROR_MARK_MISSING_ARGUMENT          166
0290 #define PCRE2_ERROR_INVALID_HEXADECIMAL            167
0291 #define PCRE2_ERROR_BACKSLASH_C_SYNTAX             168
0292 #define PCRE2_ERROR_BACKSLASH_K_SYNTAX             169
0293 #define PCRE2_ERROR_INTERNAL_BAD_CODE_LOOKBEHINDS  170
0294 #define PCRE2_ERROR_BACKSLASH_N_IN_CLASS           171
0295 #define PCRE2_ERROR_CALLOUT_STRING_TOO_LONG        172
0296 #define PCRE2_ERROR_UNICODE_DISALLOWED_CODE_POINT  173
0297 #define PCRE2_ERROR_UTF_IS_DISABLED                174
0298 #define PCRE2_ERROR_UCP_IS_DISABLED                175
0299 #define PCRE2_ERROR_VERB_NAME_TOO_LONG             176
0300 #define PCRE2_ERROR_BACKSLASH_U_CODE_POINT_TOO_BIG 177
0301 #define PCRE2_ERROR_MISSING_OCTAL_OR_HEX_DIGITS    178
0302 #define PCRE2_ERROR_VERSION_CONDITION_SYNTAX       179
0303 #define PCRE2_ERROR_INTERNAL_BAD_CODE_AUTO_POSSESS 180
0304 #define PCRE2_ERROR_CALLOUT_NO_STRING_DELIMITER    181
0305 #define PCRE2_ERROR_CALLOUT_BAD_STRING_DELIMITER   182
0306 #define PCRE2_ERROR_BACKSLASH_C_CALLER_DISABLED    183
0307 #define PCRE2_ERROR_QUERY_BARJX_NEST_TOO_DEEP      184
0308 #define PCRE2_ERROR_BACKSLASH_C_LIBRARY_DISABLED   185
0309 #define PCRE2_ERROR_PATTERN_TOO_COMPLICATED        186
0310 #define PCRE2_ERROR_LOOKBEHIND_TOO_LONG            187
0311 #define PCRE2_ERROR_PATTERN_STRING_TOO_LONG        188
0312 #define PCRE2_ERROR_INTERNAL_BAD_CODE              189
0313 #define PCRE2_ERROR_INTERNAL_BAD_CODE_IN_SKIP      190
0314 #define PCRE2_ERROR_NO_SURROGATES_IN_UTF16         191
0315 #define PCRE2_ERROR_BAD_LITERAL_OPTIONS            192
0316 #define PCRE2_ERROR_SUPPORTED_ONLY_IN_UNICODE      193
0317 #define PCRE2_ERROR_INVALID_HYPHEN_IN_OPTIONS      194
0318 #define PCRE2_ERROR_ALPHA_ASSERTION_UNKNOWN        195
0319 #define PCRE2_ERROR_SCRIPT_RUN_NOT_AVAILABLE       196
0320 #define PCRE2_ERROR_TOO_MANY_CAPTURES              197
0321 #define PCRE2_ERROR_CONDITION_ATOMIC_ASSERTION_EXPECTED  198
0322 #define PCRE2_ERROR_BACKSLASH_K_IN_LOOKAROUND      199
0323 
0324 
0325 /* "Expected" matching error codes: no match and partial match. */
0326 
0327 #define PCRE2_ERROR_NOMATCH          (-1)
0328 #define PCRE2_ERROR_PARTIAL          (-2)
0329 
0330 /* Error codes for UTF-8 validity checks */
0331 
0332 #define PCRE2_ERROR_UTF8_ERR1        (-3)
0333 #define PCRE2_ERROR_UTF8_ERR2        (-4)
0334 #define PCRE2_ERROR_UTF8_ERR3        (-5)
0335 #define PCRE2_ERROR_UTF8_ERR4        (-6)
0336 #define PCRE2_ERROR_UTF8_ERR5        (-7)
0337 #define PCRE2_ERROR_UTF8_ERR6        (-8)
0338 #define PCRE2_ERROR_UTF8_ERR7        (-9)
0339 #define PCRE2_ERROR_UTF8_ERR8       (-10)
0340 #define PCRE2_ERROR_UTF8_ERR9       (-11)
0341 #define PCRE2_ERROR_UTF8_ERR10      (-12)
0342 #define PCRE2_ERROR_UTF8_ERR11      (-13)
0343 #define PCRE2_ERROR_UTF8_ERR12      (-14)
0344 #define PCRE2_ERROR_UTF8_ERR13      (-15)
0345 #define PCRE2_ERROR_UTF8_ERR14      (-16)
0346 #define PCRE2_ERROR_UTF8_ERR15      (-17)
0347 #define PCRE2_ERROR_UTF8_ERR16      (-18)
0348 #define PCRE2_ERROR_UTF8_ERR17      (-19)
0349 #define PCRE2_ERROR_UTF8_ERR18      (-20)
0350 #define PCRE2_ERROR_UTF8_ERR19      (-21)
0351 #define PCRE2_ERROR_UTF8_ERR20      (-22)
0352 #define PCRE2_ERROR_UTF8_ERR21      (-23)
0353 
0354 /* Error codes for UTF-16 validity checks */
0355 
0356 #define PCRE2_ERROR_UTF16_ERR1      (-24)
0357 #define PCRE2_ERROR_UTF16_ERR2      (-25)
0358 #define PCRE2_ERROR_UTF16_ERR3      (-26)
0359 
0360 /* Error codes for UTF-32 validity checks */
0361 
0362 #define PCRE2_ERROR_UTF32_ERR1      (-27)
0363 #define PCRE2_ERROR_UTF32_ERR2      (-28)
0364 
0365 /* Miscellaneous error codes for pcre2[_dfa]_match(), substring extraction
0366 functions, context functions, and serializing functions. They are in numerical
0367 order. Originally they were in alphabetical order too, but now that PCRE2 is
0368 released, the numbers must not be changed. */
0369 
0370 #define PCRE2_ERROR_BADDATA           (-29)
0371 #define PCRE2_ERROR_MIXEDTABLES       (-30)  /* Name was changed */
0372 #define PCRE2_ERROR_BADMAGIC          (-31)
0373 #define PCRE2_ERROR_BADMODE           (-32)
0374 #define PCRE2_ERROR_BADOFFSET         (-33)
0375 #define PCRE2_ERROR_BADOPTION         (-34)
0376 #define PCRE2_ERROR_BADREPLACEMENT    (-35)
0377 #define PCRE2_ERROR_BADUTFOFFSET      (-36)
0378 #define PCRE2_ERROR_CALLOUT           (-37)  /* Never used by PCRE2 itself */
0379 #define PCRE2_ERROR_DFA_BADRESTART    (-38)
0380 #define PCRE2_ERROR_DFA_RECURSE       (-39)
0381 #define PCRE2_ERROR_DFA_UCOND         (-40)
0382 #define PCRE2_ERROR_DFA_UFUNC         (-41)
0383 #define PCRE2_ERROR_DFA_UITEM         (-42)
0384 #define PCRE2_ERROR_DFA_WSSIZE        (-43)
0385 #define PCRE2_ERROR_INTERNAL          (-44)
0386 #define PCRE2_ERROR_JIT_BADOPTION     (-45)
0387 #define PCRE2_ERROR_JIT_STACKLIMIT    (-46)
0388 #define PCRE2_ERROR_MATCHLIMIT        (-47)
0389 #define PCRE2_ERROR_NOMEMORY          (-48)
0390 #define PCRE2_ERROR_NOSUBSTRING       (-49)
0391 #define PCRE2_ERROR_NOUNIQUESUBSTRING (-50)
0392 #define PCRE2_ERROR_NULL              (-51)
0393 #define PCRE2_ERROR_RECURSELOOP       (-52)
0394 #define PCRE2_ERROR_DEPTHLIMIT        (-53)
0395 #define PCRE2_ERROR_RECURSIONLIMIT    (-53)  /* Obsolete synonym */
0396 #define PCRE2_ERROR_UNAVAILABLE       (-54)
0397 #define PCRE2_ERROR_UNSET             (-55)
0398 #define PCRE2_ERROR_BADOFFSETLIMIT    (-56)
0399 #define PCRE2_ERROR_BADREPESCAPE      (-57)
0400 #define PCRE2_ERROR_REPMISSINGBRACE   (-58)
0401 #define PCRE2_ERROR_BADSUBSTITUTION   (-59)
0402 #define PCRE2_ERROR_BADSUBSPATTERN    (-60)
0403 #define PCRE2_ERROR_TOOMANYREPLACE    (-61)
0404 #define PCRE2_ERROR_BADSERIALIZEDDATA (-62)
0405 #define PCRE2_ERROR_HEAPLIMIT         (-63)
0406 #define PCRE2_ERROR_CONVERT_SYNTAX    (-64)
0407 #define PCRE2_ERROR_INTERNAL_DUPMATCH (-65)
0408 #define PCRE2_ERROR_DFA_UINVALID_UTF  (-66)
0409 #define PCRE2_ERROR_INVALIDOFFSET     (-67)
0410 
0411 
0412 /* Request types for pcre2_pattern_info() */
0413 
0414 #define PCRE2_INFO_ALLOPTIONS            0
0415 #define PCRE2_INFO_ARGOPTIONS            1
0416 #define PCRE2_INFO_BACKREFMAX            2
0417 #define PCRE2_INFO_BSR                   3
0418 #define PCRE2_INFO_CAPTURECOUNT          4
0419 #define PCRE2_INFO_FIRSTCODEUNIT         5
0420 #define PCRE2_INFO_FIRSTCODETYPE         6
0421 #define PCRE2_INFO_FIRSTBITMAP           7
0422 #define PCRE2_INFO_HASCRORLF             8
0423 #define PCRE2_INFO_JCHANGED              9
0424 #define PCRE2_INFO_JITSIZE              10
0425 #define PCRE2_INFO_LASTCODEUNIT         11
0426 #define PCRE2_INFO_LASTCODETYPE         12
0427 #define PCRE2_INFO_MATCHEMPTY           13
0428 #define PCRE2_INFO_MATCHLIMIT           14
0429 #define PCRE2_INFO_MAXLOOKBEHIND        15
0430 #define PCRE2_INFO_MINLENGTH            16
0431 #define PCRE2_INFO_NAMECOUNT            17
0432 #define PCRE2_INFO_NAMEENTRYSIZE        18
0433 #define PCRE2_INFO_NAMETABLE            19
0434 #define PCRE2_INFO_NEWLINE              20
0435 #define PCRE2_INFO_DEPTHLIMIT           21
0436 #define PCRE2_INFO_RECURSIONLIMIT       21  /* Obsolete synonym */
0437 #define PCRE2_INFO_SIZE                 22
0438 #define PCRE2_INFO_HASBACKSLASHC        23
0439 #define PCRE2_INFO_FRAMESIZE            24
0440 #define PCRE2_INFO_HEAPLIMIT            25
0441 #define PCRE2_INFO_EXTRAOPTIONS         26
0442 
0443 /* Request types for pcre2_config(). */
0444 
0445 #define PCRE2_CONFIG_BSR                     0
0446 #define PCRE2_CONFIG_JIT                     1
0447 #define PCRE2_CONFIG_JITTARGET               2
0448 #define PCRE2_CONFIG_LINKSIZE                3
0449 #define PCRE2_CONFIG_MATCHLIMIT              4
0450 #define PCRE2_CONFIG_NEWLINE                 5
0451 #define PCRE2_CONFIG_PARENSLIMIT             6
0452 #define PCRE2_CONFIG_DEPTHLIMIT              7
0453 #define PCRE2_CONFIG_RECURSIONLIMIT          7  /* Obsolete synonym */
0454 #define PCRE2_CONFIG_STACKRECURSE            8  /* Obsolete */
0455 #define PCRE2_CONFIG_UNICODE                 9
0456 #define PCRE2_CONFIG_UNICODE_VERSION        10
0457 #define PCRE2_CONFIG_VERSION                11
0458 #define PCRE2_CONFIG_HEAPLIMIT              12
0459 #define PCRE2_CONFIG_NEVER_BACKSLASH_C      13
0460 #define PCRE2_CONFIG_COMPILED_WIDTHS        14
0461 #define PCRE2_CONFIG_TABLES_LENGTH          15
0462 
0463 
0464 /* Types for code units in patterns and subject strings. */
0465 
0466 typedef uint8_t  PCRE2_UCHAR8;
0467 typedef uint16_t PCRE2_UCHAR16;
0468 typedef uint32_t PCRE2_UCHAR32;
0469 
0470 typedef const PCRE2_UCHAR8  *PCRE2_SPTR8;
0471 typedef const PCRE2_UCHAR16 *PCRE2_SPTR16;
0472 typedef const PCRE2_UCHAR32 *PCRE2_SPTR32;
0473 
0474 /* The PCRE2_SIZE type is used for all string lengths and offsets in PCRE2,
0475 including pattern offsets for errors and subject offsets after a match. We
0476 define special values to indicate zero-terminated strings and unset offsets in
0477 the offset vector (ovector). */
0478 
0479 #define PCRE2_SIZE            size_t
0480 #define PCRE2_SIZE_MAX        SIZE_MAX
0481 #define PCRE2_ZERO_TERMINATED (~(PCRE2_SIZE)0)
0482 #define PCRE2_UNSET           (~(PCRE2_SIZE)0)
0483 
0484 /* Generic types for opaque structures and JIT callback functions. These
0485 declarations are defined in a macro that is expanded for each width later. */
0486 
0487 #define PCRE2_TYPES_LIST \
0488 struct pcre2_real_general_context; \
0489 typedef struct pcre2_real_general_context pcre2_general_context; \
0490 \
0491 struct pcre2_real_compile_context; \
0492 typedef struct pcre2_real_compile_context pcre2_compile_context; \
0493 \
0494 struct pcre2_real_match_context; \
0495 typedef struct pcre2_real_match_context pcre2_match_context; \
0496 \
0497 struct pcre2_real_convert_context; \
0498 typedef struct pcre2_real_convert_context pcre2_convert_context; \
0499 \
0500 struct pcre2_real_code; \
0501 typedef struct pcre2_real_code pcre2_code; \
0502 \
0503 struct pcre2_real_match_data; \
0504 typedef struct pcre2_real_match_data pcre2_match_data; \
0505 \
0506 struct pcre2_real_jit_stack; \
0507 typedef struct pcre2_real_jit_stack pcre2_jit_stack; \
0508 \
0509 typedef pcre2_jit_stack *(*pcre2_jit_callback)(void *);
0510 
0511 
0512 /* The structures for passing out data via callout functions. We use structures
0513 so that new fields can be added on the end in future versions, without changing
0514 the API of the function, thereby allowing old clients to work without
0515 modification. Define the generic versions in a macro; the width-specific
0516 versions are generated from this macro below. */
0517 
0518 /* Flags for the callout_flags field. These are cleared after a callout. */
0519 
0520 #define PCRE2_CALLOUT_STARTMATCH    0x00000001u  /* Set for each bumpalong */
0521 #define PCRE2_CALLOUT_BACKTRACK     0x00000002u  /* Set after a backtrack */
0522 
0523 #define PCRE2_STRUCTURE_LIST \
0524 typedef struct pcre2_callout_block { \
0525   uint32_t      version;           /* Identifies version of block */ \
0526   /* ------------------------ Version 0 ------------------------------- */ \
0527   uint32_t      callout_number;    /* Number compiled into pattern */ \
0528   uint32_t      capture_top;       /* Max current capture */ \
0529   uint32_t      capture_last;      /* Most recently closed capture */ \
0530   PCRE2_SIZE   *offset_vector;     /* The offset vector */ \
0531   PCRE2_SPTR    mark;              /* Pointer to current mark or NULL */ \
0532   PCRE2_SPTR    subject;           /* The subject being matched */ \
0533   PCRE2_SIZE    subject_length;    /* The length of the subject */ \
0534   PCRE2_SIZE    start_match;       /* Offset to start of this match attempt */ \
0535   PCRE2_SIZE    current_position;  /* Where we currently are in the subject */ \
0536   PCRE2_SIZE    pattern_position;  /* Offset to next item in the pattern */ \
0537   PCRE2_SIZE    next_item_length;  /* Length of next item in the pattern */ \
0538   /* ------------------- Added for Version 1 -------------------------- */ \
0539   PCRE2_SIZE    callout_string_offset; /* Offset to string within pattern */ \
0540   PCRE2_SIZE    callout_string_length; /* Length of string compiled into pattern */ \
0541   PCRE2_SPTR    callout_string;    /* String compiled into pattern */ \
0542   /* ------------------- Added for Version 2 -------------------------- */ \
0543   uint32_t      callout_flags;     /* See above for list */ \
0544   /* ------------------------------------------------------------------ */ \
0545 } pcre2_callout_block; \
0546 \
0547 typedef struct pcre2_callout_enumerate_block { \
0548   uint32_t      version;           /* Identifies version of block */ \
0549   /* ------------------------ Version 0 ------------------------------- */ \
0550   PCRE2_SIZE    pattern_position;  /* Offset to next item in the pattern */ \
0551   PCRE2_SIZE    next_item_length;  /* Length of next item in the pattern */ \
0552   uint32_t      callout_number;    /* Number compiled into pattern */ \
0553   PCRE2_SIZE    callout_string_offset; /* Offset to string within pattern */ \
0554   PCRE2_SIZE    callout_string_length; /* Length of string compiled into pattern */ \
0555   PCRE2_SPTR    callout_string;    /* String compiled into pattern */ \
0556   /* ------------------------------------------------------------------ */ \
0557 } pcre2_callout_enumerate_block; \
0558 \
0559 typedef struct pcre2_substitute_callout_block { \
0560   uint32_t      version;           /* Identifies version of block */ \
0561   /* ------------------------ Version 0 ------------------------------- */ \
0562   PCRE2_SPTR    input;             /* Pointer to input subject string */ \
0563   PCRE2_SPTR    output;            /* Pointer to output buffer */ \
0564   PCRE2_SIZE    output_offsets[2]; /* Changed portion of the output */ \
0565   PCRE2_SIZE   *ovector;           /* Pointer to current ovector */ \
0566   uint32_t      oveccount;         /* Count of pairs set in ovector */ \
0567   uint32_t      subscount;         /* Substitution number */ \
0568   /* ------------------------------------------------------------------ */ \
0569 } pcre2_substitute_callout_block;
0570 
0571 
0572 /* List the generic forms of all other functions in macros, which will be
0573 expanded for each width below. Start with functions that give general
0574 information. */
0575 
0576 #define PCRE2_GENERAL_INFO_FUNCTIONS \
0577 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION pcre2_config(uint32_t, void *);
0578 
0579 
0580 /* Functions for manipulating contexts. */
0581 
0582 #define PCRE2_GENERAL_CONTEXT_FUNCTIONS \
0583 PCRE2_EXP_DECL pcre2_general_context *PCRE2_CALL_CONVENTION \
0584   pcre2_general_context_copy(pcre2_general_context *); \
0585 PCRE2_EXP_DECL pcre2_general_context *PCRE2_CALL_CONVENTION \
0586   pcre2_general_context_create(void *(*)(size_t, void *), \
0587     void (*)(void *, void *), void *); \
0588 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
0589   pcre2_general_context_free(pcre2_general_context *);
0590 
0591 #define PCRE2_COMPILE_CONTEXT_FUNCTIONS \
0592 PCRE2_EXP_DECL pcre2_compile_context *PCRE2_CALL_CONVENTION \
0593   pcre2_compile_context_copy(pcre2_compile_context *); \
0594 PCRE2_EXP_DECL pcre2_compile_context *PCRE2_CALL_CONVENTION \
0595   pcre2_compile_context_create(pcre2_general_context *);\
0596 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
0597   pcre2_compile_context_free(pcre2_compile_context *); \
0598 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0599   pcre2_set_bsr(pcre2_compile_context *, uint32_t); \
0600 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0601   pcre2_set_character_tables(pcre2_compile_context *, const uint8_t *); \
0602 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0603   pcre2_set_compile_extra_options(pcre2_compile_context *, uint32_t); \
0604 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0605   pcre2_set_max_pattern_length(pcre2_compile_context *, PCRE2_SIZE); \
0606 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0607   pcre2_set_max_pattern_compiled_length(pcre2_compile_context *, PCRE2_SIZE); \
0608 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0609   pcre2_set_max_varlookbehind(pcre2_compile_context *, uint32_t); \
0610 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0611   pcre2_set_newline(pcre2_compile_context *, uint32_t); \
0612 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0613   pcre2_set_parens_nest_limit(pcre2_compile_context *, uint32_t); \
0614 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0615   pcre2_set_compile_recursion_guard(pcre2_compile_context *, \
0616     int (*)(uint32_t, void *), void *);
0617 
0618 #define PCRE2_MATCH_CONTEXT_FUNCTIONS \
0619 PCRE2_EXP_DECL pcre2_match_context *PCRE2_CALL_CONVENTION \
0620   pcre2_match_context_copy(pcre2_match_context *); \
0621 PCRE2_EXP_DECL pcre2_match_context *PCRE2_CALL_CONVENTION \
0622   pcre2_match_context_create(pcre2_general_context *); \
0623 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
0624   pcre2_match_context_free(pcre2_match_context *); \
0625 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0626   pcre2_set_callout(pcre2_match_context *, \
0627     int (*)(pcre2_callout_block *, void *), void *); \
0628 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0629   pcre2_set_substitute_callout(pcre2_match_context *, \
0630     int (*)(pcre2_substitute_callout_block *, void *), void *); \
0631 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0632   pcre2_set_depth_limit(pcre2_match_context *, uint32_t); \
0633 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0634   pcre2_set_heap_limit(pcre2_match_context *, uint32_t); \
0635 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0636   pcre2_set_match_limit(pcre2_match_context *, uint32_t); \
0637 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0638   pcre2_set_offset_limit(pcre2_match_context *, PCRE2_SIZE); \
0639 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0640   pcre2_set_recursion_limit(pcre2_match_context *, uint32_t); \
0641 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0642   pcre2_set_recursion_memory_management(pcre2_match_context *, \
0643     void *(*)(size_t, void *), void (*)(void *, void *), void *);
0644 
0645 #define PCRE2_CONVERT_CONTEXT_FUNCTIONS \
0646 PCRE2_EXP_DECL pcre2_convert_context *PCRE2_CALL_CONVENTION \
0647   pcre2_convert_context_copy(pcre2_convert_context *); \
0648 PCRE2_EXP_DECL pcre2_convert_context *PCRE2_CALL_CONVENTION \
0649   pcre2_convert_context_create(pcre2_general_context *); \
0650 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
0651   pcre2_convert_context_free(pcre2_convert_context *); \
0652 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0653   pcre2_set_glob_escape(pcre2_convert_context *, uint32_t); \
0654 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0655   pcre2_set_glob_separator(pcre2_convert_context *, uint32_t);
0656 
0657 
0658 /* Functions concerned with compiling a pattern to PCRE internal code. */
0659 
0660 #define PCRE2_COMPILE_FUNCTIONS \
0661 PCRE2_EXP_DECL pcre2_code *PCRE2_CALL_CONVENTION \
0662   pcre2_compile(PCRE2_SPTR, PCRE2_SIZE, uint32_t, int *, PCRE2_SIZE *, \
0663     pcre2_compile_context *); \
0664 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
0665   pcre2_code_free(pcre2_code *); \
0666 PCRE2_EXP_DECL pcre2_code *PCRE2_CALL_CONVENTION \
0667   pcre2_code_copy(const pcre2_code *); \
0668 PCRE2_EXP_DECL pcre2_code *PCRE2_CALL_CONVENTION \
0669   pcre2_code_copy_with_tables(const pcre2_code *);
0670 
0671 
0672 /* Functions that give information about a compiled pattern. */
0673 
0674 #define PCRE2_PATTERN_INFO_FUNCTIONS \
0675 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0676   pcre2_pattern_info(const pcre2_code *, uint32_t, void *); \
0677 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0678   pcre2_callout_enumerate(const pcre2_code *, \
0679     int (*)(pcre2_callout_enumerate_block *, void *), void *);
0680 
0681 
0682 /* Functions for running a match and inspecting the result. */
0683 
0684 #define PCRE2_MATCH_FUNCTIONS \
0685 PCRE2_EXP_DECL pcre2_match_data *PCRE2_CALL_CONVENTION \
0686   pcre2_match_data_create(uint32_t, pcre2_general_context *); \
0687 PCRE2_EXP_DECL pcre2_match_data *PCRE2_CALL_CONVENTION \
0688   pcre2_match_data_create_from_pattern(const pcre2_code *, \
0689     pcre2_general_context *); \
0690 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0691   pcre2_dfa_match(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \
0692     uint32_t, pcre2_match_data *, pcre2_match_context *, int *, PCRE2_SIZE); \
0693 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0694   pcre2_match(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \
0695     uint32_t, pcre2_match_data *, pcre2_match_context *); \
0696 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
0697   pcre2_match_data_free(pcre2_match_data *); \
0698 PCRE2_EXP_DECL PCRE2_SPTR PCRE2_CALL_CONVENTION \
0699   pcre2_get_mark(pcre2_match_data *); \
0700 PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
0701   pcre2_get_match_data_size(pcre2_match_data *); \
0702 PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
0703   pcre2_get_match_data_heapframes_size(pcre2_match_data *); \
0704 PCRE2_EXP_DECL uint32_t PCRE2_CALL_CONVENTION \
0705   pcre2_get_ovector_count(pcre2_match_data *); \
0706 PCRE2_EXP_DECL PCRE2_SIZE *PCRE2_CALL_CONVENTION \
0707   pcre2_get_ovector_pointer(pcre2_match_data *); \
0708 PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
0709   pcre2_get_startchar(pcre2_match_data *);
0710 
0711 
0712 /* Convenience functions for handling matched substrings. */
0713 
0714 #define PCRE2_SUBSTRING_FUNCTIONS \
0715 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0716   pcre2_substring_copy_byname(pcre2_match_data *, PCRE2_SPTR, PCRE2_UCHAR *, \
0717     PCRE2_SIZE *); \
0718 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0719   pcre2_substring_copy_bynumber(pcre2_match_data *, uint32_t, PCRE2_UCHAR *, \
0720     PCRE2_SIZE *); \
0721 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
0722   pcre2_substring_free(PCRE2_UCHAR *); \
0723 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0724   pcre2_substring_get_byname(pcre2_match_data *, PCRE2_SPTR, PCRE2_UCHAR **, \
0725     PCRE2_SIZE *); \
0726 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0727   pcre2_substring_get_bynumber(pcre2_match_data *, uint32_t, PCRE2_UCHAR **, \
0728     PCRE2_SIZE *); \
0729 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0730   pcre2_substring_length_byname(pcre2_match_data *, PCRE2_SPTR, PCRE2_SIZE *); \
0731 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0732   pcre2_substring_length_bynumber(pcre2_match_data *, uint32_t, PCRE2_SIZE *); \
0733 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0734   pcre2_substring_nametable_scan(const pcre2_code *, PCRE2_SPTR, PCRE2_SPTR *, \
0735     PCRE2_SPTR *); \
0736 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0737   pcre2_substring_number_from_name(const pcre2_code *, PCRE2_SPTR); \
0738 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
0739   pcre2_substring_list_free(PCRE2_UCHAR **); \
0740 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0741   pcre2_substring_list_get(pcre2_match_data *, PCRE2_UCHAR ***, PCRE2_SIZE **);
0742 
0743 /* Functions for serializing / deserializing compiled patterns. */
0744 
0745 #define PCRE2_SERIALIZE_FUNCTIONS \
0746 PCRE2_EXP_DECL int32_t PCRE2_CALL_CONVENTION \
0747   pcre2_serialize_encode(const pcre2_code **, int32_t, uint8_t **, \
0748     PCRE2_SIZE *, pcre2_general_context *); \
0749 PCRE2_EXP_DECL int32_t PCRE2_CALL_CONVENTION \
0750   pcre2_serialize_decode(pcre2_code **, int32_t, const uint8_t *, \
0751     pcre2_general_context *); \
0752 PCRE2_EXP_DECL int32_t PCRE2_CALL_CONVENTION \
0753   pcre2_serialize_get_number_of_codes(const uint8_t *); \
0754 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
0755   pcre2_serialize_free(uint8_t *);
0756 
0757 
0758 /* Convenience function for match + substitute. */
0759 
0760 #define PCRE2_SUBSTITUTE_FUNCTION \
0761 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0762   pcre2_substitute(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \
0763     uint32_t, pcre2_match_data *, pcre2_match_context *, PCRE2_SPTR, \
0764     PCRE2_SIZE, PCRE2_UCHAR *, PCRE2_SIZE *);
0765 
0766 
0767 /* Functions for converting pattern source strings. */
0768 
0769 #define PCRE2_CONVERT_FUNCTIONS \
0770 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0771   pcre2_pattern_convert(PCRE2_SPTR, PCRE2_SIZE, uint32_t, PCRE2_UCHAR **, \
0772     PCRE2_SIZE *, pcre2_convert_context *); \
0773 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
0774   pcre2_converted_pattern_free(PCRE2_UCHAR *);
0775 
0776 
0777 /* Functions for JIT processing */
0778 
0779 #define PCRE2_JIT_FUNCTIONS \
0780 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0781   pcre2_jit_compile(pcre2_code *, uint32_t); \
0782 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0783   pcre2_jit_match(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \
0784     uint32_t, pcre2_match_data *, pcre2_match_context *); \
0785 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
0786   pcre2_jit_free_unused_memory(pcre2_general_context *); \
0787 PCRE2_EXP_DECL pcre2_jit_stack *PCRE2_CALL_CONVENTION \
0788   pcre2_jit_stack_create(size_t, size_t, pcre2_general_context *); \
0789 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
0790   pcre2_jit_stack_assign(pcre2_match_context *, pcre2_jit_callback, void *); \
0791 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
0792   pcre2_jit_stack_free(pcre2_jit_stack *);
0793 
0794 
0795 /* Other miscellaneous functions. */
0796 
0797 #define PCRE2_OTHER_FUNCTIONS \
0798 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
0799   pcre2_get_error_message(int, PCRE2_UCHAR *, PCRE2_SIZE); \
0800 PCRE2_EXP_DECL const uint8_t *PCRE2_CALL_CONVENTION \
0801   pcre2_maketables(pcre2_general_context *); \
0802 PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
0803   pcre2_maketables_free(pcre2_general_context *, const uint8_t *);
0804 
0805 /* Define macros that generate width-specific names from generic versions. The
0806 three-level macro scheme is necessary to get the macros expanded when we want
0807 them to be. First we get the width from PCRE2_LOCAL_WIDTH, which is used for
0808 generating three versions of everything below. After that, PCRE2_SUFFIX will be
0809 re-defined to use PCRE2_CODE_UNIT_WIDTH, for use when macros such as
0810 pcre2_compile are called by application code. */
0811 
0812 #define PCRE2_JOIN(a,b) a ## b
0813 #define PCRE2_GLUE(a,b) PCRE2_JOIN(a,b)
0814 #define PCRE2_SUFFIX(a) PCRE2_GLUE(a,PCRE2_LOCAL_WIDTH)
0815 
0816 
0817 /* Data types */
0818 
0819 #define PCRE2_UCHAR                 PCRE2_SUFFIX(PCRE2_UCHAR)
0820 #define PCRE2_SPTR                  PCRE2_SUFFIX(PCRE2_SPTR)
0821 
0822 #define pcre2_code                  PCRE2_SUFFIX(pcre2_code_)
0823 #define pcre2_jit_callback          PCRE2_SUFFIX(pcre2_jit_callback_)
0824 #define pcre2_jit_stack             PCRE2_SUFFIX(pcre2_jit_stack_)
0825 
0826 #define pcre2_real_code             PCRE2_SUFFIX(pcre2_real_code_)
0827 #define pcre2_real_general_context  PCRE2_SUFFIX(pcre2_real_general_context_)
0828 #define pcre2_real_compile_context  PCRE2_SUFFIX(pcre2_real_compile_context_)
0829 #define pcre2_real_convert_context  PCRE2_SUFFIX(pcre2_real_convert_context_)
0830 #define pcre2_real_match_context    PCRE2_SUFFIX(pcre2_real_match_context_)
0831 #define pcre2_real_jit_stack        PCRE2_SUFFIX(pcre2_real_jit_stack_)
0832 #define pcre2_real_match_data       PCRE2_SUFFIX(pcre2_real_match_data_)
0833 
0834 
0835 /* Data blocks */
0836 
0837 #define pcre2_callout_block            PCRE2_SUFFIX(pcre2_callout_block_)
0838 #define pcre2_callout_enumerate_block  PCRE2_SUFFIX(pcre2_callout_enumerate_block_)
0839 #define pcre2_substitute_callout_block PCRE2_SUFFIX(pcre2_substitute_callout_block_)
0840 #define pcre2_general_context          PCRE2_SUFFIX(pcre2_general_context_)
0841 #define pcre2_compile_context          PCRE2_SUFFIX(pcre2_compile_context_)
0842 #define pcre2_convert_context          PCRE2_SUFFIX(pcre2_convert_context_)
0843 #define pcre2_match_context            PCRE2_SUFFIX(pcre2_match_context_)
0844 #define pcre2_match_data               PCRE2_SUFFIX(pcre2_match_data_)
0845 
0846 
0847 /* Functions: the complete list in alphabetical order */
0848 
0849 #define pcre2_callout_enumerate               PCRE2_SUFFIX(pcre2_callout_enumerate_)
0850 #define pcre2_code_copy                       PCRE2_SUFFIX(pcre2_code_copy_)
0851 #define pcre2_code_copy_with_tables           PCRE2_SUFFIX(pcre2_code_copy_with_tables_)
0852 #define pcre2_code_free                       PCRE2_SUFFIX(pcre2_code_free_)
0853 #define pcre2_compile                         PCRE2_SUFFIX(pcre2_compile_)
0854 #define pcre2_compile_context_copy            PCRE2_SUFFIX(pcre2_compile_context_copy_)
0855 #define pcre2_compile_context_create          PCRE2_SUFFIX(pcre2_compile_context_create_)
0856 #define pcre2_compile_context_free            PCRE2_SUFFIX(pcre2_compile_context_free_)
0857 #define pcre2_config                          PCRE2_SUFFIX(pcre2_config_)
0858 #define pcre2_convert_context_copy            PCRE2_SUFFIX(pcre2_convert_context_copy_)
0859 #define pcre2_convert_context_create          PCRE2_SUFFIX(pcre2_convert_context_create_)
0860 #define pcre2_convert_context_free            PCRE2_SUFFIX(pcre2_convert_context_free_)
0861 #define pcre2_converted_pattern_free          PCRE2_SUFFIX(pcre2_converted_pattern_free_)
0862 #define pcre2_dfa_match                       PCRE2_SUFFIX(pcre2_dfa_match_)
0863 #define pcre2_general_context_copy            PCRE2_SUFFIX(pcre2_general_context_copy_)
0864 #define pcre2_general_context_create          PCRE2_SUFFIX(pcre2_general_context_create_)
0865 #define pcre2_general_context_free            PCRE2_SUFFIX(pcre2_general_context_free_)
0866 #define pcre2_get_error_message               PCRE2_SUFFIX(pcre2_get_error_message_)
0867 #define pcre2_get_mark                        PCRE2_SUFFIX(pcre2_get_mark_)
0868 #define pcre2_get_match_data_heapframes_size  PCRE2_SUFFIX(pcre2_get_match_data_heapframes_size_)
0869 #define pcre2_get_match_data_size             PCRE2_SUFFIX(pcre2_get_match_data_size_)
0870 #define pcre2_get_ovector_pointer             PCRE2_SUFFIX(pcre2_get_ovector_pointer_)
0871 #define pcre2_get_ovector_count               PCRE2_SUFFIX(pcre2_get_ovector_count_)
0872 #define pcre2_get_startchar                   PCRE2_SUFFIX(pcre2_get_startchar_)
0873 #define pcre2_jit_compile                     PCRE2_SUFFIX(pcre2_jit_compile_)
0874 #define pcre2_jit_match                       PCRE2_SUFFIX(pcre2_jit_match_)
0875 #define pcre2_jit_free_unused_memory          PCRE2_SUFFIX(pcre2_jit_free_unused_memory_)
0876 #define pcre2_jit_stack_assign                PCRE2_SUFFIX(pcre2_jit_stack_assign_)
0877 #define pcre2_jit_stack_create                PCRE2_SUFFIX(pcre2_jit_stack_create_)
0878 #define pcre2_jit_stack_free                  PCRE2_SUFFIX(pcre2_jit_stack_free_)
0879 #define pcre2_maketables                      PCRE2_SUFFIX(pcre2_maketables_)
0880 #define pcre2_maketables_free                 PCRE2_SUFFIX(pcre2_maketables_free_)
0881 #define pcre2_match                           PCRE2_SUFFIX(pcre2_match_)
0882 #define pcre2_match_context_copy              PCRE2_SUFFIX(pcre2_match_context_copy_)
0883 #define pcre2_match_context_create            PCRE2_SUFFIX(pcre2_match_context_create_)
0884 #define pcre2_match_context_free              PCRE2_SUFFIX(pcre2_match_context_free_)
0885 #define pcre2_match_data_create               PCRE2_SUFFIX(pcre2_match_data_create_)
0886 #define pcre2_match_data_create_from_pattern  PCRE2_SUFFIX(pcre2_match_data_create_from_pattern_)
0887 #define pcre2_match_data_free                 PCRE2_SUFFIX(pcre2_match_data_free_)
0888 #define pcre2_pattern_convert                 PCRE2_SUFFIX(pcre2_pattern_convert_)
0889 #define pcre2_pattern_info                    PCRE2_SUFFIX(pcre2_pattern_info_)
0890 #define pcre2_serialize_decode                PCRE2_SUFFIX(pcre2_serialize_decode_)
0891 #define pcre2_serialize_encode                PCRE2_SUFFIX(pcre2_serialize_encode_)
0892 #define pcre2_serialize_free                  PCRE2_SUFFIX(pcre2_serialize_free_)
0893 #define pcre2_serialize_get_number_of_codes   PCRE2_SUFFIX(pcre2_serialize_get_number_of_codes_)
0894 #define pcre2_set_bsr                         PCRE2_SUFFIX(pcre2_set_bsr_)
0895 #define pcre2_set_callout                     PCRE2_SUFFIX(pcre2_set_callout_)
0896 #define pcre2_set_character_tables            PCRE2_SUFFIX(pcre2_set_character_tables_)
0897 #define pcre2_set_compile_extra_options       PCRE2_SUFFIX(pcre2_set_compile_extra_options_)
0898 #define pcre2_set_compile_recursion_guard     PCRE2_SUFFIX(pcre2_set_compile_recursion_guard_)
0899 #define pcre2_set_depth_limit                 PCRE2_SUFFIX(pcre2_set_depth_limit_)
0900 #define pcre2_set_glob_escape                 PCRE2_SUFFIX(pcre2_set_glob_escape_)
0901 #define pcre2_set_glob_separator              PCRE2_SUFFIX(pcre2_set_glob_separator_)
0902 #define pcre2_set_heap_limit                  PCRE2_SUFFIX(pcre2_set_heap_limit_)
0903 #define pcre2_set_match_limit                 PCRE2_SUFFIX(pcre2_set_match_limit_)
0904 #define pcre2_set_max_varlookbehind           PCRE2_SUFFIX(pcre2_set_max_varlookbehind_)
0905 #define pcre2_set_max_pattern_length          PCRE2_SUFFIX(pcre2_set_max_pattern_length_)
0906 #define pcre2_set_max_pattern_compiled_length PCRE2_SUFFIX(pcre2_set_max_pattern_compiled_length_)
0907 #define pcre2_set_newline                     PCRE2_SUFFIX(pcre2_set_newline_)
0908 #define pcre2_set_parens_nest_limit           PCRE2_SUFFIX(pcre2_set_parens_nest_limit_)
0909 #define pcre2_set_offset_limit                PCRE2_SUFFIX(pcre2_set_offset_limit_)
0910 #define pcre2_set_substitute_callout          PCRE2_SUFFIX(pcre2_set_substitute_callout_)
0911 #define pcre2_substitute                      PCRE2_SUFFIX(pcre2_substitute_)
0912 #define pcre2_substring_copy_byname           PCRE2_SUFFIX(pcre2_substring_copy_byname_)
0913 #define pcre2_substring_copy_bynumber         PCRE2_SUFFIX(pcre2_substring_copy_bynumber_)
0914 #define pcre2_substring_free                  PCRE2_SUFFIX(pcre2_substring_free_)
0915 #define pcre2_substring_get_byname            PCRE2_SUFFIX(pcre2_substring_get_byname_)
0916 #define pcre2_substring_get_bynumber          PCRE2_SUFFIX(pcre2_substring_get_bynumber_)
0917 #define pcre2_substring_length_byname         PCRE2_SUFFIX(pcre2_substring_length_byname_)
0918 #define pcre2_substring_length_bynumber       PCRE2_SUFFIX(pcre2_substring_length_bynumber_)
0919 #define pcre2_substring_list_get              PCRE2_SUFFIX(pcre2_substring_list_get_)
0920 #define pcre2_substring_list_free             PCRE2_SUFFIX(pcre2_substring_list_free_)
0921 #define pcre2_substring_nametable_scan        PCRE2_SUFFIX(pcre2_substring_nametable_scan_)
0922 #define pcre2_substring_number_from_name      PCRE2_SUFFIX(pcre2_substring_number_from_name_)
0923 
0924 /* Keep this old function name for backwards compatibility */
0925 #define pcre2_set_recursion_limit PCRE2_SUFFIX(pcre2_set_recursion_limit_)
0926 
0927 /* Keep this obsolete function for backwards compatibility: it is now a noop. */
0928 #define pcre2_set_recursion_memory_management PCRE2_SUFFIX(pcre2_set_recursion_memory_management_)
0929 
0930 /* Now generate all three sets of width-specific structures and function
0931 prototypes. */
0932 
0933 #define PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS \
0934 PCRE2_TYPES_LIST \
0935 PCRE2_STRUCTURE_LIST \
0936 PCRE2_GENERAL_INFO_FUNCTIONS \
0937 PCRE2_GENERAL_CONTEXT_FUNCTIONS \
0938 PCRE2_COMPILE_CONTEXT_FUNCTIONS \
0939 PCRE2_CONVERT_CONTEXT_FUNCTIONS \
0940 PCRE2_CONVERT_FUNCTIONS \
0941 PCRE2_MATCH_CONTEXT_FUNCTIONS \
0942 PCRE2_COMPILE_FUNCTIONS \
0943 PCRE2_PATTERN_INFO_FUNCTIONS \
0944 PCRE2_MATCH_FUNCTIONS \
0945 PCRE2_SUBSTRING_FUNCTIONS \
0946 PCRE2_SERIALIZE_FUNCTIONS \
0947 PCRE2_SUBSTITUTE_FUNCTION \
0948 PCRE2_JIT_FUNCTIONS \
0949 PCRE2_OTHER_FUNCTIONS
0950 
0951 #define PCRE2_LOCAL_WIDTH 8
0952 PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
0953 #undef PCRE2_LOCAL_WIDTH
0954 
0955 #define PCRE2_LOCAL_WIDTH 16
0956 PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
0957 #undef PCRE2_LOCAL_WIDTH
0958 
0959 #define PCRE2_LOCAL_WIDTH 32
0960 PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
0961 #undef PCRE2_LOCAL_WIDTH
0962 
0963 /* Undefine the list macros; they are no longer needed. */
0964 
0965 #undef PCRE2_TYPES_LIST
0966 #undef PCRE2_STRUCTURE_LIST
0967 #undef PCRE2_GENERAL_INFO_FUNCTIONS
0968 #undef PCRE2_GENERAL_CONTEXT_FUNCTIONS
0969 #undef PCRE2_COMPILE_CONTEXT_FUNCTIONS
0970 #undef PCRE2_CONVERT_CONTEXT_FUNCTIONS
0971 #undef PCRE2_MATCH_CONTEXT_FUNCTIONS
0972 #undef PCRE2_COMPILE_FUNCTIONS
0973 #undef PCRE2_PATTERN_INFO_FUNCTIONS
0974 #undef PCRE2_MATCH_FUNCTIONS
0975 #undef PCRE2_SUBSTRING_FUNCTIONS
0976 #undef PCRE2_SERIALIZE_FUNCTIONS
0977 #undef PCRE2_SUBSTITUTE_FUNCTION
0978 #undef PCRE2_JIT_FUNCTIONS
0979 #undef PCRE2_OTHER_FUNCTIONS
0980 #undef PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
0981 
0982 /* PCRE2_CODE_UNIT_WIDTH must be defined. If it is 8, 16, or 32, redefine
0983 PCRE2_SUFFIX to use it. If it is 0, undefine the other macros and make
0984 PCRE2_SUFFIX a no-op. Otherwise, generate an error. */
0985 
0986 #undef PCRE2_SUFFIX
0987 #ifndef PCRE2_CODE_UNIT_WIDTH
0988 #error PCRE2_CODE_UNIT_WIDTH must be defined before including pcre2.h.
0989 #error Use 8, 16, or 32; or 0 for a multi-width application.
0990 #else  /* PCRE2_CODE_UNIT_WIDTH is defined */
0991 #if PCRE2_CODE_UNIT_WIDTH == 8 || \
0992     PCRE2_CODE_UNIT_WIDTH == 16 || \
0993     PCRE2_CODE_UNIT_WIDTH == 32
0994 #define PCRE2_SUFFIX(a) PCRE2_GLUE(a, PCRE2_CODE_UNIT_WIDTH)
0995 #elif PCRE2_CODE_UNIT_WIDTH == 0
0996 #undef PCRE2_JOIN
0997 #undef PCRE2_GLUE
0998 #define PCRE2_SUFFIX(a) a
0999 #else
1000 #error PCRE2_CODE_UNIT_WIDTH must be 0, 8, 16, or 32.
1001 #endif
1002 #endif  /* PCRE2_CODE_UNIT_WIDTH is defined */
1003 
1004 #ifdef __cplusplus
1005 }  /* extern "C" */
1006 #endif
1007 
1008 #endif  /* PCRE2_H_IDEMPOTENT_GUARD */
1009 
1010 /* End of pcre2.h */