123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923 |
- #undef ACROSSCHAR
- #undef BACKCHAR
- #undef BYTES2CU
- #undef CHMAX_255
- #undef CU2BYTES
- #undef FORWARDCHAR
- #undef FORWARDCHARTEST
- #undef GET
- #undef GET2
- #undef GETCHAR
- #undef GETCHARINC
- #undef GETCHARINCTEST
- #undef GETCHARLEN
- #undef GETCHARLENTEST
- #undef GETCHARTEST
- #undef GET_EXTRALEN
- #undef HAS_EXTRALEN
- #undef IMM2_SIZE
- #undef MAX_255
- #undef MAX_MARK
- #undef MAX_PATTERN_SIZE
- #undef MAX_UTF_SINGLE_CU
- #undef NOT_FIRSTCU
- #undef PUT
- #undef PUT2
- #undef PUT2INC
- #undef PUTCHAR
- #undef PUTINC
- #undef TABLE_GET
- #if PCRE2_CODE_UNIT_WIDTH == 8
- #if LINK_SIZE == 2
- #define PUT(a,n,d) \
- (a[n] = (PCRE2_UCHAR)((d) >> 8)), \
- (a[(n)+1] = (PCRE2_UCHAR)((d) & 255))
- #define GET(a,n) \
- (unsigned int)(((a)[n] << 8) | (a)[(n)+1])
- #define MAX_PATTERN_SIZE (1 << 16)
- #elif LINK_SIZE == 3
- #define PUT(a,n,d) \
- (a[n] = (PCRE2_UCHAR)((d) >> 16)), \
- (a[(n)+1] = (PCRE2_UCHAR)((d) >> 8)), \
- (a[(n)+2] = (PCRE2_UCHAR)((d) & 255))
- #define GET(a,n) \
- (unsigned int)(((a)[n] << 16) | ((a)[(n)+1] << 8) | (a)[(n)+2])
- #define MAX_PATTERN_SIZE (1 << 24)
- #elif LINK_SIZE == 4
- #define PUT(a,n,d) \
- (a[n] = (PCRE2_UCHAR)((d) >> 24)), \
- (a[(n)+1] = (PCRE2_UCHAR)((d) >> 16)), \
- (a[(n)+2] = (PCRE2_UCHAR)((d) >> 8)), \
- (a[(n)+3] = (PCRE2_UCHAR)((d) & 255))
- #define GET(a,n) \
- (unsigned int)(((a)[n] << 24) | ((a)[(n)+1] << 16) | ((a)[(n)+2] << 8) | (a)[(n)+3])
- #define MAX_PATTERN_SIZE (1 << 30)
- #else
- #error LINK_SIZE must be 2, 3, or 4
- #endif
- #elif PCRE2_CODE_UNIT_WIDTH == 16
- #if LINK_SIZE == 2
- #undef LINK_SIZE
- #define LINK_SIZE 1
- #define PUT(a,n,d) \
- (a[n] = (PCRE2_UCHAR)(d))
- #define GET(a,n) \
- (a[n])
- #define MAX_PATTERN_SIZE (1 << 16)
- #elif LINK_SIZE == 3 || LINK_SIZE == 4
- #undef LINK_SIZE
- #define LINK_SIZE 2
- #define PUT(a,n,d) \
- (a[n] = (PCRE2_UCHAR)((d) >> 16)), \
- (a[(n)+1] = (PCRE2_UCHAR)((d) & 65535))
- #define GET(a,n) \
- (unsigned int)(((a)[n] << 16) | (a)[(n)+1])
- #define MAX_PATTERN_SIZE (1 << 30)
- #else
- #error LINK_SIZE must be 2, 3, or 4
- #endif
- #elif PCRE2_CODE_UNIT_WIDTH == 32
- #undef LINK_SIZE
- #define LINK_SIZE 1
- #define PUT(a,n,d) \
- (a[n] = (d))
- #define GET(a,n) \
- (a[n])
- #define MAX_PATTERN_SIZE (1 << 30)
- #else
- #error Unsupported compiling mode
- #endif
- #if PCRE2_CODE_UNIT_WIDTH == 8
- #define IMM2_SIZE 2
- #define GET2(a,n) (unsigned int)(((a)[n] << 8) | (a)[(n)+1])
- #define PUT2(a,n,d) a[n] = (d) >> 8, a[(n)+1] = (d) & 255
- #else
- #define IMM2_SIZE 1
- #define GET2(a,n) a[n]
- #define PUT2(a,n,d) a[n] = d
- #endif
- #if PCRE2_CODE_UNIT_WIDTH == 8
- #define MAX_255(c) TRUE
- #define MAX_MARK ((1u << 8) - 1)
- #define TABLE_GET(c, table, default) ((table)[c])
- #ifdef SUPPORT_UNICODE
- #define SUPPORT_WIDE_CHARS
- #define CHMAX_255(c) ((c) <= 255u)
- #else
- #define CHMAX_255(c) TRUE
- #endif
- #else
- #define CHMAX_255(c) ((c) <= 255u)
- #define MAX_255(c) ((c) <= 255u)
- #define MAX_MARK ((1u << 16) - 1)
- #define SUPPORT_WIDE_CHARS
- #define TABLE_GET(c, table, default) (MAX_255(c)? ((table)[c]):(default))
- #endif
- #define UCHAR21(eptr) (*(eptr))
- #define UCHAR21TEST(eptr) (*(eptr))
- #define UCHAR21INC(eptr) (*(eptr)++)
- #define UCHAR21INCTEST(eptr) (*(eptr)++)
- #ifndef SUPPORT_UNICODE
- #define GETCHAR(c, eptr) c = *eptr;
- #define GETCHARTEST(c, eptr) c = *eptr;
- #define GETCHARINC(c, eptr) c = *eptr++;
- #define GETCHARINCTEST(c, eptr) c = *eptr++;
- #define GETCHARLEN(c, eptr, len) c = *eptr;
- #define PUTCHAR(c, p) (*p = c, 1)
- #else
- #if PCRE2_CODE_UNIT_WIDTH == 8
- #define MAYBE_UTF_MULTI
- #define MAX_UTF_SINGLE_CU 127
- #define HAS_EXTRALEN(c) HASUTF8EXTRALEN(c)
- #define GET_EXTRALEN(c) (PRIV(utf8_table4)[(c) & 0x3fu])
- #define NOT_FIRSTCU(c) (((c) & 0xc0u) == 0x80u)
- #define GETCHAR(c, eptr) \
- c = *eptr; \
- if (c >= 0xc0u) GETUTF8(c, eptr);
- #define GETCHARTEST(c, eptr) \
- c = *eptr; \
- if (utf && c >= 0xc0u) GETUTF8(c, eptr);
- #define GETCHARINC(c, eptr) \
- c = *eptr++; \
- if (c >= 0xc0u) GETUTF8INC(c, eptr);
- #define GETCHARINCTEST(c, eptr) \
- c = *eptr++; \
- if (utf && c >= 0xc0u) GETUTF8INC(c, eptr);
- #define GETCHARLEN(c, eptr, len) \
- c = *eptr; \
- if (c >= 0xc0u) GETUTF8LEN(c, eptr, len);
- #define GETCHARLENTEST(c, eptr, len) \
- c = *eptr; \
- if (utf && c >= 0xc0u) GETUTF8LEN(c, eptr, len);
- #define BACKCHAR(eptr) while((*eptr & 0xc0u) == 0x80u) eptr--
- #define FORWARDCHAR(eptr) while((*eptr & 0xc0u) == 0x80u) eptr++
- #define FORWARDCHARTEST(eptr,end) while(eptr < end && (*eptr & 0xc0u) == 0x80u) eptr++
- #define ACROSSCHAR(condition, eptr, action) \
- while((condition) && ((*eptr) & 0xc0u) == 0x80u) action
- #define PUTCHAR(c, p) ((utf && c > MAX_UTF_SINGLE_CU)? \
- PRIV(ord2utf)(c,p) : (*p = c, 1))
- #elif PCRE2_CODE_UNIT_WIDTH == 16
- #define MAYBE_UTF_MULTI
- #define MAX_UTF_SINGLE_CU 65535
- #define HAS_EXTRALEN(c) (((c) & 0xfc00u) == 0xd800u)
- #define GET_EXTRALEN(c) 1
- #define NOT_FIRSTCU(c) (((c) & 0xfc00u) == 0xdc00u)
- #define GETUTF16(c, eptr) \
- { c = (((c & 0x3ffu) << 10) | (eptr[1] & 0x3ffu)) + 0x10000u; }
- #define GETCHAR(c, eptr) \
- c = *eptr; \
- if ((c & 0xfc00u) == 0xd800u) GETUTF16(c, eptr);
- #define GETCHARTEST(c, eptr) \
- c = *eptr; \
- if (utf && (c & 0xfc00u) == 0xd800u) GETUTF16(c, eptr);
- #define GETUTF16INC(c, eptr) \
- { c = (((c & 0x3ffu) << 10) | (*eptr++ & 0x3ffu)) + 0x10000u; }
- #define GETCHARINC(c, eptr) \
- c = *eptr++; \
- if ((c & 0xfc00u) == 0xd800u) GETUTF16INC(c, eptr);
- #define GETCHARINCTEST(c, eptr) \
- c = *eptr++; \
- if (utf && (c & 0xfc00u) == 0xd800u) GETUTF16INC(c, eptr);
- #define GETUTF16LEN(c, eptr, len) \
- { c = (((c & 0x3ffu) << 10) | (eptr[1] & 0x3ffu)) + 0x10000u; len++; }
- #define GETCHARLEN(c, eptr, len) \
- c = *eptr; \
- if ((c & 0xfc00u) == 0xd800u) GETUTF16LEN(c, eptr, len);
- #define GETCHARLENTEST(c, eptr, len) \
- c = *eptr; \
- if (utf && (c & 0xfc00u) == 0xd800u) GETUTF16LEN(c, eptr, len);
- #define BACKCHAR(eptr) if ((*eptr & 0xfc00u) == 0xdc00u) eptr--
- #define FORWARDCHAR(eptr) if ((*eptr & 0xfc00u) == 0xdc00u) eptr++
- #define FORWARDCHARTEST(eptr,end) if (eptr < end && (*eptr & 0xfc00u) == 0xdc00u) eptr++
- #define ACROSSCHAR(condition, eptr, action) \
- if ((condition) && ((*eptr) & 0xfc00u) == 0xdc00u) action
- #define PUTCHAR(c, p) ((utf && c > MAX_UTF_SINGLE_CU)? \
- PRIV(ord2utf)(c,p) : (*p = c, 1))
- #else
- #define MAX_UTF_SINGLE_CU (0x10ffffu)
- #define HAS_EXTRALEN(c) (0)
- #define GET_EXTRALEN(c) (0)
- #define NOT_FIRSTCU(c) (0)
- #define GETCHAR(c, eptr) \
- c = *(eptr);
- #define GETCHARTEST(c, eptr) \
- c = *(eptr);
- #define GETCHARINC(c, eptr) \
- c = *((eptr)++);
- #define GETCHARINCTEST(c, eptr) \
- c = *((eptr)++);
- #define GETCHARLEN(c, eptr, len) \
- GETCHAR(c, eptr)
- #define GETCHARLENTEST(c, eptr, len) \
- GETCHARTEST(c, eptr)
- #define BACKCHAR(eptr) do { } while (0)
- #define FORWARDCHAR(eptr) do { } while (0)
- #define FORWARDCHARTEST(eptr,end) do { } while (0)
- #define ACROSSCHAR(condition, eptr, action) do { } while (0)
- #define PUTCHAR(c, p) (*p = c, 1)
- #endif
- #endif
- #define CU2BYTES(x) ((x)*((PCRE2_CODE_UNIT_WIDTH/8)))
- #define BYTES2CU(x) ((x)/((PCRE2_CODE_UNIT_WIDTH/8)))
- #define PUTINC(a,n,d) PUT(a,n,d), a += LINK_SIZE
- #define PUT2INC(a,n,d) PUT2(a,n,d), a += IMM2_SIZE
- typedef struct pcre2_real_general_context {
- pcre2_memctl memctl;
- } pcre2_real_general_context;
- typedef struct pcre2_real_compile_context {
- pcre2_memctl memctl;
- int (*stack_guard)(uint32_t, void *);
- void *stack_guard_data;
- const uint8_t *tables;
- PCRE2_SIZE max_pattern_length;
- uint16_t bsr_convention;
- uint16_t newline_convention;
- uint32_t parens_nest_limit;
- uint32_t extra_options;
- } pcre2_real_compile_context;
- typedef struct pcre2_real_match_context {
- pcre2_memctl memctl;
- #ifdef SUPPORT_JIT
- pcre2_jit_callback jit_callback;
- void *jit_callback_data;
- #endif
- int (*callout)(pcre2_callout_block *, void *);
- void *callout_data;
- int (*substitute_callout)(pcre2_substitute_callout_block *, void *);
- void *substitute_callout_data;
- PCRE2_SIZE offset_limit;
- uint32_t heap_limit;
- uint32_t match_limit;
- uint32_t depth_limit;
- } pcre2_real_match_context;
- typedef struct pcre2_real_convert_context {
- pcre2_memctl memctl;
- uint32_t glob_separator;
- uint32_t glob_escape;
- } pcre2_real_convert_context;
- #undef CODE_BLOCKSIZE_TYPE
- #define CODE_BLOCKSIZE_TYPE size_t
- #undef LOOKBEHIND_MAX
- #define LOOKBEHIND_MAX UINT16_MAX
- typedef struct pcre2_real_code {
- pcre2_memctl memctl;
- const uint8_t *tables;
- void *executable_jit;
- uint8_t start_bitmap[32];
- CODE_BLOCKSIZE_TYPE blocksize;
- uint32_t magic_number;
- uint32_t compile_options;
- uint32_t overall_options;
- uint32_t extra_options;
- uint32_t flags;
- uint32_t limit_heap;
- uint32_t limit_match;
- uint32_t limit_depth;
- uint32_t first_codeunit;
- uint32_t last_codeunit;
- uint16_t bsr_convention;
- uint16_t newline_convention;
- uint16_t max_lookbehind;
- uint16_t minlength;
- uint16_t top_bracket;
- uint16_t top_backref;
- uint16_t name_entry_size;
- uint16_t name_count;
- } pcre2_real_code;
- typedef struct pcre2_real_match_data {
- pcre2_memctl memctl;
- const pcre2_real_code *code;
- PCRE2_SPTR subject;
- PCRE2_SPTR mark;
- PCRE2_SIZE leftchar;
- PCRE2_SIZE rightchar;
- PCRE2_SIZE startchar;
- uint8_t matchedby;
- uint8_t flags;
- uint16_t oveccount;
- int rc;
- PCRE2_SIZE ovector[131072];
- } pcre2_real_match_data;
- #ifndef PCRE2_PCRE2TEST
- typedef struct recurse_check {
- struct recurse_check *prev;
- PCRE2_SPTR group;
- } recurse_check;
- typedef struct parsed_recurse_check {
- struct parsed_recurse_check *prev;
- uint32_t *groupptr;
- } parsed_recurse_check;
- typedef struct recurse_cache {
- PCRE2_SPTR group;
- int groupnumber;
- } recurse_cache;
- typedef struct branch_chain {
- struct branch_chain *outer;
- PCRE2_UCHAR *current_branch;
- } branch_chain;
- typedef struct named_group {
- PCRE2_SPTR name;
- uint32_t number;
- uint16_t length;
- uint16_t isdup;
- } named_group;
- typedef struct compile_block {
- pcre2_real_compile_context *cx;
- const uint8_t *lcc;
- const uint8_t *fcc;
- const uint8_t *cbits;
- const uint8_t *ctypes;
- PCRE2_SPTR start_workspace;
- PCRE2_SPTR start_code;
- PCRE2_SPTR start_pattern;
- PCRE2_SPTR end_pattern;
- PCRE2_UCHAR *name_table;
- PCRE2_SIZE workspace_size;
- PCRE2_SIZE small_ref_offset[10];
- PCRE2_SIZE erroroffset;
- uint16_t names_found;
- uint16_t name_entry_size;
- uint16_t parens_depth;
- uint16_t assert_depth;
- open_capitem *open_caps;
- named_group *named_groups;
- uint32_t named_group_list_size;
- uint32_t external_options;
- uint32_t external_flags;
- uint32_t bracount;
- uint32_t lastcapture;
- uint32_t *parsed_pattern;
- uint32_t *parsed_pattern_end;
- uint32_t *groupinfo;
- uint32_t top_backref;
- uint32_t backref_map;
- uint32_t nltype;
- uint32_t nllen;
- uint32_t class_range_start;
- uint32_t class_range_end;
- PCRE2_UCHAR nl[4];
- int max_lookbehind;
- int req_varyopt;
- BOOL had_accept;
- BOOL had_pruneorskip;
- BOOL had_recurse;
- BOOL dupnames;
- } compile_block;
- typedef struct pcre2_real_jit_stack {
- pcre2_memctl memctl;
- void* stack;
- } pcre2_real_jit_stack;
- typedef struct dfa_recursion_info {
- struct dfa_recursion_info *prevrec;
- PCRE2_SPTR subject_position;
- uint32_t group_num;
- } dfa_recursion_info;
- typedef struct heapframe {
-
- PCRE2_SPTR ecode;
- PCRE2_SPTR temp_sptr[2];
- PCRE2_SIZE length;
- PCRE2_SIZE back_frame;
- PCRE2_SIZE temp_size;
- uint32_t rdepth;
- uint32_t group_frame_type;
- uint32_t temp_32[4];
- uint8_t return_id;
- uint8_t op;
-
- #if PCRE2_CODE_UNIT_WIDTH == 8
- PCRE2_UCHAR occu[6];
- #elif PCRE2_CODE_UNIT_WIDTH == 16
- PCRE2_UCHAR occu[2];
- uint8_t unused[2];
- #else
- uint8_t unused[2];
- PCRE2_UCHAR occu[1];
- #endif
-
- PCRE2_SPTR eptr;
- PCRE2_SPTR start_match;
- PCRE2_SPTR mark;
- uint32_t current_recurse;
- uint32_t capture_last;
- PCRE2_SIZE last_group_offset;
- PCRE2_SIZE offset_top;
- PCRE2_SIZE ovector[131072];
- } heapframe;
- typedef char check_heapframe_size[
- ((sizeof(heapframe) % sizeof(PCRE2_SIZE)) == 0)? (+1):(-1)];
- typedef struct match_block {
- pcre2_memctl memctl;
- PCRE2_SIZE frame_vector_size;
- heapframe *match_frames;
- heapframe *match_frames_top;
- heapframe *stack_frames;
- PCRE2_SIZE heap_limit;
- uint32_t match_limit;
- uint32_t match_limit_depth;
- uint32_t match_call_count;
- BOOL hitend;
- BOOL hasthen;
- BOOL allowemptypartial;
- const uint8_t *lcc;
- const uint8_t *fcc;
- const uint8_t *ctypes;
- PCRE2_SIZE start_offset;
- PCRE2_SIZE end_offset_top;
- uint16_t partial;
- uint16_t bsr_convention;
- uint16_t name_count;
- uint16_t name_entry_size;
- PCRE2_SPTR name_table;
- PCRE2_SPTR start_code;
- PCRE2_SPTR start_subject;
- PCRE2_SPTR check_subject;
- PCRE2_SPTR end_subject;
- PCRE2_SPTR end_match_ptr;
- PCRE2_SPTR start_used_ptr;
- PCRE2_SPTR last_used_ptr;
- PCRE2_SPTR mark;
- PCRE2_SPTR nomatch_mark;
- PCRE2_SPTR verb_ecode_ptr;
- PCRE2_SPTR verb_skip_ptr;
- uint32_t verb_current_recurse;
- uint32_t moptions;
- uint32_t poptions;
- uint32_t skip_arg_count;
- uint32_t ignore_skip_arg;
- uint32_t nltype;
- uint32_t nllen;
- PCRE2_UCHAR nl[4];
- pcre2_callout_block *cb;
- void *callout_data;
- int (*callout)(pcre2_callout_block *,void *);
- } match_block;
- typedef struct dfa_match_block {
- pcre2_memctl memctl;
- PCRE2_SPTR start_code;
- PCRE2_SPTR start_subject ;
- PCRE2_SPTR end_subject;
- PCRE2_SPTR start_used_ptr;
- PCRE2_SPTR last_used_ptr;
- const uint8_t *tables;
- PCRE2_SIZE start_offset;
- PCRE2_SIZE heap_limit;
- PCRE2_SIZE heap_used;
- uint32_t match_limit;
- uint32_t match_limit_depth;
- uint32_t match_call_count;
- uint32_t moptions;
- uint32_t poptions;
- uint32_t nltype;
- uint32_t nllen;
- BOOL allowemptypartial;
- PCRE2_UCHAR nl[4];
- uint16_t bsr_convention;
- pcre2_callout_block *cb;
- void *callout_data;
- int (*callout)(pcre2_callout_block *,void *);
- dfa_recursion_info *recursive;
- } dfa_match_block;
- #endif
|