Revision: 862
http://www.exim.org/viewvc/pcre2?view=rev&revision=862
Author: ph10
Date: 2017-09-16 12:39:38 +0100 (Sat, 16 Sep 2017)
Log Message:
-----------
Add PCRE2_CONFIG_COMPILED_WIDTHS and PCRE2_CONFIG_NEVER_BACKSLASH_C.
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/doc/pcre2_config.3
code/trunk/doc/pcre2api.3
code/trunk/src/pcre2.h
code/trunk/src/pcre2.h.in
code/trunk/src/pcre2_config.c
code/trunk/src/pcre2test.c
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2017-09-13 16:22:14 UTC (rev 861)
+++ code/trunk/ChangeLog 2017-09-16 11:39:38 UTC (rev 862)
@@ -13,7 +13,10 @@
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
----------------------------
Modified: code/trunk/doc/pcre2_config.3
===================================================================
--- code/trunk/doc/pcre2_config.3 2017-09-13 16:22:14 UTC (rev 861)
+++ code/trunk/doc/pcre2_config.3 2017-09-16 11:39:38 UTC (rev 862)
@@ -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 @@
PCRE2_CONFIG_BSR Indicates what \eR matches by default:
PCRE2_BSR_UNICODE
PCRE2_BSR_ANYCRLF
+ 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
- PCRE2_CONFIG_DEPTHLIMIT Default backtracking depth limit
.\" JOIN
PCRE2_CONFIG_JIT Availability of just-in-time compiler
support (1=yes 0=no)
@@ -41,6 +42,7 @@
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
Modified: code/trunk/doc/pcre2api.3
===================================================================
--- code/trunk/doc/pcre2api.3 2017-09-13 16:22:14 UTC (rev 861)
+++ code/trunk/doc/pcre2api.3 2017-09-16 11:39:38 UTC (rev 862)
@@ -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
@@ -1015,6 +1015,12 @@
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
The output is a uint32_t integer that gives the default limit for the depth of
@@ -1080,6 +1086,11 @@
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
The output is a uint32_t integer that gives the maximum depth of nesting
@@ -3574,6 +3585,6 @@
.rs
.sp
.nf
-Last updated: 10 July 2017
+Last updated: 16 September 2017
Copyright (c) 1997-2017 University of Cambridge.
.fi
Modified: code/trunk/src/pcre2.h
===================================================================
--- code/trunk/src/pcre2.h 2017-09-13 16:22:14 UTC (rev 861)
+++ code/trunk/src/pcre2.h 2017-09-16 11:39:38 UTC (rev 862)
@@ -338,7 +338,10 @@
#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. */
typedef uint8_t PCRE2_UCHAR8;
Modified: code/trunk/src/pcre2.h.in
===================================================================
--- code/trunk/src/pcre2.h.in 2017-09-13 16:22:14 UTC (rev 861)
+++ code/trunk/src/pcre2.h.in 2017-09-16 11:39:38 UTC (rev 862)
@@ -338,7 +338,10 @@
#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. */
typedef uint8_t PCRE2_UCHAR8;
Modified: code/trunk/src/pcre2_config.c
===================================================================
--- code/trunk/src/pcre2_config.c 2017-09-13 16:22:14 UTC (rev 861)
+++ code/trunk/src/pcre2_config.c 2017-09-16 11:39:38 UTC (rev 862)
@@ -84,11 +84,13 @@
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 @@
#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 @@
*((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;
Modified: code/trunk/src/pcre2test.c
===================================================================
--- code/trunk/src/pcre2test.c 2017-09-13 16:22:14 UTC (rev 861)
+++ code/trunk/src/pcre2test.c 2017-09-16 11:39:38 UTC (rev 862)
@@ -7807,15 +7807,11 @@
#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 @@
(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);