"Fossies" - the Fresh Open Source Software Archive

Member "vfu-4.18/vslib/pcre2/pcre2-10.20/src/pcre2.h.in" (18 Jun 2015, 32209 Bytes) of package /linux/privat/vfu-4.18.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*************************************************
    2 *       Perl-Compatible Regular Expressions      *
    3 *************************************************/
    4 
    5 /* This is the public header file for the PCRE library, second API, to be
    6 #included by applications that call PCRE2 functions.
    7 
    8            Copyright (c) 2015 University of Cambridge
    9 
   10 -----------------------------------------------------------------------------
   11 Redistribution and use in source and binary forms, with or without
   12 modification, are permitted provided that the following conditions are met:
   13 
   14     * Redistributions of source code must retain the above copyright notice,
   15       this list of conditions and the following disclaimer.
   16 
   17     * Redistributions in binary form must reproduce the above copyright
   18       notice, this list of conditions and the following disclaimer in the
   19       documentation and/or other materials provided with the distribution.
   20 
   21     * Neither the name of the University of Cambridge nor the names of its
   22       contributors may be used to endorse or promote products derived from
   23       this software without specific prior written permission.
   24 
   25 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   26 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   27 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   28 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
   29 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   30 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   31 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   32 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   33 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   34 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   35 POSSIBILITY OF SUCH DAMAGE.
   36 -----------------------------------------------------------------------------
   37 */
   38 
   39 #ifndef _PCRE2_H
   40 #define _PCRE2_H
   41 
   42 /* The current PCRE version information. */
   43 
   44 #define PCRE2_MAJOR          @PCRE2_MAJOR@
   45 #define PCRE2_MINOR          @PCRE2_MINOR@
   46 #define PCRE2_PRERELEASE     @PCRE2_PRERELEASE@
   47 #define PCRE2_DATE           @PCRE2_DATE@
   48 
   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. */
   53 
   54 #if defined(_WIN32) && !defined(PCRE2_STATIC)
   55 #  ifndef PCRE2_EXP_DECL
   56 #    define PCRE2_EXP_DECL  extern __declspec(dllimport)
   57 #  endif
   58 #endif
   59 
   60 /* By default, we use the standard "extern" declarations. */
   61 
   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
   69 
   70 /* Have to include limits.h, stdlib.h and stdint.h to ensure that size_t and
   71 uint8_t, UCHAR_MAX, etc are defined. */
   72 
   73 #include <limits.h>
   74 #include <stdlib.h>
   75 #include <stdint.h>
   76 
   77 /* Allow for C++ users compiling this directly. */
   78 
   79 #ifdef __cplusplus
   80 extern "C" {
   81 #endif
   82 
   83 /* The following option bits can be passed to pcre2_compile(), pcre2_match(),
   84 or pcre2_dfa_match(). PCRE2_NO_UTF_CHECK affects only the function to which it
   85 is passed. Put these bits at the most significant end of the options word so
   86 others can be added next to them */
   87 
   88 #define PCRE2_ANCHORED            0x80000000u
   89 #define PCRE2_NO_UTF_CHECK        0x40000000u
   90 
   91 /* The following option bits can be passed only to pcre2_compile(). However,
   92 they may affect compilation, JIT compilation, and/or interpretive execution.
   93 The following tags indicate which:
   94 
   95 C   alters what is compiled by pcre2_compile()
   96 J   alters what is compiled by pcre2_jit_compile()
   97 M   is inspected during pcre2_match() execution
   98 D   is inspected during pcre2_dfa_match() execution
   99 */
  100 
  101 #define PCRE2_ALLOW_EMPTY_CLASS   0x00000001u  /* C       */
  102 #define PCRE2_ALT_BSUX            0x00000002u  /* C       */
  103 #define PCRE2_AUTO_CALLOUT        0x00000004u  /* C       */
  104 #define PCRE2_CASELESS            0x00000008u  /* C       */
  105 #define PCRE2_DOLLAR_ENDONLY      0x00000010u  /*   J M D */
  106 #define PCRE2_DOTALL              0x00000020u  /* C       */
  107 #define PCRE2_DUPNAMES            0x00000040u  /* C       */
  108 #define PCRE2_EXTENDED            0x00000080u  /* C       */
  109 #define PCRE2_FIRSTLINE           0x00000100u  /*   J M D */
  110 #define PCRE2_MATCH_UNSET_BACKREF 0x00000200u  /* C J M   */
  111 #define PCRE2_MULTILINE           0x00000400u  /* C       */
  112 #define PCRE2_NEVER_UCP           0x00000800u  /* C       */
  113 #define PCRE2_NEVER_UTF           0x00001000u  /* C       */
  114 #define PCRE2_NO_AUTO_CAPTURE     0x00002000u  /* C       */
  115 #define PCRE2_NO_AUTO_POSSESS     0x00004000u  /* C       */
  116 #define PCRE2_NO_DOTSTAR_ANCHOR   0x00008000u  /* C       */
  117 #define PCRE2_NO_START_OPTIMIZE   0x00010000u  /*   J M D */
  118 #define PCRE2_UCP                 0x00020000u  /* C J M D */
  119 #define PCRE2_UNGREEDY            0x00040000u  /* C       */
  120 #define PCRE2_UTF                 0x00080000u  /* C J M D */
  121 #define PCRE2_NEVER_BACKSLASH_C   0x00100000u  /* C       */
  122 #define PCRE2_ALT_CIRCUMFLEX      0x00200000u  /*   J M D */
  123 
  124 /* These are for pcre2_jit_compile(). */
  125 
  126 #define PCRE2_JIT_COMPLETE        0x00000001u  /* For full matching */
  127 #define PCRE2_JIT_PARTIAL_SOFT    0x00000002u
  128 #define PCRE2_JIT_PARTIAL_HARD    0x00000004u
  129 
  130 /* These are for pcre2_match(), pcre2_dfa_match(), and pcre2_jit_match(). Note
  131 that PCRE2_ANCHORED and PCRE2_NO_UTF_CHECK can also be passed to these
  132 functions (though pcre2_jit_match() ignores the latter since it bypasses all
  133 sanity checks). */
  134 
  135 #define PCRE2_NOTBOL              0x00000001u
  136 #define PCRE2_NOTEOL              0x00000002u
  137 #define PCRE2_NOTEMPTY            0x00000004u  /* ) These two must be kept */
  138 #define PCRE2_NOTEMPTY_ATSTART    0x00000008u  /* ) adjacent to each other. */
  139 #define PCRE2_PARTIAL_SOFT        0x00000010u
  140 #define PCRE2_PARTIAL_HARD        0x00000020u
  141 
  142 /* These are additional options for pcre2_dfa_match(). */
  143 
  144 #define PCRE2_DFA_RESTART         0x00000040u
  145 #define PCRE2_DFA_SHORTEST        0x00000080u
  146 
  147 /* This is an additional option for pcre2_substitute(). */
  148 
  149 #define PCRE2_SUBSTITUTE_GLOBAL   0x00000100u
  150 
  151 /* Newline and \R settings, for use in compile contexts. The newline values
  152 must be kept in step with values set in config.h and both sets must all be
  153 greater than zero. */
  154 
  155 #define PCRE2_NEWLINE_CR          1
  156 #define PCRE2_NEWLINE_LF          2
  157 #define PCRE2_NEWLINE_CRLF        3
  158 #define PCRE2_NEWLINE_ANY         4
  159 #define PCRE2_NEWLINE_ANYCRLF     5
  160 
  161 #define PCRE2_BSR_UNICODE         1
  162 #define PCRE2_BSR_ANYCRLF         2
  163 
  164 /* Error codes: no match and partial match are "expected" errors. */
  165 
  166 #define PCRE2_ERROR_NOMATCH          (-1)
  167 #define PCRE2_ERROR_PARTIAL          (-2)
  168 
  169 /* Error codes for UTF-8 validity checks */
  170 
  171 #define PCRE2_ERROR_UTF8_ERR1        (-3)
  172 #define PCRE2_ERROR_UTF8_ERR2        (-4)
  173 #define PCRE2_ERROR_UTF8_ERR3        (-5)
  174 #define PCRE2_ERROR_UTF8_ERR4        (-6)
  175 #define PCRE2_ERROR_UTF8_ERR5        (-7)
  176 #define PCRE2_ERROR_UTF8_ERR6        (-8)
  177 #define PCRE2_ERROR_UTF8_ERR7        (-9)
  178 #define PCRE2_ERROR_UTF8_ERR8       (-10)
  179 #define PCRE2_ERROR_UTF8_ERR9       (-11)
  180 #define PCRE2_ERROR_UTF8_ERR10      (-12)
  181 #define PCRE2_ERROR_UTF8_ERR11      (-13)
  182 #define PCRE2_ERROR_UTF8_ERR12      (-14)
  183 #define PCRE2_ERROR_UTF8_ERR13      (-15)
  184 #define PCRE2_ERROR_UTF8_ERR14      (-16)
  185 #define PCRE2_ERROR_UTF8_ERR15      (-17)
  186 #define PCRE2_ERROR_UTF8_ERR16      (-18)
  187 #define PCRE2_ERROR_UTF8_ERR17      (-19)
  188 #define PCRE2_ERROR_UTF8_ERR18      (-20)
  189 #define PCRE2_ERROR_UTF8_ERR19      (-21)
  190 #define PCRE2_ERROR_UTF8_ERR20      (-22)
  191 #define PCRE2_ERROR_UTF8_ERR21      (-23)
  192 
  193 /* Error codes for UTF-16 validity checks */
  194 
  195 #define PCRE2_ERROR_UTF16_ERR1      (-24)
  196 #define PCRE2_ERROR_UTF16_ERR2      (-25)
  197 #define PCRE2_ERROR_UTF16_ERR3      (-26)
  198 
  199 /* Error codes for UTF-32 validity checks */
  200 
  201 #define PCRE2_ERROR_UTF32_ERR1      (-27)
  202 #define PCRE2_ERROR_UTF32_ERR2      (-28)
  203 
  204 /* Error codes for pcre2[_dfa]_match(), substring extraction functions, context
  205 functions, and serializing functions. They are in numerical order. Originally
  206 they were in alphabetical order too, but now that PCRE2 is released, the
  207 numbers must not be changed. */
  208 
  209 #define PCRE2_ERROR_BADDATA           (-29)
  210 #define PCRE2_ERROR_MIXEDTABLES       (-30)  /* Name was changed */
  211 #define PCRE2_ERROR_BADMAGIC          (-31)
  212 #define PCRE2_ERROR_BADMODE           (-32)
  213 #define PCRE2_ERROR_BADOFFSET         (-33)
  214 #define PCRE2_ERROR_BADOPTION         (-34)
  215 #define PCRE2_ERROR_BADREPLACEMENT    (-35)
  216 #define PCRE2_ERROR_BADUTFOFFSET      (-36)
  217 #define PCRE2_ERROR_CALLOUT           (-37)  /* Never used by PCRE2 itself */
  218 #define PCRE2_ERROR_DFA_BADRESTART    (-38)
  219 #define PCRE2_ERROR_DFA_RECURSE       (-39)
  220 #define PCRE2_ERROR_DFA_UCOND         (-40)
  221 #define PCRE2_ERROR_DFA_UFUNC         (-41)
  222 #define PCRE2_ERROR_DFA_UITEM         (-42)
  223 #define PCRE2_ERROR_DFA_WSSIZE        (-43)
  224 #define PCRE2_ERROR_INTERNAL          (-44)
  225 #define PCRE2_ERROR_JIT_BADOPTION     (-45)
  226 #define PCRE2_ERROR_JIT_STACKLIMIT    (-46)
  227 #define PCRE2_ERROR_MATCHLIMIT        (-47)
  228 #define PCRE2_ERROR_NOMEMORY          (-48)
  229 #define PCRE2_ERROR_NOSUBSTRING       (-49)
  230 #define PCRE2_ERROR_NOUNIQUESUBSTRING (-50)
  231 #define PCRE2_ERROR_NULL              (-51)
  232 #define PCRE2_ERROR_RECURSELOOP       (-52)
  233 #define PCRE2_ERROR_RECURSIONLIMIT    (-53)
  234 #define PCRE2_ERROR_UNAVAILABLE       (-54)
  235 #define PCRE2_ERROR_UNSET             (-55)
  236 
  237 /* Request types for pcre2_pattern_info() */
  238 
  239 #define PCRE2_INFO_ALLOPTIONS            0
  240 #define PCRE2_INFO_ARGOPTIONS            1
  241 #define PCRE2_INFO_BACKREFMAX            2
  242 #define PCRE2_INFO_BSR                   3
  243 #define PCRE2_INFO_CAPTURECOUNT          4
  244 #define PCRE2_INFO_FIRSTCODEUNIT         5
  245 #define PCRE2_INFO_FIRSTCODETYPE         6
  246 #define PCRE2_INFO_FIRSTBITMAP           7
  247 #define PCRE2_INFO_HASCRORLF             8
  248 #define PCRE2_INFO_JCHANGED              9
  249 #define PCRE2_INFO_JITSIZE              10
  250 #define PCRE2_INFO_LASTCODEUNIT         11
  251 #define PCRE2_INFO_LASTCODETYPE         12
  252 #define PCRE2_INFO_MATCHEMPTY           13
  253 #define PCRE2_INFO_MATCHLIMIT           14
  254 #define PCRE2_INFO_MAXLOOKBEHIND        15
  255 #define PCRE2_INFO_MINLENGTH            16
  256 #define PCRE2_INFO_NAMECOUNT            17
  257 #define PCRE2_INFO_NAMEENTRYSIZE        18
  258 #define PCRE2_INFO_NAMETABLE            19
  259 #define PCRE2_INFO_NEWLINE              20
  260 #define PCRE2_INFO_RECURSIONLIMIT       21
  261 #define PCRE2_INFO_SIZE                 22
  262 
  263 /* Request types for pcre2_config(). */
  264 
  265 #define PCRE2_CONFIG_BSR                     0
  266 #define PCRE2_CONFIG_JIT                     1
  267 #define PCRE2_CONFIG_JITTARGET               2
  268 #define PCRE2_CONFIG_LINKSIZE                3
  269 #define PCRE2_CONFIG_MATCHLIMIT              4
  270 #define PCRE2_CONFIG_NEWLINE                 5
  271 #define PCRE2_CONFIG_PARENSLIMIT             6
  272 #define PCRE2_CONFIG_RECURSIONLIMIT          7
  273 #define PCRE2_CONFIG_STACKRECURSE            8
  274 #define PCRE2_CONFIG_UNICODE                 9
  275 #define PCRE2_CONFIG_UNICODE_VERSION        10
  276 #define PCRE2_CONFIG_VERSION                11
  277 
  278 /* Types for code units in patterns and subject strings. */
  279 
  280 typedef uint8_t  PCRE2_UCHAR8;
  281 typedef uint16_t PCRE2_UCHAR16;
  282 typedef uint32_t PCRE2_UCHAR32;
  283 
  284 typedef const PCRE2_UCHAR8  *PCRE2_SPTR8;
  285 typedef const PCRE2_UCHAR16 *PCRE2_SPTR16;
  286 typedef const PCRE2_UCHAR32 *PCRE2_SPTR32;
  287 
  288 /* The PCRE2_SIZE type is used for all string lengths and offsets in PCRE2,
  289 including pattern offsets for errors and subject offsets after a match. We
  290 define special values to indicate zero-terminated strings and unset offsets in
  291 the offset vector (ovector). */
  292 
  293 #define PCRE2_SIZE            size_t
  294 #define PCRE2_ZERO_TERMINATED (~(PCRE2_SIZE)0)
  295 #define PCRE2_UNSET           (~(PCRE2_SIZE)0)
  296 
  297 /* Generic types for opaque structures and JIT callback functions. These
  298 declarations are defined in a macro that is expanded for each width later. */
  299 
  300 #define PCRE2_TYPES_LIST \
  301 struct pcre2_real_general_context; \
  302 typedef struct pcre2_real_general_context pcre2_general_context; \
  303 \
  304 struct pcre2_real_compile_context; \
  305 typedef struct pcre2_real_compile_context pcre2_compile_context; \
  306 \
  307 struct pcre2_real_match_context; \
  308 typedef struct pcre2_real_match_context pcre2_match_context; \
  309 \
  310 struct pcre2_real_code; \
  311 typedef struct pcre2_real_code pcre2_code; \
  312 \
  313 struct pcre2_real_match_data; \
  314 typedef struct pcre2_real_match_data pcre2_match_data; \
  315 \
  316 struct pcre2_real_jit_stack; \
  317 typedef struct pcre2_real_jit_stack pcre2_jit_stack; \
  318 \
  319 typedef pcre2_jit_stack *(*pcre2_jit_callback)(void *);
  320 
  321 
  322 /* The structure for passing out data via the pcre_callout_function. We use a
  323 structure so that new fields can be added on the end in future versions,
  324 without changing the API of the function, thereby allowing old clients to work
  325 without modification. Define the generic version in a macro; the width-specific
  326 versions are generated from this macro below. */
  327 
  328 #define PCRE2_STRUCTURE_LIST \
  329 typedef struct pcre2_callout_block { \
  330   uint32_t      version;           /* Identifies version of block */ \
  331   /* ------------------------ Version 0 ------------------------------- */ \
  332   uint32_t      callout_number;    /* Number compiled into pattern */ \
  333   uint32_t      capture_top;       /* Max current capture */ \
  334   uint32_t      capture_last;      /* Most recently closed capture */ \
  335   PCRE2_SIZE   *offset_vector;     /* The offset vector */ \
  336   PCRE2_SPTR    mark;              /* Pointer to current mark or NULL */ \
  337   PCRE2_SPTR    subject;           /* The subject being matched */ \
  338   PCRE2_SIZE    subject_length;    /* The length of the subject */ \
  339   PCRE2_SIZE    start_match;       /* Offset to start of this match attempt */ \
  340   PCRE2_SIZE    current_position;  /* Where we currently are in the subject */ \
  341   PCRE2_SIZE    pattern_position;  /* Offset to next item in the pattern */ \
  342   PCRE2_SIZE    next_item_length;  /* Length of next item in the pattern */ \
  343   /* ------------------- Added for Version 1 -------------------------- */ \
  344   PCRE2_SIZE    callout_string_offset; /* Offset to string within pattern */ \
  345   PCRE2_SIZE    callout_string_length; /* Length of string compiled into pattern */ \
  346   PCRE2_SPTR    callout_string;    /* String compiled into pattern */ \
  347   /* ------------------------------------------------------------------ */ \
  348 } pcre2_callout_block; \
  349 \
  350 typedef struct pcre2_callout_enumerate_block { \
  351   uint32_t      version;           /* Identifies version of block */ \
  352   /* ------------------------ Version 0 ------------------------------- */ \
  353   PCRE2_SIZE    pattern_position;  /* Offset to next item in the pattern */ \
  354   PCRE2_SIZE    next_item_length;  /* Length of next item in the pattern */ \
  355   uint32_t      callout_number;    /* Number compiled into pattern */ \
  356   PCRE2_SIZE    callout_string_offset; /* Offset to string within pattern */ \
  357   PCRE2_SIZE    callout_string_length; /* Length of string compiled into pattern */ \
  358   PCRE2_SPTR    callout_string;    /* String compiled into pattern */ \
  359   /* ------------------------------------------------------------------ */ \
  360 } pcre2_callout_enumerate_block;
  361 
  362 
  363 /* List the generic forms of all other functions in macros, which will be
  364 expanded for each width below. Start with functions that give general
  365 information. */
  366 
  367 #define PCRE2_GENERAL_INFO_FUNCTIONS \
  368 PCRE2_EXP_DECL int       pcre2_config(uint32_t, void *);
  369 
  370 
  371 /* Functions for manipulating contexts. */
  372 
  373 #define PCRE2_GENERAL_CONTEXT_FUNCTIONS \
  374 PCRE2_EXP_DECL \
  375   pcre2_general_context *pcre2_general_context_copy(pcre2_general_context *); \
  376 PCRE2_EXP_DECL \
  377   pcre2_general_context *pcre2_general_context_create( \
  378                            void *(*)(PCRE2_SIZE, void *), \
  379                            void (*)(void *, void *), void *); \
  380 PCRE2_EXP_DECL void      pcre2_general_context_free(pcre2_general_context *);
  381 
  382 #define PCRE2_COMPILE_CONTEXT_FUNCTIONS \
  383 PCRE2_EXP_DECL \
  384   pcre2_compile_context *pcre2_compile_context_copy(pcre2_compile_context *); \
  385 PCRE2_EXP_DECL \
  386   pcre2_compile_context *pcre2_compile_context_create(pcre2_general_context *);\
  387 PCRE2_EXP_DECL void      pcre2_compile_context_free(pcre2_compile_context *); \
  388 PCRE2_EXP_DECL int       pcre2_set_bsr(pcre2_compile_context *, uint32_t); \
  389 PCRE2_EXP_DECL int       pcre2_set_character_tables(pcre2_compile_context *, \
  390                            const unsigned char *); \
  391 PCRE2_EXP_DECL int       pcre2_set_newline(pcre2_compile_context *, uint32_t); \
  392 PCRE2_EXP_DECL int       pcre2_set_parens_nest_limit(pcre2_compile_context *, \
  393                            uint32_t); \
  394 PCRE2_EXP_DECL int       pcre2_set_compile_recursion_guard(\
  395                            pcre2_compile_context *, int (*)(uint32_t, void *), \
  396                            void *);
  397 
  398 #define PCRE2_MATCH_CONTEXT_FUNCTIONS \
  399 PCRE2_EXP_DECL \
  400   pcre2_match_context   *pcre2_match_context_copy(pcre2_match_context *); \
  401 PCRE2_EXP_DECL \
  402   pcre2_match_context   *pcre2_match_context_create(pcre2_general_context *); \
  403 PCRE2_EXP_DECL void      pcre2_match_context_free(pcre2_match_context *); \
  404 PCRE2_EXP_DECL int       pcre2_set_callout(pcre2_match_context *, \
  405                            int (*)(pcre2_callout_block *, void *), void *); \
  406 PCRE2_EXP_DECL int       pcre2_set_match_limit(pcre2_match_context *, \
  407                            uint32_t); \
  408 PCRE2_EXP_DECL int       pcre2_set_recursion_limit(pcre2_match_context *, \
  409                            uint32_t); \
  410 PCRE2_EXP_DECL int       pcre2_set_recursion_memory_management( \
  411                            pcre2_match_context *, void *(*)(PCRE2_SIZE, void *), \
  412                            void (*)(void *, void *), void *);
  413 
  414 
  415 /* Functions concerned with compiling a pattern to PCRE internal code. */
  416 
  417 #define PCRE2_COMPILE_FUNCTIONS \
  418 PCRE2_EXP_DECL \
  419   pcre2_code            *pcre2_compile(PCRE2_SPTR, PCRE2_SIZE, uint32_t, \
  420                            int *, PCRE2_SIZE *, pcre2_compile_context *); \
  421 PCRE2_EXP_DECL void      pcre2_code_free(pcre2_code *);
  422 
  423 
  424 /* Functions that give information about a compiled pattern. */
  425 
  426 #define PCRE2_PATTERN_INFO_FUNCTIONS \
  427 PCRE2_EXP_DECL int       pcre2_pattern_info(const pcre2_code *, uint32_t, \
  428                            void *); \
  429 PCRE2_EXP_DECL int       pcre2_callout_enumerate(const pcre2_code *, \
  430                            int (*)(pcre2_callout_enumerate_block *, void *), \
  431                            void *);
  432 
  433 
  434 /* Functions for running a match and inspecting the result. */
  435 
  436 #define PCRE2_MATCH_FUNCTIONS \
  437 PCRE2_EXP_DECL \
  438   pcre2_match_data        *pcre2_match_data_create(uint32_t, \
  439                              pcre2_general_context *); \
  440 PCRE2_EXP_DECL \
  441   pcre2_match_data        *pcre2_match_data_create_from_pattern(\
  442                              const pcre2_code *, \
  443                              pcre2_general_context *); \
  444 PCRE2_EXP_DECL int         pcre2_dfa_match(const pcre2_code *, PCRE2_SPTR, \
  445                              PCRE2_SIZE, PCRE2_SIZE, uint32_t, \
  446                              pcre2_match_data *, pcre2_match_context *, int *, \
  447                              PCRE2_SIZE); \
  448 PCRE2_EXP_DECL int         pcre2_match(const pcre2_code *, \
  449                              PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, uint32_t, \
  450                              pcre2_match_data *, pcre2_match_context *); \
  451 PCRE2_EXP_DECL void        pcre2_match_data_free(pcre2_match_data *); \
  452 PCRE2_EXP_DECL PCRE2_SPTR  pcre2_get_mark(pcre2_match_data *); \
  453 PCRE2_EXP_DECL uint32_t    pcre2_get_ovector_count(pcre2_match_data *); \
  454 PCRE2_EXP_DECL PCRE2_SIZE *pcre2_get_ovector_pointer(pcre2_match_data *); \
  455 PCRE2_EXP_DECL PCRE2_SIZE  pcre2_get_startchar(pcre2_match_data *);
  456 
  457 
  458 /* Convenience functions for handling matched substrings. */
  459 
  460 #define PCRE2_SUBSTRING_FUNCTIONS \
  461 PCRE2_EXP_DECL int       pcre2_substring_copy_byname(pcre2_match_data *, \
  462                            PCRE2_SPTR, PCRE2_UCHAR *, PCRE2_SIZE *); \
  463 PCRE2_EXP_DECL int       pcre2_substring_copy_bynumber(pcre2_match_data *, \
  464                            uint32_t, PCRE2_UCHAR *, PCRE2_SIZE *); \
  465 PCRE2_EXP_DECL void      pcre2_substring_free(PCRE2_UCHAR *); \
  466 PCRE2_EXP_DECL int       pcre2_substring_get_byname(pcre2_match_data *, \
  467                            PCRE2_SPTR, PCRE2_UCHAR **, PCRE2_SIZE *); \
  468 PCRE2_EXP_DECL int       pcre2_substring_get_bynumber(pcre2_match_data *, \
  469                            uint32_t, PCRE2_UCHAR **, PCRE2_SIZE *); \
  470 PCRE2_EXP_DECL int       pcre2_substring_length_byname(pcre2_match_data *, \
  471                            PCRE2_SPTR, PCRE2_SIZE *); \
  472 PCRE2_EXP_DECL int       pcre2_substring_length_bynumber(pcre2_match_data *, \
  473                            uint32_t, PCRE2_SIZE *); \
  474 PCRE2_EXP_DECL int       pcre2_substring_nametable_scan(const pcre2_code *, \
  475                            PCRE2_SPTR, PCRE2_SPTR *, PCRE2_SPTR *); \
  476 PCRE2_EXP_DECL int       pcre2_substring_number_from_name(\
  477                            const pcre2_code *, PCRE2_SPTR); \
  478 PCRE2_EXP_DECL void      pcre2_substring_list_free(PCRE2_SPTR *); \
  479 PCRE2_EXP_DECL int       pcre2_substring_list_get(pcre2_match_data *, \
  480                            PCRE2_UCHAR ***, PCRE2_SIZE **);
  481 
  482 /* Functions for serializing / deserializing compiled patterns. */
  483 
  484 #define PCRE2_SERIALIZE_FUNCTIONS \
  485 PCRE2_EXP_DECL int32_t   pcre2_serialize_encode(const pcre2_code **, \
  486                            int32_t, uint8_t **, PCRE2_SIZE *, \
  487                            pcre2_general_context *); \
  488 PCRE2_EXP_DECL int32_t   pcre2_serialize_decode(pcre2_code **, int32_t, \
  489                            const uint8_t *, pcre2_general_context *); \
  490 PCRE2_EXP_DECL int32_t   pcre2_serialize_get_number_of_codes(const uint8_t *); \
  491 PCRE2_EXP_DECL void      pcre2_serialize_free(uint8_t *);
  492 
  493 
  494 /* Convenience function for match + substitute. */
  495 
  496 #define PCRE2_SUBSTITUTE_FUNCTION \
  497 PCRE2_EXP_DECL int       pcre2_substitute(const pcre2_code *, \
  498                            PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, uint32_t, \
  499                            pcre2_match_data *, pcre2_match_context *, \
  500                            PCRE2_SPTR, PCRE2_SIZE, PCRE2_UCHAR *, \
  501                            PCRE2_SIZE *);
  502 
  503 
  504 /* Functions for JIT processing */
  505 
  506 #define PCRE2_JIT_FUNCTIONS \
  507 PCRE2_EXP_DECL int       pcre2_jit_compile(pcre2_code *, uint32_t); \
  508 PCRE2_EXP_DECL int       pcre2_jit_match(const pcre2_code *, \
  509                            PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, uint32_t, \
  510                            pcre2_match_data *, pcre2_match_context *); \
  511 PCRE2_EXP_DECL void      pcre2_jit_free_unused_memory(pcre2_general_context *); \
  512 PCRE2_EXP_DECL \
  513   pcre2_jit_stack       *pcre2_jit_stack_create(PCRE2_SIZE, PCRE2_SIZE, \
  514                            pcre2_general_context *); \
  515 PCRE2_EXP_DECL void      pcre2_jit_stack_assign(pcre2_match_context *, \
  516                            pcre2_jit_callback, void *); \
  517 PCRE2_EXP_DECL void      pcre2_jit_stack_free(pcre2_jit_stack *);
  518 
  519 
  520 /* Other miscellaneous functions. */
  521 
  522 #define PCRE2_OTHER_FUNCTIONS \
  523 PCRE2_EXP_DECL int       pcre2_get_error_message(int, PCRE2_UCHAR *, PCRE2_SIZE); \
  524 PCRE2_EXP_DECL \
  525   const uint8_t         *pcre2_maketables(pcre2_general_context *); \
  526 
  527 
  528 /* Define macros that generate width-specific names from generic versions. The
  529 three-level macro scheme is necessary to get the macros expanded when we want
  530 them to be. First we get the width from PCRE2_LOCAL_WIDTH, which is used for
  531 generating three versions of everything below. After that, PCRE2_SUFFIX will be
  532 re-defined to use PCRE2_CODE_UNIT_WIDTH, for use when macros such as
  533 pcre2_compile are called by application code. */
  534 
  535 #define PCRE2_JOIN(a,b) a ## b
  536 #define PCRE2_GLUE(a,b) PCRE2_JOIN(a,b)
  537 #define PCRE2_SUFFIX(a) PCRE2_GLUE(a,PCRE2_LOCAL_WIDTH)
  538 
  539 
  540 /* Data types */
  541 
  542 #define PCRE2_UCHAR                 PCRE2_SUFFIX(PCRE2_UCHAR)
  543 #define PCRE2_SPTR                  PCRE2_SUFFIX(PCRE2_SPTR)
  544 
  545 #define pcre2_code                  PCRE2_SUFFIX(pcre2_code_)
  546 #define pcre2_jit_callback          PCRE2_SUFFIX(pcre2_jit_callback_)
  547 #define pcre2_jit_stack             PCRE2_SUFFIX(pcre2_jit_stack_)
  548 
  549 #define pcre2_real_code             PCRE2_SUFFIX(pcre2_real_code_)
  550 #define pcre2_real_general_context  PCRE2_SUFFIX(pcre2_real_general_context_)
  551 #define pcre2_real_compile_context  PCRE2_SUFFIX(pcre2_real_compile_context_)
  552 #define pcre2_real_match_context    PCRE2_SUFFIX(pcre2_real_match_context_)
  553 #define pcre2_real_jit_stack        PCRE2_SUFFIX(pcre2_real_jit_stack_)
  554 #define pcre2_real_match_data       PCRE2_SUFFIX(pcre2_real_match_data_)
  555 
  556 
  557 /* Data blocks */
  558 
  559 #define pcre2_callout_block            PCRE2_SUFFIX(pcre2_callout_block_)
  560 #define pcre2_callout_enumerate_block  PCRE2_SUFFIX(pcre2_callout_enumerate_block_)
  561 #define pcre2_general_context          PCRE2_SUFFIX(pcre2_general_context_)
  562 #define pcre2_compile_context          PCRE2_SUFFIX(pcre2_compile_context_)
  563 #define pcre2_match_context            PCRE2_SUFFIX(pcre2_match_context_)
  564 #define pcre2_match_data               PCRE2_SUFFIX(pcre2_match_data_)
  565 
  566 
  567 /* Functions: the complete list in alphabetical order */
  568 
  569 #define pcre2_callout_enumerate               PCRE2_SUFFIX(pcre2_callout_enumerate_)
  570 #define pcre2_code_free                       PCRE2_SUFFIX(pcre2_code_free_)
  571 #define pcre2_compile                         PCRE2_SUFFIX(pcre2_compile_)
  572 #define pcre2_compile_context_copy            PCRE2_SUFFIX(pcre2_compile_context_copy_)
  573 #define pcre2_compile_context_create          PCRE2_SUFFIX(pcre2_compile_context_create_)
  574 #define pcre2_compile_context_free            PCRE2_SUFFIX(pcre2_compile_context_free_)
  575 #define pcre2_config                          PCRE2_SUFFIX(pcre2_config_)
  576 #define pcre2_dfa_match                       PCRE2_SUFFIX(pcre2_dfa_match_)
  577 #define pcre2_general_context_copy            PCRE2_SUFFIX(pcre2_general_context_copy_)
  578 #define pcre2_general_context_create          PCRE2_SUFFIX(pcre2_general_context_create_)
  579 #define pcre2_general_context_free            PCRE2_SUFFIX(pcre2_general_context_free_)
  580 #define pcre2_get_error_message               PCRE2_SUFFIX(pcre2_get_error_message_)
  581 #define pcre2_get_mark                        PCRE2_SUFFIX(pcre2_get_mark_)
  582 #define pcre2_get_ovector_pointer             PCRE2_SUFFIX(pcre2_get_ovector_pointer_)
  583 #define pcre2_get_ovector_count               PCRE2_SUFFIX(pcre2_get_ovector_count_)
  584 #define pcre2_get_startchar                   PCRE2_SUFFIX(pcre2_get_startchar_)
  585 #define pcre2_jit_compile                     PCRE2_SUFFIX(pcre2_jit_compile_)
  586 #define pcre2_jit_match                       PCRE2_SUFFIX(pcre2_jit_match_)
  587 #define pcre2_jit_free_unused_memory          PCRE2_SUFFIX(pcre2_jit_free_unused_memory_)
  588 #define pcre2_jit_stack_assign                PCRE2_SUFFIX(pcre2_jit_stack_assign_)
  589 #define pcre2_jit_stack_create                PCRE2_SUFFIX(pcre2_jit_stack_create_)
  590 #define pcre2_jit_stack_free                  PCRE2_SUFFIX(pcre2_jit_stack_free_)
  591 #define pcre2_maketables                      PCRE2_SUFFIX(pcre2_maketables_)
  592 #define pcre2_match                           PCRE2_SUFFIX(pcre2_match_)
  593 #define pcre2_match_context_copy              PCRE2_SUFFIX(pcre2_match_context_copy_)
  594 #define pcre2_match_context_create            PCRE2_SUFFIX(pcre2_match_context_create_)
  595 #define pcre2_match_context_free              PCRE2_SUFFIX(pcre2_match_context_free_)
  596 #define pcre2_match_data_create               PCRE2_SUFFIX(pcre2_match_data_create_)
  597 #define pcre2_match_data_create_from_pattern  PCRE2_SUFFIX(pcre2_match_data_create_from_pattern_)
  598 #define pcre2_match_data_free                 PCRE2_SUFFIX(pcre2_match_data_free_)
  599 #define pcre2_pattern_info                    PCRE2_SUFFIX(pcre2_pattern_info_)
  600 #define pcre2_serialize_decode                PCRE2_SUFFIX(pcre2_serialize_decode_)
  601 #define pcre2_serialize_encode                PCRE2_SUFFIX(pcre2_serialize_encode_)
  602 #define pcre2_serialize_free                  PCRE2_SUFFIX(pcre2_serialize_free_)
  603 #define pcre2_serialize_get_number_of_codes   PCRE2_SUFFIX(pcre2_serialize_get_number_of_codes_)
  604 #define pcre2_set_bsr                         PCRE2_SUFFIX(pcre2_set_bsr_)
  605 #define pcre2_set_callout                     PCRE2_SUFFIX(pcre2_set_callout_)
  606 #define pcre2_set_character_tables            PCRE2_SUFFIX(pcre2_set_character_tables_)
  607 #define pcre2_set_compile_recursion_guard     PCRE2_SUFFIX(pcre2_set_compile_recursion_guard_)
  608 #define pcre2_set_match_limit                 PCRE2_SUFFIX(pcre2_set_match_limit_)
  609 #define pcre2_set_newline                     PCRE2_SUFFIX(pcre2_set_newline_)
  610 #define pcre2_set_parens_nest_limit           PCRE2_SUFFIX(pcre2_set_parens_nest_limit_)
  611 #define pcre2_set_recursion_limit             PCRE2_SUFFIX(pcre2_set_recursion_limit_)
  612 #define pcre2_set_recursion_memory_management PCRE2_SUFFIX(pcre2_set_recursion_memory_management_)
  613 #define pcre2_substitute                      PCRE2_SUFFIX(pcre2_substitute_)
  614 #define pcre2_substring_copy_byname           PCRE2_SUFFIX(pcre2_substring_copy_byname_)
  615 #define pcre2_substring_copy_bynumber         PCRE2_SUFFIX(pcre2_substring_copy_bynumber_)
  616 #define pcre2_substring_free                  PCRE2_SUFFIX(pcre2_substring_free_)
  617 #define pcre2_substring_get_byname            PCRE2_SUFFIX(pcre2_substring_get_byname_)
  618 #define pcre2_substring_get_bynumber          PCRE2_SUFFIX(pcre2_substring_get_bynumber_)
  619 #define pcre2_substring_length_byname         PCRE2_SUFFIX(pcre2_substring_length_byname_)
  620 #define pcre2_substring_length_bynumber       PCRE2_SUFFIX(pcre2_substring_length_bynumber_)
  621 #define pcre2_substring_list_get              PCRE2_SUFFIX(pcre2_substring_list_get_)
  622 #define pcre2_substring_list_free             PCRE2_SUFFIX(pcre2_substring_list_free_)
  623 #define pcre2_substring_nametable_scan        PCRE2_SUFFIX(pcre2_substring_nametable_scan_)
  624 #define pcre2_substring_number_from_name      PCRE2_SUFFIX(pcre2_substring_number_from_name_)
  625 
  626 
  627 /* Now generate all three sets of width-specific structures and function
  628 prototypes. */
  629 
  630 #define PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS \
  631 PCRE2_TYPES_LIST \
  632 PCRE2_STRUCTURE_LIST \
  633 PCRE2_GENERAL_INFO_FUNCTIONS \
  634 PCRE2_GENERAL_CONTEXT_FUNCTIONS \
  635 PCRE2_COMPILE_CONTEXT_FUNCTIONS \
  636 PCRE2_MATCH_CONTEXT_FUNCTIONS \
  637 PCRE2_COMPILE_FUNCTIONS \
  638 PCRE2_PATTERN_INFO_FUNCTIONS \
  639 PCRE2_MATCH_FUNCTIONS \
  640 PCRE2_SUBSTRING_FUNCTIONS \
  641 PCRE2_SERIALIZE_FUNCTIONS \
  642 PCRE2_SUBSTITUTE_FUNCTION \
  643 PCRE2_JIT_FUNCTIONS \
  644 PCRE2_OTHER_FUNCTIONS
  645 
  646 #define PCRE2_LOCAL_WIDTH 8
  647 PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
  648 #undef PCRE2_LOCAL_WIDTH
  649 
  650 #define PCRE2_LOCAL_WIDTH 16
  651 PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
  652 #undef PCRE2_LOCAL_WIDTH
  653 
  654 #define PCRE2_LOCAL_WIDTH 32
  655 PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
  656 #undef PCRE2_LOCAL_WIDTH
  657 
  658 /* Undefine the list macros; they are no longer needed. */
  659 
  660 #undef PCRE2_TYPES_LIST
  661 #undef PCRE2_STRUCTURE_LIST
  662 #undef PCRE2_GENERAL_INFO_FUNCTIONS
  663 #undef PCRE2_GENERAL_CONTEXT_FUNCTIONS
  664 #undef PCRE2_COMPILE_CONTEXT_FUNCTIONS
  665 #undef PCRE2_MATCH_CONTEXT_FUNCTIONS
  666 #undef PCRE2_COMPILE_FUNCTIONS
  667 #undef PCRE2_PATTERN_INFO_FUNCTIONS
  668 #undef PCRE2_MATCH_FUNCTIONS
  669 #undef PCRE2_SUBSTRING_FUNCTIONS
  670 #undef PCRE2_SERIALIZE_FUNCTIONS
  671 #undef PCRE2_SUBSTITUTE_FUNCTION
  672 #undef PCRE2_JIT_FUNCTIONS
  673 #undef PCRE2_OTHER_FUNCTIONS
  674 #undef PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
  675 
  676 /* PCRE2_CODE_UNIT_WIDTH must be defined. If it is 8, 16, or 32, redefine
  677 PCRE2_SUFFIX to use it. If it is 0, undefine the other macros and make
  678 PCRE2_SUFFIX a no-op. Otherwise, generate an error. */
  679 
  680 #undef PCRE2_SUFFIX
  681 #ifndef PCRE2_CODE_UNIT_WIDTH
  682 #error PCRE2_CODE_UNIT_WIDTH must be defined before including pcre2.h.
  683 #error Use 8, 16, or 32; or 0 for a multi-width application.
  684 #else  /* PCRE2_CODE_UNIT_WIDTH is defined */
  685 #if PCRE2_CODE_UNIT_WIDTH == 8 || \
  686     PCRE2_CODE_UNIT_WIDTH == 16 || \
  687     PCRE2_CODE_UNIT_WIDTH == 32
  688 #define PCRE2_SUFFIX(a) PCRE2_GLUE(a, PCRE2_CODE_UNIT_WIDTH)
  689 #elif PCRE2_CODE_UNIT_WIDTH == 0
  690 #undef PCRE2_JOIN
  691 #undef PCRE2_GLUE
  692 #define PCRE2_SUFFIX(a) a
  693 #else
  694 #error PCRE2_CODE_UNIT_WIDTH must be 0, 8, 16, or 32.
  695 #endif
  696 #endif  /* PCRE2_CODE_UNIT_WIDTH is defined */
  697 
  698 #ifdef __cplusplus
  699 }  /* extern "C" */
  700 #endif
  701 
  702 #endif /* End of pcre2.h */