jpayne@69: /************************************************* jpayne@69: * Perl-Compatible Regular Expressions * jpayne@69: *************************************************/ jpayne@69: jpayne@69: /* This is the public header file for the PCRE library, to be #included by jpayne@69: applications that call the PCRE functions. jpayne@69: jpayne@69: Copyright (c) 1997-2014 University of Cambridge jpayne@69: jpayne@69: ----------------------------------------------------------------------------- jpayne@69: Redistribution and use in source and binary forms, with or without jpayne@69: modification, are permitted provided that the following conditions are met: jpayne@69: jpayne@69: * Redistributions of source code must retain the above copyright notice, jpayne@69: this list of conditions and the following disclaimer. jpayne@69: jpayne@69: * Redistributions in binary form must reproduce the above copyright jpayne@69: notice, this list of conditions and the following disclaimer in the jpayne@69: documentation and/or other materials provided with the distribution. jpayne@69: jpayne@69: * Neither the name of the University of Cambridge nor the names of its jpayne@69: contributors may be used to endorse or promote products derived from jpayne@69: this software without specific prior written permission. jpayne@69: jpayne@69: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" jpayne@69: AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE jpayne@69: IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE jpayne@69: ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE jpayne@69: LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR jpayne@69: CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF jpayne@69: SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS jpayne@69: INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN jpayne@69: CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) jpayne@69: ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE jpayne@69: POSSIBILITY OF SUCH DAMAGE. jpayne@69: ----------------------------------------------------------------------------- jpayne@69: */ jpayne@69: jpayne@69: #ifndef _PCRE_H jpayne@69: #define _PCRE_H jpayne@69: jpayne@69: /* The current PCRE version information. */ jpayne@69: jpayne@69: #define PCRE_MAJOR 8 jpayne@69: #define PCRE_MINOR 45 jpayne@69: #define PCRE_PRERELEASE jpayne@69: #define PCRE_DATE 2021-06-15 jpayne@69: jpayne@69: /* When an application links to a PCRE DLL in Windows, the symbols that are jpayne@69: imported have to be identified as such. When building PCRE, the appropriate jpayne@69: export setting is defined in pcre_internal.h, which includes this file. So we jpayne@69: don't change existing definitions of PCRE_EXP_DECL and PCRECPP_EXP_DECL. */ jpayne@69: jpayne@69: #if defined(_WIN32) && !defined(PCRE_STATIC) jpayne@69: # ifndef PCRE_EXP_DECL jpayne@69: # define PCRE_EXP_DECL extern __declspec(dllimport) jpayne@69: # endif jpayne@69: # ifdef __cplusplus jpayne@69: # ifndef PCRECPP_EXP_DECL jpayne@69: # define PCRECPP_EXP_DECL extern __declspec(dllimport) jpayne@69: # endif jpayne@69: # ifndef PCRECPP_EXP_DEFN jpayne@69: # define PCRECPP_EXP_DEFN __declspec(dllimport) jpayne@69: # endif jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: /* By default, we use the standard "extern" declarations. */ jpayne@69: jpayne@69: #ifndef PCRE_EXP_DECL jpayne@69: # ifdef __cplusplus jpayne@69: # define PCRE_EXP_DECL extern "C" jpayne@69: # else jpayne@69: # define PCRE_EXP_DECL extern jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: #ifdef __cplusplus jpayne@69: # ifndef PCRECPP_EXP_DECL jpayne@69: # define PCRECPP_EXP_DECL extern jpayne@69: # endif jpayne@69: # ifndef PCRECPP_EXP_DEFN jpayne@69: # define PCRECPP_EXP_DEFN jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: /* Have to include stdlib.h in order to ensure that size_t is defined; jpayne@69: it is needed here for malloc. */ jpayne@69: jpayne@69: #include jpayne@69: jpayne@69: /* Allow for C++ users */ jpayne@69: jpayne@69: #ifdef __cplusplus jpayne@69: extern "C" { jpayne@69: #endif jpayne@69: jpayne@69: /* Public options. Some are compile-time only, some are run-time only, and some jpayne@69: are both. Most of the compile-time options are saved with the compiled regex so jpayne@69: that they can be inspected during studying (and therefore JIT compiling). Note jpayne@69: that pcre_study() has its own set of options. Originally, all the options jpayne@69: defined here used distinct bits. However, almost all the bits in a 32-bit word jpayne@69: are now used, so in order to conserve them, option bits that were previously jpayne@69: only recognized at matching time (i.e. by pcre_exec() or pcre_dfa_exec()) may jpayne@69: also be used for compile-time options that affect only compiling and are not jpayne@69: relevant for studying or JIT compiling. jpayne@69: jpayne@69: Some options for pcre_compile() change its behaviour but do not affect the jpayne@69: behaviour of the execution functions. Other options are passed through to the jpayne@69: execution functions and affect their behaviour, with or without affecting the jpayne@69: behaviour of pcre_compile(). jpayne@69: jpayne@69: Options that can be passed to pcre_compile() are tagged Cx below, with these jpayne@69: variants: jpayne@69: jpayne@69: C1 Affects compile only jpayne@69: C2 Does not affect compile; affects exec, dfa_exec jpayne@69: C3 Affects compile, exec, dfa_exec jpayne@69: C4 Affects compile, exec, dfa_exec, study jpayne@69: C5 Affects compile, exec, study jpayne@69: jpayne@69: Options that can be set for pcre_exec() and/or pcre_dfa_exec() are flagged with jpayne@69: E and D, respectively. They take precedence over C3, C4, and C5 settings passed jpayne@69: from pcre_compile(). Those that are compatible with JIT execution are flagged jpayne@69: with J. */ jpayne@69: jpayne@69: #define PCRE_CASELESS 0x00000001 /* C1 */ jpayne@69: #define PCRE_MULTILINE 0x00000002 /* C1 */ jpayne@69: #define PCRE_DOTALL 0x00000004 /* C1 */ jpayne@69: #define PCRE_EXTENDED 0x00000008 /* C1 */ jpayne@69: #define PCRE_ANCHORED 0x00000010 /* C4 E D */ jpayne@69: #define PCRE_DOLLAR_ENDONLY 0x00000020 /* C2 */ jpayne@69: #define PCRE_EXTRA 0x00000040 /* C1 */ jpayne@69: #define PCRE_NOTBOL 0x00000080 /* E D J */ jpayne@69: #define PCRE_NOTEOL 0x00000100 /* E D J */ jpayne@69: #define PCRE_UNGREEDY 0x00000200 /* C1 */ jpayne@69: #define PCRE_NOTEMPTY 0x00000400 /* E D J */ jpayne@69: #define PCRE_UTF8 0x00000800 /* C4 ) */ jpayne@69: #define PCRE_UTF16 0x00000800 /* C4 ) Synonyms */ jpayne@69: #define PCRE_UTF32 0x00000800 /* C4 ) */ jpayne@69: #define PCRE_NO_AUTO_CAPTURE 0x00001000 /* C1 */ jpayne@69: #define PCRE_NO_UTF8_CHECK 0x00002000 /* C1 E D J ) */ jpayne@69: #define PCRE_NO_UTF16_CHECK 0x00002000 /* C1 E D J ) Synonyms */ jpayne@69: #define PCRE_NO_UTF32_CHECK 0x00002000 /* C1 E D J ) */ jpayne@69: #define PCRE_AUTO_CALLOUT 0x00004000 /* C1 */ jpayne@69: #define PCRE_PARTIAL_SOFT 0x00008000 /* E D J ) Synonyms */ jpayne@69: #define PCRE_PARTIAL 0x00008000 /* E D J ) */ jpayne@69: jpayne@69: /* This pair use the same bit. */ jpayne@69: #define PCRE_NEVER_UTF 0x00010000 /* C1 ) Overlaid */ jpayne@69: #define PCRE_DFA_SHORTEST 0x00010000 /* D ) Overlaid */ jpayne@69: jpayne@69: /* This pair use the same bit. */ jpayne@69: #define PCRE_NO_AUTO_POSSESS 0x00020000 /* C1 ) Overlaid */ jpayne@69: #define PCRE_DFA_RESTART 0x00020000 /* D ) Overlaid */ jpayne@69: jpayne@69: #define PCRE_FIRSTLINE 0x00040000 /* C3 */ jpayne@69: #define PCRE_DUPNAMES 0x00080000 /* C1 */ jpayne@69: #define PCRE_NEWLINE_CR 0x00100000 /* C3 E D */ jpayne@69: #define PCRE_NEWLINE_LF 0x00200000 /* C3 E D */ jpayne@69: #define PCRE_NEWLINE_CRLF 0x00300000 /* C3 E D */ jpayne@69: #define PCRE_NEWLINE_ANY 0x00400000 /* C3 E D */ jpayne@69: #define PCRE_NEWLINE_ANYCRLF 0x00500000 /* C3 E D */ jpayne@69: #define PCRE_BSR_ANYCRLF 0x00800000 /* C3 E D */ jpayne@69: #define PCRE_BSR_UNICODE 0x01000000 /* C3 E D */ jpayne@69: #define PCRE_JAVASCRIPT_COMPAT 0x02000000 /* C5 */ jpayne@69: #define PCRE_NO_START_OPTIMIZE 0x04000000 /* C2 E D ) Synonyms */ jpayne@69: #define PCRE_NO_START_OPTIMISE 0x04000000 /* C2 E D ) */ jpayne@69: #define PCRE_PARTIAL_HARD 0x08000000 /* E D J */ jpayne@69: #define PCRE_NOTEMPTY_ATSTART 0x10000000 /* E D J */ jpayne@69: #define PCRE_UCP 0x20000000 /* C3 */ jpayne@69: jpayne@69: /* Exec-time and get/set-time error codes */ jpayne@69: jpayne@69: #define PCRE_ERROR_NOMATCH (-1) jpayne@69: #define PCRE_ERROR_NULL (-2) jpayne@69: #define PCRE_ERROR_BADOPTION (-3) jpayne@69: #define PCRE_ERROR_BADMAGIC (-4) jpayne@69: #define PCRE_ERROR_UNKNOWN_OPCODE (-5) jpayne@69: #define PCRE_ERROR_UNKNOWN_NODE (-5) /* For backward compatibility */ jpayne@69: #define PCRE_ERROR_NOMEMORY (-6) jpayne@69: #define PCRE_ERROR_NOSUBSTRING (-7) jpayne@69: #define PCRE_ERROR_MATCHLIMIT (-8) jpayne@69: #define PCRE_ERROR_CALLOUT (-9) /* Never used by PCRE itself */ jpayne@69: #define PCRE_ERROR_BADUTF8 (-10) /* Same for 8/16/32 */ jpayne@69: #define PCRE_ERROR_BADUTF16 (-10) /* Same for 8/16/32 */ jpayne@69: #define PCRE_ERROR_BADUTF32 (-10) /* Same for 8/16/32 */ jpayne@69: #define PCRE_ERROR_BADUTF8_OFFSET (-11) /* Same for 8/16 */ jpayne@69: #define PCRE_ERROR_BADUTF16_OFFSET (-11) /* Same for 8/16 */ jpayne@69: #define PCRE_ERROR_PARTIAL (-12) jpayne@69: #define PCRE_ERROR_BADPARTIAL (-13) jpayne@69: #define PCRE_ERROR_INTERNAL (-14) jpayne@69: #define PCRE_ERROR_BADCOUNT (-15) jpayne@69: #define PCRE_ERROR_DFA_UITEM (-16) jpayne@69: #define PCRE_ERROR_DFA_UCOND (-17) jpayne@69: #define PCRE_ERROR_DFA_UMLIMIT (-18) jpayne@69: #define PCRE_ERROR_DFA_WSSIZE (-19) jpayne@69: #define PCRE_ERROR_DFA_RECURSE (-20) jpayne@69: #define PCRE_ERROR_RECURSIONLIMIT (-21) jpayne@69: #define PCRE_ERROR_NULLWSLIMIT (-22) /* No longer actually used */ jpayne@69: #define PCRE_ERROR_BADNEWLINE (-23) jpayne@69: #define PCRE_ERROR_BADOFFSET (-24) jpayne@69: #define PCRE_ERROR_SHORTUTF8 (-25) jpayne@69: #define PCRE_ERROR_SHORTUTF16 (-25) /* Same for 8/16 */ jpayne@69: #define PCRE_ERROR_RECURSELOOP (-26) jpayne@69: #define PCRE_ERROR_JIT_STACKLIMIT (-27) jpayne@69: #define PCRE_ERROR_BADMODE (-28) jpayne@69: #define PCRE_ERROR_BADENDIANNESS (-29) jpayne@69: #define PCRE_ERROR_DFA_BADRESTART (-30) jpayne@69: #define PCRE_ERROR_JIT_BADOPTION (-31) jpayne@69: #define PCRE_ERROR_BADLENGTH (-32) jpayne@69: #define PCRE_ERROR_UNSET (-33) jpayne@69: jpayne@69: /* Specific error codes for UTF-8 validity checks */ jpayne@69: jpayne@69: #define PCRE_UTF8_ERR0 0 jpayne@69: #define PCRE_UTF8_ERR1 1 jpayne@69: #define PCRE_UTF8_ERR2 2 jpayne@69: #define PCRE_UTF8_ERR3 3 jpayne@69: #define PCRE_UTF8_ERR4 4 jpayne@69: #define PCRE_UTF8_ERR5 5 jpayne@69: #define PCRE_UTF8_ERR6 6 jpayne@69: #define PCRE_UTF8_ERR7 7 jpayne@69: #define PCRE_UTF8_ERR8 8 jpayne@69: #define PCRE_UTF8_ERR9 9 jpayne@69: #define PCRE_UTF8_ERR10 10 jpayne@69: #define PCRE_UTF8_ERR11 11 jpayne@69: #define PCRE_UTF8_ERR12 12 jpayne@69: #define PCRE_UTF8_ERR13 13 jpayne@69: #define PCRE_UTF8_ERR14 14 jpayne@69: #define PCRE_UTF8_ERR15 15 jpayne@69: #define PCRE_UTF8_ERR16 16 jpayne@69: #define PCRE_UTF8_ERR17 17 jpayne@69: #define PCRE_UTF8_ERR18 18 jpayne@69: #define PCRE_UTF8_ERR19 19 jpayne@69: #define PCRE_UTF8_ERR20 20 jpayne@69: #define PCRE_UTF8_ERR21 21 jpayne@69: #define PCRE_UTF8_ERR22 22 /* Unused (was non-character) */ jpayne@69: jpayne@69: /* Specific error codes for UTF-16 validity checks */ jpayne@69: jpayne@69: #define PCRE_UTF16_ERR0 0 jpayne@69: #define PCRE_UTF16_ERR1 1 jpayne@69: #define PCRE_UTF16_ERR2 2 jpayne@69: #define PCRE_UTF16_ERR3 3 jpayne@69: #define PCRE_UTF16_ERR4 4 /* Unused (was non-character) */ jpayne@69: jpayne@69: /* Specific error codes for UTF-32 validity checks */ jpayne@69: jpayne@69: #define PCRE_UTF32_ERR0 0 jpayne@69: #define PCRE_UTF32_ERR1 1 jpayne@69: #define PCRE_UTF32_ERR2 2 /* Unused (was non-character) */ jpayne@69: #define PCRE_UTF32_ERR3 3 jpayne@69: jpayne@69: /* Request types for pcre_fullinfo() */ jpayne@69: jpayne@69: #define PCRE_INFO_OPTIONS 0 jpayne@69: #define PCRE_INFO_SIZE 1 jpayne@69: #define PCRE_INFO_CAPTURECOUNT 2 jpayne@69: #define PCRE_INFO_BACKREFMAX 3 jpayne@69: #define PCRE_INFO_FIRSTBYTE 4 jpayne@69: #define PCRE_INFO_FIRSTCHAR 4 /* For backwards compatibility */ jpayne@69: #define PCRE_INFO_FIRSTTABLE 5 jpayne@69: #define PCRE_INFO_LASTLITERAL 6 jpayne@69: #define PCRE_INFO_NAMEENTRYSIZE 7 jpayne@69: #define PCRE_INFO_NAMECOUNT 8 jpayne@69: #define PCRE_INFO_NAMETABLE 9 jpayne@69: #define PCRE_INFO_STUDYSIZE 10 jpayne@69: #define PCRE_INFO_DEFAULT_TABLES 11 jpayne@69: #define PCRE_INFO_OKPARTIAL 12 jpayne@69: #define PCRE_INFO_JCHANGED 13 jpayne@69: #define PCRE_INFO_HASCRORLF 14 jpayne@69: #define PCRE_INFO_MINLENGTH 15 jpayne@69: #define PCRE_INFO_JIT 16 jpayne@69: #define PCRE_INFO_JITSIZE 17 jpayne@69: #define PCRE_INFO_MAXLOOKBEHIND 18 jpayne@69: #define PCRE_INFO_FIRSTCHARACTER 19 jpayne@69: #define PCRE_INFO_FIRSTCHARACTERFLAGS 20 jpayne@69: #define PCRE_INFO_REQUIREDCHAR 21 jpayne@69: #define PCRE_INFO_REQUIREDCHARFLAGS 22 jpayne@69: #define PCRE_INFO_MATCHLIMIT 23 jpayne@69: #define PCRE_INFO_RECURSIONLIMIT 24 jpayne@69: #define PCRE_INFO_MATCH_EMPTY 25 jpayne@69: jpayne@69: /* Request types for pcre_config(). Do not re-arrange, in order to remain jpayne@69: compatible. */ jpayne@69: jpayne@69: #define PCRE_CONFIG_UTF8 0 jpayne@69: #define PCRE_CONFIG_NEWLINE 1 jpayne@69: #define PCRE_CONFIG_LINK_SIZE 2 jpayne@69: #define PCRE_CONFIG_POSIX_MALLOC_THRESHOLD 3 jpayne@69: #define PCRE_CONFIG_MATCH_LIMIT 4 jpayne@69: #define PCRE_CONFIG_STACKRECURSE 5 jpayne@69: #define PCRE_CONFIG_UNICODE_PROPERTIES 6 jpayne@69: #define PCRE_CONFIG_MATCH_LIMIT_RECURSION 7 jpayne@69: #define PCRE_CONFIG_BSR 8 jpayne@69: #define PCRE_CONFIG_JIT 9 jpayne@69: #define PCRE_CONFIG_UTF16 10 jpayne@69: #define PCRE_CONFIG_JITTARGET 11 jpayne@69: #define PCRE_CONFIG_UTF32 12 jpayne@69: #define PCRE_CONFIG_PARENS_LIMIT 13 jpayne@69: jpayne@69: /* Request types for pcre_study(). Do not re-arrange, in order to remain jpayne@69: compatible. */ jpayne@69: jpayne@69: #define PCRE_STUDY_JIT_COMPILE 0x0001 jpayne@69: #define PCRE_STUDY_JIT_PARTIAL_SOFT_COMPILE 0x0002 jpayne@69: #define PCRE_STUDY_JIT_PARTIAL_HARD_COMPILE 0x0004 jpayne@69: #define PCRE_STUDY_EXTRA_NEEDED 0x0008 jpayne@69: jpayne@69: /* Bit flags for the pcre[16|32]_extra structure. Do not re-arrange or redefine jpayne@69: these bits, just add new ones on the end, in order to remain compatible. */ jpayne@69: jpayne@69: #define PCRE_EXTRA_STUDY_DATA 0x0001 jpayne@69: #define PCRE_EXTRA_MATCH_LIMIT 0x0002 jpayne@69: #define PCRE_EXTRA_CALLOUT_DATA 0x0004 jpayne@69: #define PCRE_EXTRA_TABLES 0x0008 jpayne@69: #define PCRE_EXTRA_MATCH_LIMIT_RECURSION 0x0010 jpayne@69: #define PCRE_EXTRA_MARK 0x0020 jpayne@69: #define PCRE_EXTRA_EXECUTABLE_JIT 0x0040 jpayne@69: jpayne@69: /* Types */ jpayne@69: jpayne@69: struct real_pcre8_or_16; /* declaration; the definition is private */ jpayne@69: typedef struct real_pcre8_or_16 pcre; jpayne@69: jpayne@69: struct real_pcre8_or_16; /* declaration; the definition is private */ jpayne@69: typedef struct real_pcre8_or_16 pcre16; jpayne@69: jpayne@69: struct real_pcre32; /* declaration; the definition is private */ jpayne@69: typedef struct real_pcre32 pcre32; jpayne@69: jpayne@69: struct real_pcre_jit_stack; /* declaration; the definition is private */ jpayne@69: typedef struct real_pcre_jit_stack pcre_jit_stack; jpayne@69: jpayne@69: struct real_pcre16_jit_stack; /* declaration; the definition is private */ jpayne@69: typedef struct real_pcre16_jit_stack pcre16_jit_stack; jpayne@69: jpayne@69: struct real_pcre32_jit_stack; /* declaration; the definition is private */ jpayne@69: typedef struct real_pcre32_jit_stack pcre32_jit_stack; jpayne@69: jpayne@69: /* If PCRE is compiled with 16 bit character support, PCRE_UCHAR16 must contain jpayne@69: a 16 bit wide signed data type. Otherwise it can be a dummy data type since jpayne@69: pcre16 functions are not implemented. There is a check for this in pcre_internal.h. */ jpayne@69: #ifndef PCRE_UCHAR16 jpayne@69: #define PCRE_UCHAR16 unsigned short jpayne@69: #endif jpayne@69: jpayne@69: #ifndef PCRE_SPTR16 jpayne@69: #define PCRE_SPTR16 const PCRE_UCHAR16 * jpayne@69: #endif jpayne@69: jpayne@69: /* If PCRE is compiled with 32 bit character support, PCRE_UCHAR32 must contain jpayne@69: a 32 bit wide signed data type. Otherwise it can be a dummy data type since jpayne@69: pcre32 functions are not implemented. There is a check for this in pcre_internal.h. */ jpayne@69: #ifndef PCRE_UCHAR32 jpayne@69: #define PCRE_UCHAR32 unsigned int jpayne@69: #endif jpayne@69: jpayne@69: #ifndef PCRE_SPTR32 jpayne@69: #define PCRE_SPTR32 const PCRE_UCHAR32 * jpayne@69: #endif jpayne@69: jpayne@69: /* When PCRE is compiled as a C++ library, the subject pointer type can be jpayne@69: replaced with a custom type. For conventional use, the public interface is a jpayne@69: const char *. */ jpayne@69: jpayne@69: #ifndef PCRE_SPTR jpayne@69: #define PCRE_SPTR const char * jpayne@69: #endif jpayne@69: jpayne@69: /* The structure for passing additional data to pcre_exec(). This is defined in jpayne@69: such as way as to be extensible. Always add new fields at the end, in order to jpayne@69: remain compatible. */ jpayne@69: jpayne@69: typedef struct pcre_extra { jpayne@69: unsigned long int flags; /* Bits for which fields are set */ jpayne@69: void *study_data; /* Opaque data from pcre_study() */ jpayne@69: unsigned long int match_limit; /* Maximum number of calls to match() */ jpayne@69: void *callout_data; /* Data passed back in callouts */ jpayne@69: const unsigned char *tables; /* Pointer to character tables */ jpayne@69: unsigned long int match_limit_recursion; /* Max recursive calls to match() */ jpayne@69: unsigned char **mark; /* For passing back a mark pointer */ jpayne@69: void *executable_jit; /* Contains a pointer to a compiled jit code */ jpayne@69: } pcre_extra; jpayne@69: jpayne@69: /* Same structure as above, but with 16 bit char pointers. */ jpayne@69: jpayne@69: typedef struct pcre16_extra { jpayne@69: unsigned long int flags; /* Bits for which fields are set */ jpayne@69: void *study_data; /* Opaque data from pcre_study() */ jpayne@69: unsigned long int match_limit; /* Maximum number of calls to match() */ jpayne@69: void *callout_data; /* Data passed back in callouts */ jpayne@69: const unsigned char *tables; /* Pointer to character tables */ jpayne@69: unsigned long int match_limit_recursion; /* Max recursive calls to match() */ jpayne@69: PCRE_UCHAR16 **mark; /* For passing back a mark pointer */ jpayne@69: void *executable_jit; /* Contains a pointer to a compiled jit code */ jpayne@69: } pcre16_extra; jpayne@69: jpayne@69: /* Same structure as above, but with 32 bit char pointers. */ jpayne@69: jpayne@69: typedef struct pcre32_extra { jpayne@69: unsigned long int flags; /* Bits for which fields are set */ jpayne@69: void *study_data; /* Opaque data from pcre_study() */ jpayne@69: unsigned long int match_limit; /* Maximum number of calls to match() */ jpayne@69: void *callout_data; /* Data passed back in callouts */ jpayne@69: const unsigned char *tables; /* Pointer to character tables */ jpayne@69: unsigned long int match_limit_recursion; /* Max recursive calls to match() */ jpayne@69: PCRE_UCHAR32 **mark; /* For passing back a mark pointer */ jpayne@69: void *executable_jit; /* Contains a pointer to a compiled jit code */ jpayne@69: } pcre32_extra; jpayne@69: jpayne@69: /* The structure for passing out data via the pcre_callout_function. We use a jpayne@69: structure so that new fields can be added on the end in future versions, jpayne@69: without changing the API of the function, thereby allowing old clients to work jpayne@69: without modification. */ jpayne@69: jpayne@69: typedef struct pcre_callout_block { jpayne@69: int version; /* Identifies version of block */ jpayne@69: /* ------------------------ Version 0 ------------------------------- */ jpayne@69: int callout_number; /* Number compiled into pattern */ jpayne@69: int *offset_vector; /* The offset vector */ jpayne@69: PCRE_SPTR subject; /* The subject being matched */ jpayne@69: int subject_length; /* The length of the subject */ jpayne@69: int start_match; /* Offset to start of this match attempt */ jpayne@69: int current_position; /* Where we currently are in the subject */ jpayne@69: int capture_top; /* Max current capture */ jpayne@69: int capture_last; /* Most recently closed capture */ jpayne@69: void *callout_data; /* Data passed in with the call */ jpayne@69: /* ------------------- Added for Version 1 -------------------------- */ jpayne@69: int pattern_position; /* Offset to next item in the pattern */ jpayne@69: int next_item_length; /* Length of next item in the pattern */ jpayne@69: /* ------------------- Added for Version 2 -------------------------- */ jpayne@69: const unsigned char *mark; /* Pointer to current mark or NULL */ jpayne@69: /* ------------------------------------------------------------------ */ jpayne@69: } pcre_callout_block; jpayne@69: jpayne@69: /* Same structure as above, but with 16 bit char pointers. */ jpayne@69: jpayne@69: typedef struct pcre16_callout_block { jpayne@69: int version; /* Identifies version of block */ jpayne@69: /* ------------------------ Version 0 ------------------------------- */ jpayne@69: int callout_number; /* Number compiled into pattern */ jpayne@69: int *offset_vector; /* The offset vector */ jpayne@69: PCRE_SPTR16 subject; /* The subject being matched */ jpayne@69: int subject_length; /* The length of the subject */ jpayne@69: int start_match; /* Offset to start of this match attempt */ jpayne@69: int current_position; /* Where we currently are in the subject */ jpayne@69: int capture_top; /* Max current capture */ jpayne@69: int capture_last; /* Most recently closed capture */ jpayne@69: void *callout_data; /* Data passed in with the call */ jpayne@69: /* ------------------- Added for Version 1 -------------------------- */ jpayne@69: int pattern_position; /* Offset to next item in the pattern */ jpayne@69: int next_item_length; /* Length of next item in the pattern */ jpayne@69: /* ------------------- Added for Version 2 -------------------------- */ jpayne@69: const PCRE_UCHAR16 *mark; /* Pointer to current mark or NULL */ jpayne@69: /* ------------------------------------------------------------------ */ jpayne@69: } pcre16_callout_block; jpayne@69: jpayne@69: /* Same structure as above, but with 32 bit char pointers. */ jpayne@69: jpayne@69: typedef struct pcre32_callout_block { jpayne@69: int version; /* Identifies version of block */ jpayne@69: /* ------------------------ Version 0 ------------------------------- */ jpayne@69: int callout_number; /* Number compiled into pattern */ jpayne@69: int *offset_vector; /* The offset vector */ jpayne@69: PCRE_SPTR32 subject; /* The subject being matched */ jpayne@69: int subject_length; /* The length of the subject */ jpayne@69: int start_match; /* Offset to start of this match attempt */ jpayne@69: int current_position; /* Where we currently are in the subject */ jpayne@69: int capture_top; /* Max current capture */ jpayne@69: int capture_last; /* Most recently closed capture */ jpayne@69: void *callout_data; /* Data passed in with the call */ jpayne@69: /* ------------------- Added for Version 1 -------------------------- */ jpayne@69: int pattern_position; /* Offset to next item in the pattern */ jpayne@69: int next_item_length; /* Length of next item in the pattern */ jpayne@69: /* ------------------- Added for Version 2 -------------------------- */ jpayne@69: const PCRE_UCHAR32 *mark; /* Pointer to current mark or NULL */ jpayne@69: /* ------------------------------------------------------------------ */ jpayne@69: } pcre32_callout_block; jpayne@69: jpayne@69: /* Indirection for store get and free functions. These can be set to jpayne@69: alternative malloc/free functions if required. Special ones are used in the jpayne@69: non-recursive case for "frames". There is also an optional callout function jpayne@69: that is triggered by the (?) regex item. For Virtual Pascal, these definitions jpayne@69: have to take another form. */ jpayne@69: jpayne@69: #ifndef VPCOMPAT jpayne@69: PCRE_EXP_DECL void *(*pcre_malloc)(size_t); jpayne@69: PCRE_EXP_DECL void (*pcre_free)(void *); jpayne@69: PCRE_EXP_DECL void *(*pcre_stack_malloc)(size_t); jpayne@69: PCRE_EXP_DECL void (*pcre_stack_free)(void *); jpayne@69: PCRE_EXP_DECL int (*pcre_callout)(pcre_callout_block *); jpayne@69: PCRE_EXP_DECL int (*pcre_stack_guard)(void); jpayne@69: jpayne@69: PCRE_EXP_DECL void *(*pcre16_malloc)(size_t); jpayne@69: PCRE_EXP_DECL void (*pcre16_free)(void *); jpayne@69: PCRE_EXP_DECL void *(*pcre16_stack_malloc)(size_t); jpayne@69: PCRE_EXP_DECL void (*pcre16_stack_free)(void *); jpayne@69: PCRE_EXP_DECL int (*pcre16_callout)(pcre16_callout_block *); jpayne@69: PCRE_EXP_DECL int (*pcre16_stack_guard)(void); jpayne@69: jpayne@69: PCRE_EXP_DECL void *(*pcre32_malloc)(size_t); jpayne@69: PCRE_EXP_DECL void (*pcre32_free)(void *); jpayne@69: PCRE_EXP_DECL void *(*pcre32_stack_malloc)(size_t); jpayne@69: PCRE_EXP_DECL void (*pcre32_stack_free)(void *); jpayne@69: PCRE_EXP_DECL int (*pcre32_callout)(pcre32_callout_block *); jpayne@69: PCRE_EXP_DECL int (*pcre32_stack_guard)(void); jpayne@69: #else /* VPCOMPAT */ jpayne@69: PCRE_EXP_DECL void *pcre_malloc(size_t); jpayne@69: PCRE_EXP_DECL void pcre_free(void *); jpayne@69: PCRE_EXP_DECL void *pcre_stack_malloc(size_t); jpayne@69: PCRE_EXP_DECL void pcre_stack_free(void *); jpayne@69: PCRE_EXP_DECL int pcre_callout(pcre_callout_block *); jpayne@69: PCRE_EXP_DECL int pcre_stack_guard(void); jpayne@69: jpayne@69: PCRE_EXP_DECL void *pcre16_malloc(size_t); jpayne@69: PCRE_EXP_DECL void pcre16_free(void *); jpayne@69: PCRE_EXP_DECL void *pcre16_stack_malloc(size_t); jpayne@69: PCRE_EXP_DECL void pcre16_stack_free(void *); jpayne@69: PCRE_EXP_DECL int pcre16_callout(pcre16_callout_block *); jpayne@69: PCRE_EXP_DECL int pcre16_stack_guard(void); jpayne@69: jpayne@69: PCRE_EXP_DECL void *pcre32_malloc(size_t); jpayne@69: PCRE_EXP_DECL void pcre32_free(void *); jpayne@69: PCRE_EXP_DECL void *pcre32_stack_malloc(size_t); jpayne@69: PCRE_EXP_DECL void pcre32_stack_free(void *); jpayne@69: PCRE_EXP_DECL int pcre32_callout(pcre32_callout_block *); jpayne@69: PCRE_EXP_DECL int pcre32_stack_guard(void); jpayne@69: #endif /* VPCOMPAT */ jpayne@69: jpayne@69: /* User defined callback which provides a stack just before the match starts. */ jpayne@69: jpayne@69: typedef pcre_jit_stack *(*pcre_jit_callback)(void *); jpayne@69: typedef pcre16_jit_stack *(*pcre16_jit_callback)(void *); jpayne@69: typedef pcre32_jit_stack *(*pcre32_jit_callback)(void *); jpayne@69: jpayne@69: /* Exported PCRE functions */ jpayne@69: jpayne@69: PCRE_EXP_DECL pcre *pcre_compile(const char *, int, const char **, int *, jpayne@69: const unsigned char *); jpayne@69: PCRE_EXP_DECL pcre16 *pcre16_compile(PCRE_SPTR16, int, const char **, int *, jpayne@69: const unsigned char *); jpayne@69: PCRE_EXP_DECL pcre32 *pcre32_compile(PCRE_SPTR32, int, const char **, int *, jpayne@69: const unsigned char *); jpayne@69: PCRE_EXP_DECL pcre *pcre_compile2(const char *, int, int *, const char **, jpayne@69: int *, const unsigned char *); jpayne@69: PCRE_EXP_DECL pcre16 *pcre16_compile2(PCRE_SPTR16, int, int *, const char **, jpayne@69: int *, const unsigned char *); jpayne@69: PCRE_EXP_DECL pcre32 *pcre32_compile2(PCRE_SPTR32, int, int *, const char **, jpayne@69: int *, const unsigned char *); jpayne@69: PCRE_EXP_DECL int pcre_config(int, void *); jpayne@69: PCRE_EXP_DECL int pcre16_config(int, void *); jpayne@69: PCRE_EXP_DECL int pcre32_config(int, void *); jpayne@69: PCRE_EXP_DECL int pcre_copy_named_substring(const pcre *, const char *, jpayne@69: int *, int, const char *, char *, int); jpayne@69: PCRE_EXP_DECL int pcre16_copy_named_substring(const pcre16 *, PCRE_SPTR16, jpayne@69: int *, int, PCRE_SPTR16, PCRE_UCHAR16 *, int); jpayne@69: PCRE_EXP_DECL int pcre32_copy_named_substring(const pcre32 *, PCRE_SPTR32, jpayne@69: int *, int, PCRE_SPTR32, PCRE_UCHAR32 *, int); jpayne@69: PCRE_EXP_DECL int pcre_copy_substring(const char *, int *, int, int, jpayne@69: char *, int); jpayne@69: PCRE_EXP_DECL int pcre16_copy_substring(PCRE_SPTR16, int *, int, int, jpayne@69: PCRE_UCHAR16 *, int); jpayne@69: PCRE_EXP_DECL int pcre32_copy_substring(PCRE_SPTR32, int *, int, int, jpayne@69: PCRE_UCHAR32 *, int); jpayne@69: PCRE_EXP_DECL int pcre_dfa_exec(const pcre *, const pcre_extra *, jpayne@69: const char *, int, int, int, int *, int , int *, int); jpayne@69: PCRE_EXP_DECL int pcre16_dfa_exec(const pcre16 *, const pcre16_extra *, jpayne@69: PCRE_SPTR16, int, int, int, int *, int , int *, int); jpayne@69: PCRE_EXP_DECL int pcre32_dfa_exec(const pcre32 *, const pcre32_extra *, jpayne@69: PCRE_SPTR32, int, int, int, int *, int , int *, int); jpayne@69: PCRE_EXP_DECL int pcre_exec(const pcre *, const pcre_extra *, PCRE_SPTR, jpayne@69: int, int, int, int *, int); jpayne@69: PCRE_EXP_DECL int pcre16_exec(const pcre16 *, const pcre16_extra *, jpayne@69: PCRE_SPTR16, int, int, int, int *, int); jpayne@69: PCRE_EXP_DECL int pcre32_exec(const pcre32 *, const pcre32_extra *, jpayne@69: PCRE_SPTR32, int, int, int, int *, int); jpayne@69: PCRE_EXP_DECL int pcre_jit_exec(const pcre *, const pcre_extra *, jpayne@69: PCRE_SPTR, int, int, int, int *, int, jpayne@69: pcre_jit_stack *); jpayne@69: PCRE_EXP_DECL int pcre16_jit_exec(const pcre16 *, const pcre16_extra *, jpayne@69: PCRE_SPTR16, int, int, int, int *, int, jpayne@69: pcre16_jit_stack *); jpayne@69: PCRE_EXP_DECL int pcre32_jit_exec(const pcre32 *, const pcre32_extra *, jpayne@69: PCRE_SPTR32, int, int, int, int *, int, jpayne@69: pcre32_jit_stack *); jpayne@69: PCRE_EXP_DECL void pcre_free_substring(const char *); jpayne@69: PCRE_EXP_DECL void pcre16_free_substring(PCRE_SPTR16); jpayne@69: PCRE_EXP_DECL void pcre32_free_substring(PCRE_SPTR32); jpayne@69: PCRE_EXP_DECL void pcre_free_substring_list(const char **); jpayne@69: PCRE_EXP_DECL void pcre16_free_substring_list(PCRE_SPTR16 *); jpayne@69: PCRE_EXP_DECL void pcre32_free_substring_list(PCRE_SPTR32 *); jpayne@69: PCRE_EXP_DECL int pcre_fullinfo(const pcre *, const pcre_extra *, int, jpayne@69: void *); jpayne@69: PCRE_EXP_DECL int pcre16_fullinfo(const pcre16 *, const pcre16_extra *, int, jpayne@69: void *); jpayne@69: PCRE_EXP_DECL int pcre32_fullinfo(const pcre32 *, const pcre32_extra *, int, jpayne@69: void *); jpayne@69: PCRE_EXP_DECL int pcre_get_named_substring(const pcre *, const char *, jpayne@69: int *, int, const char *, const char **); jpayne@69: PCRE_EXP_DECL int pcre16_get_named_substring(const pcre16 *, PCRE_SPTR16, jpayne@69: int *, int, PCRE_SPTR16, PCRE_SPTR16 *); jpayne@69: PCRE_EXP_DECL int pcre32_get_named_substring(const pcre32 *, PCRE_SPTR32, jpayne@69: int *, int, PCRE_SPTR32, PCRE_SPTR32 *); jpayne@69: PCRE_EXP_DECL int pcre_get_stringnumber(const pcre *, const char *); jpayne@69: PCRE_EXP_DECL int pcre16_get_stringnumber(const pcre16 *, PCRE_SPTR16); jpayne@69: PCRE_EXP_DECL int pcre32_get_stringnumber(const pcre32 *, PCRE_SPTR32); jpayne@69: PCRE_EXP_DECL int pcre_get_stringtable_entries(const pcre *, const char *, jpayne@69: char **, char **); jpayne@69: PCRE_EXP_DECL int pcre16_get_stringtable_entries(const pcre16 *, PCRE_SPTR16, jpayne@69: PCRE_UCHAR16 **, PCRE_UCHAR16 **); jpayne@69: PCRE_EXP_DECL int pcre32_get_stringtable_entries(const pcre32 *, PCRE_SPTR32, jpayne@69: PCRE_UCHAR32 **, PCRE_UCHAR32 **); jpayne@69: PCRE_EXP_DECL int pcre_get_substring(const char *, int *, int, int, jpayne@69: const char **); jpayne@69: PCRE_EXP_DECL int pcre16_get_substring(PCRE_SPTR16, int *, int, int, jpayne@69: PCRE_SPTR16 *); jpayne@69: PCRE_EXP_DECL int pcre32_get_substring(PCRE_SPTR32, int *, int, int, jpayne@69: PCRE_SPTR32 *); jpayne@69: PCRE_EXP_DECL int pcre_get_substring_list(const char *, int *, int, jpayne@69: const char ***); jpayne@69: PCRE_EXP_DECL int pcre16_get_substring_list(PCRE_SPTR16, int *, int, jpayne@69: PCRE_SPTR16 **); jpayne@69: PCRE_EXP_DECL int pcre32_get_substring_list(PCRE_SPTR32, int *, int, jpayne@69: PCRE_SPTR32 **); jpayne@69: PCRE_EXP_DECL const unsigned char *pcre_maketables(void); jpayne@69: PCRE_EXP_DECL const unsigned char *pcre16_maketables(void); jpayne@69: PCRE_EXP_DECL const unsigned char *pcre32_maketables(void); jpayne@69: PCRE_EXP_DECL int pcre_refcount(pcre *, int); jpayne@69: PCRE_EXP_DECL int pcre16_refcount(pcre16 *, int); jpayne@69: PCRE_EXP_DECL int pcre32_refcount(pcre32 *, int); jpayne@69: PCRE_EXP_DECL pcre_extra *pcre_study(const pcre *, int, const char **); jpayne@69: PCRE_EXP_DECL pcre16_extra *pcre16_study(const pcre16 *, int, const char **); jpayne@69: PCRE_EXP_DECL pcre32_extra *pcre32_study(const pcre32 *, int, const char **); jpayne@69: PCRE_EXP_DECL void pcre_free_study(pcre_extra *); jpayne@69: PCRE_EXP_DECL void pcre16_free_study(pcre16_extra *); jpayne@69: PCRE_EXP_DECL void pcre32_free_study(pcre32_extra *); jpayne@69: PCRE_EXP_DECL const char *pcre_version(void); jpayne@69: PCRE_EXP_DECL const char *pcre16_version(void); jpayne@69: PCRE_EXP_DECL const char *pcre32_version(void); jpayne@69: jpayne@69: /* Utility functions for byte order swaps. */ jpayne@69: PCRE_EXP_DECL int pcre_pattern_to_host_byte_order(pcre *, pcre_extra *, jpayne@69: const unsigned char *); jpayne@69: PCRE_EXP_DECL int pcre16_pattern_to_host_byte_order(pcre16 *, pcre16_extra *, jpayne@69: const unsigned char *); jpayne@69: PCRE_EXP_DECL int pcre32_pattern_to_host_byte_order(pcre32 *, pcre32_extra *, jpayne@69: const unsigned char *); jpayne@69: PCRE_EXP_DECL int pcre16_utf16_to_host_byte_order(PCRE_UCHAR16 *, jpayne@69: PCRE_SPTR16, int, int *, int); jpayne@69: PCRE_EXP_DECL int pcre32_utf32_to_host_byte_order(PCRE_UCHAR32 *, jpayne@69: PCRE_SPTR32, int, int *, int); jpayne@69: jpayne@69: /* JIT compiler related functions. */ jpayne@69: jpayne@69: PCRE_EXP_DECL pcre_jit_stack *pcre_jit_stack_alloc(int, int); jpayne@69: PCRE_EXP_DECL pcre16_jit_stack *pcre16_jit_stack_alloc(int, int); jpayne@69: PCRE_EXP_DECL pcre32_jit_stack *pcre32_jit_stack_alloc(int, int); jpayne@69: PCRE_EXP_DECL void pcre_jit_stack_free(pcre_jit_stack *); jpayne@69: PCRE_EXP_DECL void pcre16_jit_stack_free(pcre16_jit_stack *); jpayne@69: PCRE_EXP_DECL void pcre32_jit_stack_free(pcre32_jit_stack *); jpayne@69: PCRE_EXP_DECL void pcre_assign_jit_stack(pcre_extra *, jpayne@69: pcre_jit_callback, void *); jpayne@69: PCRE_EXP_DECL void pcre16_assign_jit_stack(pcre16_extra *, jpayne@69: pcre16_jit_callback, void *); jpayne@69: PCRE_EXP_DECL void pcre32_assign_jit_stack(pcre32_extra *, jpayne@69: pcre32_jit_callback, void *); jpayne@69: PCRE_EXP_DECL void pcre_jit_free_unused_memory(void); jpayne@69: PCRE_EXP_DECL void pcre16_jit_free_unused_memory(void); jpayne@69: PCRE_EXP_DECL void pcre32_jit_free_unused_memory(void); jpayne@69: jpayne@69: #ifdef __cplusplus jpayne@69: } /* extern "C" */ jpayne@69: #endif jpayne@69: jpayne@69: #endif /* End of pcre.h */