Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 2 additions & 19 deletions RunTest
Original file line number Diff line number Diff line change
Expand Up @@ -337,19 +337,6 @@ while [ $# -gt 0 ] ; do
shift
done

# Find which optional facilities are available.

$sim $pcre2test -C linksize >/dev/null
link_size=$?
if [ $link_size -lt 2 ] ; then
echo "RunTest: Failed to find internal link size"
exit 1
fi
if [ $link_size -gt 4 ] ; then
echo "RunTest: Failed to find internal link size"
exit 1
fi

# If it is possible to set the system stack size and -bigstack was given,
# set up a large stack.

Expand Down Expand Up @@ -725,12 +712,8 @@ for bmode in "$test8" "$test16" "$test32"; do

if [ $do8 = yes ] ; then
echo $title8
bits_link_size=$link_size
if [ $bits = "16" -a $link_size = "3" ] ; then
bits_link_size=4
elif [ $bits = "32" ] ; then
bits_link_size=4
fi
$sim $pcre2test -$bits -C linksize >/dev/null
bits_link_size=$?
if [ $utf -eq 0 ] ; then
echo " Skipped because UTF-$bits support is not available"
else
Expand Down
16 changes: 4 additions & 12 deletions RunTest.bat
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
@echo off
@rem
@rem MS Windows batch file to run pcre2test on testfiles with the correct
@rem options. This file must use CRLF linebreaks to function properly,
@rem and requires both pcre2test and pcre2grep.
@rem options. This file must use CRLF linebreaks to function properly.
@rem
@rem ------------------------ HISTORY ----------------------------------
@rem This file was originally contributed to PCRE1 by Ralf Junker, and touched
Expand All @@ -14,7 +13,7 @@
@rem
@rem Sheri Pierce added logic to skip feature dependent tests
@rem tests 4 5 7 10 12 14 19 22 25 and 26 require Unicode support
@rem 8 requires Unicode and link size 2
@rem 8 requires Unicode
@rem 16 requires absence of jit support
@rem 17 requires presence of jit support
@rem Sheri P also added override tests for study and jit testing
Expand Down Expand Up @@ -57,8 +56,6 @@ call :conferror
exit /b 1
)

%pcre2test% -C linksize >NUL
set link_size=%ERRORLEVEL%
%pcre2test% -C pcre2-8 >NUL
set support8=%ERRORLEVEL%
%pcre2test% -C pcre2-16 >NUL
Expand Down Expand Up @@ -269,9 +266,8 @@ if [%3] == [] (
)

