Add PCRE2_CONFIG_COMPILED_WIDTHS and PCRE2_CONFIG_NEVER_BACKSLASH_C.

This commit is contained in:
Philip.Hazel 2017-09-16 11:39:38 +00:00
parent 03fa7ead8a
commit 4ac74a013b
7 changed files with 62 additions and 23 deletions

View File

@ -13,6 +13,9 @@ that is called by both pcre2_match() and pcre2_dfa_match().
3. Add idempotent guard to pcre2_internal.h.
4. Add new pcre2_config() options: PCRE2_CONFIG_NEVER_BACKSLASH_C and
PCRE2_CONFIG_COMPILED_WIDTHS.
Version 10.30 14-August-2017
----------------------------

View File

@ -1,4 +1,4 @@
.TH PCRE2_CONFIG 3 "26 May 2017" "PCRE2 10.30"
.TH PCRE2_CONFIG 3 "16 September 2017" "PCRE2 10.31"
.SH NAME
PCRE2 - Perl-compatible regular expressions (revised API)
.SH SYNOPSIS
@ -31,8 +31,9 @@ point to a uint32_t integer variable. The available codes are:
PCRE2_CONFIG_BSR Indicates what \eR matches by default:
PCRE2_BSR_UNICODE
PCRE2_BSR_ANYCRLF
PCRE2_CONFIG_HEAPLIMIT Default heap memory limit
PCRE2_CONFIG_COMPILED_WIDTHS Which of 8/16/32 support was compiled
PCRE2_CONFIG_DEPTHLIMIT Default backtracking depth limit
PCRE2_CONFIG_HEAPLIMIT Default heap memory limit
.\" JOIN
PCRE2_CONFIG_JIT Availability of just-in-time compiler
support (1=yes 0=no)
@ -41,6 +42,7 @@ point to a uint32_t integer variable. The available codes are:
architecture for the JIT compiler
PCRE2_CONFIG_LINKSIZE Configured internal link size (2, 3, 4)
PCRE2_CONFIG_MATCHLIMIT Default internal resource limit
PCRE2_CONFIG_NEVER_BACKSLASH_C Whether or not \eC is disabled
PCRE2_CONFIG_NEWLINE Code for the default newline sequence:
PCRE2_NEWLINE_CR
PCRE2_NEWLINE_LF

View File

@ -1,4 +1,4 @@
.TH PCRE2API 3 "10 July 2017" "PCRE2 10.30"
.TH PCRE2API 3 "16 September 2017" "PCRE2 10.31"
.SH NAME
PCRE2 - Perl-compatible regular expressions (revised API)
.sp
@ -1014,6 +1014,12 @@ sequences the \eR escape sequence matches by default. A value of
PCRE2_BSR_UNICODE means that \eR matches any Unicode line ending sequence; a
value of PCRE2_BSR_ANYCRLF means that \eR matches only CR, LF, or CRLF. The
default can be overridden when a pattern is compiled.
.sp
PCRE2_CONFIG_COMPILED_WIDTHS
.sp
The output is a uint32_t integer whose lower bits indicate which code unit
widths were selected when PCRE2 was built. The 1-bit indicates 8-bit support,
and the 2-bit and 4-bit indicate 16-bit and 32-bit support, respectively.
.sp
PCRE2_CONFIG_DEPTHLIMIT
.sp
@ -1079,6 +1085,11 @@ sequence that is recognized as meaning "newline". The values are:
.sp
The default should normally correspond to the standard sequence for your
operating system.
.sp
PCRE2_CONFIG_NEVER_BACKSLASH_C
.sp
The output is a uint32_t integer that is set to one if the use of \eC was
permanently disabled when PCRE2 was built; otherwise it is set to zero.
.sp
PCRE2_CONFIG_PARENSLIMIT
.sp
@ -3574,6 +3585,6 @@ Cambridge, England.
.rs
.sp
.nf
Last updated: 10 July 2017
Last updated: 16 September 2017
Copyright (c) 1997-2017 University of Cambridge.
.fi

View File

@ -338,6 +338,9 @@ numbers must not be changed. */
#define PCRE2_CONFIG_UNICODE_VERSION 10
#define PCRE2_CONFIG_VERSION 11
#define PCRE2_CONFIG_HEAPLIMIT 12
#define PCRE2_CONFIG_NEVER_BACKSLASH_C 13
#define PCRE2_CONFIG_COMPILED_WIDTHS 14
/* Types for code units in patterns and subject strings. */

