Refactor the framework for revised API.

This commit is contained in:
Philip.Hazel 2014-04-18 15:37:56 +00:00
parent f4174bab90
commit 06ba06c763
20 changed files with 8948 additions and 726 deletions

View File

@ -34,8 +34,8 @@ ACLOCAL_AMFLAGS = -I m4
# doc/html/pcre_config.html \
# doc/html/pcre_copy_named_substring.html \
# doc/html/pcre_copy_substring.html \
# doc/html/pcre_dfa_exec.html \
# doc/html/pcre_exec.html \
# doc/html/pcre_dfa_match.html \
# doc/html/pcre_match.html \
# doc/html/pcre_free_study.html \
# doc/html/pcre_free_substring.html \
# doc/html/pcre_free_substring_list.html \
@ -45,7 +45,7 @@ ACLOCAL_AMFLAGS = -I m4
# doc/html/pcre_get_stringtable_entries.html \
# doc/html/pcre_get_substring.html \
# doc/html/pcre_get_substring_list.html \
# doc/html/pcre_jit_exec.html \
# doc/html/pcre_jit_match.html \
# doc/html/pcre_jit_stack_alloc.html \
# doc/html/pcre_jit_stack_free.html \
# doc/html/pcre_maketables.html \
@ -87,8 +87,8 @@ ACLOCAL_AMFLAGS = -I m4
# doc/pcre2_config.3 \
# doc/pcre2_copy_named_substring.3 \
# doc/pcre2_copy_substring.3 \
# doc/pcre2_dfa_exec.3 \
# doc/pcre2_exec.3 \
# doc/pcre2_dfa_match.3 \
# doc/pcre2_match.3 \
# doc/pcre2_free_study.3 \
# doc/pcre2_free_substring.3 \
# doc/pcre2_free_substring_list.3 \
@ -98,7 +98,7 @@ ACLOCAL_AMFLAGS = -I m4
# doc/pcre2_get_stringtable_entries.3 \
# doc/pcre2_get_substring.3 \
# doc/pcre2_get_substring_list.3 \
# doc/pcre2_jit_exec.3 \
# doc/pcre2_jit_match.3 \
# doc/pcre2_jit_stack_alloc.3 \
# doc/pcre2_jit_stack_free.3 \
# doc/pcre2_maketables.3 \
@ -265,12 +265,12 @@ COMMON_SOURCES = \
src/pcre2_compile.c \
src/pcre2_config.c \
src/pcre2_context.c \
src/pcre2_dfa_exec.c \
src/pcre2_dfa_match.c \
src/pcre2_error.c \
src/pcre2_exec.c \
src/pcre2_match.c \
src/pcre2_internal.h \
src/pcre2_jit_compile.c \
src/pcre2_jit_exec.c \
src/pcre2_jit_match.c \
src/pcre2_jit_misc.c \
src/pcre2_maketables.c \
src/pcre2_match_data.c \

View File