if %1 == 8 (
set bits_link_size=%link_size%
if %bits% EQU 16 if %link_size% EQU 3 set bits_link_size=4
if %bits% EQU 32 set bits_link_size=4
%pcre2test% -%bits% -C linksize >NUL
set bits_link_size=!ERRORLEVEL!
set outnum=%1-%bits%-!bits_link_size!
) else if %1 == 11 (
set outnum=%1-%bits%
Expand Down Expand Up @@ -379,10 +375,6 @@ if %unicode% EQU 0 (
goto :eof

:do8
if NOT %link_size% EQU 2 (
echo Test 8 Skipped because link size is not 2.
goto :eof
)
if %unicode% EQU 0 (
echo Test 8 Skipped due to absence of Unicode support.
goto :eof
Expand Down
2 changes: 1 addition & 1 deletion doc/index.html.src
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ in the library.
<td>Free a compile context</td></tr>

<tr><td><a href="pcre2_config.html">pcre2_config</a></td>
<td>Show build-time configuration options</td></tr>
<td>Show build-time related configuration options</td></tr>

<tr><td><a href="pcre2_convert_context_copy.html">pcre2_convert_context_copy</a></td>
<td>Copy a convert context</td></tr>
Expand Down
53 changes: 27 additions & 26 deletions doc/pcre2_config.3
Original file line number Diff line number Diff line change
Expand Up @@ -29,36 +29,37 @@ PCRE2_CONFIG_UNICODE_VERSION, and PCRE2_CONFIG_VERSION it must point to a
buffer that is large enough to hold the string. For all other codes it must
point to a uint32_t integer variable. The available codes are:
.sp
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_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_EFFECTIVE_LINKSIZE How many bytes are used for link size
PCRE2_CONFIG_HEAPLIMIT Default heap memory limit
.\" JOIN
PCRE2_CONFIG_JIT Availability of just-in-time compiler
support (1=yes 0=no)
PCRE2_CONFIG_JIT Availability of just-in-time compiler
support (1=yes 0=no)
.\" JOIN
PCRE2_CONFIG_JITTARGET Information (a string) about the target
architecture for the JIT compiler
PCRE2_CONFIG_LINKSIZE Configured internal link size (2, 3, 4)
PCRE2_CONFIG_MATCHLIMIT Default internal resource limit
PCRE2_CONFIG_JITTARGET Information (a string) about the target
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
PCRE2_NEWLINE_CRLF
PCRE2_NEWLINE_ANY
PCRE2_NEWLINE_ANYCRLF
PCRE2_NEWLINE_NUL
PCRE2_CONFIG_PARENSLIMIT Default parentheses nesting limit
PCRE2_CONFIG_RECURSIONLIMIT Obsolete: use PCRE2_CONFIG_DEPTHLIMIT
PCRE2_CONFIG_STACKRECURSE Obsolete: always returns 0
PCRE2_CONFIG_NEWLINE Code for the default newline sequence:
PCRE2_NEWLINE_CR
PCRE2_NEWLINE_LF
PCRE2_NEWLINE_CRLF
PCRE2_NEWLINE_ANY
PCRE2_NEWLINE_ANYCRLF
PCRE2_NEWLINE_NUL
PCRE2_CONFIG_PARENSLIMIT Default parentheses nesting limit
PCRE2_CONFIG_RECURSIONLIMIT Obsolete: use PCRE2_CONFIG_DEPTHLIMIT
PCRE2_CONFIG_STACKRECURSE Obsolete: always returns 0
.\" JOIN
PCRE2_CONFIG_UNICODE Availability of Unicode support (1=yes
0=no)
PCRE2_CONFIG_UNICODE_VERSION The Unicode version (a string)
PCRE2_CONFIG_VERSION The PCRE2 version (a string)
PCRE2_CONFIG_UNICODE Availability of Unicode support
(1=yes 0=no)
PCRE2_CONFIG_UNICODE_VERSION The Unicode version (a string)
PCRE2_CONFIG_VERSION The PCRE2 version (a string)
.sp
The function yields a non-negative value on success or the negative value
PCRE2_ERROR_BADOPTION otherwise. This is also the result for the
Expand Down
24 changes: 16 additions & 8 deletions doc/pcre2api.3
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ compiled patterns on disc or elsewhere, and reloading them later.
.P
Finally, there are functions for finding out information about a compiled
pattern (\fBpcre2_pattern_info()\fP) and about the configuration with which
PCRE2 was built (\fBpcre2_config()\fP).
PCRE2 was built (\fBpcre2_config()\fP) and that it is using.
.P
Functions with names ending with \fB_free()\fP are used for freeing memory
blocks of various sorts. In all cases, if one of these functions is called with
Expand Down Expand Up @@ -1265,6 +1265,13 @@ The output is a uint32_t integer that gives the default limit for the depth of
nested backtracking in \fBpcre2_match()\fP or the depth of nested recursions,
lookarounds, and atomic groups in \fBpcre2_dfa_match()\fP. Further details are
given with \fBpcre2_set_depth_limit()\fP above.
.sp
PCRE2_CONFIG_EFFECTIVE_LINKSIZE
.sp
The output is a uint32_t integer that contains the number of bytes the library
uses for internal linkage in compiled regular expressions. Its value is derived
from the value that was provided at build time and that is described below by
PCRE2_CONFIG_LINKSIZE.
.sp
PCRE2_CONFIG_HEAPLIMIT
.sp
Expand Down Expand Up @@ -1300,13 +1307,14 @@ for the terminating zero.
.sp
PCRE2_CONFIG_LINKSIZE
.sp
The output is a uint32_t integer that contains the number of bytes used for
internal linkage in compiled regular expressions. When PCRE2 is configured, the
value can be set to 2, 3, or 4, with the default being 2. This is the value
that is returned by \fBpcre2_config()\fP. However, when the 16-bit library is
compiled, a value of 3 is rounded up to 4, and when the 32-bit library is
compiled, internal linkages always use 4 bytes, so the configured value is not
relevant.
The output is a uint32_t integer that contains the number of bytes the library
was instructed to use for internal linkage in compiled regular expressions.
When PCRE2 is configured, the value can be set to 2, 3, or 4, with the default
being 2 for most libraries.
.P
The actual number of bytes used depends on the size of the code units that the
library supports and can be higher. See PCRE2_CONFIG_EFFECTIVE_LINKSIZE above
for details.
.P
The default value of 2 for the 8-bit and 16-bit libraries is sufficient for all
but the most massive patterns, since it allows the size of the compiled pattern
Expand Down
1 change: 1 addition & 0 deletions src/pcre2.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ released, the numbers must not be changed. */
#define PCRE2_CONFIG_NEVER_BACKSLASH_C 13
#define PCRE2_CONFIG_COMPILED_WIDTHS 14
#define PCRE2_CONFIG_TABLES_LENGTH 15
#define PCRE2_CONFIG_EFFECTIVE_LINKSIZE 16

/* Optimization directives for pcre2_set_optimize().
For binary compatibility, only add to this list; do not renumber. */
Expand Down
17 changes: 11 additions & 6 deletions src/pcre2_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,15 @@ pcre2_config(uint32_t what, void *where)
{
if (where == NULL) /* Requests a length */
{
switch(what)
switch (what)
{
default:
return PCRE2_ERROR_BADOPTION;

case PCRE2_CONFIG_BSR:
case PCRE2_CONFIG_COMPILED_WIDTHS:
case PCRE2_CONFIG_DEPTHLIMIT:
case PCRE2_CONFIG_EFFECTIVE_LINKSIZE:
case PCRE2_CONFIG_HEAPLIMIT:
case PCRE2_CONFIG_JIT:
case PCRE2_CONFIG_LINKSIZE:
Expand Down Expand Up @@ -117,13 +118,13 @@ switch (what)
case PCRE2_CONFIG_COMPILED_WIDTHS:
*((uint32_t *)where) = 0
#ifdef SUPPORT_PCRE2_8
+ 1
+ (1 << 0)
#endif
#ifdef SUPPORT_PCRE2_16
+ 2
+ (1 << 1)
#endif
#ifdef SUPPORT_PCRE2_32
+ 4
+ (1 << 2)
#endif
;
break;
Expand All @@ -132,6 +133,10 @@ switch (what)
*((uint32_t *)where) = MATCH_LIMIT_DEPTH;
break;

case PCRE2_CONFIG_EFFECTIVE_LINKSIZE:
*((uint32_t *)where) = LINK_SIZE * sizeof(PCRE2_UCHAR);
break;

case PCRE2_CONFIG_HEAPLIMIT:
*((uint32_t *)where) = HEAP_LIMIT;
break;
Expand Down Expand Up @@ -199,8 +204,7 @@ switch (what)
#endif
return (int)(1 + ((where == NULL)?
strlen(v) : PRIV(strcpy_c8)((PCRE2_UCHAR *)where, v)));
}
break;
}

case PCRE2_CONFIG_UNICODE:
#if defined SUPPORT_UNICODE
Expand Down Expand Up @@ -237,6 +241,7 @@ switch (what)
return (int)(1 + ((where == NULL)?
strlen(v) : PRIV(strcpy_c8)((PCRE2_UCHAR *)where, v)));
}

}

return 0;
Expand Down
Loading
Loading