View File

@ -338,6 +338,9 @@ numbers must not be changed. */
#define PCRE2_CONFIG_UNICODE_VERSION 10
#define PCRE2_CONFIG_VERSION 11
#define PCRE2_CONFIG_HEAPLIMIT 12
#define PCRE2_CONFIG_NEVER_BACKSLASH_C 13
#define PCRE2_CONFIG_COMPILED_WIDTHS 14
/* Types for code units in patterns and subject strings. */

View File

@ -84,11 +84,13 @@ if (where == NULL) /* Requests a length */
return PCRE2_ERROR_BADOPTION;
case PCRE2_CONFIG_BSR:
case PCRE2_CONFIG_COMPILED_WIDTHS:
case PCRE2_CONFIG_DEPTHLIMIT:
case PCRE2_CONFIG_HEAPLIMIT:
case PCRE2_CONFIG_JIT:
case PCRE2_CONFIG_LINKSIZE:
case PCRE2_CONFIG_MATCHLIMIT:
case PCRE2_CONFIG_DEPTHLIMIT:
case PCRE2_CONFIG_NEVER_BACKSLASH_C:
case PCRE2_CONFIG_NEWLINE:
case PCRE2_CONFIG_PARENSLIMIT:
case PCRE2_CONFIG_STACKRECURSE: /* Obsolete */
@ -117,6 +119,24 @@ switch (what)
#endif
break;
case PCRE2_CONFIG_COMPILED_WIDTHS:
*((uint32_t *)where) = 0
#ifdef SUPPORT_PCRE2_8
+ 1
#endif
#ifdef SUPPORT_PCRE2_16
+ 2
#endif
#ifdef SUPPORT_PCRE2_32
+ 4
#endif
;
break;
case PCRE2_CONFIG_DEPTHLIMIT:
*((uint32_t *)where) = MATCH_LIMIT_DEPTH;
break;
case PCRE2_CONFIG_HEAPLIMIT:
*((uint32_t *)where) = HEAP_LIMIT;
break;
@ -148,14 +168,18 @@ switch (what)
*((uint32_t *)where) = MATCH_LIMIT;
break;
case PCRE2_CONFIG_DEPTHLIMIT:
*((uint32_t *)where) = MATCH_LIMIT_DEPTH;
break;
case PCRE2_CONFIG_NEWLINE:
*((uint32_t *)where) = NEWLINE_DEFAULT;
break;
case PCRE2_CONFIG_NEVER_BACKSLASH_C:
#ifdef NEVER_BACKSLASH_C
*((uint32_t *)where) = 1;
#else
*((uint32_t *)where) = 0;
#endif
break;
case PCRE2_CONFIG_PARENSLIMIT:
*((uint32_t *)where) = PARENS_NEST_LIMIT;
break;

View File

@ -7807,15 +7807,11 @@ printf(" EBCDIC code page %s or similar\n", pcrz_cpversion());
#endif
#endif
#ifdef SUPPORT_PCRE2_8
printf(" 8-bit support\n");
#endif
#ifdef SUPPORT_PCRE2_16
printf(" 16-bit support\n");
#endif
#ifdef SUPPORT_PCRE2_32
printf(" 32-bit support\n");
#endif
(void)PCRE2_CONFIG(PCRE2_CONFIG_COMPILED_WIDTHS, &optval);
if (optval & 1) printf(" 8-bit support\n");
if (optval & 2) printf(" 16-bit support\n");
if (optval & 4) printf(" 32-bit support\n");
#ifdef SUPPORT_VALGRIND
printf(" Valgrind support\n");
#endif
@ -7846,11 +7842,8 @@ print_newline_config(optval, FALSE);
(void)PCRE2_CONFIG(PCRE2_CONFIG_BSR, &optval);
printf(" \\R matches %s\n", optval? "CR, LF, or CRLF only" :
"all Unicode newlines");
#ifdef NEVER_BACKSLASH_C
printf(" \\C is not supported\n");
#else
printf(" \\C is supported\n");
#endif
(void)PCRE2_CONFIG(PCRE2_CONFIG_NEVER_BACKSLASH_C, &optval);
printf(" \\C is %ssupported\n", optval? "not ":"");
(void)PCRE2_CONFIG(PCRE2_CONFIG_LINKSIZE, &optval);
printf(" Internal link size = %d\n", optval);
(void)PCRE2_CONFIG(PCRE2_CONFIG_PARENSLIMIT, &optval);