summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2007-03-09 15:23:02 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2007-03-09 15:23:02 +0000
commit4e77961b575749ee33aba57e5ff8541eea8d959a (patch)
tree3e781d8b93d6550e5472aec1977162a7d3d22413
parente5fdca3902baa3216086381cdcd6d84d2808b9b1 (diff)
downloadpcre-4e77961b575749ee33aba57e5ff8541eea8d959a.tar.gz
Tests cleanup: use -C in RunTest; add /Z to pcretest and make test 3
independent of link size. git-svn-id: svn://vcs.exim.org/pcre/code/trunk@116 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--ChangeLog18
-rw-r--r--Makefile.in3
-rw-r--r--RunGrepTest.in6
-rwxr-xr-xRunTest.in50
-rwxr-xr-xconfigure64
-rw-r--r--configure.ac7
-rw-r--r--doc/pcretest.16
-rw-r--r--pcre_compile.c2
-rw-r--r--pcre_printint.src25
-rw-r--r--pcretest.c4
-rw-r--r--testdata/testinput32
-rw-r--r--testdata/testoutput316
12 files changed, 114 insertions, 89 deletions
diff --git a/ChangeLog b/ChangeLog
index b1adf50..45e4fa8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -87,6 +87,24 @@ Version 7.1 05-Mar-07
matching a wide character, but failed, corruption could cause an
erroneous result when trying to check for a repeat of the original
character.
+
+13. Some tidying changes to the testing mechanism:
+
+ (a) The RunTest script now detects the internal link size and whether there
+ is UTF-8 and UCP support by running ./pcretest -C instead of relying on
+ values substituted by "configure". (The RunGrepTest script already did
+ this for UTF-8.) The configure.ac script no longer substitutes the
+ relevant variables.
+
+ (b) The debugging options /B and /D in pcretest show the compiled bytecode
+ with length and offset values. This means that the output is different
+ for different internal link sizes. Test 2 is skipped for link sizes
+ other than 2 because of this, bypassing the problem. Unfortunately,
+ there was also a test in test 3 (the locale tests) that used /B and
+ failed for link sizes other than 2. Rather than cut the whole test out,
+ I have added a new /Z option to pcretest that replaces the length and
+ offset values with spaces. This is now used to make test 3 independent
+ of link size.
Version 7.0 19-Dec-06
diff --git a/Makefile.in b/Makefile.in
index fcec7c5..6b8887f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -266,7 +266,6 @@ LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINK_SIZE = @LINK_SIZE@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
@@ -288,8 +287,6 @@ RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
-UCP = @UCP@
-UTF8 = @UTF8@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
diff --git a/RunGrepTest.in b/RunGrepTest.in
index efd2db1..f20b971 100644
--- a/RunGrepTest.in
+++ b/RunGrepTest.in
@@ -29,8 +29,10 @@ while [ $# -gt 0 ] ; do
shift
done
+# Check for the availability of UTF-8 support
+
./pcretest -C | ./pcregrep "No UTF-8 support" >/dev/null
-no_utf8=$?
+utf8=$?
echo "---------------------------- Test 1 ------------------------------" >testtry
$valgrind ./pcregrep PATTERN $testdata/grepinput >>testtry
@@ -218,7 +220,7 @@ if [ $? != 0 ] ; then exit 1; fi
# These tests require UTF-8 support
-if [ $no_utf8 -ne 0 ] ; then
+if [ $utf8 -ne 0 ] ; then
echo "Testing pcregrep UTF-8 features"
echo "---------------------------- Test U1 ------------------------------" >testtry
diff --git a/RunTest.in b/RunTest.in
index 9a431c8..3d6c0cf 100755
--- a/RunTest.in
+++ b/RunTest.in
@@ -3,9 +3,6 @@
# This file is generated by configure from RunTest.in. Make any changes
# to that file.
-# TODO: Replace use of variables @LINK_SIZE@, @UTF8@ and @UCP@ with
-# the data found from the output of 'pcretest -C' instead.
-
# Run PCRE tests
cf=diff
@@ -15,8 +12,23 @@ if [ ! -d testdata ] ; then
fi
testdata=./testdata
+# Find which optional facilities are available
+
+case `./pcretest -C | ./pcregrep 'Internal link size'` in
+ *2) link_size=2;;
+ *3) link_size=3;;
+ *4) link_size=4;;
+ *) echo "Failed to find internal link size"; exit 1;;
+esac
+
+./pcretest -C | ./pcregrep 'No UTF-8 support' >/dev/null
+utf8=$?
-# Select which tests to run; if no selection, run all
+./pcretest -C | ./pcregrep 'No Unicode properties support' >/dev/null
+ucp=$?
+
+# Select which tests to run; for those that are explicitly requested, check
+# that the necessary optional facilities are available.
do1=no
do2=no
@@ -45,7 +57,7 @@ while [ $# -gt 0 ] ; do
shift
done
-if [ "@LINK_SIZE@" != "2" ] ; then
+if [ "$link_size" != "2" ] ; then
if [ $do2 = yes ] ; then
echo "Can't run test 2 with an internal link size other than 2"
exit 1
@@ -60,7 +72,7 @@ if [ "@LINK_SIZE@" != "2" ] ; then
fi
fi
-if [ "@UTF8@" = "no" ] ; then
+if [ $utf8 -eq 0 ] ; then
if [ $do4 = yes ] ; then
echo "Can't run test 4 because UTF-8 support is not configured"
exit 1
@@ -83,7 +95,7 @@ if [ "@UTF8@" = "no" ] ; then
fi
fi
-if [ "@UCP@" = "no" ] ; then
+if [ $ucp -eq 0 ] ; then
if [ $do6 = yes ] ; then
echo "Can't run test 6 because Unicode property support is not configured"
exit 1
@@ -94,18 +106,20 @@ if [ "@UCP@" = "no" ] ; then
fi
fi
+# If no specific tests were requested, select all that are relevant.
+
if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \
$do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \
$do9 = no ] ; then
do1=yes
do2=yes
do3=yes
- if [ "@UTF8@" != "no" ] ; then do4=yes; fi
- if [ "@UTF8@" != "no" ] ; then do5=yes; fi
- if [ "@UTF8@" != "no" -a "@UCP@" != "no" ] ; then do6=yes; fi
+ if [ $utf8 -ne 0 ] ; then do4=yes; fi
+ if [ $utf8 -ne 0 ] ; then do5=yes; fi
+ if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do6=yes; fi
do7=yes
- if [ "@UTF8@" != "no" ] ; then do8=yes; fi
- if [ "@UTF8@" != "no" -a "@UCP@" != "no" ] ; then do9=yes; fi
+ if [ $utf8 -ne 0 ] ; then do8=yes; fi
+ if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi
fi
# Show which release
@@ -129,7 +143,7 @@ fi
# PCRE tests that are not Perl-compatible - API & error tests, mostly
if [ $do2 = yes ] ; then
- if [ "@LINK_SIZE@" = "2" ] ; then
+ if [ "$link_size" = "2" ] ; then
echo "Test 2: API and error handling (not Perl compatible)"
$valgrind ./pcretest -q $testdata/testinput2 testtry
if [ $? = 0 ] ; then
@@ -140,7 +154,7 @@ if [ $do2 = yes ] ; then
echo "OK"
echo " "
else
- echo Test 2 skipped for link size other than 2 \(@LINK_SIZE@\)
+ echo Test 2 skipped for link size other than 2 \($link_size\)
echo " "
fi
fi
@@ -187,7 +201,7 @@ if [ $do4 = yes ] ; then
fi
if [ $do5 = yes ] ; then
- if [ "@LINK_SIZE@" = "2" ] ; then
+ if [ "$link_size" = "2" ] ; then
echo "Test 5: API and internals for UTF-8 support (not Perl compatible)"
$valgrind ./pcretest -q $testdata/testinput5 testtry
if [ $? = 0 ] ; then
@@ -198,13 +212,13 @@ if [ $do5 = yes ] ; then
echo "OK"
echo " "
else
- echo Test 5 skipped for link size other than 2 \(@LINK_SIZE@\)
+ echo Test 5 skipped for link size other than 2 \($link_size\)
echo " "
fi
fi
if [ $do6 = yes ] ; then
- if [ "@LINK_SIZE@" = "2" ] ; then
+ if [ "$link_size" = "2" ] ; then
echo "Test 6: Unicode property support"
$valgrind ./pcretest -q $testdata/testinput6 testtry
if [ $? = 0 ] ; then
@@ -215,7 +229,7 @@ if [ $do6 = yes ] ; then
echo "OK"
echo " "
else
- echo Test 6 skipped for link size other than 2 \(@LINK_SIZE@\)
+ echo Test 6 skipped for link size other than 2 \($link_size\)
echo " "
fi
fi
diff --git a/configure b/configure
index e1bb9eb..de0624b 100755
--- a/configure
+++ b/configure
@@ -881,9 +881,6 @@ WITH_PCRE_CPP_TRUE
WITH_PCRE_CPP_FALSE
pcre_have_long_long
pcre_have_ulong_long
-LINK_SIZE
-UTF8
-UCP
EXTRA_LIBPCRE_LDFLAGS
EXTRA_LIBPCREPOSIX_LDFLAGS
EXTRA_LIBPCRECPP_LDFLAGS
@@ -4891,7 +4888,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 4894 "configure"' > conftest.$ac_ext
+ echo '#line 4891 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -7496,11 +7493,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7499: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7496: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:7503: \$? = $ac_status" >&5
+ echo "$as_me:7500: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -7764,11 +7761,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7767: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7764: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:7771: \$? = $ac_status" >&5
+ echo "$as_me:7768: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -7868,11 +7865,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7871: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7868: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:7875: \$? = $ac_status" >&5
+ echo "$as_me:7872: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -10213,7 +10210,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 10216 "configure"
+#line 10213 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10313,7 +10310,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 10316 "configure"
+#line 10313 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12649,11 +12646,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:12652: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:12649: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:12656: \$? = $ac_status" >&5
+ echo "$as_me:12653: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -12753,11 +12750,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:12756: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:12753: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:12760: \$? = $ac_status" >&5
+ echo "$as_me:12757: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -14360,11 +14357,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14363: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14360: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:14367: \$? = $ac_status" >&5
+ echo "$as_me:14364: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -14464,11 +14461,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14467: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14464: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:14471: \$? = $ac_status" >&5
+ echo "$as_me:14468: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -16699,11 +16696,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16702: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16699: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:16706: \$? = $ac_status" >&5
+ echo "$as_me:16703: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -16967,11 +16964,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16970: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16967: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:16974: \$? = $ac_status" >&5
+ echo "$as_me:16971: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -17071,11 +17068,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:17074: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:17071: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:17078: \$? = $ac_status" >&5
+ echo "$as_me:17075: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -21232,16 +21229,6 @@ _ACEOF
fi
-# Here is where pcre specific substs are handled
-# These 3 are only used by RunTest.in.
-# TODO: remove once RunTest uses pcretest -C instead.
-LINK_SIZE=$with_link_size
-
-UTF8=$enable_utf8
-
-UCP=$enable_unicode_properties
-
-
# Platform specific issues
NO_UNDEFINED=
EXPORT_ALL_SYMBOLS=
@@ -22099,9 +22086,6 @@ WITH_PCRE_CPP_TRUE!$WITH_PCRE_CPP_TRUE$ac_delim
WITH_PCRE_CPP_FALSE!$WITH_PCRE_CPP_FALSE$ac_delim
pcre_have_long_long!$pcre_have_long_long$ac_delim
pcre_have_ulong_long!$pcre_have_ulong_long$ac_delim
-LINK_SIZE!$LINK_SIZE$ac_delim
-UTF8!$UTF8$ac_delim
-UCP!$UCP$ac_delim
EXTRA_LIBPCRE_LDFLAGS!$EXTRA_LIBPCRE_LDFLAGS$ac_delim
EXTRA_LIBPCREPOSIX_LDFLAGS!$EXTRA_LIBPCREPOSIX_LDFLAGS$ac_delim
EXTRA_LIBPCRECPP_LDFLAGS!$EXTRA_LIBPCRECPP_LDFLAGS$ac_delim
@@ -22110,7 +22094,7 @@ LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 26; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 23; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
diff --git a/configure.ac b/configure.ac
index 9f6870b..606f882 100644
--- a/configure.ac
+++ b/configure.ac
@@ -342,13 +342,6 @@ if test "$enable_ebcdic" = "yes"; then
"configure", this can be done via --enable-ebcdic.])
fi
-# Here is where pcre specific substs are handled
-# These 3 are only used by RunTest.in.
-# TODO: remove once RunTest uses pcretest -C instead.
-AC_SUBST(LINK_SIZE, $with_link_size)
-AC_SUBST(UTF8, $enable_utf8)
-AC_SUBST(UCP, $enable_unicode_properties)
-
# Platform specific issues
NO_UNDEFINED=
EXPORT_ALL_SYMBOLS=
diff --git a/doc/pcretest.1 b/doc/pcretest.1
index 9e45b7a..7cb127f 100644
--- a/doc/pcretest.1
+++ b/doc/pcretest.1
@@ -214,7 +214,11 @@ the subject string. This is useful for tests where the subject contains
multiple copies of the same substring.
.P
The \fB/B\fP modifier is a debugging feature. It requests that \fBpcretest\fP
-output a representation of the compiled byte code after compilation.
+output a representation of the compiled byte code after compilation. Normally
+this information contains length and offset values; however, if \fB/Z\fP is
+also present, this data is replaced by spaces. This is a special feature for
+use in the automatic test scripts; it ensures that the same output is generated
+for different internal link sizes.
.P
The \fB/L\fP modifier must be followed directly by the name of a locale, for
example,
diff --git a/pcre_compile.c b/pcre_compile.c
index 404fc94..b1a907c 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -5417,7 +5417,7 @@ if ((re->options & PCRE_REQCHSET) != 0)
else printf("Req char = \\x%02x%s\n", ch, caseless);
}
-pcre_printint(re, stdout);
+pcre_printint(re, stdout, TRUE);
/* This check is done here in the debugging case so that the code that
was compiled can be seen. */
diff --git a/pcre_printint.src b/pcre_printint.src
index a0a293d..cca88b8 100644
--- a/pcre_printint.src
+++ b/pcre_printint.src
@@ -141,10 +141,13 @@ return (ptype == pvalue)? "??" : "??";
*************************************************/
/* Make this function work for a regex with integers either byte order.
-However, we assume that what we are passed is a compiled regex. */
+However, we assume that what we are passed is a compiled regex. The
+print_lengths flag controls whether offsets and lengths of items are printed.
+They can be turned off from pcretest so that automatic tests on bytecode can be
+written that do not depend on the value of LINK_SIZE. */
static void
-pcre_printint(pcre *external_re, FILE *f)
+pcre_printint(pcre *external_re, FILE *f, BOOL print_lengths)
{
real_pcre *re = (real_pcre *)external_re;
uschar *codestart, *code;
@@ -175,7 +178,10 @@ for(;;)
int c;
int extra = 0;
- fprintf(f, "%3d ", (int)(code - codestart));
+ if (print_lengths)
+ fprintf(f, "%3d ", (int)(code - codestart));
+ else
+ fprintf(f, " ");
switch(*code)
{
@@ -212,8 +218,9 @@ for(;;)
case OP_CBRA:
case OP_SCBRA:
- fprintf(f, "%3d %s %d", GET(code, 1), OP_names[*code],
- GET2(code, 1+LINK_SIZE));
+ if (print_lengths) fprintf(f, "%3d ", GET(code, 1));
+ else fprintf(f, " ");
+ fprintf(f, "%s %d", OP_names[*code], GET2(code, 1+LINK_SIZE));
break;
case OP_BRA:
@@ -230,7 +237,9 @@ for(;;)
case OP_COND:
case OP_SCOND:
case OP_REVERSE:
- fprintf(f, "%3d %s", GET(code, 1), OP_names[*code]);
+ if (print_lengths) fprintf(f, "%3d ", GET(code, 1));
+ else fprintf(f, " ");
+ fprintf(f, "%s", OP_names[*code]);
break;
case OP_CREF:
@@ -346,7 +355,9 @@ for(;;)
break;
case OP_RECURSE:
- fprintf(f, "%3d %s", GET(code, 1), OP_names[*code]);
+ if (print_lengths) fprintf(f, "%3d ", GET(code, 1));
+ else fprintf(f, " ");
+ fprintf(f, "%s", OP_names[*code]);
break;
case OP_REF:
diff --git a/pcretest.c b/pcretest.c
index 56b50a0..d85dcf6 100644
--- a/pcretest.c
+++ b/pcretest.c
@@ -944,6 +944,7 @@ while (!done)
size_t size, regex_gotten_store;
int do_study = 0;
int do_debug = debug;
+ int debug_lengths = 1;
int do_G = 0;
int do_g = 0;
int do_showinfo = showinfo;
@@ -1134,6 +1135,7 @@ while (!done)
case 'S': do_study = 1; break;
case 'U': options |= PCRE_UNGREEDY; break;
case 'X': options |= PCRE_EXTRA; break;
+ case 'Z': debug_lengths = 0;
case '8': options |= PCRE_UTF8; use_utf8 = 1; break;
case '?': options |= PCRE_NO_UTF8_CHECK; break;
@@ -1335,7 +1337,7 @@ while (!done)
if (do_debug)
{
fprintf(outfile, "------------------------------------------------------------------\n");
- pcre_printint(re, outfile);
+ pcre_printint(re, outfile, debug_lengths);
}
if (do_showinfo)
diff --git a/testdata/testinput3 b/testdata/testinput3
index e6ac826..1376c21 100644
--- a/testdata/testinput3
+++ b/testdata/testinput3
@@ -86,6 +86,6 @@
>>>\xaa<<<
>>>\xba<<<
-/[[:alpha:]][[:lower:]][[:upper:]]/DLfr_FR
+/[[:alpha:]][[:lower:]][[:upper:]]/DZLfr_FR
/ End of testinput3 /
diff --git a/testdata/testoutput3 b/testdata/testoutput3
index c539579..4bddb28 100644
--- a/testdata/testoutput3
+++ b/testdata/testoutput3
@@ -146,17 +146,17 @@ No match
>>>\xba<<<
0: º
-/[[:alpha:]][[:lower:]][[:upper:]]/DLfr_FR
+/[[:alpha:]][[:lower:]][[:upper:]]/DZLfr_FR
------------------------------------------------------------------
- 0 102 Bra 0
- 3 [A-Za-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\xff]
- 36 [a-z\xb5\xdf-\xf6\xf8-\xff]
- 69 [A-Z\xc0-\xd6\xd8-\xde]
-102 102 Ket
-105 End
+ Bra 0
+ [A-Za-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\xff]
+ [a-z\xb5\xdf-\xf6\xf8-\xff]
+ [A-Z\xc0-\xd6\xd8-\xde]
+ Ket
+ End
------------------------------------------------------------------
Capturing subpattern count = 0
-No options
+Options: utf8
No first char
No need char