diff --git a/src/pcre2.h b/src/pcre2.h index 2e17c24..c810a9f 100644 --- a/src/pcre2.h +++ b/src/pcre2.h @@ -47,7 +47,7 @@ POSSIBILITY OF SUCH DAMAGE. #define PCRE2_DATE 2014-99-99 /* When an application links to a PCRE DLL in Windows, the symbols that are -imported have to be identified as such. When building PCRE, the appropriate +imported have to be identified as such. When building PCRE2, the appropriate export setting is defined in pcre2_internal.h, which includes this file. So we don't change existing definitions of PCRE2_EXP_DECL. */ @@ -198,7 +198,7 @@ must all be greater than zero. */ #define PCRE2_ERROR_BADMODE (-33) #define PCRE2_ERROR_BADOFFSET (-34) #define PCRE2_ERROR_BADOPTION (-35) -#define PCRE2_ERROR_BADUTF_OFFSET (-36) +#define PCRE2_ERROR_BADUTFOFFSET (-36) #define PCRE2_ERROR_CALLOUT (-37) /* Never used by PCRE2 itself */ #define PCRE2_ERROR_DFA_BADRESTART (-38) #define PCRE2_ERROR_DFA_RECURSE (-39) @@ -215,46 +215,44 @@ must all be greater than zero. */ #define PCRE2_ERROR_NULL (-50) #define PCRE2_ERROR_RECURSELOOP (-51) #define PCRE2_ERROR_RECURSIONLIMIT (-52) -#define PCRE2_ERROR_UNKNOWN_OPCODE (-53) -#define PCRE2_ERROR_UNSET (-54) +#define PCRE2_ERROR_UNSET (-53) /* Request types for pcre2_pattern_info() */ -#define PCRE2_INFO_BACKREFMAX 0 -#define PCRE2_INFO_BSR_CONVENTION 1 -#define PCRE2_INFO_CAPTURECOUNT 2 -#define PCRE2_INFO_COMPILE_OPTIONS 3 -#define PCRE2_INFO_FIRSTCODEUNIT 4 -#define PCRE2_INFO_FIRSTCODETYPE 5 -#define PCRE2_INFO_FIRSTBITMAP 6 -#define PCRE2_INFO_HASCRORLF 7 -#define PCRE2_INFO_JCHANGED 8 -#define PCRE2_INFO_JIT 9 +#define PCRE2_INFO_ALLOPTIONS 0 +#define PCRE2_INFO_ARGOPTIONS 1 +#define PCRE2_INFO_BACKREFMAX 2 +#define PCRE2_INFO_BSR 3 +#define PCRE2_INFO_CAPTURECOUNT 4 +#define PCRE2_INFO_FIRSTCODEUNIT 5 +#define PCRE2_INFO_FIRSTCODETYPE 6 +#define PCRE2_INFO_FIRSTBITMAP 7 +#define PCRE2_INFO_HASCRORLF 8 +#define PCRE2_INFO_JCHANGED 9 #define PCRE2_INFO_JITSIZE 10 #define PCRE2_INFO_LASTCODEUNIT 11 #define PCRE2_INFO_LASTCODETYPE 12 -#define PCRE2_INFO_MATCH_EMPTY 13 -#define PCRE2_INFO_MATCH_LIMIT 14 +#define PCRE2_INFO_MATCHEMPTY 13 +#define PCRE2_INFO_MATCHLIMIT 14 #define PCRE2_INFO_MAXLOOKBEHIND 15 #define PCRE2_INFO_MINLENGTH 16 #define PCRE2_INFO_NAMECOUNT 17 #define PCRE2_INFO_NAMEENTRYSIZE 18 #define PCRE2_INFO_NAMETABLE 19 -#define PCRE2_INFO_NEWLINE_CONVENTION 20 -#define PCRE2_INFO_PATTERN_OPTIONS 21 -#define PCRE2_INFO_RECURSION_LIMIT 22 -#define PCRE2_INFO_SIZE 23 +#define PCRE2_INFO_NEWLINE 20 +#define PCRE2_INFO_RECURSIONLIMIT 21 +#define PCRE2_INFO_SIZE 22 /* Request types for pcre2_config(). */ #define PCRE2_CONFIG_BSR 0 #define PCRE2_CONFIG_JIT 1 #define PCRE2_CONFIG_JITTARGET 2 -#define PCRE2_CONFIG_LINK_SIZE 3 -#define PCRE2_CONFIG_MATCH_LIMIT 4 -#define PCRE2_CONFIG_MATCH_LIMIT_RECURSION 5 +#define PCRE2_CONFIG_LINKSIZE 3 +#define PCRE2_CONFIG_MATCHLIMIT 4 #define PCRE2_CONFIG_NEWLINE 6 -#define PCRE2_CONFIG_PARENS_LIMIT 7 +#define PCRE2_CONFIG_PARENSLIMIT 7 +#define PCRE2_CONFIG_RECURSIONLIMIT 5 #define PCRE2_CONFIG_STACKRECURSE 8 #define PCRE2_CONFIG_UTF 9 #define PCRE2_CONFIG_VERSION 10 diff --git a/src/pcre2.h.in b/src/pcre2.h.in index d027ba3..5d964d7 100644 --- a/src/pcre2.h.in +++ b/src/pcre2.h.in @@ -47,7 +47,7 @@ POSSIBILITY OF SUCH DAMAGE. #define PCRE2_DATE @PCRE2_DATE@ /* When an application links to a PCRE DLL in Windows, the symbols that are -imported have to be identified as such. When building PCRE, the appropriate +imported have to be identified as such. When building PCRE2, the appropriate export setting is defined in pcre2_internal.h, which includes this file. So we don't change existing definitions of PCRE2_EXP_DECL. */ @@ -198,7 +198,7 @@ must all be greater than zero. */ #define PCRE2_ERROR_BADMODE (-33) #define PCRE2_ERROR_BADOFFSET (-34) #define PCRE2_ERROR_BADOPTION (-35) -#define PCRE2_ERROR_BADUTF_OFFSET (-36) +#define PCRE2_ERROR_BADUTFOFFSET (-36) #define PCRE2_ERROR_CALLOUT (-37) /* Never used by PCRE2 itself */ #define PCRE2_ERROR_DFA_BADRESTART (-38) #define PCRE2_ERROR_DFA_RECURSE (-39) @@ -215,46 +215,44 @@ must all be greater than zero. */ #define PCRE2_ERROR_NULL (-50) #define PCRE2_ERROR_RECURSELOOP (-51) #define PCRE2_ERROR_RECURSIONLIMIT (-52) -#define PCRE2_ERROR_UNKNOWN_OPCODE (-53) -#define PCRE2_ERROR_UNSET (-54) +#define PCRE2_ERROR_UNSET (-53) /* Request types for pcre2_pattern_info() */ -#define PCRE2_INFO_BACKREFMAX 0 -#define PCRE2_INFO_BSR_CONVENTION 1 -#define PCRE2_INFO_CAPTURECOUNT 2 -#define PCRE2_INFO_COMPILE_OPTIONS 3 -#define PCRE2_INFO_FIRSTCODEUNIT 4 -#define PCRE2_INFO_FIRSTCODETYPE 5 -#define PCRE2_INFO_FIRSTBITMAP 6 -#define PCRE2_INFO_HASCRORLF 7 -#define PCRE2_INFO_JCHANGED 8 -#define PCRE2_INFO_JIT 9 +#define PCRE2_INFO_ALLOPTIONS 0 +#define PCRE2_INFO_ARGOPTIONS 1 +#define PCRE2_INFO_BACKREFMAX 2 +#define PCRE2_INFO_BSR 3 +#define PCRE2_INFO_CAPTURECOUNT 4 +#define PCRE2_INFO_FIRSTCODEUNIT 5 +#define PCRE2_INFO_FIRSTCODETYPE 6 +#define PCRE2_INFO_FIRSTBITMAP 7 +#define PCRE2_INFO_HASCRORLF 8 +#define PCRE2_INFO_JCHANGED 9 #define PCRE2_INFO_JITSIZE 10 #define PCRE2_INFO_LASTCODEUNIT 11 #define PCRE2_INFO_LASTCODETYPE 12 -#define PCRE2_INFO_MATCH_EMPTY 13 -#define PCRE2_INFO_MATCH_LIMIT 14 +#define PCRE2_INFO_MATCHEMPTY 13 +#define PCRE2_INFO_MATCHLIMIT 14 #define PCRE2_INFO_MAXLOOKBEHIND 15 #define PCRE2_INFO_MINLENGTH 16 #define PCRE2_INFO_NAMECOUNT 17 #define PCRE2_INFO_NAMEENTRYSIZE 18 #define PCRE2_INFO_NAMETABLE 19 -#define PCRE2_INFO_NEWLINE_CONVENTION 20 -#define PCRE2_INFO_PATTERN_OPTIONS 21 -#define PCRE2_INFO_RECURSION_LIMIT 22 -#define PCRE2_INFO_SIZE 23 +#define PCRE2_INFO_NEWLINE 20 +#define PCRE2_INFO_RECURSIONLIMIT 21 +#define PCRE2_INFO_SIZE 22 /* Request types for pcre2_config(). */ #define PCRE2_CONFIG_BSR 0 #define PCRE2_CONFIG_JIT 1 #define PCRE2_CONFIG_JITTARGET 2 -#define PCRE2_CONFIG_LINK_SIZE 3 -#define PCRE2_CONFIG_MATCH_LIMIT 4 -#define PCRE2_CONFIG_MATCH_LIMIT_RECURSION 5 +#define PCRE2_CONFIG_LINKSIZE 3 +#define PCRE2_CONFIG_MATCHLIMIT 4 #define PCRE2_CONFIG_NEWLINE 6 -#define PCRE2_CONFIG_PARENS_LIMIT 7 +#define PCRE2_CONFIG_PARENSLIMIT 7 +#define PCRE2_CONFIG_RECURSIONLIMIT 5 #define PCRE2_CONFIG_STACKRECURSE 8 #define PCRE2_CONFIG_UTF 9 #define PCRE2_CONFIG_VERSION 10 diff --git a/src/pcre2_config.c b/src/pcre2_config.c index ba362fe..a0d544d 100644 --- a/src/pcre2_config.c +++ b/src/pcre2_config.c @@ -104,29 +104,29 @@ FIXME: This needs re-design. #endif break; - case PCRE2_CONFIG_LINK_SIZE: + case PCRE2_CONFIG_LINKSIZE: *((int *)where) = LINK_SIZE; break; - case PCRE2_CONFIG_MATCH_LIMIT: + case PCRE2_CONFIG_MATCHLIMIT: if (length < sizeof(unsigned long int)) return PCRE2_ERROR_BADLENGTH; *((unsigned long int *)where) = MATCH_LIMIT; break; - case PCRE2_CONFIG_MATCH_LIMIT_RECURSION: - if (length < sizeof(unsigned long int)) return PCRE2_ERROR_BADLENGTH; - *((unsigned long int *)where) = MATCH_LIMIT_RECURSION; - break; - case PCRE2_CONFIG_NEWLINE: *((int *)where) = NEWLINE_DEFAULT; break; - case PCRE2_CONFIG_PARENS_LIMIT: + case PCRE2_CONFIG_PARENSLIMIT: if (length < sizeof(unsigned long int)) return PCRE2_ERROR_BADLENGTH; *((unsigned long int *)where) = PARENS_NEST_LIMIT; break; + case PCRE2_CONFIG_RECURSIONLIMIT: + if (length < sizeof(unsigned long int)) return PCRE2_ERROR_BADLENGTH; + *((unsigned long int *)where) = MATCH_LIMIT_RECURSION; + break; + case PCRE2_CONFIG_STACKRECURSE: #ifdef NO_RECURSE *((int *)where) = 0; diff --git a/src/pcre2_pattern_info.c b/src/pcre2_pattern_info.c index 158c982..2b67d3c 100644 --- a/src/pcre2_pattern_info.c +++ b/src/pcre2_pattern_info.c @@ -84,11 +84,19 @@ if ((re->flags & (PCRE2_CODE_UNIT_WIDTH/8)) == 0) switch(what) { + case PCRE2_INFO_ALLOPTIONS: + *((int *)where) = re->pattern_options; + break; + + case PCRE2_INFO_ARGOPTIONS: + *((int *)where) = re->compile_options; + break; + case PCRE2_INFO_BACKREFMAX: *((int *)where) = re->top_backref; break; - case PCRE2_INFO_BSR_CONVENTION: + case PCRE2_INFO_BSR: *((uint32_t *)where) = re->bsr_convention; break; @@ -96,10 +104,6 @@ switch(what) *((int *)where) = re->top_bracket; break; - case PCRE2_INFO_COMPILE_OPTIONS: - *((int *)where) = re->compile_options; - break; - case PCRE2_INFO_FIRSTCODETYPE: *((int *)where) = ((re->flags & PCRE2_FIRSTSET) != 0)? 1 : ((re->flags & PCRE2_STARTLINE) != 0)? 2 : 0; @@ -141,11 +145,11 @@ switch(what) re->last_codeunit : 0; break; - case PCRE2_INFO_MATCH_EMPTY: + case PCRE2_INFO_MATCHEMPTY: *((int *)where) = (re->flags & PCRE2_MATCH_EMPTY) != 0; break; - case PCRE2_INFO_MATCH_LIMIT: + case PCRE2_INFO_MATCHLIMIT: if ((re->flags & PCRE2_MLSET) == 0) return PCRE2_ERROR_UNSET; *((uint32_t *)where) = re->limit_match; break; @@ -170,15 +174,11 @@ switch(what) *((PCRE2_SPTR*)where) = (PCRE2_SPTR)((char *)re + sizeof(pcre2_real_code)); break; - case PCRE2_INFO_NEWLINE_CONVENTION: + case PCRE2_INFO_NEWLINE: *((uint32_t *)where) = re->newline_convention; break; - case PCRE2_INFO_PATTERN_OPTIONS: - *((int *)where) = re->pattern_options; - break; - - case PCRE2_INFO_RECURSION_LIMIT: + case PCRE2_INFO_RECURSIONLIMIT: if ((re->flags & PCRE2_RLSET) == 0) return PCRE2_ERROR_UNSET; *((uint32_t *)where) = re->limit_recursion; break; diff --git a/src/pcre2posix.c b/src/pcre2posix.c index 0fe4b6d..1425d27 100644 --- a/src/pcre2posix.c +++ b/src/pcre2posix.c @@ -319,12 +319,11 @@ switch(rc) case PCRE2_ERROR_BADMODE: return REG_INVARG; case PCRE2_ERROR_BADMAGIC: return REG_INVARG; case PCRE2_ERROR_BADOPTION: return REG_INVARG; - case PCRE2_ERROR_BADUTF_OFFSET: return REG_INVARG; + case PCRE2_ERROR_BADUTFOFFSET: return REG_INVARG; case PCRE2_ERROR_MATCHLIMIT: return REG_ESPACE; case PCRE2_ERROR_NOMATCH: return REG_NOMATCH; case PCRE2_ERROR_NOMEMORY: return REG_ESPACE; case PCRE2_ERROR_NULL: return REG_INVARG; - case PCRE2_ERROR_UNKNOWN_OPCODE: return REG_ASSERT; } } diff --git a/src/pcre2test.c b/src/pcre2test.c index 3dde9b2..a78d4b5 100644 --- a/src/pcre2test.c +++ b/src/pcre2test.c @@ -575,7 +575,7 @@ static coptstruct coptlist[] = { { "ebcdic", CONF_FIX, SUPPORT_EBCDIC }, { "ebcdic-nl", CONF_FIZ, EBCDIC_NL }, { "jit", CONF_INT, PCRE2_CONFIG_JIT }, - { "linksize", CONF_INT, PCRE2_CONFIG_LINK_SIZE }, + { "linksize", CONF_INT, PCRE2_CONFIG_LINKSIZE }, { "newline", CONF_NL, PCRE2_CONFIG_NEWLINE }, { "pcre16", CONF_FIX, SUPPORT_16 }, { "pcre32", CONF_FIX, SUPPORT_32 }, @@ -2836,7 +2836,7 @@ if ((pat_patctl.control & CTL_INFO) != 0) /* These info requests should always succeed. */ if (pattern_info(PCRE2_INFO_BACKREFMAX, &backrefmax) + - pattern_info(PCRE2_INFO_BSR_CONVENTION, &bsr_convention) + + pattern_info(PCRE2_INFO_BSR, &bsr_convention) + pattern_info(PCRE2_INFO_CAPTURECOUNT, &count) + pattern_info(PCRE2_INFO_FIRSTBITMAP, &start_bits) + pattern_info(PCRE2_INFO_FIRSTCODEUNIT, &first_cunit) + @@ -2845,15 +2845,15 @@ if ((pat_patctl.control & CTL_INFO) != 0) pattern_info(PCRE2_INFO_JCHANGED, &jchanged) + pattern_info(PCRE2_INFO_LASTCODEUNIT, &last_cunit) + pattern_info(PCRE2_INFO_LASTCODETYPE, &last_ctype) + - pattern_info(PCRE2_INFO_MATCH_EMPTY, &match_empty) + - pattern_info(PCRE2_INFO_MATCH_LIMIT, &match_limit) + + pattern_info(PCRE2_INFO_MATCHEMPTY, &match_empty) + + pattern_info(PCRE2_INFO_MATCHLIMIT, &match_limit) + pattern_info(PCRE2_INFO_MAXLOOKBEHIND, &maxlookbehind) + pattern_info(PCRE2_INFO_MINLENGTH, &minlength) + pattern_info(PCRE2_INFO_NAMECOUNT, &namecount) + pattern_info(PCRE2_INFO_NAMEENTRYSIZE, &nameentrysize) + pattern_info(PCRE2_INFO_NAMETABLE, &nametable) + - pattern_info(PCRE2_INFO_NEWLINE_CONVENTION, &newline_convention) + - pattern_info(PCRE2_INFO_RECURSION_LIMIT, &recursion_limit) + pattern_info(PCRE2_INFO_NEWLINE, &newline_convention) + + pattern_info(PCRE2_INFO_RECURSIONLIMIT, &recursion_limit) != 0) return PR_ABEND; @@ -2901,15 +2901,15 @@ if ((pat_patctl.control & CTL_INFO) != 0) if (hascrorlf) fprintf(outfile, "Contains explicit CR or LF match\n"); if (match_empty) fprintf(outfile, "May match empty string\n"); - pattern_info(PCRE2_INFO_COMPILE_OPTIONS, &compile_options); - pattern_info(PCRE2_INFO_PATTERN_OPTIONS, &pattern_options); + pattern_info(PCRE2_INFO_ARGOPTIONS, &compile_options); + pattern_info(PCRE2_INFO_ALLOPTIONS, &pattern_options); if ((compile_options|pattern_options) == 0) fprintf(outfile, "No options\n"); else { show_compile_options(compile_options, "Compile options:", "\n"); - show_compile_options(pattern_options, "Pattern options:", "\n"); + show_compile_options(pattern_options, "Overall options:", "\n"); } if (jchanged) fprintf(outfile, "Duplicate name status changes\n"); @@ -4558,7 +4558,7 @@ if ((dat_datctl.control & CTL_DFA) != 0) } break; - case PCRE2_ERROR_BADUTF_OFFSET: + case PCRE2_ERROR_BADUTFOFFSET: fprintf(outfile, "Error %d (bad UTF-%d offset)\n", capcount, test_mode); break; @@ -4830,13 +4830,13 @@ print_newline_config(rc, FALSE); (void)PCRE2_CONFIG(PCRE2_CONFIG_BSR, &rc, sizeof(rc)); printf(" \\R matches %s\n", rc? "CR, LF, or CRLF only" : "all Unicode newlines"); -(void)PCRE2_CONFIG(PCRE2_CONFIG_LINK_SIZE, &rc, sizeof(rc)); +(void)PCRE2_CONFIG(PCRE2_CONFIG_LINKSIZE, &rc, sizeof(rc)); printf(" Internal link size = %d\n", rc); -(void)PCRE2_CONFIG(PCRE2_CONFIG_PARENS_LIMIT, &lrc, sizeof(lrc)); +(void)PCRE2_CONFIG(PCRE2_CONFIG_PARENSLIMIT, &lrc, sizeof(lrc)); printf(" Parentheses nest limit = %ld\n", lrc); -(void)PCRE2_CONFIG(PCRE2_CONFIG_MATCH_LIMIT, &lrc, sizeof(lrc)); +(void)PCRE2_CONFIG(PCRE2_CONFIG_MATCHLIMIT, &lrc, sizeof(lrc)); printf(" Default match limit = %ld\n", lrc); -(void)PCRE2_CONFIG(PCRE2_CONFIG_MATCH_LIMIT_RECURSION, &lrc, sizeof(lrc)); +(void)PCRE2_CONFIG(PCRE2_CONFIG_RECURSIONLIMIT, &lrc, sizeof(lrc)); printf(" Default recursion depth limit = %ld\n", lrc); (void)PCRE2_CONFIG(PCRE2_CONFIG_STACKRECURSE, &rc, sizeof(rc)); printf(" Match recursion uses %s", rc? "stack" : "heap");