@ -79,28 +79,7 @@ are defined. */
extern "C" {
#endif
/* Public options. Those in the context may affect compilation, JIT
compilation, and/or interpretive execution. The following tags indicate which:
C alters what is compiled
J alters what JIT compiles
E affects pcre2_exec() execution
D affects pcre2_dfa_exec() execution
*/
/* The first group of options are those that are set in the context. */
#define PCRE2_ALT_BSUX 0x00000001 /* C */
#define PCRE2_DOLLAR_ENDONLY 0x00000002 /* J E D */
#define PCRE2_DUPNAMES 0x00000004 /* C */
#define PCRE2_ALLOW_EMPTY_CLASS 0x00000008 /* C */
#define PCRE2_MATCH_UNSET_BACKREF 0x00000010 /* C J E */
#define PCRE2_NEVER_UTF 0x00000020 /* C */
#define PCRE2_NEVER_UCP 0x00000040 /* C */
#define PCRE2_UTF 0x00000080 /* C J E D */
#define PCRE2_UCP 0x00000100 /* C J E D */
/* The following can be passed to pcre2_compile(), pcre2_exec(), or
/* The following options can be passed to pcre2_compile(), pcre2_exec(), or
pcre2_dfa_exec(). PCRE2_NO_UTF_CHECK affects only the function to which it is
passed. */
@ -108,44 +87,56 @@ passed. */
#define PCRE2_NO_START_OPTIMIZE 0x00000002
#define PCRE2_NO_UTF_CHECK 0x00000004
/* These are for pcre2_compile() only, affecting what is compiled, but not
otherwise affecting execution. */
/* Other options that can be passed to pcre2_compile(). They may affect
compilation, JIT compilation, and/or interpretive execution. The following tags
indicate which:
#define PCRE2_AUTO_CALLOUT 0x00000100
#define PCRE2_CASELESS 0x00000200
#define PCRE2_DOTALL 0x00000400
#define PCRE2_EXTENDED 0x00000800
#define PCRE2_MULTILINE 0x00001000
#define PCRE2_NO_AUTO_CAPTURE 0x00002000
#define PCRE2_NO_AUTO_POSSESS 0x00004000
#define PCRE2_UNGREEDY 0x00008000
C alters what is compiled
J alters what JIT compiles
E is inspected during pcre2_exec() execution
D is inspected during pcre2_dfa_exec() execution
*/
/* This pcre2_compile() option affects JIT compilation and interpretive
execution. */
#define PCRE2_FIRSTLINE 0x00010000
#define PCRE2_ALLOW_EMPTY_CLASS 0x00000008 /* C */
#define PCRE2_ALT_BSUX 0x00000010 /* C */
#define PCRE2_AUTO_CALLOUT 0x00000020 /* C */
#define PCRE2_CASELESS 0x00000040 /* C */
#define PCRE2_DOLLAR_ENDONLY 0x00000080 /* J E D */
#define PCRE2_DOTALL 0x00000100 /* C */
#define PCRE2_DUPNAMES 0x00000200 /* C */
#define PCRE2_EXTENDED 0x00000400 /* C */
#define PCRE2_FIRSTLINE 0x00000800 /* J E D */
#define PCRE2_MATCH_UNSET_BACKREF 0x00001000 /* C J E */
#define PCRE2_MULTILINE 0x00002000 /* C */
#define PCRE2_NEVER_UCP 0x00004000 /* C */
#define PCRE2_NEVER_UTF 0x00008000 /* C */
#define PCRE2_NO_AUTO_CAPTURE 0x00010000 /* C */
#define PCRE2_NO_AUTO_POSSESS 0x00020000 /* C */
#define PCRE2_UCP 0x00040000 /* C J E D */
#define PCRE2_UNGREEDY 0x00080000 /* C */
#define PCRE2_UTF 0x00100000 /* C J E D */
/* These are for pcre2_jit_compile(). */
#define PCRE2_JIT 0x00020000
#define PCRE2_JIT_PARTIAL_SOFT 0x00040000
#define PCRE2_JIT_PARTIAL_HARD 0x00080000
#define PCRE2_JIT 0x00000001 /* For full matching */
#define PCRE2_JIT_PARTIAL_SOFT 0x00000002
#define PCRE2_JIT_PARTIAL_HARD 0x00000004
/* These are for pcre2_exec() and pcre2_dfa_exec(). */
#define PCRE2_NOTBOL 0x00000100
#define PCRE2_NOTEOL 0x00000200
#define PCRE2_NOTEMPTY 0x00000400
#define PCRE2_NOTEMPTY_ATSTART 0x00000800
#define PCRE2_PARTIAL_SOFT 0x00001000
#define PCRE2_PARTIAL_HARD 0x00002000
#define PCRE2_NOTBOL 0x00000001
#define PCRE2_NOTEOL 0x00000002
#define PCRE2_NOTEMPTY 0x00000004
#define PCRE2_NOTEMPTY_ATSTART 0x00000008
#define PCRE2_PARTIAL_SOFT 0x00000010
#define PCRE2_PARTIAL_HARD 0x00000020
/* These are additional options for pcre2_dfa_exec(). */
#define PCRE2_DFA_RESTART 0x00010000
#define PCRE2_DFA_SHORTEST 0x00020000
#define PCRE2_DFA_RESTART 0x00000040
#define PCRE2_DFA_SHORTEST 0x00000080
/* Newline and \R settings, for use in the context. */
/* Newline and \R settings, for use in the compile context. */
#define PCRE2_NEWLINE_CR 0
#define PCRE2_NEWLINE_LF 1
@ -238,14 +229,14 @@ execution. */
#define PCRE2_INFO_LASTCODEUNIT 10
#define PCRE2_INFO_LASTCODETYPE 11
#define PCRE2_INFO_MATCH_EMPTY 12
#define PCRE2_INFO_MATCHLIMIT 13
#define PCRE2_INFO_MATCH_LIMIT 13
#define PCRE2_INFO_MAXLOOKBEHIND 14
#define PCRE2_INFO_MINLENGTH 15
#define PCRE2_INFO_NAMECOUNT 16
#define PCRE2_INFO_NAMEENTRYSIZE 17
#define PCRE2_INFO_NAMETABLE 18
#define PCRE2_INFO_PATTERN_OPTIONS 19
#define PCRE2_INFO_RECURSIONLIMIT 20
#define PCRE2_INFO_RECURSION_LIMIT 20
#define PCRE2_INFO_SIZE 21
/* Request types for pcre2_config(). */
@ -262,6 +253,10 @@ execution. */
#define PCRE2_CONFIG_STACKRECURSE 9
#define PCRE2_CONFIG_UTF 10
/* A value that is used to indicate 'unset' in unsigned size_t fields. */
#define PCRE2_UNSET (~(size_t)0)
/* Types for patterns and subject strings. */
typedef uint8_t PCRE2_UCHAR8;
@ -277,8 +272,14 @@ typedef const PCRE2_UCHAR32 *PCRE2_SPTR32;
declarations are defined in a macro that is expanded for each width later. */
#define PCRE2_TYPES_LIST \
struct pcre2_real_context; \
typedef struct pcre2_real_context pcre2_context; \
struct pcre2_real_general_context; \
typedef struct pcre2_real_general_context pcre2_general_context; \
\
struct pcre2_real_compile_context; \
typedef struct pcre2_real_compile_context pcre2_compile_context; \
\
struct pcre2_real_match_context; \
typedef struct pcre2_real_match_context pcre2_match_context; \
\
struct pcre2_real_code; \
typedef struct pcre2_real_code pcre2_code; \
@ -335,104 +336,93 @@ information. */
#define PCRE2_GENERAL_INFO_FUNCTIONS \
PCRE2_EXP_DECL int pcre2_config(int, void *); \
PCRE2_EXP_DECL size_t pcre2_get_exec_frame_size(void); \
PCRE2_EXP_DECL size_t pcre2_get_match_frame_size(void); \
PCRE2_EXP_DECL int pcre2_version(PCRE2_UCHAR *, size_t);
/* Functions for manipulating contexts. */
#define PCRE2_CONTEXT_FUNCTIONS \
PCRE2_EXP_DECL size_t pcre2_context_size(void); \
#define PCRE2_GENERAL_CONTEXT_FUNCTIONS \
PCRE2_EXP_DECL \
pcre2_context *pcre2_copy_context(pcre2_context *); \
PCRE2_EXP_DECL void pcre2_free_context(pcre2_context *); \
pcre2_general_context *pcre2_general_context_copy(pcre2_general_context *); \
PCRE2_EXP_DECL \
pcre2_context *pcre2_init_context(pcre2_context *); \
\
PCRE2_EXP_DECL uint32_t pcre2_get_bsr_convention(pcre2_context *); \
PCRE2_EXP_DECL int (*pcre2_get_callout(pcre2_context *)) \
(pcre2_callout_block *, void *); \
pcre2_general_context *pcre2_general_context_create( \
void *(*)(size_t, void *), \
void (*)(void *, void *), void *); \
PCRE2_EXP_DECL void pcre2_general_context_free(pcre2_general_context *);
#define PCRE2_COMPILE_CONTEXT_FUNCTIONS \
PCRE2_EXP_DECL \
const unsigned char *pcre2_get_character_tables(pcre2_context *); \
PCRE2_EXP_DECL uint32_t pcre2_get_context_options(pcre2_context *); \
PCRE2_EXP_DECL uint32_t pcre2_get_match_limit(pcre2_context *); \
PCRE2_EXP_DECL void pcre2_get_memory_management(pcre2_context *, \
void *(**)(size_t, void *), \
void (**)(void *, void *)); \
PCRE2_EXP_DECL uint32_t pcre2_get_newline_convention(pcre2_context *); \
PCRE2_EXP_DECL uint32_t pcre2_get_parens_nest_limit(pcre2_context *); \
PCRE2_EXP_DECL int (*pcre2_get_recursion_guard(pcre2_context *)) \
(uint32_t, void *); \
PCRE2_EXP_DECL uint32_t pcre2_get_recursion_limit(pcre2_context *); \
PCRE2_EXP_DECL void pcre2_get_recursion_memory_management(\
pcre2_context *, \
void *(**)(size_t, void *), \
void (**)(void *, void *)); \
PCRE2_EXP_DECL void *pcre2_get_user_data(pcre2_context *); \
\
PCRE2_EXP_DECL int pcre2_set_bsr_convention(pcre2_context *, uint32_t); \
PCRE2_EXP_DECL int pcre2_set_callout(pcre2_context *, \
int (*)(pcre2_callout_block *, void *)); \
PCRE2_EXP_DECL int pcre2_set_character_tables(pcre2_context *, \
pcre2_compile_context *pcre2_compile_context_copy(pcre2_compile_context *); \
PCRE2_EXP_DECL \
pcre2_compile_context *pcre2_compile_context_create(pcre2_general_context *);\
PCRE2_EXP_DECL void pcre2_compile_context_free(pcre2_compile_context *); \
PCRE2_EXP_DECL int pcre2_set_bsr_convention(pcre2_compile_context *, \
uint32_t); \
PCRE2_EXP_DECL int pcre2_set_character_tables(pcre2_compile_context *, \
const unsigned char *); \
PCRE2_EXP_DECL int pcre2_set_context_options(pcre2_context *, uint32_t, \
PCRE2_EXP_DECL int pcre2_set_newline_convention(pcre2_compile_context *, \
uint32_t); \
PCRE2_EXP_DECL int pcre2_set_match_limit(pcre2_context *, uint32_t); \
PCRE2_EXP_DECL int pcre2_set_memory_management(pcre2_context *, \
void * (*)(size_t, void *), \
void (*)(void *, void *)); \
PCRE2_EXP_DECL int pcre2_set_newline_convention(pcre2_context *, \
PCRE2_EXP_DECL int pcre2_set_parens_nest_limit(pcre2_compile_context *, \
uint32_t); \
PCRE2_EXP_DECL int pcre2_set_parens_nest_limit(pcre2_context *, \
PCRE2_EXP_DECL int pcre2_set_compile_recursion_guard(\
pcre2_compile_context *, int (*)(uint32_t)); \
#define PCRE2_MATCH_CONTEXT_FUNCTIONS \
PCRE2_EXP_DECL \
pcre2_match_context *pcre2_match_context_copy(pcre2_match_context *); \
PCRE2_EXP_DECL \
pcre2_match_context *pcre2_match_context_create(pcre2_general_context *); \
PCRE2_EXP_DECL void pcre2_match_context_free(pcre2_match_context *); \
PCRE2_EXP_DECL int pcre2_set_callout(pcre2_match_context *, \
int (*)(pcre2_callout_block *, void *)); \
PCRE2_EXP_DECL int pcre2_set_match_limit(pcre2_match_context *, \
uint32_t); \
PCRE2_EXP_DECL int pcre2_set_recursion_guard(pcre2_context *, \
int (*)(uint32_t, void *)); \
PCRE2_EXP_DECL int pcre2_set_recursion_limit(pcre2_context *, uint32_t); \
PCRE2_EXP_DECL int pcre2_set_recursion_memory_management(\
pcre2_context *, void * (*)(size_t, void *), \
void (*)(void *, void *)); \
PCRE2_EXP_DECL int pcre2_set_user_data(pcre2_context *, void *);
PCRE2_EXP_DECL int pcre2_set_recursion_limit(pcre2_match_context *, \
uint32_t); \
PCRE2_EXP_DECL int pcre2_set_recursion_memory_management( \
pcre2_match_context *, void *(*)(size_t, void *), \
void (*)(void *, void *));
/* Functions concerned with compiling a pattern to PCRE internal code. */
#define PCRE2_COMPILE_FUNCTIONS \
PCRE2_EXP_DECL \
pcre2_code *pcre2_compile(pcre2_context *, PCRE2_SPTR, int, \
uint32_t, int *, size_t *); \
PCRE2_EXP_DECL void pcre2_free_compiled_code(pcre2_context *, \
pcre2_code *);
pcre2_code *pcre2_compile(PCRE2_SPTR, int, uint32_t, \
int *, size_t *, pcre2_compile_context *); \
PCRE2_EXP_DECL void pcre2_code_free(pcre2_code *);
/* Functions that give information about a compiled pattern. */
#define PCRE2_PATTERN_INFO_FUNCTIONS \
PCRE2_EXP_DECL int pcre2_pattern_info(const pcre2_code *, uint32_t, \
void *); \
PCRE2_EXP_DECL int pcre2_get_stringtable_entries(const pcre2_code *, \
PCRE2_SPTR, PCRE2_UCHAR **, PCRE2_UCHAR **); \
PCRE2_EXP_DECL int pcre2_get_substring_number(const pcre2_code *, \
PCRE2_SPTR);
void *);
/* Functions for running a match and inspecting the result. */
#define PCRE2_MATCH_FUNCTIONS \
PCRE2_EXP_DECL \
pcre2_match_data *pcre2_create_match_data(pcre2_context *, size_t); \
PCRE2_EXP_DECL int pcre2_dfa_exec(pcre2_context *, const pcre2_code *, \
pcre2_match_data *pcre2_match_data_create(size_t, \
pcre2_general_context *); \
PCRE2_EXP_DECL \
pcre2_match_data *pcre2_match_data_create_from_pattern(pcre2_code *, \
pcre2_general_context *); \
PCRE2_EXP_DECL int pcre2_dfa_match(const pcre2_code *, \
PCRE2_SPTR, int, size_t, uint32_t, \
pcre2_match_data *, int *, size_t); \
PCRE2_EXP_DECL int pcre2_exec(pcre2_context *, const pcre2_code *, \
pcre2_match_data *, pcre2_match_context *, int *, \
size_t); \
PCRE2_EXP_DECL int pcre2_match(const pcre2_code *, \
PCRE2_SPTR, int, size_t, uint32_t, \
pcre2_match_data *); \
PCRE2_EXP_DECL void pcre2_free_match_data(pcre2_context *, \
pcre2_match_data *); \
pcre2_match_data *, pcre2_match_context *); \
PCRE2_EXP_DECL void pcre2_match_data_free(pcre2_match_data *); \
PCRE2_EXP_DECL size_t pcre2_get_leftchar(pcre2_match_data *); \
PCRE2_EXP_DECL \
PCRE2_SPTR pcre2_get_mark(pcre2_match_data *); \
PCRE2_EXP_DECL size_t *pcre2_get_ovector(pcre2_match_data *); \
PCRE2_EXP_DECL size_t pcre2_get_ovector_slots(pcre2_match_data *); \
PCRE2_EXP_DECL size_t pcre2_get_ovector_count(pcre2_match_data *); \
PCRE2_EXP_DECL size_t *pcre2_get_ovector_pointer(pcre2_match_data *); \
PCRE2_EXP_DECL size_t pcre2_get_rightchar(pcre2_match_data *); \
PCRE2_EXP_DECL size_t pcre2_get_startchar(pcre2_match_data *);
@ -440,48 +430,51 @@ PCRE2_EXP_DECL size_t pcre2_get_startchar(pcre2_match_data *);
/* Convenience functions for handling matched substrings. */
#define PCRE2_SUBSTRING_FUNCTIONS \
PCRE2_EXP_DECL int pcre2_copy_named_substring(pcre2_match_data *, \
PCRE2_EXP_DECL int pcre2_substring_copy_byname(pcre2_match_data *, \
PCRE2_SPTR, PCRE2_UCHAR *, size_t); \
PCRE2_EXP_DECL int pcre2_copy_substring(pcre2_match_data *, int, \
PCRE2_UCHAR *, size_t); \
PCRE2_EXP_DECL void pcre2_free_substring(pcre2_context *, PCRE2_UCHAR *); \
PCRE2_EXP_DECL void pcre2_free_substring_list(pcre2_context *, \
PCRE2_SPTR *); \
PCRE2_EXP_DECL int pcre2_get_named_substring(pcre2_context *, \
pcre2_match_data *, PCRE2_SPTR, PCRE2_UCHAR **); \
PCRE2_EXP_DECL int pcre2_get_named_substring_length(pcre2_match_data *, \
PCRE2_EXP_DECL int pcre2_substring_copy_bynumber(pcre2_match_data *, \
int, PCRE2_UCHAR *, size_t); \
PCRE2_EXP_DECL void pcre2_substring_free(PCRE2_UCHAR *); \
PCRE2_EXP_DECL int pcre2_substring_get_byname(pcre2_match_data *, \
PCRE2_SPTR, PCRE2_UCHAR **); \
PCRE2_EXP_DECL int pcre2_substring_get_bynumber(pcre2_match_data *, \
int, PCRE2_UCHAR **); \
PCRE2_EXP_DECL int pcre2_substring_length_byname(pcre2_match_data *, \
PCRE2_SPTR); \
PCRE2_EXP_DECL int pcre2_get_substring(pcre2_context *, \
pcre2_match_data *, int, PCRE2_UCHAR **); \
PCRE2_EXP_DECL int pcre2_get_substring_length(pcre2_match_data *, int); \
PCRE2_EXP_DECL int pcre2_get_substring_list(pcre2_context *, \
pcre2_match_data *, PCRE2_UCHAR ***);
PCRE2_EXP_DECL int pcre2_substring_length_bynumber(pcre2_match_data *, \
int); \
PCRE2_EXP_DECL int pcre2_substring_nametable_scan(const pcre2_code *, \
PCRE2_SPTR, PCRE2_UCHAR **, PCRE2_UCHAR **); \
PCRE2_EXP_DECL int pcre2_substring_number_from_name(\
const pcre2_code *, PCRE2_SPTR); \
PCRE2_EXP_DECL void pcre2_substring_list_free(PCRE2_SPTR *); \
PCRE2_EXP_DECL int pcre2_substring_list_get(pcre2_match_data *, \
PCRE2_UCHAR ***, size_t **);
/* Functions for JIT processing */
#define PCRE2_JIT_FUNCTIONS \
PCRE2_EXP_DECL void pcre2_jit_compile(pcre2_context *, pcre2_code *, \
uint32_t); \
PCRE2_EXP_DECL int pcre2_jit_exec(pcre2_context *, const pcre2_code *, \
PCRE2_EXP_DECL void pcre2_jit_compile(pcre2_code *, uint32_t); \
PCRE2_EXP_DECL int pcre2_jit_match(const pcre2_code *, \
PCRE2_SPTR, int, size_t, uint32_t, \
pcre2_match_data *, pcre2_jit_stack *); \
PCRE2_EXP_DECL void pcre2_jit_free_unused_memory(pcre2_context *); \
PCRE2_EXP_DECL void pcre2_jit_free_unused_memory(pcre2_general_context *);\
PCRE2_EXP_DECL \
pcre2_jit_stack *pcre2_jit_stack_alloc(pcre2_context *, size_t, \
size_t); \
PCRE2_EXP_DECL void pcre2_jit_stack_assign(pcre2_context *, \
const pcre2_code *, pcre2_jit_callback, void *); \
PCRE2_EXP_DECL void pcre2_jit_stack_free(pcre2_context *, \
pcre2_jit_stack *);
pcre2_jit_stack *pcre2_jit_stack_alloc(pcre2_general_context *, \
size_t, size_t); \
PCRE2_EXP_DECL void pcre2_jit_stack_assign(const pcre2_code *, \
pcre2_jit_callback, void *); \
PCRE2_EXP_DECL void pcre2_jit_stack_free(pcre2_jit_stack *);
/* Other miscellaneous functions. */
#define PCRE2_OTHER_FUNCTIONS \
PCRE2_EXP_DECL int pcre2_get_error_message(int, PCRE2_UCHAR *, size_t); \
PCRE2_EXP_DECL size_t pcre2_get_match_frame_size(void); \
PCRE2_EXP_DECL \
const unsigned char *pcre2_maketables(pcre2_context *); \
const unsigned char *pcre2_maketables(pcre2_general_context *); \
PCRE2_EXP_DECL int pcre2_pattern_to_host_byte_order(pcre2_code *);
@ -499,90 +492,86 @@ pcre2_compile are called by application code. */
/* Data types */
#define PCRE2_UCHAR PCRE2_SUFFIX(PCRE2_UCHAR)
#define PCRE2_SPTR PCRE2_SUFFIX(PCRE2_SPTR)
#define PCRE2_UCHAR PCRE2_SUFFIX(PCRE2_UCHAR)
#define PCRE2_SPTR PCRE2_SUFFIX(PCRE2_SPTR)
#define pcre2_code PCRE2_SUFFIX(pcre2_code_)
#define pcre2_jit_callback PCRE2_SUFFIX(pcre2_jit_callback_)
#define pcre2_jit_stack PCRE2_SUFFIX(pcre2_jit_stack_)
#define pcre2_code PCRE2_SUFFIX(pcre2_code_)
#define pcre2_jit_callback PCRE2_SUFFIX(pcre2_jit_callback_)
#define pcre2_jit_stack PCRE2_SUFFIX(pcre2_jit_stack_)
#define pcre2_real_code PCRE2_SUFFIX(pcre2_real_code_)
#define pcre2_real_context PCRE2_SUFFIX(pcre2_real_context_)
#define pcre2_real_jit_stack PCRE2_SUFFIX(pcre2_real_jit_stack_)
#define pcre2_real_match_data PCRE2_SUFFIX(pcre2_real_match_data_)
#define pcre2_real_code PCRE2_SUFFIX(pcre2_real_code_)
#define pcre2_real_general_context PCRE2_SUFFIX(pcre2_real_general_context_)
#define pcre2_real_compile_context PCRE2_SUFFIX(pcre2_real_compile_context_)
#define pcre2_real_match_context PCRE2_SUFFIX(pcre2_real_match_context_)
#define pcre2_real_jit_stack PCRE2_SUFFIX(pcre2_real_jit_stack_)
#define pcre2_real_match_data PCRE2_SUFFIX(pcre2_real_match_data_)
/* Data blocks */
#define pcre2_callout_block PCRE2_SUFFIX(pcre2_callout_block_)
#define pcre2_context PCRE2_SUFFIX(pcre2_context_)
#define pcre2_match_data PCRE2_SUFFIX(pcre2_match_data_)
#define pcre2_callout_block PCRE2_SUFFIX(pcre2_callout_block_)
#define pcre2_general_context PCRE2_SUFFIX(pcre2_general_context_)
#define pcre2_compile_context PCRE2_SUFFIX(pcre2_compile_context_)
#define pcre2_match_context PCRE2_SUFFIX(pcre2_match_context_)
#define pcre2_match_data PCRE2_SUFFIX(pcre2_match_data_)
/* Functions: the complete list in alphabetical order */
#define pcre2_code_free PCRE2_SUFFIX(pcre2_code_free_)
#define pcre2_compile PCRE2_SUFFIX(pcre2_compile_)
#define pcre2_compile_context_copy PCRE2_SUFFIX(pcre2_compile_context_copy_)
#define pcre2_compile_context_create PCRE2_SUFFIX(pcre2_compile_context_create_)
#define pcre2_compile_context_free PCRE2_SUFFIX(pcre2_compile_context_free_)
#define pcre2_config PCRE2_SUFFIX(pcre2_config_)
#define pcre2_context_size PCRE2_SUFFIX(pcre2_context_size_)
#define pcre2_copy_context PCRE2_SUFFIX(pcre2_copy_context_)
#define pcre2_copy_named_substring PCRE2_SUFFIX(pcre2_copy_named_substring_)
#define pcre2_copy_substring PCRE2_SUFFIX(pcre2_copy_substring_)
#define pcre2_create_match_data PCRE2_SUFFIX(pcre2_create_match_data_)
#define pcre2_dfa_exec PCRE2_SUFFIX(pcre2_dfa_exec_)
#define pcre2_exec PCRE2_SUFFIX(pcre2_exec_)
#define pcre2_free_compiled_code PCRE2_SUFFIX(pcre2_free_compiled_code_)
#define pcre2_free_context PCRE2_SUFFIX(pcre2_free_context_)
#define pcre2_free_match_data PCRE2_SUFFIX(pcre2_free_match_data_)
#define pcre2_free_substring PCRE2_SUFFIX(pcre2_free_substring_)
#define pcre2_free_substring_list PCRE2_SUFFIX(pcre2_free_substring_list_)
#define pcre2_get_bsr_convention PCRE2_SUFFIX(pcre2_get_bsr_convention_)
#define pcre2_get_callout PCRE2_SUFFIX(pcre2_get_callout_)
#define pcre2_get_character_tables PCRE2_SUFFIX(pcre2_get_character_tables_)
#define pcre2_get_context_options PCRE2_SUFFIX(pcre2_get_context_options_)
#define pcre2_dfa_match PCRE2_SUFFIX(pcre2_dfa_match_)
#define pcre2_match PCRE2_SUFFIX(pcre2_match_)
#define pcre2_general_context_copy PCRE2_SUFFIX(pcre2_general_context_copy_)
#define pcre2_general_context_create PCRE2_SUFFIX(pcre2_general_context_create_)
#define pcre2_general_context_free PCRE2_SUFFIX(pcre2_general_context_free_)
#define pcre2_get_error_message PCRE2_SUFFIX(pcre2_get_error_message_)
#define pcre2_get_leftchar PCRE2_SUFFIX(pcre2_get_leftchar_)
#define pcre2_get_mark PCRE2_SUFFIX(pcre2_get_mark_)
#define pcre2_get_match_limit PCRE2_SUFFIX(pcre2_get_match_limit_)
#define pcre2_get_memory_management PCRE2_SUFFIX(pcre2_get_memory_management_)
#define pcre2_get_named_substring PCRE2_SUFFIX(pcre2_get_named_substring_)
#define pcre2_get_named_substring_length PCRE2_SUFFIX(pcre2_get_named_substring_length_)
#define pcre2_get_newline_convention PCRE2_SUFFIX(pcre2_get_newline_convention_)
#define pcre2_get_ovector PCRE2_SUFFIX(pcre2_get_ovector_)
#define pcre2_get_ovector_slots PCRE2_SUFFIX(pcre2_get_ovector_slots_)
#define pcre2_get_parens_nest_limit PCRE2_SUFFIX(pcre2_get_parens_nest_limit_)
#define pcre2_get_recursion_guard PCRE2_SUFFIX(pcre2_get_recursion_guard_)
#define pcre2_get_recursion_limit PCRE2_SUFFIX(pcre2_get_recursion_limit_)
#define pcre2_get_recursion_memory_management PCRE2_SUFFIX(pcre2_get_recursion_memory_management_)
#define pcre2_get_match_frame_size PCRE2_SUFFIX(pcre2_get_match_frame_size_)
#define pcre2_get_ovector_pointer PCRE2_SUFFIX(pcre2_get_ovector_pointer_)
#define pcre2_get_ovector_count PCRE2_SUFFIX(pcre2_get_ovector_count_)
#define pcre2_get_rightchar PCRE2_SUFFIX(pcre2_get_rightchar_)
#define pcre2_get_startchar PCRE2_SUFFIX(pcre2_get_startchar_)
#define pcre2_get_stringtable_entries PCRE2_SUFFIX(pcre2_get_stringtable_entries_)
#define pcre2_get_substring PCRE2_SUFFIX(pcre2_get_substring_)
#define pcre2_get_substring_length PCRE2_SUFFIX(pcre2_get_substring_length_)
#define pcre2_get_substring_list PCRE2_SUFFIX(pcre2_get_substring_list_)
#define pcre2_get_substring_number PCRE2_SUFFIX(pcre2_get_substring_number_)
#define pcre2_get_user_data PCRE2_SUFFIX(pcre2_get_user_data_)
#define pcre2_init_context PCRE2_SUFFIX(pcre2_init_context_)
#define pcre2_jit_compile PCRE2_SUFFIX(pcre2_jit_compile_)
#define pcre2_jit_exec PCRE2_SUFFIX(pcre2_jit_exec_)
#define pcre2_jit_match PCRE2_SUFFIX(pcre2_jit_match_)
#define pcre2_jit_free_unused_memory PCRE2_SUFFIX(pcre2_jit_free_unused_memory_)
#define pcre2_jit_stack_alloc PCRE2_SUFFIX(pcre2_jit_stack_alloc_)
#define pcre2_jit_stack_assign PCRE2_SUFFIX(pcre2_jit_stack_assign_)
#define pcre2_jit_stack_free PCRE2_SUFFIX(pcre2_jit_stack_free_)
#define pcre2_maketables PCRE2_SUFFIX(pcre2_maketables_)
#define pcre2_match_context_copy PCRE2_SUFFIX(pcre2_match_context_copy_)
#define pcre2_match_context_create PCRE2_SUFFIX(pcre2_match_context_create_)
#define pcre2_match_context_free PCRE2_SUFFIX(pcre2_match_context_free_)
#define pcre2_match_data_create PCRE2_SUFFIX(pcre2_match_data_create_)
#define pcre2_match_data_create_from_pattern PCRE2_SUFFIX(pcre2_match_data_create_from_pattern_)
#define pcre2_match_data_free PCRE2_SUFFIX(pcre2_match_data_free_)
#define pcre2_pattern_info PCRE2_SUFFIX(pcre2_pattern_info_)
#define pcre2_pattern_to_host_byte_order PCRE2_SUFFIX(pcre2_pattern_to_host_byte_order_)
#define pcre2_set_bsr_convention PCRE2_SUFFIX(pcre2_set_bsr_convention_)
#define pcre2_set_callout PCRE2_SUFFIX(pcre2_set_callout_)
#define pcre2_set_character_tables PCRE2_SUFFIX(pcre2_set_character_tables_)
#define pcre2_set_context_options PCRE2_SUFFIX(pcre2_set_context_options_)
#define pcre2_set_compile_recursion_guard PCRE2_SUFFIX(pcre2_set_compile_recursion_guard_)
#define pcre2_set_match_limit PCRE2_SUFFIX(pcre2_set_match_limit_)
#define pcre2_set_memory_management PCRE2_SUFFIX(pcre2_set_memory_management_)
#define pcre2_set_newline_convention PCRE2_SUFFIX(pcre2_set_newline_convention_)
#define pcre2_set_recursion_guard PCRE2_SUFFIX(pcre2_set_recursion_guard_)
#define pcre2_set_parens_nest_limit PCRE2_SUFFIX(pcre2_set_parens_nest_limit_)
#define pcre2_set_recursion_limit PCRE2_SUFFIX(pcre2_set_recursion_limit_)
#define pcre2_set_recursion_memory_management PCRE2_SUFFIX(pcre2_set_recursion_memory_management_)
#define pcre2_set_user_data PCRE2_SUFFIX(pcre2_set_user_data_)
#define pcre2_substring_copy_byname PCRE2_SUFFIX(pcre2_substring_copy_byname_)
#define pcre2_substring_copy_bynumber PCRE2_SUFFIX(pcre2_substring_copy_bynumber_)
#define pcre2_substring_free PCRE2_SUFFIX(pcre2_substring_free_)
#define pcre2_substring_get_byname PCRE2_SUFFIX(pcre2_substring_get_byname_)
#define pcre2_substring_get_bynumber PCRE2_SUFFIX(pcre2_substring_get_bynumber_)
#define pcre2_substring_length_byname PCRE2_SUFFIX(pcre2_substring_length_byname_)
#define pcre2_substring_length_bynumber PCRE2_SUFFIX(pcre2_substring_length_bynumber_)
#define pcre2_substring_list_get PCRE2_SUFFIX(pcre2_substring_list_get_)
#define pcre2_substring_list_free PCRE2_SUFFIX(pcre2_substring_list_free_)
#define pcre2_substring_nametable_scan PCRE2_SUFFIX(pcre2_substring_nametable_scan_)
#define pcre2_substring_number_from_name PCRE2_SUFFIX(pcre2_substring_number_from_name_)
#define pcre2_version PCRE2_SUFFIX(pcre2_version_)
@ -593,7 +582,9 @@ prototypes. */
PCRE2_TYPES_LIST
PCRE2_STRUCTURE_LIST
PCRE2_GENERAL_INFO_FUNCTIONS
PCRE2_CONTEXT_FUNCTIONS
PCRE2_GENERAL_CONTEXT_FUNCTIONS
PCRE2_COMPILE_CONTEXT_FUNCTIONS
PCRE2_MATCH_CONTEXT_FUNCTIONS
PCRE2_COMPILE_FUNCTIONS
PCRE2_PATTERN_INFO_FUNCTIONS
PCRE2_MATCH_FUNCTIONS
@ -606,7 +597,9 @@ PCRE2_OTHER_FUNCTIONS
PCRE2_TYPES_LIST
PCRE2_STRUCTURE_LIST
PCRE2_GENERAL_INFO_FUNCTIONS
PCRE2_CONTEXT_FUNCTIONS
PCRE2_GENERAL_CONTEXT_FUNCTIONS
PCRE2_COMPILE_CONTEXT_FUNCTIONS
PCRE2_MATCH_CONTEXT_FUNCTIONS
PCRE2_COMPILE_FUNCTIONS
PCRE2_PATTERN_INFO_FUNCTIONS
PCRE2_MATCH_FUNCTIONS
@ -619,7 +612,9 @@ PCRE2_OTHER_FUNCTIONS
PCRE2_TYPES_LIST
PCRE2_STRUCTURE_LIST
PCRE2_GENERAL_INFO_FUNCTIONS
PCRE2_CONTEXT_FUNCTIONS
PCRE2_GENERAL_CONTEXT_FUNCTIONS
PCRE2_COMPILE_CONTEXT_FUNCTIONS
PCRE2_MATCH_CONTEXT_FUNCTIONS
PCRE2_COMPILE_FUNCTIONS
PCRE2_PATTERN_INFO_FUNCTIONS
PCRE2_MATCH_FUNCTIONS
@ -633,7 +628,9 @@ PCRE2_OTHER_FUNCTIONS
#undef PCRE2_TYPES_LIST
#undef PCRE2_STRUCTURE_LIST
#undef PCRE2_GENERAL_INFO_FUNCTIONS
#undef PCRE2_CONTEXT_FUNCTIONS
#undef PCRE2_GENERAL_CONTEXT_FUNCTIONS
#undef PCRE2_COMPILE_CONTEXT_FUNCTIONS
#undef PCRE2_MATCH_CONTEXT_FUNCTIONS
#undef PCRE2_COMPILE_FUNCTIONS
#undef PCRE2_PATTERN_INFO_FUNCTIONS
#undef PCRE2_MATCH_FUNCTIONS

View File

@ -79,28 +79,7 @@ are defined. */
extern "C" {
#endif
/* Public options. Those in the context may affect compilation, JIT
compilation, and/or interpretive execution. The following tags indicate which:
C alters what is compiled
J alters what JIT compiles
E affects pcre2_exec() execution
D affects pcre2_dfa_exec() execution
*/
/* The first group of options are those that are set in the context. */
#define PCRE2_ALT_BSUX 0x00000001 /* C */
#define PCRE2_DOLLAR_ENDONLY 0x00000002 /* J E D */
#define PCRE2_DUPNAMES 0x00000004 /* C */
#define PCRE2_ALLOW_EMPTY_CLASS 0x00000008 /* C */
#define PCRE2_MATCH_UNSET_BACKREF 0x00000010 /* C J E */
#define PCRE2_NEVER_UTF 0x00000020 /* C */
#define PCRE2_NEVER_UCP 0x00000040 /* C */
#define PCRE2_UTF 0x00000080 /* C J E D */
#define PCRE2_UCP 0x00000100 /* C J E D */
/* The following can be passed to pcre2_compile(), pcre2_exec(), or
/* The following options can be passed to pcre2_compile(), pcre2_exec(), or
pcre2_dfa_exec(). PCRE2_NO_UTF_CHECK affects only the function to which it is
passed. */
@ -108,44 +87,56 @@ passed. */
#define PCRE2_NO_START_OPTIMIZE 0x00000002
#define PCRE2_NO_UTF_CHECK 0x00000004
/* These are for pcre2_compile() only, affecting what is compiled, but not
otherwise affecting execution. */
/* Other options that can be passed to pcre2_compile(). They may affect
compilation, JIT compilation, and/or interpretive execution. The following tags
indicate which:
#define PCRE2_AUTO_CALLOUT 0x00000100
#define PCRE2_CASELESS 0x00000200
#define PCRE2_DOTALL 0x00000400
#define PCRE2_EXTENDED 0x00000800
#define PCRE2_MULTILINE 0x00001000
#define PCRE2_NO_AUTO_CAPTURE 0x00002000
#define PCRE2_NO_AUTO_POSSESS 0x00004000
#define PCRE2_UNGREEDY 0x00008000
C alters what is compiled
J alters what JIT compiles
E is inspected during pcre2_exec() execution
D is inspected during pcre2_dfa_exec() execution
*/
/* This pcre2_compile() option affects JIT compilation and interpretive
execution. */
#define PCRE2_FIRSTLINE 0x00010000
#define PCRE2_ALLOW_EMPTY_CLASS 0x00000008 /* C */
#define PCRE2_ALT_BSUX 0x00000010 /* C */
#define PCRE2_AUTO_CALLOUT 0x00000020 /* C */
#define PCRE2_CASELESS 0x00000040 /* C */
#define PCRE2_DOLLAR_ENDONLY 0x00000080 /* J E D */
#define PCRE2_DOTALL 0x00000100 /* C */
#define PCRE2_DUPNAMES 0x00000200 /* C */
#define PCRE2_EXTENDED 0x00000400 /* C */
#define PCRE2_FIRSTLINE 0x00000800 /* J E D */
#define PCRE2_MATCH_UNSET_BACKREF 0x00001000 /* C J E */
#define PCRE2_MULTILINE 0x00002000 /* C */
#define PCRE2_NEVER_UCP 0x00004000 /* C */
#define PCRE2_NEVER_UTF 0x00008000 /* C */
#define PCRE2_NO_AUTO_CAPTURE 0x00010000 /* C */
#define PCRE2_NO_AUTO_POSSESS 0x00020000 /* C */
#define PCRE2_UCP 0x00040000 /* C J E D */
#define PCRE2_UNGREEDY 0x00080000 /* C */
#define PCRE2_UTF 0x00100000 /* C J E D */
/* These are for pcre2_jit_compile(). */
#define PCRE2_JIT 0x00020000
#define PCRE2_JIT_PARTIAL_SOFT 0x00040000
#define PCRE2_JIT_PARTIAL_HARD 0x00080000
#define PCRE2_JIT 0x00000001 /* For full matching */
#define PCRE2_JIT_PARTIAL_SOFT 0x00000002
#define PCRE2_JIT_PARTIAL_HARD 0x00000004
/* These are for pcre2_exec() and pcre2_dfa_exec(). */
#define PCRE2_NOTBOL 0x00000100
#define PCRE2_NOTEOL 0x00000200
#define PCRE2_NOTEMPTY 0x00000400
#define PCRE2_NOTEMPTY_ATSTART 0x00000800
#define PCRE2_PARTIAL_SOFT 0x00001000
#define PCRE2_PARTIAL_HARD 0x00002000
#define PCRE2_NOTBOL 0x00000001
#define PCRE2_NOTEOL 0x00000002
#define PCRE2_NOTEMPTY 0x00000004
#define PCRE2_NOTEMPTY_ATSTART 0x00000008
#define PCRE2_PARTIAL_SOFT 0x00000010
#define PCRE2_PARTIAL_HARD 0x00000020
/* These are additional options for pcre2_dfa_exec(). */
#define PCRE2_DFA_RESTART 0x00010000
#define PCRE2_DFA_SHORTEST 0x00020000
#define PCRE2_DFA_RESTART 0x00000040
#define PCRE2_DFA_SHORTEST 0x00000080
/* Newline and \R settings, for use in the context. */
/* Newline and \R settings, for use in the compile context. */
#define PCRE2_NEWLINE_CR 0
#define PCRE2_NEWLINE_LF 1
@ -238,14 +229,14 @@ execution. */
#define PCRE2_INFO_LASTCODEUNIT 10
#define PCRE2_INFO_LASTCODETYPE 11
#define PCRE2_INFO_MATCH_EMPTY 12
#define PCRE2_INFO_MATCHLIMIT 13
#define PCRE2_INFO_MATCH_LIMIT 13
#define PCRE2_INFO_MAXLOOKBEHIND 14
#define PCRE2_INFO_MINLENGTH 15
#define PCRE2_INFO_NAMECOUNT 16
#define PCRE2_INFO_NAMEENTRYSIZE 17
#define PCRE2_INFO_NAMETABLE 18
#define PCRE2_INFO_PATTERN_OPTIONS 19
#define PCRE2_INFO_RECURSIONLIMIT 20
#define PCRE2_INFO_RECURSION_LIMIT 20
#define PCRE2_INFO_SIZE 21
/* Request types for pcre2_config(). */
@ -262,6 +253,10 @@ execution. */
#define PCRE2_CONFIG_STACKRECURSE 9
#define PCRE2_CONFIG_UTF 10
/* A value that is used to indicate 'unset' in unsigned size_t fields. */
#define PCRE2_UNSET (~(size_t)0)
/* Types for patterns and subject strings. */
typedef uint8_t PCRE2_UCHAR8;
@ -277,8 +272,14 @@ typedef const PCRE2_UCHAR32 *PCRE2_SPTR32;
declarations are defined in a macro that is expanded for each width later. */
#define PCRE2_TYPES_LIST \
struct pcre2_real_context; \
typedef struct pcre2_real_context pcre2_context; \
struct pcre2_real_general_context; \
typedef struct pcre2_real_general_context pcre2_general_context; \
\
struct pcre2_real_compile_context; \
typedef struct pcre2_real_compile_context pcre2_compile_context; \
\
struct pcre2_real_match_context; \
typedef struct pcre2_real_match_context pcre2_match_context; \
\
struct pcre2_real_code; \
typedef struct pcre2_real_code pcre2_code; \
@ -335,104 +336,93 @@ information. */
#define PCRE2_GENERAL_INFO_FUNCTIONS \
PCRE2_EXP_DECL int pcre2_config(int, void *); \
PCRE2_EXP_DECL size_t pcre2_get_exec_frame_size(void); \
PCRE2_EXP_DECL size_t pcre2_get_match_frame_size(void); \
PCRE2_EXP_DECL int pcre2_version(PCRE2_UCHAR *, size_t);
/* Functions for manipulating contexts. */
#define PCRE2_CONTEXT_FUNCTIONS \
PCRE2_EXP_DECL size_t pcre2_context_size(void); \
#define PCRE2_GENERAL_CONTEXT_FUNCTIONS \
PCRE2_EXP_DECL \
pcre2_context *pcre2_copy_context(pcre2_context *); \
PCRE2_EXP_DECL void pcre2_free_context(pcre2_context *); \
pcre2_general_context *pcre2_general_context_copy(pcre2_general_context *); \
PCRE2_EXP_DECL \
pcre2_context *pcre2_init_context(pcre2_context *); \
\
PCRE2_EXP_DECL uint32_t pcre2_get_bsr_convention(pcre2_context *); \
PCRE2_EXP_DECL int (*pcre2_get_callout(pcre2_context *)) \
(pcre2_callout_block *, void *); \
pcre2_general_context *pcre2_general_context_create( \
void *(*)(size_t, void *), \
void (*)(void *, void *), void *); \
PCRE2_EXP_DECL void pcre2_general_context_free(pcre2_general_context *);
#define PCRE2_COMPILE_CONTEXT_FUNCTIONS \
PCRE2_EXP_DECL \
const unsigned char *pcre2_get_character_tables(pcre2_context *); \
PCRE2_EXP_DECL uint32_t pcre2_get_context_options(pcre2_context *); \
PCRE2_EXP_DECL uint32_t pcre2_get_match_limit(pcre2_context *); \
PCRE2_EXP_DECL void pcre2_get_memory_management(pcre2_context *, \
void *(**)(size_t, void *), \
void (**)(void *, void *)); \
PCRE2_EXP_DECL uint32_t pcre2_get_newline_convention(pcre2_context *); \
PCRE2_EXP_DECL uint32_t pcre2_get_parens_nest_limit(pcre2_context *); \
PCRE2_EXP_DECL int (*pcre2_get_recursion_guard(pcre2_context *)) \
(uint32_t, void *); \
PCRE2_EXP_DECL uint32_t pcre2_get_recursion_limit(pcre2_context *); \
PCRE2_EXP_DECL void pcre2_get_recursion_memory_management(\
pcre2_context *, \
void *(**)(size_t, void *), \
void (**)(void *, void *)); \
PCRE2_EXP_DECL void *pcre2_get_user_data(pcre2_context *); \
\
PCRE2_EXP_DECL int pcre2_set_bsr_convention(pcre2_context *, uint32_t); \
PCRE2_EXP_DECL int pcre2_set_callout(pcre2_context *, \
int (*)(pcre2_callout_block *, void *)); \
PCRE2_EXP_DECL int pcre2_set_character_tables(pcre2_context *, \
pcre2_compile_context *pcre2_compile_context_copy(pcre2_compile_context *); \
PCRE2_EXP_DECL \
pcre2_compile_context *pcre2_compile_context_create(pcre2_general_context *);\
PCRE2_EXP_DECL void pcre2_compile_context_free(pcre2_compile_context *); \
PCRE2_EXP_DECL int pcre2_set_bsr_convention(pcre2_compile_context *, \
uint32_t); \
PCRE2_EXP_DECL int pcre2_set_character_tables(pcre2_compile_context *, \
const unsigned char *); \
PCRE2_EXP_DECL int pcre2_set_context_options(pcre2_context *, uint32_t, \
PCRE2_EXP_DECL int pcre2_set_newline_convention(pcre2_compile_context *, \
uint32_t); \
PCRE2_EXP_DECL int pcre2_set_match_limit(pcre2_context *, uint32_t); \
PCRE2_EXP_DECL int pcre2_set_memory_management(pcre2_context *, \
void * (*)(size_t, void *), \
void (*)(void *, void *)); \
PCRE2_EXP_DECL int pcre2_set_newline_convention(pcre2_context *, \
PCRE2_EXP_DECL int pcre2_set_parens_nest_limit(pcre2_compile_context *, \
uint32_t); \
PCRE2_EXP_DECL int pcre2_set_parens_nest_limit(pcre2_context *, \
PCRE2_EXP_DECL int pcre2_set_compile_recursion_guard(\
pcre2_compile_context *, int (*)(uint32_t)); \
#define PCRE2_MATCH_CONTEXT_FUNCTIONS \
PCRE2_EXP_DECL \
pcre2_match_context *pcre2_match_context_copy(pcre2_match_context *); \
PCRE2_EXP_DECL \
pcre2_match_context *pcre2_match_context_create(pcre2_general_context *); \
PCRE2_EXP_DECL void pcre2_match_context_free(pcre2_match_context *); \
PCRE2_EXP_DECL int pcre2_set_callout(pcre2_match_context *, \
int (*)(pcre2_callout_block *, void *)); \
PCRE2_EXP_DECL int pcre2_set_match_limit(pcre2_match_context *, \
uint32_t); \
PCRE2_EXP_DECL int pcre2_set_recursion_guard(pcre2_context *, \
int (*)(uint32_t, void *)); \
PCRE2_EXP_DECL int pcre2_set_recursion_limit(pcre2_context *, uint32_t); \
PCRE2_EXP_DECL int pcre2_set_recursion_memory_management(\
pcre2_context *, void * (*)(size_t, void *), \
void (*)(void *, void *)); \
PCRE2_EXP_DECL int pcre2_set_user_data(pcre2_context *, void *);
PCRE2_EXP_DECL int pcre2_set_recursion_limit(pcre2_match_context *, \
uint32_t); \
PCRE2_EXP_DECL int pcre2_set_recursion_memory_management( \
pcre2_match_context *, void *(*)(size_t, void *), \
void (*)(void *, void *));
/* Functions concerned with compiling a pattern to PCRE internal code. */
#define PCRE2_COMPILE_FUNCTIONS \
PCRE2_EXP_DECL \
pcre2_code *pcre2_compile(pcre2_context *, PCRE2_SPTR, int, \
uint32_t, int *, size_t *); \
PCRE2_EXP_DECL void pcre2_free_compiled_code(pcre2_context *, \
pcre2_code *);
pcre2_code *pcre2_compile(PCRE2_SPTR, int, uint32_t, \
int *, size_t *, pcre2_compile_context *); \
PCRE2_EXP_DECL void pcre2_code_free(pcre2_code *);
/* Functions that give information about a compiled pattern. */
#define PCRE2_PATTERN_INFO_FUNCTIONS \
PCRE2_EXP_DECL int pcre2_pattern_info(const pcre2_code *, uint32_t, \
void *); \
PCRE2_EXP_DECL int pcre2_get_stringtable_entries(const pcre2_code *, \
PCRE2_SPTR, PCRE2_UCHAR **, PCRE2_UCHAR **); \
PCRE2_EXP_DECL int pcre2_get_substring_number(const pcre2_code *, \
PCRE2_SPTR);
void *);
/* Functions for running a match and inspecting the result. */
#define PCRE2_MATCH_FUNCTIONS \
PCRE2_EXP_DECL \
pcre2_match_data *pcre2_create_match_data(pcre2_context *, size_t); \
PCRE2_EXP_DECL int pcre2_dfa_exec(pcre2_context *, const pcre2_code *, \
pcre2_match_data *pcre2_match_data_create(size_t, \
pcre2_general_context *); \
PCRE2_EXP_DECL \
pcre2_match_data *pcre2_match_data_create_from_pattern(pcre2_code *, \
pcre2_general_context *); \
PCRE2_EXP_DECL int pcre2_dfa_match(const pcre2_code *, \
PCRE2_SPTR, int, size_t, uint32_t, \
pcre2_match_data *, int *, size_t); \
PCRE2_EXP_DECL int pcre2_exec(pcre2_context *, const pcre2_code *, \
pcre2_match_data *, pcre2_match_context *, int *, \
size_t); \
PCRE2_EXP_DECL int pcre2_match(const pcre2_code *, \
PCRE2_SPTR, int, size_t, uint32_t, \
pcre2_match_data *); \
PCRE2_EXP_DECL void pcre2_free_match_data(pcre2_context *, \
pcre2_match_data *); \
pcre2_match_data *, pcre2_match_context *); \
PCRE2_EXP_DECL void pcre2_match_data_free(pcre2_match_data *); \
PCRE2_EXP_DECL size_t pcre2_get_leftchar(pcre2_match_data *); \
PCRE2_EXP_DECL \
PCRE2_SPTR pcre2_get_mark(pcre2_match_data *); \
PCRE2_EXP_DECL size_t *pcre2_get_ovector(pcre2_match_data *); \
PCRE2_EXP_DECL size_t pcre2_get_ovector_slots(pcre2_match_data *); \
PCRE2_EXP_DECL size_t pcre2_get_ovector_count(pcre2_match_data *); \
PCRE2_EXP_DECL size_t *pcre2_get_ovector_pointer(pcre2_match_data *); \
PCRE2_EXP_DECL size_t pcre2_get_rightchar(pcre2_match_data *); \
PCRE2_EXP_DECL size_t pcre2_get_startchar(pcre2_match_data *);
@ -440,48 +430,51 @@ PCRE2_EXP_DECL size_t pcre2_get_startchar(pcre2_match_data *);
/* Convenience functions for handling matched substrings. */
#define PCRE2_SUBSTRING_FUNCTIONS \
PCRE2_EXP_DECL int pcre2_copy_named_substring(pcre2_match_data *, \
PCRE2_EXP_DECL int pcre2_substring_copy_byname(pcre2_match_data *, \
PCRE2_SPTR, PCRE2_UCHAR *, size_t); \
PCRE2_EXP_DECL int pcre2_copy_substring(pcre2_match_data *, int, \
PCRE2_UCHAR *, size_t); \
PCRE2_EXP_DECL void pcre2_free_substring(pcre2_context *, PCRE2_UCHAR *); \
PCRE2_EXP_DECL void pcre2_free_substring_list(pcre2_context *, \
PCRE2_SPTR *); \
PCRE2_EXP_DECL int pcre2_get_named_substring(pcre2_context *, \
pcre2_match_data *, PCRE2_SPTR, PCRE2_UCHAR **); \
PCRE2_EXP_DECL int pcre2_get_named_substring_length(pcre2_match_data *, \
PCRE2_EXP_DECL int pcre2_substring_copy_bynumber(pcre2_match_data *, \
int, PCRE2_UCHAR *, size_t); \
PCRE2_EXP_DECL void pcre2_substring_free(PCRE2_UCHAR *); \
PCRE2_EXP_DECL int pcre2_substring_get_byname(pcre2_match_data *, \
PCRE2_SPTR, PCRE2_UCHAR **); \
PCRE2_EXP_DECL int pcre2_substring_get_bynumber(pcre2_match_data *, \
int, PCRE2_UCHAR **); \
PCRE2_EXP_DECL int pcre2_substring_length_byname(pcre2_match_data *, \
PCRE2_SPTR); \
PCRE2_EXP_DECL int pcre2_get_substring(pcre2_context *, \
pcre2_match_data *, int, PCRE2_UCHAR **); \
PCRE2_EXP_DECL int pcre2_get_substring_length(pcre2_match_data *, int); \
PCRE2_EXP_DECL int pcre2_get_substring_list(pcre2_context *, \
pcre2_match_data *, PCRE2_UCHAR ***);
PCRE2_EXP_DECL int pcre2_substring_length_bynumber(pcre2_match_data *, \
int); \
PCRE2_EXP_DECL int pcre2_substring_nametable_scan(const pcre2_code *, \
PCRE2_SPTR, PCRE2_UCHAR **, PCRE2_UCHAR **); \
PCRE2_EXP_DECL int pcre2_substring_number_from_name(\
const pcre2_code *, PCRE2_SPTR); \
PCRE2_EXP_DECL void pcre2_substring_list_free(PCRE2_SPTR *); \
PCRE2_EXP_DECL int pcre2_substring_list_get(pcre2_match_data *, \
PCRE2_UCHAR ***, size_t **);
/* Functions for JIT processing */
#define PCRE2_JIT_FUNCTIONS \
PCRE2_EXP_DECL void pcre2_jit_compile(pcre2_context *, pcre2_code *, \
uint32_t); \
PCRE2_EXP_DECL int pcre2_jit_exec(pcre2_context *, const pcre2_code *, \
PCRE2_EXP_DECL void pcre2_jit_compile(pcre2_code *, uint32_t); \
PCRE2_EXP_DECL int pcre2_jit_match(const pcre2_code *, \
PCRE2_SPTR, int, size_t, uint32_t, \
pcre2_match_data *, pcre2_jit_stack *); \
PCRE2_EXP_DECL void pcre2_jit_free_unused_memory(pcre2_context *); \
PCRE2_EXP_DECL void pcre2_jit_free_unused_memory(pcre2_general_context *);\
PCRE2_EXP_DECL \
pcre2_jit_stack *pcre2_jit_stack_alloc(pcre2_context *, size_t, \
size_t); \
PCRE2_EXP_DECL void pcre2_jit_stack_assign(pcre2_context *, \
const pcre2_code *, pcre2_jit_callback, void *); \
PCRE2_EXP_DECL void pcre2_jit_stack_free(pcre2_context *, \
pcre2_jit_stack *);
pcre2_jit_stack *pcre2_jit_stack_alloc(pcre2_general_context *, \
size_t, size_t); \
PCRE2_EXP_DECL void pcre2_jit_stack_assign(const pcre2_code *, \
pcre2_jit_callback, void *); \
PCRE2_EXP_DECL void pcre2_jit_stack_free(pcre2_jit_stack *);
/* Other miscellaneous functions. */
#define PCRE2_OTHER_FUNCTIONS \
PCRE2_EXP_DECL int pcre2_get_error_message(int, PCRE2_UCHAR *, size_t); \
PCRE2_EXP_DECL size_t pcre2_get_match_frame_size(void); \
PCRE2_EXP_DECL \
const unsigned char *pcre2_maketables(pcre2_context *); \
const unsigned char *pcre2_maketables(pcre2_general_context *); \
PCRE2_EXP_DECL int pcre2_pattern_to_host_byte_order(pcre2_code *);
@ -499,90 +492,86 @@ pcre2_compile are called by application code. */
/* Data types */
#define PCRE2_UCHAR PCRE2_SUFFIX(PCRE2_UCHAR)
#define PCRE2_SPTR PCRE2_SUFFIX(PCRE2_SPTR)
#define PCRE2_UCHAR PCRE2_SUFFIX(PCRE2_UCHAR)
#define PCRE2_SPTR PCRE2_SUFFIX(PCRE2_SPTR)
#define pcre2_code PCRE2_SUFFIX(pcre2_code_)
#define pcre2_jit_callback PCRE2_SUFFIX(pcre2_jit_callback_)
#define pcre2_jit_stack PCRE2_SUFFIX(pcre2_jit_stack_)
#define pcre2_code PCRE2_SUFFIX(pcre2_code_)
#define pcre2_jit_callback PCRE2_SUFFIX(pcre2_jit_callback_)
#define pcre2_jit_stack PCRE2_SUFFIX(pcre2_jit_stack_)
#define pcre2_real_code PCRE2_SUFFIX(pcre2_real_code_)
#define pcre2_real_context PCRE2_SUFFIX(pcre2_real_context_)
#define pcre2_real_jit_stack PCRE2_SUFFIX(pcre2_real_jit_stack_)
#define pcre2_real_match_data PCRE2_SUFFIX(pcre2_real_match_data_)
#define pcre2_real_code PCRE2_SUFFIX(pcre2_real_code_)
#define pcre2_real_general_context PCRE2_SUFFIX(pcre2_real_general_context_)
#define pcre2_real_compile_context PCRE2_SUFFIX(pcre2_real_compile_context_)
#define pcre2_real_match_context PCRE2_SUFFIX(pcre2_real_match_context_)
#define pcre2_real_jit_stack PCRE2_SUFFIX(pcre2_real_jit_stack_)
#define pcre2_real_match_data PCRE2_SUFFIX(pcre2_real_match_data_)
/* Data blocks */
#define pcre2_callout_block PCRE2_SUFFIX(pcre2_callout_block_)
#define pcre2_context PCRE2_SUFFIX(pcre2_context_)
#define pcre2_match_data PCRE2_SUFFIX(pcre2_match_data_)
#define pcre2_callout_block PCRE2_SUFFIX(pcre2_callout_block_)
#define pcre2_general_context PCRE2_SUFFIX(pcre2_general_context_)
#define pcre2_compile_context PCRE2_SUFFIX(pcre2_compile_context_)
#define pcre2_match_context PCRE2_SUFFIX(pcre2_match_context_)
#define pcre2_match_data PCRE2_SUFFIX(pcre2_match_data_)
/* Functions: the complete list in alphabetical order */
#define pcre2_code_free PCRE2_SUFFIX(pcre2_code_free_)
#define pcre2_compile PCRE2_SUFFIX(pcre2_compile_)
#define pcre2_compile_context_copy PCRE2_SUFFIX(pcre2_compile_context_copy_)
#define pcre2_compile_context_create PCRE2_SUFFIX(pcre2_compile_context_create_)
#define pcre2_compile_context_free PCRE2_SUFFIX(pcre2_compile_context_free_)
#define pcre2_config PCRE2_SUFFIX(pcre2_config_)
#define pcre2_context_size PCRE2_SUFFIX(pcre2_context_size_)
#define pcre2_copy_context PCRE2_SUFFIX(pcre2_copy_context_)
#define pcre2_copy_named_substring PCRE2_SUFFIX(pcre2_copy_named_substring_)
#define pcre2_copy_substring PCRE2_SUFFIX(pcre2_copy_substring_)
#define pcre2_create_match_data PCRE2_SUFFIX(pcre2_create_match_data_)
#define pcre2_dfa_exec PCRE2_SUFFIX(pcre2_dfa_exec_)
#define pcre2_exec PCRE2_SUFFIX(pcre2_exec_)
#define pcre2_free_compiled_code PCRE2_SUFFIX(pcre2_free_compiled_code_)
#define pcre2_free_context PCRE2_SUFFIX(pcre2_free_context_)
#define pcre2_free_match_data PCRE2_SUFFIX(pcre2_free_match_data_)
#define pcre2_free_substring PCRE2_SUFFIX(pcre2_free_substring_)
#define pcre2_free_substring_list PCRE2_SUFFIX(pcre2_free_substring_list_)
#define pcre2_get_bsr_convention PCRE2_SUFFIX(pcre2_get_bsr_convention_)
#define pcre2_get_callout PCRE2_SUFFIX(pcre2_get_callout_)
#define pcre2_get_character_tables PCRE2_SUFFIX(pcre2_get_character_tables_)
#define pcre2_get_context_options PCRE2_SUFFIX(pcre2_get_context_options_)
#define pcre2_dfa_match PCRE2_SUFFIX(pcre2_dfa_match_)
#define pcre2_match PCRE2_SUFFIX(pcre2_match_)
#define pcre2_general_context_copy PCRE2_SUFFIX(pcre2_general_context_copy_)
#define pcre2_general_context_create PCRE2_SUFFIX(pcre2_general_context_create_)
#define pcre2_general_context_free PCRE2_SUFFIX(pcre2_general_context_free_)
#define pcre2_get_error_message PCRE2_SUFFIX(pcre2_get_error_message_)
#define pcre2_get_leftchar PCRE2_SUFFIX(pcre2_get_leftchar_)
#define pcre2_get_mark PCRE2_SUFFIX(pcre2_get_mark_)
#define pcre2_get_match_limit PCRE2_SUFFIX(pcre2_get_match_limit_)
#define pcre2_get_memory_management PCRE2_SUFFIX(pcre2_get_memory_management_)
#define pcre2_get_named_substring PCRE2_SUFFIX(pcre2_get_named_substring_)
#define pcre2_get_named_substring_length PCRE2_SUFFIX(pcre2_get_named_substring_length_)
#define pcre2_get_newline_convention PCRE2_SUFFIX(pcre2_get_newline_convention_)
#define pcre2_get_ovector PCRE2_SUFFIX(pcre2_get_ovector_)
#define pcre2_get_ovector_slots PCRE2_SUFFIX(pcre2_get_ovector_slots_)
#define pcre2_get_parens_nest_limit PCRE2_SUFFIX(pcre2_get_parens_nest_limit_)
#define pcre2_get_recursion_guard PCRE2_SUFFIX(pcre2_get_recursion_guard_)
#define pcre2_get_recursion_limit PCRE2_SUFFIX(pcre2_get_recursion_limit_)
#define pcre2_get_recursion_memory_management PCRE2_SUFFIX(pcre2_get_recursion_memory_management_)
#define pcre2_get_match_frame_size PCRE2_SUFFIX(pcre2_get_match_frame_size_)
#define pcre2_get_ovector_pointer PCRE2_SUFFIX(pcre2_get_ovector_pointer_)
#define pcre2_get_ovector_count PCRE2_SUFFIX(pcre2_get_ovector_count_)
#define pcre2_get_rightchar PCRE2_SUFFIX(pcre2_get_rightchar_)
#define pcre2_get_startchar PCRE2_SUFFIX(pcre2_get_startchar_)
#define pcre2_get_stringtable_entries PCRE2_SUFFIX(pcre2_get_stringtable_entries_)
#define pcre2_get_substring PCRE2_SUFFIX(pcre2_get_substring_)
#define pcre2_get_substring_length PCRE2_SUFFIX(pcre2_get_substring_length_)
#define pcre2_get_substring_list PCRE2_SUFFIX(pcre2_get_substring_list_)
#define pcre2_get_substring_number PCRE2_SUFFIX(pcre2_get_substring_number_)
#define pcre2_get_user_data PCRE2_SUFFIX(pcre2_get_user_data_)
#define pcre2_init_context PCRE2_SUFFIX(pcre2_init_context_)
#define pcre2_jit_compile PCRE2_SUFFIX(pcre2_jit_compile_)
#define pcre2_jit_exec PCRE2_SUFFIX(pcre2_jit_exec_)
#define pcre2_jit_match PCRE2_SUFFIX(pcre2_jit_match_)
#define pcre2_jit_free_unused_memory PCRE2_SUFFIX(pcre2_jit_free_unused_memory_)
#define pcre2_jit_stack_alloc PCRE2_SUFFIX(pcre2_jit_stack_alloc_)
#define pcre2_jit_stack_assign PCRE2_SUFFIX(pcre2_jit_stack_assign_)
#define pcre2_jit_stack_free PCRE2_SUFFIX(pcre2_jit_stack_free_)
#define pcre2_maketables PCRE2_SUFFIX(pcre2_maketables_)
#define pcre2_match_context_copy PCRE2_SUFFIX(pcre2_match_context_copy_)
#define pcre2_match_context_create PCRE2_SUFFIX(pcre2_match_context_create_)
#define pcre2_match_context_free PCRE2_SUFFIX(pcre2_match_context_free_)
#define pcre2_match_data_create PCRE2_SUFFIX(pcre2_match_data_create_)
#define pcre2_match_data_create_from_pattern PCRE2_SUFFIX(pcre2_match_data_create_from_pattern_)
#define pcre2_match_data_free PCRE2_SUFFIX(pcre2_match_data_free_)
#define pcre2_pattern_info PCRE2_SUFFIX(pcre2_pattern_info_)
#define pcre2_pattern_to_host_byte_order PCRE2_SUFFIX(pcre2_pattern_to_host_byte_order_)
#define pcre2_set_bsr_convention PCRE2_SUFFIX(pcre2_set_bsr_convention_)
#define pcre2_set_callout PCRE2_SUFFIX(pcre2_set_callout_)
#define pcre2_set_character_tables PCRE2_SUFFIX(pcre2_set_character_tables_)
#define pcre2_set_context_options PCRE2_SUFFIX(pcre2_set_context_options_)
#define pcre2_set_compile_recursion_guard PCRE2_SUFFIX(pcre2_set_compile_recursion_guard_)
#define pcre2_set_match_limit PCRE2_SUFFIX(pcre2_set_match_limit_)
#define pcre2_set_memory_management PCRE2_SUFFIX(pcre2_set_memory_management_)
#define pcre2_set_newline_convention PCRE2_SUFFIX(pcre2_set_newline_convention_)
#define pcre2_set_recursion_guard PCRE2_SUFFIX(pcre2_set_recursion_guard_)
#define pcre2_set_parens_nest_limit PCRE2_SUFFIX(pcre2_set_parens_nest_limit_)
#define pcre2_set_recursion_limit PCRE2_SUFFIX(pcre2_set_recursion_limit_)
#define pcre2_set_recursion_memory_management PCRE2_SUFFIX(pcre2_set_recursion_memory_management_)
#define pcre2_set_user_data PCRE2_SUFFIX(pcre2_set_user_data_)
#define pcre2_substring_copy_byname PCRE2_SUFFIX(pcre2_substring_copy_byname_)
#define pcre2_substring_copy_bynumber PCRE2_SUFFIX(pcre2_substring_copy_bynumber_)
#define pcre2_substring_free PCRE2_SUFFIX(pcre2_substring_free_)
#define pcre2_substring_get_byname PCRE2_SUFFIX(pcre2_substring_get_byname_)
#define pcre2_substring_get_bynumber PCRE2_SUFFIX(pcre2_substring_get_bynumber_)
#define pcre2_substring_length_byname PCRE2_SUFFIX(pcre2_substring_length_byname_)
#define pcre2_substring_length_bynumber PCRE2_SUFFIX(pcre2_substring_length_bynumber_)
#define pcre2_substring_list_get PCRE2_SUFFIX(pcre2_substring_list_get_)
#define pcre2_substring_list_free PCRE2_SUFFIX(pcre2_substring_list_free_)
#define pcre2_substring_nametable_scan PCRE2_SUFFIX(pcre2_substring_nametable_scan_)
#define pcre2_substring_number_from_name PCRE2_SUFFIX(pcre2_substring_number_from_name_)
#define pcre2_version PCRE2_SUFFIX(pcre2_version_)
@ -593,7 +582,9 @@ prototypes. */
PCRE2_TYPES_LIST
PCRE2_STRUCTURE_LIST
PCRE2_GENERAL_INFO_FUNCTIONS
PCRE2_CONTEXT_FUNCTIONS
PCRE2_GENERAL_CONTEXT_FUNCTIONS
PCRE2_COMPILE_CONTEXT_FUNCTIONS
PCRE2_MATCH_CONTEXT_FUNCTIONS
PCRE2_COMPILE_FUNCTIONS
PCRE2_PATTERN_INFO_FUNCTIONS
PCRE2_MATCH_FUNCTIONS
@ -606,7 +597,9 @@ PCRE2_OTHER_FUNCTIONS
PCRE2_TYPES_LIST
PCRE2_STRUCTURE_LIST
PCRE2_GENERAL_INFO_FUNCTIONS
PCRE2_CONTEXT_FUNCTIONS
PCRE2_GENERAL_CONTEXT_FUNCTIONS
PCRE2_COMPILE_CONTEXT_FUNCTIONS
PCRE2_MATCH_CONTEXT_FUNCTIONS
PCRE2_COMPILE_FUNCTIONS
PCRE2_PATTERN_INFO_FUNCTIONS
PCRE2_MATCH_FUNCTIONS
@ -619,7 +612,9 @@ PCRE2_OTHER_FUNCTIONS
PCRE2_TYPES_LIST
PCRE2_STRUCTURE_LIST
PCRE2_GENERAL_INFO_FUNCTIONS
PCRE2_CONTEXT_FUNCTIONS
PCRE2_GENERAL_CONTEXT_FUNCTIONS
PCRE2_COMPILE_CONTEXT_FUNCTIONS
PCRE2_MATCH_CONTEXT_FUNCTIONS
PCRE2_COMPILE_FUNCTIONS
PCRE2_PATTERN_INFO_FUNCTIONS
PCRE2_MATCH_FUNCTIONS
@ -633,7 +628,9 @@ PCRE2_OTHER_FUNCTIONS
#undef PCRE2_TYPES_LIST
#undef PCRE2_STRUCTURE_LIST
#undef PCRE2_GENERAL_INFO_FUNCTIONS
#undef PCRE2_CONTEXT_FUNCTIONS
#undef PCRE2_GENERAL_CONTEXT_FUNCTIONS
#undef PCRE2_COMPILE_CONTEXT_FUNCTIONS
#undef PCRE2_MATCH_CONTEXT_FUNCTIONS
#undef PCRE2_COMPILE_FUNCTIONS
#undef PCRE2_PATTERN_INFO_FUNCTIONS
#undef PCRE2_MATCH_FUNCTIONS

View File

@ -53,9 +53,9 @@ POSSIBILITY OF SUCH DAMAGE.
*************************************************/
PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
pcre2_free_compiled_code(pcre2_context *context, pcre2_code *code)
pcre2_code_free(pcre2_code *code)
{
context=context;code=code;
code=code;
return;
}
@ -69,12 +69,12 @@ return;
a pointer to a block of store holding a compiled version of the expression.
Arguments:
context points to a PCRE2 context
pattern the regular expression
patlen the length of the pattern, or < 0 for zero-terminated
options option bits
errorcode pointer to error code variable (positive error code)
erroroffset pointer for offset in pattern where error was detected
ccontext points to a compile context or is NULL
Returns: pointer to compiled data block, or NULL on error,
with errorcode and erroroffset set
@ -83,14 +83,35 @@ Returns: pointer to compiled data block, or NULL on error,
/* FIXME: this is currently a placeholder function */
PCRE2_EXP_DEFN pcre2_code * PCRE2_CALL_CONVENTION
pcre2_compile(pcre2_context *context, PCRE2_SPTR pattern, int patlen,
uint32_t options, int *errorcode, size_t *erroroffset)
pcre2_compile(PCRE2_SPTR pattern, int patlen, uint32_t options, int *errorcode,
size_t *erroroffset, pcre2_compile_context *ccontext)
{
pcre2_code *c = NULL;
patlen = patlen; options = options;
/* Fudge while testing pcre2test. */
context = context; pattern = pattern; patlen = patlen; options = options;
*errorcode = 1;
*erroroffset = 0;
return NULL;
if (pattern[0] == 'Y')
{
c = ccontext->malloc(sizeof(pcre2_real_code), NULL);
c->magic_number = MAGIC_NUMBER;
c->size = sizeof(pcre2_real_code);
c->name_table_offset = sizeof(pcre2_real_code);
c->compile_options = options;
c->flags = PCRE2_CODE_UNIT_WIDTH/8;
c->name_count = 0;
c->name_entry_size = 0;
}
else
{
*errorcode = 1;
}
return c;
}
/* End of pcre2_compile.c */

View File

@ -45,7 +45,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "pcre2_internal.h"
#define CSIZE sizeof(struct pcre2_real_context)
/*************************************************
@ -56,171 +55,176 @@ POSSIBILITY OF SUCH DAMAGE.
static void *default_malloc(size_t size, void *data)
{
data = data;
(void)data;
return malloc(size);
}
static void default_free(void *block, void *data)
{
data = data;
(void)data;
free(block);
}
/*************************************************
* Create/initialize, copy, free a context *
* Create contexts *
*************************************************/
PCRE2_EXP_DEFN size_t PCRE2_CALL_CONVENTION
pcre2_context_size(void)
PCRE2_EXP_DEFN pcre2_general_context * PCRE2_CALL_CONVENTION
pcre2_general_context_create(void *(*private_malloc)(size_t, void *),
void (*private_free)(void *, void *), void *memory_data)
{
return CSIZE;
pcre2_general_context *gcontext;
if (private_malloc == NULL) private_malloc = default_malloc;
if (private_free == NULL) private_free = default_free;
gcontext = private_malloc(sizeof(pcre2_real_general_context), memory_data);
gcontext->malloc = private_malloc;
gcontext->free = private_free;
gcontext->memory_data = memory_data;
return gcontext;
}
PCRE2_EXP_DEFN pcre2_context * PCRE2_CALL_CONVENTION
pcre2_init_context(pcre2_context *context)
PCRE2_EXP_DEFN pcre2_compile_context * PCRE2_CALL_CONVENTION
pcre2_compile_context_create(pcre2_general_context *gcontext)
{
if (context == NULL)
pcre2_compile_context *ccontext;
void *(*compile_malloc)(size_t, void *);
void (*compile_free)(void *, void *);
void *memory_data;
if (gcontext == NULL)
{
context = malloc(CSIZE);
if (context == NULL) return NULL;
compile_malloc = default_malloc;
compile_free = default_free;
memory_data = NULL;
}
context->callout = NULL;
context->malloc = default_malloc;
context->free = default_free;
context->stack_malloc = default_malloc;
context->stack_free = default_free;
context->stack_guard = NULL;
context->user_data = NULL;
context->tables = PRIV(default_tables);
else
{
compile_malloc = gcontext->malloc;
compile_free = gcontext->free;
memory_data = gcontext->memory_data;
}
ccontext = compile_malloc(sizeof(pcre2_real_compile_context), memory_data);
if (ccontext == NULL) return NULL;
ccontext->malloc = compile_malloc;
ccontext->free = compile_free;
ccontext->memory_data = memory_data;
ccontext->stack_guard = NULL;
ccontext->tables = PRIV(default_tables);
#ifdef BSR_ANYCRLF
context->bsr_convention = PCRE2_BSR_ANYCRLF;
ccontext->bsr_convention = PCRE2_BSR_ANYCRLF;
#else
context->bsr_convention = PCRE2_BSR_UNICODE;
ccontext->bsr_convention = PCRE2_BSR_UNICODE;
#endif
context->newline_convention = NEWLINE;
context->options = 0;
context->match_limit = MATCH_LIMIT;
context->parens_nest_limit = PARENS_NEST_LIMIT;
context->recursion_limit = MATCH_LIMIT_RECURSION;
return context;
ccontext->newline_convention = NEWLINE;
ccontext->parens_nest_limit = PARENS_NEST_LIMIT;
return ccontext;
}
PCRE2_EXP_DEFN pcre2_context * PCRE2_CALL_CONVENTION
pcre2_copy_context(pcre2_context *context)
PCRE2_EXP_DEFN pcre2_match_context * PCRE2_CALL_CONVENTION
pcre2_match_context_create(pcre2_general_context *gcontext)
{
pcre2_context *new = context->malloc(CSIZE, context->user_data);
if (new == NULL) return NULL;
memcpy(new, context, CSIZE);
return new;
}
PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
pcre2_free_context(pcre2_context *context)
{
context->free(context, context->user_data);
pcre2_match_context *mcontext;
void *(*match_malloc)(size_t, void *);
void (*match_free)(void *, void *);
void *memory_data;
if (gcontext == NULL)
{
match_malloc = default_malloc;
match_free = default_free;
memory_data = NULL;
}
else
{
match_malloc = gcontext->malloc;
match_free = gcontext->free;
memory_data = gcontext->memory_data;
}
mcontext = match_malloc(sizeof(pcre2_real_match_context), memory_data);
if (mcontext == NULL) return NULL;
mcontext->malloc = match_malloc;
mcontext->free = match_free;
mcontext->memory_data = memory_data;
#ifdef NO_RECURSE
mcontext->stack_malloc = match_malloc;
mcontext->stack_free = match_free;
#endif
mcontext->callout = NULL;
mcontext->match_limit = MATCH_LIMIT;
mcontext->recursion_limit = MATCH_LIMIT_RECURSION;
return mcontext;
}
/*************************************************
* Extract settings from a context *
* Context copy functions *
*************************************************/
PCRE2_EXP_DEFN uint32_t PCRE2_CALL_CONVENTION
pcre2_get_bsr_convention(pcre2_context *context)
PCRE2_EXP_DEFN pcre2_general_context * PCRE2_CALL_CONVENTION
pcre2_general_context_copy(pcre2_general_context *gcontext)
{
return context->bsr_convention;
pcre2_general_context *new =
gcontext->malloc(sizeof(pcre2_real_general_context), gcontext->memory_data);
if (new == NULL) return NULL;
memcpy(new, gcontext, sizeof(pcre2_real_general_context));
return new;
}
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
(*pcre2_get_callout(pcre2_context *context))(pcre2_callout_block *, void *)
PCRE2_EXP_DEFN pcre2_compile_context * PCRE2_CALL_CONVENTION
pcre2_compile_context_copy(pcre2_compile_context *ccontext)
{
return context->callout;
}
PCRE2_EXP_DEFN const unsigned char * PCRE2_CALL_CONVENTION
pcre2_get_character_tables(pcre2_context *context)
{
return context->tables;
pcre2_compile_context *new =
ccontext->malloc(sizeof(pcre2_real_compile_context), ccontext->memory_data);
if (new == NULL) return NULL;
memcpy(new, ccontext, sizeof(pcre2_real_compile_context));
return new;
}
PCRE2_EXP_DEFN uint32_t PCRE2_CALL_CONVENTION
pcre2_get_context_options(pcre2_context *context)
PCRE2_EXP_DEFN pcre2_match_context * PCRE2_CALL_CONVENTION
pcre2_match_context_copy(pcre2_match_context *mcontext)
{
return context->options;
pcre2_match_context *new =
mcontext->malloc(sizeof(pcre2_real_match_context), mcontext->memory_data);
if (new == NULL) return NULL;
memcpy(new, mcontext, sizeof(pcre2_real_match_context));
return new;
}
PCRE2_EXP_DEFN uint32_t PCRE2_CALL_CONVENTION
pcre2_get_match_limit(pcre2_context *context)
/*************************************************
* Context free functions *
*************************************************/
PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
pcre2_general_context_free(pcre2_general_context *gcontext)
{
return context->match_limit;
}
PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
pcre2_get_memory_management(pcre2_context *context,
void *(**mptr)(size_t, void *),
void (**fptr)(void *, void *))
{
*mptr = context->malloc;
*fptr = context->free;
}
PCRE2_EXP_DEFN uint32_t PCRE2_CALL_CONVENTION
pcre2_get_newline_convention(pcre2_context *context)
{
return context->newline_convention;
}
PCRE2_EXP_DEFN uint32_t PCRE2_CALL_CONVENTION
pcre2_get_parens_nest_limit(pcre2_context *context)
{
return context->parens_nest_limit;
}
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
(*pcre2_get_recursion_guard(pcre2_context *context))(uint32_t, void *)
{
return context->stack_guard;
}
PCRE2_EXP_DEFN uint32_t PCRE2_CALL_CONVENTION
pcre2_get_recursion_limit(pcre2_context *context)
{
return context->recursion_limit;
gcontext->free(gcontext, gcontext->memory_data);
}
PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
pcre2_get_recursion_memory_management(pcre2_context *context,
void *(**mptr)(size_t, void *),
void (**fptr)(void *, void *))
pcre2_compile_context_free(pcre2_compile_context *ccontext)
{
*mptr = context->stack_malloc;
*fptr = context->stack_free;
ccontext->free(ccontext, ccontext->memory_data);
}
PCRE2_EXP_DEFN void * PCRE2_CALL_CONVENTION
pcre2_get_user_data(pcre2_context *context)
PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
pcre2_match_context_free(pcre2_match_context *mcontext)
{
return context->user_data;
mcontext->free(mcontext, mcontext->memory_data);
}
/*************************************************
* Set values in contexts *
*************************************************/
@ -228,15 +232,14 @@ return context->user_data;
/* All these functions return 1 for success or 0 if invalid data is given. Only
some of the functions are able to test the validity of the data. */
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_bsr_convention(pcre2_context *context, uint32_t value)
pcre2_set_bsr_convention(pcre2_compile_context *ccontext, uint32_t value)
{
switch(value)
{
case PCRE2_BSR_ANYCRLF:
case PCRE2_BSR_UNICODE:
context->bsr_convention = value;
ccontext->bsr_convention = value;
return 1;
default:
@ -245,54 +248,17 @@ switch(value)
}
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_character_tables(pcre2_compile_context *ccontext,
const unsigned char *tables)
{
ccontext->tables = tables;
return 1;
}
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_callout(pcre2_context *context,
int (*callout)(pcre2_callout_block *, void *))
{
context->callout = callout;
return 1;
}
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_character_tables(pcre2_context *context, const unsigned char *tables)
{
context->tables = tables;
return 1;
}
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_context_options(pcre2_context *context, uint32_t unset_bits,
uint32_t set_bits)
{
if ((set_bits & ~PCRE2_CONTEXT_OPTIONS) != 0) return 0;
context->options = (context->options & ~unset_bits) | set_bits;
return 1;
}
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_match_limit(pcre2_context *context, uint32_t limit)
{
context->match_limit = limit;
return 1;
}
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_memory_management(pcre2_context *context,
void * (*mymalloc)(size_t, void*),
void (*myfree)(void *, void *))
{
context->malloc = context->stack_malloc = mymalloc;
context->free = context->stack_free = myfree;
return 1;
}
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_newline_convention(pcre2_context *context, uint32_t newline)
pcre2_set_newline_convention(pcre2_compile_context *ccontext, uint32_t newline)
{
switch(newline)
{
@ -301,7 +267,7 @@ switch(newline)
case PCRE2_NEWLINE_CRLF:
case PCRE2_NEWLINE_ANY:
case PCRE2_NEWLINE_ANYCRLF:
context->newline_convention = newline;
ccontext->newline_convention = newline;
return 1;
default:
@ -311,47 +277,61 @@ switch(newline)
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_parens_nest_limit(pcre2_context *context, uint32_t limit)
pcre2_set_parens_nest_limit(pcre2_compile_context *ccontext, uint32_t limit)
{
context->parens_nest_limit = limit;
ccontext->parens_nest_limit = limit;
return 1;
}
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_recursion_guard(pcre2_context *context,
int (*guard)(uint32_t, void *))
pcre2_set_compile_recursion_guard(pcre2_compile_context *ccontext,
int (*guard)(uint32_t))
{
context->stack_guard = guard;
ccontext->stack_guard = guard;
return 1;
}
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_callout(pcre2_match_context *mcontext,
int (*callout)(pcre2_callout_block *, void *))
{
mcontext->callout = callout;
return 1;
}
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_recursion_limit(pcre2_context *context, uint32_t limit)
pcre2_set_match_limit(pcre2_match_context *mcontext, uint32_t limit)
{
context->recursion_limit = limit;
mcontext->match_limit = limit;
return 1;
}
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_recursion_limit(pcre2_match_context *mcontext, uint32_t limit)
{
mcontext->recursion_limit = limit;
return 1;
}
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_recursion_memory_management(pcre2_context *context,
pcre2_set_recursion_memory_management(pcre2_match_context *mcontext,
void *(*mymalloc)(size_t, void *),
void (*myfree)(void *, void *))
{
context->stack_malloc = mymalloc;
context->stack_free = myfree;
#ifdef NORECURSE
mcontext->stack_malloc = mymalloc;
mcontext->stack_free = myfree;
#else
(void)mcontext;
(void)mymalloc;
(void)myfree;
#endif
return 1;
}
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_user_data(pcre2_context *context, void *data)
{
context->user_data = data;
return 1;
}
/* End of pcre2_context.c */

View File

@ -54,13 +54,13 @@ POSSIBILITY OF SUCH DAMAGE.
alternate matching algorithm that finds all matches at once.
Arguments:
context points to a PCRE2 context
code points to the compiled pattern
subject subject string
length length of subject string
startoffset where to start matching in the subject
options option bits
match_data points to a match data structure
gcontext points to a match context
workspace pointer to workspace
wscount size of workspace
@ -73,16 +73,16 @@ Returns: > 0 => number of match offset pairs placed in offsets
/* FIXME: this is currently a placeholder function */
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_dfa_exec(pcre2_context *context, const pcre2_code *code,
PCRE2_SPTR subject, int length, size_t startoffset, uint32_t options,
pcre2_match_data *match_data, int *workspace, size_t wscount)
pcre2_dfa_match(const pcre2_code *code, PCRE2_SPTR subject, int length,
size_t startoffset, uint32_t options, pcre2_match_data *match_data,
pcre2_match_context *mcontext, int *workspace, size_t wscount)
{
context = context; code = code; subject = subject; length = length;
mcontext = mcontext; code = code; subject = subject; length = length;
startoffset = startoffset; options = options; match_data = match_data;
workspace = workspace; wscount = wscount;
return PCRE2_ERROR_NOMATCH;
}
/* End of pcre2_dfa_exec.c */
/* End of pcre2_dfa_match.c */

View File

@ -12,7 +12,10 @@ with some of the new PCRE2 context stuff added. */
#include "pcre2.h"
#define PUBL(name) pcre2_##name
#ifndef PRIV
#define PRIV(name) _pcre2_##name
#endif
#define PCRE2_CALL_CONVENTION
@ -21,30 +24,761 @@ extern const uint8_t PRIV(default_tables)[];
/* What follows is "real" code for PCRE2. */
typedef int BOOL;
#ifndef FALSE
#define FALSE 0
#define TRUE 1
#endif
/* Valgrind (memcheck) support */
#ifdef SUPPORT_VALGRIND
#include <valgrind/memcheck.h>
#endif
/* When UTF encoding is being used, a character is no longer just a single
byte in 8-bit mode or a single short in 16-bit mode. The macros for character
handling generate simple sequences when used in the basic mode, and more
complicated ones for UTF characters. GETCHARLENTEST and other macros are not
used when UTF is not supported. To make sure they can never even appear when
UTF support is omitted, we don't even define them. */
#ifndef SUPPORT_UTF
/* #define MAX_VALUE_FOR_SINGLE_CHAR */
/* #define HAS_EXTRALEN(c) */
/* #define GET_EXTRALEN(c) */
/* #define NOT_FIRSTCHAR(c) */
#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 GETCHARLENTEST(c, eptr, len) */
/* #define BACKCHAR(eptr) */
/* #define FORWARDCHAR(eptr) */
/* #define ACROSSCHAR(condition, eptr, action) */
#else /* SUPPORT_UTF */
/* Tests whether a UTF-8 code point needs extra bytes to decode. */
#define HASUTF8EXTRALEN(c) ((c) >= 0xc0)
/* Base macro to pick up the remaining bytes of a UTF-8 character, not
advancing the pointer. */
#define GETUTF8(c, eptr) \
{ \
if ((c & 0x20) == 0) \
c = ((c & 0x1f) << 6) | (eptr[1] & 0x3f); \
else if ((c & 0x10) == 0) \
c = ((c & 0x0f) << 12) | ((eptr[1] & 0x3f) << 6) | (eptr[2] & 0x3f); \
else if ((c & 0x08) == 0) \
c = ((c & 0x07) << 18) | ((eptr[1] & 0x3f) << 12) | \
((eptr[2] & 0x3f) << 6) | (eptr[3] & 0x3f); \
else if ((c & 0x04) == 0) \
c = ((c & 0x03) << 24) | ((eptr[1] & 0x3f) << 18) | \
((eptr[2] & 0x3f) << 12) | ((eptr[3] & 0x3f) << 6) | \
(eptr[4] & 0x3f); \
else \
c = ((c & 0x01) << 30) | ((eptr[1] & 0x3f) << 24) | \
((eptr[2] & 0x3f) << 18) | ((eptr[3] & 0x3f) << 12) | \
((eptr[4] & 0x3f) << 6) | (eptr[5] & 0x3f); \
}
/* Base macro to pick up the remaining bytes of a UTF-8 character, advancing
the pointer. */
#define GETUTF8INC(c, eptr) \
{ \
if ((c & 0x20) == 0) \
c = ((c & 0x1f) << 6) | (*eptr++ & 0x3f); \
else if ((c & 0x10) == 0) \
{ \
c = ((c & 0x0f) << 12) | ((*eptr & 0x3f) << 6) | (eptr[1] & 0x3f); \
eptr += 2; \
} \
else if ((c & 0x08) == 0) \
{ \
c = ((c & 0x07) << 18) | ((*eptr & 0x3f) << 12) | \
((eptr[1] & 0x3f) << 6) | (eptr[2] & 0x3f); \
eptr += 3; \
} \
else if ((c & 0x04) == 0) \
{ \
c = ((c & 0x03) << 24) | ((*eptr & 0x3f) << 18) | \
((eptr[1] & 0x3f) << 12) | ((eptr[2] & 0x3f) << 6) | \
(eptr[3] & 0x3f); \
eptr += 4; \
} \
else \
{ \
c = ((c & 0x01) << 30) | ((*eptr & 0x3f) << 24) | \
((eptr[1] & 0x3f) << 18) | ((eptr[2] & 0x3f) << 12) | \
((eptr[3] & 0x3f) << 6) | (eptr[4] & 0x3f); \
eptr += 5; \
} \
}
#endif /* SUPPORT_UTF */
/* Private flags containing information about the compiled pattern. The first
three must not be changed, because whichever is set is actually the number of
bytes in a code unit in that mode. */
#define PCRE2_MODE8 0x00000001 /* compiled in 8 bit mode */
#define PCRE2_MODE16 0x00000002 /* compiled in 16 bit mode */
#define PCRE2_MODE32 0x00000004 /* compiled in 32 bit mode */
#define PCRE2_FIRSTSET 0x00000010 /* first_char is set */
#define PCRE2_FCH_CASELESS 0x00000020 /* caseless first char */
#define PCRE2_REQCHSET 0x00000040 /* req_byte is set */
#define PCRE2_RCH_CASELESS 0x00000080 /* caseless requested char */
#define PCRE2_STARTLINE 0x00000100 /* start after \n for multiline */
#define PCRE2_JCHANGED 0x00000200 /* j option used in pattern */
#define PCRE2_HASCRORLF 0x00000400 /* explicit \r or \n in pattern */
#define PCRE2_HASTHEN 0x00000800 /* pattern contains (*THEN) */
#define PCRE2_MLSET 0x00001000 /* match limit set by pattern */
#define PCRE2_RLSET 0x00002000 /* recursion limit set by pattern */
#define PCRE2_MATCH_EMPTY 0x00004000 /* pattern can match empty string */
#define PCRE2_MODE_MASK (PCRE2_MODE8 | PCRE2_MODE16 | PCRE2_MODE32)
/* Magic number to provide a small check against being handed junk. */
#define MAGIC_NUMBER 0x50435245UL /* 'PCRE' */
/* This variable is used to detect a loaded regular expression
in different endianness. */
#define REVERSED_MAGIC_NUMBER 0x45524350UL /* 'ERCP' */
/* -------------------- Character and string names ------------------------ */
/* If PCRE is to support UTF-8 on EBCDIC platforms, we cannot use normal
character constants like '*' because the compiler would emit their EBCDIC code,
which is different from their ASCII/UTF-8 code. Instead we define macros for
the characters so that they always use the ASCII/UTF-8 code when UTF-8 support
is enabled. When UTF-8 support is not enabled, the definitions use character
literals. Both character and string versions of each character are needed, and
there are some longer strings as well.
This means that, on EBCDIC platforms, the PCRE library can handle either
EBCDIC, or UTF-8, but not both. To support both in the same compiled library
would need different lookups depending on whether PCRE_UTF8 was set or not.
This would make it impossible to use characters in switch/case statements,
which would reduce performance. For a theoretical use (which nobody has asked
for) in a minority area (EBCDIC platforms), this is not sensible. Any
application that did need both could compile two versions of the library, using
macros to give the functions distinct names. */
#ifndef SUPPORT_UTF
/* UTF-8 support is not enabled; use the platform-dependent character literals
so that PCRE works in both ASCII and EBCDIC environments, but only in non-UTF
mode. Newline characters are problematic in EBCDIC. Though it has CR and LF
characters, a common practice has been to use its NL (0x15) character as the
line terminator in C-like processing environments. However, sometimes the LF
(0x25) character is used instead, according to this Unicode document:
http://unicode.org/standard/reports/tr13/tr13-5.html
PCRE defaults EBCDIC NL to 0x15, but has a build-time option to select 0x25
instead. Whichever is *not* chosen is defined as NEL.
In both ASCII and EBCDIC environments, CHAR_NL and CHAR_LF are synonyms for the
same code point. */
#ifdef EBCDIC
#ifndef EBCDIC_NL25
#define CHAR_NL '\x15'
#define CHAR_NEL '\x25'
#define STR_NL "\x15"
#define STR_NEL "\x25"
#else
#define CHAR_NL '\x25'
#define CHAR_NEL '\x15'
#define STR_NL "\x25"
#define STR_NEL "\x15"
#endif
#define CHAR_LF CHAR_NL
#define STR_LF STR_NL
#define CHAR_ESC '\047'
#define CHAR_DEL '\007'
#define STR_ESC "\047"
#define STR_DEL "\007"
#else /* Not EBCDIC */
/* In ASCII/Unicode, linefeed is '\n' and we equate this to NL for
compatibility. NEL is the Unicode newline character; make sure it is
a positive value. */
#define CHAR_LF '\n'
#define CHAR_NL CHAR_LF
#define CHAR_NEL ((unsigned char)'\x85')
#define CHAR_ESC '\033'
#define CHAR_DEL '\177'
#define STR_LF "\n"
#define STR_NL STR_LF
#define STR_NEL "\x85"
#define STR_ESC "\033"
#define STR_DEL "\177"
#endif /* EBCDIC */
/* The remaining definitions work in both environments. */
#define CHAR_NULL '\0'
#define CHAR_HT '\t'
#define CHAR_VT '\v'
#define CHAR_FF '\f'
#define CHAR_CR '\r'
#define CHAR_BS '\b'
#define CHAR_BEL '\a'
#define CHAR_SPACE ' '
#define CHAR_EXCLAMATION_MARK '!'
#define CHAR_QUOTATION_MARK '"'
#define CHAR_NUMBER_SIGN '#'
#define CHAR_DOLLAR_SIGN '$'
#define CHAR_PERCENT_SIGN '%'
#define CHAR_AMPERSAND '&'
#define CHAR_APOSTROPHE '\''
#define CHAR_LEFT_PARENTHESIS '('
#define CHAR_RIGHT_PARENTHESIS ')'
#define CHAR_ASTERISK '*'
#define CHAR_PLUS '+'
#define CHAR_COMMA ','
#define CHAR_MINUS '-'
#define CHAR_DOT '.'
#define CHAR_SLASH '/'
#define CHAR_0 '0'
#define CHAR_1 '1'
#define CHAR_2 '2'
#define CHAR_3 '3'
#define CHAR_4 '4'
#define CHAR_5 '5'
#define CHAR_6 '6'
#define CHAR_7 '7'
#define CHAR_8 '8'
#define CHAR_9 '9'
#define CHAR_COLON ':'
#define CHAR_SEMICOLON ';'
#define CHAR_LESS_THAN_SIGN '<'
#define CHAR_EQUALS_SIGN '='
#define CHAR_GREATER_THAN_SIGN '>'
#define CHAR_QUESTION_MARK '?'
#define CHAR_COMMERCIAL_AT '@'
#define CHAR_A 'A'
#define CHAR_B 'B'
#define CHAR_C 'C'
#define CHAR_D 'D'
#define CHAR_E 'E'
#define CHAR_F 'F'
#define CHAR_G 'G'
#define CHAR_H 'H'
#define CHAR_I 'I'
#define CHAR_J 'J'
#define CHAR_K 'K'
#define CHAR_L 'L'
#define CHAR_M 'M'
#define CHAR_N 'N'
#define CHAR_O 'O'
#define CHAR_P 'P'
#define CHAR_Q 'Q'
#define CHAR_R 'R'
#define CHAR_S 'S'
#define CHAR_T 'T'
#define CHAR_U 'U'
#define CHAR_V 'V'
#define CHAR_W 'W'
#define CHAR_X 'X'
#define CHAR_Y 'Y'
#define CHAR_Z 'Z'
#define CHAR_LEFT_SQUARE_BRACKET '['
#define CHAR_BACKSLASH '\\'
#define CHAR_RIGHT_SQUARE_BRACKET ']'
#define CHAR_CIRCUMFLEX_ACCENT '^'
#define CHAR_UNDERSCORE '_'
#define CHAR_GRAVE_ACCENT '`'
#define CHAR_a 'a'
#define CHAR_b 'b'
#define CHAR_c 'c'
#define CHAR_d 'd'
#define CHAR_e 'e'
#define CHAR_f 'f'
#define CHAR_g 'g'
#define CHAR_h 'h'
#define CHAR_i 'i'
#define CHAR_j 'j'
#define CHAR_k 'k'
#define CHAR_l 'l'
#define CHAR_m 'm'
#define CHAR_n 'n'
#define CHAR_o 'o'
#define CHAR_p 'p'
#define CHAR_q 'q'
#define CHAR_r 'r'
#define CHAR_s 's'
#define CHAR_t 't'
#define CHAR_u 'u'
#define CHAR_v 'v'
#define CHAR_w 'w'
#define CHAR_x 'x'
#define CHAR_y 'y'
#define CHAR_z 'z'
#define CHAR_LEFT_CURLY_BRACKET '{'
#define CHAR_VERTICAL_LINE '|'
#define CHAR_RIGHT_CURLY_BRACKET '}'
#define CHAR_TILDE '~'
#define STR_HT "\t"
#define STR_VT "\v"
#define STR_FF "\f"
#define STR_CR "\r"
#define STR_BS "\b"
#define STR_BEL "\a"
#define STR_SPACE " "
#define STR_EXCLAMATION_MARK "!"
#define STR_QUOTATION_MARK "\""
#define STR_NUMBER_SIGN "#"
#define STR_DOLLAR_SIGN "$"
#define STR_PERCENT_SIGN "%"
#define STR_AMPERSAND "&"
#define STR_APOSTROPHE "'"
#define STR_LEFT_PARENTHESIS "("
#define STR_RIGHT_PARENTHESIS ")"
#define STR_ASTERISK "*"
#define STR_PLUS "+"
#define STR_COMMA ","
#define STR_MINUS "-"
#define STR_DOT "."
#define STR_SLASH "/"
#define STR_0 "0"
#define STR_1 "1"
#define STR_2 "2"
#define STR_3 "3"
#define STR_4 "4"
#define STR_5 "5"
#define STR_6 "6"
#define STR_7 "7"
#define STR_8 "8"
#define STR_9 "9"
#define STR_COLON ":"
#define STR_SEMICOLON ";"
#define STR_LESS_THAN_SIGN "<"
#define STR_EQUALS_SIGN "="
#define STR_GREATER_THAN_SIGN ">"
#define STR_QUESTION_MARK "?"
#define STR_COMMERCIAL_AT "@"
#define STR_A "A"
#define STR_B "B"
#define STR_C "C"
#define STR_D "D"
#define STR_E "E"
#define STR_F "F"
#define STR_G "G"
#define STR_H "H"
#define STR_I "I"
#define STR_J "J"
#define STR_K "K"
#define STR_L "L"
#define STR_M "M"
#define STR_N "N"
#define STR_O "O"
#define STR_P "P"
#define STR_Q "Q"
#define STR_R "R"
#define STR_S "S"
#define STR_T "T"
#define STR_U "U"
#define STR_V "V"
#define STR_W "W"
#define STR_X "X"
#define STR_Y "Y"
#define STR_Z "Z"
#define STR_LEFT_SQUARE_BRACKET "["
#define STR_BACKSLASH "\\"
#define STR_RIGHT_SQUARE_BRACKET "]"
#define STR_CIRCUMFLEX_ACCENT "^"
#define STR_UNDERSCORE "_"
#define STR_GRAVE_ACCENT "`"
#define STR_a "a"
#define STR_b "b"
#define STR_c "c"
#define STR_d "d"
#define STR_e "e"
#define STR_f "f"
#define STR_g "g"
#define STR_h "h"
#define STR_i "i"
#define STR_j "j"
#define STR_k "k"
#define STR_l "l"
#define STR_m "m"
#define STR_n "n"
#define STR_o "o"
#define STR_p "p"
#define STR_q "q"
#define STR_r "r"
#define STR_s "s"
#define STR_t "t"
#define STR_u "u"
#define STR_v "v"
#define STR_w "w"
#define STR_x "x"
#define STR_y "y"
#define STR_z "z"
#define STR_LEFT_CURLY_BRACKET "{"
#define STR_VERTICAL_LINE "|"
#define STR_RIGHT_CURLY_BRACKET "}"
#define STR_TILDE "~"
#define STRING_ACCEPT0 "ACCEPT\0"
#define STRING_COMMIT0 "COMMIT\0"
#define STRING_F0 "F\0"
#define STRING_FAIL0 "FAIL\0"
#define STRING_MARK0 "MARK\0"
#define STRING_PRUNE0 "PRUNE\0"
#define STRING_SKIP0 "SKIP\0"
#define STRING_THEN "THEN"
#define STRING_alpha0 "alpha\0"
#define STRING_lower0 "lower\0"
#define STRING_upper0 "upper\0"
#define STRING_alnum0 "alnum\0"
#define STRING_ascii0 "ascii\0"
#define STRING_blank0 "blank\0"
#define STRING_cntrl0 "cntrl\0"
#define STRING_digit0 "digit\0"
#define STRING_graph0 "graph\0"
#define STRING_print0 "print\0"
#define STRING_punct0 "punct\0"
#define STRING_space0 "space\0"
#define STRING_word0 "word\0"
#define STRING_xdigit "xdigit"
#define STRING_DEFINE "DEFINE"
#define STRING_WEIRD_STARTWORD "[:<:]]"
#define STRING_WEIRD_ENDWORD "[:>:]]"
#define STRING_CR_RIGHTPAR "CR)"
#define STRING_LF_RIGHTPAR "LF)"
#define STRING_CRLF_RIGHTPAR "CRLF)"
#define STRING_ANY_RIGHTPAR "ANY)"
#define STRING_ANYCRLF_RIGHTPAR "ANYCRLF)"
#define STRING_BSR_ANYCRLF_RIGHTPAR "BSR_ANYCRLF)"
#define STRING_BSR_UNICODE_RIGHTPAR "BSR_UNICODE)"
#define STRING_UTF8_RIGHTPAR "UTF8)"
#define STRING_UTF16_RIGHTPAR "UTF16)"
#define STRING_UTF32_RIGHTPAR "UTF32)"
#define STRING_UTF_RIGHTPAR "UTF)"
#define STRING_UCP_RIGHTPAR "UCP)"
#define STRING_NO_AUTO_POSSESS_RIGHTPAR "NO_AUTO_POSSESS)"
#define STRING_NO_START_OPT_RIGHTPAR "NO_START_OPT)"
#define STRING_LIMIT_MATCH_EQ "LIMIT_MATCH="
#define STRING_LIMIT_RECURSION_EQ "LIMIT_RECURSION="
#else /* SUPPORT_UTF */
/* UTF-8 support is enabled; always use UTF-8 (=ASCII) character codes. This
works in both modes non-EBCDIC platforms, and on EBCDIC platforms in UTF-8 mode
only. */
#define CHAR_HT '\011'
#define CHAR_VT '\013'
#define CHAR_FF '\014'
#define CHAR_CR '\015'
#define CHAR_LF '\012'
#define CHAR_NL CHAR_LF
#define CHAR_NEL ((unsigned char)'\x85')
#define CHAR_BS '\010'
#define CHAR_BEL '\007'
#define CHAR_ESC '\033'
#define CHAR_DEL '\177'
#define CHAR_NULL '\0'
#define CHAR_SPACE '\040'
#define CHAR_EXCLAMATION_MARK '\041'
#define CHAR_QUOTATION_MARK '\042'
#define CHAR_NUMBER_SIGN '\043'
#define CHAR_DOLLAR_SIGN '\044'
#define CHAR_PERCENT_SIGN '\045'
#define CHAR_AMPERSAND '\046'
#define CHAR_APOSTROPHE '\047'
#define CHAR_LEFT_PARENTHESIS '\050'
#define CHAR_RIGHT_PARENTHESIS '\051'
#define CHAR_ASTERISK '\052'
#define CHAR_PLUS '\053'
#define CHAR_COMMA '\054'
#define CHAR_MINUS '\055'
#define CHAR_DOT '\056'
#define CHAR_SLASH '\057'
#define CHAR_0 '\060'
#define CHAR_1 '\061'
#define CHAR_2 '\062'
#define CHAR_3 '\063'
#define CHAR_4 '\064'
#define CHAR_5 '\065'
#define CHAR_6 '\066'
#define CHAR_7 '\067'
#define CHAR_8 '\070'
#define CHAR_9 '\071'
#define CHAR_COLON '\072'
#define CHAR_SEMICOLON '\073'
#define CHAR_LESS_THAN_SIGN '\074'
#define CHAR_EQUALS_SIGN '\075'
#define CHAR_GREATER_THAN_SIGN '\076'
#define CHAR_QUESTION_MARK '\077'
#define CHAR_COMMERCIAL_AT '\100'
#define CHAR_A '\101'
#define CHAR_B '\102'
#define CHAR_C '\103'
#define CHAR_D '\104'
#define CHAR_E '\105'
#define CHAR_F '\106'
#define CHAR_G '\107'
#define CHAR_H '\110'
#define CHAR_I '\111'
#define CHAR_J '\112'
#define CHAR_K '\113'
#define CHAR_L '\114'
#define CHAR_M '\115'
#define CHAR_N '\116'
#define CHAR_O '\117'
#define CHAR_P '\120'
#define CHAR_Q '\121'
#define CHAR_R '\122'
#define CHAR_S '\123'
#define CHAR_T '\124'
#define CHAR_U '\125'
#define CHAR_V '\126'
#define CHAR_W '\127'
#define CHAR_X '\130'
#define CHAR_Y '\131'
#define CHAR_Z '\132'
#define CHAR_LEFT_SQUARE_BRACKET '\133'
#define CHAR_BACKSLASH '\134'
#define CHAR_RIGHT_SQUARE_BRACKET '\135'
#define CHAR_CIRCUMFLEX_ACCENT '\136'
#define CHAR_UNDERSCORE '\137'
#define CHAR_GRAVE_ACCENT '\140'
#define CHAR_a '\141'
#define CHAR_b '\142'
#define CHAR_c '\143'
#define CHAR_d '\144'
#define CHAR_e '\145'
#define CHAR_f '\146'
#define CHAR_g '\147'
#define CHAR_h '\150'
#define CHAR_i '\151'
#define CHAR_j '\152'
#define CHAR_k '\153'
#define CHAR_l '\154'
#define CHAR_m '\155'
#define CHAR_n '\156'
#define CHAR_o '\157'
#define CHAR_p '\160'
#define CHAR_q '\161'
#define CHAR_r '\162'
#define CHAR_s '\163'
#define CHAR_t '\164'
#define CHAR_u '\165'
#define CHAR_v '\166'
#define CHAR_w '\167'
#define CHAR_x '\170'
#define CHAR_y '\171'
#define CHAR_z '\172'
#define CHAR_LEFT_CURLY_BRACKET '\173'
#define CHAR_VERTICAL_LINE '\174'
#define CHAR_RIGHT_CURLY_BRACKET '\175'
#define CHAR_TILDE '\176'
#define STR_HT "\011"
#define STR_VT "\013"
#define STR_FF "\014"
#define STR_CR "\015"
#define STR_NL "\012"
#define STR_BS "\010"
#define STR_BEL "\007"
#define STR_ESC "\033"
#define STR_DEL "\177"
#define STR_SPACE "\040"
#define STR_EXCLAMATION_MARK "\041"
#define STR_QUOTATION_MARK "\042"
#define STR_NUMBER_SIGN "\043"
#define STR_DOLLAR_SIGN "\044"
#define STR_PERCENT_SIGN "\045"
#define STR_AMPERSAND "\046"
#define STR_APOSTROPHE "\047"
#define STR_LEFT_PARENTHESIS "\050"
#define STR_RIGHT_PARENTHESIS "\051"
#define STR_ASTERISK "\052"
#define STR_PLUS "\053"
#define STR_COMMA "\054"
#define STR_MINUS "\055"
#define STR_DOT "\056"
#define STR_SLASH "\057"
#define STR_0 "\060"
#define STR_1 "\061"
#define STR_2 "\062"
#define STR_3 "\063"
#define STR_4 "\064"
#define STR_5 "\065"
#define STR_6 "\066"
#define STR_7 "\067"
#define STR_8 "\070"
#define STR_9 "\071"
#define STR_COLON "\072"
#define STR_SEMICOLON "\073"
#define STR_LESS_THAN_SIGN "\074"
#define STR_EQUALS_SIGN "\075"
#define STR_GREATER_THAN_SIGN "\076"
#define STR_QUESTION_MARK "\077"
#define STR_COMMERCIAL_AT "\100"
#define STR_A "\101"
#define STR_B "\102"
#define STR_C "\103"
#define STR_D "\104"
#define STR_E "\105"
#define STR_F "\106"
#define STR_G "\107"
#define STR_H "\110"
#define STR_I "\111"
#define STR_J "\112"
#define STR_K "\113"
#define STR_L "\114"
#define STR_M "\115"
#define STR_N "\116"
#define STR_O "\117"
#define STR_P "\120"
#define STR_Q "\121"
#define STR_R "\122"
#define STR_S "\123"
#define STR_T "\124"
#define STR_U "\125"
#define STR_V "\126"
#define STR_W "\127"
#define STR_X "\130"
#define STR_Y "\131"
#define STR_Z "\132"
#define STR_LEFT_SQUARE_BRACKET "\133"
#define STR_BACKSLASH "\134"
#define STR_RIGHT_SQUARE_BRACKET "\135"
#define STR_CIRCUMFLEX_ACCENT "\136"
#define STR_UNDERSCORE "\137"
#define STR_GRAVE_ACCENT "\140"
#define STR_a "\141"
#define STR_b "\142"
#define STR_c "\143"
#define STR_d "\144"
#define STR_e "\145"
#define STR_f "\146"
#define STR_g "\147"
#define STR_h "\150"
#define STR_i "\151"
#define STR_j "\152"
#define STR_k "\153"
#define STR_l "\154"
#define STR_m "\155"
#define STR_n "\156"
#define STR_o "\157"
#define STR_p "\160"
#define STR_q "\161"
#define STR_r "\162"
#define STR_s "\163"
#define STR_t "\164"
#define STR_u "\165"
#define STR_v "\166"
#define STR_w "\167"
#define STR_x "\170"
#define STR_y "\171"
#define STR_z "\172"
#define STR_LEFT_CURLY_BRACKET "\173"
#define STR_VERTICAL_LINE "\174"
#define STR_RIGHT_CURLY_BRACKET "\175"
#define STR_TILDE "\176"
#define STRING_ACCEPT0 STR_A STR_C STR_C STR_E STR_P STR_T "\0"
#define STRING_COMMIT0 STR_C STR_O STR_M STR_M STR_I STR_T "\0"
#define STRING_F0 STR_F "\0"
#define STRING_FAIL0 STR_F STR_A STR_I STR_L "\0"
#define STRING_MARK0 STR_M STR_A STR_R STR_K "\0"
#define STRING_PRUNE0 STR_P STR_R STR_U STR_N STR_E "\0"
#define STRING_SKIP0 STR_S STR_K STR_I STR_P "\0"
#define STRING_THEN STR_T STR_H STR_E STR_N
#define STRING_alpha0 STR_a STR_l STR_p STR_h STR_a "\0"
#define STRING_lower0 STR_l STR_o STR_w STR_e STR_r "\0"
#define STRING_upper0 STR_u STR_p STR_p STR_e STR_r "\0"
#define STRING_alnum0 STR_a STR_l STR_n STR_u STR_m "\0"
#define STRING_ascii0 STR_a STR_s STR_c STR_i STR_i "\0"
#define STRING_blank0 STR_b STR_l STR_a STR_n STR_k "\0"
#define STRING_cntrl0 STR_c STR_n STR_t STR_r STR_l "\0"
#define STRING_digit0 STR_d STR_i STR_g STR_i STR_t "\0"
#define STRING_graph0 STR_g STR_r STR_a STR_p STR_h "\0"
#define STRING_print0 STR_p STR_r STR_i STR_n STR_t "\0"
#define STRING_punct0 STR_p STR_u STR_n STR_c STR_t "\0"
#define STRING_space0 STR_s STR_p STR_a STR_c STR_e "\0"
#define STRING_word0 STR_w STR_o STR_r STR_d "\0"
#define STRING_xdigit STR_x STR_d STR_i STR_g STR_i STR_t
#define STRING_DEFINE STR_D STR_E STR_F STR_I STR_N STR_E
#define STRING_WEIRD_STARTWORD STR_LEFT_SQUARE_BRACKET STR_COLON STR_LESS_THAN_SIGN STR_COLON STR_RIGHT_SQUARE_BRACKET STR_RIGHT_SQUARE_BRACKET
#define STRING_WEIRD_ENDWORD STR_LEFT_SQUARE_BRACKET STR_COLON STR_GREATER_THAN_SIGN STR_COLON STR_RIGHT_SQUARE_BRACKET STR_RIGHT_SQUARE_BRACKET
#define STRING_CR_RIGHTPAR STR_C STR_R STR_RIGHT_PARENTHESIS
#define STRING_LF_RIGHTPAR STR_L STR_F STR_RIGHT_PARENTHESIS
#define STRING_CRLF_RIGHTPAR STR_C STR_R STR_L STR_F STR_RIGHT_PARENTHESIS
#define STRING_ANY_RIGHTPAR STR_A STR_N STR_Y STR_RIGHT_PARENTHESIS
#define STRING_ANYCRLF_RIGHTPAR STR_A STR_N STR_Y STR_C STR_R STR_L STR_F STR_RIGHT_PARENTHESIS
#define STRING_BSR_ANYCRLF_RIGHTPAR STR_B STR_S STR_R STR_UNDERSCORE STR_A STR_N STR_Y STR_C STR_R STR_L STR_F STR_RIGHT_PARENTHESIS
#define STRING_BSR_UNICODE_RIGHTPAR STR_B STR_S STR_R STR_UNDERSCORE STR_U STR_N STR_I STR_C STR_O STR_D STR_E STR_RIGHT_PARENTHESIS
#define STRING_UTF8_RIGHTPAR STR_U STR_T STR_F STR_8 STR_RIGHT_PARENTHESIS
#define STRING_UTF16_RIGHTPAR STR_U STR_T STR_F STR_1 STR_6 STR_RIGHT_PARENTHESIS
#define STRING_UTF32_RIGHTPAR STR_U STR_T STR_F STR_3 STR_2 STR_RIGHT_PARENTHESIS
#define STRING_UTF_RIGHTPAR STR_U STR_T STR_F STR_RIGHT_PARENTHESIS
#define STRING_UCP_RIGHTPAR STR_U STR_C STR_P STR_RIGHT_PARENTHESIS
#define STRING_NO_AUTO_POSSESS_RIGHTPAR STR_N STR_O STR_UNDERSCORE STR_A STR_U STR_T STR_O STR_UNDERSCORE STR_P STR_O STR_S STR_S STR_E STR_S STR_S STR_RIGHT_PARENTHESIS
#define STRING_NO_START_OPT_RIGHTPAR STR_N STR_O STR_UNDERSCORE STR_S STR_T STR_A STR_R STR_T STR_UNDERSCORE STR_O STR_P STR_T STR_RIGHT_PARENTHESIS
#define STRING_LIMIT_MATCH_EQ STR_L STR_I STR_M STR_I STR_T STR_UNDERSCORE STR_M STR_A STR_T STR_C STR_H STR_EQUALS_SIGN
#define STRING_LIMIT_RECURSION_EQ STR_L STR_I STR_M STR_I STR_T STR_UNDERSCORE STR_R STR_E STR_C STR_U STR_R STR_S STR_I STR_O STR_N STR_EQUALS_SIGN
#endif /* SUPPORT_UTF */
/* -------------------- End of character and string names -------------------*/
/* Only these bits are allowed when setting context options. */
#define PCRE2_CONTEXT_OPTIONS (\
PCRE2_ALT_BSUX|PCRE2_DOLLAR_ENDONLY|PCRE2_DUPNAMES|PCRE2_ALLOW_EMPTY_CLASS|\
PCRE2_MATCH_UNSET_BACKREF|PCRE2_NEVER_UTF|PCRE2_NEVER_UCP|PCRE2_UTF|\
PCRE2_UCP)
/* The real context structure */
struct pcre2_real_context {
const unsigned char *tables;
int (*callout)(pcre2_callout_block *, void *);
void * (*malloc)(size_t, void *);
void (*free)(void *, void *);
void * (*stack_malloc)(size_t, void *);
void (*stack_free)(void *, void *);
int (*stack_guard)(uint32_t, void *);
void *user_data;
uint16_t bsr_convention;
uint16_t newline_convention;
uint32_t options;
uint32_t match_limit;
uint32_t parens_nest_limit;
uint32_t recursion_limit;
};
/* The private structures used by PCRE are defined in a separate file. When
compiling the library, PCRE2_CODE_UNIT_WIDTH will be defined, so we include
them at the appropriate width. When compiling pcretest, however, that macro is
not set at this point because pcretest needs to include them at all supported
widths. */
#ifdef PCRE2_CODE_UNIT_WIDTH
#include "pcre2_intstructs.h"
#endif
/* End of pcre2_internal.h */

102
src/pcre2_intstructs.h Normal file
View File

@ -0,0 +1,102 @@
/*************************************************
* Perl-Compatible Regular Expressions *
*************************************************/
/* PCRE is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
New API code Copyright (c) 2014 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the University of Cambridge nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
*/
/* This module contains the private structures needed by pcre2_internal.h. They
are kept separate so that they can be #included multiple times for different
code unit widths by pcre2test. */
/* The real general context structure */
typedef struct pcre2_real_general_context {
void * (*malloc)(size_t, void *);
void (*free)(void *, void *);
void *memory_data;
} pcre2_real_general_context;
/* The real compile context structure */
typedef struct pcre2_real_compile_context {
void * (*malloc)(size_t, void *);
void (*free)(void *, void *);
void * memory_data;
int (*stack_guard)(uint32_t);
const unsigned char *tables;
uint16_t bsr_convention;
uint16_t newline_convention;
uint32_t parens_nest_limit;
} pcre2_real_compile_context;
/* The real match context structure. */
typedef struct pcre2_real_match_context {
void * (*malloc)(size_t, void *);
void (*free)(void *, void *);
void * memory_data;
#ifdef NO_RECURSE
void * (*stack_malloc)(size_t, void *);
void (*stack_free)(void *, void *);
#endif
int (*callout)(pcre2_callout_block *, void *);
uint32_t match_limit;
uint32_t recursion_limit;
} pcre2_real_match_context;
/* The real compiled code structure */
typedef struct pcre2_real_code {
uint32_t magic_number;
uint32_t size; /* Total that was malloc-ed */
uint32_t compile_options; /* Options passed to pcre2_compile() */
uint32_t pattern_options; /* Options taken from the pattern */
uint32_t flags; /* Various state flags */
uint32_t limit_match; /* Limit set in the pattern */
uint32_t limit_recursion; /* Limit set in the pattern */
uint32_t first_char; /* Starting character */
uint32_t req_char; /* This character must be seen */
uint16_t max_lookbehind; /* Longest lookbehind (characters) */
uint16_t top_bracket; /* Highest numbered group */
uint16_t top_backref; /* Highest numbered back reference */
uint16_t name_table_offset; /* Offset to name table that follows */
uint16_t name_entry_size; /* Size of name items in the table */
uint16_t name_count; /* Number of name entries in the table */
} pcre2_real_code;
/* End of pcre2_intstructs.h */

View File

@ -54,7 +54,6 @@ POSSIBILITY OF SUCH DAMAGE.
code.
Arguments:
context points to a PCRE2 context
code a compiled pattern
options JIT option bits
@ -64,17 +63,15 @@ Returns: nothing
/* FIXME: this is currently a placeholder function */
PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
pcre2_jit_compile(pcre2_context *context, pcre2_code *code, uint32_t options)
pcre2_jit_compile(pcre2_code *code, uint32_t options)
{
#ifndef SUPPORT_JIT
(void)context;
(void)code;
(void)options;
#else /* SUPPORT_JIT */
context = context; code=code; options = options; /* Dummy.... */
code=code; options = options; /* Dummy.... */
#endif /* SUPPORT_JIT */
}

View File

@ -53,7 +53,6 @@ POSSIBILITY OF SUCH DAMAGE.
/* This function runs a JIT pattern match.
Arguments:
context points a PCRE2 context
code points to the compiled expression
subject points to the subject string
length length of subject string (may contain binary zeros)
@ -71,12 +70,11 @@ Returns: > 0 => success; value is the number of ovector pairs filled
/* FIXME: this is currently a placeholder function */
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_jit_exec(pcre2_context *context, const pcre2_code *code,
PCRE2_SPTR subject, int length, size_t start_offset, uint32_t options,
pcre2_match_data *match_data, pcre2_jit_stack *jit_stack)
pcre2_jit_match(const pcre2_code *code, PCRE2_SPTR subject, int length,
size_t start_offset, uint32_t options, pcre2_match_data *match_data,
pcre2_jit_stack *jit_stack)
{
#ifndef SUPPORT_JIT
(void)context;
(void)code;
(void)subject;
(void)length;
@ -89,7 +87,7 @@ return PCRE2_ERROR_NOMATCH;
/* Dummy code */
context=context;code=code;subject=subject;length=length;
code=code;subject=subject;length=length;
start_offset=start_offset; options=options; match_data=match_data;
jit_stack=jit_stack;
return PCRE2_ERROR_NOMATCH;
@ -97,4 +95,4 @@ return PCRE2_ERROR_NOMATCH;
#endif /* SUPPORT_JIT */
}
/* End of pcre2_jit_exec.c */
/* End of pcre2_jit_match.c */

View File

@ -55,13 +55,13 @@ POSSIBILITY OF SUCH DAMAGE.
PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
pcre2_jit_free_unused_memory(pcre2_context *context)
pcre2_jit_free_unused_memory(pcre2_general_context *gcontext)
{
#ifndef SUPPORT_JIT
(void)context; /* Suppress warning */
(void)gcontext; /* Suppress warning */
#else /* SUPPORT_JIT */
context=context; /* Dummy */
gcontext=gcontext; /* Dummy */
#endif /* SUPPORT_JIT */
}
@ -72,16 +72,17 @@ context=context; /* Dummy */
*************************************************/
PCRE2_EXP_DEFN pcre2_jit_stack * PCRE2_CALL_CONVENTION
pcre2_jit_stack_alloc(pcre2_context *context, size_t startsize, size_t maxsize)
pcre2_jit_stack_alloc(pcre2_general_context *gcontext, size_t startsize,
size_t maxsize)
{
#ifndef SUPPORT_JIT
(void)context;
(void)gcontext;
(void)startsize;
(void)maxsize;
return NULL;
#else /* SUPPORT_JIT */
context=context;startsize=startsize;maxsize=maxsize;
gcontext=gcontext;startsize=startsize;maxsize=maxsize;
return NULL;
#endif
}
@ -92,18 +93,16 @@ return NULL;
*************************************************/
PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
pcre2_jit_stack_assign(pcre2_context *context, const pcre2_code *code,
pcre2_jit_callback callback, void *callback_data)
pcre2_jit_stack_assign(const pcre2_code *code, pcre2_jit_callback callback,
void *callback_data)
{
#ifndef SUPPORT_JIT
(void)context;
(void)code;
(void)callback;
(void)callback_data;
#else /* SUPPORT_JIT */
context=context;code=code;callback=callback;callback_data=callback_data;
code=code;callback=callback;callback_data=callback_data;
#endif /* SUPPORT_JIT */
}
@ -113,15 +112,13 @@ context=context;code=code;callback=callback;callback_data=callback_data;
*************************************************/
PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
pcre2_jit_stack_free(pcre2_context *context, pcre2_jit_stack *jit_stack)
pcre2_jit_stack_free(pcre2_jit_stack *jit_stack)
{
#ifndef SUPPORT_JIT
(void)context;
(void)jit_stack;
#else /* SUPPORT_JIT */
context=context;jit_stack=jit_stack;
jit_stack=jit_stack;
#endif /* SUPPORT_JIT */
}

View File

@ -70,9 +70,9 @@ Returns: pointer to the contiguous block of data
/* FIXME: temporarily a dummy, until pcre2_internal is complete. */
PCRE2_EXP_DEFN const unsigned char * PCRE2_CALL_CONVENTION
pcre2_maketables(pcre2_context *context)
pcre2_maketables(pcre2_general_context *gcontext)
{
context=context;
gcontext=gcontext;
return NULL;
#ifdef NEVER

View File

@ -47,7 +47,7 @@ POSSIBILITY OF SUCH DAMAGE.
/*************************************************
* Execute a Regular Expression *
* Match a Regular Expression *
*************************************************/
/* This function applies a compiled re to a subject string and picks out
@ -72,13 +72,13 @@ Returns: > 0 => success; value is the number of ovector pairs filled
/* FIXME: this is currently a placeholder function */
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_exec(pcre2_context *context, const pcre2_code *code,
PCRE2_SPTR subject, int length, size_t start_offset, uint32_t options,
pcre2_match_data *match_data)
pcre2_match( const pcre2_code *code, PCRE2_SPTR subject, int length,
size_t start_offset, uint32_t options, pcre2_match_data *match_data,
pcre2_match_context *mcontext)
{
context=context;code=code;subject=subject;length=length;
mcontext=mcontext;code=code;subject=subject;length=length;
start_offset=start_offset; options=options; match_data=match_data;
return PCRE2_ERROR_NOMATCH;
}
/* End of pcre2_exec.c */
/* End of pcre2_match.c */

View File

@ -49,14 +49,27 @@ POSSIBILITY OF SUCH DAMAGE.
/* FIXME: these are all dummy functions */
/*************************************************
* Create a match data block *
* Create a match data block given ovector size *
*************************************************/
PCRE2_EXP_DEFN pcre2_match_data * PCRE2_CALL_CONVENTION
pcre2_match_data_create(size_t ovecsize, pcre2_general_context *gcontext)
{
gcontext=gcontext;ovecsize=ovecsize;
return NULL;
}
/*************************************************
* Create a match data block using pattern data *
*************************************************/
PCRE2_EXP_DEFN pcre2_match_data * PCRE2_CALL_CONVENTION
pcre2_create_match_data(pcre2_context *context, size_t ovecsize)
pcre2_match_data_create_from_pattern(pcre2_code *code,
pcre2_general_context *gcontext)
{
context=context;ovecsize=ovecsize;
code=code;gcontext=gcontext;
return NULL;
}
@ -67,9 +80,9 @@ return NULL;
*************************************************/
PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
pcre2_free_match_data(pcre2_context *context, pcre2_match_data *match_data)
pcre2_match_data_free(pcre2_match_data *match_data)
{
context=context;match_data=match_data;
match_data=match_data;
return;
}
@ -106,7 +119,7 @@ return NULL;
*************************************************/
PCRE2_EXP_DEFN size_t * PCRE2_CALL_CONVENTION
pcre2_get_ovector(pcre2_match_data *match_data)
pcre2_get_ovector_pointer(pcre2_match_data *match_data)
{
match_data=match_data;
return NULL;
@ -119,7 +132,7 @@ return NULL;
*************************************************/
PCRE2_EXP_DEFN size_t PCRE2_CALL_CONVENTION
pcre2_get_ovector_slots(pcre2_match_data *match_data)
pcre2_get_ovector_count(pcre2_match_data *match_data)
{
match_data=match_data;
return 0;

View File

@ -59,13 +59,58 @@ Arguments:
Returns: 0 if data returned, negative on error
*/
/* FIXME: this is currently a placeholder function */
/* FIXME: this is currently incomplete */
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_pattern_info(const pcre2_code *code, uint32_t what, void *where)
{
code=code;what=what;where=where;
return -1;
const pcre2_real_code *re = (pcre2_real_code *)code;
if (re == NULL || where == NULL) return PCRE2_ERROR_NULL;
/* Check that the first field in the block is the magic number. If it is not,
return with PCRE2_ERROR_BADMAGIC. However, if the magic number is equal to
REVERSED_MAGIC_NUMBER we return with PCRE2_ERROR_BADENDIANNESS, which
means that the pattern is likely compiled with different endianness. */
if (re->magic_number != MAGIC_NUMBER)
return re->magic_number == REVERSED_MAGIC_NUMBER?
PCRE2_ERROR_BADENDIANNESS:PCRE2_ERROR_BADMAGIC;
/* Check that this pattern was compiled in the correct bit mode */
if ((re->flags & (PCRE2_CODE_UNIT_WIDTH/8)) == 0)
return PCRE2_ERROR_BADMODE;
switch(what)
{
case PCRE2_INFO_NAMEENTRYSIZE:
*((int *)where) = re->name_entry_size;
break;
case PCRE2_INFO_NAMECOUNT:
*((int *)where) = re->name_count;
break;
case PCRE2_INFO_SIZE:
*((size_t *)where) = re->size;
break;
case PCRE2_INFO_JITSIZE:
#ifdef SUPPORT_JIT
*((size_t *)where) =
(re->flags & PCRE2_EXTRA_EXECUTABLE_JIT) != 0 &&
re->executable_jit != NULL)?
PRIV(jit_get_size)(re->executable_jit) : 0;
#else
*((size_t *)where) = 0;
#endif
break;
default: return PCRE2_ERROR_BADOPTION;
}
return 0;
}
/* End of pcre2_pattern_info.c */

View File

@ -72,7 +72,7 @@ Returns: if successful:
*/
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_copy_named_substring(pcre2_match_data *match_data, PCRE2_SPTR stringname,
pcre2_substring_copy_byname(pcre2_match_data *match_data, PCRE2_SPTR stringname,
PCRE2_UCHAR *buffer, size_t size)
{
match_data=match_data;stringname=stringname;buffer=buffer;size=size;
@ -103,7 +103,7 @@ Returns: if successful:
*/
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_copy_substring(pcre2_match_data *match_data, int stringnumber,
pcre2_substring_copy_bynumber(pcre2_match_data *match_data, int stringnumber,
PCRE2_UCHAR *buffer, size_t size)
{
match_data=match_data;stringnumber=stringnumber;buffer=buffer;size=size;
@ -127,9 +127,9 @@ Returns: nothing
*/
PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
pcre2_free_substring(pcre2_context *context, PCRE2_UCHAR *string)
pcre2_substring_free(PCRE2_UCHAR *string)
{
context->free(string, context->user_data);
string=string;
return;
}
@ -151,9 +151,9 @@ Returns: nothing
PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
pcre2_free_substring_list(pcre2_context *context, PCRE2_SPTR *list)
pcre2_substring_list_free(PCRE2_SPTR *list)
{
context->free(list, context->user_data);
list=list;
return;
}
@ -182,62 +182,10 @@ Returns: if successful:
*/
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_get_named_substring(pcre2_context *context, pcre2_match_data *match_data,
pcre2_substring_get_byname(pcre2_match_data *match_data,
PCRE2_SPTR stringname, PCRE2_UCHAR **stringptr)
{
context=context;match_data=match_data;stringname=stringname;stringptr=stringptr;
return PCRE2_ERROR_NOSUBSTRING;
}
/*************************************************
* Get length of a named substring *
*************************************************/
/* This function returns the length of a named captured substring. If the regex
permits duplicate names, the first substring that is set is chosen.
Arguments:
match_data pointer to match data
stringname the name of the required substring
Returns: a non-negative length if successful
a negative error code otherwise
*/
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_get_named_substring_length(pcre2_match_data *match_data,
PCRE2_SPTR stringname)
{
match_data=match_data;stringname=stringname;
return PCRE2_ERROR_NOSUBSTRING;
}
/*************************************************
* Find (multiple) entries for named string *
*************************************************/
/* This is used by the local get_first_set() function, as well as being
generally available. It is used when duplicated names are permitted.
Arguments:
code the compiled regex
stringname the name whose entries required
firstptr where to put the pointer to the first entry
lastptr where to put the pointer to the last entry
Returns: the length of each entry, or a negative number
(PCRE2_ERROR_NOSUBSTRING) if not found
*/
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_get_stringtable_entries(const pcre2_code *code, PCRE2_SPTR stringname,
PCRE2_UCHAR **firstptr, PCRE2_UCHAR **lastptr)
{
code=code;stringname=stringname;firstptr=firstptr;lastptr=lastptr;
match_data=match_data;stringname=stringname;stringptr=stringptr;
return PCRE2_ERROR_NOSUBSTRING;
}
@ -265,16 +213,41 @@ Returns: if successful:
*/
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_get_substring(pcre2_context *context, pcre2_match_data *match_data,
int stringnumber, PCRE2_UCHAR **stringptr)
pcre2_substring_get_bynumber(pcre2_match_data *match_data, int stringnumber,
PCRE2_UCHAR **stringptr)
{
context=context;match_data=match_data;stringnumber=stringnumber;
match_data=match_data;stringnumber=stringnumber;
stringptr=stringptr;
return PCRE2_ERROR_NOSUBSTRING;
}
/*************************************************
* Get length of a named substring *
*************************************************/
/* This function returns the length of a named captured substring. If the regex
permits duplicate names, the first substring that is set is chosen.
Arguments:
match_data pointer to match data
stringname the name of the required substring
Returns: a non-negative length if successful
a negative error code otherwise
*/
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_substring_length_byname(pcre2_match_data *match_data,
PCRE2_SPTR stringname)
{
match_data=match_data;stringname=stringname;
return PCRE2_ERROR_NOSUBSTRING;
}
/*************************************************
* Get length of a numbered substring *
*************************************************/
@ -290,7 +263,7 @@ Returns: a non-negative length if successful
*/
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_get_substring_length(pcre2_match_data *match_data,
pcre2_substring_length_bynumber(pcre2_match_data *match_data,
int stringnumber)
{
match_data=match_data;stringnumber=stringnumber;
@ -317,10 +290,10 @@ Returns: if successful: 0
*/
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_get_substring_list(pcre2_context *context, pcre2_match_data *match_data,
PCRE2_UCHAR ***listptr)
pcre2_substring_list_get(pcre2_match_data *match_data, PCRE2_UCHAR ***listptr,
size_t **lengthsptr)
{
context=context;match_data=match_data;listptr=listptr;
match_data=match_data;listptr=listptr;lengthsptr=lengthsptr;
return PCRE2_ERROR_NOMEMORY;
}
@ -342,11 +315,39 @@ Returns: the number of the named parentheses, or a negative number
*/
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_get_substring_number(const pcre2_code *code, PCRE2_SPTR stringname)
pcre2_substring_number_from_name(const pcre2_code *code,
PCRE2_SPTR stringname)
{
code=code;stringname=stringname;
return PCRE2_ERROR_NOSUBSTRING;
}
/*************************************************
* Find (multiple) entries for named string *
*************************************************/
/* This is used by the local get_first_set() function, as well as being
generally available. It is used when duplicated names are permitted.
Arguments:
code the compiled regex
stringname the name whose entries required
firstptr where to put the pointer to the first entry
lastptr where to put the pointer to the last entry
Returns: the length of each entry, or a negative number
(PCRE2_ERROR_NOSUBSTRING) if not found
*/
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_substring_nametable_scan(const pcre2_code *code, PCRE2_SPTR stringname,
PCRE2_UCHAR **firstptr, PCRE2_UCHAR **lastptr)
{
code=code;stringname=stringname;firstptr=firstptr;lastptr=lastptr;
return PCRE2_ERROR_NOSUBSTRING;
}
/* End of pcre2_substring.c */

665
src/pcre2_tables.c Normal file
View File

@ -0,0 +1,665 @@
/*************************************************
* Perl-Compatible Regular Expressions *
*************************************************/
/* PCRE is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
New API code Copyright (c) 2014 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the University of Cambridge nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
*/
#ifndef PCRE2_INCLUDED
/* This module contains some fixed tables that are used by more than one of the
PCRE code modules. The tables are also #included by the pcre2test program,
which uses macros to change their names from _pcre2_xxx to xxxx, thereby
avoiding name clashes with the library. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
#endif /* PCRE2_INCLUDED */
#ifdef FIXME
/* Table of sizes for the fixed-length opcodes. It's defined in a macro so that
the definition is next to the definition of the opcodes in pcre2_internal.h. */
const uint8_t PRIV(OP_lengths)[] = { OP_LENGTHS };
/* Tables of horizontal and vertical whitespace characters, suitable for
adding to classes. */
const uint32_t PRIV(hspace_list)[] = { HSPACE_LIST };
const uint32_t PRIV(vspace_list)[] = { VSPACE_LIST };
#endif /* FIXME */
/*************************************************
* Tables for UTF-8 support *
*************************************************/
/* These are the breakpoints for different numbers of bytes in a UTF-8
character. */
#if (defined SUPPORT_UTF && defined COMPILE_PCRE8) \
|| (defined PCRE2_INCLUDED && (defined SUPPORT_PCRE16 || defined SUPPORT_PCRE32))
/* These tables are also required by pcretest in 16- or 32-bit mode. */
const int PRIV(utf8_table1)[] =
{ 0x7f, 0x7ff, 0xffff, 0x1fffff, 0x3ffffff, 0x7fffffff};
const int PRIV(utf8_table1_size) = sizeof(PRIV(utf8_table1)) / sizeof(int);
/* These are the indicator bits and the mask for the data bits to set in the
first byte of a character, indexed by the number of additional bytes. */
const int PRIV(utf8_table2)[] = { 0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc};
const int PRIV(utf8_table3)[] = { 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01};
/* Table of the number of extra bytes, indexed by the first byte masked with
0x3f. The highest number for a valid UTF-8 first byte is in fact 0x3d. */
const uint8_t PRIV(utf8_table4)[] = {
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 };
#endif /* (SUPPORT_UTF && COMPILE_PCRE8) || (PCRE2_INCLUDED && SUPPORT_PCRE[16|32])*/
#ifdef FIXME
#ifdef SUPPORT_UTF
/* Table to translate from particular type value to the general value. */
const uint32_t PRIV(ucp_gentype)[] = {
ucp_C, ucp_C, ucp_C, ucp_C, ucp_C, /* Cc, Cf, Cn, Co, Cs */
ucp_L, ucp_L, ucp_L, ucp_L, ucp_L, /* Ll, Lu, Lm, Lo, Lt */
ucp_M, ucp_M, ucp_M, /* Mc, Me, Mn */
ucp_N, ucp_N, ucp_N, /* Nd, Nl, No */
ucp_P, ucp_P, ucp_P, ucp_P, ucp_P, /* Pc, Pd, Pe, Pf, Pi */
ucp_P, ucp_P, /* Ps, Po */
ucp_S, ucp_S, ucp_S, ucp_S, /* Sc, Sk, Sm, So */
ucp_Z, ucp_Z, ucp_Z /* Zl, Zp, Zs */
};
/* This table encodes the rules for finding the end of an extended grapheme
cluster. Every code point has a grapheme break property which is one of the
ucp_gbXX values defined in ucp.h. The 2-dimensional table is indexed by the
properties of two adjacent code points. The left property selects a word from
the table, and the right property selects a bit from that word like this:
ucp_gbtable[left-property] & (1 << right-property)
The value is non-zero if a grapheme break is NOT permitted between the relevant
two code points. The breaking rules are as follows:
1. Break at the start and end of text (pretty obviously).
2. Do not break between a CR and LF; otherwise, break before and after
controls.
3. Do not break Hangul syllable sequences, the rules for which are:
L may be followed by L, V, LV or LVT
LV or V may be followed by V or T
LVT or T may be followed by T
4. Do not break before extending characters.
The next two rules are only for extended grapheme clusters (but that's what we
are implementing).
5. Do not break before SpacingMarks.
6. Do not break after Prepend characters.
7. Otherwise, break everywhere.
*/
const uint32_t PRIV(ucp_gbtable[]) = {
(1<<ucp_gbLF), /* 0 CR */
0, /* 1 LF */
0, /* 2 Control */
(1<<ucp_gbExtend)|(1<<ucp_gbSpacingMark), /* 3 Extend */
(1<<ucp_gbExtend)|(1<<ucp_gbPrepend)| /* 4 Prepend */
(1<<ucp_gbSpacingMark)|(1<<ucp_gbL)|
(1<<ucp_gbV)|(1<<ucp_gbT)|(1<<ucp_gbLV)|
(1<<ucp_gbLVT)|(1<<ucp_gbOther),
(1<<ucp_gbExtend)|(1<<ucp_gbSpacingMark), /* 5 SpacingMark */
(1<<ucp_gbExtend)|(1<<ucp_gbSpacingMark)|(1<<ucp_gbL)| /* 6 L */
(1<<ucp_gbL)|(1<<ucp_gbV)|(1<<ucp_gbLV)|(1<<ucp_gbLVT),
(1<<ucp_gbExtend)|(1<<ucp_gbSpacingMark)|(1<<ucp_gbV)| /* 7 V */
(1<<ucp_gbT),
(1<<ucp_gbExtend)|(1<<ucp_gbSpacingMark)|(1<<ucp_gbT), /* 8 T */
(1<<ucp_gbExtend)|(1<<ucp_gbSpacingMark)|(1<<ucp_gbV)| /* 9 LV */
(1<<ucp_gbT),
(1<<ucp_gbExtend)|(1<<ucp_gbSpacingMark)|(1<<ucp_gbT), /* 10 LVT */
(1<<ucp_gbRegionalIndicator), /* 11 RegionalIndicator */
(1<<ucp_gbExtend)|(1<<ucp_gbSpacingMark) /* 12 Other */
};
#ifdef SUPPORT_JIT
/* This table reverses PRIV(ucp_gentype). We can save the cost
of a memory load. */
const int PRIV(ucp_typerange)[] = {
ucp_Cc, ucp_Cs,
ucp_Ll, ucp_Lu,
ucp_Mc, ucp_Mn,
ucp_Nd, ucp_No,
ucp_Pc, ucp_Ps,
ucp_Sc, ucp_So,
ucp_Zl, ucp_Zs,
};
#endif /* SUPPORT_JIT */
/* The pcre_utt[] table below translates Unicode property names into type and
code values. It is searched by binary chop, so must be in collating sequence of
name. Originally, the table contained pointers to the name strings in the first
field of each entry. However, that leads to a large number of relocations when
a shared library is dynamically loaded. A significant reduction is made by
putting all the names into a single, large string and then using offsets in the
table itself. Maintenance is more error-prone, but frequent changes to this
data are unlikely.
July 2008: There is now a script called maint/GenerateUtt.py that can be used
to generate this data automatically instead of maintaining it by hand.
The script was updated in March 2009 to generate a new EBCDIC-compliant
version. Like all other character and string literals that are compared against
the regular expression pattern, we must use STR_ macros instead of literal
strings to make sure that UTF-8 support works on EBCDIC platforms. */
#define STRING_Any0 STR_A STR_n STR_y "\0"
#define STRING_Arabic0 STR_A STR_r STR_a STR_b STR_i STR_c "\0"
#define STRING_Armenian0 STR_A STR_r STR_m STR_e STR_n STR_i STR_a STR_n "\0"
#define STRING_Avestan0 STR_A STR_v STR_e STR_s STR_t STR_a STR_n "\0"
#define STRING_Balinese0 STR_B STR_a STR_l STR_i STR_n STR_e STR_s STR_e "\0"
#define STRING_Bamum0 STR_B STR_a STR_m STR_u STR_m "\0"
#define STRING_Batak0 STR_B STR_a STR_t STR_a STR_k "\0"
#define STRING_Bengali0 STR_B STR_e STR_n STR_g STR_a STR_l STR_i "\0"
#define STRING_Bopomofo0 STR_B STR_o STR_p STR_o STR_m STR_o STR_f STR_o "\0"
#define STRING_Brahmi0 STR_B STR_r STR_a STR_h STR_m STR_i "\0"
#define STRING_Braille0 STR_B STR_r STR_a STR_i STR_l STR_l STR_e "\0"
#define STRING_Buginese0 STR_B STR_u STR_g STR_i STR_n STR_e STR_s STR_e "\0"
#define STRING_Buhid0 STR_B STR_u STR_h STR_i STR_d "\0"
#define STRING_C0 STR_C "\0"
#define STRING_Canadian_Aboriginal0 STR_C STR_a STR_n STR_a STR_d STR_i STR_a STR_n STR_UNDERSCORE STR_A STR_b STR_o STR_r STR_i STR_g STR_i STR_n STR_a STR_l "\0"
#define STRING_Carian0 STR_C STR_a STR_r STR_i STR_a STR_n "\0"
#define STRING_Cc0 STR_C STR_c "\0"
#define STRING_Cf0 STR_C STR_f "\0"
#define STRING_Chakma0 STR_C STR_h STR_a STR_k STR_m STR_a "\0"
#define STRING_Cham0 STR_C STR_h STR_a STR_m "\0"
#define STRING_Cherokee0 STR_C STR_h STR_e STR_r STR_o STR_k STR_e STR_e "\0"
#define STRING_Cn0 STR_C STR_n "\0"
#define STRING_Co0 STR_C STR_o "\0"
#define STRING_Common0 STR_C STR_o STR_m STR_m STR_o STR_n "\0"
#define STRING_Coptic0 STR_C STR_o STR_p STR_t STR_i STR_c "\0"
#define STRING_Cs0 STR_C STR_s "\0"
#define STRING_Cuneiform0 STR_C STR_u STR_n STR_e STR_i STR_f STR_o STR_r STR_m "\0"
#define STRING_Cypriot0 STR_C STR_y STR_p STR_r STR_i STR_o STR_t "\0"
#define STRING_Cyrillic0 STR_C STR_y STR_r STR_i STR_l STR_l STR_i STR_c "\0"
#define STRING_Deseret0 STR_D STR_e STR_s STR_e STR_r STR_e STR_t "\0"
#define STRING_Devanagari0 STR_D STR_e STR_v STR_a STR_n STR_a STR_g STR_a STR_r STR_i "\0"
#define STRING_Egyptian_Hieroglyphs0 STR_E STR_g STR_y STR_p STR_t STR_i STR_a STR_n STR_UNDERSCORE STR_H STR_i STR_e STR_r STR_o STR_g STR_l STR_y STR_p STR_h STR_s "\0"
#define STRING_Ethiopic0 STR_E STR_t STR_h STR_i STR_o STR_p STR_i STR_c "\0"
#define STRING_Georgian0 STR_G STR_e STR_o STR_r STR_g STR_i STR_a STR_n "\0"
#define STRING_Glagolitic0 STR_G STR_l STR_a STR_g STR_o STR_l STR_i STR_t STR_i STR_c "\0"
#define STRING_Gothic0 STR_G STR_o STR_t STR_h STR_i STR_c "\0"
#define STRING_Greek0 STR_G STR_r STR_e STR_e STR_k "\0"
#define STRING_Gujarati0 STR_G STR_u STR_j STR_a STR_r STR_a STR_t STR_i "\0"
#define STRING_Gurmukhi0 STR_G STR_u STR_r STR_m STR_u STR_k STR_h STR_i "\0"
#define STRING_Han0 STR_H STR_a STR_n "\0"
#define STRING_Hangul0 STR_H STR_a STR_n STR_g STR_u STR_l "\0"
#define STRING_Hanunoo0 STR_H STR_a STR_n STR_u STR_n STR_o STR_o "\0"
#define STRING_Hebrew0 STR_H STR_e STR_b STR_r STR_e STR_w "\0"
#define STRING_Hiragana0 STR_H STR_i STR_r STR_a STR_g STR_a STR_n STR_a "\0"
#define STRING_Imperial_Aramaic0 STR_I STR_m STR_p STR_e STR_r STR_i STR_a STR_l STR_UNDERSCORE STR_A STR_r STR_a STR_m STR_a STR_i STR_c "\0"
#define STRING_Inherited0 STR_I STR_n STR_h STR_e STR_r STR_i STR_t STR_e STR_d "\0"
#define STRING_Inscriptional_Pahlavi0 STR_I STR_n STR_s STR_c STR_r STR_i STR_p STR_t STR_i STR_o STR_n STR_a STR_l STR_UNDERSCORE STR_P STR_a STR_h STR_l STR_a STR_v STR_i "\0"
#define STRING_Inscriptional_Parthian0 STR_I STR_n STR_s STR_c STR_r STR_i STR_p STR_t STR_i STR_o STR_n STR_a STR_l STR_UNDERSCORE STR_P STR_a STR_r STR_t STR_h STR_i STR_a STR_n "\0"
#define STRING_Javanese0 STR_J STR_a STR_v STR_a STR_n STR_e STR_s STR_e "\0"
#define STRING_Kaithi0 STR_K STR_a STR_i STR_t STR_h STR_i "\0"
#define STRING_Kannada0 STR_K STR_a STR_n STR_n STR_a STR_d STR_a "\0"
#define STRING_Katakana0 STR_K STR_a STR_t STR_a STR_k STR_a STR_n STR_a "\0"
#define STRING_Kayah_Li0 STR_K STR_a STR_y STR_a STR_h STR_UNDERSCORE STR_L STR_i "\0"
#define STRING_Kharoshthi0 STR_K STR_h STR_a STR_r STR_o STR_s STR_h STR_t STR_h STR_i "\0"
#define STRING_Khmer0 STR_K STR_h STR_m STR_e STR_r "\0"
#define STRING_L0 STR_L "\0"
#define STRING_L_AMPERSAND0 STR_L STR_AMPERSAND "\0"
#define STRING_Lao0 STR_L STR_a STR_o "\0"
#define STRING_Latin0 STR_L STR_a STR_t STR_i STR_n "\0"
#define STRING_Lepcha0 STR_L STR_e STR_p STR_c STR_h STR_a "\0"
#define STRING_Limbu0 STR_L STR_i STR_m STR_b STR_u "\0"
#define STRING_Linear_B0 STR_L STR_i STR_n STR_e STR_a STR_r STR_UNDERSCORE STR_B "\0"
#define STRING_Lisu0 STR_L STR_i STR_s STR_u "\0"
#define STRING_Ll0 STR_L STR_l "\0"
#define STRING_Lm0 STR_L STR_m "\0"
#define STRING_Lo0 STR_L STR_o "\0"
#define STRING_Lt0 STR_L STR_t "\0"
#define STRING_Lu0 STR_L STR_u "\0"
#define STRING_Lycian0 STR_L STR_y STR_c STR_i STR_a STR_n "\0"
#define STRING_Lydian0 STR_L STR_y STR_d STR_i STR_a STR_n "\0"
#define STRING_M0 STR_M "\0"
#define STRING_Malayalam0 STR_M STR_a STR_l STR_a STR_y STR_a STR_l STR_a STR_m "\0"
#define STRING_Mandaic0 STR_M STR_a STR_n STR_d STR_a STR_i STR_c "\0"
#define STRING_Mc0 STR_M STR_c "\0"
#define STRING_Me0 STR_M STR_e "\0"
#define STRING_Meetei_Mayek0 STR_M STR_e STR_e STR_t STR_e STR_i STR_UNDERSCORE STR_M STR_a STR_y STR_e STR_k "\0"
#define STRING_Meroitic_Cursive0 STR_M STR_e STR_r STR_o STR_i STR_t STR_i STR_c STR_UNDERSCORE STR_C STR_u STR_r STR_s STR_i STR_v STR_e "\0"
#define STRING_Meroitic_Hieroglyphs0 STR_M STR_e STR_r STR_o STR_i STR_t STR_i STR_c STR_UNDERSCORE STR_H STR_i STR_e STR_r STR_o STR_g STR_l STR_y STR_p STR_h STR_s "\0"
#define STRING_Miao0 STR_M STR_i STR_a STR_o "\0"
#define STRING_Mn0 STR_M STR_n "\0"
#define STRING_Mongolian0 STR_M STR_o STR_n STR_g STR_o STR_l STR_i STR_a STR_n "\0"
#define STRING_Myanmar0 STR_M STR_y STR_a STR_n STR_m STR_a STR_r "\0"
#define STRING_N0 STR_N "\0"
#define STRING_Nd0 STR_N STR_d "\0"
#define STRING_New_Tai_Lue0 STR_N STR_e STR_w STR_UNDERSCORE STR_T STR_a STR_i STR_UNDERSCORE STR_L STR_u STR_e "\0"
#define STRING_Nko0 STR_N STR_k STR_o "\0"
#define STRING_Nl0 STR_N STR_l "\0"
#define STRING_No0 STR_N STR_o "\0"
#define STRING_Ogham0 STR_O STR_g STR_h STR_a STR_m "\0"
#define STRING_Ol_Chiki0 STR_O STR_l STR_UNDERSCORE STR_C STR_h STR_i STR_k STR_i "\0"
#define STRING_Old_Italic0 STR_O STR_l STR_d STR_UNDERSCORE STR_I STR_t STR_a STR_l STR_i STR_c "\0"
#define STRING_Old_Persian0 STR_O STR_l STR_d STR_UNDERSCORE STR_P STR_e STR_r STR_s STR_i STR_a STR_n "\0"
#define STRING_Old_South_Arabian0 STR_O STR_l STR_d STR_UNDERSCORE STR_S STR_o STR_u STR_t STR_h STR_UNDERSCORE STR_A STR_r STR_a STR_b STR_i STR_a STR_n "\0"
#define STRING_Old_Turkic0 STR_O STR_l STR_d STR_UNDERSCORE STR_T STR_u STR_r STR_k STR_i STR_c "\0"
#define STRING_Oriya0 STR_O STR_r STR_i STR_y STR_a "\0"
#define STRING_Osmanya0 STR_O STR_s STR_m STR_a STR_n STR_y STR_a "\0"
#define STRING_P0 STR_P "\0"
#define STRING_Pc0 STR_P STR_c "\0"
#define STRING_Pd0 STR_P STR_d "\0"
#define STRING_Pe0 STR_P STR_e "\0"
#define STRING_Pf0 STR_P STR_f "\0"
#define STRING_Phags_Pa0 STR_P STR_h STR_a STR_g STR_s STR_UNDERSCORE STR_P STR_a "\0"
#define STRING_Phoenician0 STR_P STR_h STR_o STR_e STR_n STR_i STR_c STR_i STR_a STR_n "\0"
#define STRING_Pi0 STR_P STR_i "\0"
#define STRING_Po0 STR_P STR_o "\0"
#define STRING_Ps0 STR_P STR_s "\0"
#define STRING_Rejang0 STR_R STR_e STR_j STR_a STR_n STR_g "\0"
#define STRING_Runic0 STR_R STR_u STR_n STR_i STR_c "\0"
#define STRING_S0 STR_S "\0"
#define STRING_Samaritan0 STR_S STR_a STR_m STR_a STR_r STR_i STR_t STR_a STR_n "\0"
#define STRING_Saurashtra0 STR_S STR_a STR_u STR_r STR_a STR_s STR_h STR_t STR_r STR_a "\0"
#define STRING_Sc0 STR_S STR_c "\0"
#define STRING_Sharada0 STR_S STR_h STR_a STR_r STR_a STR_d STR_a "\0"
#define STRING_Shavian0 STR_S STR_h STR_a STR_v STR_i STR_a STR_n "\0"
#define STRING_Sinhala0 STR_S STR_i STR_n STR_h STR_a STR_l STR_a "\0"
#define STRING_Sk0 STR_S STR_k "\0"
#define STRING_Sm0 STR_S STR_m "\0"
#define STRING_So0 STR_S STR_o "\0"
#define STRING_Sora_Sompeng0 STR_S STR_o STR_r STR_a STR_UNDERSCORE STR_S STR_o STR_m STR_p STR_e STR_n STR_g "\0"
#define STRING_Sundanese0 STR_S STR_u STR_n STR_d STR_a STR_n STR_e STR_s STR_e "\0"
#define STRING_Syloti_Nagri0 STR_S STR_y STR_l STR_o STR_t STR_i STR_UNDERSCORE STR_N STR_a STR_g STR_r STR_i "\0"
#define STRING_Syriac0 STR_S STR_y STR_r STR_i STR_a STR_c "\0"
#define STRING_Tagalog0 STR_T STR_a STR_g STR_a STR_l STR_o STR_g "\0"
#define STRING_Tagbanwa0 STR_T STR_a STR_g STR_b STR_a STR_n STR_w STR_a "\0"
#define STRING_Tai_Le0 STR_T STR_a STR_i STR_UNDERSCORE STR_L STR_e "\0"
#define STRING_Tai_Tham0 STR_T STR_a STR_i STR_UNDERSCORE STR_T STR_h STR_a STR_m "\0"
#define STRING_Tai_Viet0 STR_T STR_a STR_i STR_UNDERSCORE STR_V STR_i STR_e STR_t "\0"
#define STRING_Takri0 STR_T STR_a STR_k STR_r STR_i "\0"
#define STRING_Tamil0 STR_T STR_a STR_m STR_i STR_l "\0"
#define STRING_Telugu0 STR_T STR_e STR_l STR_u STR_g STR_u "\0"
#define STRING_Thaana0 STR_T STR_h STR_a STR_a STR_n STR_a "\0"
#define STRING_Thai0 STR_T STR_h STR_a STR_i "\0"
#define STRING_Tibetan0 STR_T STR_i STR_b STR_e STR_t STR_a STR_n "\0"
#define STRING_Tifinagh0 STR_T STR_i STR_f STR_i STR_n STR_a STR_g STR_h "\0"
#define STRING_Ugaritic0 STR_U STR_g STR_a STR_r STR_i STR_t STR_i STR_c "\0"
#define STRING_Vai0 STR_V STR_a STR_i "\0"
#define STRING_Xan0 STR_X STR_a STR_n "\0"
#define STRING_Xps0 STR_X STR_p STR_s "\0"
#define STRING_Xsp0 STR_X STR_s STR_p "\0"
#define STRING_Xuc0 STR_X STR_u STR_c "\0"
#define STRING_Xwd0 STR_X STR_w STR_d "\0"
#define STRING_Yi0 STR_Y STR_i "\0"
#define STRING_Z0 STR_Z "\0"
#define STRING_Zl0 STR_Z STR_l "\0"
#define STRING_Zp0 STR_Z STR_p "\0"
#define STRING_Zs0 STR_Z STR_s "\0"
const char PRIV(utt_names)[] =
STRING_Any0
STRING_Arabic0
STRING_Armenian0
STRING_Avestan0
STRING_Balinese0
STRING_Bamum0
STRING_Batak0
STRING_Bengali0
STRING_Bopomofo0
STRING_Brahmi0
STRING_Braille0
STRING_Buginese0
STRING_Buhid0
STRING_C0
STRING_Canadian_Aboriginal0
STRING_Carian0
STRING_Cc0
STRING_Cf0
STRING_Chakma0
STRING_Cham0
STRING_Cherokee0
STRING_Cn0
STRING_Co0
STRING_Common0
STRING_Coptic0
STRING_Cs0
STRING_Cuneiform0
STRING_Cypriot0
STRING_Cyrillic0
STRING_Deseret0
STRING_Devanagari0
STRING_Egyptian_Hieroglyphs0
STRING_Ethiopic0
STRING_Georgian0
STRING_Glagolitic0
STRING_Gothic0
STRING_Greek0
STRING_Gujarati0
STRING_Gurmukhi0
STRING_Han0
STRING_Hangul0
STRING_Hanunoo0
STRING_Hebrew0
STRING_Hiragana0
STRING_Imperial_Aramaic0
STRING_Inherited0
STRING_Inscriptional_Pahlavi0
STRING_Inscriptional_Parthian0
STRING_Javanese0
STRING_Kaithi0
STRING_Kannada0
STRING_Katakana0
STRING_Kayah_Li0
STRING_Kharoshthi0
STRING_Khmer0
STRING_L0
STRING_L_AMPERSAND0
STRING_Lao0
STRING_Latin0
STRING_Lepcha0
STRING_Limbu0
STRING_Linear_B0
STRING_Lisu0
STRING_Ll0
STRING_Lm0
STRING_Lo0
STRING_Lt0
STRING_Lu0
STRING_Lycian0
STRING_Lydian0
STRING_M0
STRING_Malayalam0
STRING_Mandaic0
STRING_Mc0
STRING_Me0
STRING_Meetei_Mayek0
STRING_Meroitic_Cursive0
STRING_Meroitic_Hieroglyphs0
STRING_Miao0
STRING_Mn0
STRING_Mongolian0
STRING_Myanmar0
STRING_N0
STRING_Nd0
STRING_New_Tai_Lue0
STRING_Nko0
STRING_Nl0
STRING_No0
STRING_Ogham0
STRING_Ol_Chiki0
STRING_Old_Italic0
STRING_Old_Persian0
STRING_Old_South_Arabian0
STRING_Old_Turkic0
STRING_Oriya0
STRING_Osmanya0
STRING_P0
STRING_Pc0
STRING_Pd0
STRING_Pe0
STRING_Pf0
STRING_Phags_Pa0
STRING_Phoenician0
STRING_Pi0
STRING_Po0
STRING_Ps0
STRING_Rejang0
STRING_Runic0
STRING_S0
STRING_Samaritan0
STRING_Saurashtra0
STRING_Sc0
STRING_Sharada0
STRING_Shavian0
STRING_Sinhala0
STRING_Sk0
STRING_Sm0
STRING_So0
STRING_Sora_Sompeng0
STRING_Sundanese0
STRING_Syloti_Nagri0
STRING_Syriac0
STRING_Tagalog0
STRING_Tagbanwa0
STRING_Tai_Le0
STRING_Tai_Tham0
STRING_Tai_Viet0
STRING_Takri0
STRING_Tamil0
STRING_Telugu0
STRING_Thaana0
STRING_Thai0
STRING_Tibetan0
STRING_Tifinagh0
STRING_Ugaritic0
STRING_Vai0
STRING_Xan0
STRING_Xps0
STRING_Xsp0
STRING_Xuc0
STRING_Xwd0
STRING_Yi0
STRING_Z0
STRING_Zl0
STRING_Zp0
STRING_Zs0;
const ucp_type_table PRIV(utt)[] = {
{ 0, PT_ANY, 0 },
{ 4, PT_SC, ucp_Arabic },
{ 11, PT_SC, ucp_Armenian },
{ 20, PT_SC, ucp_Avestan },
{ 28, PT_SC, ucp_Balinese },
{ 37, PT_SC, ucp_Bamum },
{ 43, PT_SC, ucp_Batak },
{ 49, PT_SC, ucp_Bengali },
{ 57, PT_SC, ucp_Bopomofo },
{ 66, PT_SC, ucp_Brahmi },
{ 73, PT_SC, ucp_Braille },
{ 81, PT_SC, ucp_Buginese },
{ 90, PT_SC, ucp_Buhid },
{ 96, PT_GC, ucp_C },
{ 98, PT_SC, ucp_Canadian_Aboriginal },
{ 118, PT_SC, ucp_Carian },
{ 125, PT_PC, ucp_Cc },
{ 128, PT_PC, ucp_Cf },
{ 131, PT_SC, ucp_Chakma },
{ 138, PT_SC, ucp_Cham },
{ 143, PT_SC, ucp_Cherokee },
{ 152, PT_PC, ucp_Cn },
{ 155, PT_PC, ucp_Co },
{ 158, PT_SC, ucp_Common },
{ 165, PT_SC, ucp_Coptic },
{ 172, PT_PC, ucp_Cs },
{ 175, PT_SC, ucp_Cuneiform },
{ 185, PT_SC, ucp_Cypriot },
{ 193, PT_SC, ucp_Cyrillic },
{ 202, PT_SC, ucp_Deseret },
{ 210, PT_SC, ucp_Devanagari },
{ 221, PT_SC, ucp_Egyptian_Hieroglyphs },
{ 242, PT_SC, ucp_Ethiopic },
{ 251, PT_SC, ucp_Georgian },
{ 260, PT_SC, ucp_Glagolitic },
{ 271, PT_SC, ucp_Gothic },
{ 278, PT_SC, ucp_Greek },
{ 284, PT_SC, ucp_Gujarati },
{ 293, PT_SC, ucp_Gurmukhi },
{ 302, PT_SC, ucp_Han },
{ 306, PT_SC, ucp_Hangul },
{ 313, PT_SC, ucp_Hanunoo },
{ 321, PT_SC, ucp_Hebrew },
{ 328, PT_SC, ucp_Hiragana },
{ 337, PT_SC, ucp_Imperial_Aramaic },
{ 354, PT_SC, ucp_Inherited },
{ 364, PT_SC, ucp_Inscriptional_Pahlavi },
{ 386, PT_SC, ucp_Inscriptional_Parthian },
{ 409, PT_SC, ucp_Javanese },
{ 418, PT_SC, ucp_Kaithi },
{ 425, PT_SC, ucp_Kannada },
{ 433, PT_SC, ucp_Katakana },
{ 442, PT_SC, ucp_Kayah_Li },
{ 451, PT_SC, ucp_Kharoshthi },
{ 462, PT_SC, ucp_Khmer },
{ 468, PT_GC, ucp_L },
{ 470, PT_LAMP, 0 },
{ 473, PT_SC, ucp_Lao },
{ 477, PT_SC, ucp_Latin },
{ 483, PT_SC, ucp_Lepcha },
{ 490, PT_SC, ucp_Limbu },
{ 496, PT_SC, ucp_Linear_B },
{ 505, PT_SC, ucp_Lisu },
{ 510, PT_PC, ucp_Ll },
{ 513, PT_PC, ucp_Lm },
{ 516, PT_PC, ucp_Lo },
{ 519, PT_PC, ucp_Lt },
{ 522, PT_PC, ucp_Lu },
{ 525, PT_SC, ucp_Lycian },
{ 532, PT_SC, ucp_Lydian },
{ 539, PT_GC, ucp_M },
{ 541, PT_SC, ucp_Malayalam },
{ 551, PT_SC, ucp_Mandaic },
{ 559, PT_PC, ucp_Mc },
{ 562, PT_PC, ucp_Me },
{ 565, PT_SC, ucp_Meetei_Mayek },
{ 578, PT_SC, ucp_Meroitic_Cursive },
{ 595, PT_SC, ucp_Meroitic_Hieroglyphs },
{ 616, PT_SC, ucp_Miao },
{ 621, PT_PC, ucp_Mn },
{ 624, PT_SC, ucp_Mongolian },
{ 634, PT_SC, ucp_Myanmar },
{ 642, PT_GC, ucp_N },
{ 644, PT_PC, ucp_Nd },
{ 647, PT_SC, ucp_New_Tai_Lue },
{ 659, PT_SC, ucp_Nko },
{ 663, PT_PC, ucp_Nl },
{ 666, PT_PC, ucp_No },
{ 669, PT_SC, ucp_Ogham },
{ 675, PT_SC, ucp_Ol_Chiki },
{ 684, PT_SC, ucp_Old_Italic },
{ 695, PT_SC, ucp_Old_Persian },
{ 707, PT_SC, ucp_Old_South_Arabian },
{ 725, PT_SC, ucp_Old_Turkic },
{ 736, PT_SC, ucp_Oriya },
{ 742, PT_SC, ucp_Osmanya },
{ 750, PT_GC, ucp_P },
{ 752, PT_PC, ucp_Pc },
{ 755, PT_PC, ucp_Pd },
{ 758, PT_PC, ucp_Pe },
{ 761, PT_PC, ucp_Pf },
{ 764, PT_SC, ucp_Phags_Pa },
{ 773, PT_SC, ucp_Phoenician },
{ 784, PT_PC, ucp_Pi },
{ 787, PT_PC, ucp_Po },
{ 790, PT_PC, ucp_Ps },
{ 793, PT_SC, ucp_Rejang },
{ 800, PT_SC, ucp_Runic },
{ 806, PT_GC, ucp_S },
{ 808, PT_SC, ucp_Samaritan },
{ 818, PT_SC, ucp_Saurashtra },
{ 829, PT_PC, ucp_Sc },
{ 832, PT_SC, ucp_Sharada },
{ 840, PT_SC, ucp_Shavian },
{ 848, PT_SC, ucp_Sinhala },
{ 856, PT_PC, ucp_Sk },
{ 859, PT_PC, ucp_Sm },
{ 862, PT_PC, ucp_So },
{ 865, PT_SC, ucp_Sora_Sompeng },
{ 878, PT_SC, ucp_Sundanese },
{ 888, PT_SC, ucp_Syloti_Nagri },
{ 901, PT_SC, ucp_Syriac },
{ 908, PT_SC, ucp_Tagalog },
{ 916, PT_SC, ucp_Tagbanwa },
{ 925, PT_SC, ucp_Tai_Le },
{ 932, PT_SC, ucp_Tai_Tham },
{ 941, PT_SC, ucp_Tai_Viet },
{ 950, PT_SC, ucp_Takri },
{ 956, PT_SC, ucp_Tamil },
{ 962, PT_SC, ucp_Telugu },
{ 969, PT_SC, ucp_Thaana },
{ 976, PT_SC, ucp_Thai },
{ 981, PT_SC, ucp_Tibetan },
{ 989, PT_SC, ucp_Tifinagh },
{ 998, PT_SC, ucp_Ugaritic },
{ 1007, PT_SC, ucp_Vai },
{ 1011, PT_ALNUM, 0 },
{ 1015, PT_PXSPACE, 0 },
{ 1019, PT_SPACE, 0 },
{ 1023, PT_UCNC, 0 },
{ 1027, PT_WORD, 0 },
{ 1031, PT_SC, ucp_Yi },
{ 1034, PT_GC, ucp_Z },
{ 1036, PT_PC, ucp_Zl },
{ 1039, PT_PC, ucp_Zp },
{ 1042, PT_PC, ucp_Zs }
};
const int PRIV(utt_size) = sizeof(PRIV(utt)) / sizeof(ucp_type_table);
#endif /* SUPPORT_UTF */
#endif /* FIXME */
/* End of pcre2_tables.c */

3297
src/pcre2_ucd.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -291,7 +291,7 @@ if ((cflags & REG_ICASE) != 0) options |= PCRE2_CASELESS;
if ((cflags & REG_NEWLINE) != 0) options |= PCRE2_MULTILINE;
if ((cflags & REG_DOTALL) != 0) options |= PCRE2_DOTALL;
if ((cflags & REG_NOSUB) != 0) options |= PCRE2_NO_AUTO_CAPTURE;
if ((cflags & REG_UTF8) != 0) options |= PCRE2_UTF8;
if ((cflags & REG_UTF8) != 0) options |= PCRE2_UTF;
if ((cflags & REG_UCP) != 0) options |= PCRE2_UCP;
if ((cflags & REG_UNGREEDY) != 0) options |= PCRE2_UNGREEDY;

File diff suppressed because it is too large Load Diff