summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--COPYING2
-rw-r--r--ChangeLog273
-rw-r--r--LICENCE2
-rw-r--r--Makefile.in14
-rw-r--r--NEWS30
-rw-r--r--NON-UNIX-USE24
-rw-r--r--README31
-rw-r--r--RunGrepTest.in28
-rw-r--r--RunTest.bat20
-rwxr-xr-xRunTest.in2
-rwxr-xr-xconfigure7142
-rw-r--r--configure.ac13
-rw-r--r--dftables.c11
-rw-r--r--doc/Tech.Notes144
-rw-r--r--doc/html/pcre.html32
-rw-r--r--doc/html/pcre_compile.html6
-rw-r--r--doc/html/pcre_compile2.html1
-rw-r--r--doc/html/pcre_config.html6
-rw-r--r--doc/html/pcre_copy_substring.html2
-rw-r--r--doc/html/pcre_dfa_exec.html13
-rw-r--r--doc/html/pcre_exec.html5
-rw-r--r--doc/html/pcre_fullinfo.html2
-rw-r--r--doc/html/pcre_get_named_substring.html7
-rw-r--r--doc/html/pcre_get_stringnumber.html5
-rw-r--r--doc/html/pcre_get_stringtable_entries.html2
-rw-r--r--doc/html/pcre_get_substring.html7
-rw-r--r--doc/html/pcre_get_substring_list.html10
-rw-r--r--doc/html/pcreapi.html199
-rw-r--r--doc/html/pcrebuild.html20
-rw-r--r--doc/html/pcrecompat.html50
-rw-r--r--doc/html/pcrecpp.html52
-rw-r--r--doc/html/pcregrep.html44
-rw-r--r--doc/html/pcrematching.html67
-rw-r--r--doc/html/pcrepartial.html26
-rw-r--r--doc/html/pcrepattern.html500
-rw-r--r--doc/html/pcreperform.html85
-rw-r--r--doc/html/pcreposix.html2
-rw-r--r--doc/html/pcreprecompile.html15
-rw-r--r--doc/html/pcrestack.html22
-rw-r--r--doc/html/pcretest.html129
-rw-r--r--doc/pcre.331
-rw-r--r--doc/pcre.txt2068
-rw-r--r--doc/pcre_compile.36
-rw-r--r--doc/pcre_compile2.31
-rw-r--r--doc/pcre_config.36
-rw-r--r--doc/pcre_copy_substring.32
-rw-r--r--doc/pcre_dfa_exec.313
-rw-r--r--doc/pcre_exec.37
-rw-r--r--doc/pcre_fullinfo.32
-rw-r--r--doc/pcre_get_named_substring.37
-rw-r--r--doc/pcre_get_stringnumber.35
-rw-r--r--doc/pcre_get_stringtable_entries.34
-rw-r--r--doc/pcre_get_substring.37
-rw-r--r--doc/pcre_get_substring_list.310
-rw-r--r--doc/pcreapi.3198
-rw-r--r--doc/pcrebuild.320
-rw-r--r--doc/pcrecompat.345
-rw-r--r--doc/pcrecpp.324
-rw-r--r--doc/pcregrep.142
-rw-r--r--doc/pcregrep.txt142
-rw-r--r--doc/pcrematching.361
-rw-r--r--doc/pcrepartial.326
-rw-r--r--doc/pcrepattern.3420
-rw-r--r--doc/pcreperform.387
-rw-r--r--doc/pcreposix.32
-rw-r--r--doc/pcreprecompile.314
-rw-r--r--doc/pcrestack.321
-rw-r--r--doc/pcretest.1122
-rw-r--r--doc/pcretest.txt328
-rw-r--r--libpcre.a.dev299
-rw-r--r--libpcrecpp.pc.in12
-rw-r--r--pcre.h14
-rw-r--r--pcre_compile.c3277
-rw-r--r--pcre_dfa_exec.c515
-rw-r--r--pcre_exec.c892
-rw-r--r--pcre_get.c1
-rw-r--r--pcre_globals.c15
-rw-r--r--pcre_internal.h375
-rw-r--r--pcre_maketables.c2
-rw-r--r--pcre_newline.c135
-rw-r--r--pcre_printint.src80
-rw-r--r--pcre_scanner.cc31
-rw-r--r--pcre_scanner.h18
-rw-r--r--pcre_scanner_unittest.cc26
-rw-r--r--pcre_study.c115
-rw-r--r--pcre_tables.c10
-rw-r--r--pcre_ucp_searchfuncs.c14
-rw-r--r--pcre_valid_utf8.c2
-rw-r--r--pcre_version.c30
-rw-r--r--pcrecpp.cc56
-rw-r--r--pcrecpp.h44
-rw-r--r--pcrecpp_unittest.cc113
-rw-r--r--pcrecpparg.h.in22
-rw-r--r--pcregrep.c313
-rw-r--r--pcreposix.c12
-rw-r--r--pcretest.c247
-rw-r--r--testdata/grepinput811
-rw-r--r--testdata/grepoutput18
-rw-r--r--testdata/grepoutput810
-rw-r--r--testdata/testinput1151
-rw-r--r--testdata/testinput21229
-rw-r--r--testdata/testinput43
-rw-r--r--testdata/testinput584
-rw-r--r--testdata/testinput615
-rw-r--r--testdata/testinput7127
-rw-r--r--testdata/testinput853
-rw-r--r--testdata/testoutput1242
-rw-r--r--testdata/testoutput23235
-rw-r--r--testdata/testoutput36
-rw-r--r--testdata/testoutput44
-rw-r--r--testdata/testoutput5572
-rw-r--r--testdata/testoutput624
-rw-r--r--testdata/testoutput7238
-rw-r--r--testdata/testoutput8110
-rw-r--r--ucp.h11
-rw-r--r--ucpinternal.h5
-rw-r--r--ucptable.c158
117 files changed, 17078 insertions, 8664 deletions
diff --git a/COPYING b/COPYING
index daea2e4..58241b2 100644
--- a/COPYING
+++ b/COPYING
@@ -4,7 +4,7 @@ PCRE LICENCE
PCRE is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language.
-Release 6 of PCRE is distributed under the terms of the "BSD" licence, as
+Release 7 of PCRE is distributed under the terms of the "BSD" licence, as
specified below. The documentation for PCRE, supplied in the "doc"
directory, is distributed under the same terms as the software itself.
diff --git a/ChangeLog b/ChangeLog
index 2a14134..7d32804 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,279 @@
ChangeLog for PCRE
------------------
+Version 7.0 19-Dec-06
+---------------------
+
+ 1. Fixed a signed/unsigned compiler warning in pcre_compile.c, shown up by
+ moving to gcc 4.1.1.
+
+ 2. The -S option for pcretest uses setrlimit(); I had omitted to #include
+ sys/time.h, which is documented as needed for this function. It doesn't
+ seem to matter on Linux, but it showed up on some releases of OS X.
+
+ 3. It seems that there are systems where bytes whose values are greater than
+ 127 match isprint() in the "C" locale. The "C" locale should be the
+ default when a C program starts up. In most systems, only ASCII printing
+ characters match isprint(). This difference caused the output from pcretest
+ to vary, making some of the tests fail. I have changed pcretest so that:
+
+ (a) When it is outputting text in the compiled version of a pattern, bytes
+ other than 32-126 are always shown as hex escapes.
+
+ (b) When it is outputting text that is a matched part of a subject string,
+ it does the same, unless a different locale has been set for the match
+ (using the /L modifier). In this case, it uses isprint() to decide.
+
+ 4. Fixed a major bug that caused incorrect computation of the amount of memory
+ required for a compiled pattern when options that changed within the
+ pattern affected the logic of the preliminary scan that determines the
+ length. The relevant options are -x, and -i in UTF-8 mode. The result was
+ that the computed length was too small. The symptoms of this bug were
+ either the PCRE error "internal error: code overflow" from pcre_compile(),
+ or a glibc crash with a message such as "pcretest: free(): invalid next
+ size (fast)". Examples of patterns that provoked this bug (shown in
+ pcretest format) are:
+
+ /(?-x: )/x
+ /(?x)(?-x: \s*#\s*)/
+ /((?i)[\x{c0}])/8
+ /(?i:[\x{c0}])/8
+
+ HOWEVER: Change 17 below makes this fix obsolete as the memory computation
+ is now done differently.
+
+ 5. Applied patches from Google to: (a) add a QuoteMeta function to the C++
+ wrapper classes; (b) implement a new function in the C++ scanner that is
+ more efficient than the old way of doing things because it avoids levels of
+ recursion in the regex matching; (c) add a paragraph to the documentation
+ for the FullMatch() function.
+
+ 6. The escape sequence \n was being treated as whatever was defined as
+ "newline". Not only was this contrary to the documentation, which states
+ that \n is character 10 (hex 0A), but it also went horribly wrong when
+ "newline" was defined as CRLF. This has been fixed.
+
+ 7. In pcre_dfa_exec.c the value of an unsigned integer (the variable called c)
+ was being set to -1 for the "end of line" case (supposedly a value that no
+ character can have). Though this value is never used (the check for end of
+ line is "zero bytes in current character"), it caused compiler complaints.
+ I've changed it to 0xffffffff.
+
+ 8. In pcre_version.c, the version string was being built by a sequence of
+ C macros that, in the event of PCRE_PRERELEASE being defined as an empty
+ string (as it is for production releases) called a macro with an empty
+ argument. The C standard says the result of this is undefined. The gcc
+ compiler treats it as an empty string (which was what was wanted) but it is
+ reported that Visual C gives an error. The source has been hacked around to
+ avoid this problem.
+
+ 9. On the advice of a Windows user, included <io.h> and <fcntl.h> in Windows
+ builds of pcretest, and changed the call to _setmode() to use _O_BINARY
+ instead of 0x8000. Made all the #ifdefs test both _WIN32 and WIN32 (not all
+ of them did).
+
+10. Originally, pcretest opened its input and output without "b"; then I was
+ told that "b" was needed in some environments, so it was added for release
+ 5.0 to both the input and output. (It makes no difference on Unix-like
+ systems.) Later I was told that it is wrong for the input on Windows. I've
+ now abstracted the modes into two macros, to make it easier to fiddle with
+ them, and removed "b" from the input mode under Windows.
+
+11. Added pkgconfig support for the C++ wrapper library, libpcrecpp.
+
+12. Added -help and --help to pcretest as an official way of being reminded
+ of the options.
+
+13. Removed some redundant semicolons after macro calls in pcrecpparg.h.in
+ and pcrecpp.cc because they annoy compilers at high warning levels.
+
+14. A bit of tidying/refactoring in pcre_exec.c in the main bumpalong loop.
+
+15. Fixed an occurrence of == in configure.ac that should have been = (shell
+ scripts are not C programs :-) and which was not noticed because it works
+ on Linux.
+
+16. pcretest is supposed to handle any length of pattern and data line (as one
+ line or as a continued sequence of lines) by extending its input buffer if
+ necessary. This feature was broken for very long pattern lines, leading to
+ a string of junk being passed to pcre_compile() if the pattern was longer
+ than about 50K.
+
+17. I have done a major re-factoring of the way pcre_compile() computes the
+ amount of memory needed for a compiled pattern. Previously, there was code
+ that made a preliminary scan of the pattern in order to do this. That was
+ OK when PCRE was new, but as the facilities have expanded, it has become
+ harder and harder to keep it in step with the real compile phase, and there
+ have been a number of bugs (see for example, 4 above). I have now found a
+ cunning way of running the real compile function in a "fake" mode that
+ enables it to compute how much memory it would need, while actually only
+ ever using a few hundred bytes of working memory and without too many
+ tests of the mode. This should make future maintenance and development
+ easier. A side effect of this work is that the limit of 200 on the nesting
+ depth of parentheses has been removed (though this was never a serious
+ limitation, I suspect). However, there is a downside: pcre_compile() now
+ runs more slowly than before (30% or more, depending on the pattern). I
+ hope this isn't a big issue. There is no effect on runtime performance.
+
+18. Fixed a minor bug in pcretest: if a pattern line was not terminated by a
+ newline (only possible for the last line of a file) and it was a
+ pattern that set a locale (followed by /Lsomething), pcretest crashed.
+
+19. Added additional timing features to pcretest. (1) The -tm option now times
+ matching only, not compiling. (2) Both -t and -tm can be followed, as a
+ separate command line item, by a number that specifies the number of
+ repeats to use when timing. The default is 50000; this gives better
+ precision, but takes uncomfortably long for very large patterns.
+
+20. Extended pcre_study() to be more clever in cases where a branch of a
+ subpattern has no definite first character. For example, (a*|b*)[cd] would
+ previously give no result from pcre_study(). Now it recognizes that the
+ first character must be a, b, c, or d.
+
+21. There was an incorrect error "recursive call could loop indefinitely" if
+ a subpattern (or the entire pattern) that was being tested for matching an
+ empty string contained only one non-empty item after a nested subpattern.
+ For example, the pattern (?>\x{100}*)\d(?R) provoked this error
+ incorrectly, because the \d was being skipped in the check.
+
+22. The pcretest program now has a new pattern option /B and a command line
+ option -b, which is equivalent to adding /B to every pattern. This causes
+ it to show the compiled bytecode, without the additional information that
+ -d shows. The effect of -d is now the same as -b with -i (and similarly, /D
+ is the same as /B/I).
+
+23. A new optimization is now able automatically to treat some sequences such
+ as a*b as a*+b. More specifically, if something simple (such as a character
+ or a simple class like \d) has an unlimited quantifier, and is followed by
+ something that cannot possibly match the quantified thing, the quantifier
+ is automatically "possessified".
+
+24. A recursive reference to a subpattern whose number was greater than 39
+ went wrong under certain circumstances in UTF-8 mode. This bug could also
+ have affected the operation of pcre_study().
+
+25. Realized that a little bit of performance could be had by replacing
+ (c & 0xc0) == 0xc0 with c >= 0xc0 when processing UTF-8 characters.
+
+26. Timing data from pcretest is now shown to 4 decimal places instead of 3.
+
+27. Possessive quantifiers such as a++ were previously implemented by turning
+ them into atomic groups such as ($>a+). Now they have their own opcodes,
+ which improves performance. This includes the automatically created ones
+ from 23 above.
+
+28. A pattern such as (?=(\w+))\1: which simulates an atomic group using a
+ lookahead was broken if it was not anchored. PCRE was mistakenly expecting
+ the first matched character to be a colon. This applied both to named and
+ numbered groups.
+
+29. The ucpinternal.h header file was missing its idempotency #ifdef.
+
+30. I was sent a "project" file called libpcre.a.dev which I understand makes
+ building PCRE on Windows easier, so I have included it in the distribution.
+
+31. There is now a check in pcretest against a ridiculously large number being
+ returned by pcre_exec() or pcre_dfa_exec(). If this happens in a /g or /G
+ loop, the loop is abandoned.
+
+32. Forward references to subpatterns in conditions such as (?(2)...) where
+ subpattern 2 is defined later cause pcre_compile() to search forwards in
+ the pattern for the relevant set of parentheses. This search went wrong
+ when there were unescaped parentheses in a character class, parentheses
+ escaped with \Q...\E, or parentheses in a #-comment in /x mode.
+
+33. "Subroutine" calls and backreferences were previously restricted to
+ referencing subpatterns earlier in the regex. This restriction has now
+ been removed.
+
+34. Added a number of extra features that are going to be in Perl 5.10. On the
+ whole, these are just syntactic alternatives for features that PCRE had
+ previously implemented using the Python syntax or my own invention. The
+ other formats are all retained for compatibility.
+
+ (a) Named groups can now be defined as (?<name>...) or (?'name'...) as well
+ as (?P<name>...). The new forms, as well as being in Perl 5.10, are
+ also .NET compatible.
+
+ (b) A recursion or subroutine call to a named group can now be defined as
+ (?&name) as well as (?P>name).
+
+ (c) A backreference to a named group can now be defined as \k<name> or
+ \k'name' as well as (?P=name). The new forms, as well as being in Perl
+ 5.10, are also .NET compatible.
+
+ (d) A conditional reference to a named group can now use the syntax
+ (?(<name>) or (?('name') as well as (?(name).
+
+ (e) A "conditional group" of the form (?(DEFINE)...) can be used to define
+ groups (named and numbered) that are never evaluated inline, but can be
+ called as "subroutines" from elsewhere. In effect, the DEFINE condition
+ is always false. There may be only one alternative in such a group.
+
+ (f) A test for recursion can be given as (?(R1).. or (?(R&name)... as well
+ as the simple (?(R). The condition is true only if the most recent
+ recursion is that of the given number or name. It does not search out
+ through the entire recursion stack.
+
+ (g) The escape \gN or \g{N} has been added, where N is a positive or
+ negative number, specifying an absolute or relative reference.
+
+35. Tidied to get rid of some further signed/unsigned compiler warnings and
+ some "unreachable code" warnings.
+
+36. Updated the Unicode property tables to Unicode version 5.0.0. Amongst other
+ things, this adds five new scripts.
+
+37. Perl ignores orphaned \E escapes completely. PCRE now does the same.
+ There were also incompatibilities regarding the handling of \Q..\E inside
+ character classes, for example with patterns like [\Qa\E-\Qz\E] where the
+ hyphen was adjacent to \Q or \E. I hope I've cleared all this up now.
+
+38. Like Perl, PCRE detects when an indefinitely repeated parenthesized group
+ matches an empty string, and forcibly breaks the loop. There were bugs in
+ this code in non-simple cases. For a pattern such as ^(a()*)* matched
+ against aaaa the result was just "a" rather than "aaaa", for example. Two
+ separate and independent bugs (that affected different cases) have been
+ fixed.
+
+39. Refactored the code to abolish the use of different opcodes for small
+ capturing bracket numbers. This is a tidy that I avoided doing when I
+ removed the limit on the number of capturing brackets for 3.5 back in 2001.
+ The new approach is not only tidier, it makes it possible to reduce the
+ memory needed to fix the previous bug (38).
+
+40. Implemented PCRE_NEWLINE_ANY to recognize any of the Unicode newline
+ sequences (http://unicode.org/unicode/reports/tr18/) as "newline" when
+ processing dot, circumflex, or dollar metacharacters, or #-comments in /x
+ mode.
+
+41. Add \R to match any Unicode newline sequence, as suggested in the Unicode
+ report.
+
+42. Applied patch, originally from Ari Pollak, modified by Google, to allow
+ copy construction and assignment in the C++ wrapper.
+
+43. Updated pcregrep to support "--newline=any". In the process, I fixed a
+ couple of bugs that could have given wrong results in the "--newline=crlf"
+ case.
+
+44. Added a number of casts and did some reorganization of signed/unsigned int
+ variables following suggestions from Dair Grant. Also renamed the variable
+ "this" as "item" because it is a C++ keyword.
+
+45. Arranged for dftables to add
+
+ #include "pcre_internal.h"
+
+ to pcre_chartables.c because without it, gcc 4.x may remove the array
+ definition from the final binary if PCRE is built into a static library and
+ dead code stripping is activated.
+
+46. For an unanchored pattern, if a match attempt fails at the start of a
+ newline sequence, and the newline setting is CRLF or ANY, and the next two
+ characters are CRLF, advance by two characters instead of one.
+
+
Version 6.7 04-Jul-06
---------------------
diff --git a/LICENCE b/LICENCE
index daea2e4..58241b2 100644
--- a/LICENCE
+++ b/LICENCE
@@ -4,7 +4,7 @@ PCRE LICENCE
PCRE is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language.
-Release 6 of PCRE is distributed under the terms of the "BSD" licence, as
+Release 7 of PCRE is distributed under the terms of the "BSD" licence, as
specified below. The documentation for PCRE, supplied in the "doc"
directory, is distributed under the same terms as the software itself.
diff --git a/Makefile.in b/Makefile.in
index 5563608..7a24fa1 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -131,6 +131,7 @@ OBJ = pcre_chartables.@OBJEXT@ \
pcre_globals.@OBJEXT@ \
pcre_info.@OBJEXT@ \
pcre_maketables.@OBJEXT@ \
+ pcre_newline.@OBJEXT@ \
pcre_ord2utf8.@OBJEXT@ \
pcre_refcount.@OBJEXT@ \
pcre_study.@OBJEXT@ \
@@ -152,6 +153,7 @@ LOBJ = pcre_chartables.lo \
pcre_globals.lo \
pcre_info.lo \
pcre_maketables.lo \
+ pcre_newline.lo \
pcre_ord2utf8.lo \
pcre_refcount.lo \
pcre_study.lo \
@@ -275,6 +277,11 @@ pcre_maketables.@OBJEXT@: Makefile config.h $(top_srcdir)/pcre.h \
@$(LTCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \
$(top_srcdir)/pcre_maketables.c
+pcre_newline.@OBJEXT@: Makefile config.h $(top_srcdir)/pcre.h \
+ $(top_srcdir)/pcre_internal.h $(top_srcdir)/pcre_newline.c
+ @$(LTCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \
+ $(top_srcdir)/pcre_newline.c
+
pcre_ord2utf8.@OBJEXT@: Makefile config.h $(top_srcdir)/pcre.h \
$(top_srcdir)/pcre_internal.h $(top_srcdir)/pcre_ord2utf8.c
@$(LTCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \
@@ -303,6 +310,7 @@ pcre_try_flipped.@OBJEXT@: Makefile config.h $(top_srcdir)/pcre.h \
pcre_ucp_searchfuncs.@OBJEXT@: Makefile config.h $(top_srcdir)/pcre.h \
$(top_srcdir)/pcre_internal.h \
$(top_srcdir)/pcre_ucp_searchfuncs.c \
+ $(top_srcdir)/ucpinternal.h \
$(top_srcdir)/ucptable.c
@$(LTCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \
$(top_srcdir)/pcre_ucp_searchfuncs.c
@@ -516,6 +524,7 @@ install: all @ON_WINDOWS@ wininstall
$(INSTALL) pcre-config $(DESTDIR)$(BINDIR)/pcre-config
$(mkinstalldirs) $(DESTDIR)$(LIBDIR)/pkgconfig
$(INSTALL_DATA) libpcre.pc $(DESTDIR)$(LIBDIR)/pkgconfig/libpcre.pc
+ $(INSTALL_DATA) libpcrecpp.pc $(DESTDIR)$(LIBDIR)/pkgconfig/libpcrecpp.pc
# The uninstall target removes all the files that were installed.
@@ -568,7 +577,8 @@ uninstall:; -rm -rf \
$(DESTDIR)$(BINDIR)/pcregrep@EXEEXT@ \
$(DESTDIR)$(BINDIR)/pcretest@EXEEXT@ \
$(DESTDIR)$(BINDIR)/pcre-config \
- $(DESTDIR)$(LIBDIR)/pkgconfig/libpcre.pc
+ $(DESTDIR)$(LIBDIR)/pkgconfig/libpcre.pc \
+ $(DESTDIR)$(LIBDIR)/pkgconfig/libpcrecpp.pc
# We deliberately omit dftables and pcre_chartables.c from 'make clean'; once
# made pcre_chartables.c shouldn't change, and if people have edited the tables
@@ -580,7 +590,7 @@ clean:; -rm -rf *.@OBJEXT@ *.lo *.a *.la .libs pcretest@EXEEXT@ pcre_str
distclean: clean
-rm -f pcre_chartables.c libtool pcre-config libpcre.pc \
- pcre_stringpiece.h pcrecpparg.h \
+ libpcrecpp.pc pcre_stringpiece.h pcrecpparg.h \
dftables@EXEEXT@ RunGrepTest RunTest \
Makefile config.h config.status config.log config.cache
diff --git a/NEWS b/NEWS
index 4f17b19..92768ea 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,36 @@
News about PCRE releases
------------------------
+Release 7.0 23-Nov-06
+---------------------
+
+This release has a new major number because there have been some internal
+upheavals to facilitate the addition of new optimizations and other facilities,
+and to make subsequent maintenance and extension easier. Compilation is likely
+to be a bit slower, but there should be no major effect on runtime performance.
+Previously compiled patterns are NOT upwards compatible with this release. If
+you have saved compiled patterns from a previous release, you will have to
+re-compile them. Important changes that are visible to users are:
+
+1. The Unicode property tables have been updated to Unicode 5.0.0, which adds
+ some more scripts.
+
+2. The option PCRE_NEWLINE_ANY causes PCRE to recognize any Unicode newline
+ sequence as a newline.
+
+3. The \R escape matches a single Unicode newline sequence as a single unit.
+
+4. New features that will appear in Perl 5.10 are now in PCRE. These include
+ alternative Perl syntax for named parentheses, and Perl syntax for
+ recursion.
+
+5. The C++ wrapper interface has been extended by the addition of a
+ QuoteMeta function and the ability to allow copy construction and
+ assignment.
+
+For a complete list of changes, see the ChangeLog file.
+
+
Release 6.7 04-Jul-06
---------------------
diff --git a/NON-UNIX-USE b/NON-UNIX-USE
index 459bdf2..bcc0dc9 100644
--- a/NON-UNIX-USE
+++ b/NON-UNIX-USE
@@ -22,7 +22,7 @@ The following are generic comments about building PCRE. The interspersed
indented commands are suggestions from Mark Tetrode as to which commands you
might use on a Windows system to build a static library.
-(1) Copy or rename the file config.in as config.h, and change the macros that
+(1) Copy or rename the file config.h.in as config.h, and change the macros that
define HAVE_STRERROR and HAVE_MEMMOVE to define them as 1 rather than 0.
Unfortunately, because of the way Unix autoconf works, the default setting has
to be 0. You may also want to make changes to other macros in config.h. In
@@ -31,7 +31,7 @@ the NEWLINE macro. The default is to use '\n', thereby using whatever value
your compiler gives to '\n'.
rem Mark Tetrode's commands
- copy config.in config.h
+ copy config.h.in config.h
rem Use write, because notepad cannot handle UNIX files. Change values.
write config.h
@@ -56,6 +56,7 @@ character tables and writes them to that file.
pcre_globals.c
pcre_info.c
pcre_maketables.c
+ pcre_newline.c
pcre_ord2utf8.c
pcre_refcount.c
pcre_study.c
@@ -93,10 +94,10 @@ pcre and pcreposix libraries when linking.
cl /F0x400000 pcretest.c pcre.lib pcreposix.lib
(6) Run pcretest on the testinput files in the testdata directory, and check
-that the output matches the corresponding testoutput files. You must use the
--i option when checking testinput2. Note that the supplied files are in Unix
-format, with just LF characters as line terminators. You may need to edit them
-to change this if your system uses a different convention.
+that the output matches the corresponding testoutput files. Note that the
+supplied files are in Unix format, with just LF characters as line terminators.
+You may need to edit them to change this if your system uses a different
+convention.
rem Mark Tetrode's commands
pcretest testdata\testinput1 testdata\myoutput1
@@ -135,6 +136,17 @@ If you have a system without "configure" but where you can use a Makefile, edit
Makefile.in to create Makefile, substituting suitable values for the variables
at the head of the file.
+Michael Roy sent these comments about building PCRE under Windows with BCC5.5:
+
+ Some of the core BCC libraries have a version of PCRE from 1998 built in,
+ which can lead to pcre_exec() giving an erroneous PCRE_ERROR_NULL from a
+ version mismatch. I'm including an easy workaround below, if you'd like to
+ include it in the non-unix instructions:
+
+ When linking a project with BCC5.5, pcre.lib must be included before any of
+ the libraries cw32.lib, cw32i.lib, cw32mt.lib, and cw32mti.lib on the command
+ line.
+
Some help in building a Win32 DLL of PCRE in GnuWin32 environments was
contributed by Paul Sokolovsky. These environments are Mingw32
(http://www.xraylith.wisc.edu/~khan/software/gnu-win32/) and CygWin
diff --git a/README b/README
index 24d0b97..55e8fd0 100644
--- a/README
+++ b/README
@@ -118,13 +118,13 @@ library. You can read more about them in the pcrebuild man page.
property table); only the basic two-letter properties such as Lu are
supported.
-. You can build PCRE to recognize either CR or LF or the sequence CRLF as
- indicating the end of a line. Whatever you specify at build time is the
- default; the caller of PCRE can change the selection at run time. The default
- newline indicator is a single LF character (the Unix standard). You can
- specify the default newline indicator by adding --newline-is-cr or
- --newline-is-lf or --newline-is-crlf to the "configure" command,
- respectively.
+. You can build PCRE to recognize either CR or LF or the sequence CRLF or any
+ of the Unicode newline sequences as indicating the end of a line. Whatever
+ you specify at build time is the default; the caller of PCRE can change the
+ selection at run time. The default newline indicator is a single LF character
+ (the Unix standard). You can specify the default newline indicator by adding
+ --newline-is-cr or --newline-is-lf or --newline-is-crlf or --newline-is-any
+ to the "configure" command, respectively.
. When called via the POSIX interface, PCRE uses malloc() to get additional
storage for processing capturing parentheses if there are more than 10 of
@@ -283,7 +283,7 @@ to the values of CC and CFLAGS.
Using HP's ANSI C++ compiler (aCC)
----------------------------------
-Unless C++ support is disabled by specifiying the "--disable-cpp" option of the
+Unless C++ support is disabled by specifying the "--disable-cpp" option of the
"configure" script, you *must* include the "-AA" option in the CXXFLAGS
environment variable in order for the C++ components to compile correctly.
@@ -305,8 +305,8 @@ PCRE in the same way as for Unix systems.
PCRE has been compiled on Windows systems and on Macintoshes, but I don't know
the details because I don't use those systems. It should be straightforward to
-build PCRE on any system that has a Standard C compiler, because it uses only
-Standard C functions.
+build PCRE on any system that has a Standard C compiler and library, because it
+uses only Standard C functions.
Testing PCRE
@@ -325,15 +325,15 @@ NON-UNIX-USE.
The RunTest script runs the pcretest test program (which is documented in its
own man page) on each of the testinput files (in the testdata directory) in
turn, and compares the output with the contents of the corresponding testoutput
-file. A file called testtry is used to hold the main output from pcretest
+files. A file called testtry is used to hold the main output from pcretest
(testsavedregex is also used as a working file). To run pcretest on just one of
the test files, give its number as an argument to RunTest, for example:
RunTest 2
-The first file can also be fed directly into the perltest script to check that
-Perl gives the same results. The only difference you should see is in the first
-few lines, where the Perl version is given instead of the PCRE version.
+The first test file can also be fed directly into the perltest script to check
+that Perl gives the same results. The only difference you should see is in the
+first few lines, where the Perl version is given instead of the PCRE version.
The second set of tests check pcre_fullinfo(), pcre_info(), pcre_study(),
pcre_copy_substring(), pcre_get_substring(), pcre_get_substring_list(), error
@@ -442,6 +442,7 @@ The distribution should contain the following files:
pcre_globals.c ) and some internal functions that they use
pcre_info.c )
pcre_maketables.c )
+ pcre_newline.c )
pcre_ord2utf8.c )
pcre_refcount.c )
pcre_study.c )
@@ -525,4 +526,4 @@ The distribution should contain the following files:
Philip Hazel
Email local part: ph10
Email domain: cam.ac.uk
-June 2006
+November 2006
diff --git a/RunGrepTest.in b/RunGrepTest.in
index 86ada8d..e2586b9 100644
--- a/RunGrepTest.in
+++ b/RunGrepTest.in
@@ -25,6 +25,9 @@ while [ $# -gt 0 ] ; do
shift
done
+./pcretest -C | ./pcregrep "No UTF-8 support" >/dev/null
+no_utf8=$?
+
echo "---------------------------- Test 1 ------------------------------" >testtry
$valgrind ./pcregrep PATTERN $testdata/grepinput >>testtry
@@ -200,9 +203,32 @@ echo "---------------------------- Test 53 ------------------------------" >>tes
$valgrind ./pcregrep --newline=crlf -F "xxx
jkl" $testdata/grepinputx >>testtry
+echo "---------------------------- Test 54 ------------------------------" >>testtry
+$valgrind ./pcregrep -n --newline=any "^(abc|def|ghi|jkl)" $testdata/grepinputx >>testtry
+
# Now compare the results.
$cf testtry $testdata/grepoutput
-if [ $? != 0 ] ; then exit 1; else exit 0; fi
+if [ $? != 0 ] ; then exit 1; fi
+
+# These tests require UTF-8 support
+
+if [ $no_utf8 -ne 0 ] ; then
+ echo "Testing pcregrep UTF-8 features"
+
+ echo "---------------------------- Test U1 ------------------------------" >testtry
+ $valgrind ./pcregrep -n -u --newline=any "^X" $testdata/grepinput8 >>testtry
+
+ echo "---------------------------- Test U2 ------------------------------" >>testtry
+ $valgrind ./pcregrep -n -u -C 3 --newline=any "Match" $testdata/grepinput8 >>testtry
+
+ $cf testtry $testdata/grepoutput8
+ if [ $? != 0 ] ; then exit 1; fi
+
+else
+ echo "Skipping pcregrep UTF-8 tests: no UTF-8 support in PCRE library"
+fi
+
+exit 0
# End
diff --git a/RunTest.bat b/RunTest.bat
new file mode 100644
index 0000000..f9b3519
--- /dev/null
+++ b/RunTest.bat
@@ -0,0 +1,20 @@
+rem This file was contributed by Ralf Junker.
+rem
+rem MS Windows batch file to run pcretest on testfiles with the correct options.
+rem
+rem Assumes that this file as well as pcretest.exe is located in the PCRE root folder.
+rem
+rem Output written to a newly generated subfolder named "testdata".
+
+if not exist .\testout\ md .\testout\
+
+pcretest -q testdata\testinput1 > testout\testoutput1
+pcretest -q testdata\testinput2 > testout\testoutput2
+pcretest -q testdata\testinput3 > testout\testoutput3
+pcretest -q testdata\testinput4 > testout\testoutput4
+pcretest -q testdata\testinput5 > testout\testoutput5
+pcretest -q testdata\testinput6 > testout\testoutput6
+pcretest -q -dfa testdata\testinput7 > testout\testoutput7
+pcretest -q -dfa testdata\testinput8 > testout\testoutput8
+pcretest -q -dfa testdata\testinput9 > testout\testoutput9
+
diff --git a/RunTest.in b/RunTest.in
index f6518ed..2b3ba70 100755
--- a/RunTest.in
+++ b/RunTest.in
@@ -128,7 +128,7 @@ fi
if [ $do2 = yes ] ; then
if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then
echo "Test 2: API and error handling (not Perl compatible)"
- $valgrind ./pcretest -q -i $testdata/testinput2 testtry
+ $valgrind ./pcretest -q $testdata/testinput2 testtry
if [ $? = 0 ] ; then
$cf testtry $testdata/testoutput2
if [ $? != 0 ] ; then exit 1; fi
diff --git a/configure b/configure
index cd0a4ca..5c129eb 100755
--- a/configure
+++ b/configure
@@ -1,8 +1,9 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59.
+# Generated by GNU Autoconf 2.60.
#
-# Copyright (C) 2003 Free Software Foundation, Inc.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## --------------------- ##
@@ -16,11 +17,35 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
DUALCASE=1; export DUALCASE # for MKS sh
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
# Support unset when possible.
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
as_unset=unset
@@ -29,8 +54,43 @@ else
fi
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
PS1='$ '
PS2='> '
PS4='+ '
@@ -44,18 +104,19 @@ do
if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
- $as_unset $as_var
+ ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
fi
done
# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
@@ -63,157 +124,386 @@ fi
# Name of the executable.
-as_me=`$as_basename "$0" ||
+as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)$' \| \
- . : '\(.\)' 2>/dev/null ||
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+# CDPATH.
+$as_unset CDPATH
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
+if test "x$CONFIG_SHELL" = x; then
+ if (eval ":") 2>/dev/null; then
+ as_have_required=yes
+else
+ as_have_required=no
fi
+ if test $as_have_required = yes && (eval ":
+(as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" || {
- # Find who we are. Look in the path if we contain no path at all
- # relative or not.
- case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
- ;;
- esac
- # We did not find ourselves, most probably we were run as `sh COMMAND'
- # in which case we are not to be found in the path.
- if test "x$as_myself" = x; then
- as_myself=$0
- fi
- if test ! -f "$as_myself"; then
- { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
- { (exit 1); exit 1; }; }
- fi
- case $CONFIG_SHELL in
- '')
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+ as_lineno_1=\$LINENO
+ as_lineno_2=\$LINENO
+ test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+ test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+ :
+else
+ as_candidate_shells=
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+for as_dir in /usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for as_base in sh bash ksh sh5; do
- case $as_dir in
+ case $as_dir in
/*)
- if ("$as_dir/$as_base" -c '
+ for as_base in sh bash ksh sh5; do
+ as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+ done;;
+ esac
+done
+IFS=$as_save_IFS
+
+
+ for as_shell in $as_candidate_shells $SHELL; do
+ # Try only shells that exist, to save several forks.
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { ("$as_shell") 2> /dev/null <<\_ASEOF
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+:
+_ASEOF
+}; then
+ CONFIG_SHELL=$as_shell
+ as_have_required=yes
+ if { "$as_shell" 2> /dev/null <<\_ASEOF
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+:
+(as_func_return () {
+ (exit $1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
as_lineno_1=$LINENO
as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
- $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
- $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
- CONFIG_SHELL=$as_dir/$as_base
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" ${1+"$@"}
- fi;;
- esac
- done
-done
-;;
- esac
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+ break
+fi
+
+fi
+
+ done
+
+ if test "x$CONFIG_SHELL" != x; then
+ for as_var in BASH_ENV ENV
+ do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ done
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+ if test $as_have_required = no; then
+ echo This script requires a shell more modern than all the
+ echo shells that I found on your system. Please install a
+ echo modern shell, or manually run the script under such a
+ echo shell if you do have one.
+ { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0") || {
+ echo No shell found that supports shell functions.
+ echo Please tell autoconf@gnu.org about your system,
+ echo including any error possibly output before this
+ echo message
+}
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
# Create $as_me.lineno as a copy of $as_myself, but with $LINENO
# uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line before each line; the second 'sed' does the real
- # work. The second script uses 'N' to pair each line-number line
- # with the numbered line, and appends trailing '-' during
- # substitution so that $LINENO is not a special case at line end.
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
# (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
- sed '=' <$as_myself |
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
N
- s,$,-,
- : loop
- s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
t loop
- s,-$,,
- s,^['$as_cr_digits']*\n,,
+ s/-\n.*//
' >$as_me.lineno &&
- chmod +x $as_me.lineno ||
+ chmod +x "$as_me.lineno" ||
{ echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
{ (exit 1); exit 1; }; }
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
# Exit status is that of the last command.
exit
}
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
esac
-if expr a : '\(a\)' >/dev/null 2>&1; then
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir
+fi
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
- # We could just check for DJGPP; but this test a) works b) is more generic
- # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
- if test -f conf$$.exe; then
- # Don't use ln at all; we don't have any links
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -p'
- else
- as_ln_s='ln -s'
- fi
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
fi
-rm -f conf$$ conf$$.exe conf$$.file
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
if mkdir -p . 2>/dev/null; then
as_mkdir_p=:
@@ -222,7 +512,19 @@ else
as_mkdir_p=false
fi
-as_executable_p="test -f"
+# Find out whether ``test -x'' works. Don't use a zero-byte file, as
+# systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+ as_executable_p="test -x"
+else
+ as_executable_p=:
+fi
+rm -f conf$$.file
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -231,15 +533,6 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
# Check that we are running under the correct shell.
@@ -395,29 +688,26 @@ tagnames=${tagnames+${tagnames},}CXX
tagnames=${tagnames+${tagnames},}F77
+exec 7<&0 </dev/null 6>&1
+
# Name of the host.
# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
-exec 6>&1
-
#
# Initializations.
#
ac_default_prefix=/usr/local
+ac_clean_files=
ac_config_libobj_dir=.
+LIBOBJS=
cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-# This variable seems obsolete. It should probably be removed, and
-# only ac_max_sed_lines should be used.
-: ${ac_max_here_lines=38}
-
# Identity of this package.
PACKAGE_NAME=
PACKAGE_TARNAME=
@@ -455,17 +745,140 @@ ac_includes_default="\
#endif
#if HAVE_INTTYPES_H
# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-# include <stdint.h>
-# endif
+#endif
+#if HAVE_STDINT_H
+# include <stdint.h>
#endif
#if HAVE_UNISTD_H
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP DLLTOOL ac_ct_DLLTOOL AS ac_ct_AS OBJDUMP ac_ct_OBJDUMP CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL pcre_have_bits_type_traits pcre_have_type_traits MAYBE_CPP_TARGETS HAVE_CPP pcre_have_long_long pcre_have_ulong_long BUILD_EXEEXT BUILD_OBJEXT CC_FOR_BUILD CXX_FOR_BUILD CFLAGS_FOR_BUILD CXXFLAGS_FOR_BUILD CXXLDFLAGS EBCDIC HAVE_MEMMOVE HAVE_STRERROR LINK_SIZE MATCH_LIMIT MATCH_LIMIT_RECURSION NEWLINE NO_RECURSE PCRE_LIB_VERSION PCRE_POSIXLIB_VERSION PCRE_CPPLIB_VERSION PCRE_VERSION POSIX_MALLOC_THRESHOLD UCP UTF8 WIN_PREFIX ON_WINDOWS NOT_ON_WINDOWS POSIX_OBJ POSIX_LOBJ POSIX_LIB LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL
+PATH_SEPARATOR
+PACKAGE_NAME
+PACKAGE_TARNAME
+PACKAGE_VERSION
+PACKAGE_STRING
+PACKAGE_BUGREPORT
+exec_prefix
+prefix
+program_transform_name
+bindir
+sbindir
+libexecdir
+datarootdir
+datadir
+sysconfdir
+sharedstatedir
+localstatedir
+includedir
+oldincludedir
+docdir
+infodir
+htmldir
+dvidir
+pdfdir
+psdir
+libdir
+localedir
+mandir
+DEFS
+ECHO_C
+ECHO_N
+ECHO_T
+LIBS
+build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+ac_ct_CC
+EXEEXT
+OBJEXT
+CXX
+CXXFLAGS
+ac_ct_CXX
+INSTALL_PROGRAM
+INSTALL_SCRIPT
+INSTALL_DATA
+build
+build_cpu
+build_vendor
+build_os
+host
+host_cpu
+host_vendor
+host_os
+GREP
+EGREP
+LN_S
+ECHO
+AR
+RANLIB
+STRIP
+DLLTOOL
+AS
+OBJDUMP
+CPP
+CXXCPP
+F77
+FFLAGS
+ac_ct_F77
+LIBTOOL
+pcre_have_bits_type_traits
+pcre_have_type_traits
+MAYBE_CPP_TARGETS
+HAVE_CPP
+pcre_have_long_long
+pcre_have_ulong_long
+BUILD_EXEEXT
+BUILD_OBJEXT
+CC_FOR_BUILD
+CXX_FOR_BUILD
+CFLAGS_FOR_BUILD
+CXXFLAGS_FOR_BUILD
+CXXLDFLAGS
+EBCDIC
+HAVE_MEMMOVE
+HAVE_STRERROR
+LINK_SIZE
+MATCH_LIMIT
+MATCH_LIMIT_RECURSION
+NEWLINE
+NO_RECURSE
+PCRE_LIB_VERSION
+PCRE_POSIXLIB_VERSION
+PCRE_CPPLIB_VERSION
+PCRE_VERSION
+POSIX_MALLOC_THRESHOLD
+UCP
+UTF8
+WIN_PREFIX
+ON_WINDOWS
+NOT_ON_WINDOWS
+POSIX_OBJ
+POSIX_LOBJ
+POSIX_LIB
+LIBOBJS
+LTLIBOBJS'
ac_subst_files=''
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+CXX
+CXXFLAGS
+CCC
+CPP
+CXXCPP
+F77
+FFLAGS'
+
# Initialize some variables set by options.
ac_init_help=
@@ -492,34 +905,48 @@ x_libraries=NONE
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
includedir='${prefix}/include'
oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
+docdir='${datarootdir}/doc/${PACKAGE}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
ac_prev=
+ac_dashdash=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
- eval "$ac_prev=\$ac_option"
+ eval $ac_prev=\$ac_option
ac_prev=
continue
fi
- ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+ case $ac_option in
+ *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *) ac_optarg=yes ;;
+ esac
# Accept the important Cygnus configure options, so we can diagnose typos.
- case $ac_option in
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
@@ -541,12 +968,18 @@ do
--config-cache | -C)
cache_file=config.cache ;;
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ -datadir | --datadir | --datadi | --datad)
ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
datadir=$ac_optarg ;;
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
-disable-* | --disable-*)
ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
@@ -554,7 +987,17 @@ do
{ echo "$as_me: error: invalid feature name: $ac_feature" >&2
{ (exit 1); exit 1; }; }
ac_feature=`echo $ac_feature | sed 's/-/_/g'`
- eval "enable_$ac_feature=no" ;;
+ eval enable_$ac_feature=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
-enable-* | --enable-*)
ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
@@ -563,11 +1006,7 @@ do
{ echo "$as_me: error: invalid feature name: $ac_feature" >&2
{ (exit 1); exit 1; }; }
ac_feature=`echo $ac_feature | sed 's/-/_/g'`
- case $ac_option in
- *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_$ac_feature='$ac_optarg'" ;;
+ eval enable_$ac_feature=\$ac_optarg ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -594,6 +1033,12 @@ do
-host=* | --host=* | --hos=* | --ho=*)
host_alias=$ac_optarg ;;
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
@@ -618,13 +1063,16 @@ do
| --libexe=* | --libex=* | --libe=*)
libexecdir=$ac_optarg ;;
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
-localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
+ | --localstate | --localstat | --localsta | --localst | --locals)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
@@ -689,6 +1137,16 @@ do
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name=$ac_optarg ;;
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
@@ -745,11 +1203,7 @@ do
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
ac_package=`echo $ac_package| sed 's/-/_/g'`
- case $ac_option in
- *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
- esac
- eval "with_$ac_package='$ac_optarg'" ;;
+ eval with_$ac_package=\$ac_optarg ;;
-without-* | --without-*)
ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
@@ -758,7 +1212,7 @@ do
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
ac_package=`echo $ac_package | sed 's/-/_/g'`
- eval "with_$ac_package=no" ;;
+ eval with_$ac_package=no ;;
--x)
# Obsolete; use --with-x.
@@ -789,8 +1243,7 @@ Try \`$0 --help' for more information." >&2
expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid variable name: $ac_envvar" >&2
{ (exit 1); exit 1; }; }
- ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
- eval "$ac_envvar='$ac_optarg'"
+ eval $ac_envvar=\$ac_optarg
export $ac_envvar ;;
*)
@@ -810,27 +1263,19 @@ if test -n "$ac_prev"; then
{ (exit 1); exit 1; }; }
fi
-# Be sure to have absolute paths.
-for ac_var in exec_prefix prefix
+# Be sure to have absolute directory names.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
do
- eval ac_val=$`echo $ac_var`
+ eval ac_val=\$$ac_var
case $ac_val in
- [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
- *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; };;
- esac
-done
-
-# Be sure to have absolute paths.
-for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
- localstatedir libdir includedir oldincludedir infodir mandir
-do
- eval ac_val=$`echo $ac_var`
- case $ac_val in
- [\\/$]* | ?:[\\/]* ) ;;
- *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; };;
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
esac
+ { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; }
done
# There might be people who depend on the old broken behavior: `$host'
@@ -857,22 +1302,43 @@ test -n "$host_alias" && ac_tool_prefix=$host_alias-
test "$silent" = yes && exec 6>/dev/null
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ { echo "$as_me: error: Working directory cannot be determined" >&2
+ { (exit 1); exit 1; }; }
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ { echo "$as_me: error: pwd does not report name of working directory" >&2
+ { (exit 1); exit 1; }; }
+
+
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
- # Try the directory containing this script, then its parent.
- ac_confdir=`(dirname "$0") 2>/dev/null ||
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$0" ||
$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$0" : 'X\(//\)[^/]' \| \
X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$0" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
srcdir=$ac_confdir
if test ! -r "$srcdir/$ac_unique_file"; then
srcdir=..
@@ -881,70 +1347,31 @@ else
ac_srcdir_defaulted=no
fi
if test ! -r "$srcdir/$ac_unique_file"; then
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
- { (exit 1); exit 1; }; }
- else
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
{ (exit 1); exit 1; }; }
- fi
fi
-(cd $srcdir && test -r "./$ac_unique_file") 2>/dev/null ||
- { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
{ (exit 1); exit 1; }; }
-srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
-ac_env_build_alias_set=${build_alias+set}
-ac_env_build_alias_value=$build_alias
-ac_cv_env_build_alias_set=${build_alias+set}
-ac_cv_env_build_alias_value=$build_alias
-ac_env_host_alias_set=${host_alias+set}
-ac_env_host_alias_value=$host_alias
-ac_cv_env_host_alias_set=${host_alias+set}
-ac_cv_env_host_alias_value=$host_alias
-ac_env_target_alias_set=${target_alias+set}
-ac_env_target_alias_value=$target_alias
-ac_cv_env_target_alias_set=${target_alias+set}
-ac_cv_env_target_alias_value=$target_alias
-ac_env_CC_set=${CC+set}
-ac_env_CC_value=$CC
-ac_cv_env_CC_set=${CC+set}
-ac_cv_env_CC_value=$CC
-ac_env_CFLAGS_set=${CFLAGS+set}
-ac_env_CFLAGS_value=$CFLAGS
-ac_cv_env_CFLAGS_set=${CFLAGS+set}
-ac_cv_env_CFLAGS_value=$CFLAGS
-ac_env_LDFLAGS_set=${LDFLAGS+set}
-ac_env_LDFLAGS_value=$LDFLAGS
-ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
-ac_cv_env_LDFLAGS_value=$LDFLAGS
-ac_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_env_CPPFLAGS_value=$CPPFLAGS
-ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_cv_env_CPPFLAGS_value=$CPPFLAGS
-ac_env_CXX_set=${CXX+set}
-ac_env_CXX_value=$CXX
-ac_cv_env_CXX_set=${CXX+set}
-ac_cv_env_CXX_value=$CXX
-ac_env_CXXFLAGS_set=${CXXFLAGS+set}
-ac_env_CXXFLAGS_value=$CXXFLAGS
-ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set}
-ac_cv_env_CXXFLAGS_value=$CXXFLAGS
-ac_env_CPP_set=${CPP+set}
-ac_env_CPP_value=$CPP
-ac_cv_env_CPP_set=${CPP+set}
-ac_cv_env_CPP_value=$CPP
-ac_env_CXXCPP_set=${CXXCPP+set}
-ac_env_CXXCPP_value=$CXXCPP
-ac_cv_env_CXXCPP_set=${CXXCPP+set}
-ac_cv_env_CXXCPP_value=$CXXCPP
-ac_env_F77_set=${F77+set}
-ac_env_F77_value=$F77
-ac_cv_env_F77_set=${F77+set}
-ac_cv_env_F77_value=$F77
-ac_env_FFLAGS_set=${FFLAGS+set}
-ac_env_FFLAGS_value=$FFLAGS
-ac_cv_env_FFLAGS_set=${FFLAGS+set}
-ac_cv_env_FFLAGS_value=$FFLAGS
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
#
# Report the --help message.
@@ -973,9 +1400,6 @@ Configuration:
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or \`..']
-_ACEOF
-
- cat <<_ACEOF
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[$ac_default_prefix]
@@ -993,15 +1417,22 @@ Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data [PREFIX/share]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
- --infodir=DIR info documentation [PREFIX/info]
- --mandir=DIR man documentation [PREFIX/man]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
_ACEOF
cat <<\_ACEOF
@@ -1020,10 +1451,8 @@ Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-cpp disable C++ support
- --enable-shared[=PKGS]
- build shared libraries [default=yes]
- --enable-static[=PKGS]
- build static libraries [default=yes]
+ --enable-shared[=PKGS] build shared libraries [default=yes]
+ --enable-static[=PKGS] build static libraries [default=yes]
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
@@ -1032,6 +1461,7 @@ Optional Features:
--enable-newline-is-cr use CR as the newline character
--enable-newline-is-lf use LF as the newline character
--enable-newline-is-crlf use CRLF as the newline sequence
+ --enable-newline-is-any use any Unicode newline sequence
--enable-ebcdic assume EBCDIC coding rather than ASCII
--disable-stack-for-recursion disable use of stack recursion when matching
@@ -1041,8 +1471,7 @@ Optional Packages:
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
--with-pic try to use only PIC/non-PIC objects [default=use
both]
- --with-tags[=TAGS]
- include additional configurations [automatic]
+ --with-tags[=TAGS] include additional configurations [automatic]
--with-posix-malloc-threshold=10 threshold for POSIX malloc usage
--with-link-size=2 internal link size (2, 3, or 4 allowed)
--with-match-limit=10000000 default limit on internal looping
@@ -1053,8 +1482,8 @@ Some influential environment variables:
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
- CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
- headers in a nonstandard directory <include dir>
+ CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
CXX C++ compiler command
CXXFLAGS C++ compiler flags
CPP C preprocessor
@@ -1066,118 +1495,86 @@ Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
_ACEOF
+ac_status=$?
fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
- ac_popdir=`pwd`
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
- test -d $ac_dir || continue
+ test -d "$ac_dir" || continue
ac_builddir=.
-if test "$ac_dir" != .; then
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
case $srcdir in
- .) # No --srcdir option. We are building in place.
+ .) # We are building in place.
ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
-
- cd $ac_dir
- # Check for guested configure; otherwise get Cygnus style configure.
- if test -f $ac_srcdir/configure.gnu; then
- echo
- $SHELL $ac_srcdir/configure.gnu --help=recursive
- elif test -f $ac_srcdir/configure; then
- echo
- $SHELL $ac_srcdir/configure --help=recursive
- elif test -f $ac_srcdir/configure.ac ||
- test -f $ac_srcdir/configure.in; then
- echo
- $ac_configure --help
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
else
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
- fi
- cd $ac_popdir
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
done
fi
-test -n "$ac_init_help" && exit 0
+test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
+configure
+generated by GNU Autoconf 2.60
-Copyright (C) 2003 Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
- exit 0
+ exit
fi
-exec 5>config.log
-cat >&5 <<_ACEOF
+cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by $as_me, which was
-generated by GNU Autoconf 2.59. Invocation command line was
+generated by GNU Autoconf 2.60. Invocation command line was
$ $0 $@
_ACEOF
+exec 5>>config.log
{
cat <<_ASUNAME
## --------- ##
@@ -1196,7 +1593,7 @@ uname -v = `(uname -v) 2>/dev/null || echo unknown`
/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
@@ -1210,6 +1607,7 @@ do
test -z "$as_dir" && as_dir=.
echo "PATH: $as_dir"
done
+IFS=$as_save_IFS
} >&5
@@ -1231,7 +1629,6 @@ _ACEOF
ac_configure_args=
ac_configure_args0=
ac_configure_args1=
-ac_sep=
ac_must_keep_next=false
for ac_pass in 1 2
do
@@ -1242,7 +1639,7 @@ do
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
continue ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ *\'*)
ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
@@ -1264,9 +1661,7 @@ do
-* ) ac_must_keep_next=true ;;
esac
fi
- ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
- # Get rid of the leading space.
- ac_sep=" "
+ ac_configure_args="$ac_configure_args '$ac_arg'"
;;
esac
done
@@ -1277,8 +1672,8 @@ $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
# would cause problems or look ugly.
-# WARNING: Be sure not to use single quotes in there, as some shells,
-# such as our DU 5.0 friend, will then `close' the trap.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
trap 'exit_status=$?
# Save into config.log some information that might help in debugging.
{
@@ -1291,20 +1686,34 @@ trap 'exit_status=$?
_ASBOX
echo
# The following way of writing the cache mishandles newlines in values,
-{
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
(set) 2>&1 |
- case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
sed -n \
- "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
- ;;
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
*)
- sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
- esac;
-}
+ esac |
+ sort
+)
echo
cat <<\_ASBOX
@@ -1315,22 +1724,28 @@ _ASBOX
echo
for ac_var in $ac_subst_vars
do
- eval ac_val=$`echo $ac_var`
- echo "$ac_var='"'"'$ac_val'"'"'"
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ echo "$ac_var='\''$ac_val'\''"
done | sort
echo
if test -n "$ac_subst_files"; then
cat <<\_ASBOX
-## ------------- ##
-## Output files. ##
-## ------------- ##
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
_ASBOX
echo
for ac_var in $ac_subst_files
do
- eval ac_val=$`echo $ac_var`
- echo "$ac_var='"'"'$ac_val'"'"'"
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ echo "$ac_var='\''$ac_val'\''"
done | sort
echo
fi
@@ -1342,26 +1757,24 @@ _ASBOX
## ----------- ##
_ASBOX
echo
- sed "/^$/d" confdefs.h | sort
+ cat confdefs.h
echo
fi
test "$ac_signal" != 0 &&
echo "$as_me: caught signal $ac_signal"
echo "$as_me: exit $exit_status"
} >&5
- rm -f core *.core &&
- rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
- ' 0
+' 0
for ac_signal in 1 2 13 15; do
trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
done
ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo >confdefs.h
+rm -f -r conftest* confdefs.h
# Predefined preprocessor variables.
@@ -1392,14 +1805,17 @@ _ACEOF
# Let the site file select an alternate cache file if it wants to.
# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
+if test -n "$CONFIG_SITE"; then
+ set x "$CONFIG_SITE"
+elif test "x$prefix" != xNONE; then
+ set x "$prefix/share/config.site" "$prefix/etc/config.site"
+else
+ set x "$ac_default_prefix/share/config.site" \
+ "$ac_default_prefix/etc/config.site"
fi
-for ac_site_file in $CONFIG_SITE; do
+shift
+for ac_site_file
+do
if test -r "$ac_site_file"; then
{ echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
echo "$as_me: loading site script $ac_site_file" >&6;}
@@ -1415,8 +1831,8 @@ if test -r "$cache_file"; then
{ echo "$as_me:$LINENO: loading cache $cache_file" >&5
echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
- [\\/]* | ?:[\\/]* ) . $cache_file;;
- *) . ./$cache_file;;
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
esac
fi
else
@@ -1428,12 +1844,11 @@ fi
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
-for ac_var in `(set) 2>&1 |
- sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+for ac_var in $ac_precious_vars; do
eval ac_old_set=\$ac_cv_env_${ac_var}_set
eval ac_new_set=\$ac_env_${ac_var}_set
- eval ac_old_val="\$ac_cv_env_${ac_var}_value"
- eval ac_new_val="\$ac_env_${ac_var}_value"
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
case $ac_old_set,$ac_new_set in
set,)
{ echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
@@ -1458,8 +1873,7 @@ echo "$as_me: current value: $ac_new_val" >&2;}
# Pass precious variables to config.status.
if test "$ac_new_set" = set; then
case $ac_new_val in
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
- ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
*) ac_arg=$ac_var=$ac_new_val ;;
esac
case " $ac_configure_args " in
@@ -1476,12 +1890,6 @@ echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start ov
{ (exit 1); exit 1; }; }
fi
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
@@ -1498,6 +1906,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
@@ -1505,7 +1918,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
- ac_config_headers="$ac_config_headers config.h"
+ac_config_headers="$ac_config_headers config.h"
@@ -1523,13 +1936,13 @@ PCRE_PRERELEASE=`grep '#define PCRE_PRERELEASE' ${srcdir}/pcre.h | cut -c 29-`
PCRE_VERSION=${PCRE_MAJOR}.${PCRE_MINOR}${PCRE_PRERELEASE}
-# Check whether --enable-cpp or --disable-cpp was given.
+# Check whether --enable-cpp was given.
if test "${enable_cpp+set}" = set; then
- enableval="$enable_cpp"
- want_cpp="$enableval"
+ enableval=$enable_cpp; want_cpp="$enableval"
else
want_cpp=yes
-fi;
+fi
+
ac_ext=c
@@ -1540,8 +1953,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -1554,32 +1967,34 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
+
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -1592,36 +2007,51 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_CC="gcc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
+ { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
- CC=$ac_ct_CC
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
else
CC="$ac_cv_prog_CC"
fi
if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set dummy ${ac_tool_prefix}cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -1634,74 +2064,34 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_CC"; then
- ac_ct_CC=$CC
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
- CC=$ac_ct_CC
-else
- CC="$ac_cv_prog_CC"
-fi
+ fi
fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -1715,7 +2105,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
@@ -1726,6 +2116,7 @@ do
fi
done
done
+IFS=$as_save_IFS
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
@@ -1743,22 +2134,23 @@ fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
+
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
- for ac_prog in cl
+ for ac_prog in cl.exe
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -1771,36 +2163,38 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
+
test -n "$CC" && break
done
fi
if test -z "$CC"; then
ac_ct_CC=$CC
- for ac_prog in cl
+ for ac_prog in cl.exe
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -1813,29 +2207,45 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_CC="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
+ { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
+
test -n "$ac_ct_CC" && break
done
- CC=$ac_ct_CC
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
fi
fi
@@ -1848,21 +2258,35 @@ See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
# Provide some information about the compiler.
-echo "$as_me:$LINENO:" \
- "checking for C compiler version" >&5
+echo "$as_me:$LINENO: checking for C compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
- (eval $ac_compiler --version </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler --version >&5") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
- (eval $ac_compiler -v </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -v >&5") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
- (eval $ac_compiler -V </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -V >&5") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
@@ -1887,46 +2311,70 @@ ac_clean_files="$ac_clean_files a.out a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
-echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
- (eval $ac_link_default) 2>&5
+#
+# List of possible output files, starting from the most likely.
+# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
+# only as a last resort. b.out is created by i960 compilers.
+ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
+#
+# The IRIX 6 linker writes into existing files which may not be
+# executable, retaining their permissions. Remove them first so a
+# subsequent execution test works.
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { (ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link_default") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
- # Find the output, starting from the most likely. This scheme is
-# not robust to junk in `.', hence go to wildcards (a.*) only as a last
-# resort.
-
-# Be careful to initialize this variable, since it used to be cached.
-# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
-ac_cv_exeext=
-# b.out is created by i960 compilers.
-for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files
do
test -f "$ac_file" || continue
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
- ;;
- conftest.$ac_ext )
- # This is the source file.
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
;;
[ab].out )
# We found the default executable, but exeext='' is most
# certainly right.
break;;
*.* )
- ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- # FIXME: I believe we export ac_cv_exeext for Libtool,
- # but it would be cool to find out if it's true. Does anybody
- # maintain Libtool? --akim.
- export ac_cv_exeext
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
break;;
* )
break;;
esac
done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
@@ -1939,19 +2387,23 @@ See \`config.log' for more details." >&2;}
fi
ac_exeext=$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6
+{ echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6; }
-# Check the compiler produces executables we can run. If not, either
+# Check that the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
# If not cross compiling, check that we can run a simple program.
if test "$cross_compiling" != yes; then
if { ac_try='./$ac_file'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -1970,22 +2422,27 @@ See \`config.log' for more details." >&2;}
fi
fi
fi
-echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
rm -f a.out a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
-# Check the compiler produces executables we can run. If not, either
+# Check that the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
-echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6
-
-echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6; }
+
+{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
@@ -1996,9 +2453,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
for ac_file in conftest.exe conftest conftest.*; do
test -f "$ac_file" || continue
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- export ac_cv_exeext
break;;
* ) break;;
esac
@@ -2012,14 +2468,14 @@ See \`config.log' for more details." >&2;}
fi
rm -f conftest$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6; }
rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
-echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
if test "${ac_cv_objext+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -2039,14 +2495,20 @@ main ()
}
_ACEOF
rm -f conftest.o conftest.obj
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
- for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
*) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
break;;
esac
@@ -2064,12 +2526,12 @@ fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6; }
OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
-echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
if test "${ac_cv_c_compiler_gnu+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -2092,24 +2554,36 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -2118,24 +2592,28 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_compiler_gnu=no
+ ac_compiler_gnu=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
-echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
GCC=`test $ac_compiler_gnu = yes && echo yes`
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
-CFLAGS="-g"
-echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
if test "${ac_cv_prog_cc_g+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat >conftest.$ac_ext <<_ACEOF
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -2151,24 +2629,36 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -2177,12 +2667,131 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_prog_cc_g=no
+ CFLAGS=""
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
@@ -2198,12 +2807,12 @@ else
CFLAGS=
fi
fi
-echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
-echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_stdc+set}" = set; then
+{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_cv_prog_cc_stdc=no
+ ac_cv_prog_cc_c89=no
ac_save_CC=$CC
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
@@ -2237,12 +2846,17 @@ static char *f (char * (*g) (char **, int), char **p, ...)
/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
function prototypes and stuff, but not '\xHH' hex character constants.
These don't provoke an error unfortunately, instead are silently treated
- as 'x'. The following induces an error, until -std1 is added to get
+ as 'x'. The following induces an error, until -std is added to get
proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
array size at least. It's necessary to write '\x00'==0 to get something
- that's true only with -std1. */
+ that's true only with -std. */
int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
@@ -2257,205 +2871,74 @@ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
return 0;
}
_ACEOF
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX -qlanglvl=ansi
-# Ultrix and OSF/1 -std1
-# HP-UX 10.20 and later -Ae
-# HP-UX older versions -Aa -D_HPUX_SOURCE
-# SVR4 -Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_prog_cc_stdc=$ac_arg
-break
+ ac_cv_prog_cc_c89=$ac_arg
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
+
fi
-rm -f conftest.err conftest.$ac_objext
+
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
done
-rm -f conftest.$ac_ext conftest.$ac_objext
+rm -f conftest.$ac_ext
CC=$ac_save_CC
fi
-
-case "x$ac_cv_prog_cc_stdc" in
- x|xno)
- echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6 ;;
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+ xno)
+ { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
*)
- echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
- CC="$CC $ac_cv_prog_cc_stdc" ;;
+ CC="$CC $ac_cv_prog_cc_c89"
+ { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
esac
-# Some people use a C++ compiler to compile C. Since we use `exit',
-# in C++ we need to declare it. In case someone uses the same compiler
-# for both compiling C and C++ we need to have the C++ compiler decide
-# the declaration of exit, since it's the most demanding environment.
-cat >conftest.$ac_ext <<_ACEOF
-#ifndef __cplusplus
- choke me
-#endif
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- for ac_declaration in \
- '' \
- 'extern "C" void std::exit (int) throw (); using std::exit;' \
- 'extern "C" void std::exit (int); using std::exit;' \
- 'extern "C" void exit (int) throw ();' \
- 'extern "C" void exit (int);' \
- 'void exit (int);'
-do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_declaration
-#include <stdlib.h>
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-continue
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_declaration
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-rm -f conftest*
-if test -n "$ac_declaration"; then
- echo '#ifdef __cplusplus' >>confdefs.h
- echo $ac_declaration >>confdefs.h
- echo '#endif' >>confdefs.h
-fi
-
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -2464,18 +2947,22 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
-ac_ext=cc
+ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-if test -n "$ac_tool_prefix"; then
- for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
+if test -z "$CXX"; then
+ if test -n "$CCC"; then
+ CXX=$CCC
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_CXX+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -2488,36 +2975,38 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
fi
fi
CXX=$ac_cv_prog_CXX
if test -n "$CXX"; then
- echo "$as_me:$LINENO: result: $CXX" >&5
-echo "${ECHO_T}$CXX" >&6
+ { echo "$as_me:$LINENO: result: $CXX" >&5
+echo "${ECHO_T}$CXX" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
+
test -n "$CXX" && break
done
fi
if test -z "$CXX"; then
ac_ct_CXX=$CXX
- for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -2530,55 +3019,85 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_CXX="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
fi
fi
ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
if test -n "$ac_ct_CXX"; then
- echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
-echo "${ECHO_T}$ac_ct_CXX" >&6
+ { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+echo "${ECHO_T}$ac_ct_CXX" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
+
test -n "$ac_ct_CXX" && break
done
-test -n "$ac_ct_CXX" || ac_ct_CXX="g++"
- CXX=$ac_ct_CXX
+ if test "x$ac_ct_CXX" = x; then
+ CXX="g++"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ CXX=$ac_ct_CXX
+ fi
fi
-
+ fi
+fi
# Provide some information about the compiler.
-echo "$as_me:$LINENO:" \
- "checking for C++ compiler version" >&5
+echo "$as_me:$LINENO: checking for C++ compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
- (eval $ac_compiler --version </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler --version >&5") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
- (eval $ac_compiler -v </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -v >&5") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
- (eval $ac_compiler -V </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -V >&5") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
-echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; }
if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -2601,24 +3120,36 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -2627,24 +3158,28 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_compiler_gnu=no
+ ac_compiler_gnu=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
fi
-echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; }
GXX=`test $ac_compiler_gnu = yes && echo yes`
ac_test_CXXFLAGS=${CXXFLAGS+set}
ac_save_CXXFLAGS=$CXXFLAGS
-CXXFLAGS="-g"
-echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
-echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; }
if test "${ac_cv_prog_cxx_g+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat >conftest.$ac_ext <<_ACEOF
+ ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+ ac_cxx_werror_flag=yes
+ ac_cv_prog_cxx_g=no
+ CXXFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -2660,24 +3195,36 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -2686,70 +3233,53 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_prog_cxx_g=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6
-if test "$ac_test_CXXFLAGS" = set; then
- CXXFLAGS=$ac_save_CXXFLAGS
-elif test $ac_cv_prog_cxx_g = yes; then
- if test "$GXX" = yes; then
- CXXFLAGS="-g -O2"
- else
- CXXFLAGS="-g"
- fi
-else
- if test "$GXX" = yes; then
- CXXFLAGS="-O2"
- else
- CXXFLAGS=
- fi
-fi
-for ac_declaration in \
- '' \
- 'extern "C" void std::exit (int) throw (); using std::exit;' \
- 'extern "C" void std::exit (int); using std::exit;' \
- 'extern "C" void exit (int) throw ();' \
- 'extern "C" void exit (int);' \
- 'void exit (int);'
-do
- cat >conftest.$ac_ext <<_ACEOF
+ CXXFLAGS=""
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-$ac_declaration
-#include <stdlib.h>
+
int
main ()
{
-exit (42);
+
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -2758,61 +3288,91 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-continue
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- cat >conftest.$ac_ext <<_ACEOF
+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+ CXXFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-$ac_declaration
+
int
main ()
{
-exit (42);
+
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- break
+ ac_cv_prog_cxx_g=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
+
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-rm -f conftest*
-if test -n "$ac_declaration"; then
- echo '#ifdef __cplusplus' >>confdefs.h
- echo $ac_declaration >>confdefs.h
- echo '#endif' >>confdefs.h
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+ if test "$GXX" = yes; then
+ CXXFLAGS="-g -O2"
+ else
+ CXXFLAGS="-g"
+ fi
+else
+ if test "$GXX" = yes; then
+ CXXFLAGS="-O2"
+ else
+ CXXFLAGS=
+ fi
+fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -2822,29 +3382,35 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+ if test -f "$ac_dir/install-sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
break
- elif test -f $ac_dir/install.sh; then
+ elif test -f "$ac_dir/install.sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
- elif test -f $ac_dir/shtool; then
+ elif test -f "$ac_dir/shtool"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/shtool install -c"
break
fi
done
if test -z "$ac_aux_dir"; then
- { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
-echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
+ { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
{ (exit 1); exit 1; }; }
fi
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"
-ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
@@ -2859,8 +3425,8 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# OS/2's system install, which has a completely different semantic
# ./install, which can be erroneously created by make from ./install.sh.
-echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
if test -z "$INSTALL"; then
if test "${ac_cv_path_install+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2882,7 +3448,7 @@ case $as_dir/ in
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; }; then
if test $ac_prog = install &&
grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
@@ -2901,21 +3467,22 @@ case $as_dir/ in
;;
esac
done
+IFS=$as_save_IFS
fi
if test "${ac_cv_path_install+set}" = set; then
INSTALL=$ac_cv_path_install
else
- # As a last resort, use the slow shell script. We don't cache a
- # path for INSTALL within a source directory, because that will
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
# break other packages using the cache if that directory is
- # removed, or if the path is relative.
+ # removed, or if the value is a relative name.
INSTALL=$ac_install_sh
fi
fi
-echo "$as_me:$LINENO: result: $INSTALL" >&5
-echo "${ECHO_T}$INSTALL" >&6
+{ echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6; }
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
@@ -2927,10 +3494,9 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-# Check whether --enable-shared or --disable-shared was given.
+# Check whether --enable-shared was given.
if test "${enable_shared+set}" = set; then
- enableval="$enable_shared"
- p=${PACKAGE-default}
+ enableval=$enable_shared; p=${PACKAGE-default}
case $enableval in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
@@ -2949,12 +3515,12 @@ if test "${enable_shared+set}" = set; then
esac
else
enable_shared=yes
-fi;
+fi
+
-# Check whether --enable-static or --disable-static was given.
+# Check whether --enable-static was given.
if test "${enable_static+set}" = set; then
- enableval="$enable_static"
- p=${PACKAGE-default}
+ enableval=$enable_static; p=${PACKAGE-default}
case $enableval in
yes) enable_static=yes ;;
no) enable_static=no ;;
@@ -2973,12 +3539,12 @@ if test "${enable_static+set}" = set; then
esac
else
enable_static=yes
-fi;
+fi
+
-# Check whether --enable-fast-install or --disable-fast-install was given.
+# Check whether --enable-fast-install was given.
if test "${enable_fast_install+set}" = set; then
- enableval="$enable_fast_install"
- p=${PACKAGE-default}
+ enableval=$enable_fast_install; p=${PACKAGE-default}
case $enableval in
yes) enable_fast_install=yes ;;
no) enable_fast_install=no ;;
@@ -2997,64 +3563,94 @@ if test "${enable_fast_install+set}" = set; then
esac
else
enable_fast_install=yes
-fi;
+fi
+
# Make sure we can run config.sub.
-$ac_config_sub sun4 >/dev/null 2>&1 ||
- { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
-echo "$as_me: error: cannot run $ac_config_sub" >&2;}
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+ { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
+echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
{ (exit 1); exit 1; }; }
-echo "$as_me:$LINENO: checking build system type" >&5
-echo $ECHO_N "checking build system type... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
if test "${ac_cv_build+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_cv_build_alias=$build_alias
-test -z "$ac_cv_build_alias" &&
- ac_cv_build_alias=`$ac_config_guess`
-test -z "$ac_cv_build_alias" &&
+ ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+ ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
{ { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
{ (exit 1); exit 1; }; }
-ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
- { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
-echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+ { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
{ (exit 1); exit 1; }; }
fi
-echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-echo "${ECHO_T}$ac_cv_build" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
+echo "$as_me: error: invalid value of canonical build" >&2;}
+ { (exit 1); exit 1; }; };;
+esac
build=$ac_cv_build
-build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-
-
-echo "$as_me:$LINENO: checking host system type" >&5
-echo $ECHO_N "checking host system type... $ECHO_C" >&6
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
if test "${ac_cv_host+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_cv_host_alias=$host_alias
-test -z "$ac_cv_host_alias" &&
- ac_cv_host_alias=$ac_cv_build_alias
-ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
- { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
-echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
+ if test "x$host_alias" = x; then
+ ac_cv_host=$ac_cv_build
+else
+ ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+ { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
{ (exit 1); exit 1; }; }
+fi
fi
-echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-echo "${ECHO_T}$ac_cv_host" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
+echo "$as_me: error: invalid value of canonical host" >&2;}
+ { (exit 1); exit 1; }; };;
+esac
host=$ac_cv_host
-host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-
-
-echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
-echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+{ echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; }
if test "${lt_cv_path_SED+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3107,37 +3703,184 @@ done
fi
SED=$lt_cv_path_SED
-echo "$as_me:$LINENO: result: $SED" >&5
-echo "${ECHO_T}$SED" >&6
+{ echo "$as_me:$LINENO: result: $SED" >&5
+echo "${ECHO_T}$SED" >&6; }
-echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6
-if test "${ac_cv_prog_egrep+set}" = set; then
+{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Extract the first word of "grep ggrep" to use in msg output
+if test -z "$GREP"; then
+set dummy grep ggrep; ac_prog_name=$2
+if test "${ac_cv_path_GREP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if echo a | (grep -E '(a|b)') >/dev/null 2>&1
- then ac_cv_prog_egrep='grep -E'
- else ac_cv_prog_egrep='egrep'
+ ac_path_GREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_GREP" && $as_executable_p "$ac_path_GREP"; } || continue
+ # Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ ac_count=`expr $ac_count + 1`
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+ $ac_path_GREP_found && break 3
+ done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+GREP="$ac_cv_path_GREP"
+if test -z "$GREP"; then
+ { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+else
+ ac_cv_path_GREP=$GREP
fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
-echo "${ECHO_T}$ac_cv_prog_egrep" >&6
- EGREP=$ac_cv_prog_egrep
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
-# Check whether --with-gnu-ld or --without-gnu-ld was given.
+{ echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ # Extract the first word of "egrep" to use in msg output
+if test -z "$EGREP"; then
+set dummy egrep; ac_prog_name=$2
+if test "${ac_cv_path_EGREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_path_EGREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_EGREP" && $as_executable_p "$ac_path_EGREP"; } || continue
+ # Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ ac_count=`expr $ac_count + 1`
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+ $ac_path_EGREP_found && break 3
+ done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+EGREP="$ac_cv_path_EGREP"
+if test -z "$EGREP"; then
+ { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+
+ fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+
+# Check whether --with-gnu-ld was given.
if test "${with_gnu_ld+set}" = set; then
- withval="$with_gnu_ld"
- test "$withval" = no || with_gnu_ld=yes
+ withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
else
with_gnu_ld=no
-fi;
+fi
+
ac_prog=ld
if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
- echo "$as_me:$LINENO: checking for ld used by $CC" >&5
-echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
@@ -3166,11 +3909,11 @@ echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6
;;
esac
elif test "$with_gnu_ld" = yes; then
- echo "$as_me:$LINENO: checking for GNU ld" >&5
-echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
else
- echo "$as_me:$LINENO: checking for non-GNU ld" >&5
-echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
fi
if test "${lt_cv_path_LD+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3203,17 +3946,17 @@ fi
LD="$lt_cv_path_LD"
if test -n "$LD"; then
- echo "$as_me:$LINENO: result: $LD" >&5
-echo "${ECHO_T}$LD" >&6
+ { echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
{ (exit 1); exit 1; }; }
-echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
-echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
if test "${lt_cv_prog_gnu_ld+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3227,20 +3970,20 @@ case `$LD -v 2>&1 </dev/null` in
;;
esac
fi
-echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
-echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
with_gnu_ld=$lt_cv_prog_gnu_ld
-echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
-echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; }
if test "${lt_cv_ld_reload_flag+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
lt_cv_ld_reload_flag='-r'
fi
-echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
-echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6
+{ echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; }
reload_flag=$lt_cv_ld_reload_flag
case $reload_flag in
"" | " "*) ;;
@@ -3257,8 +4000,8 @@ case $host_os in
;;
esac
-echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
-echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
+echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6; }
if test "${lt_cv_path_NM+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3306,23 +4049,23 @@ else
test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
fi
fi
-echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
-echo "${ECHO_T}$lt_cv_path_NM" >&6
+{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
+echo "${ECHO_T}$lt_cv_path_NM" >&6; }
NM="$lt_cv_path_NM"
-echo "$as_me:$LINENO: checking whether ln -s works" >&5
-echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; }
LN_S=$as_ln_s
if test "$LN_S" = "ln -s"; then
- echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
else
- echo "$as_me:$LINENO: result: no, using $LN_S" >&5
-echo "${ECHO_T}no, using $LN_S" >&6
+ { echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6; }
fi
-echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5
-echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5
+echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6; }
if test "${lt_cv_deplibs_check_method+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3497,8 +4240,8 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
esac
fi
-echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
-echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6
+{ echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; }
file_magic_cmd=$lt_cv_file_magic_cmd
deplibs_check_method=$lt_cv_deplibs_check_method
test -z "$deplibs_check_method" && deplibs_check_method=unknown
@@ -3516,11 +4259,11 @@ LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
compiler=$CC
-# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+# Check whether --enable-libtool-lock was given.
if test "${enable_libtool_lock+set}" = set; then
- enableval="$enable_libtool_lock"
+ enableval=$enable_libtool_lock;
+fi
-fi;
test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
# Some flags need to be propagated to the compiler or linker for good
@@ -3547,7 +4290,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 3550 "configure"' > conftest.$ac_ext
+ echo '#line 4293 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -3632,8 +4375,8 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
- echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
-echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; }
if test "${lt_cv_cc_needs_belf+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3659,24 +4402,36 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -3685,9 +4440,10 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-lt_cv_cc_needs_belf=no
+ lt_cv_cc_needs_belf=no
fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -3696,8 +4452,8 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
fi
-echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
-echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6
+{ echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; }
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
CFLAGS="$SAVE_CFLAGS"
@@ -3727,8 +4483,8 @@ sparc*-*solaris*)
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
set dummy ${ac_tool_prefix}dlltool; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_DLLTOOL+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3741,32 +4497,34 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
fi
fi
DLLTOOL=$ac_cv_prog_DLLTOOL
if test -n "$DLLTOOL"; then
- echo "$as_me:$LINENO: result: $DLLTOOL" >&5
-echo "${ECHO_T}$DLLTOOL" >&6
+ { echo "$as_me:$LINENO: result: $DLLTOOL" >&5
+echo "${ECHO_T}$DLLTOOL" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
+
fi
if test -z "$ac_cv_prog_DLLTOOL"; then
ac_ct_DLLTOOL=$DLLTOOL
# Extract the first word of "dlltool", so it can be a program name with args.
set dummy dlltool; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_ac_ct_DLLTOOL+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3779,27 +4537,41 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_DLLTOOL="dlltool"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
- test -z "$ac_cv_prog_ac_ct_DLLTOOL" && ac_cv_prog_ac_ct_DLLTOOL="false"
fi
fi
ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
if test -n "$ac_ct_DLLTOOL"; then
- echo "$as_me:$LINENO: result: $ac_ct_DLLTOOL" >&5
-echo "${ECHO_T}$ac_ct_DLLTOOL" >&6
+ { echo "$as_me:$LINENO: result: $ac_ct_DLLTOOL" >&5
+echo "${ECHO_T}$ac_ct_DLLTOOL" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
- DLLTOOL=$ac_ct_DLLTOOL
+ if test "x$ac_ct_DLLTOOL" = x; then
+ DLLTOOL="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ DLLTOOL=$ac_ct_DLLTOOL
+ fi
else
DLLTOOL="$ac_cv_prog_DLLTOOL"
fi
@@ -3807,8 +4579,8 @@ fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
set dummy ${ac_tool_prefix}as; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_AS+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3821,32 +4593,34 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_AS="${ac_tool_prefix}as"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
fi
fi
AS=$ac_cv_prog_AS
if test -n "$AS"; then
- echo "$as_me:$LINENO: result: $AS" >&5
-echo "${ECHO_T}$AS" >&6
+ { echo "$as_me:$LINENO: result: $AS" >&5
+echo "${ECHO_T}$AS" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
+
fi
if test -z "$ac_cv_prog_AS"; then
ac_ct_AS=$AS
# Extract the first word of "as", so it can be a program name with args.
set dummy as; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_ac_ct_AS+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3859,27 +4633,41 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_AS="as"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
- test -z "$ac_cv_prog_ac_ct_AS" && ac_cv_prog_ac_ct_AS="false"
fi
fi
ac_ct_AS=$ac_cv_prog_ac_ct_AS
if test -n "$ac_ct_AS"; then
- echo "$as_me:$LINENO: result: $ac_ct_AS" >&5
-echo "${ECHO_T}$ac_ct_AS" >&6
+ { echo "$as_me:$LINENO: result: $ac_ct_AS" >&5
+echo "${ECHO_T}$ac_ct_AS" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
- AS=$ac_ct_AS
+ if test "x$ac_ct_AS" = x; then
+ AS="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ AS=$ac_ct_AS
+ fi
else
AS="$ac_cv_prog_AS"
fi
@@ -3887,8 +4675,8 @@ fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
set dummy ${ac_tool_prefix}objdump; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_OBJDUMP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3901,32 +4689,34 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
fi
fi
OBJDUMP=$ac_cv_prog_OBJDUMP
if test -n "$OBJDUMP"; then
- echo "$as_me:$LINENO: result: $OBJDUMP" >&5
-echo "${ECHO_T}$OBJDUMP" >&6
+ { echo "$as_me:$LINENO: result: $OBJDUMP" >&5
+echo "${ECHO_T}$OBJDUMP" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
+
fi
if test -z "$ac_cv_prog_OBJDUMP"; then
ac_ct_OBJDUMP=$OBJDUMP
# Extract the first word of "objdump", so it can be a program name with args.
set dummy objdump; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3939,27 +4729,41 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_OBJDUMP="objdump"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
- test -z "$ac_cv_prog_ac_ct_OBJDUMP" && ac_cv_prog_ac_ct_OBJDUMP="false"
fi
fi
ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
if test -n "$ac_ct_OBJDUMP"; then
- echo "$as_me:$LINENO: result: $ac_ct_OBJDUMP" >&5
-echo "${ECHO_T}$ac_ct_OBJDUMP" >&6
+ { echo "$as_me:$LINENO: result: $ac_ct_OBJDUMP" >&5
+echo "${ECHO_T}$ac_ct_OBJDUMP" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
- OBJDUMP=$ac_ct_OBJDUMP
+ if test "x$ac_ct_OBJDUMP" = x; then
+ OBJDUMP="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ OBJDUMP=$ac_ct_OBJDUMP
+ fi
else
OBJDUMP="$ac_cv_prog_OBJDUMP"
fi
@@ -3976,8 +4780,8 @@ ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -4011,8 +4815,13 @@ cat >>conftest.$ac_ext <<_ACEOF
#endif
Syntax error
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
@@ -4037,9 +4846,10 @@ sed 's/^/| /' conftest.$ac_ext >&5
# Broken: fails on valid input.
continue
fi
+
rm -f conftest.err conftest.$ac_ext
- # OK, works on sane cases. Now check whether non-existent headers
+ # OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
@@ -4049,8 +4859,13 @@ cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
@@ -4077,6 +4892,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_preproc_ok=:
break
fi
+
rm -f conftest.err conftest.$ac_ext
done
@@ -4094,8 +4910,8 @@ fi
else
ac_cv_prog_CPP=$CPP
fi
-echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6
+{ echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6; }
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
@@ -4118,8 +4934,13 @@ cat >>conftest.$ac_ext <<_ACEOF
#endif
Syntax error
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
@@ -4144,9 +4965,10 @@ sed 's/^/| /' conftest.$ac_ext >&5
# Broken: fails on valid input.
continue
fi
+
rm -f conftest.err conftest.$ac_ext
- # OK, works on sane cases. Now check whether non-existent headers
+ # OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
@@ -4156,8 +4978,13 @@ cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
@@ -4184,6 +5011,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_preproc_ok=:
break
fi
+
rm -f conftest.err conftest.$ac_ext
done
@@ -4206,8 +5034,8 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
if test "${ac_cv_header_stdc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4231,24 +5059,36 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -4257,9 +5097,10 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_header_stdc=no
+ ac_cv_header_stdc=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
@@ -4315,6 +5156,7 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <ctype.h>
+#include <stdlib.h>
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
@@ -4334,18 +5176,27 @@ main ()
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
|| toupper (i) != TOUPPER (i))
- exit(2);
- exit (0);
+ return 2;
+ return 0;
}
_ACEOF
rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -4358,12 +5209,14 @@ sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_header_stdc=no
fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
+
+
fi
fi
-echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
if test $ac_cv_header_stdc = yes; then
cat >>confdefs.h <<\_ACEOF
@@ -4386,9 +5239,9 @@ for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
inttypes.h stdint.h unistd.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
@@ -4402,24 +5255,36 @@ $ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -4428,12 +5293,14 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-eval "$as_ac_Header=no"
+ eval "$as_ac_Header=no"
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
@@ -4448,18 +5315,19 @@ done
for ac_header in dlfcn.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
else
# Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -4470,24 +5338,36 @@ $ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -4496,15 +5376,16 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_header_compiler=no
+ ac_header_compiler=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -4513,8 +5394,13 @@ cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
@@ -4538,9 +5424,10 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
+
rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
@@ -4564,25 +5451,19 @@ echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to the AC_PACKAGE_NAME lists. ##
-## ------------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
+
;;
esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=\$ac_header_preproc"
fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
@@ -4599,13 +5480,13 @@ done
if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
(test "X$CXX" != "Xg++"))) ; then
- ac_ext=cc
+ ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5
-echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5
+echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6; }
if test -z "$CXXCPP"; then
if test "${ac_cv_prog_CXXCPP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -4635,8 +5516,13 @@ cat >>conftest.$ac_ext <<_ACEOF
#endif
Syntax error
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
@@ -4661,9 +5547,10 @@ sed 's/^/| /' conftest.$ac_ext >&5
# Broken: fails on valid input.
continue
fi
+
rm -f conftest.err conftest.$ac_ext
- # OK, works on sane cases. Now check whether non-existent headers
+ # OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
@@ -4673,8 +5560,13 @@ cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
@@ -4701,6 +5593,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_preproc_ok=:
break
fi
+
rm -f conftest.err conftest.$ac_ext
done
@@ -4718,8 +5611,8 @@ fi
else
ac_cv_prog_CXXCPP=$CXXCPP
fi
-echo "$as_me:$LINENO: result: $CXXCPP" >&5
-echo "${ECHO_T}$CXXCPP" >&6
+{ echo "$as_me:$LINENO: result: $CXXCPP" >&5
+echo "${ECHO_T}$CXXCPP" >&6; }
ac_preproc_ok=false
for ac_cxx_preproc_warn_flag in '' yes
do
@@ -4742,8 +5635,13 @@ cat >>conftest.$ac_ext <<_ACEOF
#endif
Syntax error
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
@@ -4768,9 +5666,10 @@ sed 's/^/| /' conftest.$ac_ext >&5
# Broken: fails on valid input.
continue
fi
+
rm -f conftest.err conftest.$ac_ext
- # OK, works on sane cases. Now check whether non-existent headers
+ # OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
@@ -4780,8 +5679,13 @@ cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
@@ -4808,6 +5712,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_preproc_ok=:
break
fi
+
rm -f conftest.err conftest.$ac_ext
done
@@ -4823,7 +5728,7 @@ See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
-ac_ext=cc
+ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
@@ -4837,12 +5742,12 @@ ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_f77_compiler_gnu
if test -n "$ac_tool_prefix"; then
- for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran
+ for ac_prog in g77 f77 xlf frt pgf77 cf77 fort77 fl32 af77 f90 xlf90 pgf90 pghpf epcf90 gfortran g95 f95 fort xlf95 ifort ifc efc pgf95 lf95 ftn
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_F77+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4855,36 +5760,38 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_F77="$ac_tool_prefix$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
fi
fi
F77=$ac_cv_prog_F77
if test -n "$F77"; then
- echo "$as_me:$LINENO: result: $F77" >&5
-echo "${ECHO_T}$F77" >&6
+ { echo "$as_me:$LINENO: result: $F77" >&5
+echo "${ECHO_T}$F77" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
+
test -n "$F77" && break
done
fi
if test -z "$F77"; then
ac_ct_F77=$F77
- for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran
+ for ac_prog in g77 f77 xlf frt pgf77 cf77 fort77 fl32 af77 f90 xlf90 pgf90 pghpf epcf90 gfortran g95 f95 fort xlf95 ifort ifc efc pgf95 lf95 ftn
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_ac_ct_F77+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4897,48 +5804,78 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_F77="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
fi
fi
ac_ct_F77=$ac_cv_prog_ac_ct_F77
if test -n "$ac_ct_F77"; then
- echo "$as_me:$LINENO: result: $ac_ct_F77" >&5
-echo "${ECHO_T}$ac_ct_F77" >&6
+ { echo "$as_me:$LINENO: result: $ac_ct_F77" >&5
+echo "${ECHO_T}$ac_ct_F77" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
+
test -n "$ac_ct_F77" && break
done
- F77=$ac_ct_F77
+ if test "x$ac_ct_F77" = x; then
+ F77=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ F77=$ac_ct_F77
+ fi
fi
# Provide some information about the compiler.
-echo "$as_me:4927:" \
- "checking for Fortran 77 compiler version" >&5
+echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
- (eval $ac_compiler --version </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler --version >&5") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
- (eval $ac_compiler -v </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -v >&5") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
- (eval $ac_compiler -V </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -V >&5") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
@@ -4948,8 +5885,8 @@ rm -f a.out
# input file. (Note that this only needs to work for GNU compilers.)
ac_save_ext=$ac_ext
ac_ext=F
-echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6; }
if test "${ac_cv_f77_compiler_gnu+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4962,24 +5899,36 @@ else
end
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_f77_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -4988,20 +5937,21 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_compiler_gnu=no
+ ac_compiler_gnu=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_f77_compiler_gnu=$ac_compiler_gnu
fi
-echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6; }
ac_ext=$ac_save_ext
ac_test_FFLAGS=${FFLAGS+set}
ac_save_FFLAGS=$FFLAGS
FFLAGS=
-echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5
-echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5
+echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6; }
if test "${ac_cv_prog_f77_g+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5012,24 +5962,36 @@ cat >conftest.$ac_ext <<_ACEOF
end
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_f77_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -5038,13 +6000,14 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_prog_f77_g=no
+ ac_cv_prog_f77_g=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5
-echo "${ECHO_T}$ac_cv_prog_f77_g" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5
+echo "${ECHO_T}$ac_cv_prog_f77_g" >&6; }
if test "$ac_test_FFLAGS" = set; then
FFLAGS=$ac_save_FFLAGS
elif test $ac_cv_prog_f77_g = yes; then
@@ -5073,8 +6036,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
# find the maximum length of command line arguments
-echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
-echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
+echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6; }
if test "${lt_cv_sys_max_cmd_len+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5182,19 +6145,19 @@ else
fi
if test -n $lt_cv_sys_max_cmd_len ; then
- echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
-echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6
+ { echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
+echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6; }
else
- echo "$as_me:$LINENO: result: none" >&5
-echo "${ECHO_T}none" >&6
+ { echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6; }
fi
# Check for command to grab the raw symbol name followed by C symbol from nm.
-echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
-echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
+echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; }
if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5398,15 +6361,15 @@ if test -z "$lt_cv_sys_global_symbol_pipe"; then
lt_cv_sys_global_symbol_to_cdecl=
fi
if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
- echo "$as_me:$LINENO: result: failed" >&5
-echo "${ECHO_T}failed" >&6
+ { echo "$as_me:$LINENO: result: failed" >&5
+echo "${ECHO_T}failed" >&6; }
else
- echo "$as_me:$LINENO: result: ok" >&5
-echo "${ECHO_T}ok" >&6
+ { echo "$as_me:$LINENO: result: ok" >&5
+echo "${ECHO_T}ok" >&6; }
fi
-echo "$as_me:$LINENO: checking for objdir" >&5
-echo $ECHO_N "checking for objdir... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for objdir" >&5
+echo $ECHO_N "checking for objdir... $ECHO_C" >&6; }
if test "${lt_cv_objdir+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5420,8 +6383,8 @@ else
fi
rmdir .libs 2>/dev/null
fi
-echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
-echo "${ECHO_T}$lt_cv_objdir" >&6
+{ echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
+echo "${ECHO_T}$lt_cv_objdir" >&6; }
objdir=$lt_cv_objdir
@@ -5472,8 +6435,8 @@ with_gnu_ld="$lt_cv_prog_gnu_ld"
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_AR+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5486,32 +6449,34 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_AR="${ac_tool_prefix}ar"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
fi
fi
AR=$ac_cv_prog_AR
if test -n "$AR"; then
- echo "$as_me:$LINENO: result: $AR" >&5
-echo "${ECHO_T}$AR" >&6
+ { echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
+
fi
if test -z "$ac_cv_prog_AR"; then
ac_ct_AR=$AR
# Extract the first word of "ar", so it can be a program name with args.
set dummy ar; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5524,27 +6489,41 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_AR="ar"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
- test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="false"
fi
fi
ac_ct_AR=$ac_cv_prog_ac_ct_AR
if test -n "$ac_ct_AR"; then
- echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
-echo "${ECHO_T}$ac_ct_AR" >&6
+ { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
- AR=$ac_ct_AR
+ if test "x$ac_ct_AR" = x; then
+ AR="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ AR=$ac_ct_AR
+ fi
else
AR="$ac_cv_prog_AR"
fi
@@ -5552,8 +6531,8 @@ fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_RANLIB+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5566,32 +6545,34 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
fi
fi
RANLIB=$ac_cv_prog_RANLIB
if test -n "$RANLIB"; then
- echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6
+ { echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
+
fi
if test -z "$ac_cv_prog_RANLIB"; then
ac_ct_RANLIB=$RANLIB
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5604,27 +6585,41 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_RANLIB="ranlib"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
- test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
fi
fi
ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
if test -n "$ac_ct_RANLIB"; then
- echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-echo "${ECHO_T}$ac_ct_RANLIB" >&6
+ { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
- RANLIB=$ac_ct_RANLIB
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ RANLIB=$ac_ct_RANLIB
+ fi
else
RANLIB="$ac_cv_prog_RANLIB"
fi
@@ -5632,8 +6627,8 @@ fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_STRIP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5646,32 +6641,34 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_STRIP="${ac_tool_prefix}strip"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
fi
fi
STRIP=$ac_cv_prog_STRIP
if test -n "$STRIP"; then
- echo "$as_me:$LINENO: result: $STRIP" >&5
-echo "${ECHO_T}$STRIP" >&6
+ { echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
+
fi
if test -z "$ac_cv_prog_STRIP"; then
ac_ct_STRIP=$STRIP
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5684,27 +6681,41 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_STRIP="strip"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
- test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
fi
fi
ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
if test -n "$ac_ct_STRIP"; then
- echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
-echo "${ECHO_T}$ac_ct_STRIP" >&6
+ { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
- STRIP=$ac_ct_STRIP
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
else
STRIP="$ac_cv_prog_STRIP"
fi
@@ -5763,8 +6774,8 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
case $deplibs_check_method in
file_magic*)
if test "$file_magic_cmd" = '$MAGIC_CMD'; then
- echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
-echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6; }
if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5816,17 +6827,17 @@ fi
MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
if test -n "$MAGIC_CMD"; then
- echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
-echo "${ECHO_T}$MAGIC_CMD" >&6
+ { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
if test -z "$lt_cv_path_MAGIC_CMD"; then
if test -n "$ac_tool_prefix"; then
- echo "$as_me:$LINENO: checking for file" >&5
-echo $ECHO_N "checking for file... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking for file" >&5
+echo $ECHO_N "checking for file... $ECHO_C" >&6; }
if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5878,11 +6889,11 @@ fi
MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
if test -n "$MAGIC_CMD"; then
- echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
-echo "${ECHO_T}$MAGIC_CMD" >&6
+ { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
else
@@ -5897,21 +6908,21 @@ esac
enable_dlopen=no
enable_win32_dll=yes
-# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+# Check whether --enable-libtool-lock was given.
if test "${enable_libtool_lock+set}" = set; then
- enableval="$enable_libtool_lock"
+ enableval=$enable_libtool_lock;
+fi
-fi;
test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
-# Check whether --with-pic or --without-pic was given.
+# Check whether --with-pic was given.
if test "${with_pic+set}" = set; then
- withval="$with_pic"
- pic_mode="$withval"
+ withval=$with_pic; pic_mode="$withval"
else
pic_mode=default
-fi;
+fi
+
test -z "$pic_mode" && pic_mode=default
# Check if we have a version mismatch between libtool.m4 and ltmain.sh.
@@ -5920,11 +6931,11 @@ test -z "$pic_mode" && pic_mode=default
# We also should do it _before_ AC_LIBTOOL_LANG_C_CONFIG that actually
# calls AC_LIBTOOL_CONFIG and creates libtool.
#
-echo "$as_me:$LINENO: checking for correct ltmain.sh version" >&5
-echo $ECHO_N "checking for correct ltmain.sh version... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for correct ltmain.sh version" >&5
+echo $ECHO_N "checking for correct ltmain.sh version... $ECHO_C" >&6; }
if test "x$ltmain" = "x" ; then
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
{ { echo "$as_me:$LINENO: error:
*** [Gentoo] sanity check failed! ***
@@ -5940,8 +6951,8 @@ fi
gentoo_lt_version="1.5.22"
gentoo_ltmain_version=`sed -n '/^[ ]*VERSION=/{s/^[ ]*VERSION=//;p;q;}' "$ltmain"`
if test "x$gentoo_lt_version" != "x$gentoo_ltmain_version" ; then
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
{ { echo "$as_me:$LINENO: error:
*** [Gentoo] sanity check failed! ***
@@ -5970,8 +6981,8 @@ package (or your distribution) for help.
" >&2;}
{ (exit 1); exit 1; }; }
else
- echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
fi
@@ -6030,8 +7041,8 @@ if test "$GCC" = yes; then
lt_prog_compiler_no_builtin_flag=' -fno-builtin'
-echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
-echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -6048,11 +7059,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:6051: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7062: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6055: \$? = $ac_status" >&5
+ echo "$as_me:7066: \$? = $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.
@@ -6065,8 +7076,8 @@ else
$rm conftest*
fi
-echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
@@ -6080,8 +7091,8 @@ lt_prog_compiler_wl=
lt_prog_compiler_pic=
lt_prog_compiler_static=
-echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
if test "$GCC" = yes; then
lt_prog_compiler_wl='-Wl,'
@@ -6290,16 +7301,16 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
esac
fi
-echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic" >&6
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic" >&6; }
#
# Check to make sure the PIC flag actually works.
#
if test -n "$lt_prog_compiler_pic"; then
-echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
-echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6; }
if test "${lt_prog_compiler_pic_works+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -6316,11 +7327,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:6319: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7330: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6323: \$? = $ac_status" >&5
+ echo "$as_me:7334: \$? = $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.
@@ -6333,8 +7344,8 @@ else
$rm conftest*
fi
-echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6; }
if test x"$lt_prog_compiler_pic_works" = xyes; then
case $lt_prog_compiler_pic in
@@ -6361,8 +7372,8 @@ esac
# Check to make sure the static flag actually works.
#
wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
-echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
if test "${lt_prog_compiler_static_works+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -6389,8 +7400,8 @@ else
LDFLAGS="$save_LDFLAGS"
fi
-echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5
-echo "${ECHO_T}$lt_prog_compiler_static_works" >&6
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works" >&6; }
if test x"$lt_prog_compiler_static_works" = xyes; then
:
@@ -6399,8 +7410,8 @@ else
fi
-echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
if test "${lt_cv_prog_compiler_c_o+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -6420,11 +7431,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:6423: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7434: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:6427: \$? = $ac_status" >&5
+ echo "$as_me:7438: \$? = $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
@@ -6446,23 +7457,23 @@ else
$rm conftest*
fi
-echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; }
hard_links="nottested"
if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
# do not overwrite the value of need_locks provided by the user
- echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
-echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
hard_links=yes
$rm conftest*
ln conftest.a conftest.b 2>/dev/null && hard_links=no
touch conftest.a
ln conftest.a conftest.b 2>&5 || hard_links=no
ln conftest.a conftest.b 2>/dev/null && hard_links=no
- echo "$as_me:$LINENO: result: $hard_links" >&5
-echo "${ECHO_T}$hard_links" >&6
+ { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
if test "$hard_links" = no; then
{ echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
@@ -6472,8 +7483,8 @@ else
need_locks=no
fi
-echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
runpath_var=
allow_undefined_flag=
@@ -6888,24 +7899,36 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -6919,8 +7942,10 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
+
fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
@@ -6949,24 +7974,36 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -6980,8 +8017,10 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
+
fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
@@ -7430,8 +8469,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
fi
-echo "$as_me:$LINENO: result: $ld_shlibs" >&5
-echo "${ECHO_T}$ld_shlibs" >&6
+{ echo "$as_me:$LINENO: result: $ld_shlibs" >&5
+echo "${ECHO_T}$ld_shlibs" >&6; }
test "$ld_shlibs" = no && can_build_shared=no
#
@@ -7451,8 +8490,8 @@ x|xyes)
# Test whether the compiler implicitly links with -lc since on some
# systems, -lgcc has to come before -lc. If gcc already passes -lc
# to ld, don't add -lc before -lgcc.
- echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
-echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
$rm conftest*
printf "$lt_simple_compile_test_code" > conftest.$ac_ext
@@ -7489,16 +8528,16 @@ echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&
cat conftest.err 1>&5
fi
$rm conftest*
- echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
-echo "${ECHO_T}$archive_cmds_need_lc" >&6
+ { echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
+echo "${ECHO_T}$archive_cmds_need_lc" >&6; }
;;
esac
fi
;;
esac
-echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
-echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
library_names_spec=
libname_spec='lib$name'
soname_spec=
@@ -8122,8 +9161,8 @@ uts4*)
dynamic_linker=no
;;
esac
-echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-echo "${ECHO_T}$dynamic_linker" >&6
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
test "$dynamic_linker" = no && can_build_shared=no
variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
@@ -8131,8 +9170,8 @@ if test "$GCC" = yes; then
variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
fi
-echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
-echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
hardcode_action=
if test -n "$hardcode_libdir_flag_spec" || \
test -n "$runpath_var" || \
@@ -8156,8 +9195,8 @@ else
# directories.
hardcode_action=unsupported
fi
-echo "$as_me:$LINENO: result: $hardcode_action" >&5
-echo "${ECHO_T}$hardcode_action" >&6
+{ echo "$as_me:$LINENO: result: $hardcode_action" >&5
+echo "${ECHO_T}$hardcode_action" >&6; }
if test "$hardcode_action" = relink; then
# Fast installation is not supported
@@ -8170,29 +9209,29 @@ fi
striplib=
old_striplib=
-echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
-echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; }
if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
test -z "$striplib" && striplib="$STRIP --strip-unneeded"
- echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
else
# FIXME - insert some real tests, host_os isn't really good enough
case $host_os in
darwin*)
if test -n "$STRIP" ; then
striplib="$STRIP -x"
- echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
;;
*)
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
;;
esac
fi
@@ -8224,8 +9263,8 @@ else
darwin*)
# if libdl is installed we need to link against it
- echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
if test "${ac_cv_lib_dl_dlopen+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -8238,40 +9277,52 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-/* Override any gcc2 internal prototype to avoid an error. */
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
char dlopen ();
int
main ()
{
-dlopen ();
+return dlopen ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -8280,14 +9331,15 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_lib_dl_dlopen=no
+ ac_cv_lib_dl_dlopen=no
fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
if test $ac_cv_lib_dl_dlopen = yes; then
lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
else
@@ -8301,8 +9353,8 @@ fi
;;
*)
- echo "$as_me:$LINENO: checking for shl_load" >&5
-echo $ECHO_N "checking for shl_load... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking for shl_load" >&5
+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; }
if test "${ac_cv_func_shl_load+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -8329,53 +9381,59 @@ cat >>conftest.$ac_ext <<_ACEOF
#undef shl_load
-/* Override any gcc2 internal prototype to avoid an error. */
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
-{
#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
char shl_load ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
-#if defined (__stub_shl_load) || defined (__stub___shl_load)
+#if defined __stub_shl_load || defined __stub___shl_load
choke me
-#else
-char (*f) () = shl_load;
-#endif
-#ifdef __cplusplus
-}
#endif
int
main ()
{
-return f != shl_load;
+return shl_load ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -8384,18 +9442,19 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_func_shl_load=no
+ ac_cv_func_shl_load=no
fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
-echo "${ECHO_T}$ac_cv_func_shl_load" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+echo "${ECHO_T}$ac_cv_func_shl_load" >&6; }
if test $ac_cv_func_shl_load = yes; then
lt_cv_dlopen="shl_load"
else
- echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
-echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; }
if test "${ac_cv_lib_dld_shl_load+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -8408,40 +9467,52 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-/* Override any gcc2 internal prototype to avoid an error. */
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
char shl_load ();
int
main ()
{
-shl_load ();
+return shl_load ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -8450,19 +9521,20 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_lib_dld_shl_load=no
+ ac_cv_lib_dld_shl_load=no
fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
-echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; }
if test $ac_cv_lib_dld_shl_load = yes; then
lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
else
- echo "$as_me:$LINENO: checking for dlopen" >&5
-echo $ECHO_N "checking for dlopen... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking for dlopen" >&5
+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; }
if test "${ac_cv_func_dlopen+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -8489,53 +9561,59 @@ cat >>conftest.$ac_ext <<_ACEOF
#undef dlopen
-/* Override any gcc2 internal prototype to avoid an error. */
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
-{
#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
char dlopen ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
-#if defined (__stub_dlopen) || defined (__stub___dlopen)
+#if defined __stub_dlopen || defined __stub___dlopen
choke me
-#else
-char (*f) () = dlopen;
-#endif
-#ifdef __cplusplus
-}
#endif
int
main ()
{
-return f != dlopen;
+return dlopen ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -8544,18 +9622,19 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_func_dlopen=no
+ ac_cv_func_dlopen=no
fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
-echo "${ECHO_T}$ac_cv_func_dlopen" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+echo "${ECHO_T}$ac_cv_func_dlopen" >&6; }
if test $ac_cv_func_dlopen = yes; then
lt_cv_dlopen="dlopen"
else
- echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
if test "${ac_cv_lib_dl_dlopen+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -8568,40 +9647,52 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-/* Override any gcc2 internal prototype to avoid an error. */
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
char dlopen ();
int
main ()
{
-dlopen ();
+return dlopen ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -8610,19 +9701,20 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_lib_dl_dlopen=no
+ ac_cv_lib_dl_dlopen=no
fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
if test $ac_cv_lib_dl_dlopen = yes; then
lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
else
- echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
-echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; }
if test "${ac_cv_lib_svld_dlopen+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -8635,40 +9727,52 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-/* Override any gcc2 internal prototype to avoid an error. */
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
char dlopen ();
int
main ()
{
-dlopen ();
+return dlopen ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -8677,19 +9781,20 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_lib_svld_dlopen=no
+ ac_cv_lib_svld_dlopen=no
fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; }
if test $ac_cv_lib_svld_dlopen = yes; then
lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
else
- echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
-echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; }
if test "${ac_cv_lib_dld_dld_link+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -8702,40 +9807,52 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-/* Override any gcc2 internal prototype to avoid an error. */
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
char dld_link ();
int
main ()
{
-dld_link ();
+return dld_link ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -8744,14 +9861,15 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_lib_dld_dld_link=no
+ ac_cv_lib_dld_dld_link=no
fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
-echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; }
if test $ac_cv_lib_dld_dld_link = yes; then
lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
fi
@@ -8791,8 +9909,8 @@ fi
save_LIBS="$LIBS"
LIBS="$lt_cv_dlopen_libs $LIBS"
- echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
-echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; }
if test "${lt_cv_dlopen_self+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -8802,7 +9920,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 8805 "configure"
+#line 9923 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -8886,13 +10004,13 @@ rm -fr conftest*
fi
-echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
-echo "${ECHO_T}$lt_cv_dlopen_self" >&6
+{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self" >&6; }
if test "x$lt_cv_dlopen_self" = xyes; then
wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
- echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
-echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; }
if test "${lt_cv_dlopen_self_static+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -8902,7 +10020,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 8905 "configure"
+#line 10023 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -8986,8 +10104,8 @@ rm -fr conftest*
fi
-echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
-echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6
+{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; }
fi
CPPFLAGS="$save_CPPFLAGS"
@@ -9009,13 +10127,13 @@ fi
# Report which library types will actually be built
-echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
-echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6
-echo "$as_me:$LINENO: result: $can_build_shared" >&5
-echo "${ECHO_T}$can_build_shared" >&6
+{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6; }
-echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
-echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
test "$can_build_shared" = "no" && enable_shared=no
# On AIX, shared libraries and static libraries use the same namespace, and
@@ -9035,15 +10153,15 @@ aix4* | aix5*)
fi
;;
esac
-echo "$as_me:$LINENO: result: $enable_shared" >&5
-echo "${ECHO_T}$enable_shared" >&6
+{ echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6; }
-echo "$as_me:$LINENO: checking whether to build static libraries" >&5
-echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
# Make sure either enable_shared or enable_static is yes.
test "$enable_shared" = yes || enable_static=yes
-echo "$as_me:$LINENO: result: $enable_static" >&5
-echo "${ECHO_T}$enable_static" >&6
+{ echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6; }
# The else clause should only fire when bootstrapping the
# libtool distribution, otherwise you forgot to ship ltmain.sh
@@ -9535,11 +10653,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
CC="$lt_save_CC"
-# Check whether --with-tags or --without-tags was given.
+# Check whether --with-tags was given.
if test "${with_tags+set}" = set; then
- withval="$with_tags"
- tagnames="$withval"
-fi;
+ withval=$with_tags; tagnames="$withval"
+fi
+
if test -f "$ltmain" && test -n "$tagnames"; then
if test ! -f "${ofile}"; then
@@ -9593,7 +10711,7 @@ echo "$as_me: error: tag name \"$tagname\" already exists" >&2;}
if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
(test "X$CXX" != "Xg++"))) ; then
- ac_ext=cc
+ ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
@@ -9712,18 +10830,18 @@ if test "$GXX" = yes; then
# Set up default GNU C++ configuration
-# Check whether --with-gnu-ld or --without-gnu-ld was given.
+# Check whether --with-gnu-ld was given.
if test "${with_gnu_ld+set}" = set; then
- withval="$with_gnu_ld"
- test "$withval" = no || with_gnu_ld=yes
+ withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
else
with_gnu_ld=no
-fi;
+fi
+
ac_prog=ld
if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
- echo "$as_me:$LINENO: checking for ld used by $CC" >&5
-echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
@@ -9752,11 +10870,11 @@ echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6
;;
esac
elif test "$with_gnu_ld" = yes; then
- echo "$as_me:$LINENO: checking for GNU ld" >&5
-echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
else
- echo "$as_me:$LINENO: checking for non-GNU ld" >&5
-echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
fi
if test "${lt_cv_path_LD+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -9789,17 +10907,17 @@ fi
LD="$lt_cv_path_LD"
if test -n "$LD"; then
- echo "$as_me:$LINENO: result: $LD" >&5
-echo "${ECHO_T}$LD" >&6
+ { echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
{ (exit 1); exit 1; }; }
-echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
-echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
if test "${lt_cv_prog_gnu_ld+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -9813,8 +10931,8 @@ case `$LD -v 2>&1 </dev/null` in
;;
esac
fi
-echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
-echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
with_gnu_ld=$lt_cv_prog_gnu_ld
@@ -9864,8 +10982,8 @@ else
fi
# PORTME: fill in a description of your system's C++ link characteristics
-echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
ld_shlibs_CXX=yes
case $host_os in
aix3*)
@@ -9977,24 +11095,36 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -10008,8 +11138,10 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
+
fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
@@ -10039,24 +11171,36 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -10070,8 +11214,10 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
+
fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
@@ -10802,8 +11948,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
ld_shlibs_CXX=no
;;
esac
-echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
-echo "${ECHO_T}$ld_shlibs_CXX" >&6
+{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6; }
test "$ld_shlibs_CXX" = no && can_build_shared=no
GCC_CXX="$GXX"
@@ -10942,8 +12088,8 @@ lt_prog_compiler_wl_CXX=
lt_prog_compiler_pic_CXX=
lt_prog_compiler_static_CXX=
-echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
# C++ specific cases for pic, static, wl, etc.
if test "$GXX" = yes; then
@@ -11216,16 +12362,16 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
esac
fi
-echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6; }
#
# Check to make sure the PIC flag actually works.
#
if test -n "$lt_prog_compiler_pic_CXX"; then
-echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
-echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6; }
if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -11242,11 +12388,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:11245: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:12391: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:11249: \$? = $ac_status" >&5
+ echo "$as_me:12395: \$? = $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.
@@ -11259,8 +12405,8 @@ else
$rm conftest*
fi
-echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6; }
if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then
case $lt_prog_compiler_pic_CXX in
@@ -11287,8 +12433,8 @@ esac
# Check to make sure the static flag actually works.
#
wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
-echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
if test "${lt_prog_compiler_static_works_CXX+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -11315,8 +12461,8 @@ else
LDFLAGS="$save_LDFLAGS"
fi
-echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5
-echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6; }
if test x"$lt_prog_compiler_static_works_CXX" = xyes; then
:
@@ -11325,8 +12471,8 @@ else
fi
-echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -11346,11 +12492,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:11349: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:12495: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:11353: \$? = $ac_status" >&5
+ echo "$as_me:12499: \$? = $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
@@ -11372,23 +12518,23 @@ else
$rm conftest*
fi
-echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6; }
hard_links="nottested"
if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
# do not overwrite the value of need_locks provided by the user
- echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
-echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
hard_links=yes
$rm conftest*
ln conftest.a conftest.b 2>/dev/null && hard_links=no
touch conftest.a
ln conftest.a conftest.b 2>&5 || hard_links=no
ln conftest.a conftest.b 2>/dev/null && hard_links=no
- echo "$as_me:$LINENO: result: $hard_links" >&5
-echo "${ECHO_T}$hard_links" >&6
+ { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
if test "$hard_links" = no; then
{ echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
@@ -11398,8 +12544,8 @@ else
need_locks=no
fi
-echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
case $host_os in
@@ -11423,8 +12569,8 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar
;;
esac
-echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
-echo "${ECHO_T}$ld_shlibs_CXX" >&6
+{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6; }
test "$ld_shlibs_CXX" = no && can_build_shared=no
#
@@ -11444,8 +12590,8 @@ x|xyes)
# Test whether the compiler implicitly links with -lc since on some
# systems, -lgcc has to come before -lc. If gcc already passes -lc
# to ld, don't add -lc before -lgcc.
- echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
-echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
$rm conftest*
printf "$lt_simple_compile_test_code" > conftest.$ac_ext
@@ -11482,16 +12628,16 @@ echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&
cat conftest.err 1>&5
fi
$rm conftest*
- echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5
-echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6
+ { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6; }
;;
esac
fi
;;
esac
-echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
-echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
library_names_spec=
libname_spec='lib$name'
soname_spec=
@@ -12115,8 +13261,8 @@ uts4*)
dynamic_linker=no
;;
esac
-echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-echo "${ECHO_T}$dynamic_linker" >&6
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
test "$dynamic_linker" = no && can_build_shared=no
variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
@@ -12124,8 +13270,8 @@ if test "$GCC" = yes; then
variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
fi
-echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
-echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
hardcode_action_CXX=
if test -n "$hardcode_libdir_flag_spec_CXX" || \
test -n "$runpath_var_CXX" || \
@@ -12149,8 +13295,8 @@ else
# directories.
hardcode_action_CXX=unsupported
fi
-echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5
-echo "${ECHO_T}$hardcode_action_CXX" >&6
+{ echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5
+echo "${ECHO_T}$hardcode_action_CXX" >&6; }
if test "$hardcode_action_CXX" = relink; then
# Fast installation is not supported
@@ -12675,13 +13821,13 @@ done
cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
-echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
-echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6
-echo "$as_me:$LINENO: result: $can_build_shared" >&5
-echo "${ECHO_T}$can_build_shared" >&6
+{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6; }
-echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
-echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
test "$can_build_shared" = "no" && enable_shared=no
# On AIX, shared libraries and static libraries use the same namespace, and
@@ -12700,15 +13846,15 @@ aix4* | aix5*)
fi
;;
esac
-echo "$as_me:$LINENO: result: $enable_shared" >&5
-echo "${ECHO_T}$enable_shared" >&6
+{ echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6; }
-echo "$as_me:$LINENO: checking whether to build static libraries" >&5
-echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
# Make sure either enable_shared or enable_static is yes.
test "$enable_shared" = yes || enable_static=yes
-echo "$as_me:$LINENO: result: $enable_static" >&5
-echo "${ECHO_T}$enable_static" >&6
+{ echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6; }
GCC_F77="$G77"
LD_F77="$LD"
@@ -12717,8 +13863,8 @@ lt_prog_compiler_wl_F77=
lt_prog_compiler_pic_F77=
lt_prog_compiler_static_F77=
-echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
if test "$GCC" = yes; then
lt_prog_compiler_wl_F77='-Wl,'
@@ -12927,16 +14073,16 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
esac
fi
-echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6; }
#
# Check to make sure the PIC flag actually works.
#
if test -n "$lt_prog_compiler_pic_F77"; then
-echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5
-echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6; }
if test "${lt_prog_compiler_pic_works_F77+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -12953,11 +14099,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:12956: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14102: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:12960: \$? = $ac_status" >&5
+ echo "$as_me:14106: \$? = $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.
@@ -12970,8 +14116,8 @@ else
$rm conftest*
fi
-echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6; }
if test x"$lt_prog_compiler_pic_works_F77" = xyes; then
case $lt_prog_compiler_pic_F77 in
@@ -12998,8 +14144,8 @@ esac
# Check to make sure the static flag actually works.
#
wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\"
-echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
if test "${lt_prog_compiler_static_works_F77+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -13026,8 +14172,8 @@ else
LDFLAGS="$save_LDFLAGS"
fi
-echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_F77" >&5
-echo "${ECHO_T}$lt_prog_compiler_static_works_F77" >&6
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_F77" >&6; }
if test x"$lt_prog_compiler_static_works_F77" = xyes; then
:
@@ -13036,8 +14182,8 @@ else
fi
-echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -13057,11 +14203,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:13060: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14206: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:13064: \$? = $ac_status" >&5
+ echo "$as_me:14210: \$? = $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
@@ -13083,23 +14229,23 @@ else
$rm conftest*
fi
-echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6; }
hard_links="nottested"
if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then
# do not overwrite the value of need_locks provided by the user
- echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
-echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
hard_links=yes
$rm conftest*
ln conftest.a conftest.b 2>/dev/null && hard_links=no
touch conftest.a
ln conftest.a conftest.b 2>&5 || hard_links=no
ln conftest.a conftest.b 2>/dev/null && hard_links=no
- echo "$as_me:$LINENO: result: $hard_links" >&5
-echo "${ECHO_T}$hard_links" >&6
+ { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
if test "$hard_links" = no; then
{ echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
@@ -13109,8 +14255,8 @@ else
need_locks=no
fi
-echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
runpath_var=
allow_undefined_flag_F77=
@@ -13515,24 +14661,36 @@ _LT_EOF
end
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_f77_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -13546,8 +14704,10 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
+
fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
@@ -13566,24 +14726,36 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
end
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_f77_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -13597,8 +14769,10 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
+
fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
@@ -14047,8 +15221,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
fi
-echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5
-echo "${ECHO_T}$ld_shlibs_F77" >&6
+{ echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5
+echo "${ECHO_T}$ld_shlibs_F77" >&6; }
test "$ld_shlibs_F77" = no && can_build_shared=no
#
@@ -14068,8 +15242,8 @@ x|xyes)
# Test whether the compiler implicitly links with -lc since on some
# systems, -lgcc has to come before -lc. If gcc already passes -lc
# to ld, don't add -lc before -lgcc.
- echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
-echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
$rm conftest*
printf "$lt_simple_compile_test_code" > conftest.$ac_ext
@@ -14106,16 +15280,16 @@ echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&
cat conftest.err 1>&5
fi
$rm conftest*
- echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5
-echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6
+ { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6; }
;;
esac
fi
;;
esac
-echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
-echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
library_names_spec=
libname_spec='lib$name'
soname_spec=
@@ -14739,8 +15913,8 @@ uts4*)
dynamic_linker=no
;;
esac
-echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-echo "${ECHO_T}$dynamic_linker" >&6
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
test "$dynamic_linker" = no && can_build_shared=no
variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
@@ -14748,8 +15922,8 @@ if test "$GCC" = yes; then
variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
fi
-echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
-echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
hardcode_action_F77=
if test -n "$hardcode_libdir_flag_spec_F77" || \
test -n "$runpath_var_F77" || \
@@ -14773,8 +15947,8 @@ else
# directories.
hardcode_action_F77=unsupported
fi
-echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5
-echo "${ECHO_T}$hardcode_action_F77" >&6
+{ echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5
+echo "${ECHO_T}$hardcode_action_F77" >&6; }
if test "$hardcode_action_F77" = relink; then
# Fast installation is not supported
@@ -15211,7 +16385,6 @@ CC="$lt_save_CC"
if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
-
# Source file extension for Java test sources.
ac_ext=java
@@ -15279,8 +16452,8 @@ if test "$GCC" = yes; then
lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin'
-echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
-echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -15297,11 +16470,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:15300: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16473: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15304: \$? = $ac_status" >&5
+ echo "$as_me:16477: \$? = $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.
@@ -15314,8 +16487,8 @@ else
$rm conftest*
fi
-echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions"
@@ -15329,8 +16502,8 @@ lt_prog_compiler_wl_GCJ=
lt_prog_compiler_pic_GCJ=
lt_prog_compiler_static_GCJ=
-echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
if test "$GCC" = yes; then
lt_prog_compiler_wl_GCJ='-Wl,'
@@ -15539,16 +16712,16 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
esac
fi
-echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6; }
#
# Check to make sure the PIC flag actually works.
#
if test -n "$lt_prog_compiler_pic_GCJ"; then
-echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5
-echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6; }
if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -15565,11 +16738,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:15568: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16741: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15572: \$? = $ac_status" >&5
+ echo "$as_me:16745: \$? = $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.
@@ -15582,8 +16755,8 @@ else
$rm conftest*
fi
-echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6; }
if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then
case $lt_prog_compiler_pic_GCJ in
@@ -15610,8 +16783,8 @@ esac
# Check to make sure the static flag actually works.
#
wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\"
-echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
if test "${lt_prog_compiler_static_works_GCJ+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -15638,8 +16811,8 @@ else
LDFLAGS="$save_LDFLAGS"
fi
-echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5
-echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6; }
if test x"$lt_prog_compiler_static_works_GCJ" = xyes; then
:
@@ -15648,8 +16821,8 @@ else
fi
-echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -15669,11 +16842,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:15672: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16845: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:15676: \$? = $ac_status" >&5
+ echo "$as_me:16849: \$? = $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
@@ -15695,23 +16868,23 @@ else
$rm conftest*
fi
-echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6; }
hard_links="nottested"
if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then
# do not overwrite the value of need_locks provided by the user
- echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
-echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
hard_links=yes
$rm conftest*
ln conftest.a conftest.b 2>/dev/null && hard_links=no
touch conftest.a
ln conftest.a conftest.b 2>&5 || hard_links=no
ln conftest.a conftest.b 2>/dev/null && hard_links=no
- echo "$as_me:$LINENO: result: $hard_links" >&5
-echo "${ECHO_T}$hard_links" >&6
+ { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
if test "$hard_links" = no; then
{ echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
@@ -15721,8 +16894,8 @@ else
need_locks=no
fi
-echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
runpath_var=
allow_undefined_flag_GCJ=
@@ -16137,24 +17310,36 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -16168,8 +17353,10 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
+
fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
@@ -16198,24 +17385,36 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -16229,8 +17428,10 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
+
fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
@@ -16679,8 +17880,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
fi
-echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5
-echo "${ECHO_T}$ld_shlibs_GCJ" >&6
+{ echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5
+echo "${ECHO_T}$ld_shlibs_GCJ" >&6; }
test "$ld_shlibs_GCJ" = no && can_build_shared=no
#
@@ -16700,8 +17901,8 @@ x|xyes)
# Test whether the compiler implicitly links with -lc since on some
# systems, -lgcc has to come before -lc. If gcc already passes -lc
# to ld, don't add -lc before -lgcc.
- echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
-echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
$rm conftest*
printf "$lt_simple_compile_test_code" > conftest.$ac_ext
@@ -16738,16 +17939,16 @@ echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&
cat conftest.err 1>&5
fi
$rm conftest*
- echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5
-echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6
+ { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6; }
;;
esac
fi
;;
esac
-echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
-echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
library_names_spec=
libname_spec='lib$name'
soname_spec=
@@ -17371,8 +18572,8 @@ uts4*)
dynamic_linker=no
;;
esac
-echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-echo "${ECHO_T}$dynamic_linker" >&6
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
test "$dynamic_linker" = no && can_build_shared=no
variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
@@ -17380,8 +18581,8 @@ if test "$GCC" = yes; then
variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
fi
-echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
-echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
hardcode_action_GCJ=
if test -n "$hardcode_libdir_flag_spec_GCJ" || \
test -n "$runpath_var_GCJ" || \
@@ -17405,8 +18606,8 @@ else
# directories.
hardcode_action_GCJ=unsupported
fi
-echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5
-echo "${ECHO_T}$hardcode_action_GCJ" >&6
+{ echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5
+echo "${ECHO_T}$hardcode_action_GCJ" >&6; }
if test "$hardcode_action_GCJ" = relink; then
# Fast installation is not supported
@@ -17842,7 +19043,6 @@ CC="$lt_save_CC"
RC)
-
# Source file extension for RC test sources.
ac_ext=rc
@@ -18384,8 +19584,8 @@ BUILD_EXEEXT=${BUILD_EXEEXT:-'$(EXEEXT)'}
BUILD_OBJEXT=${BUILD_OBJEXT:-'$(OBJEXT)'}
-echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
if test "${ac_cv_header_stdc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -18409,24 +19609,36 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -18435,9 +19647,10 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_header_stdc=no
+ ac_cv_header_stdc=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
@@ -18493,6 +19706,7 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <ctype.h>
+#include <stdlib.h>
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
@@ -18512,18 +19726,27 @@ main ()
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
|| toupper (i) != TOUPPER (i))
- exit(2);
- exit (0);
+ return 2;
+ return 0;
}
_ACEOF
rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -18536,12 +19759,14 @@ sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_header_stdc=no
fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
+
+
fi
fi
-echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
if test $ac_cv_header_stdc = yes; then
cat >>confdefs.h <<\_ACEOF
@@ -18554,18 +19779,19 @@ fi
for ac_header in limits.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
else
# Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -18576,24 +19802,36 @@ $ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -18602,15 +19840,16 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_header_compiler=no
+ ac_header_compiler=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -18619,8 +19858,13 @@ cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
@@ -18644,9 +19888,10 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
+
rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
@@ -18670,25 +19915,19 @@ echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to the AC_PACKAGE_NAME lists. ##
-## ------------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
+
;;
esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=\$ac_header_preproc"
fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
@@ -18705,8 +19944,7 @@ done
if test "x$want_cpp" = "xyes" -a -n "$CXX"
then
-
-ac_ext=cc
+ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
@@ -18718,18 +19956,19 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
for ac_header in string
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
else
# Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -18740,24 +19979,36 @@ $ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -18766,15 +20017,16 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_header_compiler=no
+ ac_header_compiler=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -18783,8 +20035,13 @@ cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
@@ -18808,9 +20065,10 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
+
rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
@@ -18834,25 +20092,19 @@ echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to the AC_PACKAGE_NAME lists. ##
-## ------------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
+
;;
esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=\$ac_header_preproc"
fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
@@ -18870,18 +20122,19 @@ done
for ac_header in bits/type_traits.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
else
# Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -18892,24 +20145,36 @@ $ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -18918,15 +20183,16 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_header_compiler=no
+ ac_header_compiler=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -18935,8 +20201,13 @@ cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
@@ -18960,9 +20231,10 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
+
rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
@@ -18986,25 +20258,19 @@ echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to the AC_PACKAGE_NAME lists. ##
-## ------------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
+
;;
esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=\$ac_header_preproc"
fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
@@ -19022,18 +20288,19 @@ done
for ac_header in type_traits.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
else
# Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -19044,24 +20311,36 @@ $ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -19070,15 +20349,16 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_header_compiler=no
+ ac_header_compiler=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -19087,8 +20367,13 @@ cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
@@ -19112,9 +20397,10 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
+
rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
@@ -19138,25 +20424,19 @@ echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to the AC_PACKAGE_NAME lists. ##
-## ------------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
+
;;
esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=\$ac_header_preproc"
fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
@@ -19191,8 +20471,8 @@ fi
-echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
-echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; }
if test "${ac_cv_c_const+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -19232,6 +20512,7 @@ main ()
char const *s = 0 ? (char *) 0 : (char const *) 0;
*t++ = 0;
+ if (s) return 0;
}
{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
int x[] = {25, 17};
@@ -19250,7 +20531,9 @@ main ()
}
{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
const int foo = 10;
+ if (!foo) return 0;
}
+ return !x[0] && !zero.x;
#endif
;
@@ -19258,24 +20541,36 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -19284,12 +20579,13 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_c_const=no
+ ac_cv_c_const=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
-echo "${ECHO_T}$ac_cv_c_const" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6; }
if test $ac_cv_c_const = no; then
cat >>confdefs.h <<\_ACEOF
@@ -19298,8 +20594,8 @@ _ACEOF
fi
-echo "$as_me:$LINENO: checking for size_t" >&5
-echo $ECHO_N "checking for size_t... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for size_t" >&5
+echo $ECHO_N "checking for size_t... $ECHO_C" >&6; }
if test "${ac_cv_type_size_t+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -19310,36 +20606,49 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
+typedef size_t ac__type_new_;
int
main ()
{
-if ((size_t *) 0)
+if ((ac__type_new_ *) 0)
return 0;
-if (sizeof (size_t))
+if (sizeof (ac__type_new_))
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -19348,25 +20657,26 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_type_size_t=no
+ ac_cv_type_size_t=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
-echo "${ECHO_T}$ac_cv_type_size_t" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+echo "${ECHO_T}$ac_cv_type_size_t" >&6; }
if test $ac_cv_type_size_t = yes; then
:
else
cat >>confdefs.h <<_ACEOF
-#define size_t unsigned
+#define size_t unsigned int
_ACEOF
fi
-echo "$as_me:$LINENO: checking for long long" >&5
-echo $ECHO_N "checking for long long... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for long long" >&5
+echo $ECHO_N "checking for long long... $ECHO_C" >&6; }
if test "${ac_cv_type_long_long+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -19377,36 +20687,49 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
+typedef long long ac__type_new_;
int
main ()
{
-if ((long long *) 0)
+if ((ac__type_new_ *) 0)
return 0;
-if (sizeof (long long))
+if (sizeof (ac__type_new_))
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -19415,12 +20738,13 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_type_long_long=no
+ ac_cv_type_long_long=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5
-echo "${ECHO_T}$ac_cv_type_long_long" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5
+echo "${ECHO_T}$ac_cv_type_long_long" >&6; }
if test $ac_cv_type_long_long = yes; then
cat >>confdefs.h <<_ACEOF
@@ -19432,8 +20756,8 @@ else
pcre_have_long_long="0"
fi
-echo "$as_me:$LINENO: checking for unsigned long long" >&5
-echo $ECHO_N "checking for unsigned long long... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for unsigned long long" >&5
+echo $ECHO_N "checking for unsigned long long... $ECHO_C" >&6; }
if test "${ac_cv_type_unsigned_long_long+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -19444,36 +20768,49 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
+typedef unsigned long long ac__type_new_;
int
main ()
{
-if ((unsigned long long *) 0)
+if ((ac__type_new_ *) 0)
return 0;
-if (sizeof (unsigned long long))
+if (sizeof (ac__type_new_))
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -19482,12 +20819,13 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_type_unsigned_long_long=no
+ ac_cv_type_unsigned_long_long=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_long" >&5
-echo "${ECHO_T}$ac_cv_type_unsigned_long_long" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_long" >&5
+echo "${ECHO_T}$ac_cv_type_unsigned_long_long" >&6; }
if test $ac_cv_type_unsigned_long_long = yes; then
cat >>confdefs.h <<_ACEOF
@@ -19511,9 +20849,9 @@ fi
for ac_func in bcopy memmove strerror strtoq strtoll
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
@@ -19539,53 +20877,59 @@ cat >>conftest.$ac_ext <<_ACEOF
#undef $ac_func
-/* Override any gcc2 internal prototype to avoid an error. */
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
-{
#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
char $ac_func ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+#if defined __stub_$ac_func || defined __stub___$ac_func
choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
#endif
int
main ()
{
-return f != $ac_func;
+return $ac_func ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -19594,13 +20938,15 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-eval "$as_ac_var=no"
+ eval "$as_ac_var=no"
fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+ac_res=`eval echo '${'$as_ac_var'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
if test `eval echo '${'$as_ac_var'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
@@ -19611,111 +20957,121 @@ done
-# Check whether --enable-utf8 or --disable-utf8 was given.
+# Check whether --enable-utf8 was given.
if test "${enable_utf8+set}" = set; then
- enableval="$enable_utf8"
- if test "$enableval" = "yes"; then
+ enableval=$enable_utf8; if test "$enableval" = "yes"; then
UTF8=-DSUPPORT_UTF8
fi
-fi;
+fi
-# Check whether --enable-unicode-properties or --disable-unicode-properties was given.
+
+# Check whether --enable-unicode-properties was given.
if test "${enable_unicode_properties+set}" = set; then
- enableval="$enable_unicode_properties"
- if test "$enableval" = "yes"; then
+ enableval=$enable_unicode_properties; if test "$enableval" = "yes"; then
UCP=-DSUPPORT_UCP
fi
-fi;
+fi
-# Check whether --enable-newline-is-cr or --disable-newline-is-cr was given.
+
+# Check whether --enable-newline-is-cr was given.
if test "${enable_newline_is_cr+set}" = set; then
- enableval="$enable_newline_is_cr"
- if test "$enableval" = "yes"; then
+ enableval=$enable_newline_is_cr; if test "$enableval" = "yes"; then
NEWLINE=-DNEWLINE=13
fi
-fi;
+fi
+
-# Check whether --enable-newline-is-lf or --disable-newline-is-lf was given.
+# Check whether --enable-newline-is-lf was given.
if test "${enable_newline_is_lf+set}" = set; then
- enableval="$enable_newline_is_lf"
- if test "$enableval" = "yes"; then
+ enableval=$enable_newline_is_lf; if test "$enableval" = "yes"; then
NEWLINE=-DNEWLINE=10
fi
-fi;
+fi
+
-# Check whether --enable-newline-is-crlf or --disable-newline-is-crlf was given.
+# Check whether --enable-newline-is-crlf was given.
if test "${enable_newline_is_crlf+set}" = set; then
- enableval="$enable_newline_is_crlf"
- if test "$enableval" = "yes"; then
+ enableval=$enable_newline_is_crlf; if test "$enableval" = "yes"; then
NEWLINE=-DNEWLINE=3338
fi
-fi;
+fi
+
+
+
+# Check whether --enable-newline-is-any was given.
+if test "${enable_newline_is_any+set}" = set; then
+ enableval=$enable_newline_is_any; if test "$enableval" = "yes"; then
+ NEWLINE=-DNEWLINE=-1
+fi
+
+fi
+
-# Check whether --enable-ebcdic or --disable-ebcdic was given.
+# Check whether --enable-ebcdic was given.
if test "${enable_ebcdic+set}" = set; then
- enableval="$enable_ebcdic"
- if test "$enableval" == "yes"; then
+ enableval=$enable_ebcdic; if test "$enableval" = "yes"; then
EBCDIC=-DEBCDIC=1
fi
-fi;
+fi
+
-# Check whether --enable-stack-for-recursion or --disable-stack-for-recursion was given.
+# Check whether --enable-stack-for-recursion was given.
if test "${enable_stack_for_recursion+set}" = set; then
- enableval="$enable_stack_for_recursion"
- if test "$enableval" = "no"; then
+ enableval=$enable_stack_for_recursion; if test "$enableval" = "no"; then
NO_RECURSE=-DNO_RECURSE
fi
-fi;
+fi
+
-# Check whether --with-posix-malloc-threshold or --without-posix-malloc-threshold was given.
+# Check whether --with-posix-malloc-threshold was given.
if test "${with_posix_malloc_threshold+set}" = set; then
- withval="$with_posix_malloc_threshold"
- POSIX_MALLOC_THRESHOLD=-DPOSIX_MALLOC_THRESHOLD=$withval
+ withval=$with_posix_malloc_threshold; POSIX_MALLOC_THRESHOLD=-DPOSIX_MALLOC_THRESHOLD=$withval
+
+fi
-fi;
-# Check whether --with-link-size or --without-link-size was given.
+# Check whether --with-link-size was given.
if test "${with_link_size+set}" = set; then
- withval="$with_link_size"
- LINK_SIZE=-DLINK_SIZE=$withval
+ withval=$with_link_size; LINK_SIZE=-DLINK_SIZE=$withval
-fi;
+fi
-# Check whether --with-match-limit or --without-match-limit was given.
+
+# Check whether --with-match-limit was given.
if test "${with_match_limit+set}" = set; then
- withval="$with_match_limit"
- MATCH_LIMIT=-DMATCH_LIMIT=$withval
+ withval=$with_match_limit; MATCH_LIMIT=-DMATCH_LIMIT=$withval
+
+fi
-fi;
-# Check whether --with-match-limit-recursion or --without-match-limit-recursion was given.
+# Check whether --with-match-limit-recursion was given.
if test "${with_match_limit_recursion+set}" = set; then
- withval="$with_match_limit_recursion"
- MATCH_LIMIT_RECURSION=-DMATCH_LIMIT_RECURSION=$withval
+ withval=$with_match_limit_recursion; MATCH_LIMIT_RECURSION=-DMATCH_LIMIT_RECURSION=$withval
+
+fi
-fi;
if test "$UCP" != "" ; then
@@ -19780,8 +21136,10 @@ _ACEOF
fi
- ac_config_files="$ac_config_files Makefile pcre-config:pcre-config.in libpcre.pc:libpcre.pc.in pcrecpparg.h:pcrecpparg.h.in pcre_stringpiece.h:pcre_stringpiece.h.in RunGrepTest:RunGrepTest.in RunTest:RunTest.in"
- ac_config_commands="$ac_config_commands default"
+ac_config_files="$ac_config_files Makefile pcre-config:pcre-config.in libpcre.pc:libpcre.pc.in libpcrecpp.pc:libpcrecpp.pc.in pcrecpparg.h:pcrecpparg.h.in pcre_stringpiece.h:pcre_stringpiece.h.in RunGrepTest:RunGrepTest.in RunTest:RunTest.in"
+
+ac_config_commands="$ac_config_commands default"
+
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
@@ -19800,39 +21158,58 @@ _ACEOF
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
+# So, we kill variables containing newlines.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
-{
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
+
(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote
# substitution turns \\\\ into \\, and sed turns \\ into \).
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
- ;;
+ ;; #(
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
- esac;
-} |
+ esac |
+ sort
+) |
sed '
+ /^ac_cv_env_/b end
t clear
- : clear
+ :clear
s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
t end
- /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
- : end' >>confcache
-if diff $cache_file confcache >/dev/null 2>&1; then :; else
- if test -w $cache_file; then
- test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ test "x$cache_file" != "x/dev/null" &&
+ { echo "$as_me:$LINENO: updating cache $cache_file" >&5
+echo "$as_me: updating cache $cache_file" >&6;}
cat confcache >$cache_file
else
- echo "not updating unwritable cache $cache_file"
+ { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+echo "$as_me: not updating unwritable cache $cache_file" >&6;}
fi
fi
rm -f confcache
@@ -19841,32 +21218,18 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=/{
-s/:*\$(srcdir):*/:/;
-s/:*\${srcdir}:*/:/;
-s/:*@srcdir@:*/:/;
-s/^\([^=]*=[ ]*\):*/\1/;
-s/:*$//;
-s/^[^=]*=[ ]*$//;
-}'
-fi
-
DEFS=-DHAVE_CONFIG_H
ac_libobjs=
ac_ltlibobjs=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
- ac_i=`echo "$ac_i" |
- sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
- # 2. Add them.
- ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
- ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs
@@ -19904,11 +21267,35 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
DUALCASE=1; export DUALCASE # for MKS sh
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
# Support unset when possible.
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
as_unset=unset
@@ -19917,8 +21304,43 @@ else
fi
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
PS1='$ '
PS2='> '
PS4='+ '
@@ -19932,18 +21354,19 @@ do
if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
- $as_unset $as_var
+ ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
fi
done
# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
@@ -19951,159 +21374,120 @@ fi
# Name of the executable.
-as_me=`$as_basename "$0" ||
+as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)$' \| \
- . : '\(.\)' 2>/dev/null ||
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
-
-
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
+# CDPATH.
+$as_unset CDPATH
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" || {
- # Find who we are. Look in the path if we contain no path at all
- # relative or not.
- case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
- ;;
- esac
- # We did not find ourselves, most probably we were run as `sh COMMAND'
- # in which case we are not to be found in the path.
- if test "x$as_myself" = x; then
- as_myself=$0
- fi
- if test ! -f "$as_myself"; then
- { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
-echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
- { (exit 1); exit 1; }; }
- fi
- case $CONFIG_SHELL in
- '')
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for as_base in sh bash ksh sh5; do
- case $as_dir in
- /*)
- if ("$as_dir/$as_base" -c '
as_lineno_1=$LINENO
as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
- $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
- $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
- CONFIG_SHELL=$as_dir/$as_base
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" ${1+"$@"}
- fi;;
- esac
- done
-done
-;;
- esac
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
# Create $as_me.lineno as a copy of $as_myself, but with $LINENO
# uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line before each line; the second 'sed' does the real
- # work. The second script uses 'N' to pair each line-number line
- # with the numbered line, and appends trailing '-' during
- # substitution so that $LINENO is not a special case at line end.
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
# (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
- sed '=' <$as_myself |
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
N
- s,$,-,
- : loop
- s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
t loop
- s,-$,,
- s,^['$as_cr_digits']*\n,,
+ s/-\n.*//
' >$as_me.lineno &&
- chmod +x $as_me.lineno ||
- { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
-echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+ chmod +x "$as_me.lineno" ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
{ (exit 1); exit 1; }; }
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
# Exit status is that of the last command.
exit
}
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
esac
-if expr a : '\(a\)' >/dev/null 2>&1; then
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir
+fi
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
- # We could just check for DJGPP; but this test a) works b) is more generic
- # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
- if test -f conf$$.exe; then
- # Don't use ln at all; we don't have any links
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -p'
- else
- as_ln_s='ln -s'
- fi
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
fi
-rm -f conf$$ conf$$.exe conf$$.file
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
if mkdir -p . 2>/dev/null; then
as_mkdir_p=:
@@ -20112,7 +21496,19 @@ else
as_mkdir_p=false
fi
-as_executable_p="test -f"
+# Find out whether ``test -x'' works. Don't use a zero-byte file, as
+# systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+ as_executable_p="test -x"
+else
+ as_executable_p=:
+fi
+rm -f conf$$.file
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -20121,31 +21517,14 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
exec 6>&1
-# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# Save the log message, to keep $[0] and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling. Logging --version etc. is OK.
-exec 5>>config.log
-{
- echo
- sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
-} >&5
-cat >&5 <<_CSEOF
-
+# values after options handling.
+ac_log="
This file was extended by $as_me, which was
-generated by GNU Autoconf 2.59. Invocation command line was
+generated by GNU Autoconf 2.60. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -20153,30 +21532,20 @@ generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_COMMANDS = $CONFIG_COMMANDS
$ $0 $@
-_CSEOF
-echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
-echo >&5
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
# Files that config.status was made for.
-if test -n "$ac_config_files"; then
- echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_headers"; then
- echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
-fi
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
-if test -n "$ac_config_links"; then
- echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_commands"; then
- echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
-fi
+_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
-
ac_cs_usage="\
\`$as_me' instantiates files from templates according to the
current configuration.
@@ -20203,19 +21572,21 @@ Configuration commands:
$config_commands
Report bugs to <bug-autoconf@gnu.org>."
-_ACEOF
+_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
config.status
-configured by $0, generated by GNU Autoconf 2.59,
- with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+configured by $0, generated by GNU Autoconf 2.60,
+ with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
-Copyright (C) 2003 Free Software Foundation, Inc.
+Copyright (C) 2006 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
-srcdir=$srcdir
-INSTALL="$INSTALL"
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
@@ -20226,39 +21597,24 @@ while test $# != 0
do
case $1 in
--*=*)
- ac_option=`expr "x$1" : 'x\([^=]*\)='`
- ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ac_shift=:
;;
- -*)
+ *)
ac_option=$1
ac_optarg=$2
ac_shift=shift
;;
- *) # This is not an option, so the user has probably given explicit
- # arguments.
- ac_option=$1
- ac_need_defaults=false;;
esac
case $ac_option in
# Handling of the options.
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
ac_cs_recheck=: ;;
- --version | --vers* | -V )
- echo "$ac_cs_version"; exit 0 ;;
- --he | --h)
- # Conflict between --help and --header
- { { echo "$as_me:$LINENO: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2;}
- { (exit 1); exit 1; }; };;
- --help | --hel | -h )
- echo "$ac_cs_usage"; exit 0 ;;
- --debug | --d* | -d )
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ echo "$ac_cs_version"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
debug=: ;;
--file | --fil | --fi | --f )
$ac_shift
@@ -20268,18 +21624,24 @@ Try \`$0 --help' for more information." >&2;}
$ac_shift
CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
ac_need_defaults=false;;
+ --he | --h)
+ # Conflict between --help and --header
+ { echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ echo "$ac_cs_usage"; exit ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
ac_cs_silent=: ;;
# This is an error.
- -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2;}
+ -*) { echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
{ (exit 1); exit 1; }; } ;;
- *) ac_config_targets="$ac_config_targets $1" ;;
+ *) ac_config_targets="$ac_config_targets $1"
+ ac_need_defaults=false ;;
esac
shift
@@ -20295,36 +21657,51 @@ fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
if \$ac_cs_recheck; then
- echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
- exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ CONFIG_SHELL=$SHELL
+ export CONFIG_SHELL
+ exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
fi
_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ echo "$ac_log"
+} >&5
-
-
-
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
+
+# Handling of arguments.
for ac_config_target in $ac_config_targets
do
- case "$ac_config_target" in
- # Handling of arguments.
- "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
- "pcre-config" ) CONFIG_FILES="$CONFIG_FILES pcre-config:pcre-config.in" ;;
- "libpcre.pc" ) CONFIG_FILES="$CONFIG_FILES libpcre.pc:libpcre.pc.in" ;;
- "pcrecpparg.h" ) CONFIG_FILES="$CONFIG_FILES pcrecpparg.h:pcrecpparg.h.in" ;;
- "pcre_stringpiece.h" ) CONFIG_FILES="$CONFIG_FILES pcre_stringpiece.h:pcre_stringpiece.h.in" ;;
- "RunGrepTest" ) CONFIG_FILES="$CONFIG_FILES RunGrepTest:RunGrepTest.in" ;;
- "RunTest" ) CONFIG_FILES="$CONFIG_FILES RunTest:RunTest.in" ;;
- "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
- "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ case $ac_config_target in
+ "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "pcre-config") CONFIG_FILES="$CONFIG_FILES pcre-config:pcre-config.in" ;;
+ "libpcre.pc") CONFIG_FILES="$CONFIG_FILES libpcre.pc:libpcre.pc.in" ;;
+ "libpcrecpp.pc") CONFIG_FILES="$CONFIG_FILES libpcrecpp.pc:libpcrecpp.pc.in" ;;
+ "pcrecpparg.h") CONFIG_FILES="$CONFIG_FILES pcrecpparg.h:pcrecpparg.h.in" ;;
+ "pcre_stringpiece.h") CONFIG_FILES="$CONFIG_FILES pcre_stringpiece.h:pcre_stringpiece.h.in" ;;
+ "RunGrepTest") CONFIG_FILES="$CONFIG_FILES RunGrepTest:RunGrepTest.in" ;;
+ "RunTest") CONFIG_FILES="$CONFIG_FILES RunTest:RunTest.in" ;;
+ "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
+
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
{ (exit 1); exit 1; }; };;
esac
done
+
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# We use the long form for the default assignment because of an extremely
@@ -20336,362 +21713,465 @@ if $ac_need_defaults; then
fi
# Have a temporary directory for convenience. Make it in the build tree
-# simply because there is no reason to put it here, and in addition,
+# simply because there is no reason against having it here, and in addition,
# creating and moving files from /tmp can sometimes cause problems.
-# Create a temporary directory, and hook for its removal unless debugging.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
$debug ||
{
- trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+ tmp=
+ trap 'exit_status=$?
+ { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
trap '{ (exit 1); exit 1; }' 1 2 13 15
}
-
# Create a (secure) tmp directory for tmp files.
{
- tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
test -n "$tmp" && test -d "$tmp"
} ||
{
- tmp=./confstat$$-$RANDOM
- (umask 077 && mkdir $tmp)
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
} ||
{
echo "$me: cannot create a temporary directory in ." >&2
{ (exit 1); exit 1; }
}
-_ACEOF
-
-cat >>$CONFIG_STATUS <<_ACEOF
-
#
-# CONFIG_FILES section.
+# Set up the sed scripts for CONFIG_FILES section.
#
# No need to generate the scripts if there are no CONFIG_FILES.
# This happens for instance when ./config.status config.h
-if test -n "\$CONFIG_FILES"; then
- # Protect against being on the right side of a sed subst in config.status.
- sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
- s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
-s,@SHELL@,$SHELL,;t t
-s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
-s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
-s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
-s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
-s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
-s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
-s,@exec_prefix@,$exec_prefix,;t t
-s,@prefix@,$prefix,;t t
-s,@program_transform_name@,$program_transform_name,;t t
-s,@bindir@,$bindir,;t t
-s,@sbindir@,$sbindir,;t t
-s,@libexecdir@,$libexecdir,;t t
-s,@datadir@,$datadir,;t t
-s,@sysconfdir@,$sysconfdir,;t t
-s,@sharedstatedir@,$sharedstatedir,;t t
-s,@localstatedir@,$localstatedir,;t t
-s,@libdir@,$libdir,;t t
-s,@includedir@,$includedir,;t t
-s,@oldincludedir@,$oldincludedir,;t t
-s,@infodir@,$infodir,;t t
-s,@mandir@,$mandir,;t t
-s,@build_alias@,$build_alias,;t t
-s,@host_alias@,$host_alias,;t t
-s,@target_alias@,$target_alias,;t t
-s,@DEFS@,$DEFS,;t t
-s,@ECHO_C@,$ECHO_C,;t t
-s,@ECHO_N@,$ECHO_N,;t t
-s,@ECHO_T@,$ECHO_T,;t t
-s,@LIBS@,$LIBS,;t t
-s,@CC@,$CC,;t t
-s,@CFLAGS@,$CFLAGS,;t t
-s,@LDFLAGS@,$LDFLAGS,;t t
-s,@CPPFLAGS@,$CPPFLAGS,;t t
-s,@ac_ct_CC@,$ac_ct_CC,;t t
-s,@EXEEXT@,$EXEEXT,;t t
-s,@OBJEXT@,$OBJEXT,;t t
-s,@CXX@,$CXX,;t t
-s,@CXXFLAGS@,$CXXFLAGS,;t t
-s,@ac_ct_CXX@,$ac_ct_CXX,;t t
-s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
-s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
-s,@INSTALL_DATA@,$INSTALL_DATA,;t t
-s,@build@,$build,;t t
-s,@build_cpu@,$build_cpu,;t t
-s,@build_vendor@,$build_vendor,;t t
-s,@build_os@,$build_os,;t t
-s,@host@,$host,;t t
-s,@host_cpu@,$host_cpu,;t t
-s,@host_vendor@,$host_vendor,;t t
-s,@host_os@,$host_os,;t t
-s,@EGREP@,$EGREP,;t t
-s,@LN_S@,$LN_S,;t t
-s,@ECHO@,$ECHO,;t t
-s,@AR@,$AR,;t t
-s,@ac_ct_AR@,$ac_ct_AR,;t t
-s,@RANLIB@,$RANLIB,;t t
-s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
-s,@STRIP@,$STRIP,;t t
-s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
-s,@DLLTOOL@,$DLLTOOL,;t t
-s,@ac_ct_DLLTOOL@,$ac_ct_DLLTOOL,;t t
-s,@AS@,$AS,;t t
-s,@ac_ct_AS@,$ac_ct_AS,;t t
-s,@OBJDUMP@,$OBJDUMP,;t t
-s,@ac_ct_OBJDUMP@,$ac_ct_OBJDUMP,;t t
-s,@CPP@,$CPP,;t t
-s,@CXXCPP@,$CXXCPP,;t t
-s,@F77@,$F77,;t t
-s,@FFLAGS@,$FFLAGS,;t t
-s,@ac_ct_F77@,$ac_ct_F77,;t t
-s,@LIBTOOL@,$LIBTOOL,;t t
-s,@pcre_have_bits_type_traits@,$pcre_have_bits_type_traits,;t t
-s,@pcre_have_type_traits@,$pcre_have_type_traits,;t t
-s,@MAYBE_CPP_TARGETS@,$MAYBE_CPP_TARGETS,;t t
-s,@HAVE_CPP@,$HAVE_CPP,;t t
-s,@pcre_have_long_long@,$pcre_have_long_long,;t t
-s,@pcre_have_ulong_long@,$pcre_have_ulong_long,;t t
-s,@BUILD_EXEEXT@,$BUILD_EXEEXT,;t t
-s,@BUILD_OBJEXT@,$BUILD_OBJEXT,;t t
-s,@CC_FOR_BUILD@,$CC_FOR_BUILD,;t t
-s,@CXX_FOR_BUILD@,$CXX_FOR_BUILD,;t t
-s,@CFLAGS_FOR_BUILD@,$CFLAGS_FOR_BUILD,;t t
-s,@CXXFLAGS_FOR_BUILD@,$CXXFLAGS_FOR_BUILD,;t t
-s,@CXXLDFLAGS@,$CXXLDFLAGS,;t t
-s,@EBCDIC@,$EBCDIC,;t t
-s,@HAVE_MEMMOVE@,$HAVE_MEMMOVE,;t t
-s,@HAVE_STRERROR@,$HAVE_STRERROR,;t t
-s,@LINK_SIZE@,$LINK_SIZE,;t t
-s,@MATCH_LIMIT@,$MATCH_LIMIT,;t t
-s,@MATCH_LIMIT_RECURSION@,$MATCH_LIMIT_RECURSION,;t t
-s,@NEWLINE@,$NEWLINE,;t t
-s,@NO_RECURSE@,$NO_RECURSE,;t t
-s,@PCRE_LIB_VERSION@,$PCRE_LIB_VERSION,;t t
-s,@PCRE_POSIXLIB_VERSION@,$PCRE_POSIXLIB_VERSION,;t t
-s,@PCRE_CPPLIB_VERSION@,$PCRE_CPPLIB_VERSION,;t t
-s,@PCRE_VERSION@,$PCRE_VERSION,;t t
-s,@POSIX_MALLOC_THRESHOLD@,$POSIX_MALLOC_THRESHOLD,;t t
-s,@UCP@,$UCP,;t t
-s,@UTF8@,$UTF8,;t t
-s,@WIN_PREFIX@,$WIN_PREFIX,;t t
-s,@ON_WINDOWS@,$ON_WINDOWS,;t t
-s,@NOT_ON_WINDOWS@,$NOT_ON_WINDOWS,;t t
-s,@POSIX_OBJ@,$POSIX_OBJ,;t t
-s,@POSIX_LOBJ@,$POSIX_LOBJ,;t t
-s,@POSIX_LIB@,$POSIX_LIB,;t t
-s,@LIBOBJS@,$LIBOBJS,;t t
-s,@LTLIBOBJS@,$LTLIBOBJS,;t t
-CEOF
+if test -n "$CONFIG_FILES"; then
_ACEOF
- cat >>$CONFIG_STATUS <<\_ACEOF
- # Split the substitutions into bite-sized pieces for seds with
- # small command number limits, like on Digital OSF/1 and HP-UX.
- ac_max_sed_lines=48
- ac_sed_frag=1 # Number of current file.
- ac_beg=1 # First line for current file.
- ac_end=$ac_max_sed_lines # Line after last line for current file.
- ac_more_lines=:
- ac_sed_cmds=
- while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- else
- sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- fi
- if test ! -s $tmp/subs.frag; then
- ac_more_lines=false
- else
- # The purpose of the label and of the branching condition is to
- # speed up the sed processing (if there are no `@' at all, there
- # is no need to browse any of the substitutions).
- # These are the two extra sed commands mentioned above.
- (echo ':t
- /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
- fi
- ac_sed_frag=`expr $ac_sed_frag + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_lines`
- fi
- done
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ cat >conf$$subs.sed <<_ACEOF
+SHELL!$SHELL$ac_delim
+PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
+PACKAGE_NAME!$PACKAGE_NAME$ac_delim
+PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
+PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
+PACKAGE_STRING!$PACKAGE_STRING$ac_delim
+PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
+exec_prefix!$exec_prefix$ac_delim
+prefix!$prefix$ac_delim
+program_transform_name!$program_transform_name$ac_delim
+bindir!$bindir$ac_delim
+sbindir!$sbindir$ac_delim
+libexecdir!$libexecdir$ac_delim
+datarootdir!$datarootdir$ac_delim
+datadir!$datadir$ac_delim
+sysconfdir!$sysconfdir$ac_delim
+sharedstatedir!$sharedstatedir$ac_delim
+localstatedir!$localstatedir$ac_delim
+includedir!$includedir$ac_delim
+oldincludedir!$oldincludedir$ac_delim
+docdir!$docdir$ac_delim
+infodir!$infodir$ac_delim
+htmldir!$htmldir$ac_delim
+dvidir!$dvidir$ac_delim
+pdfdir!$pdfdir$ac_delim
+psdir!$psdir$ac_delim
+libdir!$libdir$ac_delim
+localedir!$localedir$ac_delim
+mandir!$mandir$ac_delim
+DEFS!$DEFS$ac_delim
+ECHO_C!$ECHO_C$ac_delim
+ECHO_N!$ECHO_N$ac_delim
+ECHO_T!$ECHO_T$ac_delim
+LIBS!$LIBS$ac_delim
+build_alias!$build_alias$ac_delim
+host_alias!$host_alias$ac_delim
+target_alias!$target_alias$ac_delim
+CC!$CC$ac_delim
+CFLAGS!$CFLAGS$ac_delim
+LDFLAGS!$LDFLAGS$ac_delim
+CPPFLAGS!$CPPFLAGS$ac_delim
+ac_ct_CC!$ac_ct_CC$ac_delim
+EXEEXT!$EXEEXT$ac_delim
+OBJEXT!$OBJEXT$ac_delim
+CXX!$CXX$ac_delim
+CXXFLAGS!$CXXFLAGS$ac_delim
+ac_ct_CXX!$ac_ct_CXX$ac_delim
+INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
+INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
+INSTALL_DATA!$INSTALL_DATA$ac_delim
+build!$build$ac_delim
+build_cpu!$build_cpu$ac_delim
+build_vendor!$build_vendor$ac_delim
+build_os!$build_os$ac_delim
+host!$host$ac_delim
+host_cpu!$host_cpu$ac_delim
+host_vendor!$host_vendor$ac_delim
+host_os!$host_os$ac_delim
+GREP!$GREP$ac_delim
+EGREP!$EGREP$ac_delim
+LN_S!$LN_S$ac_delim
+ECHO!$ECHO$ac_delim
+AR!$AR$ac_delim
+RANLIB!$RANLIB$ac_delim
+STRIP!$STRIP$ac_delim
+DLLTOOL!$DLLTOOL$ac_delim
+AS!$AS$ac_delim
+OBJDUMP!$OBJDUMP$ac_delim
+CPP!$CPP$ac_delim
+CXXCPP!$CXXCPP$ac_delim
+F77!$F77$ac_delim
+FFLAGS!$FFLAGS$ac_delim
+ac_ct_F77!$ac_ct_F77$ac_delim
+LIBTOOL!$LIBTOOL$ac_delim
+pcre_have_bits_type_traits!$pcre_have_bits_type_traits$ac_delim
+pcre_have_type_traits!$pcre_have_type_traits$ac_delim
+MAYBE_CPP_TARGETS!$MAYBE_CPP_TARGETS$ac_delim
+HAVE_CPP!$HAVE_CPP$ac_delim
+pcre_have_long_long!$pcre_have_long_long$ac_delim
+pcre_have_ulong_long!$pcre_have_ulong_long$ac_delim
+BUILD_EXEEXT!$BUILD_EXEEXT$ac_delim
+BUILD_OBJEXT!$BUILD_OBJEXT$ac_delim
+CC_FOR_BUILD!$CC_FOR_BUILD$ac_delim
+CXX_FOR_BUILD!$CXX_FOR_BUILD$ac_delim
+CFLAGS_FOR_BUILD!$CFLAGS_FOR_BUILD$ac_delim
+CXXFLAGS_FOR_BUILD!$CXXFLAGS_FOR_BUILD$ac_delim
+CXXLDFLAGS!$CXXLDFLAGS$ac_delim
+EBCDIC!$EBCDIC$ac_delim
+HAVE_MEMMOVE!$HAVE_MEMMOVE$ac_delim
+HAVE_STRERROR!$HAVE_STRERROR$ac_delim
+LINK_SIZE!$LINK_SIZE$ac_delim
+MATCH_LIMIT!$MATCH_LIMIT$ac_delim
+MATCH_LIMIT_RECURSION!$MATCH_LIMIT_RECURSION$ac_delim
+NEWLINE!$NEWLINE$ac_delim
+NO_RECURSE!$NO_RECURSE$ac_delim
+PCRE_LIB_VERSION!$PCRE_LIB_VERSION$ac_delim
+PCRE_POSIXLIB_VERSION!$PCRE_POSIXLIB_VERSION$ac_delim
+_ACEOF
+
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
+ break
+ elif $ac_last_try; then
+ { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
-fi # test -n "$CONFIG_FILES"
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+ ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+ ac_eof=`expr $ac_eof + 1`
+fi
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+CEOF$ac_eof
+_ACEOF
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ cat >conf$$subs.sed <<_ACEOF
+PCRE_CPPLIB_VERSION!$PCRE_CPPLIB_VERSION$ac_delim
+PCRE_VERSION!$PCRE_VERSION$ac_delim
+POSIX_MALLOC_THRESHOLD!$POSIX_MALLOC_THRESHOLD$ac_delim
+UCP!$UCP$ac_delim
+UTF8!$UTF8$ac_delim
+WIN_PREFIX!$WIN_PREFIX$ac_delim
+ON_WINDOWS!$ON_WINDOWS$ac_delim
+NOT_ON_WINDOWS!$NOT_ON_WINDOWS$ac_delim
+POSIX_OBJ!$POSIX_OBJ$ac_delim
+POSIX_LOBJ!$POSIX_LOBJ$ac_delim
+POSIX_LIB!$POSIX_LIB$ac_delim
+LIBOBJS!$LIBOBJS$ac_delim
+LTLIBOBJS!$LTLIBOBJS$ac_delim
+_ACEOF
+
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 13; then
+ break
+ elif $ac_last_try; then
+ { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+ ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+ ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+:end
+s/|#_!!_#|//g
+CEOF$ac_eof
+_ACEOF
+
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[ ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
cat >>$CONFIG_STATUS <<\_ACEOF
-for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case $ac_file in
- - | *:- | *:-:* ) # input from stdin
- cat >$tmp/stdin
- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- * ) ac_file_in=$ac_file.in ;;
+fi # test -n "$CONFIG_FILES"
+
+
+for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
+echo "$as_me: error: Invalid tag $ac_tag." >&2;}
+ { (exit 1); exit 1; }; };;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
- # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
- ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+ ac_file_inputs="$ac_file_inputs $ac_f"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input="Generated from "`IFS=:
+ echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ fi
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$tmp/stdin";;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ { as_dir="$ac_dir"
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
{ (exit 1); exit 1; }; }; }
-
ac_builddir=.
-if test "$ac_dir" != .; then
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
case $srcdir in
- .) # No --srcdir option. We are building in place.
+ .) # We are building in place.
ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
case $INSTALL in
[\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
- *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
esac
+_ACEOF
- if test x"$ac_file" != x-; then
- { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
- rm -f "$ac_file"
- fi
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- if test x"$ac_file" = x-; then
- configure_input=
- else
- configure_input="$ac_file. "
- fi
- configure_input=$configure_input"Generated from `echo $ac_file_in |
- sed 's,.*/,,'` by configure."
-
- # First look for the input files in the build tree, otherwise in the
- # src tree.
- ac_file_inputs=`IFS=:
- for f in $ac_file_in; do
- case $f in
- -) echo $tmp/stdin ;;
- [\\/$]*)
- # Absolute (can't be DOS-style, as IFS=:)
- test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- echo "$f";;
- *) # Relative
- if test -f "$f"; then
- # Build tree
- echo "$f"
- elif test -f "$srcdir/$f"; then
- # Source tree
- echo "$srcdir/$f"
- else
- # /dev/null tree
- { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- fi;;
- esac
- done` || { (exit 1); exit 1; }
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+case `sed -n '/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+' $ac_file_inputs` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
cat >>$CONFIG_STATUS <<_ACEOF
sed "$ac_vpsub
$extrasub
@@ -20699,370 +22179,144 @@ _ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s,@configure_input@,$configure_input,;t t
-s,@srcdir@,$ac_srcdir,;t t
-s,@abs_srcdir@,$ac_abs_srcdir,;t t
-s,@top_srcdir@,$ac_top_srcdir,;t t
-s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
-s,@builddir@,$ac_builddir,;t t
-s,@abs_builddir@,$ac_abs_builddir,;t t
-s,@top_builddir@,$ac_top_builddir,;t t
-s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
-s,@INSTALL@,$ac_INSTALL,;t t
-" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
- rm -f $tmp/stdin
- if test x"$ac_file" != x-; then
- mv $tmp/out $ac_file
- else
- cat $tmp/out
- rm -f $tmp/out
- fi
-
-done
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-#
-# CONFIG_HEADER section.
-#
-
-# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
-# NAME is the cpp macro being defined and VALUE is the value it is being given.
-#
-# ac_d sets the value in "#define NAME VALUE" lines.
-ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
-ac_dB='[ ].*$,\1#\2'
-ac_dC=' '
-ac_dD=',;t'
-# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-ac_uB='$,\1#\2define\3'
-ac_uC=' '
-ac_uD=',;t'
-
-for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+s&@configure_input@&$configure_input&;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+$ac_datarootdir_hack
+" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&5
+echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&2;}
+
+ rm -f "$tmp/stdin"
case $ac_file in
- - | *:- | *:-:* ) # input from stdin
- cat >$tmp/stdin
- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- * ) ac_file_in=$ac_file.in ;;
+ -) cat "$tmp/out"; rm -f "$tmp/out";;
+ *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
esac
-
- test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
-
- # First look for the input files in the build tree, otherwise in the
- # src tree.
- ac_file_inputs=`IFS=:
- for f in $ac_file_in; do
- case $f in
- -) echo $tmp/stdin ;;
- [\\/$]*)
- # Absolute (can't be DOS-style, as IFS=:)
- test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- # Do quote $f, to prevent DOS paths from being IFS'd.
- echo "$f";;
- *) # Relative
- if test -f "$f"; then
- # Build tree
- echo "$f"
- elif test -f "$srcdir/$f"; then
- # Source tree
- echo "$srcdir/$f"
- else
- # /dev/null tree
- { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- fi;;
- esac
- done` || { (exit 1); exit 1; }
- # Remove the trailing spaces.
- sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
-
+ ;;
+ :H)
+ #
+ # CONFIG_HEADER
+ #
_ACEOF
-# Transform confdefs.h into two sed scripts, `conftest.defines' and
-# `conftest.undefs', that substitutes the proper values into
-# config.h.in to produce config.h. The first handles `#define'
-# templates, and the second `#undef' templates.
-# And first: Protect against being on the right side of a sed subst in
-# config.status. Protect against being in an unquoted here document
-# in config.status.
-rm -f conftest.defines conftest.undefs
-# Using a here document instead of a string reduces the quoting nightmare.
-# Putting comments in sed scripts is not portable.
-#
-# `end' is used to avoid that the second main sed command (meant for
-# 0-ary CPP macros) applies to n-ary macro definitions.
-# See the Autoconf documentation for `clear'.
-cat >confdef2sed.sed <<\_ACEOF
-s/[\\&,]/\\&/g
-s,[\\$`],\\&,g
-t clear
-: clear
-s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
-t end
-s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
-: end
-_ACEOF
-# If some macros were called several times there might be several times
-# the same #defines, which is useless. Nevertheless, we may not want to
-# sort them, since we want the *last* AC-DEFINE to be honored.
-uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
-sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
-rm -f confdef2sed.sed
-
-# This sed command replaces #undef with comments. This is necessary, for
+# Transform confdefs.h into a sed script `conftest.defines', that
+# substitutes the proper values into config.h.in to produce config.h.
+rm -f conftest.defines conftest.tail
+# First, append a space to every undef/define line, to ease matching.
+echo 's/$/ /' >conftest.defines
+# Then, protect against being on the right side of a sed subst, or in
+# an unquoted here document, in config.status. If some macros were
+# called several times there might be several #defines for the same
+# symbol, which is useless. But do not sort them, since the last
+# AC_DEFINE must be honored.
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
+# NAME is the cpp macro being defined, VALUE is the value it is being given.
+# PARAMS is the parameter list in the macro definition--in most cases, it's
+# just an empty string.
+ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*'
+ac_dB='\\)[ (].*,\\1define\\2'
+ac_dC=' '
+ac_dD=' ,'
+
+uniq confdefs.h |
+ sed -n '
+ t rset
+ :rset
+ s/^[ ]*#[ ]*define[ ][ ]*//
+ t ok
+ d
+ :ok
+ s/[\\&,]/\\&/g
+ s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
+ s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
+ ' >>conftest.defines
+
+# Remove the space that was appended to ease matching.
+# Then replace #undef with comments. This is necessary, for
# example, in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
-cat >>conftest.undefs <<\_ACEOF
-s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
-_ACEOF
-
-# Break up conftest.defines because some shells have a limit on the size
-# of here documents, and old seds have small limits too (100 cmds).
-echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
-echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
-echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
-echo ' :' >>$CONFIG_STATUS
-rm -f conftest.tail
-while grep . conftest.defines >/dev/null
+# (The regexp can be short, since the line contains either #define or #undef.)
+echo 's/ $//
+s,^[ #]*u.*,/* & */,' >>conftest.defines
+
+# Break up conftest.defines:
+ac_max_sed_lines=50
+
+# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1"
+# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2"
+# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1"
+# et cetera.
+ac_in='$ac_file_inputs'
+ac_out='"$tmp/out1"'
+ac_nxt='"$tmp/out2"'
+
+while :
do
- # Write a limited-size here document to $tmp/defines.sed.
- echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
- # Speed up: don't consider the non `#define' lines.
- echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
- # Work around the forget-to-reset-the-flag bug.
- echo 't clr' >>$CONFIG_STATUS
- echo ': clr' >>$CONFIG_STATUS
- sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
+ # Write a here document:
+ cat >>$CONFIG_STATUS <<_ACEOF
+ # First, check the format of the line:
+ cat >"\$tmp/defines.sed" <<\\CEOF
+/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def
+/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def
+b
+:def
+_ACEOF
+ sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
echo 'CEOF
- sed -f $tmp/defines.sed $tmp/in >$tmp/out
- rm -f $tmp/in
- mv $tmp/out $tmp/in
-' >>$CONFIG_STATUS
- sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+ sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
+ ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
+ sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
+ grep . conftest.tail >/dev/null || break
rm -f conftest.defines
mv conftest.tail conftest.defines
done
-rm -f conftest.defines
-echo ' fi # grep' >>$CONFIG_STATUS
-echo >>$CONFIG_STATUS
-
-# Break up conftest.undefs because some shells have a limit on the size
-# of here documents, and old seds have small limits too (100 cmds).
-echo ' # Handle all the #undef templates' >>$CONFIG_STATUS
-rm -f conftest.tail
-while grep . conftest.undefs >/dev/null
-do
- # Write a limited-size here document to $tmp/undefs.sed.
- echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
- # Speed up: don't consider the non `#undef'
- echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
- # Work around the forget-to-reset-the-flag bug.
- echo 't clr' >>$CONFIG_STATUS
- echo ': clr' >>$CONFIG_STATUS
- sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
- echo 'CEOF
- sed -f $tmp/undefs.sed $tmp/in >$tmp/out
- rm -f $tmp/in
- mv $tmp/out $tmp/in
-' >>$CONFIG_STATUS
- sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
- rm -f conftest.undefs
- mv conftest.tail conftest.undefs
-done
-rm -f conftest.undefs
+rm -f conftest.defines conftest.tail
+echo "ac_result=$ac_in" >>$CONFIG_STATUS
cat >>$CONFIG_STATUS <<\_ACEOF
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- if test x"$ac_file" = x-; then
- echo "/* Generated by configure. */" >$tmp/config.h
- else
- echo "/* $ac_file. Generated by configure. */" >$tmp/config.h
- fi
- cat $tmp/in >>$tmp/config.h
- rm -f $tmp/in
if test x"$ac_file" != x-; then
- if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
+ echo "/* $configure_input */" >"$tmp/config.h"
+ cat "$ac_result" >>"$tmp/config.h"
+ if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
{ echo "$as_me:$LINENO: $ac_file is unchanged" >&5
echo "$as_me: $ac_file is unchanged" >&6;}
else
- ac_dir=`(dirname "$ac_file") 2>/dev/null ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_file" : 'X\(//\)[^/]' \| \
- X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
- as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
- { (exit 1); exit 1; }; }; }
-
rm -f $ac_file
- mv $tmp/config.h $ac_file
+ mv "$tmp/config.h" $ac_file
fi
else
- cat $tmp/config.h
- rm -f $tmp/config.h
+ echo "/* $configure_input */"
+ cat "$ac_result"
fi
-done
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-#
-# CONFIG_COMMANDS section.
-#
-for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
- ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
- ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
-$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_dest" : 'X\(//\)[^/]' \| \
- X"$ac_dest" : 'X\(//\)$' \| \
- X"$ac_dest" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$ac_dest" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
- as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
- { (exit 1); exit 1; }; }; }
-
- ac_builddir=.
-
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
+ rm -f "$tmp/out12"
+ ;;
-case $srcdir in
- .) # No --srcdir option. We are building in place.
- ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
+ :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5
+echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+ esac
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
+ case $ac_file$ac_mode in
+ "default":C) chmod a+x RunTest RunGrepTest pcre-config ;;
- { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
-echo "$as_me: executing $ac_dest commands" >&6;}
- case $ac_dest in
- default ) chmod a+x RunTest RunGrepTest pcre-config ;;
esac
-done
-_ACEOF
+done # for ac_tag
-cat >>$CONFIG_STATUS <<\_ACEOF
{ (exit 0); exit 0; }
_ACEOF
diff --git a/configure.ac b/configure.ac
index 6a318c1..c439b0f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -185,11 +185,20 @@ if test "$enableval" = "yes"; then
fi
)
+dnl Handle --enable-newline-is-any
+
+AC_ARG_ENABLE(newline-is-any,
+[ --enable-newline-is-any use any Unicode newline sequence],
+if test "$enableval" = "yes"; then
+ NEWLINE=-DNEWLINE=-1
+fi
+)
+
dnl Handle --enable-ebcdic
AC_ARG_ENABLE(ebcdic,
[ --enable-ebcdic assume EBCDIC coding rather than ASCII],
-if test "$enableval" == "yes"; then
+if test "$enableval" = "yes"; then
EBCDIC=-DEBCDIC=1
fi
)
@@ -299,4 +308,4 @@ if test "x$enable_shared" = "xno" ; then
fi
dnl This must be last; it determines what files are written as well as config.h
-AC_OUTPUT(Makefile pcre-config:pcre-config.in libpcre.pc:libpcre.pc.in pcrecpparg.h:pcrecpparg.h.in pcre_stringpiece.h:pcre_stringpiece.h.in RunGrepTest:RunGrepTest.in RunTest:RunTest.in,[chmod a+x RunTest RunGrepTest pcre-config])
+AC_OUTPUT(Makefile pcre-config:pcre-config.in libpcre.pc:libpcre.pc.in libpcrecpp.pc:libpcrecpp.pc.in pcrecpparg.h:pcrecpparg.h.in pcre_stringpiece.h:pcre_stringpiece.h.in RunGrepTest:RunGrepTest.in RunTest:RunTest.in,[chmod a+x RunTest RunGrepTest pcre-config])
diff --git a/dftables.c b/dftables.c
index 5ba207a..a94b7a6 100644
--- a/dftables.c
+++ b/dftables.c
@@ -86,7 +86,16 @@ fprintf(f,
fprintf(f,
"This file contains the default tables for characters with codes less than\n"
"128 (ASCII characters). These tables are used when no external tables are\n"
- "passed to PCRE. */\n\n"
+ "passed to PCRE.\n\n");
+fprintf(f,
+ "The following #include is present because without it gcc 4.x may remove\n"
+ "the array definition from the final binary if PCRE is built into a static\n"
+ "library and dead code stripping is activated. This leads to link errors.\n"
+ "Pulling in the header ensures that the array gets flagged as \"someone\n"
+ "outside this compilation unit might reference this\" and so it will always\n"
+ "be supplied to the linker. */\n\n"
+ "#include \"pcre_internal.h\"\n\n");
+fprintf(f,
"const unsigned char _pcre_default_tables[] = {\n\n"
"/* This table is a lower casing table. */\n\n");
diff --git a/doc/Tech.Notes b/doc/Tech.Notes
index 21dbe1f..c75b3e8 100644
--- a/doc/Tech.Notes
+++ b/doc/Tech.Notes
@@ -16,10 +16,11 @@ not operate by backtracking, as the original Henry Spencer code and current
Perl code does, but instead checked all possibilities simultaneously by keeping
a list of current states and checking all of them as it advanced through the
subject string. In the terminology of Jeffrey Friedl's book, it was a "DFA
-algorithm". When the pattern was all used up, all remaining states were
-possible matches, and the one matching the longest subset of the subject string
-was chosen. This did not necessarily maximize the individual wild portions of
-the pattern, as is expected in Unix and Perl-style regular expressions.
+algorithm", though it was not a traditional Finite State Machine (FSM). When
+the pattern was all used up, all remaining states were possible matches, and
+the one matching the longest subset of the subject string was chosen. This did
+not necessarily maximize the individual wild portions of the pattern, as is
+expected in Unix and Perl-style regular expressions.
Historical note 2
-----------------
@@ -41,14 +42,38 @@ unrelated to those mentioned above), I tried at first to invent an algorithm
that used an amount of store bounded by a multiple of the number of characters
in the pattern, to save on compiling time. However, because of the greater
complexity in Perl regular expressions, I couldn't do this. In any case, a
-first pass through the pattern is needed, for a number of reasons. PCRE works
-by running a very degenerate first pass to calculate a maximum store size, and
-then a second pass to do the real compile - which may use a bit less than the
-predicted amount of store. The idea is that this is going to turn out faster
-because the first pass is degenerate and the second pass can just store stuff
-straight into the vector, which it knows is big enough. It does make the
-compiling functions bigger, of course, but they have become quite big anyway to
-handle all the Perl stuff.
+first pass through the pattern is helpful for other reasons.
+
+Computing the memory requirement: how it was
+--------------------------------------------
+
+Up to and including release 6.7, PCRE worked by running a very degenerate first
+pass to calculate a maximum store size, and then a second pass to do the real
+compile - which might use a bit less than the predicted amount of memory. The
+idea was that this would turn out faster than the Henry Spencer code because
+the first pass is degenerate and the second pass can just store stuff straight
+into the vector, which it knows is big enough.
+
+Computing the memory requirement: how it is
+-------------------------------------------
+
+By the time I was working on a potential 6.8 release, the degenerate first pass
+had become very complicated and hard to maintain. Indeed one of the early
+things I did for 6.8 was to fix Yet Another Bug in the memory computation. Then
+I had a flash of inspiration as to how I could run the real compile function in
+a "fake" mode that enables it to compute how much memory it would need, while
+actually only ever using a few hundred bytes of working memory, and without too
+many tests of the mode that might slow it down. So I re-factored the compiling
+functions to work this way. This got rid of about 600 lines of source. It
+should make future maintenance and development easier. As this was such a major
+change, I never released 6.8, instead upping the number to 7.0 (other quite
+major changes are also present in the 7.0 release).
+
+A side effect of this work is that the previous limit of 200 on the nesting
+depth of parentheses was removed. However, there is a downside: pcre_compile()
+runs more slowly than before (30% or more, depending on the pattern) because it
+is doing a full analysis of the pattern. My hope is that this is not a big
+issue.
Traditional matching function
-----------------------------
@@ -70,6 +95,12 @@ intreprets the same compiled pattern data as pcre_exec(); however, not all the
facilities are available, and those that are do not always work in quite the
same way. See the user documentation for details.
+The algorithm that is used for pcre_dfa_exec() is not a traditional FSM,
+because it may have a number of states active at one time. More work would be
+needed at compile time to produce a traditional FSM where only one state is
+ever active at once. I believe some other regex matchers work this way.
+
+
Format of compiled patterns
---------------------------
@@ -79,10 +110,12 @@ item is either implicit in the opcode or contained in the data bytes that
follow it.
In many cases below "two-byte" data values are specified. This is in fact just
-a default. PCRE can be compiled to use 3-byte or 4-byte values (impairing the
+a default when the number is an offset within the compiled pattern. PCRE can be
+compiled to use 3-byte or 4-byte values for these offsets (impairing the
performance). This is necessary only when patterns whose compiled length is
-greater than 64K are going to be processed. In this description, we assume the
-"normal" compilation options.
+greater than 64K are going to be processed. In this description, we assume the
+"normal" compilation options. "Two-byte" data values that are counts (e.g. for
+quantifiers) are always just two bytes.
A list of all the opcodes follows:
@@ -109,6 +142,7 @@ These items are all just one byte long
OP_EOD match end of data: \z
OP_DOLL $ (end of data, or before \n in multiline)
OP_EXTUNI match an extended Unicode character
+ OP_ANYNL match any Unicode newline sequence
Repeating single characters
@@ -119,23 +153,28 @@ following opcodes:
OP_STAR
OP_MINSTAR
+ OP_POSSTAR
OP_PLUS
OP_MINPLUS
+ OP_POSPLUS
OP_QUERY
OP_MINQUERY
+ OP_POSQUERY
In ASCII mode, these are two-byte items; in UTF-8 mode, the length is variable.
-Those with "MIN" in their name are the minimizing versions. Each is followed by
-the character that is to be repeated. Other repeats make use of
+Those with "MIN" in their name are the minimizing versions. Those with "POS" in
+their names are possessive versions. Each is followed by the character that is
+to be repeated. Other repeats make use of
OP_UPTO
OP_MINUPTO
+ OP_POSUPTO
OP_EXACT
which are followed by a two-byte count (most significant first) and the
repeated character. OP_UPTO matches from 0 to the given number. A repeat with a
non-zero minimum and a fixed maximum is coded as an OP_EXACT followed by an
-OP_UPTO (or OP_MINUPTO).
+OP_UPTO (or OP_MINUPTO or OPT_POSUPTO).
Repeating character types
@@ -147,12 +186,16 @@ byte. The opcodes are:
OP_TYPESTAR
OP_TYPEMINSTAR
+ OP_TYPEPOSSTAR
OP_TYPEPLUS
OP_TYPEMINPLUS
+ OP_TYPEPOSPLUS
OP_TYPEQUERY
OP_TYPEMINQUERY
+ OP_TYPEPOSQUERY
OP_TYPEUPTO
OP_TYPEMINUPTO
+ OP_TYPEPOSUPTO
OP_TYPEEXACT
@@ -216,9 +259,10 @@ OP_REF is followed by two bytes containing the reference number.
Repeating character classes and back references
-----------------------------------------------
-Single-character classes are handled specially (see above). This applies to
-OP_CLASS and OP_REF. In both cases, the repeat information follows the base
-item. The matching code looks at the following opcode to see if it is one of
+Single-character classes are handled specially (see above). This section
+applies to OP_CLASS and OP_REF. In both cases, the repeat information follows
+the base item. The matching code looks at the following opcode to see if it is
+one of
OP_CRSTAR
OP_CRMINSTAR
@@ -230,7 +274,9 @@ item. The matching code looks at the following opcode to see if it is one of
OP_CRMINRANGE
All but the last two are just single-byte items. The others are followed by
-four bytes of data, comprising the minimum and maximum repeat counts.
+four bytes of data, comprising the minimum and maximum repeat counts. There are
+no special possessive opcodes for these repeats; a possessive repeat is
+compiled into an atomic group.
Brackets and alternation
@@ -239,29 +285,25 @@ Brackets and alternation
A pair of non-capturing (round) brackets is wrapped round each expression at
compile time, so alternation always happens in the context of brackets.
-Non-capturing brackets use the opcode OP_BRA, while capturing brackets use
-OP_BRA+1, OP_BRA+2, etc. [Note for North Americans: "bracket" to some English
-speakers, including myself, can be round, square, curly, or pointy. Hence this
-usage.]
+[Note for North Americans: "bracket" to some English speakers, including
+myself, can be round, square, curly, or pointy. Hence this usage.]
-Originally PCRE was limited to 99 capturing brackets (so as not to use up all
-the opcodes). From release 3.5, there is no limit. What happens is that the
-first ones, up to EXTRACT_BASIC_MAX are handled with separate opcodes, as
-above. If there are more, the opcode is set to EXTRACT_BASIC_MAX+1, and the
-first operation in the bracket is OP_BRANUMBER, followed by a 2-byte bracket
-number. This opcode is ignored while matching, but is fished out when handling
-the bracket itself. (They could have all been done like this, but I was making
-minimal changes.)
+Non-capturing brackets use the opcode OP_BRA. Originally PCRE was limited to 99
+capturing brackets and it used a different opcode for each one. From release
+3.5, the limit was removed by putting the bracket number into the data for
+higher-numbered brackets. From release 7.0 all capturing brackets are handled
+this way, using the single opcode OP_CBRA.
A bracket opcode is followed by LINK_SIZE bytes which give the offset to the
next alternative OP_ALT or, if there aren't any branches, to the matching
OP_KET opcode. Each OP_ALT is followed by LINK_SIZE bytes giving the offset to
-the next one, or to the OP_KET opcode.
+the next one, or to the OP_KET opcode. For capturing brackets, the bracket
+number immediately follows the offset, always as a 2-byte item.
OP_KET is used for subpatterns that do not repeat indefinitely, while
OP_KETRMIN and OP_KETRMAX are used for indefinite repetitions, minimally or
maximally respectively. All three are followed by LINK_SIZE bytes giving (as a
-positive number) the offset back to the matching OP_BRA opcode.
+positive number) the offset back to the matching bracket opcode.
If a subpattern is quantified such that it is permitted to match zero times, it
is preceded by one of OP_BRAZERO or OP_BRAMINZERO. These are single-byte
@@ -276,7 +318,14 @@ as appropriate.
A subpattern with a bounded maximum repetition is replicated in a nested
fashion up to the maximum number of times, with OP_BRAZERO or OP_BRAMINZERO
before each replication after the minimum, so that, for example, (abc){2,5} is
-compiled as (abc)(abc)((abc)((abc)(abc)?)?)?.
+compiled as (abc)(abc)((abc)((abc)(abc)?)?)?, except that each bracketed group
+has the same number.
+
+When a repeated subpattern has an unbounded upper limit, it is checked to see
+whether it could match an empty string. If this is the case, the opcode in the
+final replication is changed to OP_SBRA or OP_SCBRA. This tells the matcher
+that it needs to check for matching an empty string when it hits OP_KETRMIN or
+OP_KETRMAX, and if so, to break the loop.
Assertions
@@ -292,22 +341,27 @@ each alternative of a lookbehind assertion, allowing them to have different
fixed lengths.
-Once-only subpatterns
----------------------
+Once-only (atomic) subpatterns
+------------------------------
These are also just like other subpatterns, but they start with the opcode
-OP_ONCE.
+OP_ONCE. The check for matching an empty string in an unbounded repeat is
+handled entirely at runtime, so there is just this one opcode.
Conditional subpatterns
-----------------------
-These are like other subpatterns, but they start with the opcode OP_COND. If
+These are like other subpatterns, but they start with the opcode OP_COND, or
+OP_SCOND for one that might match an empty string in an unbounded repeat. If
the condition is a back reference, this is stored at the start of the
subpattern using the opcode OP_CREF followed by two bytes containing the
-reference number. If the condition is "in recursion" (coded as "(?(R)"), the
-same scheme is used, with a "reference number" of 0xffff. Otherwise, a
-conditional subpattern always starts with one of the assertions.
+reference number. If the condition is "in recursion" (coded as "(?(R)"), or "in
+recursion of group x" (coded as "(?(Rx)"), the group number is stored at the
+start of the subpattern using the opcode OP_RREF, and a value of zero for "the
+whole pattern". For a DEFINE condition, just the single byte OP_DEF is used (it
+has no associated data). Otherwise, a conditional subpattern always starts with
+one of the assertions.
Recursion
@@ -345,4 +399,4 @@ at compile time, and so does not cause anything to be put into the compiled
data.
Philip Hazel
-June 2006
+November 2006
diff --git a/doc/html/pcre.html b/doc/html/pcre.html
index eb2102d..f681535 100644
--- a/doc/html/pcre.html
+++ b/doc/html/pcre.html
@@ -23,13 +23,18 @@ man page, in case the conversion went wrong.
<P>
The PCRE library is a set of functions that implement regular expression
pattern matching using the same syntax and semantics as Perl, with just a few
-differences. The current implementation of PCRE (release 6.x) corresponds
-approximately with Perl 5.8, including support for UTF-8 encoded strings and
-Unicode general category properties. However, this support has to be explicitly
-enabled; it is not the default.
+differences. (Certain features that appeared in Python and PCRE before they
+appeared in Perl are also available using the Python syntax.)
</P>
<P>
-In addition to the Perl-compatible matching function, PCRE also contains an
+The current implementation of PCRE (release 7.x) corresponds approximately with
+Perl 5.10, including support for UTF-8 encoded strings and Unicode general
+category properties. However, UTF-8 and Unicode support has to be explicitly
+enabled; it is not the default. The Unicode tables correspond to Unicode
+release 5.0.0.
+</P>
+<P>
+In addition to the Perl-compatible matching function, PCRE contains an
alternative matching function that matches the same compiled patterns in a
different way. In certain circumstances, the alternative function has some
advantages. For a discussion of the two matching algorithms, see the
@@ -114,7 +119,7 @@ internal linkage size of 3 or 4 (see the <b>README</b> file in the source
distribution and the
<a href="pcrebuild.html"><b>pcrebuild</b></a>
documentation for details). In these cases the limit is substantially larger.
-However, the speed of execution will be slower.
+However, the speed of execution is slower.
</P>
<P>
All values in repeating quantifiers must be less than 65536. The maximum
@@ -122,13 +127,12 @@ compiled length of subpattern with an explicit repeat count is 30000 bytes. The
maximum number of capturing subpatterns is 65535.
</P>
<P>
-There is no limit to the number of non-capturing subpatterns, but the maximum
-depth of nesting of all kinds of parenthesized subpattern, including capturing
-subpatterns, assertions, and other types of subpattern, is 200.
+There is no limit to the number of parenthesized subpatterns, but there can be
+no more than 65535 capturing subpatterns.
</P>
<P>
-The maximum length of name for a named subpattern is 32, and the maximum number
-of named subpatterns is 10000.
+The maximum length of name for a named subpattern is 32 characters, and the
+maximum number of named subpatterns is 10000.
</P>
<P>
The maximum length of a subject string is the largest positive number that an
@@ -158,7 +162,7 @@ instead of just strings of bytes.
<P>
If you compile PCRE with UTF-8 support, but do not use it at run time, the
library will be a bit bigger, but the additional run time overhead is limited
-to testing the PCRE_UTF8 flag in several places, so should not be very large.
+to testing the PCRE_UTF8 flag occasionally, so should not be very big.
</P>
<P>
If PCRE is built with Unicode character property support (which implies UTF-8
@@ -238,13 +242,13 @@ Philip Hazel
<br>
University Computing Service,
<br>
-Cambridge CB2 3QG, England.
+Cambridge CB2 3QH, England.
</P>
<P>
Putting an actual email address here seems to have been a spam magnet, so I've
taken it away. If you want to email me, use my initial and surname, separated
by a dot, at the domain ucs.cam.ac.uk.
-Last updated: 05 June 2006
+Last updated: 23 November 2006
<br>
Copyright &copy; 1997-2006 University of Cambridge.
<p>
diff --git a/doc/html/pcre_compile.html b/doc/html/pcre_compile.html
index e46558b..e69078c 100644
--- a/doc/html/pcre_compile.html
+++ b/doc/html/pcre_compile.html
@@ -27,8 +27,9 @@ SYNOPSIS
DESCRIPTION
</b><br>
<P>
-This function compiles a regular expression into an internal form. Its
-arguments are:
+This function compiles a regular expression into an internal form. It is the
+same as <b>pcre_compile2()</b>, except for the absence of the <i>errorcodeptr</i>
+argument. Its arguments are:
<pre>
<i>pattern</i> A zero-terminated string containing the
regular expression to be compiled
@@ -51,6 +52,7 @@ The option bits are:
(not much use currently)
PCRE_FIRSTLINE Force matching to be before newline
PCRE_MULTILINE ^ and $ match newlines within data
+ PCRE_NEWLINE_ANY Recognize any Unicode newline sequence
PCRE_NEWLINE_CR Set CR as the newline sequence
PCRE_NEWLINE_CRLF Set CRLF as the newline sequence
PCRE_NEWLINE_LF Set LF as the newline sequence
diff --git a/doc/html/pcre_compile2.html b/doc/html/pcre_compile2.html
index 892ef6c..e17a698 100644
--- a/doc/html/pcre_compile2.html
+++ b/doc/html/pcre_compile2.html
@@ -56,6 +56,7 @@ The option bits are:
(not much use currently)
PCRE_FIRSTLINE Force matching to be before newline
PCRE_MULTILINE ^ and $ match newlines within data
+ PCRE_NEWLINE_ANY Recognize any Unicode newline sequence
PCRE_NEWLINE_CR Set CR as the newline sequence
PCRE_NEWLINE_CRLF Set CRLF as the newline sequence
PCRE_NEWLINE_LF Set LF as the newline sequence
diff --git a/doc/html/pcre_config.html b/doc/html/pcre_config.html
index 0ba0319..d362cd6 100644
--- a/doc/html/pcre_config.html
+++ b/doc/html/pcre_config.html
@@ -38,7 +38,11 @@ The available codes are:
PCRE_CONFIG_MATCH_LIMIT Internal resource limit
PCRE_CONFIG_MATCH_LIMIT_RECURSION
Internal recursion depth limit
- PCRE_CONFIG_NEWLINE Value of the newline sequence
+ PCRE_CONFIG_NEWLINE Value of the newline sequence:
+ 13 (0x000d) for CR
+ 10 (0x000a) for LF
+ 3338 (0x0d0a) for CRLF
+ -1 for ANY
PCRE_CONFIG_POSIX_MALLOC_THRESHOLD
Threshold of return slots, above
which <b>malloc()</b> is used by
diff --git a/doc/html/pcre_copy_substring.html b/doc/html/pcre_copy_substring.html
index 9aa87c1..b7d2341 100644
--- a/doc/html/pcre_copy_substring.html
+++ b/doc/html/pcre_copy_substring.html
@@ -37,7 +37,7 @@ buffer. The arguments are:
<i>buffer</i> Buffer to receive the string
<i>buffersize</i> Size of buffer
</pre>
-The yield is the legnth of the string, PCRE_ERROR_NOMEMORY if the buffer was
+The yield is the length of the string, PCRE_ERROR_NOMEMORY if the buffer was
too small, or PCRE_ERROR_NOSUBSTRING if the string number is invalid.
</P>
<P>
diff --git a/doc/html/pcre_dfa_exec.html b/doc/html/pcre_dfa_exec.html
index d852286..92b444f 100644
--- a/doc/html/pcre_dfa_exec.html
+++ b/doc/html/pcre_dfa_exec.html
@@ -29,9 +29,9 @@ DESCRIPTION
</b><br>
<P>
This function matches a compiled regular expression against a given subject
-string, using a DFA matching algorithm (<i>not</i> Perl-compatible). Note that
-the main, Perl-compatible, matching function is <b>pcre_exec()</b>. The
-arguments for this function are:
+string, using an alternative matching algorithm that scans the subject string
+just once (<i>not</i> Perl-compatible). Note that the main, Perl-compatible,
+matching function is <b>pcre_exec()</b>. The arguments for this function are:
<pre>
<i>code</i> Points to the compiled pattern
<i>extra</i> Points to an associated <b>pcre_extra</b> structure,
@@ -49,6 +49,7 @@ arguments for this function are:
The options are:
<pre>
PCRE_ANCHORED Match only at the first position
+ PCRE_NEWLINE_ANY Recognize any Unicode newline sequence
PCRE_NEWLINE_CR Set CR as the newline sequence
PCRE_NEWLINE_CRLF Set CRLF as the newline sequence
PCRE_NEWLINE_LF Set LF as the newline sequence
@@ -62,8 +63,8 @@ The options are:
PCRE_DFA_SHORTEST Return only the shortest match
PCRE_DFA_RESTART This is a restart after a partial match
</pre>
-There are restrictions on what may appear in a pattern when matching using the
-DFA algorithm is requested. Details are given in the
+There are restrictions on what may appear in a pattern when using this matching
+function. Details are given in the
<a href="pcrematching.html"><b>pcrematching</b></a>
documentation.
</P>
@@ -79,7 +80,7 @@ A <b>pcre_extra</b> structure contains the following fields:
</pre>
The flag bits are PCRE_EXTRA_STUDY_DATA, PCRE_EXTRA_MATCH_LIMIT,
PCRE_EXTRA_MATCH_LIMIT_RECURSION, PCRE_EXTRA_CALLOUT_DATA, and
-PCRE_EXTRA_TABLES. For DFA matching, the <i>match_limit</i> and
+PCRE_EXTRA_TABLES. For this matching function, the <i>match_limit</i> and
<i>match_limit_recursion</i> fields are not used, and must not be set.
</P>
<P>
diff --git a/doc/html/pcre_exec.html b/doc/html/pcre_exec.html
index 229e418..9da31a1 100644
--- a/doc/html/pcre_exec.html
+++ b/doc/html/pcre_exec.html
@@ -45,6 +45,7 @@ offsets to captured substrings. Its arguments are:
The options are:
<pre>
PCRE_ANCHORED Match only at the first position
+ PCRE_NEWLINE_ANY Recognize any Unicode newline sequence
PCRE_NEWLINE_CR Set CR as the newline sequence
PCRE_NEWLINE_CRLF Set CRLF as the newline sequence
PCRE_NEWLINE_LF Set LF as the newline sequence
@@ -57,7 +58,9 @@ The options are:
PCRE_PARTIAL Return PCRE_ERROR_PARTIAL for a partial match
</pre>
There are restrictions on what may appear in a pattern when partial matching is
-requested.
+requested. For details, see the
+<a href="pcrepartial.html"><b>pcrepartial</b></a>
+page.
</P>
<P>
A <b>pcre_extra</b> structure contains the following fields:
diff --git a/doc/html/pcre_fullinfo.html b/doc/html/pcre_fullinfo.html
index 3488285..ac24f8e 100644
--- a/doc/html/pcre_fullinfo.html
+++ b/doc/html/pcre_fullinfo.html
@@ -48,7 +48,7 @@ The following information is available:
PCRE_INFO_NAMECOUNT Number of named subpatterns
PCRE_INFO_NAMEENTRYSIZE Size of name table entry
PCRE_INFO_NAMETABLE Pointer to name table
- PCRE_INFO_OPTIONS Options used for compilation
+ PCRE_INFO_OPTIONS Option bits used for compilation
PCRE_INFO_SIZE Size of compiled pattern
PCRE_INFO_STUDYSIZE Size of study data
</pre>
diff --git a/doc/html/pcre_get_named_substring.html b/doc/html/pcre_get_named_substring.html
index ff8456b..24dc058 100644
--- a/doc/html/pcre_get_named_substring.html
+++ b/doc/html/pcre_get_named_substring.html
@@ -39,9 +39,10 @@ arguments are:
<i>stringptr</i> Where to put the string pointer
</pre>
The memory in which the substring is placed is obtained by calling
-<b>pcre_malloc()</b>. The yield of the function is the length of the extracted
-substring, PCRE_ERROR_NOMEMORY if sufficient memory could not be obtained, or
-PCRE_ERROR_NOSUBSTRING if the string name is invalid.
+<b>pcre_malloc()</b>. The convenience function <b>pcre_free_substring()</b> can
+be used to free it when it is no longer needed. The yield of the function is
+the length of the extracted substring, PCRE_ERROR_NOMEMORY if sufficient memory
+could not be obtained, or PCRE_ERROR_NOSUBSTRING if the string name is invalid.
</P>
<P>
There is a complete description of the PCRE native API in the
diff --git a/doc/html/pcre_get_stringnumber.html b/doc/html/pcre_get_stringnumber.html
index 9c8bea0..43af3aa 100644
--- a/doc/html/pcre_get_stringnumber.html
+++ b/doc/html/pcre_get_stringnumber.html
@@ -33,7 +33,10 @@ parenthesis in a compiled pattern. Its arguments are:
<i>name</i> Name whose number is required
</pre>
The yield of the function is the number of the parenthesis if the name is
-found, or PCRE_ERROR_NOSUBSTRING otherwise.
+found, or PCRE_ERROR_NOSUBSTRING otherwise. When duplicate names are allowed
+(PCRE_DUPNAMES is set), it is not defined which of the numbers is returned by
+<b>pcre_get_stringnumber()</b>. You can obtain the complete list by calling
+<b>pcre_get_stringtable_entries()</b>.
</P>
<P>
There is a complete description of the PCRE native API in the
diff --git a/doc/html/pcre_get_stringtable_entries.html b/doc/html/pcre_get_stringtable_entries.html
index 3073379..dc20ffd 100644
--- a/doc/html/pcre_get_stringtable_entries.html
+++ b/doc/html/pcre_get_stringtable_entries.html
@@ -44,7 +44,7 @@ PCRE_ERROR_NOSUBSTRING if none are found.
There is a complete description of the PCRE native API, including the format of
the table entries, in the
<a href="pcreapi.html"><b>pcreapi</b></a>
-page and a description of the POSIX API in the
+page, and a description of the POSIX API in the
<a href="pcreposix.html"><b>pcreposix</b></a>
page.
<p>
diff --git a/doc/html/pcre_get_substring.html b/doc/html/pcre_get_substring.html
index 14a4132..9b40e4d 100644
--- a/doc/html/pcre_get_substring.html
+++ b/doc/html/pcre_get_substring.html
@@ -37,9 +37,10 @@ arguments are:
<i>stringptr</i> Where to put the string pointer
</pre>
The memory in which the substring is placed is obtained by calling
-<b>pcre_malloc()</b>. The yield of the function is the length of the substring,
-PCRE_ERROR_NOMEMORY if sufficient memory could not be obtained, or
-PCRE_ERROR_NOSUBSTRING if the string number is invalid.
+<b>pcre_malloc()</b>. The convenience function <b>pcre_free_substring()</b> can
+be used to free it when it is no longer needed. The yield of the function is
+the length of the substring, PCRE_ERROR_NOMEMORY if sufficient memory could not
+be obtained, or PCRE_ERROR_NOSUBSTRING if the string number is invalid.
</P>
<P>
There is a complete description of the PCRE native API in the
diff --git a/doc/html/pcre_get_substring_list.html b/doc/html/pcre_get_substring_list.html
index d278b17..617a315 100644
--- a/doc/html/pcre_get_substring_list.html
+++ b/doc/html/pcre_get_substring_list.html
@@ -35,10 +35,12 @@ substrings. The arguments are:
<i>listptr</i> Where to put a pointer to the list
</pre>
The memory in which the substrings and the list are placed is obtained by
-calling <b>pcre_malloc()</b>. A pointer to a list of pointers is put in
-the variable whose address is in <i>listptr</i>. The list is terminated by a
-NULL pointer. The yield of the function is zero on success or
-PCRE_ERROR_NOMEMORY if sufficient memory could not be obtained.
+calling <b>pcre_malloc()</b>. The convenience function
+<b>pcre_free_substring_list()</b> can be used to free it when it is no longer
+needed. A pointer to a list of pointers is put in the variable whose address is
+in <i>listptr</i>. The list is terminated by a NULL pointer. The yield of the
+function is zero on success or PCRE_ERROR_NOMEMORY if sufficient memory could
+not be obtained.
</P>
<P>
There is a complete description of the PCRE native API in the
diff --git a/doc/html/pcreapi.html b/doc/html/pcreapi.html
index a15df27..6d1340a 100644
--- a/doc/html/pcreapi.html
+++ b/doc/html/pcreapi.html
@@ -32,6 +32,7 @@ man page, in case the conversion went wrong.
<li><a name="TOC17" href="#SEC17">DUPLICATE SUBPATTERN NAMES</a>
<li><a name="TOC18" href="#SEC18">FINDING ALL POSSIBLE MATCHES</a>
<li><a name="TOC19" href="#SEC19">MATCHING A PATTERN: THE ALTERNATIVE FUNCTION</a>
+<li><a name="TOC20" href="#SEC20">SEE ALSO</a>
</ul>
<br><a name="SEC1" href="#TOC1">PCRE NATIVE API</a><br>
<P>
@@ -140,8 +141,8 @@ man page, in case the conversion went wrong.
</P>
<br><a name="SEC2" href="#TOC1">PCRE API OVERVIEW</a><br>
<P>
-PCRE has its own native API, which is described in this document. There is
-also a set of wrapper functions that correspond to the POSIX regular expression
+PCRE has its own native API, which is described in this document. There are
+also some wrapper functions that correspond to the POSIX regular expression
API. These are described in the
<a href="pcreposix.html"><b>pcreposix</b></a>
documentation. Both of these APIs define a set of C function calls. A C++
@@ -170,9 +171,9 @@ documentation describes how to run it.
A second matching function, <b>pcre_dfa_exec()</b>, which is not
Perl-compatible, is also provided. This uses a different algorithm for the
matching. The alternative algorithm finds all possible matches (at a given
-point in the subject). However, this algorithm does not return captured
-substrings. A description of the two matching algorithms and their advantages
-and disadvantages is given in the
+point in the subject), and scans the subject just once. However, this algorithm
+does not return captured substrings. A description of the two matching
+algorithms and their advantages and disadvantages is given in the
<a href="pcrematching.html"><b>pcrematching</b></a>
documentation.
</P>
@@ -243,16 +244,28 @@ documentation.
</P>
<br><a name="SEC3" href="#TOC1">NEWLINES</a><br>
<P>
-PCRE supports three different conventions for indicating line breaks in
-strings: a single CR character, a single LF character, or the two-character
-sequence CRLF. All three are used as "standard" by different operating systems.
-When PCRE is built, a default can be specified. The default default is LF,
-which is the Unix standard. When PCRE is run, the default can be overridden,
-either when a pattern is compiled, or when it is matched.
-<br>
-<br>
+PCRE supports four different conventions for indicating line breaks in
+strings: a single CR (carriage return) character, a single LF (linefeed)
+character, the two-character sequence CRLF, or any Unicode newline sequence.
+The Unicode newline sequences are the three just mentioned, plus the single
+characters VT (vertical tab, U+000B), FF (formfeed, U+000C), NEL (next line,
+U+0085), LS (line separator, U+2028), and PS (paragraph separator, U+2029).
+</P>
+<P>
+Each of the first three conventions is used by at least one operating system as
+its standard newline sequence. When PCRE is built, a default can be specified.
+The default default is LF, which is the Unix standard. When PCRE is run, the
+default can be overridden, either when a pattern is compiled, or when it is
+matched.
+</P>
+<P>
In the PCRE documentation the word "newline" is used to mean "the character or
-pair of characters that indicate a line break".
+pair of characters that indicate a line break". The choice of newline
+convention affects the handling of the dot, circumflex, and dollar
+metacharacters, the handling of #-comments in /x mode, and, when CRLF is a
+recognized line ending sequence, the match position advancement for a
+non-anchored pattern. The choice of newline convention does not affect the
+interpretation of the \n or \r escape sequences.
</P>
<br><a name="SEC4" href="#TOC1">MULTITHREADING</a><br>
<P>
@@ -301,9 +314,9 @@ properties is available; otherwise it is set to zero.
PCRE_CONFIG_NEWLINE
</pre>
The output is an integer whose value specifies the default character sequence
-that is recognized as meaning "newline". The three values that are supported
-are: 10 for LF, 13 for CR, and 3338 for CRLF. The default should normally be
-the standard sequence for your operating system.
+that is recognized as meaning "newline". The four values that are supported
+are: 10 for LF, 13 for CR, 3338 for CRLF, and -1 for ANY. The default should
+normally be the standard sequence for your operating system.
<pre>
PCRE_CONFIG_LINK_SIZE
</pre>
@@ -374,7 +387,7 @@ fully relocatable, because it may contain a copy of the <i>tableptr</i>
argument, which is an address (see below).
</P>
<P>
-The <i>options</i> argument contains independent bits that affect the
+The <i>options</i> argument contains various bit settings that affect the
compilation. It should be zero if no options are required. The available
options are described below. Some of them, in particular, those that are
compatible with Perl, can also be set and unset from within the pattern (see
@@ -467,8 +480,8 @@ If this bit is set, a dot metacharater in the pattern matches all characters,
including those that indicate newline. Without it, a dot does not match when
the current position is at a newline. This option is equivalent to Perl's /s
option, and it can be changed within a pattern by a (?s) option setting. A
-negative class such as [^a] always matches newlines, independent of the setting
-of this option.
+negative class such as [^a] always matches newline characters, independent of
+the setting of this option.
<pre>
PCRE_DUPNAMES
</pre>
@@ -531,19 +544,37 @@ occurrences of ^ or $ in a pattern, setting PCRE_MULTILINE has no effect.
PCRE_NEWLINE_CR
PCRE_NEWLINE_LF
PCRE_NEWLINE_CRLF
+ PCRE_NEWLINE_ANY
</pre>
These options override the default newline definition that was chosen when PCRE
was built. Setting the first or the second specifies that a newline is
-indicated by a single character (CR or LF, respectively). Setting both of them
-specifies that a newline is indicated by the two-character CRLF sequence. For
-convenience, PCRE_NEWLINE_CRLF is defined to contain both bits. The only time
-that a line break is relevant when compiling a pattern is if PCRE_EXTENDED is
-set, and an unescaped # outside a character class is encountered. This
-indicates a comment that lasts until after the next newline.
+indicated by a single character (CR or LF, respectively). Setting
+PCRE_NEWLINE_CRLF specifies that a newline is indicated by the two-character
+CRLF sequence. Setting PCRE_NEWLINE_ANY specifies that any Unicode newline
+sequence should be recognized. The Unicode newline sequences are the three just
+mentioned, plus the single characters VT (vertical tab, U+000B), FF (formfeed,
+U+000C), NEL (next line, U+0085), LS (line separator, U+2028), and PS
+(paragraph separator, U+2029). The last two are recognized only in UTF-8 mode.
+</P>
+<P>
+The newline setting in the options word uses three bits that are treated
+as a number, giving eight possibilities. Currently only five are used (default
+plus the four values above). This means that if you set more than one newline
+option, the combination may or may not be sensible. For example,
+PCRE_NEWLINE_CR with PCRE_NEWLINE_LF is equivalent to PCRE_NEWLINE_CRLF, but
+other combinations yield unused numbers and cause an error.
</P>
<P>
-The newline option set at compile time becomes the default that is used for
-<b>pcre_exec()</b> and <b>pcre_dfa_exec()</b>, but it can be overridden.
+The only time that a line break is specially recognized when compiling a
+pattern is if PCRE_EXTENDED is set, and an unescaped # outside a character
+class is encountered. This indicates a comment that lasts until after the next
+line break sequence. In other circumstances, line break sequences are treated
+as literal data, except that in PCRE_EXTENDED mode, both CR and LF are treated
+as whitespace characters and are therefore ignored.
+</P>
+<P>
+The newline option that is set at compile time becomes the default that is used
+for <b>pcre_exec()</b> and <b>pcre_dfa_exec()</b>, but it can be overridden.
<pre>
PCRE_NO_AUTO_CAPTURE
</pre>
@@ -587,7 +618,8 @@ strings.
<P>
The following table lists the error codes than may be returned by
<b>pcre_compile2()</b>, along with the error messages that may be returned by
-both compiling functions.
+both compiling functions. As PCRE has developed, some error codes have fallen
+out of use. To avoid confusion, they have not been re-used.
<pre>
0 no error
1 \ at end of pattern
@@ -599,7 +631,7 @@ both compiling functions.
7 invalid escape sequence in character class
8 range out of order in character class
9 nothing to repeat
- 10 operand of unlimited repeat could match the empty string
+ 10 [this code is not in use]
11 internal error: unexpected repeat
12 unrecognized character after (?
13 POSIX named classes are supported only within a class
@@ -608,7 +640,7 @@ both compiling functions.
16 erroffset passed as NULL
17 unknown option bit(s) set
18 missing ) after comment
- 19 parentheses nested too deeply
+ 19 [this code is not in use]
20 regular expression too large
21 failed to get memory
22 unmatched parentheses
@@ -622,7 +654,7 @@ both compiling functions.
30 unknown POSIX class name
31 POSIX collating elements are not supported
32 this version of PCRE is not compiled with PCRE_UTF8 support
- 33 spare error
+ 33 [this code is not in use]
34 character value in \x{...} sequence is too large
35 invalid condition (?(0)
36 \C not allowed in lookbehind assertion
@@ -631,7 +663,7 @@ both compiling functions.
39 closing ) for (?C expected
40 recursive call could loop indefinitely
41 unrecognized character after (?P
- 42 syntax error after (?P
+ 42 syntax error in subpattern name (missing terminator)
43 two named subpatterns have the same name
44 invalid UTF-8 string
45 support for \P, \p, and \X has not been compiled
@@ -641,6 +673,11 @@ both compiling functions.
49 too many named subpatterns (maximum 10,000)
50 repeated subpattern is too long
51 octal value is greater than \377 (not in UTF-8 mode)
+ 52 internal error: overran compiling workspace
+ 53 internal error: previously-checked referenced subpattern not found
+ 54 DEFINE group contains more than one branch
+ 55 repeating a DEFINE group is not allowed
+ 56 inconsistent NEWLINE options"
</PRE>
</P>
<br><a name="SEC9" href="#TOC1">STUDYING A PATTERN</a><br>
@@ -810,7 +847,7 @@ still recognized for backwards compatibility.)
</P>
<P>
If there is a fixed first byte, for example, from a pattern such as
-(cat|cow|coyote). Otherwise, if either
+(cat|cow|coyote), its value is returned. Otherwise, if either
<br>
<br>
(a) the pattern was compiled with the PCRE_MULTILINE option, and every branch
@@ -868,7 +905,7 @@ alphabetical order. When PCRE_DUPNAMES is set, duplicate names are in order of
their parentheses numbers. For example, consider the following pattern (assume
PCRE_EXTENDED is set, so white space - including newlines - is ignored):
<pre>
- (?P&#60;date&#62; (?P&#60;year&#62;(\d\d)?\d\d) - (?P&#60;month&#62;\d\d) - (?P&#60;day&#62;\d\d) )
+ (?&#60;date&#62; (?&#60;year&#62;(\d\d)?\d\d) - (?&#60;month&#62;\d\d) - (?&#60;day&#62;\d\d) )
</pre>
There are four named subpatterns, so the table has four entries, and each entry
in the table is eight bytes long. The table is as follows, with non-printing
@@ -1116,11 +1153,16 @@ matching time.
PCRE_NEWLINE_CR
PCRE_NEWLINE_LF
PCRE_NEWLINE_CRLF
+ PCRE_NEWLINE_ANY
</pre>
These options override the newline definition that was chosen or defaulted when
-the pattern was compiled. For details, see the description <b>pcre_compile()</b>
-above. During matching, the newline choice affects the behaviour of the dot,
-circumflex, and dollar metacharacters.
+the pattern was compiled. For details, see the description of
+<b>pcre_compile()</b> above. During matching, the newline choice affects the
+behaviour of the dot, circumflex, and dollar metacharacters. It may also alter
+the way the match position is advanced after a match failure for an unanchored
+pattern. When PCRE_NEWLINE_CRLF or PCRE_NEWLINE_ANY is set, and a match attempt
+fails when the current position is at a CRLF sequence, the match position is
+advanced by two characters instead of one, in other words, to after the CRLF.
<pre>
PCRE_NOTBOL
</pre>
@@ -1334,7 +1376,7 @@ compiled in an environment of one endianness is run in an environment with the
other endianness. This is the error that PCRE gives when the magic number is
not present.
<pre>
- PCRE_ERROR_UNKNOWN_NODE (-5)
+ PCRE_ERROR_UNKNOWN_OPCODE (-5)
</pre>
While running the pattern match, an unknown item was encountered in the
compiled pattern. This error could be caused by a bug in PCRE or by overwriting
@@ -1360,12 +1402,6 @@ The backtracking limit, as specified by the <i>match_limit</i> field in a
<b>pcre_extra</b> structure (or defaulted) was reached. See the description
above.
<pre>
- PCRE_ERROR_RECURSIONLIMIT (-21)
-</pre>
-The internal recursion limit, as specified by the <i>match_limit_recursion</i>
-field in a <b>pcre_extra</b> structure (or defaulted) was reached. See the
-description above.
-<pre>
PCRE_ERROR_CALLOUT (-9)
</pre>
This error is never generated by <b>pcre_exec()</b> itself. It is provided for
@@ -1403,6 +1439,27 @@ in PCRE or by overwriting of the compiled pattern.
PCRE_ERROR_BADCOUNT (-15)
</pre>
This error is given if the value of the <i>ovecsize</i> argument is negative.
+<pre>
+ PCRE_ERROR_RECURSIONLIMIT (-21)
+</pre>
+The internal recursion limit, as specified by the <i>match_limit_recursion</i>
+field in a <b>pcre_extra</b> structure (or defaulted) was reached. See the
+description above.
+<pre>
+ PCRE_ERROR_NULLWSLIMIT (-22)
+</pre>
+When a group that can match an empty substring is repeated with an unbounded
+upper limit, the subject position at the start of the group must be remembered,
+so that a test for an empty string can be made when the end of the group is
+reached. Some workspace is required for this; if it runs out, this error is
+given.
+<pre>
+ PCRE_ERROR_BADNEWLINE (-23)
+</pre>
+An invalid combination of PCRE_NEWLINE_<i>xxx</i> options was given.
+</P>
+<P>
+Error numbers -16 to -20 are not used by <b>pcre_exec()</b>.
</P>
<br><a name="SEC15" href="#TOC1">EXTRACTING CAPTURED SUBSTRINGS BY NUMBER</a><br>
<P>
@@ -1457,7 +1514,7 @@ the string is placed in <i>buffer</i>, whose length is given by
<i>buffersize</i>, while for <b>pcre_get_substring()</b> a new block of memory is
obtained via <b>pcre_malloc</b>, and its address is returned via
<i>stringptr</i>. The yield of the function is the length of the string, not
-including the terminating zero, or one of
+including the terminating zero, or one of these error codes:
<pre>
PCRE_ERROR_NOMEMORY (-6)
</pre>
@@ -1474,7 +1531,7 @@ and builds a list of pointers to them. All this is done in a single block of
memory that is obtained via <b>pcre_malloc</b>. The address of the memory block
is returned via <i>listptr</i>, which is also the start of the list of string
pointers. The end of the list is marked by a NULL pointer. The yield of the
-function is zero if all went well, or
+function is zero if all went well, or the error code
<pre>
PCRE_ERROR_NOMEMORY (-6)
</pre>
@@ -1520,7 +1577,7 @@ provided.
To extract a substring by name, you first have to find associated number.
For example, for this pattern
<pre>
- (a+)b(?P&#60;xxx&#62;\d+)...
+ (a+)b(?&#60;xxx&#62;\d+)...
</pre>
the number of the subpattern called "xxx" is 2. If the name is known to be
unique (PCRE_DUPNAMES was not set), you can find the number from the name by
@@ -1575,10 +1632,10 @@ argument is the compiled pattern, and the second is the name. The third and
fourth are pointers to variables which are updated by the function. After it
has run, they point to the first and last entries in the name-to-number table
for the given name. The function itself returns the length of each entry, or
-PCRE_ERROR_NOSUBSTRING if there are none. The format of the table is described
-above in the section entitled <i>Information about a pattern</i>. Given all the
-relevant entries for the name, you can extract each of their numbers, and hence
-the captured data, if any.
+PCRE_ERROR_NOSUBSTRING (-7) if there are none. The format of the table is
+described above in the section entitled <i>Information about a pattern</i>.
+Given all the relevant entries for the name, you can extract each of their
+numbers, and hence the captured data, if any.
</P>
<br><a name="SEC18" href="#TOC1">FINDING ALL POSSIBLE MATCHES</a><br>
<P>
@@ -1608,11 +1665,12 @@ will yield PCRE_ERROR_NOMATCH.
</P>
<P>
The function <b>pcre_dfa_exec()</b> is called to match a subject string against
-a compiled pattern, using a "DFA" matching algorithm. This has different
-characteristics to the normal algorithm, and is not compatible with Perl. Some
-of the features of PCRE patterns are not supported. Nevertheless, there are
-times when this kind of matching can be useful. For a discussion of the two
-matching algorithms, see the
+a compiled pattern, using a matching algorithm that scans the subject string
+just once, and does not backtrack. This has different characteristics to the
+normal algorithm, and is not compatible with Perl. Some of the features of PCRE
+patterns are not supported. Nevertheless, there are times when this kind of
+matching can be useful. For a discussion of the two matching algorithms, see
+the
<a href="pcrematching.html"><b>pcrematching</b></a>
documentation.
</P>
@@ -1671,9 +1729,9 @@ matching string.
PCRE_DFA_SHORTEST
</pre>
Setting the PCRE_DFA_SHORTEST option causes the matching algorithm to stop as
-soon as it has found one match. Because of the way the DFA algorithm works,
-this is necessarily the shortest possible match at the first possible matching
-point in the subject string.
+soon as it has found one match. Because of the way the alternative algorithm
+works, this is necessarily the shortest possible match at the first possible
+matching point in the subject string.
<pre>
PCRE_DFA_RESTART
</pre>
@@ -1711,10 +1769,10 @@ the three matched strings are
On success, the yield of the function is a number greater than zero, which is
the number of matched substrings. The substrings themselves are returned in
<i>ovector</i>. Each string uses two elements; the first is the offset to the
-start, and the second is the offset to the end. All the strings have the same
-start offset. (Space could have been saved by giving this only once, but it was
-decided to retain some compatibility with the way <b>pcre_exec()</b> returns
-data, even though the meaning of the strings is different.)
+start, and the second is the offset to the end. In fact, all the strings have
+the same start offset. (Space could have been saved by giving this only once,
+but it was decided to retain some compatibility with the way <b>pcre_exec()</b>
+returns data, even though the meaning of the strings is different.)
</P>
<P>
The strings are returned in reverse order of length; that is, the longest
@@ -1740,8 +1798,9 @@ that it does not support, for instance, the use of \C or a back reference.
<pre>
PCRE_ERROR_DFA_UCOND (-17)
</pre>
-This return is given if <b>pcre_dfa_exec()</b> encounters a condition item in a
-pattern that uses a back reference for the condition. This is not supported.
+This return is given if <b>pcre_dfa_exec()</b> encounters a condition item that
+uses a back reference for the condition, or a test for recursion in a specific
+group. These are not supported.
<pre>
PCRE_ERROR_DFA_UMLIMIT (-18)
</pre>
@@ -1761,8 +1820,14 @@ recursively, using private vectors for <i>ovector</i> and <i>workspace</i>. This
error is given if the output vector is not large enough. This should be
extremely rare, as a vector of size 1000 is used.
</P>
+<br><a name="SEC20" href="#TOC1">SEE ALSO</a><br>
+<P>
+<b>pcrebuild</b>(3), <b>pcrecallout</b>(3), <b>pcrecpp(3)</b>(3),
+<b>pcrematching</b>(3), <b>pcrepartial</b>(3), <b>pcreposix</b>(3),
+<b>pcreprecompile</b>(3), <b>pcresample</b>(3), <b>pcrestack</b>(3).
+</P>
<P>
-Last updated: 08 June 2006
+Last updated: 30 November 2006
<br>
Copyright &copy; 1997-2006 University of Cambridge.
<p>
diff --git a/doc/html/pcrebuild.html b/doc/html/pcrebuild.html
index d405b4d..3ca6309 100644
--- a/doc/html/pcrebuild.html
+++ b/doc/html/pcrebuild.html
@@ -24,6 +24,7 @@ man page, in case the conversion went wrong.
<li><a name="TOC9" href="#SEC9">AVOIDING EXCESSIVE STACK USAGE</a>
<li><a name="TOC10" href="#SEC10">LIMITING PCRE RESOURCE USAGE</a>
<li><a name="TOC11" href="#SEC11">USING EBCDIC CODE</a>
+<li><a name="TOC12" href="#SEC12">SEE ALSO</a>
</ul>
<br><a name="SEC1" href="#TOC1">PCRE BUILD-TIME OPTIONS</a><br>
<P>
@@ -100,9 +101,16 @@ character sequence CRLF. If you want this, add
<pre>
--enable-newline-is-crlf
</pre>
-to the <b>configure</b> command. Whatever line ending convention is selected
-when PCRE is built can be overridden when the library functions are called. At
-build time it is conventional to use the standard for your operating system.
+to the <b>configure</b> command. There is a fourth option, specified by
+<pre>
+ --enable-newline-is-any
+</pre>
+which causes PCRE to recognize any Unicode newline sequence.
+</P>
+<P>
+Whatever line ending convention is selected when PCRE is built can be
+overridden when the library functions are called. At build time it is
+conventional to use the standard for your operating system.
</P>
<br><a name="SEC6" href="#TOC1">BUILDING SHARED AND STATIC LIBRARIES</a><br>
<P>
@@ -216,8 +224,12 @@ compiled to run in an EBCDIC environment by adding
</pre>
to the <b>configure</b> command.
</P>
+<br><a name="SEC12" href="#TOC1">SEE ALSO</a><br>
+<P>
+<b>pcreapi</b>(3), <b>pcre_config</b>(3).
+</P>
<P>
-Last updated: 06 June 2006
+Last updated: 30 November 2006
<br>
Copyright &copy; 1997-2006 University of Cambridge.
<p>
diff --git a/doc/html/pcrecompat.html b/doc/html/pcrecompat.html
index 0d4e1df..697cb13 100644
--- a/doc/html/pcrecompat.html
+++ b/doc/html/pcrecompat.html
@@ -17,8 +17,9 @@ DIFFERENCES BETWEEN PCRE AND PERL
</b><br>
<P>
This document describes the differences in the ways that PCRE and Perl handle
-regular expressions. The differences described here are with respect to Perl
-5.8.
+regular expressions. The differences described here are mainly with respect to
+Perl 5.8, though PCRE version 7.0 contains some features that are expected to
+be in the forthcoming Perl 5.10.
</P>
<P>
1. PCRE has only a subset of Perl's UTF-8 and Unicode support. Details of what
@@ -76,20 +77,28 @@ following examples:
The \Q...\E sequence is recognized both inside and outside character classes.
</P>
<P>
-8. Fairly obviously, PCRE does not support the (?{code}) and (?p{code})
-constructions. However, there is support for recursive patterns using the
-non-Perl items (?R), (?number), and (?P&#62;name). Also, the PCRE "callout" feature
-allows an external function to be called during pattern matching. See the
+8. Fairly obviously, PCRE does not support the (?{code}) and (??{code})
+constructions. However, there is support for recursive patterns. This is not
+available in Perl 5.8, but will be in Perl 5.10. Also, the PCRE "callout"
+feature allows an external function to be called during pattern matching. See
+the
<a href="pcrecallout.html"><b>pcrecallout</b></a>
documentation for details.
</P>
<P>
-9. There are some differences that are concerned with the settings of captured
+9. Subpatterns that are called recursively or as "subroutines" are always
+treated as atomic groups in PCRE. This is like Python, but unlike Perl.
+</P>
+<P>
+10. There are some differences that are concerned with the settings of captured
strings when part of a pattern is repeated. For example, matching "aba" against
the pattern /^(a(b)?)+$/ in Perl leaves $2 unset, but in PCRE it is set to "b".
</P>
<P>
-10. PCRE provides some extensions to the Perl regular expression facilities:
+11. PCRE provides some extensions to the Perl regular expression facilities.
+Perl 5.10 will include new features that are not in earlier versions, some of
+which (such as named parentheses) have been in PCRE for some time. This list is
+with respect to Perl 5.10:
<br>
<br>
(a) Although lookbehind assertions must match fixed length strings, each
@@ -119,36 +128,21 @@ only at the first matching position in the subject string.
options for <b>pcre_exec()</b> have no Perl equivalents.
<br>
<br>
-(g) The (?R), (?number), and (?P&#62;name) constructs allows for recursive pattern
-matching (Perl can do this using the (?p{code}) construct, which PCRE cannot
-support.)
-<br>
-<br>
-(h) PCRE supports named capturing substrings, using the Python syntax.
-<br>
-<br>
-(i) PCRE supports the possessive quantifier "++" syntax, taken from Sun's Java
-package.
-<br>
-<br>
-(j) The (R) condition, for testing recursion, is a PCRE extension.
-<br>
-<br>
-(k) The callout facility is PCRE-specific.
+(g) The callout facility is PCRE-specific.
<br>
<br>
-(l) The partial matching facility is PCRE-specific.
+(h) The partial matching facility is PCRE-specific.
<br>
<br>
-(m) Patterns compiled by PCRE can be saved and re-used at a later time, even on
+(i) Patterns compiled by PCRE can be saved and re-used at a later time, even on
different hosts that have the other endianness.
<br>
<br>
-(n) The alternative matching function (<b>pcre_dfa_exec()</b>) matches in a
+(j) The alternative matching function (<b>pcre_dfa_exec()</b>) matches in a
different way and is not Perl-compatible.
</P>
<P>
-Last updated: 06 June 2006
+Last updated: 28 November 2006
<br>
Copyright &copy; 1997-2006 University of Cambridge.
<p>
diff --git a/doc/html/pcrecpp.html b/doc/html/pcrecpp.html
index 8c3216d..8bd6f72 100644
--- a/doc/html/pcrecpp.html
+++ b/doc/html/pcrecpp.html
@@ -16,13 +16,14 @@ man page, in case the conversion went wrong.
<li><a name="TOC1" href="#SEC1">SYNOPSIS OF C++ WRAPPER</a>
<li><a name="TOC2" href="#SEC2">DESCRIPTION</a>
<li><a name="TOC3" href="#SEC3">MATCHING INTERFACE</a>
-<li><a name="TOC4" href="#SEC4">PARTIAL MATCHES</a>
-<li><a name="TOC5" href="#SEC5">UTF-8 AND THE MATCHING INTERFACE</a>
-<li><a name="TOC6" href="#SEC6">PASSING MODIFIERS TO THE REGULAR EXPRESSION ENGINE</a>
-<li><a name="TOC7" href="#SEC7">SCANNING TEXT INCREMENTALLY</a>
-<li><a name="TOC8" href="#SEC8">PARSING HEX/OCTAL/C-RADIX NUMBERS</a>
-<li><a name="TOC9" href="#SEC9">REPLACING PARTS OF STRINGS</a>
-<li><a name="TOC10" href="#SEC10">AUTHOR</a>
+<li><a name="TOC4" href="#SEC4">QUOTING METACHARACTERS</a>
+<li><a name="TOC5" href="#SEC5">PARTIAL MATCHES</a>
+<li><a name="TOC6" href="#SEC6">UTF-8 AND THE MATCHING INTERFACE</a>
+<li><a name="TOC7" href="#SEC7">PASSING MODIFIERS TO THE REGULAR EXPRESSION ENGINE</a>
+<li><a name="TOC8" href="#SEC8">SCANNING TEXT INCREMENTALLY</a>
+<li><a name="TOC9" href="#SEC9">PARSING HEX/OCTAL/C-RADIX NUMBERS</a>
+<li><a name="TOC10" href="#SEC10">REPLACING PARTS OF STRINGS</a>
+<li><a name="TOC11" href="#SEC11">AUTHOR</a>
</ul>
<br><a name="SEC1" href="#TOC1">SYNOPSIS OF C++ WRAPPER</a><br>
<P>
@@ -105,12 +106,33 @@ The function returns true iff all of the following conditions are satisfied:
number of sub-patterns, "i"th captured sub-pattern is
ignored.
</pre>
+CAVEAT: An optional sub-pattern that does not exist in the matched
+string is assigned the empty string. Therefore, the following will
+return false (because the empty string is not a valid number):
+<pre>
+ int number;
+ pcrecpp::RE::FullMatch("abc", "[a-z]+(\\d+)?", &number);
+</pre>
The matching interface supports at most 16 arguments per call.
If you need more, consider using the more general interface
<b>pcrecpp::RE::DoMatch</b>. See <b>pcrecpp.h</b> for the signature for
<b>DoMatch</b>.
</P>
-<br><a name="SEC4" href="#TOC1">PARTIAL MATCHES</a><br>
+<br><a name="SEC4" href="#TOC1">QUOTING METACHARACTERS</a><br>
+<P>
+You can use the "QuoteMeta" operation to insert backslashes before all
+potentially meaningful characters in a string. The returned string, used as a
+regular expression, will exactly match the original string.
+<pre>
+ Example:
+ string quoted = RE::QuoteMeta(unquoted);
+</pre>
+Note that it's legal to escape a character even if it has no special meaning in
+a regular expression -- so this function does that. (This also makes it
+identical to the perl function of the same name; see "perldoc -f quotemeta".)
+For example, "1.5-2.0?" becomes "1\.5\-2\.0\?".
+</P>
+<br><a name="SEC5" href="#TOC1">PARTIAL MATCHES</a><br>
<P>
You can use the "PartialMatch" operation when you want the pattern
to match any substring of the text.
@@ -125,7 +147,7 @@ to match any substring of the text.
assert(number == 100);
</PRE>
</P>
-<br><a name="SEC5" href="#TOC1">UTF-8 AND THE MATCHING INTERFACE</a><br>
+<br><a name="SEC6" href="#TOC1">UTF-8 AND THE MATCHING INTERFACE</a><br>
<P>
By default, pattern and text are plain text, one byte per character. The UTF8
flag, passed to the constructor, causes both pattern and string to be treated
@@ -150,7 +172,7 @@ NOTE: The UTF8 flag is ignored if pcre was not configured with the
--enable-utf8 flag.
</PRE>
</P>
-<br><a name="SEC6" href="#TOC1">PASSING MODIFIERS TO THE REGULAR EXPRESSION ENGINE</a><br>
+<br><a name="SEC7" href="#TOC1">PASSING MODIFIERS TO THE REGULAR EXPRESSION ENGINE</a><br>
<P>
PCRE defines some modifiers to change the behavior of the regular expression
engine. The C++ wrapper defines an auxiliary class, RE_Options, as a vehicle to
@@ -244,7 +266,7 @@ PCRE_EXTENDED, and PCRE_MULTILINE to a RE with one statement, you may write:
</PRE>
</P>
-<br><a name="SEC7" href="#TOC1">SCANNING TEXT INCREMENTALLY</a><br>
+<br><a name="SEC8" href="#TOC1">SCANNING TEXT INCREMENTALLY</a><br>
<P>
The "Consume" operation may be useful if you want to repeatedly
match regular expressions at the front of a string and skip over
@@ -277,7 +299,7 @@ could extract all words from a string by repeatedly calling
pcrecpp::RE("(\\w+)").FindAndConsume(&input, &word)
</PRE>
</P>
-<br><a name="SEC8" href="#TOC1">PARSING HEX/OCTAL/C-RADIX NUMBERS</a><br>
+<br><a name="SEC9" href="#TOC1">PARSING HEX/OCTAL/C-RADIX NUMBERS</a><br>
<P>
By default, if you pass a pointer to a numeric value, the
corresponding text is interpreted as a base-10 number. You can
@@ -295,7 +317,7 @@ prefixes, but defaults to base-10.
</pre>
will leave 64 in a, b, c, and d.
</P>
-<br><a name="SEC9" href="#TOC1">REPLACING PARTS OF STRINGS</a><br>
+<br><a name="SEC10" href="#TOC1">REPLACING PARTS OF STRINGS</a><br>
<P>
You can replace the first match of "pattern" in "str" with "rewrite".
Within "rewrite", backslash-escaped digits (\1 to \9) can be
@@ -327,11 +349,11 @@ The non-matching portions of "text" are ignored. Returns true iff a match
occurred and the extraction happened successfully; if no match occurs, the
string is left unaffected.
</P>
-<br><a name="SEC10" href="#TOC1">AUTHOR</a><br>
+<br><a name="SEC11" href="#TOC1">AUTHOR</a><br>
<P>
The C++ wrapper was contributed by Google Inc.
<br>
-Copyright &copy; 2005 Google Inc.
+Copyright &copy; 2006 Google Inc.
<p>
Return to the <a href="index.html">PCRE index page</a>.
</p>
diff --git a/doc/html/pcregrep.html b/doc/html/pcregrep.html
index 97ece8e..1a295d2 100644
--- a/doc/html/pcregrep.html
+++ b/doc/html/pcregrep.html
@@ -22,7 +22,8 @@ man page, in case the conversion went wrong.
<li><a name="TOC7" href="#SEC7">OPTIONS WITH DATA</a>
<li><a name="TOC8" href="#SEC8">MATCHING ERRORS</a>
<li><a name="TOC9" href="#SEC9">DIAGNOSTICS</a>
-<li><a name="TOC10" href="#SEC10">AUTHOR</a>
+<li><a name="TOC10" href="#SEC10">SEE ALSO</a>
+<li><a name="TOC11" href="#SEC11">AUTHOR</a>
</ul>
<br><a name="SEC1" href="#TOC1">SYNOPSIS</a><br>
<P>
@@ -33,9 +34,9 @@ man page, in case the conversion went wrong.
<b>pcregrep</b> searches files for character patterns, in the same way as other
grep commands do, but it uses the PCRE regular expression library to support
patterns that are compatible with the regular expressions of Perl 5. See
-<a href="pcrepattern.html"><b>pcrepattern</b></a>
-for a full description of syntax and semantics of the regular expressions that
-PCRE supports.
+<a href="pcrepattern.html"><b>pcrepattern</b>(3)</a>
+for a full description of syntax and semantics of the regular expressions
+that PCRE supports.
</P>
<P>
Patterns, whether supplied on the command line or in a separate file, are given
@@ -268,16 +269,23 @@ are guaranteed to be available for lookbehind assertions.
</P>
<P>
<b>-N</b> <i>newline-type</i>, <b>--newline=</b><i>newline-type</i>
-The PCRE library supports three different character sequences for indicating
+The PCRE library supports four different conventions for indicating
the ends of lines. They are the single-character sequences CR (carriage return)
-and LF (linefeed), and the two-character sequence CR, LF. When the library is
-built, a default line-ending sequence is specified. This is normally the
-standard sequence for the operating system. Unless otherwise specified by this
-option, <b>pcregrep</b> uses the default. The possible values for this option
-are CR, LF, or CRLF. This makes it possible to use <b>pcregrep</b> on files that
-have come from other environments without having to modify their line endings.
-If the data that is being scanned does not agree with the convention set by
-this option, <b>pcregrep</b> may behave in strange ways.
+and LF (linefeed), the two-character sequence CRLF, and an "any" convention, in
+which any Unicode line ending sequence is assumed to end a line. The Unicode
+sequences are the three just mentioned, plus VT (vertical tab, U+000B), FF
+(formfeed, U+000C), NEL (next line, U+0085), LS (line separator, U+2028), and
+PS (paragraph separator, U+0029).
+<br>
+<br>
+When the PCRE library is built, a default line-ending sequence is specified.
+This is normally the standard sequence for the operating system. Unless
+otherwise specified by this option, <b>pcregrep</b> uses the library's default.
+The possible values for this option are CR, LF, CRLF, or ANY. This makes it
+possible to use <b>pcregrep</b> on files that have come from other environments
+without having to modify their line endings. If the data that is being scanned
+does not agree with the convention set by this option, <b>pcregrep</b> may
+behave in strange ways.
</P>
<P>
<b>-n</b>, <b>--line-number</b>
@@ -407,16 +415,20 @@ found in other files) or too many matching errors. Using the <b>-s</b> option to
suppress error messages about inaccessble files does not affect the return
code.
</P>
-<br><a name="SEC10" href="#TOC1">AUTHOR</a><br>
+<br><a name="SEC10" href="#TOC1">SEE ALSO</a><br>
+<P>
+<b>pcrepattern</b>(3), <b>pcretest</b>(1).
+</P>
+<br><a name="SEC11" href="#TOC1">AUTHOR</a><br>
<P>
Philip Hazel
<br>
University Computing Service
<br>
-Cambridge CB2 3QG, England.
+Cambridge CB2 3QH, England.
</P>
<P>
-Last updated: 06 June 2006
+Last updated: 29 November 2006
<br>
Copyright &copy; 1997-2006 University of Cambridge.
<p>
diff --git a/doc/html/pcrematching.html b/doc/html/pcrematching.html
index 56740a5..22876a3 100644
--- a/doc/html/pcrematching.html
+++ b/doc/html/pcrematching.html
@@ -16,9 +16,9 @@ man page, in case the conversion went wrong.
<li><a name="TOC1" href="#SEC1">PCRE MATCHING ALGORITHMS</a>
<li><a name="TOC2" href="#SEC2">REGULAR EXPRESSIONS AS TREES</a>
<li><a name="TOC3" href="#SEC3">THE STANDARD MATCHING ALGORITHM</a>
-<li><a name="TOC4" href="#SEC4">THE DFA MATCHING ALGORITHM</a>
-<li><a name="TOC5" href="#SEC5">ADVANTAGES OF THE DFA ALGORITHM</a>
-<li><a name="TOC6" href="#SEC6">DISADVANTAGES OF THE DFA ALGORITHM</a>
+<li><a name="TOC4" href="#SEC4">THE ALTERNATIVE MATCHING ALGORITHM</a>
+<li><a name="TOC5" href="#SEC5">ADVANTAGES OF THE ALTERNATIVE ALGORITHM</a>
+<li><a name="TOC6" href="#SEC6">DISADVANTAGES OF THE ALTERNATIVE ALGORITHM</a>
</ul>
<br><a name="SEC1" href="#TOC1">PCRE MATCHING ALGORITHMS</a><br>
<P>
@@ -46,7 +46,7 @@ is matched against the string
&#60;something&#62; &#60;something else&#62; &#60;something further&#62;
</pre>
there are three possible answers. The standard algorithm finds only one of
-them, whereas the DFA algorithm finds all three.
+them, whereas the alternative algorithm finds all three.
</P>
<br><a name="SEC2" href="#TOC1">REGULAR EXPRESSIONS AS TREES</a><br>
<P>
@@ -83,14 +83,15 @@ straightforward for this algorithm to keep track of the substrings that are
matched by portions of the pattern in parentheses. This provides support for
capturing parentheses and back references.
</P>
-<br><a name="SEC4" href="#TOC1">THE DFA MATCHING ALGORITHM</a><br>
+<br><a name="SEC4" href="#TOC1">THE ALTERNATIVE MATCHING ALGORITHM</a><br>
<P>
-DFA stands for "deterministic finite automaton", but you do not need to
-understand the origins of that name. This algorithm conducts a breadth-first
-search of the tree. Starting from the first matching point in the subject, it
-scans the subject string from left to right, once, character by character, and
-as it does this, it remembers all the paths through the tree that represent
-valid matches.
+This algorithm conducts a breadth-first search of the tree. Starting from the
+first matching point in the subject, it scans the subject string from left to
+right, once, character by character, and as it does this, it remembers all the
+paths through the tree that represent valid matches. In Friedl's terminology,
+this is a kind of "DFA algorithm", though it is not implemented as a
+traditional finite state machine (it keeps multiple states active
+simultaneously).
</P>
<P>
The scan continues until either the end of the subject is reached, or there are
@@ -114,12 +115,21 @@ matches that start at later positions.
</P>
<P>
There are a number of features of PCRE regular expressions that are not
-supported by the DFA matching algorithm. They are as follows:
+supported by the alternative matching algorithm. They are as follows:
</P>
<P>
1. Because the algorithm finds all possible matches, the greedy or ungreedy
nature of repetition quantifiers is not relevant. Greedy and ungreedy
-quantifiers are treated in exactly the same way.
+quantifiers are treated in exactly the same way. However, possessive
+quantifiers can make a difference when what follows could also match what is
+quantified, for example in a pattern like this:
+<pre>
+ ^a++\w!
+</pre>
+This pattern matches "aaab!" but not "aaa!", which would be matched by a
+non-possessive quantifier. Similarly, if an atomic group is present, it is
+matched as if it were a standalone pattern at the current point, and the
+longest match is then "locked in" for the rest of the overall pattern.
</P>
<P>
2. When dealing with multiple paths through the tree simultaneously, it is not
@@ -133,7 +143,7 @@ not supported, and cause errors if encountered.
</P>
<P>
4. For the same reason, conditional expressions that use a backreference as the
-condition are not supported.
+condition or test for a specific group recursion are not supported.
</P>
<P>
5. Callouts are supported, but the value of the <i>capture_top</i> field is
@@ -142,13 +152,13 @@ always 1, and the value of the <i>capture_last</i> field is always -1.
<P>
6.
The \C escape sequence, which (in the standard algorithm) matches a single
-byte, even in UTF-8 mode, is not supported because the DFA algorithm moves
-through the subject string one character at a time, for all active paths
+byte, even in UTF-8 mode, is not supported because the alternative algorithm
+moves through the subject string one character at a time, for all active paths
through the tree.
</P>
-<br><a name="SEC5" href="#TOC1">ADVANTAGES OF THE DFA ALGORITHM</a><br>
+<br><a name="SEC5" href="#TOC1">ADVANTAGES OF THE ALTERNATIVE ALGORITHM</a><br>
<P>
-Using the DFA matching algorithm provides the following advantages:
+Using the alternative matching algorithm provides the following advantages:
</P>
<P>
1. All possible matches (at a single point in the subject) are automatically
@@ -159,17 +169,18 @@ callouts.
<P>
2. There is much better support for partial matching. The restrictions on the
content of the pattern that apply when using the standard algorithm for partial
-matching do not apply to the DFA algorithm. For non-anchored patterns, the
-starting position of a partial match is available.
+matching do not apply to the alternative algorithm. For non-anchored patterns,
+the starting position of a partial match is available.
</P>
<P>
-3. Because the DFA algorithm scans the subject string just once, and never
-needs to backtrack, it is possible to pass very long subject strings to the
-matching function in several pieces, checking for partial matching each time.
+3. Because the alternative algorithm scans the subject string just once, and
+never needs to backtrack, it is possible to pass very long subject strings to
+the matching function in several pieces, checking for partial matching each
+time.
</P>
-<br><a name="SEC6" href="#TOC1">DISADVANTAGES OF THE DFA ALGORITHM</a><br>
+<br><a name="SEC6" href="#TOC1">DISADVANTAGES OF THE ALTERNATIVE ALGORITHM</a><br>
<P>
-The DFA algorithm suffers from a number of disadvantages:
+The alternative algorithm suffers from a number of disadvantages:
</P>
<P>
1. It is substantially slower than the standard algorithm. This is partly
@@ -180,11 +191,11 @@ less susceptible to optimization.
2. Capturing parentheses and back references are not supported.
</P>
<P>
-3. The "atomic group" feature of PCRE regular expressions is supported, but
-does not provide the advantage that it does for the standard algorithm.
+3. Although atomic groups are supported, their use does not provide the
+performance advantage that it does for the standard algorithm.
</P>
<P>
-Last updated: 06 June 2006
+Last updated: 24 November 2006
<br>
Copyright &copy; 1997-2006 University of Cambridge.
<p>
diff --git a/doc/html/pcrepartial.html b/doc/html/pcrepartial.html
index acb93c2..0004a59 100644
--- a/doc/html/pcrepartial.html
+++ b/doc/html/pcrepartial.html
@@ -112,8 +112,9 @@ uses the date example quoted above:
</pre>
The first data string is matched completely, so <b>pcretest</b> shows the
matched substrings. The remaining four strings do not match the complete
-pattern, but the first two are partial matches. The same test, using DFA
-matching (by means of the \D escape sequence), produces the following output:
+pattern, but the first two are partial matches. The same test, using
+<b>pcre_dfa_exec()</b> matching (by means of the \D escape sequence), produces
+the following output:
<pre>
re&#62; /^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$/
data&#62; 25jun04\P\D
@@ -134,11 +135,11 @@ available.
<P>
When a partial match has been found using <b>pcre_dfa_exec()</b>, it is possible
to continue the match by providing additional subject data and calling
-<b>pcre_dfa_exec()</b> again with the PCRE_DFA_RESTART option and the same
-working space (where details of the previous partial match are stored). Here is
-an example using <b>pcretest</b>, where the \R escape sequence sets the
-PCRE_DFA_RESTART option and the \D escape sequence requests the use of
-<b>pcre_dfa_exec()</b>:
+<b>pcre_dfa_exec()</b> again with the same compiled regular expression, this
+time setting the PCRE_DFA_RESTART option. You must also pass the same working
+space as before, because this is where details of the previous partial match
+are stored. Here is an example using <b>pcretest</b>, using the \R escape
+sequence to set the PCRE_DFA_RESTART option (\P and \D are as above):
<pre>
re&#62; /^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$/
data&#62; 23ja\P\D
@@ -153,9 +154,10 @@ not retain the previously partially-matched string. It is up to the calling
program to do that if it needs to.
</P>
<P>
-This facility can be used to pass very long subject strings to
-<b>pcre_dfa_exec()</b>. However, some care is needed for certain types of
-pattern.
+You can set PCRE_PARTIAL with PCRE_DFA_RESTART to continue partial matching
+over multiple segments. This facility can be used to pass very long subject
+strings to <b>pcre_dfa_exec()</b>. However, some care is needed for certain
+types of pattern.
</P>
<P>
1. If the pattern contains tests for the beginning or end of a line, you need
@@ -165,7 +167,7 @@ subject string for any call does not contain the beginning or end of a line.
<P>
2. If the pattern contains backward assertions (including \b or \B), you need
to arrange for some overlap in the subject strings to allow for this. For
-example, you could pass the subject in chunks that were 500 bytes long, but in
+example, you could pass the subject in chunks that are 500 bytes long, but in
a buffer of 700 bytes, with the starting offset set to 200 and the previous 200
bytes at the start of the buffer.
</P>
@@ -217,7 +219,7 @@ patterns or patterns such as:
where no string can be a partial match for both alternatives.
</P>
<P>
-Last updated: 16 January 2006
+Last updated: 30 November 2006
<br>
Copyright &copy; 1997-2006 University of Cambridge.
<p>
diff --git a/doc/html/pcrepattern.html b/doc/html/pcrepattern.html
index 8f10cad..b2a171c 100644
--- a/doc/html/pcrepattern.html
+++ b/doc/html/pcrepattern.html
@@ -14,25 +14,27 @@ man page, in case the conversion went wrong.
<br>
<ul>
<li><a name="TOC1" href="#SEC1">PCRE REGULAR EXPRESSION DETAILS</a>
-<li><a name="TOC2" href="#SEC2">BACKSLASH</a>
-<li><a name="TOC3" href="#SEC3">CIRCUMFLEX AND DOLLAR</a>
-<li><a name="TOC4" href="#SEC4">FULL STOP (PERIOD, DOT)</a>
-<li><a name="TOC5" href="#SEC5">MATCHING A SINGLE BYTE</a>
-<li><a name="TOC6" href="#SEC6">SQUARE BRACKETS AND CHARACTER CLASSES</a>
-<li><a name="TOC7" href="#SEC7">POSIX CHARACTER CLASSES</a>
-<li><a name="TOC8" href="#SEC8">VERTICAL BAR</a>
-<li><a name="TOC9" href="#SEC9">INTERNAL OPTION SETTING</a>
-<li><a name="TOC10" href="#SEC10">SUBPATTERNS</a>
-<li><a name="TOC11" href="#SEC11">NAMED SUBPATTERNS</a>
-<li><a name="TOC12" href="#SEC12">REPETITION</a>
-<li><a name="TOC13" href="#SEC13">ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS</a>
-<li><a name="TOC14" href="#SEC14">BACK REFERENCES</a>
-<li><a name="TOC15" href="#SEC15">ASSERTIONS</a>
-<li><a name="TOC16" href="#SEC16">CONDITIONAL SUBPATTERNS</a>
-<li><a name="TOC17" href="#SEC17">COMMENTS</a>
-<li><a name="TOC18" href="#SEC18">RECURSIVE PATTERNS</a>
-<li><a name="TOC19" href="#SEC19">SUBPATTERNS AS SUBROUTINES</a>
-<li><a name="TOC20" href="#SEC20">CALLOUTS</a>
+<li><a name="TOC2" href="#SEC2">CHARACTERS AND METACHARACTERS</a>
+<li><a name="TOC3" href="#SEC3">BACKSLASH</a>
+<li><a name="TOC4" href="#SEC4">CIRCUMFLEX AND DOLLAR</a>
+<li><a name="TOC5" href="#SEC5">FULL STOP (PERIOD, DOT)</a>
+<li><a name="TOC6" href="#SEC6">MATCHING A SINGLE BYTE</a>
+<li><a name="TOC7" href="#SEC7">SQUARE BRACKETS AND CHARACTER CLASSES</a>
+<li><a name="TOC8" href="#SEC8">POSIX CHARACTER CLASSES</a>
+<li><a name="TOC9" href="#SEC9">VERTICAL BAR</a>
+<li><a name="TOC10" href="#SEC10">INTERNAL OPTION SETTING</a>
+<li><a name="TOC11" href="#SEC11">SUBPATTERNS</a>
+<li><a name="TOC12" href="#SEC12">NAMED SUBPATTERNS</a>
+<li><a name="TOC13" href="#SEC13">REPETITION</a>
+<li><a name="TOC14" href="#SEC14">ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS</a>
+<li><a name="TOC15" href="#SEC15">BACK REFERENCES</a>
+<li><a name="TOC16" href="#SEC16">ASSERTIONS</a>
+<li><a name="TOC17" href="#SEC17">CONDITIONAL SUBPATTERNS</a>
+<li><a name="TOC18" href="#SEC18">COMMENTS</a>
+<li><a name="TOC19" href="#SEC19">RECURSIVE PATTERNS</a>
+<li><a name="TOC20" href="#SEC20">SUBPATTERNS AS SUBROUTINES</a>
+<li><a name="TOC21" href="#SEC21">CALLOUTS</a>
+<li><a name="TOC22" href="#SEC22">SEE ALSO</a>
</ul>
<br><a name="SEC1" href="#TOC1">PCRE REGULAR EXPRESSION DETAILS</a><br>
<P>
@@ -64,6 +66,7 @@ and how it differs from the normal function, are discussed in the
<a href="pcrematching.html"><b>pcrematching</b></a>
page.
</P>
+<br><a name="SEC2" href="#TOC1">CHARACTERS AND METACHARACTERS</a><br>
<P>
A regular expression is a pattern that is matched against a subject string from
left to right. Most characters stand for themselves in a pattern, and match the
@@ -90,8 +93,8 @@ interpreted in some special way.
<P>
There are two different sets of metacharacters: those that are recognized
anywhere in the pattern except within square brackets, and those that are
-recognized in square brackets. Outside square brackets, the metacharacters are
-as follows:
+recognized within square brackets. Outside square brackets, the metacharacters
+are as follows:
<pre>
\ general escape character with several uses
^ assert start of string (or line, in multiline mode)
@@ -120,7 +123,7 @@ a character class the only metacharacters are:
</pre>
The following sections describe the use of each of the metacharacters.
</P>
-<br><a name="SEC2" href="#TOC1">BACKSLASH</a><br>
+<br><a name="SEC3" href="#TOC1">BACKSLASH</a><br>
<P>
The backslash character has several uses. Firstly, if it is followed by a
non-alphanumeric character, it takes away any special meaning that character
@@ -216,7 +219,7 @@ following the discussion of
<P>
Inside a character class, or if the decimal number is greater than 9 and there
have not been that many capturing subpatterns, PCRE re-reads up to three octal
-digits following the backslash, ane uses them to generate a data character. Any
+digits following the backslash, and uses them to generate a data character. Any
subsequent digits stand for themselves. In non-UTF-8 mode, the value of a
character specified in octal must be less than \400. In UTF-8 mode, values up
to \777 are permitted. For example:
@@ -238,15 +241,27 @@ zero, because no more than three octal digits are ever read.
All the sequences that define a single character value can be used both inside
and outside character classes. In addition, inside a character class, the
sequence \b is interpreted as the backspace character (hex 08), and the
-sequence \X is interpreted as the character "X". Outside a character class,
-these sequences have different meanings
+sequences \R and \X are interpreted as the characters "R" and "X",
+respectively. Outside a character class, these sequences have different
+meanings
<a href="#uniextseq">(see below).</a>
</P>
<br><b>
+Absolute and relative back references
+</b><br>
+<P>
+The sequence \g followed by a positive or negative number, optionally enclosed
+in braces, is an absolute or relative back reference. Back references are
+discussed
+<a href="#backreferences">later,</a>
+following the discussion of
+<a href="#subpattern">parenthesized subpatterns.</a>
+</P>
+<br><b>
Generic character types
</b><br>
<P>
-The third use of backslash is for specifying generic character types. The
+Another use of backslash is for specifying generic character types. The
following are always recognized:
<pre>
\d any decimal digit
@@ -288,6 +303,33 @@ In UTF-8 mode, characters with values greater than 128 never match \d, \s, or
\w, and always match \D, \S, and \W. This is true even when Unicode
character property support is available. The use of locales with Unicode is
discouraged.
+</P>
+<br><b>
+Newline sequences
+</b><br>
+<P>
+Outside a character class, the escape sequence \R matches any Unicode newline
+sequence. This is an extension to Perl. In non-UTF-8 mode \R is equivalent to
+the following:
+<pre>
+ (?&#62;\r\n|\n|\x0b|\f|\r|\x85)
+</pre>
+This is an example of an "atomic group", details of which are given
+<a href="#atomicgroup">below.</a>
+This particular group matches either the two-character sequence CR followed by
+LF, or one of the single characters LF (linefeed, U+000A), VT (vertical tab,
+U+000B), FF (formfeed, U+000C), CR (carriage return, U+000D), or NEL (next
+line, U+0085). The two-character sequence is treated as a single unit that
+cannot be split.
+</P>
+<P>
+In UTF-8 mode, two additional characters whose codepoints are greater than 255
+are added: LS (line separator, U+2028) and PS (paragraph separator, U+2029).
+Unicode character property support is not needed for these characters to be
+recognized.
+</P>
+<P>
+Inside a character class, \R matches the letter "R".
<a name="uniextseq"></a></P>
<br><b>
Unicode character properties
@@ -321,6 +363,7 @@ Those that are not part of an identified script are lumped together as
<P>
Arabic,
Armenian,
+Balinese,
Bengali,
Bopomofo,
Braille,
@@ -330,6 +373,7 @@ Canadian_Aboriginal,
Cherokee,
Common,
Coptic,
+Cuneiform,
Cypriot,
Cyrillic,
Deseret,
@@ -359,11 +403,14 @@ Malayalam,
Mongolian,
Myanmar,
New_Tai_Lue,
+Nko,
Ogham,
Old_Italic,
Old_Persian,
Oriya,
Osmanya,
+Phags_Pa,
+Phoenician,
Runic,
Shavian,
Sinhala,
@@ -483,7 +530,7 @@ properties in PCRE.
Simple assertions
</b><br>
<P>
-The fourth use of backslash is for certain simple assertions. An assertion
+The final use of backslash is for certain simple assertions. An assertion
specifies a condition that has to be met at a particular point in a match,
without consuming any characters from the subject string. The use of
subpatterns for more complicated assertions is described
@@ -492,10 +539,11 @@ The backslashed assertions are:
<pre>
\b matches at a word boundary
\B matches when not at a word boundary
- \A matches at start of subject
- \Z matches at end of subject or before newline at end
- \z matches at end of subject
- \G matches at first matching position in subject
+ \A matches at the start of the subject
+ \Z matches at the end of the subject
+ also matches before a newline at the end of the subject
+ \z matches only at the end of the subject
+ \G matches at the first matching position in the subject
</pre>
These assertions may not appear in character classes (but note that \b has a
different meaning, namely the backspace character, inside a character class).
@@ -538,7 +586,7 @@ If all the alternatives of a pattern begin with \G, the expression is anchored
to the starting match position, and the "anchored" flag is set in the compiled
regular expression.
</P>
-<br><a name="SEC3" href="#TOC1">CIRCUMFLEX AND DOLLAR</a><br>
+<br><a name="SEC4" href="#TOC1">CIRCUMFLEX AND DOLLAR</a><br>
<P>
Outside a character class, in the default matching mode, the circumflex
character is an assertion that is true only if the current matching point is
@@ -592,34 +640,39 @@ Note that the sequences \A, \Z, and \z can be used to match the start and
end of the subject in both modes, and if all branches of a pattern start with
\A it is always anchored, whether or not PCRE_MULTILINE is set.
</P>
-<br><a name="SEC4" href="#TOC1">FULL STOP (PERIOD, DOT)</a><br>
+<br><a name="SEC5" href="#TOC1">FULL STOP (PERIOD, DOT)</a><br>
<P>
Outside a character class, a dot in the pattern matches any one character in
the subject string except (by default) a character that signifies the end of a
-line. In UTF-8 mode, the matched character may be more than one byte long. When
-a line ending is defined as a single character (CR or LF), dot never matches
-that character; when the two-character sequence CRLF is used, dot does not
-match CR if it is immediately followed by LF, but otherwise it matches all
-characters (including isolated CRs and LFs).
+line. In UTF-8 mode, the matched character may be more than one byte long.
+</P>
+<P>
+When a line ending is defined as a single character, dot never matches that
+character; when the two-character sequence CRLF is used, dot does not match CR
+if it is immediately followed by LF, but otherwise it matches all characters
+(including isolated CRs and LFs). When any Unicode line endings are being
+recognized, dot does not match CR or LF or any of the other line ending
+characters.
</P>
<P>
The behaviour of dot with regard to newlines can be changed. If the PCRE_DOTALL
-option is set, a dot matches any one character, without exception. If newline
-is defined as the two-character sequence CRLF, it takes two dots to match it.
+option is set, a dot matches any one character, without exception. If the
+two-character sequence CRLF is present in the subject string, it takes two dots
+to match it.
</P>
<P>
The handling of dot is entirely independent of the handling of circumflex and
dollar, the only relationship being that they both involve newlines. Dot has no
special meaning in a character class.
</P>
-<br><a name="SEC5" href="#TOC1">MATCHING A SINGLE BYTE</a><br>
+<br><a name="SEC6" href="#TOC1">MATCHING A SINGLE BYTE</a><br>
<P>
Outside a character class, the escape sequence \C matches any one byte, both
-in and out of UTF-8 mode. Unlike a dot, it always matches CR and LF. The
-feature is provided in Perl in order to match individual bytes in UTF-8 mode.
-Because it breaks up UTF-8 characters into individual bytes, what remains in
-the string may be a malformed UTF-8 string. For this reason, the \C escape
-sequence is best avoided.
+in and out of UTF-8 mode. Unlike a dot, it always matches any line-ending
+characters. The feature is provided in Perl in order to match individual bytes
+in UTF-8 mode. Because it breaks up UTF-8 characters into individual bytes,
+what remains in the string may be a malformed UTF-8 string. For this reason,
+the \C escape sequence is best avoided.
</P>
<P>
PCRE does not allow \C to appear in lookbehind assertions
@@ -627,7 +680,7 @@ PCRE does not allow \C to appear in lookbehind assertions
because in UTF-8 mode this would make it impossible to calculate the length of
the lookbehind.
<a name="characterclass"></a></P>
-<br><a name="SEC6" href="#TOC1">SQUARE BRACKETS AND CHARACTER CLASSES</a><br>
+<br><a name="SEC7" href="#TOC1">SQUARE BRACKETS AND CHARACTER CLASSES</a><br>
<P>
An opening square bracket introduces a character class, terminated by a closing
square bracket. A closing square bracket on its own is not special. If a
@@ -670,10 +723,10 @@ ensure that PCRE is compiled with Unicode property support as well as with
UTF-8 support.
</P>
<P>
-Characters that might indicate line breaks (CR and LF) are never treated in any
-special way when matching character classes, whatever line-ending sequence is
-in use, and whatever setting of the PCRE_DOTALL and PCRE_MULTILINE options is
-used. A class such as [^a] always matches one of these characters.
+Characters that might indicate line breaks are never treated in any special way
+when matching character classes, whatever line-ending sequence is in use, and
+whatever setting of the PCRE_DOTALL and PCRE_MULTILINE options is used. A class
+such as [^a] always matches one of these characters.
</P>
<P>
The minus (hyphen) character can be used to specify a range of characters in a
@@ -722,7 +775,7 @@ introducing a POSIX class name - see the next section), and the terminating
closing square bracket. However, escaping other non-alphanumeric characters
does no harm.
</P>
-<br><a name="SEC7" href="#TOC1">POSIX CHARACTER CLASSES</a><br>
+<br><a name="SEC8" href="#TOC1">POSIX CHARACTER CLASSES</a><br>
<P>
Perl supports the POSIX notation for character classes. This uses names
enclosed by [: and :] within the enclosing square brackets. PCRE also supports
@@ -768,7 +821,7 @@ supported, and an error is given if they are encountered.
In UTF-8 mode, characters with values greater than 128 do not match any of
the POSIX character classes.
</P>
-<br><a name="SEC8" href="#TOC1">VERTICAL BAR</a><br>
+<br><a name="SEC9" href="#TOC1">VERTICAL BAR</a><br>
<P>
Vertical bar characters are used to separate alternative patterns. For example,
the pattern
@@ -783,7 +836,7 @@ that succeeds is used. If the alternatives are within a subpattern
"succeeds" means matching the rest of the main pattern as well as the
alternative in the subpattern.
</P>
-<br><a name="SEC9" href="#TOC1">INTERNAL OPTION SETTING</a><br>
+<br><a name="SEC10" href="#TOC1">INTERNAL OPTION SETTING</a><br>
<P>
The settings of the PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, and
PCRE_EXTENDED options can be changed from within the pattern by a sequence of
@@ -809,8 +862,8 @@ the global options (and it will therefore show up in data extracted by the
<b>pcre_fullinfo()</b> function).
</P>
<P>
-An option change within a subpattern affects only that part of the current
-pattern that follows it, so
+An option change within a subpattern (see below for a description of
+subpatterns) affects only that part of the current pattern that follows it, so
<pre>
(a(?i)b)c
</pre>
@@ -831,7 +884,7 @@ The PCRE-specific options PCRE_DUPNAMES, PCRE_UNGREEDY, and PCRE_EXTRA can be
changed in the same way as the Perl-compatible options by using the characters
J, U and X respectively.
<a name="subpattern"></a></P>
-<br><a name="SEC10" href="#TOC1">SUBPATTERNS</a><br>
+<br><a name="SEC11" href="#TOC1">SUBPATTERNS</a><br>
<P>
Subpatterns are delimited by parentheses (round brackets), which can be nested.
Turning part of a pattern into a subpattern does two things:
@@ -842,7 +895,7 @@ Turning part of a pattern into a subpattern does two things:
cat(aract|erpillar|)
</pre>
matches one of the words "cat", "cataract", or "caterpillar". Without the
-parentheses, it would match "cataract", "erpillar" or the empty string.
+parentheses, it would match "cataract", "erpillar" or an empty string.
<br>
<br>
2. It sets up the subpattern as a capturing subpattern. This means that, when
@@ -870,8 +923,7 @@ the string "the white queen" is matched against the pattern
the ((?:red|white) (king|queen))
</pre>
the captured substrings are "white queen" and "queen", and are numbered 1 and
-2. The maximum number of capturing subpatterns is 65535, and the maximum depth
-of nesting of all subpatterns, both capturing and non-capturing, is 200.
+2. The maximum number of capturing subpatterns is 65535.
</P>
<P>
As a convenient shorthand, if any option settings are required at the start of
@@ -886,13 +938,19 @@ from left to right, and options are not reset until the end of the subpattern
is reached, an option setting in one branch does affect subsequent branches, so
the above patterns match "SUNDAY" as well as "Saturday".
</P>
-<br><a name="SEC11" href="#TOC1">NAMED SUBPATTERNS</a><br>
+<br><a name="SEC12" href="#TOC1">NAMED SUBPATTERNS</a><br>
<P>
Identifying capturing parentheses by number is simple, but it can be very hard
to keep track of the numbers in complicated regular expressions. Furthermore,
if an expression is modified, the numbers may change. To help with this
-difficulty, PCRE supports the naming of subpatterns, something that Perl does
-not provide. The Python syntax (?P&#60;name&#62;...) is used. References to capturing
+difficulty, PCRE supports the naming of subpatterns. This feature was not
+added to Perl until release 5.10. Python had the feature earlier, and PCRE
+introduced it at release 4.0, using the Python syntax. PCRE now supports both
+the Perl and the Python syntax.
+</P>
+<P>
+In PCRE, a subpattern can be named in one of three ways: (?&#60;name&#62;...) or
+(?'name'...) as in Perl, or (?P&#60;name&#62;...) as in Python. References to capturing
parentheses from other parts of the pattern, such as
<a href="#backreferences">backreferences,</a>
<a href="#recursion">recursion,</a>
@@ -902,10 +960,10 @@ can be made by name as well as by number.
</P>
<P>
Names consist of up to 32 alphanumeric characters and underscores. Named
-capturing parentheses are still allocated numbers as well as names. The PCRE
-API provides function calls for extracting the name-to-number translation table
-from a compiled pattern. There is also a convenience function for extracting a
-captured substring by name.
+capturing parentheses are still allocated numbers as well as names, exactly as
+if the names were not present. The PCRE API provides function calls for
+extracting the name-to-number translation table from a compiled pattern. There
+is also a convenience function for extracting a captured substring by name.
</P>
<P>
By default, a name must be unique within a pattern, but it is possible to relax
@@ -915,15 +973,15 @@ match. Suppose you want to match the name of a weekday, either as a 3-letter
abbreviation or as the full name, and in both cases you want to extract the
abbreviation. This pattern (ignoring the line breaks) does the job:
<pre>
- (?P&#60;DN&#62;Mon|Fri|Sun)(?:day)?|
- (?P&#60;DN&#62;Tue)(?:sday)?|
- (?P&#60;DN&#62;Wed)(?:nesday)?|
- (?P&#60;DN&#62;Thu)(?:rsday)?|
- (?P&#60;DN&#62;Sat)(?:urday)?
+ (?&#60;DN&#62;Mon|Fri|Sun)(?:day)?|
+ (?&#60;DN&#62;Tue)(?:sday)?|
+ (?&#60;DN&#62;Wed)(?:nesday)?|
+ (?&#60;DN&#62;Thu)(?:rsday)?|
+ (?&#60;DN&#62;Sat)(?:urday)?
</pre>
There are five capturing substrings, but only one is ever set after a match.
The convenience function for extracting the data by name returns the substring
-for the first, and in this example, the only, subpattern of that name that
+for the first (and in this example, the only) subpattern of that name that
matched. This saves searching to find which numbered subpattern it was. If you
make a reference to a non-unique named subpattern from elsewhere in the
pattern, the one that corresponds to the lowest number is used. For further
@@ -931,15 +989,16 @@ details of the interfaces for handling named subpatterns, see the
<a href="pcreapi.html"><b>pcreapi</b></a>
documentation.
</P>
-<br><a name="SEC12" href="#TOC1">REPETITION</a><br>
+<br><a name="SEC13" href="#TOC1">REPETITION</a><br>
<P>
Repetition is specified by quantifiers, which can follow any of the following
items:
<pre>
a literal data character
- the . metacharacter
+ the dot metacharacter
the \C escape sequence
the \X escape sequence (in UTF-8 mode with Unicode properties)
+ the \R escape sequence
an escape such as \d that matches a single character
a character class
a back reference (see next section)
@@ -980,8 +1039,8 @@ The quantifier {0} is permitted, causing the expression to behave as if the
previous item and the quantifier were not present.
</P>
<P>
-For convenience (and historical compatibility) the three most common
-quantifiers have single-character abbreviations:
+For convenience, the three most common quantifiers have single-character
+abbreviations:
<pre>
* is equivalent to {0,}
+ is equivalent to {1,}
@@ -1032,7 +1091,7 @@ which matches one digit by preference, but can match two if that is the only
way the rest of the pattern matches.
</P>
<P>
-If the PCRE_UNGREEDY option is set (an option which is not available in Perl),
+If the PCRE_UNGREEDY option is set (an option that is not available in Perl),
the quantifiers are not greedy by default, but individual ones can be made
greedy by following them with a question mark. In other words, it inverts the
default behaviour.
@@ -1044,7 +1103,7 @@ compiled pattern, in proportion to the size of the minimum or maximum.
</P>
<P>
If a pattern starts with .* or .{0,} and the PCRE_DOTALL option (equivalent
-to Perl's /s) is set, thus allowing the . to match newlines, the pattern is
+to Perl's /s) is set, thus allowing the dot to match newlines, the pattern is
implicitly anchored, because whatever follows will be tried against every
character position in the subject string, so there is no point in retrying the
overall match at any position after the first. PCRE normally treats such a
@@ -1058,8 +1117,8 @@ alternatively using ^ to indicate anchoring explicitly.
<P>
However, there is one situation where the optimization cannot be used. When .*
is inside capturing parentheses that are the subject of a backreference
-elsewhere in the pattern, a match at the start may fail, and a later one
-succeed. Consider, for example:
+elsewhere in the pattern, a match at the start may fail where a later one
+succeeds. Consider, for example:
<pre>
(.*)abc\1
</pre>
@@ -1081,14 +1140,14 @@ example, after
</pre>
matches "aba" the value of the second captured substring is "b".
<a name="atomicgroup"></a></P>
-<br><a name="SEC13" href="#TOC1">ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS</a><br>
+<br><a name="SEC14" href="#TOC1">ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS</a><br>
<P>
-With both maximizing and minimizing repetition, failure of what follows
-normally causes the repeated item to be re-evaluated to see if a different
-number of repeats allows the rest of the pattern to match. Sometimes it is
-useful to prevent this, either to change the nature of the match, or to cause
-it fail earlier than it otherwise might, when the author of the pattern knows
-there is no point in carrying on.
+With both maximizing ("greedy") and minimizing ("ungreedy" or "lazy")
+repetition, failure of what follows normally causes the repeated item to be
+re-evaluated to see if a different number of repeats allows the rest of the
+pattern to match. Sometimes it is useful to prevent this, either to change the
+nature of the match, or to cause it fail earlier than it otherwise might, when
+the author of the pattern knows there is no point in carrying on.
</P>
<P>
Consider, for example, the pattern \d+foo when applied to the subject line
@@ -1102,7 +1161,7 @@ item, and then with 4, and so on, before ultimately failing. "Atomic grouping"
that once a subpattern has matched, it is not to be re-evaluated in this way.
</P>
<P>
-If we use atomic grouping for the previous example, the matcher would give up
+If we use atomic grouping for the previous example, the matcher gives up
immediately on failing to match "foo" the first time. The notation is a kind of
special parenthesis, starting with (?&#62; as in this example:
<pre>
@@ -1137,14 +1196,21 @@ previous example can be rewritten as
</pre>
Possessive quantifiers are always greedy; the setting of the PCRE_UNGREEDY
option is ignored. They are a convenient notation for the simpler forms of
-atomic group. However, there is no difference in the meaning or processing of a
-possessive quantifier and the equivalent atomic group.
+atomic group. However, there is no difference in the meaning of a possessive
+quantifier and the equivalent atomic group, though there may be a performance
+difference; possessive quantifiers should be slightly faster.
+</P>
+<P>
+The possessive quantifier syntax is an extension to the Perl 5.8 syntax.
+Jeffrey Friedl originated the idea (and the name) in the first edition of his
+book. Mike McCloskey liked it, so implemented it when he built Sun's Java
+package, and PCRE copied it from there. It ultimately found its way into Perl
+at release 5.10.
</P>
<P>
-The possessive quantifier syntax is an extension to the Perl syntax. Jeffrey
-Friedl originated the idea (and the name) in the first edition of his book.
-Mike McCloskey liked it, so implemented it when he built Sun's Java package,
-and PCRE copied it from there.
+PCRE has an optimization that automatically "possessifies" certain simple
+pattern constructs. For example, the sequence A+B is treated as A++B because
+there is no point in backtracking into a sequence of A's when B must follow.
</P>
<P>
When a pattern contains an unlimited repeat inside a subpattern that can itself
@@ -1173,7 +1239,7 @@ an atomic group, like this:
</pre>
sequences of non-digits cannot be broken, and failure happens quickly.
<a name="backreferences"></a></P>
-<br><a name="SEC14" href="#TOC1">BACK REFERENCES</a><br>
+<br><a name="SEC15" href="#TOC1">BACK REFERENCES</a><br>
<P>
Outside a character class, a backslash followed by a digit greater than 0 (and
possibly further digits) is a back reference to a capturing subpattern earlier
@@ -1190,12 +1256,36 @@ when a repetition is involved and the subpattern to the right has participated
in an earlier iteration.
</P>
<P>
-It is not possible to have a numerical "forward back reference" to subpattern
-whose number is 10 or more. However, a back reference to any subpattern is
-possible using named parentheses (see below). See also the subsection entitled
+It is not possible to have a numerical "forward back reference" to a subpattern
+whose number is 10 or more using this syntax because a sequence such as \50 is
+interpreted as a character defined in octal. See the subsection entitled
"Non-printing characters"
<a href="#digitsafterbackslash">above</a>
-for further details of the handling of digits following a backslash.
+for further details of the handling of digits following a backslash. There is
+no such problem when named parentheses are used. A back reference to any
+subpattern is possible using named parentheses (see below).
+</P>
+<P>
+Another way of avoiding the ambiguity inherent in the use of digits following a
+backslash is to use the \g escape sequence, which is a feature introduced in
+Perl 5.10. This escape must be followed by a positive or a negative number,
+optionally enclosed in braces. These examples are all identical:
+<pre>
+ (ring), \1
+ (ring), \g1
+ (ring), \g{1}
+</pre>
+A positive number specifies an absolute reference without the ambiguity that is
+present in the older syntax. It is also useful when literal digits follow the
+reference. A negative number is a relative reference. Consider this example:
+<pre>
+ (abc(def)ghi)\g{-1}
+</pre>
+The sequence \g{-1} is a reference to the most recently started capturing
+subpattern before \g, that is, is it equivalent to \2. Similarly, \g{-2}
+would be equivalent to \1. The use of relative references can be helpful in
+long patterns, and also in patterns that are created by joining together
+fragments that contain references within themselves.
</P>
<P>
A back reference matches whatever actually matched the capturing subpattern in
@@ -1216,9 +1306,11 @@ matches "rah rah" and "RAH RAH", but not "RAH rah", even though the original
capturing subpattern is matched caselessly.
</P>
<P>
-Back references to named subpatterns use the Python syntax (?P=name). We could
-rewrite the above example as follows:
+Back references to named subpatterns use the Perl syntax \k&#60;name&#62; or \k'name'
+or the Python syntax (?P=name). We could rewrite the above example in either of
+the following ways:
<pre>
+ (?&#60;p1&#62;(?i)rah)\s+\k&#60;p1&#62;
(?P&#60;p1&#62;(?i)rah)\s+(?P=p1)
</pre>
A subpattern that is referenced by name may appear in the pattern before or
@@ -1255,7 +1347,7 @@ that the first iteration does not need to match the back reference. This can be
done using alternation, as in the example above, or by a quantifier with a
minimum of zero.
<a name="bigassertions"></a></P>
-<br><a name="SEC15" href="#TOC1">ASSERTIONS</a><br>
+<br><a name="SEC16" href="#TOC1">ASSERTIONS</a><br>
<P>
An assertion is a test on the characters following or preceding the current
matching point that does not actually consume any characters. The simple
@@ -1338,20 +1430,20 @@ lengths, but it is acceptable if rewritten to use two top-level branches:
(?&#60;=abc|abde)
</pre>
The implementation of lookbehind assertions is, for each alternative, to
-temporarily move the current position back by the fixed width and then try to
+temporarily move the current position back by the fixed length and then try to
match. If there are insufficient characters before the current position, the
-match is deemed to fail.
+assertion fails.
</P>
<P>
PCRE does not allow the \C escape (which matches a single byte in UTF-8 mode)
to appear in lookbehind assertions, because it makes it impossible to calculate
-the length of the lookbehind. The \X escape, which can match different numbers
-of bytes, is also not permitted.
+the length of the lookbehind. The \X and \R escapes, which can match
+different numbers of bytes, are also not permitted.
</P>
<P>
-Atomic groups can be used in conjunction with lookbehind assertions to specify
-efficient matching at the end of the subject string. Consider a simple pattern
-such as
+Possessive quantifiers can be used in conjunction with lookbehind assertions to
+specify efficient matching at the end of the subject string. Consider a simple
+pattern such as
<pre>
abcd$
</pre>
@@ -1367,13 +1459,9 @@ then all but the last two characters, and so on. Once again the search for "a"
covers the entire string, from right to left, so we are no better off. However,
if the pattern is written as
<pre>
- ^(?&#62;.*)(?&#60;=abcd)
-</pre>
-or, equivalently, using the possessive quantifier syntax,
-<pre>
^.*+(?&#60;=abcd)
</pre>
-there can be no backtracking for the .* item; it can match only the entire
+there can be no backtracking for the .*+ item; it can match only the entire
string. The subsequent lookbehind assertion does a single test on the last four
characters. If it fails, the match fails immediately. For long strings, this
approach makes a significant difference to the processing time.
@@ -1413,7 +1501,7 @@ preceded by "foo", while
is another pattern that matches "foo" preceded by three digits and any three
characters that are not "999".
<a name="conditions"></a></P>
-<br><a name="SEC16" href="#TOC1">CONDITIONAL SUBPATTERNS</a><br>
+<br><a name="SEC17" href="#TOC1">CONDITIONAL SUBPATTERNS</a><br>
<P>
It is possible to cause the matching process to obey a subpattern
conditionally or to choose between two alternative subpatterns, depending on
@@ -1428,15 +1516,16 @@ no-pattern (if present) is used. If there are more than two alternatives in the
subpattern, a compile-time error occurs.
</P>
<P>
-There are three kinds of condition. If the text between the parentheses
-consists of a sequence of digits, or a sequence of alphanumeric characters and
-underscores, the condition is satisfied if the capturing subpattern of that
-number or name has previously matched. There is a possible ambiguity here,
-because subpattern names may consist entirely of digits. PCRE looks first for a
-named subpattern; if it cannot find one and the text consists entirely of
-digits, it looks for a subpattern of that number, which must be greater than
-zero. Using subpattern names that consist entirely of digits is not
-recommended.
+There are four kinds of condition: references to subpatterns, references to
+recursion, a pseudo-condition called DEFINE, and assertions.
+</P>
+<br><b>
+Checking for a used subpattern by number
+</b><br>
+<P>
+If the text between the parentheses consists of a sequence of digits, the
+condition is true if the capturing subpattern of that number has previously
+matched.
</P>
<P>
Consider the following pattern, which contains non-significant white space to
@@ -1453,18 +1542,77 @@ or not. If they did, that is, if subject started with an opening parenthesis,
the condition is true, and so the yes-pattern is executed and a closing
parenthesis is required. Otherwise, since no-pattern is not present, the
subpattern matches nothing. In other words, this pattern matches a sequence of
-non-parentheses, optionally enclosed in parentheses. Rewriting it to use a
-named subpattern gives this:
+non-parentheses, optionally enclosed in parentheses.
+</P>
+<br><b>
+Checking for a used subpattern by name
+</b><br>
+<P>
+Perl uses the syntax (?(&#60;name&#62;)...) or (?('name')...) to test for a used
+subpattern by name. For compatibility with earlier versions of PCRE, which had
+this facility before Perl, the syntax (?(name)...) is also recognized. However,
+there is a possible ambiguity with this syntax, because subpattern names may
+consist entirely of digits. PCRE looks first for a named subpattern; if it
+cannot find one and the name consists entirely of digits, PCRE looks for a
+subpattern of that number, which must be greater than zero. Using subpattern
+names that consist entirely of digits is not recommended.
+</P>
+<P>
+Rewriting the above example to use a named subpattern gives this:
<pre>
- (?P&#60;OPEN&#62; \( )? [^()]+ (?(OPEN) \) )
-</pre>
+ (?&#60;OPEN&#62; \( )? [^()]+ (?(&#60;OPEN&#62;) \) )
+
+</PRE>
+</P>
+<br><b>
+Checking for pattern recursion
+</b><br>
+<P>
If the condition is the string (R), and there is no subpattern with the name R,
-the condition is satisfied if a recursive call to the pattern or subpattern has
-been made. At "top level", the condition is false. This is a PCRE extension.
-Recursive patterns are described in the next section.
+the condition is true if a recursive call to the whole pattern or any
+subpattern has been made. If digits or a name preceded by ampersand follow the
+letter R, for example:
+<pre>
+ (?(R3)...) or (?(R&name)...)
+</pre>
+the condition is true if the most recent recursion is into the subpattern whose
+number or name is given. This condition does not check the entire recursion
+stack.
+</P>
+<P>
+At "top level", all these recursion test conditions are false. Recursive
+patterns are described below.
+</P>
+<br><b>
+Defining subpatterns for use by reference only
+</b><br>
+<P>
+If the condition is the string (DEFINE), and there is no subpattern with the
+name DEFINE, the condition is always false. In this case, there may be only one
+alternative in the subpattern. It is always skipped if control reaches this
+point in the pattern; the idea of DEFINE is that it can be used to define
+"subroutines" that can be referenced from elsewhere. (The use of "subroutines"
+is described below.) For example, a pattern to match an IPv4 address could be
+written like this (ignore whitespace and line breaks):
+<pre>
+ (?(DEFINE) (?&#60;byte&#62; 2[0-4]\d | 25[0-5] | 1\d\d | [1-9]?\d) )
+ \b (?&byte) (\.(?&byte)){3} \b
+</pre>
+The first part of the pattern is a DEFINE group inside which a another group
+named "byte" is defined. This matches an individual component of an IPv4
+address (a number less than 256). When matching takes place, this part of the
+pattern is skipped because DEFINE acts like a false condition.
</P>
<P>
-If the condition is not a sequence of digits or (R), it must be an assertion.
+The rest of the pattern uses references to the named group to match the four
+dot-separated components of an IPv4 address, insisting on a word boundary at
+each end.
+</P>
+<br><b>
+Assertion conditions
+</b><br>
+<P>
+If the condition is not in any of the above formats, it must be an assertion.
This may be a positive or negative lookahead or lookbehind assertion. Consider
this pattern, again containing non-significant white space, and with the two
alternatives on the second line:
@@ -1479,7 +1627,7 @@ subject is matched against the first alternative; otherwise it is matched
against the second. This pattern matches strings in one of the two forms
dd-aaa-dd or dd-dd-dd, where aaa are letters and dd are digits.
<a name="comments"></a></P>
-<br><a name="SEC17" href="#TOC1">COMMENTS</a><br>
+<br><a name="SEC18" href="#TOC1">COMMENTS</a><br>
<P>
The sequence (?# marks the start of a comment that continues up to the next
closing parenthesis. Nested parentheses are not permitted. The characters
@@ -1490,35 +1638,43 @@ If the PCRE_EXTENDED option is set, an unescaped # character outside a
character class introduces a comment that continues to immediately after the
next newline in the pattern.
<a name="recursion"></a></P>
-<br><a name="SEC18" href="#TOC1">RECURSIVE PATTERNS</a><br>
+<br><a name="SEC19" href="#TOC1">RECURSIVE PATTERNS</a><br>
<P>
Consider the problem of matching a string in parentheses, allowing for
unlimited nested parentheses. Without the use of recursion, the best that can
be done is to use a pattern that matches up to some fixed depth of nesting. It
-is not possible to handle an arbitrary nesting depth. Perl provides a facility
-that allows regular expressions to recurse (amongst other things). It does this
-by interpolating Perl code in the expression at run time, and the code can
-refer to the expression itself. A Perl pattern to solve the parentheses problem
-can be created like this:
+is not possible to handle an arbitrary nesting depth.
+</P>
+<P>
+For some time, Perl has provided a facility that allows regular expressions to
+recurse (amongst other things). It does this by interpolating Perl code in the
+expression at run time, and the code can refer to the expression itself. A Perl
+pattern using code interpolation to solve the parentheses problem can be
+created like this:
<pre>
$re = qr{\( (?: (?&#62;[^()]+) | (?p{$re}) )* \)}x;
</pre>
The (?p{...}) item interpolates Perl code at run time, and in this case refers
-recursively to the pattern in which it appears. Obviously, PCRE cannot support
-the interpolation of Perl code. Instead, it supports some special syntax for
-recursion of the entire pattern, and also for individual subpattern recursion.
+recursively to the pattern in which it appears.
</P>
<P>
-The special item that consists of (? followed by a number greater than zero and
-a closing parenthesis is a recursive call of the subpattern of the given
-number, provided that it occurs inside that subpattern. (If not, it is a
-"subroutine" call, which is described in the next section.) The special item
-(?R) is a recursive call of the entire regular expression.
+Obviously, PCRE cannot support the interpolation of Perl code. Instead, it
+supports special syntax for recursion of the entire pattern, and also for
+individual subpattern recursion. After its introduction in PCRE and Python,
+this kind of recursion was introduced into Perl at release 5.10.
</P>
<P>
-A recursive subpattern call is always treated as an atomic group. That is, once
-it has matched some of the subject string, it is never re-entered, even if
-it contains untried alternatives and there is a subsequent matching failure.
+A special item that consists of (? followed by a number greater than zero and a
+closing parenthesis is a recursive call of the subpattern of the given number,
+provided that it occurs inside that subpattern. (If not, it is a "subroutine"
+call, which is described in the next section.) The special item (?R) or (?0) is
+a recursive call of the entire regular expression.
+</P>
+<P>
+In PCRE (like Python, but unlike Perl), a recursive subpattern call is always
+treated as an atomic group. That is, once it has matched some of the subject
+string, it is never re-entered, even if it contains untried alternatives and
+there is a subsequent matching failure.
</P>
<P>
This PCRE pattern solves the nested parentheses problem (assume the
@@ -1540,14 +1696,15 @@ pattern, so instead you could use this:
We have put the pattern into parentheses, and caused the recursion to refer to
them instead of the whole pattern. In a larger pattern, keeping track of
parenthesis numbers can be tricky. It may be more convenient to use named
-parentheses instead. For this, PCRE uses (?P&#62;name), which is an extension to
-the Python syntax that PCRE uses for named parentheses (Perl does not provide
-named parentheses). We could rewrite the above example as follows:
+parentheses instead. The Perl syntax for this is (?&name); PCRE's earlier
+syntax (?P&#62;name) is also supported. We could rewrite the above example as
+follows:
<pre>
- (?P&#60;pn&#62; \( ( (?&#62;[^()]+) | (?P&#62;pn) )* \) )
+ (?&#60;pn&#62; \( ( (?&#62;[^()]+) | (?&pn) )* \) )
</pre>
-This particular example pattern contains nested unlimited repeats, and so the
-use of atomic grouping for matching strings of non-parentheses is important
+If there is more than one subpattern with the same name, the earliest one is
+used. This particular example pattern contains nested unlimited repeats, and so
+the use of atomic grouping for matching strings of non-parentheses is important
when applying the pattern to strings that do not match. For example, when this
pattern is applied to
<pre>
@@ -1562,7 +1719,7 @@ before failure can be reported.
At the end of a match, the values set for any capturing subpatterns are those
from the outermost level of the recursion at which the subpattern value is set.
If you want to obtain intermediate values, a callout function can be used (see
-the next section and the
+below and the
<a href="pcrecallout.html"><b>pcrecallout</b></a>
documentation). If the pattern above is matched against
<pre>
@@ -1593,12 +1750,12 @@ In this pattern, (?(R) is the start of a conditional subpattern, with two
different alternatives for the recursive and non-recursive cases. The (?R) item
is the actual recursive call.
<a name="subpatternsassubroutines"></a></P>
-<br><a name="SEC19" href="#TOC1">SUBPATTERNS AS SUBROUTINES</a><br>
+<br><a name="SEC20" href="#TOC1">SUBPATTERNS AS SUBROUTINES</a><br>
<P>
If the syntax for a recursive subpattern reference (either by number or by
name) is used outside the parentheses to which it refers, it operates like a
-subroutine in a programming language. An earlier example pointed out that the
-pattern
+subroutine in a programming language. The "called" subpattern may be defined
+before or after the reference. An earlier example pointed out that the pattern
<pre>
(sens|respons)e and \1ibility
</pre>
@@ -1608,8 +1765,7 @@ matches "sense and sensibility" and "response and responsibility", but not
(sens|respons)e and (?1)ibility
</pre>
is used, it does match "sense and responsibility" as well as the other two
-strings. Such references, if given numerically, must follow the subpattern to
-which they refer. However, named references can refer to later subpatterns.
+strings. Another example is given in the discussion of DEFINE above.
</P>
<P>
Like recursive subpatterns, a "subroutine" call is always treated as an atomic
@@ -1617,7 +1773,17 @@ group. That is, once it has matched some of the subject string, it is never
re-entered, even if it contains untried alternatives and there is a subsequent
matching failure.
</P>
-<br><a name="SEC20" href="#TOC1">CALLOUTS</a><br>
+<P>
+When a subpattern is used as a subroutine, processing options such as
+case-independence are fixed when the subpattern is defined. They cannot be
+changed for different calls. For example, consider this pattern:
+<pre>
+ (abc)(?i:(?1))
+</pre>
+It matches "abcabc". It does not match "abcABC" because the change of
+processing option does not affect the called subpattern.
+</P>
+<br><a name="SEC21" href="#TOC1">CALLOUTS</a><br>
<P>
Perl has a feature whereby using the sequence (?{...}) causes arbitrary Perl
code to be obeyed in the middle of matching a regular expression. This makes it
@@ -1652,8 +1818,12 @@ description of the interface to the callout function is given in the
<a href="pcrecallout.html"><b>pcrecallout</b></a>
documentation.
</P>
+<br><a name="SEC22" href="#TOC1">SEE ALSO</a><br>
+<P>
+<b>pcreapi</b>(3), <b>pcrecallout</b>(3), <b>pcrematching</b>(3), <b>pcre</b>(3).
+</P>
<P>
-Last updated: 06 June 2006
+Last updated: 06 December 2006
<br>
Copyright &copy; 1997-2006 University of Cambridge.
<p>
diff --git a/doc/html/pcreperform.html b/doc/html/pcreperform.html
index e97e748..628288e 100644
--- a/doc/html/pcreperform.html
+++ b/doc/html/pcreperform.html
@@ -16,13 +16,73 @@ man page, in case the conversion went wrong.
PCRE PERFORMANCE
</b><br>
<P>
-Certain items that may appear in regular expression patterns are more efficient
+Two aspects of performance are discussed below: memory usage and processing
+time. The way you express your pattern as a regular expression can affect both
+of them.
+</P>
+<br><b>
+MEMORY USAGE
+</b><br>
+<P>
+Patterns are compiled by PCRE into a reasonably efficient byte code, so that
+most simple patterns do not use much memory. However, there is one case where
+memory usage can be unexpectedly large. When a parenthesized subpattern has a
+quantifier with a minimum greater than 1 and/or a limited maximum, the whole
+subpattern is repeated in the compiled code. For example, the pattern
+<pre>
+ (abc|def){2,4}
+</pre>
+is compiled as if it were
+<pre>
+ (abc|def)(abc|def)((abc|def)(abc|def)?)?
+</pre>
+(Technical aside: It is done this way so that backtrack points within each of
+the repetitions can be independently maintained.)
+</P>
+<P>
+For regular expressions whose quantifiers use only small numbers, this is not
+usually a problem. However, if the numbers are large, and particularly if such
+repetitions are nested, the memory usage can become an embarrassment. For
+example, the very simple pattern
+<pre>
+ ((ab){1,1000}c){1,3}
+</pre>
+uses 51K bytes when compiled. When PCRE is compiled with its default internal
+pointer size of two bytes, the size limit on a compiled pattern is 64K, and
+this is reached with the above pattern if the outer repetition is increased
+from 3 to 4. PCRE can be compiled to use larger internal pointers and thus
+handle larger compiled patterns, but it is better to try to rewrite your
+pattern to use less memory if you can.
+</P>
+<P>
+One way of reducing the memory usage for such patterns is to make use of PCRE's
+<a href="pcrepattern.html#subpatternsassubroutines">"subroutine"</a>
+facility. Re-writing the above pattern as
+<pre>
+ ((ab)(?2){0,999}c)(?1){0,2}
+</pre>
+reduces the memory requirements to 18K, and indeed it remains under 20K even
+with the outer repetition increased to 100. However, this pattern is not
+exactly equivalent, because the "subroutine" calls are treated as
+<a href="pcrepattern.html#atomicgroup">atomic groups</a>
+into which there can be no backtracking if there is a subsequent matching
+failure. Therefore, PCRE cannot do this kind of rewriting automatically.
+Furthermore, there is a noticeable loss of speed when executing the modified
+pattern. Nevertheless, if the atomic grouping is not a problem and the loss of
+speed is acceptable, this kind of rewriting will allow you to process patterns
+that PCRE cannot otherwise handle.
+</P>
+<br><b>
+PROCESSING TIME
+</b><br>
+<P>
+Certain items in regular expression patterns are processed more efficiently
than others. It is more efficient to use a character class like [aeiou] than a
-set of alternatives such as (a|e|i|o|u). In general, the simplest construction
-that provides the required behaviour is usually the most efficient. Jeffrey
-Friedl's book contains a lot of useful general discussion about optimizing
-regular expressions for efficient performance. This document contains a few
-observations about PCRE.
+set of single-character alternatives such as (a|e|i|o|u). In general, the
+simplest construction that provides the required behaviour is usually the most
+efficient. Jeffrey Friedl's book contains a lot of useful general discussion
+about optimizing regular expressions for efficient performance. This document
+contains a few observations about PCRE.
</P>
<P>
Using Unicode character properties (the \p, \P, and \X escapes) is slow,
@@ -58,14 +118,15 @@ Beware of patterns that contain nested indefinite repeats. These can take a
long time to run when applied to a string that does not match. Consider the
pattern fragment
<pre>
- (a+)*
+ ^(a+)*
</pre>
-This can match "aaaa" in 33 different ways, and this number increases very
+This can match "aaaa" in 16 different ways, and this number increases very
rapidly as the string gets longer. (The * repeat can match 0, 1, 2, 3, or 4
-times, and for each of those cases other than 0, the + repeats can match
+times, and for each of those cases other than 0 or 4, the + repeats can match
different numbers of times.) When the remainder of the pattern is such that the
entire match is going to fail, PCRE has in principle to try every possible
-variation, and this can take an extremely long time.
+variation, and this can take an extremely long time, even for relatively short
+strings.
</P>
<P>
An optimization catches some of the more simple cases such as
@@ -89,9 +150,9 @@ In many cases, the solution to this kind of performance issue is to use an
atomic group or a possessive quantifier.
</P>
<P>
-Last updated: 28 February 2005
+Last updated: 20 September 2006
<br>
-Copyright &copy; 1997-2005 University of Cambridge.
+Copyright &copy; 1997-2006 University of Cambridge.
<p>
Return to the <a href="index.html">PCRE index page</a>.
</p>
diff --git a/doc/html/pcreposix.html b/doc/html/pcreposix.html
index 9bf36ca..75a40ca 100644
--- a/doc/html/pcreposix.html
+++ b/doc/html/pcreposix.html
@@ -233,7 +233,7 @@ Philip Hazel
<br>
University Computing Service,
<br>
-Cambridge CB2 3QG, England.
+Cambridge CB2 3QH, England.
</P>
<P>
Last updated: 16 January 2006
diff --git a/doc/html/pcreprecompile.html b/doc/html/pcreprecompile.html
index 00de3b0..fbb54a5 100644
--- a/doc/html/pcreprecompile.html
+++ b/doc/html/pcreprecompile.html
@@ -123,16 +123,19 @@ usual way.
The layout of the control block that is at the start of the data that makes up
a compiled pattern was changed for release 5.0. If you have any saved patterns
that were compiled with previous releases (not a facility that was previously
-advertised), you will have to recompile them for release 5.0. However, from now
-on, it should be possible to make changes in a compatible manner.
+advertised), you will have to recompile them for release 5.0 and above.
</P>
<P>
-Notwithstanding the above, if you have any saved patterns in UTF-8 mode that
-use \p or \P that were compiled with any release up to and including 6.4, you
-will have to recompile them for release 6.5 and above.
+If you have any saved patterns in UTF-8 mode that use \p or \P that were
+compiled with any release up to and including 6.4, you will have to recompile
+them for release 6.5 and above.
</P>
<P>
-Last updated: 01 February 2006
+All saved patterns from earlier releases must be recompiled for release 7.0 or
+higher, because there was an internal reorganization at that release.
+</P>
+<P>
+Last updated: 28 November 2006
<br>
Copyright &copy; 1997-2006 University of Cambridge.
<p>
diff --git a/doc/html/pcrestack.html b/doc/html/pcrestack.html
index edca78e..e3b5cb6 100644
--- a/doc/html/pcrestack.html
+++ b/doc/html/pcrestack.html
@@ -73,6 +73,11 @@ backtracking into the runs of non-"&#60;" characters, but that is not related to
stack usage.
</P>
<P>
+This example shows that one way of avoiding stack problems when matching long
+subject strings is to write repeated parenthesized subpatterns to match more
+than one character whenever possible.
+</P>
+<P>
In environments where stack memory is constrained, you might want to compile
PCRE to use heap memory instead of stack for remembering back-up points. This
makes it run a lot more slowly, however. Details of how to do this are given in
@@ -81,15 +86,16 @@ the
documentation.
</P>
<P>
-In Unix-like environments, there is not often a problem with the stack, though
-the default limit on stack size varies from system to system. Values from 8Mb
-to 64Mb are common. You can find your default limit by running the command:
+In Unix-like environments, there is not often a problem with the stack unless
+very long strings are involved, though the default limit on stack size varies
+from system to system. Values from 8Mb to 64Mb are common. You can find your
+default limit by running the command:
<pre>
ulimit -s
</pre>
-The effect of running out of stack is often SIGSEGV, though sometimes an error
-message is given. You can normally increase the limit on stack size by code
-such as this:
+Unfortunately, the effect of running out of stack is often SIGSEGV, though
+sometimes a more explicit error message is given. You can normally increase the
+limit on stack size by code such as this:
<pre>
struct rlimit rlim;
getrlimit(RLIMIT_STACK, &rlim);
@@ -116,10 +122,10 @@ As a very rough rule of thumb, you should reckon on about 500 bytes per
recursion. Thus, if you want to limit your stack usage to 8Mb, you
should set the limit at 16000 recursions. A 64Mb stack, on the other hand, can
support around 128000 recursions. The <b>pcretest</b> test program has a command
-line option (<b>-S</b>) that can be used to increase its stack.
+line option (<b>-S</b>) that can be used to increase the size of its stack.
</P>
<P>
-Last updated: 29 June 2006
+Last updated: 14 September 2006
<br>
Copyright &copy; 1997-2006 University of Cambridge.
<p>
diff --git a/doc/html/pcretest.html b/doc/html/pcretest.html
index 8ffd577..f2add66 100644
--- a/doc/html/pcretest.html
+++ b/doc/html/pcretest.html
@@ -23,8 +23,10 @@ man page, in case the conversion went wrong.
<li><a name="TOC8" href="#SEC8">OUTPUT FROM THE ALTERNATIVE MATCHING FUNCTION</a>
<li><a name="TOC9" href="#SEC9">RESTARTING AFTER A PARTIAL MATCH</a>
<li><a name="TOC10" href="#SEC10">CALLOUTS</a>
-<li><a name="TOC11" href="#SEC11">SAVING AND RELOADING COMPILED PATTERNS</a>
-<li><a name="TOC12" href="#SEC12">AUTHOR</a>
+<li><a name="TOC11" href="#SEC11">NON-PRINTING CHARACTERS</a>
+<li><a name="TOC12" href="#SEC12">SAVING AND RELOADING COMPILED PATTERNS</a>
+<li><a name="TOC13" href="#SEC13">SEE ALSO</a>
+<li><a name="TOC14" href="#SEC14">AUTHOR</a>
</ul>
<br><a name="SEC1" href="#TOC1">SYNOPSIS</a><br>
<P>
@@ -43,6 +45,11 @@ documentation.
</P>
<br><a name="SEC2" href="#TOC1">OPTIONS</a><br>
<P>
+<b>-b</b>
+Behave as if each regex has the <b>/B</b> (show bytecode) modifier; the internal
+form is output after compilation.
+</P>
+<P>
<b>-C</b>
Output the version number of the PCRE library, and all available information
about the optional features that are included, and then exit.
@@ -50,7 +57,8 @@ about the optional features that are included, and then exit.
<P>
<b>-d</b>
Behave as if each regex has the <b>/D</b> (debug) modifier; the internal
-form is output after compilation.
+form and information about the compiled pattern is output after compilation;
+<b>-d</b> is equivalent to <b>-b -i</b>.
</P>
<P>
<b>-dfa</b>
@@ -59,6 +67,10 @@ alternative matching function, <b>pcre_dfa_exec()</b>, to be used instead of the
standard <b>pcre_exec()</b> function (more detail is given below).
</P>
<P>
+<b>-help</b>
+Output a brief summary these options and then exit.
+</P>
+<P>
<b>-i</b>
Behave as if each regex has the <b>/I</b> modifier; information about the
compiled pattern is given after compilation.
@@ -72,9 +84,11 @@ with earlier versions of pcretest, <b>-s</b> is a synonym for <b>-m</b>.
<P>
<b>-o</b> <i>osize</i>
Set the number of elements in the output vector that is used when calling
-<b>pcre_exec()</b> to be <i>osize</i>. The default value is 45, which is enough
-for 14 capturing subexpressions. The vector size can be changed for individual
-matching calls by including \O in the data line (see below).
+<b>pcre_exec()</b> or <b>pcre_dfa_exec()</b> to be <i>osize</i>. The default value
+is 45, which is enough for 14 capturing subexpressions for <b>pcre_exec()</b> or
+22 different matches for <b>pcre_dfa_exec()</b>. The vector size can be
+changed for individual matching calls by including \O in the data line (see
+below).
</P>
<P>
<b>-p</b>
@@ -96,7 +110,15 @@ megabytes.
Run each compile, study, and match many times with a timer, and output
resulting time per compile or match (in milliseconds). Do not set <b>-m</b> with
<b>-t</b>, because you will then get the size output a zillion times, and the
-timing will be distorted.
+timing will be distorted. You can control the number of iterations that are
+used for timing by following <b>-t</b> with a number (as a separate item on the
+command line). For example, "-t 1000" would iterate 1000 times. The default is
+to iterate 500000 times.
+</P>
+<P>
+<b>-tm</b>
+This is like <b>-t</b> except that it times only the matching phase, not the
+compile or study phases.
</P>
<br><a name="SEC3" href="#TOC1">DESCRIPTION</a><br>
<P>
@@ -114,8 +136,8 @@ lines to be matched against the pattern.
<P>
Each data line is matched separately and independently. If you want to do
multi-line matches, you have to use the \n escape sequence (or \r or \r\n,
-depending on the newline setting) in a single line of input to encode the
-newline characters. There is no limit on the length of data lines; the input
+etc., depending on the newline setting) in a single line of input to encode the
+newline sequences. There is no limit on the length of data lines; the input
buffer is automatically extended if it is too small.
</P>
<P>
@@ -179,9 +201,14 @@ not correspond to anything in Perl:
<b>/&#60;cr&#62;</b> PCRE_NEWLINE_CR
<b>/&#60;lf&#62;</b> PCRE_NEWLINE_LF
<b>/&#60;crlf&#62;</b> PCRE_NEWLINE_CRLF
+ <b>/&#60;any&#62;</b> PCRE_NEWLINE_ANY
+</pre>
+Those specifying line ending sequencess are literal strings as shown. This
+example sets multiline matching with CRLF as the line ending sequence:
+<pre>
+ /^abc/m&#60;crlf&#62;
</pre>
-Those specifying line endings are literal strings as shown. Details of the
-meanings of these PCRE options are given in the
+Details of the meanings of these PCRE options are given in the
<a href="pcreapi.html"><b>pcreapi</b></a>
documentation.
</P>
@@ -220,6 +247,10 @@ the subject string. This is useful for tests where the subject contains
multiple copies of the same substring.
</P>
<P>
+The <b>/B</b> modifier is a debugging feature. It requests that <b>pcretest</b>
+output a representation of the compiled byte code after compilation.
+</P>
+<P>
The <b>/L</b> modifier must be followed directly by the name of a locale, for
example,
<pre>
@@ -238,10 +269,8 @@ so on). It does this by calling <b>pcre_fullinfo()</b> after compiling a
pattern. If the pattern is studied, the results of that are also output.
</P>
<P>
-The <b>/D</b> modifier is a PCRE debugging feature, which also assumes <b>/I</b>.
-It causes the internal form of compiled regular expressions to be output after
-compilation. If the pattern was studied, the information returned is also
-output.
+The <b>/D</b> modifier is a PCRE debugging feature, and is equivalent to
+<b>/BI</b>, that is, both the \fP/B\fP and the <b>/I</b> modifiers.
</P>
<P>
The <b>/F</b> modifier causes <b>pcretest</b> to flip the byte order of the
@@ -289,15 +318,15 @@ complicated features of PCRE. If you are just testing "ordinary" regular
expressions, you probably don't need any of these. The following escapes are
recognized:
<pre>
- \a alarm (= BEL)
- \b backspace
- \e escape
- \f formfeed
- \n newline
+ \a alarm (BEL, \x07)
+ \b backspace (\x08)
+ \e escape (\x27)
+ \f formfeed (\x0c)
+ \n newline (\x0a)
\qdd set the PCRE_MATCH_LIMIT limit to dd (any number of digits)
- \r carriage return
- \t tab
- \v vertical tab
+ \r carriage return (\x0d)
+ \t tab (\x09)
+ \v vertical tab (\x0b)
\nnn octal character (up to 3 octal digits)
\xhh hexadecimal character (up to 2 hex digits)
\x{hh...} hexadecimal character, any number of digits in UTF-8 mode
@@ -331,11 +360,16 @@ recognized:
\&#60;cr&#62; pass the PCRE_NEWLINE_CR option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
\&#60;lf&#62; pass the PCRE_NEWLINE_LF option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
\&#60;crlf&#62; pass the PCRE_NEWLINE_CRLF option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
+ \&#60;any&#62; pass the PCRE_NEWLINE_ANY option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
</pre>
-The escapes that specify line endings are literal strings, exactly as shown.
-A backslash followed by anything else just escapes the anything else. If the
-very last character is a backslash, it is ignored. This gives a way of passing
-an empty line as data, since a real empty line terminates the data input.
+The escapes that specify line ending sequences are literal strings, exactly as
+shown. No more than one newline setting should be present in any data line.
+</P>
+<P>
+A backslash followed by anything else just escapes the anything else. If
+the very last character is a backslash, it is ignored. This gives a way of
+passing an empty line as data, since a real empty line terminates the data
+input.
</P>
<P>
If \M is present, <b>pcretest</b> calls <b>pcre_exec()</b> several times, with
@@ -398,7 +432,7 @@ respectively, and otherwise the PCRE negative error number. Here is an example
of an interactive <b>pcretest</b> run.
<pre>
$ pcretest
- PCRE version 5.00 07-Sep-2004
+ PCRE version 7.0 30-Nov-2006
re&#62; /^abc(\d+)/
data&#62; abc123
@@ -409,9 +443,9 @@ of an interactive <b>pcretest</b> run.
</pre>
If the strings contain any non-printing characters, they are output as \0x
escapes, or as \x{...} escapes if the <b>/8</b> modifier was present on the
-pattern. If the pattern has the <b>/+</b> modifier, the output for substring 0
-is followed by the the rest of the subject string, identified by "0+" like
-this:
+pattern. See below for the definition of non-printing characters. If the
+pattern has the <b>/+</b> modifier, the output for substring 0 is followed by
+the the rest of the subject string, identified by "0+" like this:
<pre>
re&#62; /cat/+
data&#62; cataract
@@ -441,10 +475,10 @@ length (that is, the return from the extraction function) is given in
parentheses after each string for <b>\C</b> and <b>\G</b>.
</P>
<P>
-Note that while patterns can be continued over several lines (a plain "&#62;"
+Note that whereas patterns can be continued over several lines (a plain "&#62;"
prompt is used for continuations), data lines may not. However newlines can be
-included in data by means of the \n escape (or \r or \r\n for those newline
-settings).
+included in data by means of the \n escape (or \r, \r\n, etc., depending on
+the newline sequence setting).
</P>
<br><a name="SEC8" href="#TOC1">OUTPUT FROM THE ALTERNATIVE MATCHING FUNCTION</a><br>
<P>
@@ -463,7 +497,7 @@ the subject where there is at least one match. For example:
longest matching string is always given first (and numbered zero).
</P>
<P>
-If \fB/g\P is present on the pattern, the search for further matches resumes
+If <b>/g</b> is present on the pattern, the search for further matches resumes
at the end of the longest match. For example:
<pre>
re&#62; /(tang|tangerine|tan)/g
@@ -537,7 +571,19 @@ the
<a href="pcrecallout.html"><b>pcrecallout</b></a>
documentation.
</P>
-<br><a name="SEC11" href="#TOC1">SAVING AND RELOADING COMPILED PATTERNS</a><br>
+<br><a name="SEC11" href="#TOC1">NON-PRINTING CHARACTERS</a><br>
+<P>
+When <b>pcretest</b> is outputting text in the compiled version of a pattern,
+bytes other than 32-126 are always treated as non-printing characters are are
+therefore shown as hex escapes.
+</P>
+<P>
+When <b>pcretest</b> is outputting text that is a matched part of a subject
+string, it behaves in the same way, unless a different locale has been set for
+the pattern (using the <b>/L</b> modifier). In this case, the <b>isprint()</b>
+function to distinguish printing and non-printing characters.
+</P>
+<br><a name="SEC12" href="#TOC1">SAVING AND RELOADING COMPILED PATTERNS</a><br>
<P>
The facilities described in this section are not available when the POSIX
inteface to PCRE is being used, that is, when the <b>/P</b> pattern modifier is
@@ -599,16 +645,21 @@ string using a reloaded pattern is likely to cause <b>pcretest</b> to crash.
Finally, if you attempt to load a file that is not in the correct format, the
result is undefined.
</P>
-<br><a name="SEC12" href="#TOC1">AUTHOR</a><br>
+<br><a name="SEC13" href="#TOC1">SEE ALSO</a><br>
+<P>
+<b>pcre</b>(3), <b>pcreapi</b>(3), <b>pcrecallout</b>(3), <b>pcrematching</b>(3),
+<b>pcrepartial</b>(d), \fPpcrepattern\fP(3), <b>pcreprecompile</b>(3).
+</P>
+<br><a name="SEC14" href="#TOC1">AUTHOR</a><br>
<P>
Philip Hazel
<br>
University Computing Service,
<br>
-Cambridge CB2 3QG, England.
+Cambridge CB2 3QH, England.
</P>
<P>
-Last updated: 29 June 2006
+Last updated: 30 November 2006
<br>
Copyright &copy; 1997-2006 University of Cambridge.
<p>
diff --git a/doc/pcre.3 b/doc/pcre.3
index 62c18fa..6fd9b5b 100644
--- a/doc/pcre.3
+++ b/doc/pcre.3
@@ -6,12 +6,16 @@ PCRE - Perl-compatible regular expressions
.sp
The PCRE library is a set of functions that implement regular expression
pattern matching using the same syntax and semantics as Perl, with just a few
-differences. The current implementation of PCRE (release 6.x) corresponds
-approximately with Perl 5.8, including support for UTF-8 encoded strings and
-Unicode general category properties. However, this support has to be explicitly
-enabled; it is not the default.
+differences. (Certain features that appeared in Python and PCRE before they
+appeared in Perl are also available using the Python syntax.)
.P
-In addition to the Perl-compatible matching function, PCRE also contains an
+The current implementation of PCRE (release 7.x) corresponds approximately with
+Perl 5.10, including support for UTF-8 encoded strings and Unicode general
+category properties. However, UTF-8 and Unicode support has to be explicitly
+enabled; it is not the default. The Unicode tables correspond to Unicode
+release 5.0.0.
+.P
+In addition to the Perl-compatible matching function, PCRE contains an
alternative matching function that matches the same compiled patterns in a
different way. In certain circumstances, the alternative function has some
advantages. For a discussion of the two matching algorithms, see the
@@ -114,18 +118,17 @@ distribution and the
\fBpcrebuild\fP
.\"
documentation for details). In these cases the limit is substantially larger.
-However, the speed of execution will be slower.
+However, the speed of execution is slower.
.P
All values in repeating quantifiers must be less than 65536. The maximum
compiled length of subpattern with an explicit repeat count is 30000 bytes. The
maximum number of capturing subpatterns is 65535.
.P
-There is no limit to the number of non-capturing subpatterns, but the maximum
-depth of nesting of all kinds of parenthesized subpattern, including capturing
-subpatterns, assertions, and other types of subpattern, is 200.
+There is no limit to the number of parenthesized subpatterns, but there can be
+no more than 65535 capturing subpatterns.
.P
-The maximum length of name for a named subpattern is 32, and the maximum number
-of named subpatterns is 10000.
+The maximum length of name for a named subpattern is 32 characters, and the
+maximum number of named subpatterns is 10000.
.P
The maximum length of a subject string is the largest positive number that an
integer variable can hold. However, when using the traditional matching
@@ -160,7 +163,7 @@ instead of just strings of bytes.
.P
If you compile PCRE with UTF-8 support, but do not use it at run time, the
library will be a bit bigger, but the additional run time overhead is limited
-to testing the PCRE_UTF8 flag in several places, so should not be very large.
+to testing the PCRE_UTF8 flag occasionally, so should not be very big.
.P
If PCRE is built with Unicode character property support (which implies UTF-8
support), the escape sequences \ep{..}, \eP{..}, and \eX are supported.
@@ -232,13 +235,13 @@ Philip Hazel
.br
University Computing Service,
.br
-Cambridge CB2 3QG, England.
+Cambridge CB2 3QH, England.
.P
Putting an actual email address here seems to have been a spam magnet, so I've
taken it away. If you want to email me, use my initial and surname, separated
by a dot, at the domain ucs.cam.ac.uk.
.sp
.in 0
-Last updated: 05 June 2006
+Last updated: 23 November 2006
.br
Copyright (c) 1997-2006 University of Cambridge.
diff --git a/doc/pcre.txt b/doc/pcre.txt
index d6c204b..9c78849 100644
--- a/doc/pcre.txt
+++ b/doc/pcre.txt
@@ -18,52 +18,57 @@ INTRODUCTION
The PCRE library is a set of functions that implement regular expres-
sion pattern matching using the same syntax and semantics as Perl, with
- just a few differences. The current implementation of PCRE (release
- 6.x) corresponds approximately with Perl 5.8, including support for
- UTF-8 encoded strings and Unicode general category properties. However,
- this support has to be explicitly enabled; it is not the default.
-
- In addition to the Perl-compatible matching function, PCRE also con-
- tains an alternative matching function that matches the same compiled
- patterns in a different way. In certain circumstances, the alternative
- function has some advantages. For a discussion of the two matching
- algorithms, see the pcrematching page.
-
- PCRE is written in C and released as a C library. A number of people
- have written wrappers and interfaces of various kinds. In particular,
- Google Inc. have provided a comprehensive C++ wrapper. This is now
+ just a few differences. (Certain features that appeared in Python and
+ PCRE before they appeared in Perl are also available using the Python
+ syntax.)
+
+ The current implementation of PCRE (release 7.x) corresponds approxi-
+ mately with Perl 5.10, including support for UTF-8 encoded strings and
+ Unicode general category properties. However, UTF-8 and Unicode support
+ has to be explicitly enabled; it is not the default. The Unicode tables
+ correspond to Unicode release 5.0.0.
+
+ In addition to the Perl-compatible matching function, PCRE contains an
+ alternative matching function that matches the same compiled patterns
+ in a different way. In certain circumstances, the alternative function
+ has some advantages. For a discussion of the two matching algorithms,
+ see the pcrematching page.
+
+ PCRE is written in C and released as a C library. A number of people
+ have written wrappers and interfaces of various kinds. In particular,
+ Google Inc. have provided a comprehensive C++ wrapper. This is now
included as part of the PCRE distribution. The pcrecpp page has details
- of this interface. Other people's contributions can be found in the
+ of this interface. Other people's contributions can be found in the
Contrib directory at the primary FTP site, which is:
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre
- Details of exactly which Perl regular expression features are and are
+ Details of exactly which Perl regular expression features are and are
not supported by PCRE are given in separate documents. See the pcrepat-
tern and pcrecompat pages.
- Some features of PCRE can be included, excluded, or changed when the
- library is built. The pcre_config() function makes it possible for a
- client to discover which features are available. The features them-
- selves are described in the pcrebuild page. Documentation about build-
- ing PCRE for various operating systems can be found in the README file
+ Some features of PCRE can be included, excluded, or changed when the
+ library is built. The pcre_config() function makes it possible for a
+ client to discover which features are available. The features them-
+ selves are described in the pcrebuild page. Documentation about build-
+ ing PCRE for various operating systems can be found in the README file
in the source distribution.
- The library contains a number of undocumented internal functions and
- data tables that are used by more than one of the exported external
- functions, but which are not intended for use by external callers.
- Their names all begin with "_pcre_", which hopefully will not provoke
+ The library contains a number of undocumented internal functions and
+ data tables that are used by more than one of the exported external
+ functions, but which are not intended for use by external callers.
+ Their names all begin with "_pcre_", which hopefully will not provoke
any name clashes. In some environments, it is possible to control which
- external symbols are exported when a shared library is built, and in
+ external symbols are exported when a shared library is built, and in
these cases the undocumented symbols are not exported.
USER DOCUMENTATION
- The user documentation for PCRE comprises a number of different sec-
- tions. In the "man" format, each of these is a separate "man page". In
- the HTML format, each is a separate page, linked from the index page.
- In the plain text format, all the sections are concatenated, for ease
+ The user documentation for PCRE comprises a number of different sec-
+ tions. In the "man" format, each of these is a separate "man page". In
+ the HTML format, each is a separate page, linked from the index page.
+ In the plain text format, all the sections are concatenated, for ease
of searching. The sections are as follows:
pcre this document
@@ -84,124 +89,122 @@ USER DOCUMENTATION
pcrestack discussion of stack usage
pcretest description of the pcretest testing command
- In addition, in the "man" and HTML formats, there is a short page for
+ In addition, in the "man" and HTML formats, there is a short page for
each C library function, listing its arguments and results.
LIMITATIONS
- There are some size limitations in PCRE but it is hoped that they will
+ There are some size limitations in PCRE but it is hoped that they will
never in practice be relevant.
- The maximum length of a compiled pattern is 65539 (sic) bytes if PCRE
+ The maximum length of a compiled pattern is 65539 (sic) bytes if PCRE
is compiled with the default internal linkage size of 2. If you want to
- process regular expressions that are truly enormous, you can compile
- PCRE with an internal linkage size of 3 or 4 (see the README file in
- the source distribution and the pcrebuild documentation for details).
- In these cases the limit is substantially larger. However, the speed
- of execution will be slower.
-
- All values in repeating quantifiers must be less than 65536. The maxi-
- mum compiled length of subpattern with an explicit repeat count is
+ process regular expressions that are truly enormous, you can compile
+ PCRE with an internal linkage size of 3 or 4 (see the README file in
+ the source distribution and the pcrebuild documentation for details).
+ In these cases the limit is substantially larger. However, the speed
+ of execution is slower.
+
+ All values in repeating quantifiers must be less than 65536. The maxi-
+ mum compiled length of subpattern with an explicit repeat count is
30000 bytes. The maximum number of capturing subpatterns is 65535.
- There is no limit to the number of non-capturing subpatterns, but the
- maximum depth of nesting of all kinds of parenthesized subpattern,
- including capturing subpatterns, assertions, and other types of subpat-
- tern, is 200.
+ There is no limit to the number of parenthesized subpatterns, but there
+ can be no more than 65535 capturing subpatterns.
- The maximum length of name for a named subpattern is 32, and the maxi-
- mum number of named subpatterns is 10000.
+ The maximum length of name for a named subpattern is 32 characters, and
+ the maximum number of named subpatterns is 10000.
- The maximum length of a subject string is the largest positive number
- that an integer variable can hold. However, when using the traditional
+ The maximum length of a subject string is the largest positive number
+ that an integer variable can hold. However, when using the traditional
matching function, PCRE uses recursion to handle subpatterns and indef-
- inite repetition. This means that the available stack space may limit
+ inite repetition. This means that the available stack space may limit
the size of a subject string that can be processed by certain patterns.
For a discussion of stack issues, see the pcrestack documentation.
UTF-8 AND UNICODE PROPERTY SUPPORT
- From release 3.3, PCRE has had some support for character strings
- encoded in the UTF-8 format. For release 4.0 this was greatly extended
- to cover most common requirements, and in release 5.0 additional sup-
+ From release 3.3, PCRE has had some support for character strings
+ encoded in the UTF-8 format. For release 4.0 this was greatly extended
+ to cover most common requirements, and in release 5.0 additional sup-
port for Unicode general category properties was added.
- In order process UTF-8 strings, you must build PCRE to include UTF-8
- support in the code, and, in addition, you must call pcre_compile()
- with the PCRE_UTF8 option flag. When you do this, both the pattern and
- any subject strings that are matched against it are treated as UTF-8
+ In order process UTF-8 strings, you must build PCRE to include UTF-8
+ support in the code, and, in addition, you must call pcre_compile()
+ with the PCRE_UTF8 option flag. When you do this, both the pattern and
+ any subject strings that are matched against it are treated as UTF-8
strings instead of just strings of bytes.
- If you compile PCRE with UTF-8 support, but do not use it at run time,
- the library will be a bit bigger, but the additional run time overhead
- is limited to testing the PCRE_UTF8 flag in several places, so should
- not be very large.
+ If you compile PCRE with UTF-8 support, but do not use it at run time,
+ the library will be a bit bigger, but the additional run time overhead
+ is limited to testing the PCRE_UTF8 flag occasionally, so should not be
+ very big.
If PCRE is built with Unicode character property support (which implies
- UTF-8 support), the escape sequences \p{..}, \P{..}, and \X are sup-
+ UTF-8 support), the escape sequences \p{..}, \P{..}, and \X are sup-
ported. The available properties that can be tested are limited to the
- general category properties such as Lu for an upper case letter or Nd
- for a decimal number, the Unicode script names such as Arabic or Han,
- and the derived properties Any and L&. A full list is given in the
+ general category properties such as Lu for an upper case letter or Nd
+ for a decimal number, the Unicode script names such as Arabic or Han,
+ and the derived properties Any and L&. A full list is given in the
pcrepattern documentation. Only the short names for properties are sup-
- ported. For example, \p{L} matches a letter. Its Perl synonym, \p{Let-
- ter}, is not supported. Furthermore, in Perl, many properties may
- optionally be prefixed by "Is", for compatibility with Perl 5.6. PCRE
+ ported. For example, \p{L} matches a letter. Its Perl synonym, \p{Let-
+ ter}, is not supported. Furthermore, in Perl, many properties may
+ optionally be prefixed by "Is", for compatibility with Perl 5.6. PCRE
does not support this.
The following comments apply when PCRE is running in UTF-8 mode:
- 1. When you set the PCRE_UTF8 flag, the strings passed as patterns and
- subjects are checked for validity on entry to the relevant functions.
+ 1. When you set the PCRE_UTF8 flag, the strings passed as patterns and
+ subjects are checked for validity on entry to the relevant functions.
If an invalid UTF-8 string is passed, an error return is given. In some
- situations, you may already know that your strings are valid, and
+ situations, you may already know that your strings are valid, and
therefore want to skip these checks in order to improve performance. If
- you set the PCRE_NO_UTF8_CHECK flag at compile time or at run time,
- PCRE assumes that the pattern or subject it is given (respectively)
- contains only valid UTF-8 codes. In this case, it does not diagnose an
- invalid UTF-8 string. If you pass an invalid UTF-8 string to PCRE when
- PCRE_NO_UTF8_CHECK is set, the results are undefined. Your program may
+ you set the PCRE_NO_UTF8_CHECK flag at compile time or at run time,
+ PCRE assumes that the pattern or subject it is given (respectively)
+ contains only valid UTF-8 codes. In this case, it does not diagnose an
+ invalid UTF-8 string. If you pass an invalid UTF-8 string to PCRE when
+ PCRE_NO_UTF8_CHECK is set, the results are undefined. Your program may
crash.
- 2. An unbraced hexadecimal escape sequence (such as \xb3) matches a
+ 2. An unbraced hexadecimal escape sequence (such as \xb3) matches a
two-byte UTF-8 character if the value is greater than 127.
- 3. Octal numbers up to \777 are recognized, and match two-byte UTF-8
+ 3. Octal numbers up to \777 are recognized, and match two-byte UTF-8
characters for values greater than \177.
- 4. Repeat quantifiers apply to complete UTF-8 characters, not to indi-
+ 4. Repeat quantifiers apply to complete UTF-8 characters, not to indi-
vidual bytes, for example: \x{100}{3}.
- 5. The dot metacharacter matches one UTF-8 character instead of a sin-
+ 5. The dot metacharacter matches one UTF-8 character instead of a sin-
gle byte.
- 6. The escape sequence \C can be used to match a single byte in UTF-8
- mode, but its use can lead to some strange effects. This facility is
+ 6. The escape sequence \C can be used to match a single byte in UTF-8
+ mode, but its use can lead to some strange effects. This facility is
not available in the alternative matching function, pcre_dfa_exec().
- 7. The character escapes \b, \B, \d, \D, \s, \S, \w, and \W correctly
- test characters of any code value, but the characters that PCRE recog-
- nizes as digits, spaces, or word characters remain the same set as
+ 7. The character escapes \b, \B, \d, \D, \s, \S, \w, and \W correctly
+ test characters of any code value, but the characters that PCRE recog-
+ nizes as digits, spaces, or word characters remain the same set as
before, all with values less than 256. This remains true even when PCRE
- includes Unicode property support, because to do otherwise would slow
- down PCRE in many common cases. If you really want to test for a wider
- sense of, say, "digit", you must use Unicode property tests such as
+ includes Unicode property support, because to do otherwise would slow
+ down PCRE in many common cases. If you really want to test for a wider
+ sense of, say, "digit", you must use Unicode property tests such as
\p{Nd}.
- 8. Similarly, characters that match the POSIX named character classes
+ 8. Similarly, characters that match the POSIX named character classes
are all low-valued characters.
- 9. Case-insensitive matching applies only to characters whose values
- are less than 128, unless PCRE is built with Unicode property support.
- Even when Unicode property support is available, PCRE still uses its
- own character tables when checking the case of low-valued characters,
- so as not to degrade performance. The Unicode property information is
+ 9. Case-insensitive matching applies only to characters whose values
+ are less than 128, unless PCRE is built with Unicode property support.
+ Even when Unicode property support is available, PCRE still uses its
+ own character tables when checking the case of low-valued characters,
+ so as not to degrade performance. The Unicode property information is
used only for characters with higher values. Even when Unicode property
support is available, PCRE supports case-insensitive matching only when
- there is a one-to-one mapping between a letter's cases. There are a
- small number of many-to-one mappings in Unicode; these are not sup-
+ there is a one-to-one mapping between a letter's cases. There are a
+ small number of many-to-one mappings in Unicode; these are not sup-
ported by PCRE.
@@ -209,13 +212,13 @@ AUTHOR
Philip Hazel
University Computing Service,
- Cambridge CB2 3QG, England.
+ Cambridge CB2 3QH, England.
- Putting an actual email address here seems to have been a spam magnet,
+ Putting an actual email address here seems to have been a spam magnet,
so I've taken it away. If you want to email me, use my initial and sur-
name, separated by a dot, at the domain ucs.cam.ac.uk.
-Last updated: 05 June 2006
+Last updated: 23 November 2006
Copyright (c) 1997-2006 University of Cambridge.
------------------------------------------------------------------------------
@@ -305,16 +308,21 @@ CODE VALUE OF NEWLINE
--enable-newline-is-crlf
- to the configure command. Whatever line ending convention is selected
- when PCRE is built can be overridden when the library functions are
- called. At build time it is conventional to use the standard for your
- operating system.
+ to the configure command. There is a fourth option, specified by
+
+ --enable-newline-is-any
+
+ which causes PCRE to recognize any Unicode newline sequence.
+
+ Whatever line ending convention is selected when PCRE is built can be
+ overridden when the library functions are called. At build time it is
+ conventional to use the standard for your operating system.
BUILDING SHARED AND STATIC LIBRARIES
- The PCRE building process uses libtool to build both shared and static
- Unix libraries by default. You can suppress one of these by adding one
+ The PCRE building process uses libtool to build both shared and static
+ Unix libraries by default. You can suppress one of these by adding one
of
--disable-shared
@@ -326,9 +334,9 @@ BUILDING SHARED AND STATIC LIBRARIES
POSIX MALLOC USAGE
When PCRE is called through the POSIX interface (see the pcreposix doc-
- umentation), additional working storage is required for holding the
- pointers to capturing substrings, because PCRE requires three integers
- per substring, whereas the POSIX interface provides only two. If the
+ umentation), additional working storage is required for holding the
+ pointers to capturing substrings, because PCRE requires three integers
+ per substring, whereas the POSIX interface provides only two. If the
number of expected substrings is small, the wrapper function uses space
on the stack, because this is faster than using malloc() for each call.
The default threshold above which the stack is no longer used is 10; it
@@ -341,95 +349,100 @@ POSIX MALLOC USAGE
HANDLING VERY LARGE PATTERNS
- Within a compiled pattern, offset values are used to point from one
- part to another (for example, from an opening parenthesis to an alter-
- nation metacharacter). By default, two-byte values are used for these
- offsets, leading to a maximum size for a compiled pattern of around
- 64K. This is sufficient to handle all but the most gigantic patterns.
- Nevertheless, some people do want to process enormous patterns, so it
- is possible to compile PCRE to use three-byte or four-byte offsets by
+ Within a compiled pattern, offset values are used to point from one
+ part to another (for example, from an opening parenthesis to an alter-
+ nation metacharacter). By default, two-byte values are used for these
+ offsets, leading to a maximum size for a compiled pattern of around
+ 64K. This is sufficient to handle all but the most gigantic patterns.
+ Nevertheless, some people do want to process enormous patterns, so it
+ is possible to compile PCRE to use three-byte or four-byte offsets by
adding a setting such as
--with-link-size=3
- to the configure command. The value given must be 2, 3, or 4. Using
- longer offsets slows down the operation of PCRE because it has to load
+ to the configure command. The value given must be 2, 3, or 4. Using
+ longer offsets slows down the operation of PCRE because it has to load
additional bytes when handling them.
- If you build PCRE with an increased link size, test 2 (and test 5 if
- you are using UTF-8) will fail. Part of the output of these tests is a
- representation of the compiled pattern, and this changes with the link
+ If you build PCRE with an increased link size, test 2 (and test 5 if
+ you are using UTF-8) will fail. Part of the output of these tests is a
+ representation of the compiled pattern, and this changes with the link
size.
AVOIDING EXCESSIVE STACK USAGE
When matching with the pcre_exec() function, PCRE implements backtrack-
- ing by making recursive calls to an internal function called match().
- In environments where the size of the stack is limited, this can se-
- verely limit PCRE's operation. (The Unix environment does not usually
+ ing by making recursive calls to an internal function called match().
+ In environments where the size of the stack is limited, this can se-
+ verely limit PCRE's operation. (The Unix environment does not usually
suffer from this problem, but it may sometimes be necessary to increase
- the maximum stack size. There is a discussion in the pcrestack docu-
- mentation.) An alternative approach to recursion that uses memory from
- the heap to remember data, instead of using recursive function calls,
- has been implemented to work round the problem of limited stack size.
+ the maximum stack size. There is a discussion in the pcrestack docu-
+ mentation.) An alternative approach to recursion that uses memory from
+ the heap to remember data, instead of using recursive function calls,
+ has been implemented to work round the problem of limited stack size.
If you want to build a version of PCRE that works this way, add
--disable-stack-for-recursion
- to the configure command. With this configuration, PCRE will use the
- pcre_stack_malloc and pcre_stack_free variables to call memory manage-
- ment functions. Separate functions are provided because the usage is
- very predictable: the block sizes requested are always the same, and
- the blocks are always freed in reverse order. A calling program might
- be able to implement optimized functions that perform better than the
- standard malloc() and free() functions. PCRE runs noticeably more
+ to the configure command. With this configuration, PCRE will use the
+ pcre_stack_malloc and pcre_stack_free variables to call memory manage-
+ ment functions. Separate functions are provided because the usage is
+ very predictable: the block sizes requested are always the same, and
+ the blocks are always freed in reverse order. A calling program might
+ be able to implement optimized functions that perform better than the
+ standard malloc() and free() functions. PCRE runs noticeably more
slowly when built in this way. This option affects only the pcre_exec()
function; it is not relevant for the the pcre_dfa_exec() function.
LIMITING PCRE RESOURCE USAGE
- Internally, PCRE has a function called match(), which it calls repeat-
- edly (sometimes recursively) when matching a pattern with the
- pcre_exec() function. By controlling the maximum number of times this
- function may be called during a single matching operation, a limit can
- be placed on the resources used by a single call to pcre_exec(). The
- limit can be changed at run time, as described in the pcreapi documen-
- tation. The default is 10 million, but this can be changed by adding a
+ Internally, PCRE has a function called match(), which it calls repeat-
+ edly (sometimes recursively) when matching a pattern with the
+ pcre_exec() function. By controlling the maximum number of times this
+ function may be called during a single matching operation, a limit can
+ be placed on the resources used by a single call to pcre_exec(). The
+ limit can be changed at run time, as described in the pcreapi documen-
+ tation. The default is 10 million, but this can be changed by adding a
setting such as
--with-match-limit=500000
- to the configure command. This setting has no effect on the
+ to the configure command. This setting has no effect on the
pcre_dfa_exec() matching function.
- In some environments it is desirable to limit the depth of recursive
+ In some environments it is desirable to limit the depth of recursive
calls of match() more strictly than the total number of calls, in order
- to restrict the maximum amount of stack (or heap, if --disable-stack-
+ to restrict the maximum amount of stack (or heap, if --disable-stack-
for-recursion is specified) that is used. A second limit controls this;
- it defaults to the value that is set for --with-match-limit, which
- imposes no additional constraints. However, you can set a lower limit
+ it defaults to the value that is set for --with-match-limit, which
+ imposes no additional constraints. However, you can set a lower limit
by adding, for example,
--with-match-limit-recursion=10000
- to the configure command. This value can also be overridden at run
+ to the configure command. This value can also be overridden at run
time.
USING EBCDIC CODE
- PCRE assumes by default that it will run in an environment where the
- character code is ASCII (or Unicode, which is a superset of ASCII).
- PCRE can, however, be compiled to run in an EBCDIC environment by
+ PCRE assumes by default that it will run in an environment where the
+ character code is ASCII (or Unicode, which is a superset of ASCII).
+ PCRE can, however, be compiled to run in an EBCDIC environment by
adding
--enable-ebcdic
to the configure command.
-Last updated: 06 June 2006
+
+SEE ALSO
+
+ pcreapi(3), pcre_config(3).
+
+Last updated: 30 November 2006
Copyright (c) 1997-2006 University of Cambridge.
------------------------------------------------------------------------------
@@ -466,7 +479,7 @@ PCRE MATCHING ALGORITHMS
<something> <something else> <something further>
there are three possible answers. The standard algorithm finds only one
- of them, whereas the DFA algorithm finds all three.
+ of them, whereas the alternative algorithm finds all three.
REGULAR EXPRESSIONS AS TREES
@@ -507,21 +520,22 @@ THE STANDARD MATCHING ALGORITHM
This provides support for capturing parentheses and back references.
-THE DFA MATCHING ALGORITHM
+THE ALTERNATIVE MATCHING ALGORITHM
- DFA stands for "deterministic finite automaton", but you do not need to
- understand the origins of that name. This algorithm conducts a breadth-
- first search of the tree. Starting from the first matching point in the
- subject, it scans the subject string from left to right, once, charac-
- ter by character, and as it does this, it remembers all the paths
- through the tree that represent valid matches.
+ This algorithm conducts a breadth-first search of the tree. Starting
+ from the first matching point in the subject, it scans the subject
+ string from left to right, once, character by character, and as it does
+ this, it remembers all the paths through the tree that represent valid
+ matches. In Friedl's terminology, this is a kind of "DFA algorithm",
+ though it is not implemented as a traditional finite state machine (it
+ keeps multiple states active simultaneously).
- The scan continues until either the end of the subject is reached, or
- there are no more unterminated paths. At this point, terminated paths
- represent the different matching possibilities (if there are none, the
- match has failed). Thus, if there is more than one possible match,
+ The scan continues until either the end of the subject is reached, or
+ there are no more unterminated paths. At this point, terminated paths
+ represent the different matching possibilities (if there are none, the
+ match has failed). Thus, if there is more than one possible match,
this algorithm finds all of them, and in particular, it finds the long-
- est. In PCRE, there is an option to stop the algorithm after the first
+ est. In PCRE, there is an option to stop the algorithm after the first
match (which is necessarily the shortest) has been found.
Note that all the matches that are found start at the same point in the
@@ -529,75 +543,86 @@ THE DFA MATCHING ALGORITHM
cat(er(pillar)?)
- is matched against the string "the caterpillar catchment", the result
- will be the three strings "cat", "cater", and "caterpillar" that start
+ is matched against the string "the caterpillar catchment", the result
+ will be the three strings "cat", "cater", and "caterpillar" that start
at the fourth character of the subject. The algorithm does not automat-
ically move on to find matches that start at later positions.
There are a number of features of PCRE regular expressions that are not
- supported by the DFA matching algorithm. They are as follows:
+ supported by the alternative matching algorithm. They are as follows:
+
+ 1. Because the algorithm finds all possible matches, the greedy or
+ ungreedy nature of repetition quantifiers is not relevant. Greedy and
+ ungreedy quantifiers are treated in exactly the same way. However, pos-
+ sessive quantifiers can make a difference when what follows could also
+ match what is quantified, for example in a pattern like this:
- 1. Because the algorithm finds all possible matches, the greedy or
- ungreedy nature of repetition quantifiers is not relevant. Greedy and
- ungreedy quantifiers are treated in exactly the same way.
+ ^a++\w!
+
+ This pattern matches "aaab!" but not "aaa!", which would be matched by
+ a non-possessive quantifier. Similarly, if an atomic group is present,
+ it is matched as if it were a standalone pattern at the current point,
+ and the longest match is then "locked in" for the rest of the overall
+ pattern.
2. When dealing with multiple paths through the tree simultaneously, it
- is not straightforward to keep track of captured substrings for the
- different matching possibilities, and PCRE's implementation of this
+ is not straightforward to keep track of captured substrings for the
+ different matching possibilities, and PCRE's implementation of this
algorithm does not attempt to do this. This means that no captured sub-
strings are available.
- 3. Because no substrings are captured, back references within the pat-
+ 3. Because no substrings are captured, back references within the pat-
tern are not supported, and cause errors if encountered.
- 4. For the same reason, conditional expressions that use a backrefer-
- ence as the condition are not supported.
+ 4. For the same reason, conditional expressions that use a backrefer-
+ ence as the condition or test for a specific group recursion are not
+ supported.
5. Callouts are supported, but the value of the capture_top field is
always 1, and the value of the capture_last field is always -1.
6. The \C escape sequence, which (in the standard algorithm) matches a
- single byte, even in UTF-8 mode, is not supported because the DFA algo-
- rithm moves through the subject string one character at a time, for all
- active paths through the tree.
+ single byte, even in UTF-8 mode, is not supported because the alterna-
+ tive algorithm moves through the subject string one character at a
+ time, for all active paths through the tree.
-ADVANTAGES OF THE DFA ALGORITHM
+ADVANTAGES OF THE ALTERNATIVE ALGORITHM
- Using the DFA matching algorithm provides the following advantages:
+ Using the alternative matching algorithm provides the following advan-
+ tages:
1. All possible matches (at a single point in the subject) are automat-
- ically found, and in particular, the longest match is found. To find
+ ically found, and in particular, the longest match is found. To find
more than one match using the standard algorithm, you have to do kludgy
things with callouts.
- 2. There is much better support for partial matching. The restrictions
- on the content of the pattern that apply when using the standard algo-
- rithm for partial matching do not apply to the DFA algorithm. For non-
- anchored patterns, the starting position of a partial match is avail-
- able.
+ 2. There is much better support for partial matching. The restrictions
+ on the content of the pattern that apply when using the standard algo-
+ rithm for partial matching do not apply to the alternative algorithm.
+ For non-anchored patterns, the starting position of a partial match is
+ available.
- 3. Because the DFA algorithm scans the subject string just once, and
- never needs to backtrack, it is possible to pass very long subject
- strings to the matching function in several pieces, checking for par-
- tial matching each time.
+ 3. Because the alternative algorithm scans the subject string just
+ once, and never needs to backtrack, it is possible to pass very long
+ subject strings to the matching function in several pieces, checking
+ for partial matching each time.
-DISADVANTAGES OF THE DFA ALGORITHM
+DISADVANTAGES OF THE ALTERNATIVE ALGORITHM
- The DFA algorithm suffers from a number of disadvantages:
+ The alternative algorithm suffers from a number of disadvantages:
- 1. It is substantially slower than the standard algorithm. This is
- partly because it has to search for all possible matches, but is also
+ 1. It is substantially slower than the standard algorithm. This is
+ partly because it has to search for all possible matches, but is also
because it is less susceptible to optimization.
2. Capturing parentheses and back references are not supported.
- 3. The "atomic group" feature of PCRE regular expressions is supported,
- but does not provide the advantage that it does for the standard algo-
- rithm.
+ 3. Although atomic groups are supported, their use does not provide the
+ performance advantage that it does for the standard algorithm.
-Last updated: 06 June 2006
+Last updated: 24 November 2006
Copyright (c) 1997-2006 University of Cambridge.
------------------------------------------------------------------------------
@@ -692,7 +717,7 @@ PCRE NATIVE API
PCRE API OVERVIEW
PCRE has its own native API, which is described in this document. There
- is also a set of wrapper functions that correspond to the POSIX regular
+ are also some wrapper functions that correspond to the POSIX regular
expression API. These are described in the pcreposix documentation.
Both of these APIs define a set of C function calls. A C++ wrapper is
distributed with PCRE. It is documented in the pcrecpp page.
@@ -715,10 +740,10 @@ PCRE API OVERVIEW
A second matching function, pcre_dfa_exec(), which is not Perl-compati-
ble, is also provided. This uses a different algorithm for the match-
ing. The alternative algorithm finds all possible matches (at a given
- point in the subject). However, this algorithm does not return captured
- substrings. A description of the two matching algorithms and their
- advantages and disadvantages is given in the pcrematching documenta-
- tion.
+ point in the subject), and scans the subject just once. However, this
+ algorithm does not return captured substrings. A description of the two
+ matching algorithms and their advantages and disadvantages is given in
+ the pcrematching documentation.
In addition to the main compiling and matching functions, there are
convenience functions for extracting captured substrings from a subject
@@ -779,26 +804,38 @@ PCRE API OVERVIEW
NEWLINES
- PCRE supports three different conventions for indicating line breaks in
- strings: a single CR character, a single LF character, or the two-char-
- acter sequence CRLF. All three are used as "standard" by different
- operating systems. When PCRE is built, a default can be specified. The
- default default is LF, which is the Unix standard. When PCRE is run,
- the default can be overridden, either when a pattern is compiled, or
- when it is matched.
+
+ PCRE supports four different conventions for indicating line breaks in
+ strings: a single CR (carriage return) character, a single LF (line-
+ feed) character, the two-character sequence CRLF, or any Unicode new-
+ line sequence. The Unicode newline sequences are the three just men-
+ tioned, plus the single characters VT (vertical tab, U+000B), FF (form-
+ feed, U+000C), NEL (next line, U+0085), LS (line separator, U+2028),
+ and PS (paragraph separator, U+2029).
+
+ Each of the first three conventions is used by at least one operating
+ system as its standard newline sequence. When PCRE is built, a default
+ can be specified. The default default is LF, which is the Unix stan-
+ dard. When PCRE is run, the default can be overridden, either when a
+ pattern is compiled, or when it is matched.
In the PCRE documentation the word "newline" is used to mean "the char-
- acter or pair of characters that indicate a line break".
+ acter or pair of characters that indicate a line break". The choice of
+ newline convention affects the handling of the dot, circumflex, and
+ dollar metacharacters, the handling of #-comments in /x mode, and, when
+ CRLF is a recognized line ending sequence, the match position advance-
+ ment for a non-anchored pattern. The choice of newline convention does
+ not affect the interpretation of the \n or \r escape sequences.
MULTITHREADING
- The PCRE functions can be used in multi-threading applications, with
+ The PCRE functions can be used in multi-threading applications, with
the proviso that the memory management functions pointed to by
pcre_malloc, pcre_free, pcre_stack_malloc, and pcre_stack_free, and the
callout function pointed to by pcre_callout, are shared by all threads.
- The compiled form of a regular expression is not altered during match-
+ The compiled form of a regular expression is not altered during match-
ing, so the same compiled pattern can safely be used by several threads
at once.
@@ -806,8 +843,8 @@ MULTITHREADING
SAVING PRECOMPILED PATTERNS FOR LATER USE
The compiled form of a regular expression can be saved and re-used at a
- later time, possibly by a different program, and even on a host other
- than the one on which it was compiled. Details are given in the
+ later time, possibly by a different program, and even on a host other
+ than the one on which it was compiled. Details are given in the
pcreprecompile documentation.
@@ -815,32 +852,33 @@ CHECKING BUILD-TIME OPTIONS
int pcre_config(int what, void *where);
- The function pcre_config() makes it possible for a PCRE client to dis-
+ The function pcre_config() makes it possible for a PCRE client to dis-
cover which optional features have been compiled into the PCRE library.
- The pcrebuild documentation has more details about these optional fea-
+ The pcrebuild documentation has more details about these optional fea-
tures.
- The first argument for pcre_config() is an integer, specifying which
+ The first argument for pcre_config() is an integer, specifying which
information is required; the second argument is a pointer to a variable
- into which the information is placed. The following information is
+ into which the information is placed. The following information is
available:
PCRE_CONFIG_UTF8
- The output is an integer that is set to one if UTF-8 support is avail-
+ The output is an integer that is set to one if UTF-8 support is avail-
able; otherwise it is set to zero.
PCRE_CONFIG_UNICODE_PROPERTIES
- The output is an integer that is set to one if support for Unicode
+ The output is an integer that is set to one if support for Unicode
character properties is available; otherwise it is set to zero.
PCRE_CONFIG_NEWLINE
- The output is an integer whose value specifies the default character
- sequence that is recognized as meaning "newline". The three values that
- are supported are: 10 for LF, 13 for CR, and 3338 for CRLF. The default
- should normally be the standard sequence for your operating system.
+ The output is an integer whose value specifies the default character
+ sequence that is recognized as meaning "newline". The four values that
+ are supported are: 10 for LF, 13 for CR, 3338 for CRLF, and -1 for ANY.
+ The default should normally be the standard sequence for your operating
+ system.
PCRE_CONFIG_LINK_SIZE
@@ -909,8 +947,8 @@ COMPILING A PATTERN
fully relocatable, because it may contain a copy of the tableptr argu-
ment, which is an address (see below).
- The options argument contains independent bits that affect the compila-
- tion. It should be zero if no options are required. The available
+ The options argument contains various bit settings that affect the com-
+ pilation. It should be zero if no options are required. The available
options are described below. Some of them, in particular, those that
are compatible with Perl, can also be set and unset from within the
pattern (see the detailed description in the pcrepattern documenta-
@@ -1000,7 +1038,7 @@ COMPILING A PATTERN
not match when the current position is at a newline. This option is
equivalent to Perl's /s option, and it can be changed within a pattern
by a (?s) option setting. A negative class such as [^a] always matches
- newlines, independent of the setting of this option.
+ newline characters, independent of the setting of this option.
PCRE_DUPNAMES
@@ -1064,19 +1102,37 @@ COMPILING A PATTERN
PCRE_NEWLINE_CR
PCRE_NEWLINE_LF
PCRE_NEWLINE_CRLF
+ PCRE_NEWLINE_ANY
These options override the default newline definition that was chosen
when PCRE was built. Setting the first or the second specifies that a
newline is indicated by a single character (CR or LF, respectively).
- Setting both of them specifies that a newline is indicated by the two-
- character CRLF sequence. For convenience, PCRE_NEWLINE_CRLF is defined
- to contain both bits. The only time that a line break is relevant when
- compiling a pattern is if PCRE_EXTENDED is set, and an unescaped # out-
- side a character class is encountered. This indicates a comment that
- lasts until after the next newline.
-
- The newline option set at compile time becomes the default that is used
- for pcre_exec() and pcre_dfa_exec(), but it can be overridden.
+ Setting PCRE_NEWLINE_CRLF specifies that a newline is indicated by the
+ two-character CRLF sequence. Setting PCRE_NEWLINE_ANY specifies that
+ any Unicode newline sequence should be recognized. The Unicode newline
+ sequences are the three just mentioned, plus the single characters VT
+ (vertical tab, U+000B), FF (formfeed, U+000C), NEL (next line, U+0085),
+ LS (line separator, U+2028), and PS (paragraph separator, U+2029). The
+ last two are recognized only in UTF-8 mode.
+
+ The newline setting in the options word uses three bits that are
+ treated as a number, giving eight possibilities. Currently only five
+ are used (default plus the four values above). This means that if you
+ set more than one newline option, the combination may or may not be
+ sensible. For example, PCRE_NEWLINE_CR with PCRE_NEWLINE_LF is equiva-
+ lent to PCRE_NEWLINE_CRLF, but other combinations yield unused numbers
+ and cause an error.
+
+ The only time that a line break is specially recognized when compiling
+ a pattern is if PCRE_EXTENDED is set, and an unescaped # outside a
+ character class is encountered. This indicates a comment that lasts
+ until after the next line break sequence. In other circumstances, line
+ break sequences are treated as literal data, except that in
+ PCRE_EXTENDED mode, both CR and LF are treated as whitespace characters
+ and are therefore ignored.
+
+ The newline option that is set at compile time becomes the default that
+ is used for pcre_exec() and pcre_dfa_exec(), but it can be overridden.
PCRE_NO_AUTO_CAPTURE
@@ -1119,7 +1175,8 @@ COMPILATION ERROR CODES
The following table lists the error codes than may be returned by
pcre_compile2(), along with the error messages that may be returned by
- both compiling functions.
+ both compiling functions. As PCRE has developed, some error codes have
+ fallen out of use. To avoid confusion, they have not been re-used.
0 no error
1 \ at end of pattern
@@ -1131,7 +1188,7 @@ COMPILATION ERROR CODES
7 invalid escape sequence in character class
8 range out of order in character class
9 nothing to repeat
- 10 operand of unlimited repeat could match the empty string
+ 10 [this code is not in use]
11 internal error: unexpected repeat
12 unrecognized character after (?
13 POSIX named classes are supported only within a class
@@ -1140,7 +1197,7 @@ COMPILATION ERROR CODES
16 erroffset passed as NULL
17 unknown option bit(s) set
18 missing ) after comment
- 19 parentheses nested too deeply
+ 19 [this code is not in use]
20 regular expression too large
21 failed to get memory
22 unmatched parentheses
@@ -1154,7 +1211,7 @@ COMPILATION ERROR CODES
30 unknown POSIX class name
31 POSIX collating elements are not supported
32 this version of PCRE is not compiled with PCRE_UTF8 support
- 33 spare error
+ 33 [this code is not in use]
34 character value in \x{...} sequence is too large
35 invalid condition (?(0)
36 \C not allowed in lookbehind assertion
@@ -1163,7 +1220,7 @@ COMPILATION ERROR CODES
39 closing ) for (?C expected
40 recursive call could loop indefinitely
41 unrecognized character after (?P
- 42 syntax error after (?P
+ 42 syntax error in subpattern name (missing terminator)
43 two named subpatterns have the same name
44 invalid UTF-8 string
45 support for \P, \p, and \X has not been compiled
@@ -1173,6 +1230,12 @@ COMPILATION ERROR CODES
49 too many named subpatterns (maximum 10,000)
50 repeated subpattern is too long
51 octal value is greater than \377 (not in UTF-8 mode)
+ 52 internal error: overran compiling workspace
+ 53 internal error: previously-checked referenced subpattern not
+ found
+ 54 DEFINE group contains more than one branch
+ 55 repeating a DEFINE group is not allowed
+ 56 inconsistent NEWLINE options"
STUDYING A PATTERN
@@ -1331,7 +1394,7 @@ INFORMATION ABOUT A PATTERN
is still recognized for backwards compatibility.)
If there is a fixed first byte, for example, from a pattern such as
- (cat|cow|coyote). Otherwise, if either
+ (cat|cow|coyote), its value is returned. Otherwise, if either
(a) the pattern was compiled with the PCRE_MULTILINE option, and every
branch starts with "^", or
@@ -1388,8 +1451,8 @@ INFORMATION ABOUT A PATTERN
PCRE_EXTENDED is set, so white space - including newlines - is
ignored):
- (?P<date> (?P<year>(\d\d)?\d\d) -
- (?P<month>\d\d) - (?P<day>\d\d) )
+ (?<date> (?<year>(\d\d)?\d\d) -
+ (?<month>\d\d) - (?<day>\d\d) )
There are four named subpatterns, so the table has four entries, and
each entry in the table is eight bytes long. The table is as follows,
@@ -1616,191 +1679,197 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
PCRE_NEWLINE_CR
PCRE_NEWLINE_LF
PCRE_NEWLINE_CRLF
+ PCRE_NEWLINE_ANY
These options override the newline definition that was chosen or
defaulted when the pattern was compiled. For details, see the descrip-
- tion pcre_compile() above. During matching, the newline choice affects
- the behaviour of the dot, circumflex, and dollar metacharacters.
+ tion of pcre_compile() above. During matching, the newline choice
+ affects the behaviour of the dot, circumflex, and dollar metacharac-
+ ters. It may also alter the way the match position is advanced after a
+ match failure for an unanchored pattern. When PCRE_NEWLINE_CRLF or
+ PCRE_NEWLINE_ANY is set, and a match attempt fails when the current
+ position is at a CRLF sequence, the match position is advanced by two
+ characters instead of one, in other words, to after the CRLF.
PCRE_NOTBOL
This option specifies that first character of the subject string is not
- the beginning of a line, so the circumflex metacharacter should not
- match before it. Setting this without PCRE_MULTILINE (at compile time)
- causes circumflex never to match. This option affects only the behav-
+ the beginning of a line, so the circumflex metacharacter should not
+ match before it. Setting this without PCRE_MULTILINE (at compile time)
+ causes circumflex never to match. This option affects only the behav-
iour of the circumflex metacharacter. It does not affect \A.
PCRE_NOTEOL
This option specifies that the end of the subject string is not the end
- of a line, so the dollar metacharacter should not match it nor (except
- in multiline mode) a newline immediately before it. Setting this with-
+ of a line, so the dollar metacharacter should not match it nor (except
+ in multiline mode) a newline immediately before it. Setting this with-
out PCRE_MULTILINE (at compile time) causes dollar never to match. This
- option affects only the behaviour of the dollar metacharacter. It does
+ option affects only the behaviour of the dollar metacharacter. It does
not affect \Z or \z.
PCRE_NOTEMPTY
An empty string is not considered to be a valid match if this option is
- set. If there are alternatives in the pattern, they are tried. If all
- the alternatives match the empty string, the entire match fails. For
+ set. If there are alternatives in the pattern, they are tried. If all
+ the alternatives match the empty string, the entire match fails. For
example, if the pattern
a?b?
- is applied to a string not beginning with "a" or "b", it matches the
- empty string at the start of the subject. With PCRE_NOTEMPTY set, this
+ is applied to a string not beginning with "a" or "b", it matches the
+ empty string at the start of the subject. With PCRE_NOTEMPTY set, this
match is not valid, so PCRE searches further into the string for occur-
rences of "a" or "b".
Perl has no direct equivalent of PCRE_NOTEMPTY, but it does make a spe-
- cial case of a pattern match of the empty string within its split()
- function, and when using the /g modifier. It is possible to emulate
+ cial case of a pattern match of the empty string within its split()
+ function, and when using the /g modifier. It is possible to emulate
Perl's behaviour after matching a null string by first trying the match
again at the same offset with PCRE_NOTEMPTY and PCRE_ANCHORED, and then
- if that fails by advancing the starting offset (see below) and trying
+ if that fails by advancing the starting offset (see below) and trying
an ordinary match again. There is some code that demonstrates how to do
this in the pcredemo.c sample program.
PCRE_NO_UTF8_CHECK
When PCRE_UTF8 is set at compile time, the validity of the subject as a
- UTF-8 string is automatically checked when pcre_exec() is subsequently
- called. The value of startoffset is also checked to ensure that it
- points to the start of a UTF-8 character. If an invalid UTF-8 sequence
+ UTF-8 string is automatically checked when pcre_exec() is subsequently
+ called. The value of startoffset is also checked to ensure that it
+ points to the start of a UTF-8 character. If an invalid UTF-8 sequence
of bytes is found, pcre_exec() returns the error PCRE_ERROR_BADUTF8. If
- startoffset contains an invalid value, PCRE_ERROR_BADUTF8_OFFSET is
+ startoffset contains an invalid value, PCRE_ERROR_BADUTF8_OFFSET is
returned.
- If you already know that your subject is valid, and you want to skip
- these checks for performance reasons, you can set the
- PCRE_NO_UTF8_CHECK option when calling pcre_exec(). You might want to
- do this for the second and subsequent calls to pcre_exec() if you are
- making repeated calls to find all the matches in a single subject
- string. However, you should be sure that the value of startoffset
- points to the start of a UTF-8 character. When PCRE_NO_UTF8_CHECK is
- set, the effect of passing an invalid UTF-8 string as a subject, or a
- value of startoffset that does not point to the start of a UTF-8 char-
+ If you already know that your subject is valid, and you want to skip
+ these checks for performance reasons, you can set the
+ PCRE_NO_UTF8_CHECK option when calling pcre_exec(). You might want to
+ do this for the second and subsequent calls to pcre_exec() if you are
+ making repeated calls to find all the matches in a single subject
+ string. However, you should be sure that the value of startoffset
+ points to the start of a UTF-8 character. When PCRE_NO_UTF8_CHECK is
+ set, the effect of passing an invalid UTF-8 string as a subject, or a
+ value of startoffset that does not point to the start of a UTF-8 char-
acter, is undefined. Your program may crash.
PCRE_PARTIAL
- This option turns on the partial matching feature. If the subject
- string fails to match the pattern, but at some point during the match-
- ing process the end of the subject was reached (that is, the subject
- partially matches the pattern and the failure to match occurred only
- because there were not enough subject characters), pcre_exec() returns
- PCRE_ERROR_PARTIAL instead of PCRE_ERROR_NOMATCH. When PCRE_PARTIAL is
- used, there are restrictions on what may appear in the pattern. These
+ This option turns on the partial matching feature. If the subject
+ string fails to match the pattern, but at some point during the match-
+ ing process the end of the subject was reached (that is, the subject
+ partially matches the pattern and the failure to match occurred only
+ because there were not enough subject characters), pcre_exec() returns
+ PCRE_ERROR_PARTIAL instead of PCRE_ERROR_NOMATCH. When PCRE_PARTIAL is
+ used, there are restrictions on what may appear in the pattern. These
are discussed in the pcrepartial documentation.
The string to be matched by pcre_exec()
- The subject string is passed to pcre_exec() as a pointer in subject, a
- length in length, and a starting byte offset in startoffset. In UTF-8
- mode, the byte offset must point to the start of a UTF-8 character.
- Unlike the pattern string, the subject may contain binary zero bytes.
- When the starting offset is zero, the search for a match starts at the
+ The subject string is passed to pcre_exec() as a pointer in subject, a
+ length in length, and a starting byte offset in startoffset. In UTF-8
+ mode, the byte offset must point to the start of a UTF-8 character.
+ Unlike the pattern string, the subject may contain binary zero bytes.
+ When the starting offset is zero, the search for a match starts at the
beginning of the subject, and this is by far the most common case.
- A non-zero starting offset is useful when searching for another match
- in the same subject by calling pcre_exec() again after a previous suc-
- cess. Setting startoffset differs from just passing over a shortened
- string and setting PCRE_NOTBOL in the case of a pattern that begins
+ A non-zero starting offset is useful when searching for another match
+ in the same subject by calling pcre_exec() again after a previous suc-
+ cess. Setting startoffset differs from just passing over a shortened
+ string and setting PCRE_NOTBOL in the case of a pattern that begins
with any kind of lookbehind. For example, consider the pattern
\Biss\B
- which finds occurrences of "iss" in the middle of words. (\B matches
- only if the current position in the subject is not a word boundary.)
- When applied to the string "Mississipi" the first call to pcre_exec()
- finds the first occurrence. If pcre_exec() is called again with just
- the remainder of the subject, namely "issipi", it does not match,
+ which finds occurrences of "iss" in the middle of words. (\B matches
+ only if the current position in the subject is not a word boundary.)
+ When applied to the string "Mississipi" the first call to pcre_exec()
+ finds the first occurrence. If pcre_exec() is called again with just
+ the remainder of the subject, namely "issipi", it does not match,
because \B is always false at the start of the subject, which is deemed
- to be a word boundary. However, if pcre_exec() is passed the entire
+ to be a word boundary. However, if pcre_exec() is passed the entire
string again, but with startoffset set to 4, it finds the second occur-
- rence of "iss" because it is able to look behind the starting point to
+ rence of "iss" because it is able to look behind the starting point to
discover that it is preceded by a letter.
- If a non-zero starting offset is passed when the pattern is anchored,
+ If a non-zero starting offset is passed when the pattern is anchored,
one attempt to match at the given offset is made. This can only succeed
- if the pattern does not require the match to be at the start of the
+ if the pattern does not require the match to be at the start of the
subject.
How pcre_exec() returns captured substrings
- In general, a pattern matches a certain portion of the subject, and in
- addition, further substrings from the subject may be picked out by
- parts of the pattern. Following the usage in Jeffrey Friedl's book,
- this is called "capturing" in what follows, and the phrase "capturing
- subpattern" is used for a fragment of a pattern that picks out a sub-
- string. PCRE supports several other kinds of parenthesized subpattern
+ In general, a pattern matches a certain portion of the subject, and in
+ addition, further substrings from the subject may be picked out by
+ parts of the pattern. Following the usage in Jeffrey Friedl's book,
+ this is called "capturing" in what follows, and the phrase "capturing
+ subpattern" is used for a fragment of a pattern that picks out a sub-
+ string. PCRE supports several other kinds of parenthesized subpattern
that do not cause substrings to be captured.
- Captured substrings are returned to the caller via a vector of integer
- offsets whose address is passed in ovector. The number of elements in
- the vector is passed in ovecsize, which must be a non-negative number.
+ Captured substrings are returned to the caller via a vector of integer
+ offsets whose address is passed in ovector. The number of elements in
+ the vector is passed in ovecsize, which must be a non-negative number.
Note: this argument is NOT the size of ovector in bytes.
- The first two-thirds of the vector is used to pass back captured sub-
- strings, each substring using a pair of integers. The remaining third
- of the vector is used as workspace by pcre_exec() while matching cap-
- turing subpatterns, and is not available for passing back information.
- The length passed in ovecsize should always be a multiple of three. If
+ The first two-thirds of the vector is used to pass back captured sub-
+ strings, each substring using a pair of integers. The remaining third
+ of the vector is used as workspace by pcre_exec() while matching cap-
+ turing subpatterns, and is not available for passing back information.
+ The length passed in ovecsize should always be a multiple of three. If
it is not, it is rounded down.
- When a match is successful, information about captured substrings is
- returned in pairs of integers, starting at the beginning of ovector,
- and continuing up to two-thirds of its length at the most. The first
+ When a match is successful, information about captured substrings is
+ returned in pairs of integers, starting at the beginning of ovector,
+ and continuing up to two-thirds of its length at the most. The first
element of a pair is set to the offset of the first character in a sub-
- string, and the second is set to the offset of the first character
- after the end of a substring. The first pair, ovector[0] and ovec-
- tor[1], identify the portion of the subject string matched by the
- entire pattern. The next pair is used for the first capturing subpat-
+ string, and the second is set to the offset of the first character
+ after the end of a substring. The first pair, ovector[0] and ovec-
+ tor[1], identify the portion of the subject string matched by the
+ entire pattern. The next pair is used for the first capturing subpat-
tern, and so on. The value returned by pcre_exec() is one more than the
highest numbered pair that has been set. For example, if two substrings
- have been captured, the returned value is 3. If there are no capturing
- subpatterns, the return value from a successful match is 1, indicating
+ have been captured, the returned value is 3. If there are no capturing
+ subpatterns, the return value from a successful match is 1, indicating
that just the first pair of offsets has been set.
If a capturing subpattern is matched repeatedly, it is the last portion
of the string that it matched that is returned.
- If the vector is too small to hold all the captured substring offsets,
+ If the vector is too small to hold all the captured substring offsets,
it is used as far as possible (up to two-thirds of its length), and the
- function returns a value of zero. In particular, if the substring off-
+ function returns a value of zero. In particular, if the substring off-
sets are not of interest, pcre_exec() may be called with ovector passed
- as NULL and ovecsize as zero. However, if the pattern contains back
- references and the ovector is not big enough to remember the related
- substrings, PCRE has to get additional memory for use during matching.
+ as NULL and ovecsize as zero. However, if the pattern contains back
+ references and the ovector is not big enough to remember the related
+ substrings, PCRE has to get additional memory for use during matching.
Thus it is usually advisable to supply an ovector.
- The pcre_info() function can be used to find out how many capturing
- subpatterns there are in a compiled pattern. The smallest size for
- ovector that will allow for n captured substrings, in addition to the
+ The pcre_info() function can be used to find out how many capturing
+ subpatterns there are in a compiled pattern. The smallest size for
+ ovector that will allow for n captured substrings, in addition to the
offsets of the substring matched by the whole pattern, is (n+1)*3.
- It is possible for capturing subpattern number n+1 to match some part
+ It is possible for capturing subpattern number n+1 to match some part
of the subject when subpattern n has not been used at all. For example,
- if the string "abc" is matched against the pattern (a|(z))(bc) the
+ if the string "abc" is matched against the pattern (a|(z))(bc) the
return from the function is 4, and subpatterns 1 and 3 are matched, but
- 2 is not. When this happens, both values in the offset pairs corre-
+ 2 is not. When this happens, both values in the offset pairs corre-
sponding to unused subpatterns are set to -1.
- Offset values that correspond to unused subpatterns at the end of the
- expression are also set to -1. For example, if the string "abc" is
- matched against the pattern (abc)(x(yz)?)? subpatterns 2 and 3 are not
- matched. The return from the function is 2, because the highest used
+ Offset values that correspond to unused subpatterns at the end of the
+ expression are also set to -1. For example, if the string "abc" is
+ matched against the pattern (abc)(x(yz)?)? subpatterns 2 and 3 are not
+ matched. The return from the function is 2, because the highest used
capturing subpattern number is 1. However, you can refer to the offsets
- for the second and third capturing subpatterns if you wish (assuming
+ for the second and third capturing subpatterns if you wish (assuming
the vector is large enough, of course).
- Some convenience functions are provided for extracting the captured
+ Some convenience functions are provided for extracting the captured
substrings as separate strings. These are described below.
Error return values from pcre_exec()
- If pcre_exec() fails, it returns a negative number. The following are
+ If pcre_exec() fails, it returns a negative number. The following are
defined in the header file:
PCRE_ERROR_NOMATCH (-1)
@@ -1809,7 +1878,7 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
PCRE_ERROR_NULL (-2)
- Either code or subject was passed as NULL, or ovector was NULL and
+ Either code or subject was passed as NULL, or ovector was NULL and
ovecsize was not zero.
PCRE_ERROR_BADOPTION (-3)
@@ -1818,80 +1887,94 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
PCRE_ERROR_BADMAGIC (-4)
- PCRE stores a 4-byte "magic number" at the start of the compiled code,
+ PCRE stores a 4-byte "magic number" at the start of the compiled code,
to catch the case when it is passed a junk pointer and to detect when a
pattern that was compiled in an environment of one endianness is run in
- an environment with the other endianness. This is the error that PCRE
+ an environment with the other endianness. This is the error that PCRE
gives when the magic number is not present.
- PCRE_ERROR_UNKNOWN_NODE (-5)
+ PCRE_ERROR_UNKNOWN_OPCODE (-5)
While running the pattern match, an unknown item was encountered in the
- compiled pattern. This error could be caused by a bug in PCRE or by
+ compiled pattern. This error could be caused by a bug in PCRE or by
overwriting of the compiled pattern.
PCRE_ERROR_NOMEMORY (-6)
- If a pattern contains back references, but the ovector that is passed
+ If a pattern contains back references, but the ovector that is passed
to pcre_exec() is not big enough to remember the referenced substrings,
- PCRE gets a block of memory at the start of matching to use for this
- purpose. If the call via pcre_malloc() fails, this error is given. The
+ PCRE gets a block of memory at the start of matching to use for this
+ purpose. If the call via pcre_malloc() fails, this error is given. The
memory is automatically freed at the end of matching.
PCRE_ERROR_NOSUBSTRING (-7)
- This error is used by the pcre_copy_substring(), pcre_get_substring(),
+ This error is used by the pcre_copy_substring(), pcre_get_substring(),
and pcre_get_substring_list() functions (see below). It is never
returned by pcre_exec().
PCRE_ERROR_MATCHLIMIT (-8)
- The backtracking limit, as specified by the match_limit field in a
- pcre_extra structure (or defaulted) was reached. See the description
+ The backtracking limit, as specified by the match_limit field in a
+ pcre_extra structure (or defaulted) was reached. See the description
above.
- PCRE_ERROR_RECURSIONLIMIT (-21)
-
- The internal recursion limit, as specified by the match_limit_recursion
- field in a pcre_extra structure (or defaulted) was reached. See the
- description above.
-
PCRE_ERROR_CALLOUT (-9)
This error is never generated by pcre_exec() itself. It is provided for
- use by callout functions that want to yield a distinctive error code.
+ use by callout functions that want to yield a distinctive error code.
See the pcrecallout documentation for details.
PCRE_ERROR_BADUTF8 (-10)
- A string that contains an invalid UTF-8 byte sequence was passed as a
+ A string that contains an invalid UTF-8 byte sequence was passed as a
subject.
PCRE_ERROR_BADUTF8_OFFSET (-11)
The UTF-8 byte sequence that was passed as a subject was valid, but the
- value of startoffset did not point to the beginning of a UTF-8 charac-
+ value of startoffset did not point to the beginning of a UTF-8 charac-
ter.
PCRE_ERROR_PARTIAL (-12)
- The subject string did not match, but it did match partially. See the
+ The subject string did not match, but it did match partially. See the
pcrepartial documentation for details of partial matching.
PCRE_ERROR_BADPARTIAL (-13)
- The PCRE_PARTIAL option was used with a compiled pattern containing
- items that are not supported for partial matching. See the pcrepartial
+ The PCRE_PARTIAL option was used with a compiled pattern containing
+ items that are not supported for partial matching. See the pcrepartial
documentation for details of partial matching.
PCRE_ERROR_INTERNAL (-14)
- An unexpected internal error has occurred. This error could be caused
+ An unexpected internal error has occurred. This error could be caused
by a bug in PCRE or by overwriting of the compiled pattern.
PCRE_ERROR_BADCOUNT (-15)
- This error is given if the value of the ovecsize argument is negative.
+ This error is given if the value of the ovecsize argument is negative.
+
+ PCRE_ERROR_RECURSIONLIMIT (-21)
+
+ The internal recursion limit, as specified by the match_limit_recursion
+ field in a pcre_extra structure (or defaulted) was reached. See the
+ description above.
+
+ PCRE_ERROR_NULLWSLIMIT (-22)
+
+ When a group that can match an empty substring is repeated with an
+ unbounded upper limit, the subject position at the start of the group
+ must be remembered, so that a test for an empty string can be made when
+ the end of the group is reached. Some workspace is required for this;
+ if it runs out, this error is given.
+
+ PCRE_ERROR_BADNEWLINE (-23)
+
+ An invalid combination of PCRE_NEWLINE_xxx options was given.
+
+ Error numbers -16 to -20 are not used by pcre_exec().
EXTRACTING CAPTURED SUBSTRINGS BY NUMBER
@@ -1907,57 +1990,58 @@ EXTRACTING CAPTURED SUBSTRINGS BY NUMBER
int pcre_get_substring_list(const char *subject,
int *ovector, int stringcount, const char ***listptr);
- Captured substrings can be accessed directly by using the offsets
- returned by pcre_exec() in ovector. For convenience, the functions
+ Captured substrings can be accessed directly by using the offsets
+ returned by pcre_exec() in ovector. For convenience, the functions
pcre_copy_substring(), pcre_get_substring(), and pcre_get_sub-
- string_list() are provided for extracting captured substrings as new,
- separate, zero-terminated strings. These functions identify substrings
- by number. The next section describes functions for extracting named
+ string_list() are provided for extracting captured substrings as new,
+ separate, zero-terminated strings. These functions identify substrings
+ by number. The next section describes functions for extracting named
substrings.
- A substring that contains a binary zero is correctly extracted and has
- a further zero added on the end, but the result is not, of course, a C
- string. However, you can process such a string by referring to the
- length that is returned by pcre_copy_substring() and pcre_get_sub-
+ A substring that contains a binary zero is correctly extracted and has
+ a further zero added on the end, but the result is not, of course, a C
+ string. However, you can process such a string by referring to the
+ length that is returned by pcre_copy_substring() and pcre_get_sub-
string(). Unfortunately, the interface to pcre_get_substring_list() is
- not adequate for handling strings containing binary zeros, because the
+ not adequate for handling strings containing binary zeros, because the
end of the final string is not independently indicated.
- The first three arguments are the same for all three of these func-
- tions: subject is the subject string that has just been successfully
+ The first three arguments are the same for all three of these func-
+ tions: subject is the subject string that has just been successfully
matched, ovector is a pointer to the vector of integer offsets that was
passed to pcre_exec(), and stringcount is the number of substrings that
- were captured by the match, including the substring that matched the
+ were captured by the match, including the substring that matched the
entire regular expression. This is the value returned by pcre_exec() if
- it is greater than zero. If pcre_exec() returned zero, indicating that
- it ran out of space in ovector, the value passed as stringcount should
+ it is greater than zero. If pcre_exec() returned zero, indicating that
+ it ran out of space in ovector, the value passed as stringcount should
be the number of elements in the vector divided by three.
- The functions pcre_copy_substring() and pcre_get_substring() extract a
- single substring, whose number is given as stringnumber. A value of
- zero extracts the substring that matched the entire pattern, whereas
- higher values extract the captured substrings. For pcre_copy_sub-
- string(), the string is placed in buffer, whose length is given by
- buffersize, while for pcre_get_substring() a new block of memory is
- obtained via pcre_malloc, and its address is returned via stringptr.
- The yield of the function is the length of the string, not including
- the terminating zero, or one of
+ The functions pcre_copy_substring() and pcre_get_substring() extract a
+ single substring, whose number is given as stringnumber. A value of
+ zero extracts the substring that matched the entire pattern, whereas
+ higher values extract the captured substrings. For pcre_copy_sub-
+ string(), the string is placed in buffer, whose length is given by
+ buffersize, while for pcre_get_substring() a new block of memory is
+ obtained via pcre_malloc, and its address is returned via stringptr.
+ The yield of the function is the length of the string, not including
+ the terminating zero, or one of these error codes:
PCRE_ERROR_NOMEMORY (-6)
- The buffer was too small for pcre_copy_substring(), or the attempt to
+ The buffer was too small for pcre_copy_substring(), or the attempt to
get memory failed for pcre_get_substring().
PCRE_ERROR_NOSUBSTRING (-7)
There is no substring whose number is stringnumber.
- The pcre_get_substring_list() function extracts all available sub-
- strings and builds a list of pointers to them. All this is done in a
+ The pcre_get_substring_list() function extracts all available sub-
+ strings and builds a list of pointers to them. All this is done in a
single block of memory that is obtained via pcre_malloc. The address of
- the memory block is returned via listptr, which is also the start of
- the list of string pointers. The end of the list is marked by a NULL
- pointer. The yield of the function is zero if all went well, or
+ the memory block is returned via listptr, which is also the start of
+ the list of string pointers. The end of the list is marked by a NULL
+ pointer. The yield of the function is zero if all went well, or the
+ error code
PCRE_ERROR_NOMEMORY (-6)
@@ -1999,7 +2083,7 @@ EXTRACTING CAPTURED SUBSTRINGS BY NAME
To extract a substring by name, you first have to find associated num-
ber. For example, for this pattern
- (a+)b(?P<xxx>\d+)...
+ (a+)b(?<xxx>\d+)...
the number of the subpattern called "xxx" is 2. If the name is known to
be unique (PCRE_DUPNAMES was not set), you can find the number from the
@@ -2050,11 +2134,11 @@ DUPLICATE SUBPATTERN NAMES
third and fourth are pointers to variables which are updated by the
function. After it has run, they point to the first and last entries in
the name-to-number table for the given name. The function itself
- returns the length of each entry, or PCRE_ERROR_NOSUBSTRING if there
- are none. The format of the table is described above in the section
- entitled Information about a pattern. Given all the relevant entries
- for the name, you can extract each of their numbers, and hence the cap-
- tured data, if any.
+ returns the length of each entry, or PCRE_ERROR_NOSUBSTRING (-7) if
+ there are none. The format of the table is described above in the sec-
+ tion entitled Information about a pattern. Given all the relevant
+ entries for the name, you can extract each of their numbers, and hence
+ the captured data, if any.
FINDING ALL POSSIBLE MATCHES
@@ -2083,23 +2167,24 @@ MATCHING A PATTERN: THE ALTERNATIVE FUNCTION
int *workspace, int wscount);
The function pcre_dfa_exec() is called to match a subject string
- against a compiled pattern, using a "DFA" matching algorithm. This has
- different characteristics to the normal algorithm, and is not compati-
- ble with Perl. Some of the features of PCRE patterns are not supported.
- Nevertheless, there are times when this kind of matching can be useful.
- For a discussion of the two matching algorithms, see the pcrematching
- documentation.
+ against a compiled pattern, using a matching algorithm that scans the
+ subject string just once, and does not backtrack. This has different
+ characteristics to the normal algorithm, and is not compatible with
+ Perl. Some of the features of PCRE patterns are not supported. Never-
+ theless, there are times when this kind of matching can be useful. For
+ a discussion of the two matching algorithms, see the pcrematching docu-
+ mentation.
- The arguments for the pcre_dfa_exec() function are the same as for
+ The arguments for the pcre_dfa_exec() function are the same as for
pcre_exec(), plus two extras. The ovector argument is used in a differ-
- ent way, and this is described below. The other common arguments are
- used in the same way as for pcre_exec(), so their description is not
+ ent way, and this is described below. The other common arguments are
+ used in the same way as for pcre_exec(), so their description is not
repeated here.
- The two additional arguments provide workspace for the function. The
- workspace vector should contain at least 20 elements. It is used for
+ The two additional arguments provide workspace for the function. The
+ workspace vector should contain at least 20 elements. It is used for
keeping track of multiple paths through the pattern tree. More
- workspace will be needed for patterns and subjects where there are a
+ workspace will be needed for patterns and subjects where there are a
lot of potential matches.
Here is an example of a simple call to pcre_dfa_exec():
@@ -2121,47 +2206,47 @@ MATCHING A PATTERN: THE ALTERNATIVE FUNCTION
Option bits for pcre_dfa_exec()
- The unused bits of the options argument for pcre_dfa_exec() must be
- zero. The only bits that may be set are PCRE_ANCHORED, PCRE_NEW-
- LINE_xxx, PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NO_UTF8_CHECK,
+ The unused bits of the options argument for pcre_dfa_exec() must be
+ zero. The only bits that may be set are PCRE_ANCHORED, PCRE_NEW-
+ LINE_xxx, PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NO_UTF8_CHECK,
PCRE_PARTIAL, PCRE_DFA_SHORTEST, and PCRE_DFA_RESTART. All but the last
three of these are the same as for pcre_exec(), so their description is
not repeated here.
PCRE_PARTIAL
- This has the same general effect as it does for pcre_exec(), but the
- details are slightly different. When PCRE_PARTIAL is set for
- pcre_dfa_exec(), the return code PCRE_ERROR_NOMATCH is converted into
- PCRE_ERROR_PARTIAL if the end of the subject is reached, there have
+ This has the same general effect as it does for pcre_exec(), but the
+ details are slightly different. When PCRE_PARTIAL is set for
+ pcre_dfa_exec(), the return code PCRE_ERROR_NOMATCH is converted into
+ PCRE_ERROR_PARTIAL if the end of the subject is reached, there have
been no complete matches, but there is still at least one matching pos-
- sibility. The portion of the string that provided the partial match is
+ sibility. The portion of the string that provided the partial match is
set as the first matching string.
PCRE_DFA_SHORTEST
- Setting the PCRE_DFA_SHORTEST option causes the matching algorithm to
- stop as soon as it has found one match. Because of the way the DFA
- algorithm works, this is necessarily the shortest possible match at the
- first possible matching point in the subject string.
+ Setting the PCRE_DFA_SHORTEST option causes the matching algorithm to
+ stop as soon as it has found one match. Because of the way the alterna-
+ tive algorithm works, this is necessarily the shortest possible match
+ at the first possible matching point in the subject string.
PCRE_DFA_RESTART
- When pcre_dfa_exec() is called with the PCRE_PARTIAL option, and
- returns a partial match, it is possible to call it again, with addi-
- tional subject characters, and have it continue with the same match.
- The PCRE_DFA_RESTART option requests this action; when it is set, the
- workspace and wscount options must reference the same vector as before
- because data about the match so far is left in them after a partial
- match. There is more discussion of this facility in the pcrepartial
+ When pcre_dfa_exec() is called with the PCRE_PARTIAL option, and
+ returns a partial match, it is possible to call it again, with addi-
+ tional subject characters, and have it continue with the same match.
+ The PCRE_DFA_RESTART option requests this action; when it is set, the
+ workspace and wscount options must reference the same vector as before
+ because data about the match so far is left in them after a partial
+ match. There is more discussion of this facility in the pcrepartial
documentation.
Successful returns from pcre_dfa_exec()
- When pcre_dfa_exec() succeeds, it may have matched more than one sub-
+ When pcre_dfa_exec() succeeds, it may have matched more than one sub-
string in the subject. Note, however, that all the matches from one run
- of the function start at the same point in the subject. The shorter
- matches are all initial substrings of the longer matches. For example,
+ of the function start at the same point in the subject. The shorter
+ matches are all initial substrings of the longer matches. For example,
if the pattern
<.*>
@@ -2176,58 +2261,64 @@ MATCHING A PATTERN: THE ALTERNATIVE FUNCTION
<something> <something else>
<something> <something else> <something further>
- On success, the yield of the function is a number greater than zero,
- which is the number of matched substrings. The substrings themselves
- are returned in ovector. Each string uses two elements; the first is
- the offset to the start, and the second is the offset to the end. All
- the strings have the same start offset. (Space could have been saved by
- giving this only once, but it was decided to retain some compatibility
- with the way pcre_exec() returns data, even though the meaning of the
- strings is different.)
+ On success, the yield of the function is a number greater than zero,
+ which is the number of matched substrings. The substrings themselves
+ are returned in ovector. Each string uses two elements; the first is
+ the offset to the start, and the second is the offset to the end. In
+ fact, all the strings have the same start offset. (Space could have
+ been saved by giving this only once, but it was decided to retain some
+ compatibility with the way pcre_exec() returns data, even though the
+ meaning of the strings is different.)
The strings are returned in reverse order of length; that is, the long-
- est matching string is given first. If there were too many matches to
- fit into ovector, the yield of the function is zero, and the vector is
+ est matching string is given first. If there were too many matches to
+ fit into ovector, the yield of the function is zero, and the vector is
filled with the longest matches.
Error returns from pcre_dfa_exec()
- The pcre_dfa_exec() function returns a negative number when it fails.
- Many of the errors are the same as for pcre_exec(), and these are
- described above. There are in addition the following errors that are
+ The pcre_dfa_exec() function returns a negative number when it fails.
+ Many of the errors are the same as for pcre_exec(), and these are
+ described above. There are in addition the following errors that are
specific to pcre_dfa_exec():
PCRE_ERROR_DFA_UITEM (-16)
- This return is given if pcre_dfa_exec() encounters an item in the pat-
- tern that it does not support, for instance, the use of \C or a back
+ This return is given if pcre_dfa_exec() encounters an item in the pat-
+ tern that it does not support, for instance, the use of \C or a back
reference.
PCRE_ERROR_DFA_UCOND (-17)
- This return is given if pcre_dfa_exec() encounters a condition item in
- a pattern that uses a back reference for the condition. This is not
- supported.
+ This return is given if pcre_dfa_exec() encounters a condition item
+ that uses a back reference for the condition, or a test for recursion
+ in a specific group. These are not supported.
PCRE_ERROR_DFA_UMLIMIT (-18)
- This return is given if pcre_dfa_exec() is called with an extra block
+ This return is given if pcre_dfa_exec() is called with an extra block
that contains a setting of the match_limit field. This is not supported
(it is meaningless).
PCRE_ERROR_DFA_WSSIZE (-19)
- This return is given if pcre_dfa_exec() runs out of space in the
+ This return is given if pcre_dfa_exec() runs out of space in the
workspace vector.
PCRE_ERROR_DFA_RECURSE (-20)
- When a recursive subpattern is processed, the matching function calls
- itself recursively, using private vectors for ovector and workspace.
- This error is given if the output vector is not large enough. This
+ When a recursive subpattern is processed, the matching function calls
+ itself recursively, using private vectors for ovector and workspace.
+ This error is given if the output vector is not large enough. This
should be extremely rare, as a vector of size 1000 is used.
-Last updated: 08 June 2006
+
+SEE ALSO
+
+ pcrebuild(3), pcrecallout(3), pcrecpp(3)(3), pcrematching(3), pcrepar-
+ tial(3), pcreposix(3), pcreprecompile(3), pcresample(3), pcrestack(3).
+
+Last updated: 30 November 2006
Copyright (c) 1997-2006 University of Cambridge.
------------------------------------------------------------------------------
@@ -2401,45 +2492,46 @@ NAME
DIFFERENCES BETWEEN PCRE AND PERL
This document describes the differences in the ways that PCRE and Perl
- handle regular expressions. The differences described here are with
- respect to Perl 5.8.
+ handle regular expressions. The differences described here are mainly
+ with respect to Perl 5.8, though PCRE version 7.0 contains some fea-
+ tures that are expected to be in the forthcoming Perl 5.10.
- 1. PCRE has only a subset of Perl's UTF-8 and Unicode support. Details
- of what it does have are given in the section on UTF-8 support in the
+ 1. PCRE has only a subset of Perl's UTF-8 and Unicode support. Details
+ of what it does have are given in the section on UTF-8 support in the
main pcre page.
2. PCRE does not allow repeat quantifiers on lookahead assertions. Perl
- permits them, but they do not mean what you might think. For example,
+ permits them, but they do not mean what you might think. For example,
(?!a){3} does not assert that the next three characters are not "a". It
just asserts that the next character is not "a" three times.
- 3. Capturing subpatterns that occur inside negative lookahead asser-
- tions are counted, but their entries in the offsets vector are never
- set. Perl sets its numerical variables from any such patterns that are
+ 3. Capturing subpatterns that occur inside negative lookahead asser-
+ tions are counted, but their entries in the offsets vector are never
+ set. Perl sets its numerical variables from any such patterns that are
matched before the assertion fails to match something (thereby succeed-
- ing), but only if the negative lookahead assertion contains just one
+ ing), but only if the negative lookahead assertion contains just one
branch.
- 4. Though binary zero characters are supported in the subject string,
+ 4. Though binary zero characters are supported in the subject string,
they are not allowed in a pattern string because it is passed as a nor-
mal C string, terminated by zero. The escape sequence \0 can be used in
the pattern to represent a binary zero.
- 5. The following Perl escape sequences are not supported: \l, \u, \L,
+ 5. The following Perl escape sequences are not supported: \l, \u, \L,
\U, and \N. In fact these are implemented by Perl's general string-han-
- dling and are not part of its pattern matching engine. If any of these
+ dling and are not part of its pattern matching engine. If any of these
are encountered by PCRE, an error is generated.
- 6. The Perl escape sequences \p, \P, and \X are supported only if PCRE
- is built with Unicode character property support. The properties that
- can be tested with \p and \P are limited to the general category prop-
- erties such as Lu and Nd, script names such as Greek or Han, and the
+ 6. The Perl escape sequences \p, \P, and \X are supported only if PCRE
+ is built with Unicode character property support. The properties that
+ can be tested with \p and \P are limited to the general category prop-
+ erties such as Lu and Nd, script names such as Greek or Han, and the
derived properties Any and L&.
7. PCRE does support the \Q...\E escape for quoting substrings. Charac-
- ters in between are treated as literals. This is slightly different
- from Perl in that $ and @ are also handled as literals inside the
- quotes. In Perl, they cause variable interpolation (but of course PCRE
+ ters in between are treated as literals. This is slightly different
+ from Perl in that $ and @ are also handled as literals inside the
+ quotes. In Perl, they cause variable interpolation (but of course PCRE
does not have variables). Note the following examples:
Pattern PCRE matches Perl matches
@@ -2449,66 +2541,61 @@ DIFFERENCES BETWEEN PCRE AND PERL
\Qabc\$xyz\E abc\$xyz abc\$xyz
\Qabc\E\$\Qxyz\E abc$xyz abc$xyz
- The \Q...\E sequence is recognized both inside and outside character
+ The \Q...\E sequence is recognized both inside and outside character
classes.
- 8. Fairly obviously, PCRE does not support the (?{code}) and (?p{code})
- constructions. However, there is support for recursive patterns using
- the non-Perl items (?R), (?number), and (?P>name). Also, the PCRE
- "callout" feature allows an external function to be called during pat-
+ 8. Fairly obviously, PCRE does not support the (?{code}) and (??{code})
+ constructions. However, there is support for recursive patterns. This
+ is not available in Perl 5.8, but will be in Perl 5.10. Also, the PCRE
+ "callout" feature allows an external function to be called during pat-
tern matching. See the pcrecallout documentation for details.
- 9. There are some differences that are concerned with the settings of
- captured strings when part of a pattern is repeated. For example,
- matching "aba" against the pattern /^(a(b)?)+$/ in Perl leaves $2
+ 9. Subpatterns that are called recursively or as "subroutines" are
+ always treated as atomic groups in PCRE. This is like Python, but
+ unlike Perl.
+
+ 10. There are some differences that are concerned with the settings of
+ captured strings when part of a pattern is repeated. For example,
+ matching "aba" against the pattern /^(a(b)?)+$/ in Perl leaves $2
unset, but in PCRE it is set to "b".
- 10. PCRE provides some extensions to the Perl regular expression facil-
- ities:
+ 11. PCRE provides some extensions to the Perl regular expression facil-
+ ities. Perl 5.10 will include new features that are not in earlier
+ versions, some of which (such as named parentheses) have been in PCRE
+ for some time. This list is with respect to Perl 5.10:
- (a) Although lookbehind assertions must match fixed length strings,
+ (a) Although lookbehind assertions must match fixed length strings,
each alternative branch of a lookbehind assertion can match a different
length of string. Perl requires them all to have the same length.
- (b) If PCRE_DOLLAR_ENDONLY is set and PCRE_MULTILINE is not set, the $
+ (b) If PCRE_DOLLAR_ENDONLY is set and PCRE_MULTILINE is not set, the $
meta-character matches only at the very end of the string.
(c) If PCRE_EXTRA is set, a backslash followed by a letter with no spe-
- cial meaning is faulted. Otherwise, like Perl, the backslash is
+ cial meaning is faulted. Otherwise, like Perl, the backslash is
ignored. (Perl can be made to issue a warning.)
- (d) If PCRE_UNGREEDY is set, the greediness of the repetition quanti-
+ (d) If PCRE_UNGREEDY is set, the greediness of the repetition quanti-
fiers is inverted, that is, by default they are not greedy, but if fol-
lowed by a question mark they are.
(e) PCRE_ANCHORED can be used at matching time to force a pattern to be
tried only at the first matching position in the subject string.
- (f) The PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, and PCRE_NO_AUTO_CAP-
+ (f) The PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, and PCRE_NO_AUTO_CAP-
TURE options for pcre_exec() have no Perl equivalents.
- (g) The (?R), (?number), and (?P>name) constructs allows for recursive
- pattern matching (Perl can do this using the (?p{code}) construct,
- which PCRE cannot support.)
-
- (h) PCRE supports named capturing substrings, using the Python syntax.
-
- (i) PCRE supports the possessive quantifier "++" syntax, taken from
- Sun's Java package.
+ (g) The callout facility is PCRE-specific.
- (j) The (R) condition, for testing recursion, is a PCRE extension.
+ (h) The partial matching facility is PCRE-specific.
- (k) The callout facility is PCRE-specific.
-
- (l) The partial matching facility is PCRE-specific.
-
- (m) Patterns compiled by PCRE can be saved and re-used at a later time,
+ (i) Patterns compiled by PCRE can be saved and re-used at a later time,
even on different hosts that have the other endianness.
- (n) The alternative matching function (pcre_dfa_exec()) matches in a
+ (j) The alternative matching function (pcre_dfa_exec()) matches in a
different way and is not Perl-compatible.
-Last updated: 06 June 2006
+Last updated: 28 November 2006
Copyright (c) 1997-2006 University of Cambridge.
------------------------------------------------------------------------------
@@ -2545,6 +2632,9 @@ PCRE REGULAR EXPRESSION DETAILS
function, and how it differs from the normal function, are discussed in
the pcrematching page.
+
+CHARACTERS AND METACHARACTERS
+
A regular expression is a pattern that is matched against a subject
string from left to right. Most characters stand for themselves in a
pattern, and match the corresponding characters in the subject. As a
@@ -2569,8 +2659,8 @@ PCRE REGULAR EXPRESSION DETAILS
There are two different sets of metacharacters: those that are recog-
nized anywhere in the pattern except within square brackets, and those
- that are recognized in square brackets. Outside square brackets, the
- metacharacters are as follows:
+ that are recognized within square brackets. Outside square brackets,
+ the metacharacters are as follows:
\ general escape character with several uses
^ assert start of string (or line, in multiline mode)
@@ -2692,7 +2782,7 @@ BACKSLASH
Inside a character class, or if the decimal number is greater than 9
and there have not been that many capturing subpatterns, PCRE re-reads
- up to three octal digits following the backslash, ane uses them to gen-
+ up to three octal digits following the backslash, and uses them to gen-
erate a data character. Any subsequent digits stand for themselves. In
non-UTF-8 mode, the value of a character specified in octal must be
less than \400. In UTF-8 mode, values up to \777 are permitted. For
@@ -2719,13 +2809,21 @@ BACKSLASH
All the sequences that define a single character value can be used both
inside and outside character classes. In addition, inside a character
class, the sequence \b is interpreted as the backspace character (hex
- 08), and the sequence \X is interpreted as the character "X". Outside a
- character class, these sequences have different meanings (see below).
+ 08), and the sequences \R and \X are interpreted as the characters "R"
+ and "X", respectively. Outside a character class, these sequences have
+ different meanings (see below).
+
+ Absolute and relative back references
+
+ The sequence \g followed by a positive or negative number, optionally
+ enclosed in braces, is an absolute or relative back reference. Back
+ references are discussed later, following the discussion of parenthe-
+ sized subpatterns.
Generic character types
- The third use of backslash is for specifying generic character types.
- The following are always recognized:
+ Another use of backslash is for specifying generic character types. The
+ following are always recognized:
\d any decimal digit
\D any character that is not a decimal digit
@@ -2762,6 +2860,28 @@ BACKSLASH
code character property support is available. The use of locales with
Unicode is discouraged.
+ Newline sequences
+
+ Outside a character class, the escape sequence \R matches any Unicode
+ newline sequence. This is an extension to Perl. In non-UTF-8 mode \R is
+ equivalent to the following:
+
+ (?>\r\n|\n|\x0b|\f|\r|\x85)
+
+ This is an example of an "atomic group", details of which are given
+ below. This particular group matches either the two-character sequence
+ CR followed by LF, or one of the single characters LF (linefeed,
+ U+000A), VT (vertical tab, U+000B), FF (formfeed, U+000C), CR (carriage
+ return, U+000D), or NEL (next line, U+0085). The two-character sequence
+ is treated as a single unit that cannot be split.
+
+ In UTF-8 mode, two additional characters whose codepoints are greater
+ than 255 are added: LS (line separator, U+2028) and PS (paragraph sepa-
+ rator, U+2029). Unicode character property support is not needed for
+ these characters to be recognized.
+
+ Inside a character class, \R matches the letter "R".
+
Unicode character properties
When PCRE is built with Unicode character property support, three addi-
@@ -2788,15 +2908,15 @@ BACKSLASH
Those that are not part of an identified script are lumped together as
"Common". The current list of scripts is:
- Arabic, Armenian, Bengali, Bopomofo, Braille, Buginese, Buhid, Cana-
- dian_Aboriginal, Cherokee, Common, Coptic, Cypriot, Cyrillic, Deseret,
- Devanagari, Ethiopic, Georgian, Glagolitic, Gothic, Greek, Gujarati,
- Gurmukhi, Han, Hangul, Hanunoo, Hebrew, Hiragana, Inherited, Kannada,
- Katakana, Kharoshthi, Khmer, Lao, Latin, Limbu, Linear_B, Malayalam,
- Mongolian, Myanmar, New_Tai_Lue, Ogham, Old_Italic, Old_Persian, Oriya,
- Osmanya, Runic, Shavian, Sinhala, Syloti_Nagri, Syriac, Tagalog, Tag-
- banwa, Tai_Le, Tamil, Telugu, Thaana, Thai, Tibetan, Tifinagh,
- Ugaritic, Yi.
+ Arabic, Armenian, Balinese, Bengali, Bopomofo, Braille, Buginese,
+ Buhid, Canadian_Aboriginal, Cherokee, Common, Coptic, Cuneiform,
+ Cypriot, Cyrillic, Deseret, Devanagari, Ethiopic, Georgian, Glagolitic,
+ Gothic, Greek, Gujarati, Gurmukhi, Han, Hangul, Hanunoo, Hebrew, Hira-
+ gana, Inherited, Kannada, Katakana, Kharoshthi, Khmer, Lao, Latin,
+ Limbu, Linear_B, Malayalam, Mongolian, Myanmar, New_Tai_Lue, Nko,
+ Ogham, Old_Italic, Old_Persian, Oriya, Osmanya, Phags_Pa, Phoenician,
+ Runic, Shavian, Sinhala, Syloti_Nagri, Syriac, Tagalog, Tagbanwa,
+ Tai_Le, Tamil, Telugu, Thaana, Thai, Tibetan, Tifinagh, Ugaritic, Yi.
Each character has exactly one general category property, specified by
a two-letter abbreviation. For compatibility with Perl, negation can be
@@ -2889,7 +3009,7 @@ BACKSLASH
Simple assertions
- The fourth use of backslash is for certain simple assertions. An asser-
+ The final use of backslash is for certain simple assertions. An asser-
tion specifies a condition that has to be met at a particular point in
a match, without consuming any characters from the subject string. The
use of subpatterns for more complicated assertions is described below.
@@ -2897,10 +3017,11 @@ BACKSLASH
\b matches at a word boundary
\B matches when not at a word boundary
- \A matches at start of subject
- \Z matches at end of subject or before newline at end
- \z matches at end of subject
- \G matches at first matching position in subject
+ \A matches at the start of the subject
+ \Z matches at the end of the subject
+ also matches before a newline at the end of the subject
+ \z matches only at the end of the subject
+ \G matches at the first matching position in the subject
These assertions may not appear in character classes (but note that \b
has a different meaning, namely the backspace character, inside a char-
@@ -2997,30 +3118,34 @@ FULL STOP (PERIOD, DOT)
Outside a character class, a dot in the pattern matches any one charac-
ter in the subject string except (by default) a character that signi-
fies the end of a line. In UTF-8 mode, the matched character may be
- more than one byte long. When a line ending is defined as a single
- character (CR or LF), dot never matches that character; when the two-
- character sequence CRLF is used, dot does not match CR if it is immedi-
- ately followed by LF, but otherwise it matches all characters (includ-
- ing isolated CRs and LFs).
-
- The behaviour of dot with regard to newlines can be changed. If the
- PCRE_DOTALL option is set, a dot matches any one character, without
- exception. If newline is defined as the two-character sequence CRLF, it
- takes two dots to match it.
-
- The handling of dot is entirely independent of the handling of circum-
- flex and dollar, the only relationship being that they both involve
+ more than one byte long.
+
+ When a line ending is defined as a single character, dot never matches
+ that character; when the two-character sequence CRLF is used, dot does
+ not match CR if it is immediately followed by LF, but otherwise it
+ matches all characters (including isolated CRs and LFs). When any Uni-
+ code line endings are being recognized, dot does not match CR or LF or
+ any of the other line ending characters.
+
+ The behaviour of dot with regard to newlines can be changed. If the
+ PCRE_DOTALL option is set, a dot matches any one character, without
+ exception. If the two-character sequence CRLF is present in the subject
+ string, it takes two dots to match it.
+
+ The handling of dot is entirely independent of the handling of circum-
+ flex and dollar, the only relationship being that they both involve
newlines. Dot has no special meaning in a character class.
MATCHING A SINGLE BYTE
Outside a character class, the escape sequence \C matches any one byte,
- both in and out of UTF-8 mode. Unlike a dot, it always matches CR and
- LF. The feature is provided in Perl in order to match individual bytes
- in UTF-8 mode. Because it breaks up UTF-8 characters into individual
- bytes, what remains in the string may be a malformed UTF-8 string. For
- this reason, the \C escape sequence is best avoided.
+ both in and out of UTF-8 mode. Unlike a dot, it always matches any
+ line-ending characters. The feature is provided in Perl in order to
+ match individual bytes in UTF-8 mode. Because it breaks up UTF-8 char-
+ acters into individual bytes, what remains in the string may be a mal-
+ formed UTF-8 string. For this reason, the \C escape sequence is best
+ avoided.
PCRE does not allow \C to appear in lookbehind assertions (described
below), because in UTF-8 mode this would make it impossible to calcu-
@@ -3067,11 +3192,11 @@ SQUARE BRACKETS AND CHARACTER CLASSES
PCRE is compiled with Unicode property support as well as with UTF-8
support.
- Characters that might indicate line breaks (CR and LF) are never
- treated in any special way when matching character classes, whatever
- line-ending sequence is in use, and whatever setting of the PCRE_DOTALL
- and PCRE_MULTILINE options is used. A class such as [^a] always matches
- one of these characters.
+ Characters that might indicate line breaks are never treated in any
+ special way when matching character classes, whatever line-ending
+ sequence is in use, and whatever setting of the PCRE_DOTALL and
+ PCRE_MULTILINE options is used. A class such as [^a] always matches one
+ of these characters.
The minus (hyphen) character can be used to specify a range of charac-
ters in a character class. For example, [d-m] matches any letter
@@ -3203,26 +3328,27 @@ INTERNAL OPTION SETTING
PCRE extracts it into the global options (and it will therefore show up
in data extracted by the pcre_fullinfo() function).
- An option change within a subpattern affects only that part of the cur-
- rent pattern that follows it, so
+ An option change within a subpattern (see below for a description of
+ subpatterns) affects only that part of the current pattern that follows
+ it, so
(a(?i)b)c
matches abc and aBc and no other strings (assuming PCRE_CASELESS is not
- used). By this means, options can be made to have different settings
- in different parts of the pattern. Any changes made in one alternative
- do carry on into subsequent branches within the same subpattern. For
+ used). By this means, options can be made to have different settings
+ in different parts of the pattern. Any changes made in one alternative
+ do carry on into subsequent branches within the same subpattern. For
example,
(a(?i)b|c)
- matches "ab", "aB", "c", and "C", even though when matching "C" the
- first branch is abandoned before the option setting. This is because
- the effects of option settings happen at compile time. There would be
+ matches "ab", "aB", "c", and "C", even though when matching "C" the
+ first branch is abandoned before the option setting. This is because
+ the effects of option settings happen at compile time. There would be
some very weird behaviour otherwise.
- The PCRE-specific options PCRE_DUPNAMES, PCRE_UNGREEDY, and PCRE_EXTRA
- can be changed in the same way as the Perl-compatible options by using
+ The PCRE-specific options PCRE_DUPNAMES, PCRE_UNGREEDY, and PCRE_EXTRA
+ can be changed in the same way as the Perl-compatible options by using
the characters J, U and X respectively.
@@ -3235,18 +3361,18 @@ SUBPATTERNS
cat(aract|erpillar|)
- matches one of the words "cat", "cataract", or "caterpillar". Without
- the parentheses, it would match "cataract", "erpillar" or the empty
+ matches one of the words "cat", "cataract", or "caterpillar". Without
+ the parentheses, it would match "cataract", "erpillar" or an empty
string.
- 2. It sets up the subpattern as a capturing subpattern. This means
- that, when the whole pattern matches, that portion of the subject
+ 2. It sets up the subpattern as a capturing subpattern. This means
+ that, when the whole pattern matches, that portion of the subject
string that matched the subpattern is passed back to the caller via the
- ovector argument of pcre_exec(). Opening parentheses are counted from
- left to right (starting from 1) to obtain numbers for the capturing
+ ovector argument of pcre_exec(). Opening parentheses are counted from
+ left to right (starting from 1) to obtain numbers for the capturing
subpatterns.
- For example, if the string "the red king" is matched against the pat-
+ For example, if the string "the red king" is matched against the pat-
tern
the ((red|white) (king|queen))
@@ -3254,51 +3380,56 @@ SUBPATTERNS
the captured substrings are "red king", "red", and "king", and are num-
bered 1, 2, and 3, respectively.
- The fact that plain parentheses fulfil two functions is not always
- helpful. There are often times when a grouping subpattern is required
- without a capturing requirement. If an opening parenthesis is followed
- by a question mark and a colon, the subpattern does not do any captur-
- ing, and is not counted when computing the number of any subsequent
- capturing subpatterns. For example, if the string "the white queen" is
+ The fact that plain parentheses fulfil two functions is not always
+ helpful. There are often times when a grouping subpattern is required
+ without a capturing requirement. If an opening parenthesis is followed
+ by a question mark and a colon, the subpattern does not do any captur-
+ ing, and is not counted when computing the number of any subsequent
+ capturing subpatterns. For example, if the string "the white queen" is
matched against the pattern
the ((?:red|white) (king|queen))
the captured substrings are "white queen" and "queen", and are numbered
- 1 and 2. The maximum number of capturing subpatterns is 65535, and the
- maximum depth of nesting of all subpatterns, both capturing and non-
- capturing, is 200.
+ 1 and 2. The maximum number of capturing subpatterns is 65535.
- As a convenient shorthand, if any option settings are required at the
- start of a non-capturing subpattern, the option letters may appear
+ As a convenient shorthand, if any option settings are required at the
+ start of a non-capturing subpattern, the option letters may appear
between the "?" and the ":". Thus the two patterns
(?i:saturday|sunday)
(?:(?i)saturday|sunday)
match exactly the same set of strings. Because alternative branches are
- tried from left to right, and options are not reset until the end of
- the subpattern is reached, an option setting in one branch does affect
- subsequent branches, so the above patterns match "SUNDAY" as well as
+ tried from left to right, and options are not reset until the end of
+ the subpattern is reached, an option setting in one branch does affect
+ subsequent branches, so the above patterns match "SUNDAY" as well as
"Saturday".
NAMED SUBPATTERNS
- Identifying capturing parentheses by number is simple, but it can be
- very hard to keep track of the numbers in complicated regular expres-
- sions. Furthermore, if an expression is modified, the numbers may
- change. To help with this difficulty, PCRE supports the naming of sub-
- patterns, something that Perl does not provide. The Python syntax
- (?P<name>...) is used. References to capturing parentheses from other
- parts of the pattern, such as backreferences, recursion, and condi-
- tions, can be made by name as well as by number.
-
- Names consist of up to 32 alphanumeric characters and underscores.
- Named capturing parentheses are still allocated numbers as well as
- names. The PCRE API provides function calls for extracting the name-to-
- number translation table from a compiled pattern. There is also a con-
- venience function for extracting a captured substring by name.
+ Identifying capturing parentheses by number is simple, but it can be
+ very hard to keep track of the numbers in complicated regular expres-
+ sions. Furthermore, if an expression is modified, the numbers may
+ change. To help with this difficulty, PCRE supports the naming of sub-
+ patterns. This feature was not added to Perl until release 5.10. Python
+ had the feature earlier, and PCRE introduced it at release 4.0, using
+ the Python syntax. PCRE now supports both the Perl and the Python syn-
+ tax.
+
+ In PCRE, a subpattern can be named in one of three ways: (?<name>...)
+ or (?'name'...) as in Perl, or (?P<name>...) as in Python. References
+ to capturing parentheses from other parts of the pattern, such as back-
+ references, recursion, and conditions, can be made by name as well as
+ by number.
+
+ Names consist of up to 32 alphanumeric characters and underscores.
+ Named capturing parentheses are still allocated numbers as well as
+ names, exactly as if the names were not present. The PCRE API provides
+ function calls for extracting the name-to-number translation table from
+ a compiled pattern. There is also a convenience function for extracting
+ a captured substring by name.
By default, a name must be unique within a pattern, but it is possible
to relax this constraint by setting the PCRE_DUPNAMES option at compile
@@ -3308,15 +3439,15 @@ NAMED SUBPATTERNS
both cases you want to extract the abbreviation. This pattern (ignoring
the line breaks) does the job:
- (?P<DN>Mon|Fri|Sun)(?:day)?|
- (?P<DN>Tue)(?:sday)?|
- (?P<DN>Wed)(?:nesday)?|
- (?P<DN>Thu)(?:rsday)?|
- (?P<DN>Sat)(?:urday)?
+ (?<DN>Mon|Fri|Sun)(?:day)?|
+ (?<DN>Tue)(?:sday)?|
+ (?<DN>Wed)(?:nesday)?|
+ (?<DN>Thu)(?:rsday)?|
+ (?<DN>Sat)(?:urday)?
There are five capturing substrings, but only one is ever set after a
match. The convenience function for extracting the data by name
- returns the substring for the first, and in this example, the only,
+ returns the substring for the first (and in this example, the only)
subpattern of that name that matched. This saves searching to find
which numbered subpattern it was. If you make a reference to a non-
unique named subpattern from elsewhere in the pattern, the one that
@@ -3331,9 +3462,10 @@ REPETITION
following items:
a literal data character
- the . metacharacter
+ the dot metacharacter
the \C escape sequence
the \X escape sequence (in UTF-8 mode with Unicode properties)
+ the \R escape sequence
an escape such as \d that matches a single character
a character class
a back reference (see next section)
@@ -3373,8 +3505,8 @@ REPETITION
The quantifier {0} is permitted, causing the expression to behave as if
the previous item and the quantifier were not present.
- For convenience (and historical compatibility) the three most common
- quantifiers have single-character abbreviations:
+ For convenience, the three most common quantifiers have single-charac-
+ ter abbreviations:
* is equivalent to {0,}
+ is equivalent to {1,}
@@ -3426,7 +3558,7 @@ REPETITION
which matches one digit by preference, but can match two if that is the
only way the rest of the pattern matches.
- If the PCRE_UNGREEDY option is set (an option which is not available in
+ If the PCRE_UNGREEDY option is set (an option that is not available in
Perl), the quantifiers are not greedy by default, but individual ones
can be made greedy by following them with a question mark. In other
words, it inverts the default behaviour.
@@ -3437,24 +3569,25 @@ REPETITION
minimum or maximum.
If a pattern starts with .* or .{0,} and the PCRE_DOTALL option (equiv-
- alent to Perl's /s) is set, thus allowing the . to match newlines, the
- pattern is implicitly anchored, because whatever follows will be tried
- against every character position in the subject string, so there is no
- point in retrying the overall match at any position after the first.
- PCRE normally treats such a pattern as though it were preceded by \A.
-
- In cases where it is known that the subject string contains no new-
- lines, it is worth setting PCRE_DOTALL in order to obtain this opti-
+ alent to Perl's /s) is set, thus allowing the dot to match newlines,
+ the pattern is implicitly anchored, because whatever follows will be
+ tried against every character position in the subject string, so there
+ is no point in retrying the overall match at any position after the
+ first. PCRE normally treats such a pattern as though it were preceded
+ by \A.
+
+ In cases where it is known that the subject string contains no new-
+ lines, it is worth setting PCRE_DOTALL in order to obtain this opti-
mization, or alternatively using ^ to indicate anchoring explicitly.
- However, there is one situation where the optimization cannot be used.
- When .* is inside capturing parentheses that are the subject of a
- backreference elsewhere in the pattern, a match at the start may fail,
- and a later one succeed. Consider, for example:
+ However, there is one situation where the optimization cannot be used.
+ When .* is inside capturing parentheses that are the subject of a
+ backreference elsewhere in the pattern, a match at the start may fail
+ where a later one succeeds. Consider, for example:
(.*)abc\1
- If the subject is "xyz123abc123" the match point is the fourth charac-
+ If the subject is "xyz123abc123" the match point is the fourth charac-
ter. For this reason, such a pattern is not implicitly anchored.
When a capturing subpattern is repeated, the value captured is the sub-
@@ -3463,8 +3596,8 @@ REPETITION
(tweedle[dume]{3}\s*)+
has matched "tweedledum tweedledee" the value of the captured substring
- is "tweedledee". However, if there are nested capturing subpatterns,
- the corresponding captured values may have been set in previous itera-
+ is "tweedledee". However, if there are nested capturing subpatterns,
+ the corresponding captured values may have been set in previous itera-
tions. For example, after
/(a|(b))+/
@@ -3474,12 +3607,13 @@ REPETITION
ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS
- With both maximizing and minimizing repetition, failure of what follows
- normally causes the repeated item to be re-evaluated to see if a dif-
- ferent number of repeats allows the rest of the pattern to match. Some-
- times it is useful to prevent this, either to change the nature of the
- match, or to cause it fail earlier than it otherwise might, when the
- author of the pattern knows there is no point in carrying on.
+ With both maximizing ("greedy") and minimizing ("ungreedy" or "lazy")
+ repetition, failure of what follows normally causes the repeated item
+ to be re-evaluated to see if a different number of repeats allows the
+ rest of the pattern to match. Sometimes it is useful to prevent this,
+ either to change the nature of the match, or to cause it fail earlier
+ than it otherwise might, when the author of the pattern knows there is
+ no point in carrying on.
Consider, for example, the pattern \d+foo when applied to the subject
line
@@ -3493,10 +3627,9 @@ ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS
the means for specifying that once a subpattern has matched, it is not
to be re-evaluated in this way.
- If we use atomic grouping for the previous example, the matcher would
- give up immediately on failing to match "foo" the first time. The nota-
- tion is a kind of special parenthesis, starting with (?> as in this
- example:
+ If we use atomic grouping for the previous example, the matcher gives
+ up immediately on failing to match "foo" the first time. The notation
+ is a kind of special parenthesis, starting with (?> as in this example:
(?>\d+)foo
@@ -3528,63 +3661,95 @@ ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS
Possessive quantifiers are always greedy; the setting of the
PCRE_UNGREEDY option is ignored. They are a convenient notation for the
simpler forms of atomic group. However, there is no difference in the
- meaning or processing of a possessive quantifier and the equivalent
- atomic group.
-
- The possessive quantifier syntax is an extension to the Perl syntax.
- Jeffrey Friedl originated the idea (and the name) in the first edition
- of his book. Mike McCloskey liked it, so implemented it when he built
- Sun's Java package, and PCRE copied it from there.
-
- When a pattern contains an unlimited repeat inside a subpattern that
- can itself be repeated an unlimited number of times, the use of an
- atomic group is the only way to avoid some failing matches taking a
+ meaning of a possessive quantifier and the equivalent atomic group,
+ though there may be a performance difference; possessive quantifiers
+ should be slightly faster.
+
+ The possessive quantifier syntax is an extension to the Perl 5.8 syn-
+ tax. Jeffrey Friedl originated the idea (and the name) in the first
+ edition of his book. Mike McCloskey liked it, so implemented it when he
+ built Sun's Java package, and PCRE copied it from there. It ultimately
+ found its way into Perl at release 5.10.
+
+ PCRE has an optimization that automatically "possessifies" certain sim-
+ ple pattern constructs. For example, the sequence A+B is treated as
+ A++B because there is no point in backtracking into a sequence of A's
+ when B must follow.
+
+ When a pattern contains an unlimited repeat inside a subpattern that
+ can itself be repeated an unlimited number of times, the use of an
+ atomic group is the only way to avoid some failing matches taking a
very long time indeed. The pattern
(\D+|<\d+>)*[!?]
- matches an unlimited number of substrings that either consist of non-
- digits, or digits enclosed in <>, followed by either ! or ?. When it
+ matches an unlimited number of substrings that either consist of non-
+ digits, or digits enclosed in <>, followed by either ! or ?. When it
matches, it runs quickly. However, if it is applied to
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
- it takes a long time before reporting failure. This is because the
- string can be divided between the internal \D+ repeat and the external
- * repeat in a large number of ways, and all have to be tried. (The
- example uses [!?] rather than a single character at the end, because
- both PCRE and Perl have an optimization that allows for fast failure
- when a single character is used. They remember the last single charac-
- ter that is required for a match, and fail early if it is not present
- in the string.) If the pattern is changed so that it uses an atomic
+ it takes a long time before reporting failure. This is because the
+ string can be divided between the internal \D+ repeat and the external
+ * repeat in a large number of ways, and all have to be tried. (The
+ example uses [!?] rather than a single character at the end, because
+ both PCRE and Perl have an optimization that allows for fast failure
+ when a single character is used. They remember the last single charac-
+ ter that is required for a match, and fail early if it is not present
+ in the string.) If the pattern is changed so that it uses an atomic
group, like this:
((?>\D+)|<\d+>)*[!?]
- sequences of non-digits cannot be broken, and failure happens quickly.
+ sequences of non-digits cannot be broken, and failure happens quickly.
BACK REFERENCES
Outside a character class, a backslash followed by a digit greater than
0 (and possibly further digits) is a back reference to a capturing sub-
- pattern earlier (that is, to its left) in the pattern, provided there
+ pattern earlier (that is, to its left) in the pattern, provided there
have been that many previous capturing left parentheses.
However, if the decimal number following the backslash is less than 10,
- it is always taken as a back reference, and causes an error only if
- there are not that many capturing left parentheses in the entire pat-
- tern. In other words, the parentheses that are referenced need not be
- to the left of the reference for numbers less than 10. A "forward back
- reference" of this type can make sense when a repetition is involved
- and the subpattern to the right has participated in an earlier itera-
+ it is always taken as a back reference, and causes an error only if
+ there are not that many capturing left parentheses in the entire pat-
+ tern. In other words, the parentheses that are referenced need not be
+ to the left of the reference for numbers less than 10. A "forward back
+ reference" of this type can make sense when a repetition is involved
+ and the subpattern to the right has participated in an earlier itera-
tion.
- It is not possible to have a numerical "forward back reference" to sub-
- pattern whose number is 10 or more. However, a back reference to any
- subpattern is possible using named parentheses (see below). See also
- the subsection entitled "Non-printing characters" above for further
- details of the handling of digits following a backslash.
+ It is not possible to have a numerical "forward back reference" to a
+ subpattern whose number is 10 or more using this syntax because a
+ sequence such as \50 is interpreted as a character defined in octal.
+ See the subsection entitled "Non-printing characters" above for further
+ details of the handling of digits following a backslash. There is no
+ such problem when named parentheses are used. A back reference to any
+ subpattern is possible using named parentheses (see below).
+
+ Another way of avoiding the ambiguity inherent in the use of digits
+ following a backslash is to use the \g escape sequence, which is a fea-
+ ture introduced in Perl 5.10. This escape must be followed by a posi-
+ tive or a negative number, optionally enclosed in braces. These exam-
+ ples are all identical:
+
+ (ring), \1
+ (ring), \g1
+ (ring), \g{1}
+
+ A positive number specifies an absolute reference without the ambiguity
+ that is present in the older syntax. It is also useful when literal
+ digits follow the reference. A negative number is a relative reference.
+ Consider this example:
+
+ (abc(def)ghi)\g{-1}
+
+ The sequence \g{-1} is a reference to the most recently started captur-
+ ing subpattern before \g, that is, is it equivalent to \2. Similarly,
+ \g{-2} would be equivalent to \1. The use of relative references can be
+ helpful in long patterns, and also in patterns that are created by
+ joining together fragments that contain references within themselves.
A back reference matches whatever actually matched the capturing sub-
pattern in the current subject string, rather than anything matching
@@ -3603,62 +3768,64 @@ BACK REFERENCES
matches "rah rah" and "RAH RAH", but not "RAH rah", even though the
original capturing subpattern is matched caselessly.
- Back references to named subpatterns use the Python syntax (?P=name).
- We could rewrite the above example as follows:
+ Back references to named subpatterns use the Perl syntax \k<name> or
+ \k'name' or the Python syntax (?P=name). We could rewrite the above
+ example in either of the following ways:
+ (?<p1>(?i)rah)\s+\k<p1>
(?P<p1>(?i)rah)\s+(?P=p1)
- A subpattern that is referenced by name may appear in the pattern
+ A subpattern that is referenced by name may appear in the pattern
before or after the reference.
- There may be more than one back reference to the same subpattern. If a
- subpattern has not actually been used in a particular match, any back
+ There may be more than one back reference to the same subpattern. If a
+ subpattern has not actually been used in a particular match, any back
references to it always fail. For example, the pattern
(a|(bc))\2
- always fails if it starts to match "a" rather than "bc". Because there
- may be many capturing parentheses in a pattern, all digits following
- the backslash are taken as part of a potential back reference number.
+ always fails if it starts to match "a" rather than "bc". Because there
+ may be many capturing parentheses in a pattern, all digits following
+ the backslash are taken as part of a potential back reference number.
If the pattern continues with a digit character, some delimiter must be
- used to terminate the back reference. If the PCRE_EXTENDED option is
- set, this can be whitespace. Otherwise an empty comment (see "Com-
+ used to terminate the back reference. If the PCRE_EXTENDED option is
+ set, this can be whitespace. Otherwise an empty comment (see "Com-
ments" below) can be used.
- A back reference that occurs inside the parentheses to which it refers
- fails when the subpattern is first used, so, for example, (a\1) never
- matches. However, such references can be useful inside repeated sub-
+ A back reference that occurs inside the parentheses to which it refers
+ fails when the subpattern is first used, so, for example, (a\1) never
+ matches. However, such references can be useful inside repeated sub-
patterns. For example, the pattern
(a|b\1)+
matches any number of "a"s and also "aba", "ababbaa" etc. At each iter-
- ation of the subpattern, the back reference matches the character
- string corresponding to the previous iteration. In order for this to
- work, the pattern must be such that the first iteration does not need
- to match the back reference. This can be done using alternation, as in
+ ation of the subpattern, the back reference matches the character
+ string corresponding to the previous iteration. In order for this to
+ work, the pattern must be such that the first iteration does not need
+ to match the back reference. This can be done using alternation, as in
the example above, or by a quantifier with a minimum of zero.
ASSERTIONS
- An assertion is a test on the characters following or preceding the
- current matching point that does not actually consume any characters.
- The simple assertions coded as \b, \B, \A, \G, \Z, \z, ^ and $ are
+ An assertion is a test on the characters following or preceding the
+ current matching point that does not actually consume any characters.
+ The simple assertions coded as \b, \B, \A, \G, \Z, \z, ^ and $ are
described above.
- More complicated assertions are coded as subpatterns. There are two
- kinds: those that look ahead of the current position in the subject
- string, and those that look behind it. An assertion subpattern is
- matched in the normal way, except that it does not cause the current
+ More complicated assertions are coded as subpatterns. There are two
+ kinds: those that look ahead of the current position in the subject
+ string, and those that look behind it. An assertion subpattern is
+ matched in the normal way, except that it does not cause the current
matching position to be changed.
- Assertion subpatterns are not capturing subpatterns, and may not be
- repeated, because it makes no sense to assert the same thing several
- times. If any kind of assertion contains capturing subpatterns within
- it, these are counted for the purposes of numbering the capturing sub-
+ Assertion subpatterns are not capturing subpatterns, and may not be
+ repeated, because it makes no sense to assert the same thing several
+ times. If any kind of assertion contains capturing subpatterns within
+ it, these are counted for the purposes of numbering the capturing sub-
patterns in the whole pattern. However, substring capturing is carried
- out only for positive assertions, because it does not make sense for
+ out only for positive assertions, because it does not make sense for
negative assertions.
Lookahead assertions
@@ -3668,37 +3835,37 @@ ASSERTIONS
\w+(?=;)
- matches a word followed by a semicolon, but does not include the semi-
+ matches a word followed by a semicolon, but does not include the semi-
colon in the match, and
foo(?!bar)
- matches any occurrence of "foo" that is not followed by "bar". Note
+ matches any occurrence of "foo" that is not followed by "bar". Note
that the apparently similar pattern
(?!foo)bar
- does not find an occurrence of "bar" that is preceded by something
- other than "foo"; it finds any occurrence of "bar" whatsoever, because
+ does not find an occurrence of "bar" that is preceded by something
+ other than "foo"; it finds any occurrence of "bar" whatsoever, because
the assertion (?!foo) is always true when the next three characters are
"bar". A lookbehind assertion is needed to achieve the other effect.
If you want to force a matching failure at some point in a pattern, the
- most convenient way to do it is with (?!) because an empty string
- always matches, so an assertion that requires there not to be an empty
+ most convenient way to do it is with (?!) because an empty string
+ always matches, so an assertion that requires there not to be an empty
string must always fail.
Lookbehind assertions
- Lookbehind assertions start with (?<= for positive assertions and (?<!
+ Lookbehind assertions start with (?<= for positive assertions and (?<!
for negative assertions. For example,
(?<!foo)bar
- does find an occurrence of "bar" that is not preceded by "foo". The
- contents of a lookbehind assertion are restricted such that all the
+ does find an occurrence of "bar" that is not preceded by "foo". The
+ contents of a lookbehind assertion are restricted such that all the
strings it matches must have a fixed length. However, if there are sev-
- eral top-level alternatives, they do not all have to have the same
+ eral top-level alternatives, they do not all have to have the same
fixed length. Thus
(?<=bullock|donkey)
@@ -3707,59 +3874,55 @@ ASSERTIONS
(?<!dogs?|cats?)
- causes an error at compile time. Branches that match different length
- strings are permitted only at the top level of a lookbehind assertion.
- This is an extension compared with Perl (at least for 5.8), which
- requires all branches to match the same length of string. An assertion
+ causes an error at compile time. Branches that match different length
+ strings are permitted only at the top level of a lookbehind assertion.
+ This is an extension compared with Perl (at least for 5.8), which
+ requires all branches to match the same length of string. An assertion
such as
(?<=ab(c|de))
- is not permitted, because its single top-level branch can match two
- different lengths, but it is acceptable if rewritten to use two top-
+ is not permitted, because its single top-level branch can match two
+ different lengths, but it is acceptable if rewritten to use two top-
level branches:
(?<=abc|abde)
- The implementation of lookbehind assertions is, for each alternative,
- to temporarily move the current position back by the fixed width and
+ The implementation of lookbehind assertions is, for each alternative,
+ to temporarily move the current position back by the fixed length and
then try to match. If there are insufficient characters before the cur-
- rent position, the match is deemed to fail.
+ rent position, the assertion fails.
PCRE does not allow the \C escape (which matches a single byte in UTF-8
- mode) to appear in lookbehind assertions, because it makes it impossi-
- ble to calculate the length of the lookbehind. The \X escape, which can
- match different numbers of bytes, is also not permitted.
+ mode) to appear in lookbehind assertions, because it makes it impossi-
+ ble to calculate the length of the lookbehind. The \X and \R escapes,
+ which can match different numbers of bytes, are also not permitted.
- Atomic groups can be used in conjunction with lookbehind assertions to
- specify efficient matching at the end of the subject string. Consider a
- simple pattern such as
+ Possessive quantifiers can be used in conjunction with lookbehind
+ assertions to specify efficient matching at the end of the subject
+ string. Consider a simple pattern such as
abcd$
- when applied to a long string that does not match. Because matching
+ when applied to a long string that does not match. Because matching
proceeds from left to right, PCRE will look for each "a" in the subject
- and then see if what follows matches the rest of the pattern. If the
+ and then see if what follows matches the rest of the pattern. If the
pattern is specified as
^.*abcd$
- the initial .* matches the entire string at first, but when this fails
+ the initial .* matches the entire string at first, but when this fails
(because there is no following "a"), it backtracks to match all but the
- last character, then all but the last two characters, and so on. Once
- again the search for "a" covers the entire string, from right to left,
+ last character, then all but the last two characters, and so on. Once
+ again the search for "a" covers the entire string, from right to left,
so we are no better off. However, if the pattern is written as
- ^(?>.*)(?<=abcd)
-
- or, equivalently, using the possessive quantifier syntax,
-
^.*+(?<=abcd)
- there can be no backtracking for the .* item; it can match only the
- entire string. The subsequent lookbehind assertion does a single test
- on the last four characters. If it fails, the match fails immediately.
- For long strings, this approach makes a significant difference to the
+ there can be no backtracking for the .*+ item; it can match only the
+ entire string. The subsequent lookbehind assertion does a single test
+ on the last four characters. If it fails, the match fails immediately.
+ For long strings, this approach makes a significant difference to the
processing time.
Using multiple assertions
@@ -3768,18 +3931,18 @@ ASSERTIONS
(?<=\d{3})(?<!999)foo
- matches "foo" preceded by three digits that are not "999". Notice that
- each of the assertions is applied independently at the same point in
- the subject string. First there is a check that the previous three
- characters are all digits, and then there is a check that the same
+ matches "foo" preceded by three digits that are not "999". Notice that
+ each of the assertions is applied independently at the same point in
+ the subject string. First there is a check that the previous three
+ characters are all digits, and then there is a check that the same
three characters are not "999". This pattern does not match "foo" pre-
- ceded by six characters, the first of which are digits and the last
- three of which are not "999". For example, it doesn't match "123abc-
+ ceded by six characters, the first of which are digits and the last
+ three of which are not "999". For example, it doesn't match "123abc-
foo". A pattern to do that is
(?<=\d{3}...)(?<!999)foo
- This time the first assertion looks at the preceding six characters,
+ This time the first assertion looks at the preceding six characters,
checking that the first three are digits, and then the second assertion
checks that the preceding three characters are not "999".
@@ -3787,39 +3950,38 @@ ASSERTIONS
(?<=(?<!foo)bar)baz
- matches an occurrence of "baz" that is preceded by "bar" which in turn
+ matches an occurrence of "baz" that is preceded by "bar" which in turn
is not preceded by "foo", while
(?<=\d{3}(?!999)...)foo
- is another pattern that matches "foo" preceded by three digits and any
+ is another pattern that matches "foo" preceded by three digits and any
three characters that are not "999".
CONDITIONAL SUBPATTERNS
- It is possible to cause the matching process to obey a subpattern con-
- ditionally or to choose between two alternative subpatterns, depending
- on the result of an assertion, or whether a previous capturing subpat-
- tern matched or not. The two possible forms of conditional subpattern
+ It is possible to cause the matching process to obey a subpattern con-
+ ditionally or to choose between two alternative subpatterns, depending
+ on the result of an assertion, or whether a previous capturing subpat-
+ tern matched or not. The two possible forms of conditional subpattern
are
(?(condition)yes-pattern)
(?(condition)yes-pattern|no-pattern)
- If the condition is satisfied, the yes-pattern is used; otherwise the
- no-pattern (if present) is used. If there are more than two alterna-
+ If the condition is satisfied, the yes-pattern is used; otherwise the
+ no-pattern (if present) is used. If there are more than two alterna-
tives in the subpattern, a compile-time error occurs.
- There are three kinds of condition. If the text between the parentheses
- consists of a sequence of digits, or a sequence of alphanumeric charac-
- ters and underscores, the condition is satisfied if the capturing sub-
- pattern of that number or name has previously matched. There is a pos-
- sible ambiguity here, because subpattern names may consist entirely of
- digits. PCRE looks first for a named subpattern; if it cannot find one
- and the text consists entirely of digits, it looks for a subpattern of
- that number, which must be greater than zero. Using subpattern names
- that consist entirely of digits is not recommended.
+ There are four kinds of condition: references to subpatterns, refer-
+ ences to recursion, a pseudo-condition called DEFINE, and assertions.
+
+ Checking for a used subpattern by number
+
+ If the text between the parentheses consists of a sequence of digits,
+ the condition is true if the capturing subpattern of that number has
+ previously matched.
Consider the following pattern, which contains non-significant white
space to make it more readable (assume the PCRE_EXTENDED option) and to
@@ -3836,18 +3998,68 @@ CONDITIONAL SUBPATTERNS
tern is executed and a closing parenthesis is required. Otherwise,
since no-pattern is not present, the subpattern matches nothing. In
other words, this pattern matches a sequence of non-parentheses,
- optionally enclosed in parentheses. Rewriting it to use a named subpat-
- tern gives this:
+ optionally enclosed in parentheses.
+
+ Checking for a used subpattern by name
+
+ Perl uses the syntax (?(<name>)...) or (?('name')...) to test for a
+ used subpattern by name. For compatibility with earlier versions of
+ PCRE, which had this facility before Perl, the syntax (?(name)...) is
+ also recognized. However, there is a possible ambiguity with this syn-
+ tax, because subpattern names may consist entirely of digits. PCRE
+ looks first for a named subpattern; if it cannot find one and the name
+ consists entirely of digits, PCRE looks for a subpattern of that num-
+ ber, which must be greater than zero. Using subpattern names that con-
+ sist entirely of digits is not recommended.
+
+ Rewriting the above example to use a named subpattern gives this:
+
+ (?<OPEN> \( )? [^()]+ (?(<OPEN>) \) )
+
- (?P<OPEN> \( )? [^()]+ (?(OPEN) \) )
+ Checking for pattern recursion
If the condition is the string (R), and there is no subpattern with the
- name R, the condition is satisfied if a recursive call to the pattern
- or subpattern has been made. At "top level", the condition is false.
- This is a PCRE extension. Recursive patterns are described in the next
- section.
+ name R, the condition is true if a recursive call to the whole pattern
+ or any subpattern has been made. If digits or a name preceded by amper-
+ sand follow the letter R, for example:
+
+ (?(R3)...) or (?(R&name)...)
+
+ the condition is true if the most recent recursion is into the subpat-
+ tern whose number or name is given. This condition does not check the
+ entire recursion stack.
+
+ At "top level", all these recursion test conditions are false. Recur-
+ sive patterns are described below.
+
+ Defining subpatterns for use by reference only
+
+ If the condition is the string (DEFINE), and there is no subpattern
+ with the name DEFINE, the condition is always false. In this case,
+ there may be only one alternative in the subpattern. It is always
+ skipped if control reaches this point in the pattern; the idea of
+ DEFINE is that it can be used to define "subroutines" that can be ref-
+ erenced from elsewhere. (The use of "subroutines" is described below.)
+ For example, a pattern to match an IPv4 address could be written like
+ this (ignore whitespace and line breaks):
+
+ (?(DEFINE) (?<byte> 2[0-4]\d | 25[0-5] | 1\d\d | [1-9]?\d) )
+ \b (?&byte) (\.(?&byte)){3} \b
+
+ The first part of the pattern is a DEFINE group inside which a another
+ group named "byte" is defined. This matches an individual component of
+ an IPv4 address (a number less than 256). When matching takes place,
+ this part of the pattern is skipped because DEFINE acts like a false
+ condition.
- If the condition is not a sequence of digits or (R), it must be an
+ The rest of the pattern uses references to the named group to match the
+ four dot-separated components of an IPv4 address, insisting on a word
+ boundary at each end.
+
+ Assertion conditions
+
+ If the condition is not in any of the above formats, it must be an
assertion. This may be a positive or negative lookahead or lookbehind
assertion. Consider this pattern, again containing non-significant
white space, and with the two alternatives on the second line:
@@ -3882,110 +4094,116 @@ RECURSIVE PATTERNS
unlimited nested parentheses. Without the use of recursion, the best
that can be done is to use a pattern that matches up to some fixed
depth of nesting. It is not possible to handle an arbitrary nesting
- depth. Perl provides a facility that allows regular expressions to
- recurse (amongst other things). It does this by interpolating Perl code
- in the expression at run time, and the code can refer to the expression
- itself. A Perl pattern to solve the parentheses problem can be created
- like this:
+ depth.
+
+ For some time, Perl has provided a facility that allows regular expres-
+ sions to recurse (amongst other things). It does this by interpolating
+ Perl code in the expression at run time, and the code can refer to the
+ expression itself. A Perl pattern using code interpolation to solve the
+ parentheses problem can be created like this:
$re = qr{\( (?: (?>[^()]+) | (?p{$re}) )* \)}x;
The (?p{...}) item interpolates Perl code at run time, and in this case
- refers recursively to the pattern in which it appears. Obviously, PCRE
- cannot support the interpolation of Perl code. Instead, it supports
- some special syntax for recursion of the entire pattern, and also for
- individual subpattern recursion.
+ refers recursively to the pattern in which it appears.
+
+ Obviously, PCRE cannot support the interpolation of Perl code. Instead,
+ it supports special syntax for recursion of the entire pattern, and
+ also for individual subpattern recursion. After its introduction in
+ PCRE and Python, this kind of recursion was introduced into Perl at
+ release 5.10.
- The special item that consists of (? followed by a number greater than
+ A special item that consists of (? followed by a number greater than
zero and a closing parenthesis is a recursive call of the subpattern of
- the given number, provided that it occurs inside that subpattern. (If
- not, it is a "subroutine" call, which is described in the next sec-
- tion.) The special item (?R) is a recursive call of the entire regular
- expression.
+ the given number, provided that it occurs inside that subpattern. (If
+ not, it is a "subroutine" call, which is described in the next sec-
+ tion.) The special item (?R) or (?0) is a recursive call of the entire
+ regular expression.
- A recursive subpattern call is always treated as an atomic group. That
- is, once it has matched some of the subject string, it is never re-
- entered, even if it contains untried alternatives and there is a subse-
- quent matching failure.
+ In PCRE (like Python, but unlike Perl), a recursive subpattern call is
+ always treated as an atomic group. That is, once it has matched some of
+ the subject string, it is never re-entered, even if it contains untried
+ alternatives and there is a subsequent matching failure.
- This PCRE pattern solves the nested parentheses problem (assume the
+ This PCRE pattern solves the nested parentheses problem (assume the
PCRE_EXTENDED option is set so that white space is ignored):
\( ( (?>[^()]+) | (?R) )* \)
- First it matches an opening parenthesis. Then it matches any number of
- substrings which can either be a sequence of non-parentheses, or a
- recursive match of the pattern itself (that is, a correctly parenthe-
+ First it matches an opening parenthesis. Then it matches any number of
+ substrings which can either be a sequence of non-parentheses, or a
+ recursive match of the pattern itself (that is, a correctly parenthe-
sized substring). Finally there is a closing parenthesis.
- If this were part of a larger pattern, you would not want to recurse
+ If this were part of a larger pattern, you would not want to recurse
the entire pattern, so instead you could use this:
( \( ( (?>[^()]+) | (?1) )* \) )
- We have put the pattern into parentheses, and caused the recursion to
- refer to them instead of the whole pattern. In a larger pattern, keep-
- ing track of parenthesis numbers can be tricky. It may be more conve-
- nient to use named parentheses instead. For this, PCRE uses (?P>name),
- which is an extension to the Python syntax that PCRE uses for named
- parentheses (Perl does not provide named parentheses). We could rewrite
- the above example as follows:
+ We have put the pattern into parentheses, and caused the recursion to
+ refer to them instead of the whole pattern. In a larger pattern, keep-
+ ing track of parenthesis numbers can be tricky. It may be more conve-
+ nient to use named parentheses instead. The Perl syntax for this is
+ (?&name); PCRE's earlier syntax (?P>name) is also supported. We could
+ rewrite the above example as follows:
- (?P<pn> \( ( (?>[^()]+) | (?P>pn) )* \) )
+ (?<pn> \( ( (?>[^()]+) | (?&pn) )* \) )
- This particular example pattern contains nested unlimited repeats, and
- so the use of atomic grouping for matching strings of non-parentheses
- is important when applying the pattern to strings that do not match.
- For example, when this pattern is applied to
+ If there is more than one subpattern with the same name, the earliest
+ one is used. This particular example pattern contains nested unlimited
+ repeats, and so the use of atomic grouping for matching strings of non-
+ parentheses is important when applying the pattern to strings that do
+ not match. For example, when this pattern is applied to
(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()
- it yields "no match" quickly. However, if atomic grouping is not used,
- the match runs for a very long time indeed because there are so many
- different ways the + and * repeats can carve up the subject, and all
+ it yields "no match" quickly. However, if atomic grouping is not used,
+ the match runs for a very long time indeed because there are so many
+ different ways the + and * repeats can carve up the subject, and all
have to be tested before failure can be reported.
At the end of a match, the values set for any capturing subpatterns are
those from the outermost level of the recursion at which the subpattern
- value is set. If you want to obtain intermediate values, a callout
- function can be used (see the next section and the pcrecallout documen-
- tation). If the pattern above is matched against
+ value is set. If you want to obtain intermediate values, a callout
+ function can be used (see below and the pcrecallout documentation). If
+ the pattern above is matched against
(ab(cd)ef)
- the value for the capturing parentheses is "ef", which is the last
- value taken on at the top level. If additional parentheses are added,
+ the value for the capturing parentheses is "ef", which is the last
+ value taken on at the top level. If additional parentheses are added,
giving
\( ( ( (?>[^()]+) | (?R) )* ) \)
^ ^
^ ^
- the string they capture is "ab(cd)ef", the contents of the top level
- parentheses. If there are more than 15 capturing parentheses in a pat-
+ the string they capture is "ab(cd)ef", the contents of the top level
+ parentheses. If there are more than 15 capturing parentheses in a pat-
tern, PCRE has to obtain extra memory to store data during a recursion,
- which it does by using pcre_malloc, freeing it via pcre_free after-
- wards. If no memory can be obtained, the match fails with the
+ which it does by using pcre_malloc, freeing it via pcre_free after-
+ wards. If no memory can be obtained, the match fails with the
PCRE_ERROR_NOMEMORY error.
- Do not confuse the (?R) item with the condition (R), which tests for
- recursion. Consider this pattern, which matches text in angle brack-
- ets, allowing for arbitrary nesting. Only digits are allowed in nested
- brackets (that is, when recursing), whereas any characters are permit-
+ Do not confuse the (?R) item with the condition (R), which tests for
+ recursion. Consider this pattern, which matches text in angle brack-
+ ets, allowing for arbitrary nesting. Only digits are allowed in nested
+ brackets (that is, when recursing), whereas any characters are permit-
ted at the outer level.
< (?: (?(R) \d++ | [^<>]*+) | (?R)) * >
- In this pattern, (?(R) is the start of a conditional subpattern, with
- two different alternatives for the recursive and non-recursive cases.
+ In this pattern, (?(R) is the start of a conditional subpattern, with
+ two different alternatives for the recursive and non-recursive cases.
The (?R) item is the actual recursive call.
SUBPATTERNS AS SUBROUTINES
If the syntax for a recursive subpattern reference (either by number or
- by name) is used outside the parentheses to which it refers, it oper-
- ates like a subroutine in a programming language. An earlier example
+ by name) is used outside the parentheses to which it refers, it oper-
+ ates like a subroutine in a programming language. The "called" subpat-
+ tern may be defined before or after the reference. An earlier example
pointed out that the pattern
(sens|respons)e and \1ibility
@@ -3996,15 +4214,23 @@ SUBPATTERNS AS SUBROUTINES
(sens|respons)e and (?1)ibility
is used, it does match "sense and responsibility" as well as the other
- two strings. Such references, if given numerically, must follow the
- subpattern to which they refer. However, named references can refer to
- later subpatterns.
+ two strings. Another example is given in the discussion of DEFINE
+ above.
Like recursive subpatterns, a "subroutine" call is always treated as an
- atomic group. That is, once it has matched some of the subject string,
- it is never re-entered, even if it contains untried alternatives and
+ atomic group. That is, once it has matched some of the subject string,
+ it is never re-entered, even if it contains untried alternatives and
there is a subsequent matching failure.
+ When a subpattern is used as a subroutine, processing options such as
+ case-independence are fixed when the subpattern is defined. They cannot
+ be changed for different calls. For example, consider this pattern:
+
+ (abc)(?i:(?1))
+
+ It matches "abcabc". It does not match "abcABC" because the change of
+ processing option does not affect the called subpattern.
+
CALLOUTS
@@ -4040,7 +4266,12 @@ CALLOUTS
gether. A complete description of the interface to the callout function
is given in the pcrecallout documentation.
-Last updated: 06 June 2006
+
+SEE ALSO
+
+ pcreapi(3), pcrecallout(3), pcrematching(3), pcre(3).
+
+Last updated: 06 December 2006
Copyright (c) 1997-2006 University of Cambridge.
------------------------------------------------------------------------------
@@ -4146,8 +4377,8 @@ EXAMPLE OF PARTIAL MATCHING USING PCRETEST
The first data string is matched completely, so pcretest shows the
matched substrings. The remaining four strings do not match the com-
plete pattern, but the first two are partial matches. The same test,
- using DFA matching (by means of the \D escape sequence), produces the
- following output:
+ using pcre_dfa_exec() matching (by means of the \D escape sequence),
+ produces the following output:
re> /^?(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)$/
data> 25jun04\P\D
@@ -4169,11 +4400,12 @@ MULTI-SEGMENT MATCHING WITH pcre_dfa_exec()
When a partial match has been found using pcre_dfa_exec(), it is possi-
ble to continue the match by providing additional subject data and
- calling pcre_dfa_exec() again with the PCRE_DFA_RESTART option and the
- same working space (where details of the previous partial match are
- stored). Here is an example using pcretest, where the \R escape
- sequence sets the PCRE_DFA_RESTART option and the \D escape sequence
- requests the use of pcre_dfa_exec():
+ calling pcre_dfa_exec() again with the same compiled regular expres-
+ sion, this time setting the PCRE_DFA_RESTART option. You must also pass
+ the same working space as before, because this is where details of the
+ previous partial match are stored. Here is an example using pcretest,
+ using the \R escape sequence to set the PCRE_DFA_RESTART option (\P and
+ \D are as above):
re> /^?(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)$/
data> 23ja\P\D
@@ -4181,16 +4413,17 @@ MULTI-SEGMENT MATCHING WITH pcre_dfa_exec()
data> n05\R\D
0: n05
- The first call has "23ja" as the subject, and requests partial match-
- ing; the second call has "n05" as the subject for the continued
- (restarted) match. Notice that when the match is complete, only the
- last part is shown; PCRE does not retain the previously partially-
- matched string. It is up to the calling program to do that if it needs
+ The first call has "23ja" as the subject, and requests partial match-
+ ing; the second call has "n05" as the subject for the continued
+ (restarted) match. Notice that when the match is complete, only the
+ last part is shown; PCRE does not retain the previously partially-
+ matched string. It is up to the calling program to do that if it needs
to.
- This facility can be used to pass very long subject strings to
- pcre_dfa_exec(). However, some care is needed for certain types of pat-
- tern.
+ You can set PCRE_PARTIAL with PCRE_DFA_RESTART to continue partial
+ matching over multiple segments. This facility can be used to pass very
+ long subject strings to pcre_dfa_exec(). However, some care is needed
+ for certain types of pattern.
1. If the pattern contains tests for the beginning or end of a line,
you need to pass the PCRE_NOTBOL or PCRE_NOTEOL options, as appropri-
@@ -4199,7 +4432,7 @@ MULTI-SEGMENT MATCHING WITH pcre_dfa_exec()
2. If the pattern contains backward assertions (including \b or \B),
you need to arrange for some overlap in the subject strings to allow
- for this. For example, you could pass the subject in chunks that were
+ for this. For example, you could pass the subject in chunks that are
500 bytes long, but in a buffer of 700 bytes, with the starting offset
set to 200 and the previous 200 bytes at the start of the buffer.
@@ -4249,7 +4482,7 @@ MULTI-SEGMENT MATCHING WITH pcre_dfa_exec()
where no string can be a partial match for both alternatives.
-Last updated: 16 January 2006
+Last updated: 30 November 2006
Copyright (c) 1997-2006 University of Cambridge.
------------------------------------------------------------------------------
@@ -4361,14 +4594,17 @@ COMPATIBILITY WITH DIFFERENT PCRE RELEASES
makes up a compiled pattern was changed for release 5.0. If you have
any saved patterns that were compiled with previous releases (not a
facility that was previously advertised), you will have to recompile
- them for release 5.0. However, from now on, it should be possible to
- make changes in a compatible manner.
+ them for release 5.0 and above.
+
+ If you have any saved patterns in UTF-8 mode that use \p or \P that
+ were compiled with any release up to and including 6.4, you will have
+ to recompile them for release 6.5 and above.
- Notwithstanding the above, if you have any saved patterns in UTF-8 mode
- that use \p or \P that were compiled with any release up to and includ-
- ing 6.4, you will have to recompile them for release 6.5 and above.
+ All saved patterns from earlier releases must be recompiled for release
+ 7.0 or higher, because there was an internal reorganization at that
+ release.
-Last updated: 01 February 2006
+Last updated: 28 November 2006
Copyright (c) 1997-2006 University of Cambridge.
------------------------------------------------------------------------------
@@ -4382,14 +4618,70 @@ NAME
PCRE PERFORMANCE
- Certain items that may appear in regular expression patterns are more
- efficient than others. It is more efficient to use a character class
- like [aeiou] than a set of alternatives such as (a|e|i|o|u). In gen-
- eral, the simplest construction that provides the required behaviour is
- usually the most efficient. Jeffrey Friedl's book contains a lot of
- useful general discussion about optimizing regular expressions for
- efficient performance. This document contains a few observations about
- PCRE.
+ Two aspects of performance are discussed below: memory usage and pro-
+ cessing time. The way you express your pattern as a regular expression
+ can affect both of them.
+
+
+MEMORY USAGE
+
+ Patterns are compiled by PCRE into a reasonably efficient byte code, so
+ that most simple patterns do not use much memory. However, there is one
+ case where memory usage can be unexpectedly large. When a parenthesized
+ subpattern has a quantifier with a minimum greater than 1 and/or a lim-
+ ited maximum, the whole subpattern is repeated in the compiled code.
+ For example, the pattern
+
+ (abc|def){2,4}
+
+ is compiled as if it were
+
+ (abc|def)(abc|def)((abc|def)(abc|def)?)?
+
+ (Technical aside: It is done this way so that backtrack points within
+ each of the repetitions can be independently maintained.)
+
+ For regular expressions whose quantifiers use only small numbers, this
+ is not usually a problem. However, if the numbers are large, and par-
+ ticularly if such repetitions are nested, the memory usage can become
+ an embarrassment. For example, the very simple pattern
+
+ ((ab){1,1000}c){1,3}
+
+ uses 51K bytes when compiled. When PCRE is compiled with its default
+ internal pointer size of two bytes, the size limit on a compiled pat-
+ tern is 64K, and this is reached with the above pattern if the outer
+ repetition is increased from 3 to 4. PCRE can be compiled to use larger
+ internal pointers and thus handle larger compiled patterns, but it is
+ better to try to rewrite your pattern to use less memory if you can.
+
+ One way of reducing the memory usage for such patterns is to make use
+ of PCRE's "subroutine" facility. Re-writing the above pattern as
+
+ ((ab)(?2){0,999}c)(?1){0,2}
+
+ reduces the memory requirements to 18K, and indeed it remains under 20K
+ even with the outer repetition increased to 100. However, this pattern
+ is not exactly equivalent, because the "subroutine" calls are treated
+ as atomic groups into which there can be no backtracking if there is a
+ subsequent matching failure. Therefore, PCRE cannot do this kind of
+ rewriting automatically. Furthermore, there is a noticeable loss of
+ speed when executing the modified pattern. Nevertheless, if the atomic
+ grouping is not a problem and the loss of speed is acceptable, this
+ kind of rewriting will allow you to process patterns that PCRE cannot
+ otherwise handle.
+
+
+PROCESSING TIME
+
+ Certain items in regular expression patterns are processed more effi-
+ ciently than others. It is more efficient to use a character class like
+ [aeiou] than a set of single-character alternatives such as
+ (a|e|i|o|u). In general, the simplest construction that provides the
+ required behaviour is usually the most efficient. Jeffrey Friedl's book
+ contains a lot of useful general discussion about optimizing regular
+ expressions for efficient performance. This document contains a few
+ observations about PCRE.
Using Unicode character properties (the \p, \P, and \X escapes) is
slow, because PCRE has to scan a structure that contains data for over
@@ -4423,15 +4715,15 @@ PCRE PERFORMANCE
take a long time to run when applied to a string that does not match.
Consider the pattern fragment
- (a+)*
+ ^(a+)*
- This can match "aaaa" in 33 different ways, and this number increases
+ This can match "aaaa" in 16 different ways, and this number increases
very rapidly as the string gets longer. (The * repeat can match 0, 1,
- 2, 3, or 4 times, and for each of those cases other than 0, the +
+ 2, 3, or 4 times, and for each of those cases other than 0 or 4, the +
repeats can match different numbers of times.) When the remainder of
the pattern is such that the entire match is going to fail, PCRE has in
principle to try every possible variation, and this can take an
- extremely long time.
+ extremely long time, even for relatively short strings.
An optimization catches some of the more simple cases such as
@@ -4452,8 +4744,8 @@ PCRE PERFORMANCE
In many cases, the solution to this kind of performance issue is to use
an atomic group or a possessive quantifier.
-Last updated: 28 February 2005
-Copyright (c) 1997-2005 University of Cambridge.
+Last updated: 20 September 2006
+Copyright (c) 1997-2006 University of Cambridge.
------------------------------------------------------------------------------
@@ -4667,7 +4959,7 @@ AUTHOR
Philip Hazel
University Computing Service,
- Cambridge CB2 3QG, England.
+ Cambridge CB2 3QH, England.
Last updated: 16 January 2006
Copyright (c) 1997-2006 University of Cambridge.
@@ -4762,11 +5054,34 @@ MATCHING INTERFACE
number of sub-patterns, "i"th captured sub-pattern is
ignored.
+ CAVEAT: An optional sub-pattern that does not exist in the matched
+ string is assigned the empty string. Therefore, the following will
+ return false (because the empty string is not a valid number):
+
+ int number;
+ pcrecpp::RE::FullMatch("abc", "[a-z]+(\d+)?", &number);
+
The matching interface supports at most 16 arguments per call. If you
need more, consider using the more general interface
pcrecpp::RE::DoMatch. See pcrecpp.h for the signature for DoMatch.
+QUOTING METACHARACTERS
+
+ You can use the "QuoteMeta" operation to insert backslashes before all
+ potentially meaningful characters in a string. The returned string,
+ used as a regular expression, will exactly match the original string.
+
+ Example:
+ string quoted = RE::QuoteMeta(unquoted);
+
+ Note that it's legal to escape a character even if it has no special
+ meaning in a regular expression -- so this function does that. (This
+ also makes it identical to the perl function of the same name; see
+ "perldoc -f quotemeta".) For example, "1.5-2.0?" becomes
+ "1\.5\-2\.0\?".
+
+
PARTIAL MATCHES
You can use the "PartialMatch" operation when you want the pattern to
@@ -4978,7 +5293,7 @@ REPLACING PARTS OF STRINGS
AUTHOR
The C++ wrapper was contributed by Google Inc.
- Copyright (c) 2005 Google Inc.
+ Copyright (c) 2006 Google Inc.
------------------------------------------------------------------------------
@@ -5108,21 +5423,25 @@ PCRE DISCUSSION OF STACK USAGE
quantifier is used to stop any backtracking into the runs of non-"<"
characters, but that is not related to stack usage.
+ This example shows that one way of avoiding stack problems when match-
+ ing long subject strings is to write repeated parenthesized subpatterns
+ to match more than one character whenever possible.
+
In environments where stack memory is constrained, you might want to
compile PCRE to use heap memory instead of stack for remembering back-
up points. This makes it run a lot more slowly, however. Details of how
to do this are given in the pcrebuild documentation.
- In Unix-like environments, there is not often a problem with the stack,
- though the default limit on stack size varies from system to system.
- Values from 8Mb to 64Mb are common. You can find your default limit by
- running the command:
+ In Unix-like environments, there is not often a problem with the stack
+ unless very long strings are involved, though the default limit on
+ stack size varies from system to system. Values from 8Mb to 64Mb are
+ common. You can find your default limit by running the command:
ulimit -s
- The effect of running out of stack is often SIGSEGV, though sometimes
- an error message is given. You can normally increase the limit on stack
- size by code such as this:
+ Unfortunately, the effect of running out of stack is often SIGSEGV,
+ though sometimes a more explicit error message is given. You can nor-
+ mally increase the limit on stack size by code such as this:
struct rlimit rlim;
getrlimit(RLIMIT_STACK, &rlim);
@@ -5144,9 +5463,10 @@ PCRE DISCUSSION OF STACK USAGE
recursion. Thus, if you want to limit your stack usage to 8Mb, you
should set the limit at 16000 recursions. A 64Mb stack, on the other
hand, can support around 128000 recursions. The pcretest test program
- has a command line option (-S) that can be used to increase its stack.
+ has a command line option (-S) that can be used to increase the size of
+ its stack.
-Last updated: 29 June 2006
+Last updated: 14 September 2006
Copyright (c) 1997-2006 University of Cambridge.
------------------------------------------------------------------------------
diff --git a/doc/pcre_compile.3 b/doc/pcre_compile.3
index d838b3a..487e8a7 100644
--- a/doc/pcre_compile.3
+++ b/doc/pcre_compile.3
@@ -17,8 +17,9 @@ PCRE - Perl-compatible regular expressions
.SH DESCRIPTION
.rs
.sp
-This function compiles a regular expression into an internal form. Its
-arguments are:
+This function compiles a regular expression into an internal form. It is the
+same as \fBpcre_compile2()\fP, except for the absence of the \fIerrorcodeptr\fP
+argument. Its arguments are:
.sp
\fIpattern\fR A zero-terminated string containing the
regular expression to be compiled
@@ -41,6 +42,7 @@ The option bits are:
(not much use currently)
PCRE_FIRSTLINE Force matching to be before newline
PCRE_MULTILINE ^ and $ match newlines within data
+ PCRE_NEWLINE_ANY Recognize any Unicode newline sequence
PCRE_NEWLINE_CR Set CR as the newline sequence
PCRE_NEWLINE_CRLF Set CRLF as the newline sequence
PCRE_NEWLINE_LF Set LF as the newline sequence
diff --git a/doc/pcre_compile2.3 b/doc/pcre_compile2.3
index 2688785..9fa995d 100644
--- a/doc/pcre_compile2.3
+++ b/doc/pcre_compile2.3
@@ -46,6 +46,7 @@ The option bits are:
(not much use currently)
PCRE_FIRSTLINE Force matching to be before newline
PCRE_MULTILINE ^ and $ match newlines within data
+ PCRE_NEWLINE_ANY Recognize any Unicode newline sequence
PCRE_NEWLINE_CR Set CR as the newline sequence
PCRE_NEWLINE_CRLF Set CRLF as the newline sequence
PCRE_NEWLINE_LF Set LF as the newline sequence
diff --git a/doc/pcre_config.3 b/doc/pcre_config.3
index 03a27e8..cb0ef27 100644
--- a/doc/pcre_config.3
+++ b/doc/pcre_config.3
@@ -26,7 +26,11 @@ The available codes are:
PCRE_CONFIG_MATCH_LIMIT Internal resource limit
PCRE_CONFIG_MATCH_LIMIT_RECURSION
Internal recursion depth limit
- PCRE_CONFIG_NEWLINE Value of the newline sequence
+ PCRE_CONFIG_NEWLINE Value of the newline sequence:
+ 13 (0x000d) for CR
+ 10 (0x000a) for LF
+ 3338 (0x0d0a) for CRLF
+ -1 for ANY
PCRE_CONFIG_POSIX_MALLOC_THRESHOLD
Threshold of return slots, above
which \fBmalloc()\fR is used by
diff --git a/doc/pcre_copy_substring.3 b/doc/pcre_copy_substring.3
index 41c8dc3..f038b95 100644
--- a/doc/pcre_copy_substring.3
+++ b/doc/pcre_copy_substring.3
@@ -27,7 +27,7 @@ buffer. The arguments are:
\fIbuffer\fP Buffer to receive the string
\fIbuffersize\fP Size of buffer
.sp
-The yield is the legnth of the string, PCRE_ERROR_NOMEMORY if the buffer was
+The yield is the length of the string, PCRE_ERROR_NOMEMORY if the buffer was
too small, or PCRE_ERROR_NOSUBSTRING if the string number is invalid.
.P
There is a complete description of the PCRE native API in the
diff --git a/doc/pcre_dfa_exec.3 b/doc/pcre_dfa_exec.3
index 92c2872..7b952df 100644
--- a/doc/pcre_dfa_exec.3
+++ b/doc/pcre_dfa_exec.3
@@ -20,9 +20,9 @@ PCRE - Perl-compatible regular expressions
.rs
.sp
This function matches a compiled regular expression against a given subject
-string, using a DFA matching algorithm (\fInot\fP Perl-compatible). Note that
-the main, Perl-compatible, matching function is \fBpcre_exec()\fP. The
-arguments for this function are:
+string, using an alternative matching algorithm that scans the subject string
+just once (\fInot\fP Perl-compatible). Note that the main, Perl-compatible,
+matching function is \fBpcre_exec()\fP. The arguments for this function are:
.sp
\fIcode\fP Points to the compiled pattern
\fIextra\fP Points to an associated \fBpcre_extra\fP structure,
@@ -40,6 +40,7 @@ arguments for this function are:
The options are:
.sp
PCRE_ANCHORED Match only at the first position
+ PCRE_NEWLINE_ANY Recognize any Unicode newline sequence
PCRE_NEWLINE_CR Set CR as the newline sequence
PCRE_NEWLINE_CRLF Set CRLF as the newline sequence
PCRE_NEWLINE_LF Set LF as the newline sequence
@@ -53,8 +54,8 @@ The options are:
PCRE_DFA_SHORTEST Return only the shortest match
PCRE_DFA_RESTART This is a restart after a partial match
.sp
-There are restrictions on what may appear in a pattern when matching using the
-DFA algorithm is requested. Details are given in the
+There are restrictions on what may appear in a pattern when using this matching
+function. Details are given in the
.\" HREF
\fBpcrematching\fP
.\"
@@ -71,7 +72,7 @@ A \fBpcre_extra\fP structure contains the following fields:
.sp
The flag bits are PCRE_EXTRA_STUDY_DATA, PCRE_EXTRA_MATCH_LIMIT,
PCRE_EXTRA_MATCH_LIMIT_RECURSION, PCRE_EXTRA_CALLOUT_DATA, and
-PCRE_EXTRA_TABLES. For DFA matching, the \fImatch_limit\fP and
+PCRE_EXTRA_TABLES. For this matching function, the \fImatch_limit\fP and
\fImatch_limit_recursion\fP fields are not used, and must not be set.
.P
There is a complete description of the PCRE native API in the
diff --git a/doc/pcre_exec.3 b/doc/pcre_exec.3
index 2a59812..19cd82f 100644
--- a/doc/pcre_exec.3
+++ b/doc/pcre_exec.3
@@ -35,6 +35,7 @@ offsets to captured substrings. Its arguments are:
The options are:
.sp
PCRE_ANCHORED Match only at the first position
+ PCRE_NEWLINE_ANY Recognize any Unicode newline sequence
PCRE_NEWLINE_CR Set CR as the newline sequence
PCRE_NEWLINE_CRLF Set CRLF as the newline sequence
PCRE_NEWLINE_LF Set LF as the newline sequence
@@ -47,7 +48,11 @@ The options are:
PCRE_PARTIAL Return PCRE_ERROR_PARTIAL for a partial match
.sp
There are restrictions on what may appear in a pattern when partial matching is
-requested.
+requested. For details, see the
+.\" HREF
+\fBpcrepartial\fP
+.\"
+page.
.P
A \fBpcre_extra\fP structure contains the following fields:
.sp
diff --git a/doc/pcre_fullinfo.3 b/doc/pcre_fullinfo.3
index 4b528e2..04155b7 100644
--- a/doc/pcre_fullinfo.3
+++ b/doc/pcre_fullinfo.3
@@ -37,7 +37,7 @@ The following information is available:
PCRE_INFO_NAMECOUNT Number of named subpatterns
PCRE_INFO_NAMEENTRYSIZE Size of name table entry
PCRE_INFO_NAMETABLE Pointer to name table
- PCRE_INFO_OPTIONS Options used for compilation
+ PCRE_INFO_OPTIONS Option bits used for compilation
PCRE_INFO_SIZE Size of compiled pattern
PCRE_INFO_STUDYSIZE Size of study data
.sp
diff --git a/doc/pcre_get_named_substring.3 b/doc/pcre_get_named_substring.3
index 2a1043d..0089777 100644
--- a/doc/pcre_get_named_substring.3
+++ b/doc/pcre_get_named_substring.3
@@ -30,9 +30,10 @@ arguments are:
\fIstringptr\fP Where to put the string pointer
.sp
The memory in which the substring is placed is obtained by calling
-\fBpcre_malloc()\fP. The yield of the function is the length of the extracted
-substring, PCRE_ERROR_NOMEMORY if sufficient memory could not be obtained, or
-PCRE_ERROR_NOSUBSTRING if the string name is invalid.
+\fBpcre_malloc()\fP. The convenience function \fBpcre_free_substring()\fP can
+be used to free it when it is no longer needed. The yield of the function is
+the length of the extracted substring, PCRE_ERROR_NOMEMORY if sufficient memory
+could not be obtained, or PCRE_ERROR_NOSUBSTRING if the string name is invalid.
.P
There is a complete description of the PCRE native API in the
.\" HREF
diff --git a/doc/pcre_get_stringnumber.3 b/doc/pcre_get_stringnumber.3
index f6f46de..e35b606 100644
--- a/doc/pcre_get_stringnumber.3
+++ b/doc/pcre_get_stringnumber.3
@@ -22,7 +22,10 @@ parenthesis in a compiled pattern. Its arguments are:
\fIname\fP Name whose number is required
.sp
The yield of the function is the number of the parenthesis if the name is
-found, or PCRE_ERROR_NOSUBSTRING otherwise.
+found, or PCRE_ERROR_NOSUBSTRING otherwise. When duplicate names are allowed
+(PCRE_DUPNAMES is set), it is not defined which of the numbers is returned by
+\fBpcre_get_stringnumber()\fP. You can obtain the complete list by calling
+\fBpcre_get_stringtable_entries()\fP.
.P
There is a complete description of the PCRE native API in the
.\" HREF
diff --git a/doc/pcre_get_stringtable_entries.3 b/doc/pcre_get_stringtable_entries.3
index 423170d..f08087e 100644
--- a/doc/pcre_get_stringtable_entries.3
+++ b/doc/pcre_get_stringtable_entries.3
@@ -1,4 +1,4 @@
-.TH PCRE_GET_STRINGNUMBER 3
+.TH PCRE_GET_STRINGTABLE_ENTRIES 3
.SH NAME
PCRE - Perl-compatible regular expressions
.SH SYNOPSIS
@@ -34,7 +34,7 @@ the table entries, in the
.\" HREF
\fBpcreapi\fP
.\"
-page and a description of the POSIX API in the
+page, and a description of the POSIX API in the
.\" HREF
\fBpcreposix\fP
.\"
diff --git a/doc/pcre_get_substring.3 b/doc/pcre_get_substring.3
index cc35e4a..a2c12ad 100644
--- a/doc/pcre_get_substring.3
+++ b/doc/pcre_get_substring.3
@@ -27,9 +27,10 @@ arguments are:
\fIstringptr\fP Where to put the string pointer
.sp
The memory in which the substring is placed is obtained by calling
-\fBpcre_malloc()\fP. The yield of the function is the length of the substring,
-PCRE_ERROR_NOMEMORY if sufficient memory could not be obtained, or
-PCRE_ERROR_NOSUBSTRING if the string number is invalid.
+\fBpcre_malloc()\fP. The convenience function \fBpcre_free_substring()\fP can
+be used to free it when it is no longer needed. The yield of the function is
+the length of the substring, PCRE_ERROR_NOMEMORY if sufficient memory could not
+be obtained, or PCRE_ERROR_NOSUBSTRING if the string number is invalid.
.P
There is a complete description of the PCRE native API in the
.\" HREF
diff --git a/doc/pcre_get_substring_list.3 b/doc/pcre_get_substring_list.3
index 51d8ba5..b12b717 100644
--- a/doc/pcre_get_substring_list.3
+++ b/doc/pcre_get_substring_list.3
@@ -24,10 +24,12 @@ substrings. The arguments are:
\fIlistptr\fP Where to put a pointer to the list
.sp
The memory in which the substrings and the list are placed is obtained by
-calling \fBpcre_malloc()\fP. A pointer to a list of pointers is put in
-the variable whose address is in \fIlistptr\fP. The list is terminated by a
-NULL pointer. The yield of the function is zero on success or
-PCRE_ERROR_NOMEMORY if sufficient memory could not be obtained.
+calling \fBpcre_malloc()\fP. The convenience function
+\fBpcre_free_substring_list()\fP can be used to free it when it is no longer
+needed. A pointer to a list of pointers is put in the variable whose address is
+in \fIlistptr\fP. The list is terminated by a NULL pointer. The yield of the
+function is zero on success or PCRE_ERROR_NOMEMORY if sufficient memory could
+not be obtained.
.P
There is a complete description of the PCRE native API in the
.\" HREF
diff --git a/doc/pcreapi.3 b/doc/pcreapi.3
index 9e4d23e..f6dfb70 100644
--- a/doc/pcreapi.3
+++ b/doc/pcreapi.3
@@ -137,8 +137,8 @@ PCRE - Perl-compatible regular expressions
.SH "PCRE API OVERVIEW"
.rs
.sp
-PCRE has its own native API, which is described in this document. There is
-also a set of wrapper functions that correspond to the POSIX regular expression
+PCRE has its own native API, which is described in this document. There are
+also some wrapper functions that correspond to the POSIX regular expression
API. These are described in the
.\" HREF
\fBpcreposix\fP
@@ -170,9 +170,9 @@ documentation describes how to run it.
A second matching function, \fBpcre_dfa_exec()\fP, which is not
Perl-compatible, is also provided. This uses a different algorithm for the
matching. The alternative algorithm finds all possible matches (at a given
-point in the subject). However, this algorithm does not return captured
-substrings. A description of the two matching algorithms and their advantages
-and disadvantages is given in the
+point in the subject), and scans the subject just once. However, this algorithm
+does not return captured substrings. A description of the two matching
+algorithms and their advantages and disadvantages is given in the
.\" HREF
\fBpcrematching\fP
.\"
@@ -244,15 +244,28 @@ documentation.
.
.
.SH NEWLINES
-PCRE supports three different conventions for indicating line breaks in
-strings: a single CR character, a single LF character, or the two-character
-sequence CRLF. All three are used as "standard" by different operating systems.
-When PCRE is built, a default can be specified. The default default is LF,
-which is the Unix standard. When PCRE is run, the default can be overridden,
-either when a pattern is compiled, or when it is matched.
+.rs
.sp
+PCRE supports four different conventions for indicating line breaks in
+strings: a single CR (carriage return) character, a single LF (linefeed)
+character, the two-character sequence CRLF, or any Unicode newline sequence.
+The Unicode newline sequences are the three just mentioned, plus the single
+characters VT (vertical tab, U+000B), FF (formfeed, U+000C), NEL (next line,
+U+0085), LS (line separator, U+2028), and PS (paragraph separator, U+2029).
+.P
+Each of the first three conventions is used by at least one operating system as
+its standard newline sequence. When PCRE is built, a default can be specified.
+The default default is LF, which is the Unix standard. When PCRE is run, the
+default can be overridden, either when a pattern is compiled, or when it is
+matched.
+.P
In the PCRE documentation the word "newline" is used to mean "the character or
-pair of characters that indicate a line break".
+pair of characters that indicate a line break". The choice of newline
+convention affects the handling of the dot, circumflex, and dollar
+metacharacters, the handling of #-comments in /x mode, and, when CRLF is a
+recognized line ending sequence, the match position advancement for a
+non-anchored pattern. The choice of newline convention does not affect the
+interpretation of the \en or \er escape sequences.
.
.
.SH MULTITHREADING
@@ -308,9 +321,9 @@ properties is available; otherwise it is set to zero.
PCRE_CONFIG_NEWLINE
.sp
The output is an integer whose value specifies the default character sequence
-that is recognized as meaning "newline". The three values that are supported
-are: 10 for LF, 13 for CR, and 3338 for CRLF. The default should normally be
-the standard sequence for your operating system.
+that is recognized as meaning "newline". The four values that are supported
+are: 10 for LF, 13 for CR, 3338 for CRLF, and -1 for ANY. The default should
+normally be the standard sequence for your operating system.
.sp
PCRE_CONFIG_LINK_SIZE
.sp
@@ -387,7 +400,7 @@ depend on memory location, the complete \fBpcre\fP data block is not
fully relocatable, because it may contain a copy of the \fItableptr\fP
argument, which is an address (see below).
.P
-The \fIoptions\fP argument contains independent bits that affect the
+The \fIoptions\fP argument contains various bit settings that affect the
compilation. It should be zero if no options are required. The available
options are described below. Some of them, in particular, those that are
compatible with Perl, can also be set and unset from within the pattern (see
@@ -480,8 +493,8 @@ If this bit is set, a dot metacharater in the pattern matches all characters,
including those that indicate newline. Without it, a dot does not match when
the current position is at a newline. This option is equivalent to Perl's /s
option, and it can be changed within a pattern by a (?s) option setting. A
-negative class such as [^a] always matches newlines, independent of the setting
-of this option.
+negative class such as [^a] always matches newline characters, independent of
+the setting of this option.
.sp
PCRE_DUPNAMES
.sp
@@ -544,18 +557,34 @@ occurrences of ^ or $ in a pattern, setting PCRE_MULTILINE has no effect.
PCRE_NEWLINE_CR
PCRE_NEWLINE_LF
PCRE_NEWLINE_CRLF
+ PCRE_NEWLINE_ANY
.sp
These options override the default newline definition that was chosen when PCRE
was built. Setting the first or the second specifies that a newline is
-indicated by a single character (CR or LF, respectively). Setting both of them
-specifies that a newline is indicated by the two-character CRLF sequence. For
-convenience, PCRE_NEWLINE_CRLF is defined to contain both bits. The only time
-that a line break is relevant when compiling a pattern is if PCRE_EXTENDED is
-set, and an unescaped # outside a character class is encountered. This
-indicates a comment that lasts until after the next newline.
-.P
-The newline option set at compile time becomes the default that is used for
-\fBpcre_exec()\fP and \fBpcre_dfa_exec()\fP, but it can be overridden.
+indicated by a single character (CR or LF, respectively). Setting
+PCRE_NEWLINE_CRLF specifies that a newline is indicated by the two-character
+CRLF sequence. Setting PCRE_NEWLINE_ANY specifies that any Unicode newline
+sequence should be recognized. The Unicode newline sequences are the three just
+mentioned, plus the single characters VT (vertical tab, U+000B), FF (formfeed,
+U+000C), NEL (next line, U+0085), LS (line separator, U+2028), and PS
+(paragraph separator, U+2029). The last two are recognized only in UTF-8 mode.
+.P
+The newline setting in the options word uses three bits that are treated
+as a number, giving eight possibilities. Currently only five are used (default
+plus the four values above). This means that if you set more than one newline
+option, the combination may or may not be sensible. For example,
+PCRE_NEWLINE_CR with PCRE_NEWLINE_LF is equivalent to PCRE_NEWLINE_CRLF, but
+other combinations yield unused numbers and cause an error.
+.P
+The only time that a line break is specially recognized when compiling a
+pattern is if PCRE_EXTENDED is set, and an unescaped # outside a character
+class is encountered. This indicates a comment that lasts until after the next
+line break sequence. In other circumstances, line break sequences are treated
+as literal data, except that in PCRE_EXTENDED mode, both CR and LF are treated
+as whitespace characters and are therefore ignored.
+.P
+The newline option that is set at compile time becomes the default that is used
+for \fBpcre_exec()\fP and \fBpcre_dfa_exec()\fP, but it can be overridden.
.sp
PCRE_NO_AUTO_CAPTURE
.sp
@@ -606,7 +635,8 @@ strings.
.sp
The following table lists the error codes than may be returned by
\fBpcre_compile2()\fP, along with the error messages that may be returned by
-both compiling functions.
+both compiling functions. As PCRE has developed, some error codes have fallen
+out of use. To avoid confusion, they have not been re-used.
.sp
0 no error
1 \e at end of pattern
@@ -618,7 +648,7 @@ both compiling functions.
7 invalid escape sequence in character class
8 range out of order in character class
9 nothing to repeat
- 10 operand of unlimited repeat could match the empty string
+ 10 [this code is not in use]
11 internal error: unexpected repeat
12 unrecognized character after (?
13 POSIX named classes are supported only within a class
@@ -627,7 +657,7 @@ both compiling functions.
16 erroffset passed as NULL
17 unknown option bit(s) set
18 missing ) after comment
- 19 parentheses nested too deeply
+ 19 [this code is not in use]
20 regular expression too large
21 failed to get memory
22 unmatched parentheses
@@ -641,7 +671,7 @@ both compiling functions.
30 unknown POSIX class name
31 POSIX collating elements are not supported
32 this version of PCRE is not compiled with PCRE_UTF8 support
- 33 spare error
+ 33 [this code is not in use]
34 character value in \ex{...} sequence is too large
35 invalid condition (?(0)
36 \eC not allowed in lookbehind assertion
@@ -650,7 +680,7 @@ both compiling functions.
39 closing ) for (?C expected
40 recursive call could loop indefinitely
41 unrecognized character after (?P
- 42 syntax error after (?P
+ 42 syntax error in subpattern name (missing terminator)
43 two named subpatterns have the same name
44 invalid UTF-8 string
45 support for \eP, \ep, and \eX has not been compiled
@@ -660,6 +690,11 @@ both compiling functions.
49 too many named subpatterns (maximum 10,000)
50 repeated subpattern is too long
51 octal value is greater than \e377 (not in UTF-8 mode)
+ 52 internal error: overran compiling workspace
+ 53 internal error: previously-checked referenced subpattern not found
+ 54 DEFINE group contains more than one branch
+ 55 repeating a DEFINE group is not allowed
+ 56 inconsistent NEWLINE options"
.
.
.SH "STUDYING A PATTERN"
@@ -827,7 +862,7 @@ variable. (This option used to be called PCRE_INFO_FIRSTCHAR; the old name is
still recognized for backwards compatibility.)
.P
If there is a fixed first byte, for example, from a pattern such as
-(cat|cow|coyote). Otherwise, if either
+(cat|cow|coyote), its value is returned. Otherwise, if either
.sp
(a) the pattern was compiled with the PCRE_MULTILINE option, and every branch
starts with "^", or
@@ -882,8 +917,8 @@ their parentheses numbers. For example, consider the following pattern (assume
PCRE_EXTENDED is set, so white space - including newlines - is ignored):
.sp
.\" JOIN
- (?P<date> (?P<year>(\ed\ed)?\ed\ed) -
- (?P<month>\ed\ed) - (?P<day>\ed\ed) )
+ (?<date> (?<year>(\ed\ed)?\ed\ed) -
+ (?<month>\ed\ed) - (?<day>\ed\ed) )
.sp
There are four named subpatterns, so the table has four entries, and each entry
in the table is eight bytes long. The table is as follows, with non-printing
@@ -1131,11 +1166,16 @@ matching time.
PCRE_NEWLINE_CR
PCRE_NEWLINE_LF
PCRE_NEWLINE_CRLF
+ PCRE_NEWLINE_ANY
.sp
These options override the newline definition that was chosen or defaulted when
-the pattern was compiled. For details, see the description \fBpcre_compile()\fP
-above. During matching, the newline choice affects the behaviour of the dot,
-circumflex, and dollar metacharacters.
+the pattern was compiled. For details, see the description of
+\fBpcre_compile()\fP above. During matching, the newline choice affects the
+behaviour of the dot, circumflex, and dollar metacharacters. It may also alter
+the way the match position is advanced after a match failure for an unanchored
+pattern. When PCRE_NEWLINE_CRLF or PCRE_NEWLINE_ANY is set, and a match attempt
+fails when the current position is at a CRLF sequence, the match position is
+advanced by two characters instead of one, in other words, to after the CRLF.
.sp
PCRE_NOTBOL
.sp
@@ -1336,7 +1376,7 @@ compiled in an environment of one endianness is run in an environment with the
other endianness. This is the error that PCRE gives when the magic number is
not present.
.sp
- PCRE_ERROR_UNKNOWN_NODE (-5)
+ PCRE_ERROR_UNKNOWN_OPCODE (-5)
.sp
While running the pattern match, an unknown item was encountered in the
compiled pattern. This error could be caused by a bug in PCRE or by overwriting
@@ -1362,12 +1402,6 @@ The backtracking limit, as specified by the \fImatch_limit\fP field in a
\fBpcre_extra\fP structure (or defaulted) was reached. See the description
above.
.sp
- PCRE_ERROR_RECURSIONLIMIT (-21)
-.sp
-The internal recursion limit, as specified by the \fImatch_limit_recursion\fP
-field in a \fBpcre_extra\fP structure (or defaulted) was reached. See the
-description above.
-.sp
PCRE_ERROR_CALLOUT (-9)
.sp
This error is never generated by \fBpcre_exec()\fP itself. It is provided for
@@ -1411,6 +1445,26 @@ in PCRE or by overwriting of the compiled pattern.
PCRE_ERROR_BADCOUNT (-15)
.sp
This error is given if the value of the \fIovecsize\fP argument is negative.
+.sp
+ PCRE_ERROR_RECURSIONLIMIT (-21)
+.sp
+The internal recursion limit, as specified by the \fImatch_limit_recursion\fP
+field in a \fBpcre_extra\fP structure (or defaulted) was reached. See the
+description above.
+.sp
+ PCRE_ERROR_NULLWSLIMIT (-22)
+.sp
+When a group that can match an empty substring is repeated with an unbounded
+upper limit, the subject position at the start of the group must be remembered,
+so that a test for an empty string can be made when the end of the group is
+reached. Some workspace is required for this; if it runs out, this error is
+given.
+.sp
+ PCRE_ERROR_BADNEWLINE (-23)
+.sp
+An invalid combination of PCRE_NEWLINE_\fIxxx\fP options was given.
+.P
+Error numbers -16 to -20 are not used by \fBpcre_exec()\fP.
.
.
.SH "EXTRACTING CAPTURED SUBSTRINGS BY NUMBER"
@@ -1468,7 +1522,7 @@ the string is placed in \fIbuffer\fP, whose length is given by
\fIbuffersize\fP, while for \fBpcre_get_substring()\fP a new block of memory is
obtained via \fBpcre_malloc\fP, and its address is returned via
\fIstringptr\fP. The yield of the function is the length of the string, not
-including the terminating zero, or one of
+including the terminating zero, or one of these error codes:
.sp
PCRE_ERROR_NOMEMORY (-6)
.sp
@@ -1484,7 +1538,7 @@ and builds a list of pointers to them. All this is done in a single block of
memory that is obtained via \fBpcre_malloc\fP. The address of the memory block
is returned via \fIlistptr\fP, which is also the start of the list of string
pointers. The end of the list is marked by a NULL pointer. The yield of the
-function is zero if all went well, or
+function is zero if all went well, or the error code
.sp
PCRE_ERROR_NOMEMORY (-6)
.sp
@@ -1536,7 +1590,7 @@ provided.
To extract a substring by name, you first have to find associated number.
For example, for this pattern
.sp
- (a+)b(?P<xxx>\ed+)...
+ (a+)b(?<xxx>\ed+)...
.sp
the number of the subpattern called "xxx" is 2. If the name is known to be
unique (PCRE_DUPNAMES was not set), you can find the number from the name by
@@ -1590,10 +1644,10 @@ argument is the compiled pattern, and the second is the name. The third and
fourth are pointers to variables which are updated by the function. After it
has run, they point to the first and last entries in the name-to-number table
for the given name. The function itself returns the length of each entry, or
-PCRE_ERROR_NOSUBSTRING if there are none. The format of the table is described
-above in the section entitled \fIInformation about a pattern\fP. Given all the
-relevant entries for the name, you can extract each of their numbers, and hence
-the captured data, if any.
+PCRE_ERROR_NOSUBSTRING (-7) if there are none. The format of the table is
+described above in the section entitled \fIInformation about a pattern\fP.
+Given all the relevant entries for the name, you can extract each of their
+numbers, and hence the captured data, if any.
.
.
.SH "FINDING ALL POSSIBLE MATCHES"
@@ -1631,11 +1685,12 @@ will yield PCRE_ERROR_NOMATCH.
.B int *\fIworkspace\fP, int \fIwscount\fP);
.P
The function \fBpcre_dfa_exec()\fP is called to match a subject string against
-a compiled pattern, using a "DFA" matching algorithm. This has different
-characteristics to the normal algorithm, and is not compatible with Perl. Some
-of the features of PCRE patterns are not supported. Nevertheless, there are
-times when this kind of matching can be useful. For a discussion of the two
-matching algorithms, see the
+a compiled pattern, using a matching algorithm that scans the subject string
+just once, and does not backtrack. This has different characteristics to the
+normal algorithm, and is not compatible with Perl. Some of the features of PCRE
+patterns are not supported. Nevertheless, there are times when this kind of
+matching can be useful. For a discussion of the two matching algorithms, see
+the
.\" HREF
\fBpcrematching\fP
.\"
@@ -1691,9 +1746,9 @@ matching string.
PCRE_DFA_SHORTEST
.sp
Setting the PCRE_DFA_SHORTEST option causes the matching algorithm to stop as
-soon as it has found one match. Because of the way the DFA algorithm works,
-this is necessarily the shortest possible match at the first possible matching
-point in the subject string.
+soon as it has found one match. Because of the way the alternative algorithm
+works, this is necessarily the shortest possible match at the first possible
+matching point in the subject string.
.sp
PCRE_DFA_RESTART
.sp
@@ -1732,10 +1787,10 @@ the three matched strings are
On success, the yield of the function is a number greater than zero, which is
the number of matched substrings. The substrings themselves are returned in
\fIovector\fP. Each string uses two elements; the first is the offset to the
-start, and the second is the offset to the end. All the strings have the same
-start offset. (Space could have been saved by giving this only once, but it was
-decided to retain some compatibility with the way \fBpcre_exec()\fP returns
-data, even though the meaning of the strings is different.)
+start, and the second is the offset to the end. In fact, all the strings have
+the same start offset. (Space could have been saved by giving this only once,
+but it was decided to retain some compatibility with the way \fBpcre_exec()\fP
+returns data, even though the meaning of the strings is different.)
.P
The strings are returned in reverse order of length; that is, the longest
matching string is given first. If there were too many matches to fit into
@@ -1762,8 +1817,9 @@ that it does not support, for instance, the use of \eC or a back reference.
.sp
PCRE_ERROR_DFA_UCOND (-17)
.sp
-This return is given if \fBpcre_dfa_exec()\fP encounters a condition item in a
-pattern that uses a back reference for the condition. This is not supported.
+This return is given if \fBpcre_dfa_exec()\fP encounters a condition item that
+uses a back reference for the condition, or a test for recursion in a specific
+group. These are not supported.
.sp
PCRE_ERROR_DFA_UMLIMIT (-18)
.sp
@@ -1782,8 +1838,16 @@ When a recursive subpattern is processed, the matching function calls itself
recursively, using private vectors for \fIovector\fP and \fIworkspace\fP. This
error is given if the output vector is not large enough. This should be
extremely rare, as a vector of size 1000 is used.
+.
+.
+.SH "SEE ALSO"
+.rs
+.sp
+\fBpcrebuild\fP(3), \fBpcrecallout\fP(3), \fBpcrecpp(3)\fP(3),
+\fBpcrematching\fP(3), \fBpcrepartial\fP(3), \fBpcreposix\fP(3),
+\fBpcreprecompile\fP(3), \fBpcresample\fP(3), \fBpcrestack\fP(3).
.P
.in 0
-Last updated: 08 June 2006
+Last updated: 30 November 2006
.br
Copyright (c) 1997-2006 University of Cambridge.
diff --git a/doc/pcrebuild.3 b/doc/pcrebuild.3
index dee499d..a693d92 100644
--- a/doc/pcrebuild.3
+++ b/doc/pcrebuild.3
@@ -81,9 +81,15 @@ character sequence CRLF. If you want this, add
.sp
--enable-newline-is-crlf
.sp
-to the \fBconfigure\fP command. Whatever line ending convention is selected
-when PCRE is built can be overridden when the library functions are called. At
-build time it is conventional to use the standard for your operating system.
+to the \fBconfigure\fP command. There is a fourth option, specified by
+.sp
+ --enable-newline-is-any
+.sp
+which causes PCRE to recognize any Unicode newline sequence.
+.P
+Whatever line ending convention is selected when PCRE is built can be
+overridden when the library functions are called. At build time it is
+conventional to use the standard for your operating system.
.
.SH "BUILDING SHARED AND STATIC LIBRARIES"
.rs
@@ -206,8 +212,14 @@ compiled to run in an EBCDIC environment by adding
--enable-ebcdic
.sp
to the \fBconfigure\fP command.
+.
+.
+.SH "SEE ALSO"
+.rs
+.sp
+\fBpcreapi\fP(3), \fBpcre_config\fP(3).
.P
.in 0
-Last updated: 06 June 2006
+Last updated: 30 November 2006
.br
Copyright (c) 1997-2006 University of Cambridge.
diff --git a/doc/pcrecompat.3 b/doc/pcrecompat.3
index 8929177..ca18d8a 100644
--- a/doc/pcrecompat.3
+++ b/doc/pcrecompat.3
@@ -5,8 +5,9 @@ PCRE - Perl-compatible regular expressions
.rs
.sp
This document describes the differences in the ways that PCRE and Perl handle
-regular expressions. The differences described here are with respect to Perl
-5.8.
+regular expressions. The differences described here are mainly with respect to
+Perl 5.8, though PCRE version 7.0 contains some features that are expected to
+be in the forthcoming Perl 5.10.
.P
1. PCRE has only a subset of Perl's UTF-8 and Unicode support. Details of what
it does have are given in the
@@ -63,20 +64,27 @@ following examples:
.sp
The \eQ...\eE sequence is recognized both inside and outside character classes.
.P
-8. Fairly obviously, PCRE does not support the (?{code}) and (?p{code})
-constructions. However, there is support for recursive patterns using the
-non-Perl items (?R), (?number), and (?P>name). Also, the PCRE "callout" feature
-allows an external function to be called during pattern matching. See the
+8. Fairly obviously, PCRE does not support the (?{code}) and (??{code})
+constructions. However, there is support for recursive patterns. This is not
+available in Perl 5.8, but will be in Perl 5.10. Also, the PCRE "callout"
+feature allows an external function to be called during pattern matching. See
+the
.\" HREF
\fBpcrecallout\fP
.\"
documentation for details.
.P
-9. There are some differences that are concerned with the settings of captured
+9. Subpatterns that are called recursively or as "subroutines" are always
+treated as atomic groups in PCRE. This is like Python, but unlike Perl.
+.P
+10. There are some differences that are concerned with the settings of captured
strings when part of a pattern is repeated. For example, matching "aba" against
the pattern /^(a(b)?)+$/ in Perl leaves $2 unset, but in PCRE it is set to "b".
.P
-10. PCRE provides some extensions to the Perl regular expression facilities:
+11. PCRE provides some extensions to the Perl regular expression facilities.
+Perl 5.10 will include new features that are not in earlier versions, some of
+which (such as named parentheses) have been in PCRE for some time. This list is
+with respect to Perl 5.10:
.sp
(a) Although lookbehind assertions must match fixed length strings, each
alternative branch of a lookbehind assertion can match a different length of
@@ -99,28 +107,17 @@ only at the first matching position in the subject string.
(f) The PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, and PCRE_NO_AUTO_CAPTURE
options for \fBpcre_exec()\fP have no Perl equivalents.
.sp
-(g) The (?R), (?number), and (?P>name) constructs allows for recursive pattern
-matching (Perl can do this using the (?p{code}) construct, which PCRE cannot
-support.)
-.sp
-(h) PCRE supports named capturing substrings, using the Python syntax.
-.sp
-(i) PCRE supports the possessive quantifier "++" syntax, taken from Sun's Java
-package.
-.sp
-(j) The (R) condition, for testing recursion, is a PCRE extension.
-.sp
-(k) The callout facility is PCRE-specific.
+(g) The callout facility is PCRE-specific.
.sp
-(l) The partial matching facility is PCRE-specific.
+(h) The partial matching facility is PCRE-specific.
.sp
-(m) Patterns compiled by PCRE can be saved and re-used at a later time, even on
+(i) Patterns compiled by PCRE can be saved and re-used at a later time, even on
different hosts that have the other endianness.
.sp
-(n) The alternative matching function (\fBpcre_dfa_exec()\fP) matches in a
+(j) The alternative matching function (\fBpcre_dfa_exec()\fP) matches in a
different way and is not Perl-compatible.
.P
.in 0
-Last updated: 06 June 2006
+Last updated: 28 November 2006
.br
Copyright (c) 1997-2006 University of Cambridge.
diff --git a/doc/pcrecpp.3 b/doc/pcrecpp.3
index e1cec6d..d466b83 100644
--- a/doc/pcrecpp.3
+++ b/doc/pcrecpp.3
@@ -85,11 +85,33 @@ The function returns true iff all of the following conditions are satisfied:
number of sub-patterns, "i"th captured sub-pattern is
ignored.
.sp
+CAVEAT: An optional sub-pattern that does not exist in the matched
+string is assigned the empty string. Therefore, the following will
+return false (because the empty string is not a valid number):
+.sp
+ int number;
+ pcrecpp::RE::FullMatch("abc", "[a-z]+(\\d+)?", &number);
+.sp
The matching interface supports at most 16 arguments per call.
If you need more, consider using the more general interface
\fBpcrecpp::RE::DoMatch\fP. See \fBpcrecpp.h\fP for the signature for
\fBDoMatch\fP.
.
+.SH "QUOTING METACHARACTERS"
+.rs
+.sp
+You can use the "QuoteMeta" operation to insert backslashes before all
+potentially meaningful characters in a string. The returned string, used as a
+regular expression, will exactly match the original string.
+.sp
+ Example:
+ string quoted = RE::QuoteMeta(unquoted);
+.sp
+Note that it's legal to escape a character even if it has no special meaning in
+a regular expression -- so this function does that. (This also makes it
+identical to the perl function of the same name; see "perldoc -f quotemeta".)
+For example, "1.5-2.0?" becomes "1\e.5\e-2\e.0\e?".
+.
.SH "PARTIAL MATCHES"
.rs
.sp
@@ -309,4 +331,4 @@ string is left unaffected.
.sp
The C++ wrapper was contributed by Google Inc.
.br
-Copyright (c) 2005 Google Inc.
+Copyright (c) 2006 Google Inc.
diff --git a/doc/pcregrep.1 b/doc/pcregrep.1
index 62fa1a2..1d9d4f6 100644
--- a/doc/pcregrep.1
+++ b/doc/pcregrep.1
@@ -11,10 +11,10 @@ pcregrep - a grep with Perl-compatible regular expressions.
grep commands do, but it uses the PCRE regular expression library to support
patterns that are compatible with the regular expressions of Perl 5. See
.\" HREF
-\fBpcrepattern\fP
+\fBpcrepattern\fP(3)
.\"
-for a full description of syntax and semantics of the regular expressions that
-PCRE supports.
+for a full description of syntax and semantics of the regular expressions
+that PCRE supports.
.P
Patterns, whether supplied on the command line or in a separate file, are given
without delimiters. For example:
@@ -220,16 +220,22 @@ the previous 8K characters (or all the previous characters, if fewer than 8K)
are guaranteed to be available for lookbehind assertions.
.TP
\fB-N\fP \fInewline-type\fP, \fB--newline=\fP\fInewline-type\fP
-The PCRE library supports three different character sequences for indicating
+The PCRE library supports four different conventions for indicating
the ends of lines. They are the single-character sequences CR (carriage return)
-and LF (linefeed), and the two-character sequence CR, LF. When the library is
-built, a default line-ending sequence is specified. This is normally the
-standard sequence for the operating system. Unless otherwise specified by this
-option, \fBpcregrep\fP uses the default. The possible values for this option
-are CR, LF, or CRLF. This makes it possible to use \fBpcregrep\fP on files that
-have come from other environments without having to modify their line endings.
-If the data that is being scanned does not agree with the convention set by
-this option, \fBpcregrep\fP may behave in strange ways.
+and LF (linefeed), the two-character sequence CRLF, and an "any" convention, in
+which any Unicode line ending sequence is assumed to end a line. The Unicode
+sequences are the three just mentioned, plus VT (vertical tab, U+000B), FF
+(formfeed, U+000C), NEL (next line, U+0085), LS (line separator, U+2028), and
+PS (paragraph separator, U+0029).
+.sp
+When the PCRE library is built, a default line-ending sequence is specified.
+This is normally the standard sequence for the operating system. Unless
+otherwise specified by this option, \fBpcregrep\fP uses the library's default.
+The possible values for this option are CR, LF, CRLF, or ANY. This makes it
+possible to use \fBpcregrep\fP on files that have come from other environments
+without having to modify their line endings. If the data that is being scanned
+does not agree with the convention set by this option, \fBpcregrep\fP may
+behave in strange ways.
.TP
\fB-n\fP, \fB--line-number\fP
Precede each output line by its line number in the file, followed by a colon
@@ -339,7 +345,7 @@ in the first form, using an equals character. Otherwise it will be assumed that
it has no data.
.
.
-.SH MATCHING ERRORS
+.SH "MATCHING ERRORS"
.rs
.sp
It is possible to supply a regular expression that takes a very long time to
@@ -361,6 +367,12 @@ suppress error messages about inaccessble files does not affect the return
code.
.
.
+.SH "SEE ALSO"
+.rs
+.sp
+\fBpcrepattern\fP(3), \fBpcretest\fP(1).
+.
+.
.SH AUTHOR
.rs
.sp
@@ -368,9 +380,9 @@ Philip Hazel
.br
University Computing Service
.br
-Cambridge CB2 3QG, England.
+Cambridge CB2 3QH, England.
.P
.in 0
-Last updated: 06 June 2006
+Last updated: 29 November 2006
.br
Copyright (c) 1997-2006 University of Cambridge.
diff --git a/doc/pcregrep.txt b/doc/pcregrep.txt
index 69b0e2b..67d2cae 100644
--- a/doc/pcregrep.txt
+++ b/doc/pcregrep.txt
@@ -14,8 +14,8 @@ DESCRIPTION
pcregrep searches files for character patterns, in the same way as
other grep commands do, but it uses the PCRE regular expression library
to support patterns that are compatible with the regular expressions of
- Perl 5. See pcrepattern for a full description of syntax and semantics
- of the regular expressions that PCRE supports.
+ Perl 5. See pcrepattern(3) for a full description of syntax and seman-
+ tics of the regular expressions that PCRE supports.
Patterns, whether supplied on the command line or in a separate file,
are given without delimiters. For example:
@@ -245,60 +245,67 @@ OPTIONS
lookbehind assertions.
-N newline-type, --newline=newline-type
- The PCRE library supports three different character sequences
- for indicating the ends of lines. They are the single-charac-
- ter sequences CR (carriage return) and LF (linefeed), and the
- two-character sequence CR, LF. When the library is built, a
- default line-ending sequence is specified. This is normally
- the standard sequence for the operating system. Unless other-
- wise specified by this option, pcregrep uses the default. The
- possible values for this option are CR, LF, or CRLF. This
- makes it possible to use pcregrep on files that have come
- from other environments without having to modify their line
- endings. If the data that is being scanned does not agree
- with the convention set by this option, pcregrep may behave
- in strange ways.
+ The PCRE library supports four different conventions for
+ indicating the ends of lines. They are the single-character
+ sequences CR (carriage return) and LF (linefeed), the two-
+ character sequence CRLF, and an "any" convention, in which
+ any Unicode line ending sequence is assumed to end a line.
+ The Unicode sequences are the three just mentioned, plus VT
+ (vertical tab, U+000B), FF (formfeed, U+000C), NEL (next
+ line, U+0085), LS (line separator, U+2028), and PS (paragraph
+ separator, U+0029).
+
+ When the PCRE library is built, a default line-ending
+ sequence is specified. This is normally the standard
+ sequence for the operating system. Unless otherwise specified
+ by this option, pcregrep uses the library's default. The
+ possible values for this option are CR, LF, CRLF, or ANY.
+ This makes it possible to use pcregrep on files that have
+ come from other environments without having to modify their
+ line endings. If the data that is being scanned does not
+ agree with the convention set by this option, pcregrep may
+ behave in strange ways.
-n, --line-number
Precede each output line by its line number in the file, fol-
- lowed by a colon and a space for matching lines or a hyphen
- and a space for context lines. If the filename is also being
+ lowed by a colon and a space for matching lines or a hyphen
+ and a space for context lines. If the filename is also being
output, it precedes the line number.
-o, --only-matching
- Show only the part of the line that matched a pattern. In
- this mode, no context is shown. That is, the -A, -B, and -C
+ Show only the part of the line that matched a pattern. In
+ this mode, no context is shown. That is, the -A, -B, and -C
options are ignored.
-q, --quiet
Work quietly, that is, display nothing except error messages.
- The exit status indicates whether or not any matches were
+ The exit status indicates whether or not any matches were
found.
-r, --recursive
- If any given path is a directory, recursively scan the files
- it contains, taking note of any --include and --exclude set-
- tings. By default, a directory is read as a normal file; in
- some operating systems this gives an immediate end-of-file.
- This option is a shorthand for setting the -d option to
+ If any given path is a directory, recursively scan the files
+ it contains, taking note of any --include and --exclude set-
+ tings. By default, a directory is read as a normal file; in
+ some operating systems this gives an immediate end-of-file.
+ This option is a shorthand for setting the -d option to
"recurse".
-s, --no-messages
- Suppress error messages about non-existent or unreadable
- files. Such files are quietly skipped. However, the return
+ Suppress error messages about non-existent or unreadable
+ files. Such files are quietly skipped. However, the return
code is still 2, even if matches were found in other files.
-u, --utf-8
- Operate in UTF-8 mode. This option is available only if PCRE
- has been compiled with UTF-8 support. Both patterns and sub-
+ Operate in UTF-8 mode. This option is available only if PCRE
+ has been compiled with UTF-8 support. Both patterns and sub-
ject lines must be valid strings of UTF-8 characters.
-V, --version
- Write the version numbers of pcregrep and the PCRE library
+ Write the version numbers of pcregrep and the PCRE library
that is being used to the standard error stream.
-v, --invert-match
- Invert the sense of the match, so that lines which do not
+ Invert the sense of the match, so that lines which do not
match any of the patterns are the ones that are found.
-w, --word-regex, --word-regexp
@@ -306,94 +313,99 @@ OPTIONS
lent to having \b at the start and end of the pattern.
-x, --line-regex, --line-regexp
- Force the patterns to be anchored (each must start matching
- at the beginning of a line) and in addition, require them to
- match entire lines. This is equivalent to having ^ and $
+ Force the patterns to be anchored (each must start matching
+ at the beginning of a line) and in addition, require them to
+ match entire lines. This is equivalent to having ^ and $
characters at the start and end of each alternative branch in
every pattern.
ENVIRONMENT VARIABLES
- The environment variables LC_ALL and LC_CTYPE are examined, in that
- order, for a locale. The first one that is set is used. This can be
- overridden by the --locale option. If no locale is set, the PCRE
+ The environment variables LC_ALL and LC_CTYPE are examined, in that
+ order, for a locale. The first one that is set is used. This can be
+ overridden by the --locale option. If no locale is set, the PCRE
library's default (usually the "C" locale) is used.
NEWLINES
- The -N (--newline) option allows pcregrep to scan files with different
- newline conventions from the default. However, the setting of this
- option does not affect the way in which pcregrep writes information to
- the standard error and output streams. It uses the string "\n" in C
- printf() calls to indicate newlines, relying on the C I/O library to
- convert this to an appropriate sequence if the output is sent to a
+ The -N (--newline) option allows pcregrep to scan files with different
+ newline conventions from the default. However, the setting of this
+ option does not affect the way in which pcregrep writes information to
+ the standard error and output streams. It uses the string "\n" in C
+ printf() calls to indicate newlines, relying on the C I/O library to
+ convert this to an appropriate sequence if the output is sent to a
file.
OPTIONS COMPATIBILITY
The majority of short and long forms of pcregrep's options are the same
- as in the GNU grep program. Any long option of the form --xxx-regexp
- (GNU terminology) is also available as --xxx-regex (PCRE terminology).
- However, the --locale, -M, --multiline, -u, and --utf-8 options are
+ as in the GNU grep program. Any long option of the form --xxx-regexp
+ (GNU terminology) is also available as --xxx-regex (PCRE terminology).
+ However, the --locale, -M, --multiline, -u, and --utf-8 options are
specific to pcregrep.
OPTIONS WITH DATA
There are four different ways in which an option with data can be spec-
- ified. If a short form option is used, the data may follow immedi-
+ ified. If a short form option is used, the data may follow immedi-
ately, or in the next command line item. For example:
-f/some/file
-f /some/file
- If a long form option is used, the data may appear in the same command
+ If a long form option is used, the data may appear in the same command
line item, separated by an equals character, or (with one exception) it
may appear in the next command line item. For example:
--file=/some/file
--file /some/file
- Note, however, that if you want to supply a file name beginning with ~
- as data in a shell command, and have the shell expand ~ to a home
+ Note, however, that if you want to supply a file name beginning with ~
+ as data in a shell command, and have the shell expand ~ to a home
directory, you must separate the file name from the option, because the
- shell does not treat ~ specially unless it is at the start of an item.
+ shell does not treat ~ specially unless it is at the start of an item.
- The exception to the above is the --colour (or --color) option, for
- which the data is optional. If this option does have data, it must be
- given in the first form, using an equals character. Otherwise it will
+ The exception to the above is the --colour (or --color) option, for
+ which the data is optional. If this option does have data, it must be
+ given in the first form, using an equals character. Otherwise it will
be assumed that it has no data.
MATCHING ERRORS
- It is possible to supply a regular expression that takes a very long
- time to fail to match certain lines. Such patterns normally involve
- nested indefinite repeats, for example: (a+)*\d when matched against a
- line of a's with no final digit. The PCRE matching function has a
- resource limit that causes it to abort in these circumstances. If this
+ It is possible to supply a regular expression that takes a very long
+ time to fail to match certain lines. Such patterns normally involve
+ nested indefinite repeats, for example: (a+)*\d when matched against a
+ line of a's with no final digit. The PCRE matching function has a
+ resource limit that causes it to abort in these circumstances. If this
happens, pcregrep outputs an error message and the line that caused the
- problem to the standard error stream. If there are more than 20 such
+ problem to the standard error stream. If there are more than 20 such
errors, pcregrep gives up.
DIAGNOSTICS
Exit status is 0 if any matches were found, 1 if no matches were found,
- and 2 for syntax errors and non-existent or inacessible files (even if
- matches were found in other files) or too many matching errors. Using
- the -s option to suppress error messages about inaccessble files does
+ and 2 for syntax errors and non-existent or inacessible files (even if
+ matches were found in other files) or too many matching errors. Using
+ the -s option to suppress error messages about inaccessble files does
not affect the return code.
+SEE ALSO
+
+ pcrepattern(3), pcretest(1).
+
+
AUTHOR
Philip Hazel
University Computing Service
- Cambridge CB2 3QG, England.
+ Cambridge CB2 3QH, England.
-Last updated: 06 June 2006
+Last updated: 29 November 2006
Copyright (c) 1997-2006 University of Cambridge.
diff --git a/doc/pcrematching.3 b/doc/pcrematching.3
index ff582c4..18c0d5d 100644
--- a/doc/pcrematching.3
+++ b/doc/pcrematching.3
@@ -26,7 +26,7 @@ is matched against the string
<something> <something else> <something further>
.sp
there are three possible answers. The standard algorithm finds only one of
-them, whereas the DFA algorithm finds all three.
+them, whereas the alternative algorithm finds all three.
.
.SH "REGULAR EXPRESSIONS AS TREES"
.rs
@@ -63,15 +63,16 @@ straightforward for this algorithm to keep track of the substrings that are
matched by portions of the pattern in parentheses. This provides support for
capturing parentheses and back references.
.
-.SH "THE DFA MATCHING ALGORITHM"
+.SH "THE ALTERNATIVE MATCHING ALGORITHM"
.rs
.sp
-DFA stands for "deterministic finite automaton", but you do not need to
-understand the origins of that name. This algorithm conducts a breadth-first
-search of the tree. Starting from the first matching point in the subject, it
-scans the subject string from left to right, once, character by character, and
-as it does this, it remembers all the paths through the tree that represent
-valid matches.
+This algorithm conducts a breadth-first search of the tree. Starting from the
+first matching point in the subject, it scans the subject string from left to
+right, once, character by character, and as it does this, it remembers all the
+paths through the tree that represent valid matches. In Friedl's terminology,
+this is a kind of "DFA algorithm", though it is not implemented as a
+traditional finite state machine (it keeps multiple states active
+simultaneously).
.P
The scan continues until either the end of the subject is reached, or there are
no more unterminated paths. At this point, terminated paths represent the
@@ -92,11 +93,20 @@ character of the subject. The algorithm does not automatically move on to find
matches that start at later positions.
.P
There are a number of features of PCRE regular expressions that are not
-supported by the DFA matching algorithm. They are as follows:
+supported by the alternative matching algorithm. They are as follows:
.P
1. Because the algorithm finds all possible matches, the greedy or ungreedy
nature of repetition quantifiers is not relevant. Greedy and ungreedy
-quantifiers are treated in exactly the same way.
+quantifiers are treated in exactly the same way. However, possessive
+quantifiers can make a difference when what follows could also match what is
+quantified, for example in a pattern like this:
+.sp
+ ^a++\ew!
+.sp
+This pattern matches "aaab!" but not "aaa!", which would be matched by a
+non-possessive quantifier. Similarly, if an atomic group is present, it is
+matched as if it were a standalone pattern at the current point, and the
+longest match is then "locked in" for the rest of the overall pattern.
.P
2. When dealing with multiple paths through the tree simultaneously, it is not
straightforward to keep track of captured substrings for the different matching
@@ -107,21 +117,21 @@ do this. This means that no captured substrings are available.
not supported, and cause errors if encountered.
.P
4. For the same reason, conditional expressions that use a backreference as the
-condition are not supported.
+condition or test for a specific group recursion are not supported.
.P
5. Callouts are supported, but the value of the \fIcapture_top\fP field is
always 1, and the value of the \fIcapture_last\fP field is always -1.
.P
6.
The \eC escape sequence, which (in the standard algorithm) matches a single
-byte, even in UTF-8 mode, is not supported because the DFA algorithm moves
-through the subject string one character at a time, for all active paths
+byte, even in UTF-8 mode, is not supported because the alternative algorithm
+moves through the subject string one character at a time, for all active paths
through the tree.
.
-.SH "ADVANTAGES OF THE DFA ALGORITHM"
+.SH "ADVANTAGES OF THE ALTERNATIVE ALGORITHM"
.rs
.sp
-Using the DFA matching algorithm provides the following advantages:
+Using the alternative matching algorithm provides the following advantages:
.P
1. All possible matches (at a single point in the subject) are automatically
found, and in particular, the longest match is found. To find more than one
@@ -130,17 +140,18 @@ callouts.
.P
2. There is much better support for partial matching. The restrictions on the
content of the pattern that apply when using the standard algorithm for partial
-matching do not apply to the DFA algorithm. For non-anchored patterns, the
-starting position of a partial match is available.
+matching do not apply to the alternative algorithm. For non-anchored patterns,
+the starting position of a partial match is available.
.P
-3. Because the DFA algorithm scans the subject string just once, and never
-needs to backtrack, it is possible to pass very long subject strings to the
-matching function in several pieces, checking for partial matching each time.
+3. Because the alternative algorithm scans the subject string just once, and
+never needs to backtrack, it is possible to pass very long subject strings to
+the matching function in several pieces, checking for partial matching each
+time.
.
-.SH "DISADVANTAGES OF THE DFA ALGORITHM"
+.SH "DISADVANTAGES OF THE ALTERNATIVE ALGORITHM"
.rs
.sp
-The DFA algorithm suffers from a number of disadvantages:
+The alternative algorithm suffers from a number of disadvantages:
.P
1. It is substantially slower than the standard algorithm. This is partly
because it has to search for all possible matches, but is also because it is
@@ -148,10 +159,10 @@ less susceptible to optimization.
.P
2. Capturing parentheses and back references are not supported.
.P
-3. The "atomic group" feature of PCRE regular expressions is supported, but
-does not provide the advantage that it does for the standard algorithm.
+3. Although atomic groups are supported, their use does not provide the
+performance advantage that it does for the standard algorithm.
.P
.in 0
-Last updated: 06 June 2006
+Last updated: 24 November 2006
.br
Copyright (c) 1997-2006 University of Cambridge.
diff --git a/doc/pcrepartial.3 b/doc/pcrepartial.3
index c4e0aca..c52a1cd 100644
--- a/doc/pcrepartial.3
+++ b/doc/pcrepartial.3
@@ -95,8 +95,9 @@ uses the date example quoted above:
.sp
The first data string is matched completely, so \fBpcretest\fP shows the
matched substrings. The remaining four strings do not match the complete
-pattern, but the first two are partial matches. The same test, using DFA
-matching (by means of the \eD escape sequence), produces the following output:
+pattern, but the first two are partial matches. The same test, using
+\fBpcre_dfa_exec()\fP matching (by means of the \eD escape sequence), produces
+the following output:
.sp
re> /^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$/
data> 25jun04\eP\eD
@@ -119,11 +120,11 @@ available.
.sp
When a partial match has been found using \fBpcre_dfa_exec()\fP, it is possible
to continue the match by providing additional subject data and calling
-\fBpcre_dfa_exec()\fP again with the PCRE_DFA_RESTART option and the same
-working space (where details of the previous partial match are stored). Here is
-an example using \fBpcretest\fP, where the \eR escape sequence sets the
-PCRE_DFA_RESTART option and the \eD escape sequence requests the use of
-\fBpcre_dfa_exec()\fP:
+\fBpcre_dfa_exec()\fP again with the same compiled regular expression, this
+time setting the PCRE_DFA_RESTART option. You must also pass the same working
+space as before, because this is where details of the previous partial match
+are stored. Here is an example using \fBpcretest\fP, using the \eR escape
+sequence to set the PCRE_DFA_RESTART option (\eP and \eD are as above):
.sp
re> /^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$/
data> 23ja\eP\eD
@@ -137,9 +138,10 @@ Notice that when the match is complete, only the last part is shown; PCRE does
not retain the previously partially-matched string. It is up to the calling
program to do that if it needs to.
.P
-This facility can be used to pass very long subject strings to
-\fBpcre_dfa_exec()\fP. However, some care is needed for certain types of
-pattern.
+You can set PCRE_PARTIAL with PCRE_DFA_RESTART to continue partial matching
+over multiple segments. This facility can be used to pass very long subject
+strings to \fBpcre_dfa_exec()\fP. However, some care is needed for certain
+types of pattern.
.P
1. If the pattern contains tests for the beginning or end of a line, you need
to pass the PCRE_NOTBOL or PCRE_NOTEOL options, as appropriate, when the
@@ -147,7 +149,7 @@ subject string for any call does not contain the beginning or end of a line.
.P
2. If the pattern contains backward assertions (including \eb or \eB), you need
to arrange for some overlap in the subject strings to allow for this. For
-example, you could pass the subject in chunks that were 500 bytes long, but in
+example, you could pass the subject in chunks that are 500 bytes long, but in
a buffer of 700 bytes, with the starting offset set to 200 and the previous 200
bytes at the start of the buffer.
.P
@@ -198,6 +200,6 @@ where no string can be a partial match for both alternatives.
.
.P
.in 0
-Last updated: 16 January 2006
+Last updated: 30 November 2006
.br
Copyright (c) 1997-2006 University of Cambridge.
diff --git a/doc/pcrepattern.3 b/doc/pcrepattern.3
index 84c4b4d..c1efbea 100644
--- a/doc/pcrepattern.3
+++ b/doc/pcrepattern.3
@@ -36,7 +36,11 @@ and how it differs from the normal function, are discussed in the
\fBpcrematching\fP
.\"
page.
-.P
+.
+.
+.SH "CHARACTERS AND METACHARACTERS"
+.rs
+.sp
A regular expression is a pattern that is matched against a subject string from
left to right. Most characters stand for themselves in a pattern, and match the
corresponding characters in the subject. As a trivial example, the pattern
@@ -60,8 +64,8 @@ interpreted in some special way.
.P
There are two different sets of metacharacters: those that are recognized
anywhere in the pattern except within square brackets, and those that are
-recognized in square brackets. Outside square brackets, the metacharacters are
-as follows:
+recognized within square brackets. Outside square brackets, the metacharacters
+are as follows:
.sp
\e general escape character with several uses
^ assert start of string (or line, in multiline mode)
@@ -92,6 +96,7 @@ a character class the only metacharacters are:
.sp
The following sections describe the use of each of the metacharacters.
.
+.
.SH BACKSLASH
.rs
.sp
@@ -190,7 +195,7 @@ parenthesized subpatterns.
.P
Inside a character class, or if the decimal number is greater than 9 and there
have not been that many capturing subpatterns, PCRE re-reads up to three octal
-digits following the backslash, ane uses them to generate a data character. Any
+digits following the backslash, and uses them to generate a data character. Any
subsequent digits stand for themselves. In non-UTF-8 mode, the value of a
character specified in octal must be less than \e400. In UTF-8 mode, values up
to \e777 are permitted. For example:
@@ -221,18 +226,36 @@ zero, because no more than three octal digits are ever read.
All the sequences that define a single character value can be used both inside
and outside character classes. In addition, inside a character class, the
sequence \eb is interpreted as the backspace character (hex 08), and the
-sequence \eX is interpreted as the character "X". Outside a character class,
-these sequences have different meanings
+sequences \eR and \eX are interpreted as the characters "R" and "X",
+respectively. Outside a character class, these sequences have different
+meanings
.\" HTML <a href="#uniextseq">
.\" </a>
(see below).
.\"
.
.
+.SS "Absolute and relative back references"
+.rs
+.sp
+The sequence \eg followed by a positive or negative number, optionally enclosed
+in braces, is an absolute or relative back reference. Back references are
+discussed
+.\" HTML <a href="#backreferences">
+.\" </a>
+later,
+.\"
+following the discussion of
+.\" HTML <a href="#subpattern">
+.\" </a>
+parenthesized subpatterns.
+.\"
+.
+.
.SS "Generic character types"
.rs
.sp
-The third use of backslash is for specifying generic character types. The
+Another use of backslash is for specifying generic character types. The
following are always recognized:
.sp
\ed any decimal digit
@@ -277,6 +300,34 @@ character property support is available. The use of locales with Unicode is
discouraged.
.
.
+.SS "Newline sequences"
+.rs
+.sp
+Outside a character class, the escape sequence \eR matches any Unicode newline
+sequence. This is an extension to Perl. In non-UTF-8 mode \eR is equivalent to
+the following:
+.sp
+ (?>\er\en|\en|\ex0b|\ef|\er|\ex85)
+.sp
+This is an example of an "atomic group", details of which are given
+.\" HTML <a href="#atomicgroup">
+.\" </a>
+below.
+.\"
+This particular group matches either the two-character sequence CR followed by
+LF, or one of the single characters LF (linefeed, U+000A), VT (vertical tab,
+U+000B), FF (formfeed, U+000C), CR (carriage return, U+000D), or NEL (next
+line, U+0085). The two-character sequence is treated as a single unit that
+cannot be split.
+.P
+In UTF-8 mode, two additional characters whose codepoints are greater than 255
+are added: LS (line separator, U+2028) and PS (paragraph separator, U+2029).
+Unicode character property support is not needed for these characters to be
+recognized.
+.P
+Inside a character class, \eR matches the letter "R".
+.
+.
.\" HTML <a name="uniextseq"></a>
.SS Unicode character properties
.rs
@@ -307,6 +358,7 @@ Those that are not part of an identified script are lumped together as
.P
Arabic,
Armenian,
+Balinese,
Bengali,
Bopomofo,
Braille,
@@ -316,6 +368,7 @@ Canadian_Aboriginal,
Cherokee,
Common,
Coptic,
+Cuneiform,
Cypriot,
Cyrillic,
Deseret,
@@ -345,11 +398,14 @@ Malayalam,
Mongolian,
Myanmar,
New_Tai_Lue,
+Nko,
Ogham,
Old_Italic,
Old_Persian,
Oriya,
Osmanya,
+Phags_Pa,
+Phoenician,
Runic,
Shavian,
Sinhala,
@@ -466,7 +522,7 @@ properties in PCRE.
.SS "Simple assertions"
.rs
.sp
-The fourth use of backslash is for certain simple assertions. An assertion
+The final use of backslash is for certain simple assertions. An assertion
specifies a condition that has to be met at a particular point in a match,
without consuming any characters from the subject string. The use of
subpatterns for more complicated assertions is described
@@ -478,10 +534,11 @@ The backslashed assertions are:
.sp
\eb matches at a word boundary
\eB matches when not at a word boundary
- \eA matches at start of subject
- \eZ matches at end of subject or before newline at end
- \ez matches at end of subject
- \eG matches at first matching position in subject
+ \eA matches at the start of the subject
+ \eZ matches at the end of the subject
+ also matches before a newline at the end of the subject
+ \ez matches only at the end of the subject
+ \eG matches at the first matching position in the subject
.sp
These assertions may not appear in character classes (but note that \eb has a
different meaning, namely the backspace character, inside a character class).
@@ -578,15 +635,19 @@ end of the subject in both modes, and if all branches of a pattern start with
.sp
Outside a character class, a dot in the pattern matches any one character in
the subject string except (by default) a character that signifies the end of a
-line. In UTF-8 mode, the matched character may be more than one byte long. When
-a line ending is defined as a single character (CR or LF), dot never matches
-that character; when the two-character sequence CRLF is used, dot does not
-match CR if it is immediately followed by LF, but otherwise it matches all
-characters (including isolated CRs and LFs).
+line. In UTF-8 mode, the matched character may be more than one byte long.
+.P
+When a line ending is defined as a single character, dot never matches that
+character; when the two-character sequence CRLF is used, dot does not match CR
+if it is immediately followed by LF, but otherwise it matches all characters
+(including isolated CRs and LFs). When any Unicode line endings are being
+recognized, dot does not match CR or LF or any of the other line ending
+characters.
.P
The behaviour of dot with regard to newlines can be changed. If the PCRE_DOTALL
-option is set, a dot matches any one character, without exception. If newline
-is defined as the two-character sequence CRLF, it takes two dots to match it.
+option is set, a dot matches any one character, without exception. If the
+two-character sequence CRLF is present in the subject string, it takes two dots
+to match it.
.P
The handling of dot is entirely independent of the handling of circumflex and
dollar, the only relationship being that they both involve newlines. Dot has no
@@ -597,11 +658,11 @@ special meaning in a character class.
.rs
.sp
Outside a character class, the escape sequence \eC matches any one byte, both
-in and out of UTF-8 mode. Unlike a dot, it always matches CR and LF. The
-feature is provided in Perl in order to match individual bytes in UTF-8 mode.
-Because it breaks up UTF-8 characters into individual bytes, what remains in
-the string may be a malformed UTF-8 string. For this reason, the \eC escape
-sequence is best avoided.
+in and out of UTF-8 mode. Unlike a dot, it always matches any line-ending
+characters. The feature is provided in Perl in order to match individual bytes
+in UTF-8 mode. Because it breaks up UTF-8 characters into individual bytes,
+what remains in the string may be a malformed UTF-8 string. For this reason,
+the \eC escape sequence is best avoided.
.P
PCRE does not allow \eC to appear in lookbehind assertions
.\" HTML <a href="#lookbehind">
@@ -652,10 +713,10 @@ If you want to use caseless matching for characters 128 and above, you must
ensure that PCRE is compiled with Unicode property support as well as with
UTF-8 support.
.P
-Characters that might indicate line breaks (CR and LF) are never treated in any
-special way when matching character classes, whatever line-ending sequence is
-in use, and whatever setting of the PCRE_DOTALL and PCRE_MULTILINE options is
-used. A class such as [^a] always matches one of these characters.
+Characters that might indicate line breaks are never treated in any special way
+when matching character classes, whatever line-ending sequence is in use, and
+whatever setting of the PCRE_DOTALL and PCRE_MULTILINE options is used. A class
+such as [^a] always matches one of these characters.
.P
The minus (hyphen) character can be used to specify a range of characters in a
character class. For example, [d-m] matches any letter between d and m,
@@ -790,8 +851,8 @@ If the change is placed right at the start of a pattern, PCRE extracts it into
the global options (and it will therefore show up in data extracted by the
\fBpcre_fullinfo()\fP function).
.P
-An option change within a subpattern affects only that part of the current
-pattern that follows it, so
+An option change within a subpattern (see below for a description of
+subpatterns) affects only that part of the current pattern that follows it, so
.sp
(a(?i)b)c
.sp
@@ -824,7 +885,7 @@ Turning part of a pattern into a subpattern does two things:
cat(aract|erpillar|)
.sp
matches one of the words "cat", "cataract", or "caterpillar". Without the
-parentheses, it would match "cataract", "erpillar" or the empty string.
+parentheses, it would match "cataract", "erpillar" or an empty string.
.sp
2. It sets up the subpattern as a capturing subpattern. This means that, when
the whole pattern matches, that portion of the subject string that matched the
@@ -849,8 +910,7 @@ the string "the white queen" is matched against the pattern
the ((?:red|white) (king|queen))
.sp
the captured substrings are "white queen" and "queen", and are numbered 1 and
-2. The maximum number of capturing subpatterns is 65535, and the maximum depth
-of nesting of all subpatterns, both capturing and non-capturing, is 200.
+2. The maximum number of capturing subpatterns is 65535.
.P
As a convenient shorthand, if any option settings are required at the start of
a non-capturing subpattern, the option letters may appear between the "?" and
@@ -871,8 +931,13 @@ the above patterns match "SUNDAY" as well as "Saturday".
Identifying capturing parentheses by number is simple, but it can be very hard
to keep track of the numbers in complicated regular expressions. Furthermore,
if an expression is modified, the numbers may change. To help with this
-difficulty, PCRE supports the naming of subpatterns, something that Perl does
-not provide. The Python syntax (?P<name>...) is used. References to capturing
+difficulty, PCRE supports the naming of subpatterns. This feature was not
+added to Perl until release 5.10. Python had the feature earlier, and PCRE
+introduced it at release 4.0, using the Python syntax. PCRE now supports both
+the Perl and the Python syntax.
+.P
+In PCRE, a subpattern can be named in one of three ways: (?<name>...) or
+(?'name'...) as in Perl, or (?P<name>...) as in Python. References to capturing
parentheses from other parts of the pattern, such as
.\" HTML <a href="#backreferences">
.\" </a>
@@ -890,10 +955,10 @@ conditions,
can be made by name as well as by number.
.P
Names consist of up to 32 alphanumeric characters and underscores. Named
-capturing parentheses are still allocated numbers as well as names. The PCRE
-API provides function calls for extracting the name-to-number translation table
-from a compiled pattern. There is also a convenience function for extracting a
-captured substring by name.
+capturing parentheses are still allocated numbers as well as names, exactly as
+if the names were not present. The PCRE API provides function calls for
+extracting the name-to-number translation table from a compiled pattern. There
+is also a convenience function for extracting a captured substring by name.
.P
By default, a name must be unique within a pattern, but it is possible to relax
this constraint by setting the PCRE_DUPNAMES option at compile time. This can
@@ -902,15 +967,15 @@ match. Suppose you want to match the name of a weekday, either as a 3-letter
abbreviation or as the full name, and in both cases you want to extract the
abbreviation. This pattern (ignoring the line breaks) does the job:
.sp
- (?P<DN>Mon|Fri|Sun)(?:day)?|
- (?P<DN>Tue)(?:sday)?|
- (?P<DN>Wed)(?:nesday)?|
- (?P<DN>Thu)(?:rsday)?|
- (?P<DN>Sat)(?:urday)?
+ (?<DN>Mon|Fri|Sun)(?:day)?|
+ (?<DN>Tue)(?:sday)?|
+ (?<DN>Wed)(?:nesday)?|
+ (?<DN>Thu)(?:rsday)?|
+ (?<DN>Sat)(?:urday)?
.sp
There are five capturing substrings, but only one is ever set after a match.
The convenience function for extracting the data by name returns the substring
-for the first, and in this example, the only, subpattern of that name that
+for the first (and in this example, the only) subpattern of that name that
matched. This saves searching to find which numbered subpattern it was. If you
make a reference to a non-unique named subpattern from elsewhere in the
pattern, the one that corresponds to the lowest number is used. For further
@@ -928,9 +993,10 @@ Repetition is specified by quantifiers, which can follow any of the following
items:
.sp
a literal data character
- the . metacharacter
+ the dot metacharacter
the \eC escape sequence
the \eX escape sequence (in UTF-8 mode with Unicode properties)
+ the \eR escape sequence
an escape such as \ed that matches a single character
a character class
a back reference (see next section)
@@ -968,8 +1034,8 @@ which may be several bytes long (and they may be of different lengths).
The quantifier {0} is permitted, causing the expression to behave as if the
previous item and the quantifier were not present.
.P
-For convenience (and historical compatibility) the three most common
-quantifiers have single-character abbreviations:
+For convenience, the three most common quantifiers have single-character
+abbreviations:
.sp
* is equivalent to {0,}
+ is equivalent to {1,}
@@ -1017,7 +1083,7 @@ own right. Because it has two uses, it can sometimes appear doubled, as in
which matches one digit by preference, but can match two if that is the only
way the rest of the pattern matches.
.P
-If the PCRE_UNGREEDY option is set (an option which is not available in Perl),
+If the PCRE_UNGREEDY option is set (an option that is not available in Perl),
the quantifiers are not greedy by default, but individual ones can be made
greedy by following them with a question mark. In other words, it inverts the
default behaviour.
@@ -1027,7 +1093,7 @@ is greater than 1 or with a limited maximum, more memory is required for the
compiled pattern, in proportion to the size of the minimum or maximum.
.P
If a pattern starts with .* or .{0,} and the PCRE_DOTALL option (equivalent
-to Perl's /s) is set, thus allowing the . to match newlines, the pattern is
+to Perl's /s) is set, thus allowing the dot to match newlines, the pattern is
implicitly anchored, because whatever follows will be tried against every
character position in the subject string, so there is no point in retrying the
overall match at any position after the first. PCRE normally treats such a
@@ -1039,8 +1105,8 @@ alternatively using ^ to indicate anchoring explicitly.
.P
However, there is one situation where the optimization cannot be used. When .*
is inside capturing parentheses that are the subject of a backreference
-elsewhere in the pattern, a match at the start may fail, and a later one
-succeed. Consider, for example:
+elsewhere in the pattern, a match at the start may fail where a later one
+succeeds. Consider, for example:
.sp
(.*)abc\e1
.sp
@@ -1066,12 +1132,12 @@ matches "aba" the value of the second captured substring is "b".
.SH "ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS"
.rs
.sp
-With both maximizing and minimizing repetition, failure of what follows
-normally causes the repeated item to be re-evaluated to see if a different
-number of repeats allows the rest of the pattern to match. Sometimes it is
-useful to prevent this, either to change the nature of the match, or to cause
-it fail earlier than it otherwise might, when the author of the pattern knows
-there is no point in carrying on.
+With both maximizing ("greedy") and minimizing ("ungreedy" or "lazy")
+repetition, failure of what follows normally causes the repeated item to be
+re-evaluated to see if a different number of repeats allows the rest of the
+pattern to match. Sometimes it is useful to prevent this, either to change the
+nature of the match, or to cause it fail earlier than it otherwise might, when
+the author of the pattern knows there is no point in carrying on.
.P
Consider, for example, the pattern \ed+foo when applied to the subject line
.sp
@@ -1083,7 +1149,7 @@ item, and then with 4, and so on, before ultimately failing. "Atomic grouping"
(a term taken from Jeffrey Friedl's book) provides the means for specifying
that once a subpattern has matched, it is not to be re-evaluated in this way.
.P
-If we use atomic grouping for the previous example, the matcher would give up
+If we use atomic grouping for the previous example, the matcher gives up
immediately on failing to match "foo" the first time. The notation is a kind of
special parenthesis, starting with (?> as in this example:
.sp
@@ -1115,13 +1181,19 @@ previous example can be rewritten as
.sp
Possessive quantifiers are always greedy; the setting of the PCRE_UNGREEDY
option is ignored. They are a convenient notation for the simpler forms of
-atomic group. However, there is no difference in the meaning or processing of a
-possessive quantifier and the equivalent atomic group.
+atomic group. However, there is no difference in the meaning of a possessive
+quantifier and the equivalent atomic group, though there may be a performance
+difference; possessive quantifiers should be slightly faster.
+.P
+The possessive quantifier syntax is an extension to the Perl 5.8 syntax.
+Jeffrey Friedl originated the idea (and the name) in the first edition of his
+book. Mike McCloskey liked it, so implemented it when he built Sun's Java
+package, and PCRE copied it from there. It ultimately found its way into Perl
+at release 5.10.
.P
-The possessive quantifier syntax is an extension to the Perl syntax. Jeffrey
-Friedl originated the idea (and the name) in the first edition of his book.
-Mike McCloskey liked it, so implemented it when he built Sun's Java package,
-and PCRE copied it from there.
+PCRE has an optimization that automatically "possessifies" certain simple
+pattern constructs. For example, the sequence A+B is treated as A++B because
+there is no point in backtracking into a sequence of A's when B must follow.
.P
When a pattern contains an unlimited repeat inside a subpattern that can itself
be repeated an unlimited number of times, the use of an atomic group is the
@@ -1167,15 +1239,38 @@ numbers less than 10. A "forward back reference" of this type can make sense
when a repetition is involved and the subpattern to the right has participated
in an earlier iteration.
.P
-It is not possible to have a numerical "forward back reference" to subpattern
-whose number is 10 or more. However, a back reference to any subpattern is
-possible using named parentheses (see below). See also the subsection entitled
+It is not possible to have a numerical "forward back reference" to a subpattern
+whose number is 10 or more using this syntax because a sequence such as \e50 is
+interpreted as a character defined in octal. See the subsection entitled
"Non-printing characters"
.\" HTML <a href="#digitsafterbackslash">
.\" </a>
above
.\"
-for further details of the handling of digits following a backslash.
+for further details of the handling of digits following a backslash. There is
+no such problem when named parentheses are used. A back reference to any
+subpattern is possible using named parentheses (see below).
+.P
+Another way of avoiding the ambiguity inherent in the use of digits following a
+backslash is to use the \eg escape sequence, which is a feature introduced in
+Perl 5.10. This escape must be followed by a positive or a negative number,
+optionally enclosed in braces. These examples are all identical:
+.sp
+ (ring), \e1
+ (ring), \eg1
+ (ring), \eg{1}
+.sp
+A positive number specifies an absolute reference without the ambiguity that is
+present in the older syntax. It is also useful when literal digits follow the
+reference. A negative number is a relative reference. Consider this example:
+.sp
+ (abc(def)ghi)\eg{-1}
+.sp
+The sequence \eg{-1} is a reference to the most recently started capturing
+subpattern before \eg, that is, is it equivalent to \e2. Similarly, \eg{-2}
+would be equivalent to \e1. The use of relative references can be helpful in
+long patterns, and also in patterns that are created by joining together
+fragments that contain references within themselves.
.P
A back reference matches whatever actually matched the capturing subpattern in
the current subject string, rather than anything matching the subpattern
@@ -1197,9 +1292,11 @@ back reference, the case of letters is relevant. For example,
matches "rah rah" and "RAH RAH", but not "RAH rah", even though the original
capturing subpattern is matched caselessly.
.P
-Back references to named subpatterns use the Python syntax (?P=name). We could
-rewrite the above example as follows:
+Back references to named subpatterns use the Perl syntax \ek<name> or \ek'name'
+or the Python syntax (?P=name). We could rewrite the above example in either of
+the following ways:
.sp
+ (?<p1>(?i)rah)\es+\ek<p1>
(?P<p1>(?i)rah)\es+(?P=p1)
.sp
A subpattern that is referenced by name may appear in the pattern before or
@@ -1324,18 +1421,18 @@ lengths, but it is acceptable if rewritten to use two top-level branches:
(?<=abc|abde)
.sp
The implementation of lookbehind assertions is, for each alternative, to
-temporarily move the current position back by the fixed width and then try to
+temporarily move the current position back by the fixed length and then try to
match. If there are insufficient characters before the current position, the
-match is deemed to fail.
+assertion fails.
.P
PCRE does not allow the \eC escape (which matches a single byte in UTF-8 mode)
to appear in lookbehind assertions, because it makes it impossible to calculate
-the length of the lookbehind. The \eX escape, which can match different numbers
-of bytes, is also not permitted.
+the length of the lookbehind. The \eX and \eR escapes, which can match
+different numbers of bytes, are also not permitted.
.P
-Atomic groups can be used in conjunction with lookbehind assertions to specify
-efficient matching at the end of the subject string. Consider a simple pattern
-such as
+Possessive quantifiers can be used in conjunction with lookbehind assertions to
+specify efficient matching at the end of the subject string. Consider a simple
+pattern such as
.sp
abcd$
.sp
@@ -1351,13 +1448,9 @@ then all but the last two characters, and so on. Once again the search for "a"
covers the entire string, from right to left, so we are no better off. However,
if the pattern is written as
.sp
- ^(?>.*)(?<=abcd)
-.sp
-or, equivalently, using the possessive quantifier syntax,
-.sp
^.*+(?<=abcd)
.sp
-there can be no backtracking for the .* item; it can match only the entire
+there can be no backtracking for the .*+ item; it can match only the entire
string. The subsequent lookbehind assertion does a single test on the last four
characters. If it fails, the match fails immediately. For long strings, this
approach makes a significant difference to the processing time.
@@ -1413,15 +1506,15 @@ If the condition is satisfied, the yes-pattern is used; otherwise the
no-pattern (if present) is used. If there are more than two alternatives in the
subpattern, a compile-time error occurs.
.P
-There are three kinds of condition. If the text between the parentheses
-consists of a sequence of digits, or a sequence of alphanumeric characters and
-underscores, the condition is satisfied if the capturing subpattern of that
-number or name has previously matched. There is a possible ambiguity here,
-because subpattern names may consist entirely of digits. PCRE looks first for a
-named subpattern; if it cannot find one and the text consists entirely of
-digits, it looks for a subpattern of that number, which must be greater than
-zero. Using subpattern names that consist entirely of digits is not
-recommended.
+There are four kinds of condition: references to subpatterns, references to
+recursion, a pseudo-condition called DEFINE, and assertions.
+.
+.SS "Checking for a used subpattern by number"
+.rs
+.sp
+If the text between the parentheses consists of a sequence of digits, the
+condition is true if the capturing subpattern of that number has previously
+matched.
.P
Consider the following pattern, which contains non-significant white space to
make it more readable (assume the PCRE_EXTENDED option) and to divide it into
@@ -1437,17 +1530,69 @@ or not. If they did, that is, if subject started with an opening parenthesis,
the condition is true, and so the yes-pattern is executed and a closing
parenthesis is required. Otherwise, since no-pattern is not present, the
subpattern matches nothing. In other words, this pattern matches a sequence of
-non-parentheses, optionally enclosed in parentheses. Rewriting it to use a
-named subpattern gives this:
+non-parentheses, optionally enclosed in parentheses.
+.
+.SS "Checking for a used subpattern by name"
+.rs
+.sp
+Perl uses the syntax (?(<name>)...) or (?('name')...) to test for a used
+subpattern by name. For compatibility with earlier versions of PCRE, which had
+this facility before Perl, the syntax (?(name)...) is also recognized. However,
+there is a possible ambiguity with this syntax, because subpattern names may
+consist entirely of digits. PCRE looks first for a named subpattern; if it
+cannot find one and the name consists entirely of digits, PCRE looks for a
+subpattern of that number, which must be greater than zero. Using subpattern
+names that consist entirely of digits is not recommended.
+.P
+Rewriting the above example to use a named subpattern gives this:
+.sp
+ (?<OPEN> \e( )? [^()]+ (?(<OPEN>) \e) )
.sp
- (?P<OPEN> \e( )? [^()]+ (?(OPEN) \e) )
+.
+.SS "Checking for pattern recursion"
+.rs
.sp
If the condition is the string (R), and there is no subpattern with the name R,
-the condition is satisfied if a recursive call to the pattern or subpattern has
-been made. At "top level", the condition is false. This is a PCRE extension.
-Recursive patterns are described in the next section.
+the condition is true if a recursive call to the whole pattern or any
+subpattern has been made. If digits or a name preceded by ampersand follow the
+letter R, for example:
+.sp
+ (?(R3)...) or (?(R&name)...)
+.sp
+the condition is true if the most recent recursion is into the subpattern whose
+number or name is given. This condition does not check the entire recursion
+stack.
.P
-If the condition is not a sequence of digits or (R), it must be an assertion.
+At "top level", all these recursion test conditions are false. Recursive
+patterns are described below.
+.
+.SS "Defining subpatterns for use by reference only"
+.rs
+.sp
+If the condition is the string (DEFINE), and there is no subpattern with the
+name DEFINE, the condition is always false. In this case, there may be only one
+alternative in the subpattern. It is always skipped if control reaches this
+point in the pattern; the idea of DEFINE is that it can be used to define
+"subroutines" that can be referenced from elsewhere. (The use of "subroutines"
+is described below.) For example, a pattern to match an IPv4 address could be
+written like this (ignore whitespace and line breaks):
+.sp
+ (?(DEFINE) (?<byte> 2[0-4]\ed | 25[0-5] | 1\ed\ed | [1-9]?\ed) )
+ \eb (?&byte) (\e.(?&byte)){3} \eb
+.sp
+The first part of the pattern is a DEFINE group inside which a another group
+named "byte" is defined. This matches an individual component of an IPv4
+address (a number less than 256). When matching takes place, this part of the
+pattern is skipped because DEFINE acts like a false condition.
+.P
+The rest of the pattern uses references to the named group to match the four
+dot-separated components of an IPv4 address, insisting on a word boundary at
+each end.
+.
+.SS "Assertion conditions"
+.rs
+.sp
+If the condition is not in any of the above formats, it must be an assertion.
This may be a positive or negative lookahead or lookbehind assertion. Consider
this pattern, again containing non-significant white space, and with the two
alternatives on the second line:
@@ -1483,28 +1628,34 @@ next newline in the pattern.
Consider the problem of matching a string in parentheses, allowing for
unlimited nested parentheses. Without the use of recursion, the best that can
be done is to use a pattern that matches up to some fixed depth of nesting. It
-is not possible to handle an arbitrary nesting depth. Perl provides a facility
-that allows regular expressions to recurse (amongst other things). It does this
-by interpolating Perl code in the expression at run time, and the code can
-refer to the expression itself. A Perl pattern to solve the parentheses problem
-can be created like this:
+is not possible to handle an arbitrary nesting depth.
+.P
+For some time, Perl has provided a facility that allows regular expressions to
+recurse (amongst other things). It does this by interpolating Perl code in the
+expression at run time, and the code can refer to the expression itself. A Perl
+pattern using code interpolation to solve the parentheses problem can be
+created like this:
.sp
$re = qr{\e( (?: (?>[^()]+) | (?p{$re}) )* \e)}x;
.sp
The (?p{...}) item interpolates Perl code at run time, and in this case refers
-recursively to the pattern in which it appears. Obviously, PCRE cannot support
-the interpolation of Perl code. Instead, it supports some special syntax for
-recursion of the entire pattern, and also for individual subpattern recursion.
+recursively to the pattern in which it appears.
+.P
+Obviously, PCRE cannot support the interpolation of Perl code. Instead, it
+supports special syntax for recursion of the entire pattern, and also for
+individual subpattern recursion. After its introduction in PCRE and Python,
+this kind of recursion was introduced into Perl at release 5.10.
.P
-The special item that consists of (? followed by a number greater than zero and
-a closing parenthesis is a recursive call of the subpattern of the given
-number, provided that it occurs inside that subpattern. (If not, it is a
-"subroutine" call, which is described in the next section.) The special item
-(?R) is a recursive call of the entire regular expression.
+A special item that consists of (? followed by a number greater than zero and a
+closing parenthesis is a recursive call of the subpattern of the given number,
+provided that it occurs inside that subpattern. (If not, it is a "subroutine"
+call, which is described in the next section.) The special item (?R) or (?0) is
+a recursive call of the entire regular expression.
.P
-A recursive subpattern call is always treated as an atomic group. That is, once
-it has matched some of the subject string, it is never re-entered, even if
-it contains untried alternatives and there is a subsequent matching failure.
+In PCRE (like Python, but unlike Perl), a recursive subpattern call is always
+treated as an atomic group. That is, once it has matched some of the subject
+string, it is never re-entered, even if it contains untried alternatives and
+there is a subsequent matching failure.
.P
This PCRE pattern solves the nested parentheses problem (assume the
PCRE_EXTENDED option is set so that white space is ignored):
@@ -1524,14 +1675,15 @@ pattern, so instead you could use this:
We have put the pattern into parentheses, and caused the recursion to refer to
them instead of the whole pattern. In a larger pattern, keeping track of
parenthesis numbers can be tricky. It may be more convenient to use named
-parentheses instead. For this, PCRE uses (?P>name), which is an extension to
-the Python syntax that PCRE uses for named parentheses (Perl does not provide
-named parentheses). We could rewrite the above example as follows:
+parentheses instead. The Perl syntax for this is (?&name); PCRE's earlier
+syntax (?P>name) is also supported. We could rewrite the above example as
+follows:
.sp
- (?P<pn> \e( ( (?>[^()]+) | (?P>pn) )* \e) )
+ (?<pn> \e( ( (?>[^()]+) | (?&pn) )* \e) )
.sp
-This particular example pattern contains nested unlimited repeats, and so the
-use of atomic grouping for matching strings of non-parentheses is important
+If there is more than one subpattern with the same name, the earliest one is
+used. This particular example pattern contains nested unlimited repeats, and so
+the use of atomic grouping for matching strings of non-parentheses is important
when applying the pattern to strings that do not match. For example, when this
pattern is applied to
.sp
@@ -1545,7 +1697,7 @@ before failure can be reported.
At the end of a match, the values set for any capturing subpatterns are those
from the outermost level of the recursion at which the subpattern value is set.
If you want to obtain intermediate values, a callout function can be used (see
-the next section and the
+below and the
.\" HREF
\fBpcrecallout\fP
.\"
@@ -1584,8 +1736,8 @@ is the actual recursive call.
.sp
If the syntax for a recursive subpattern reference (either by number or by
name) is used outside the parentheses to which it refers, it operates like a
-subroutine in a programming language. An earlier example pointed out that the
-pattern
+subroutine in a programming language. The "called" subpattern may be defined
+before or after the reference. An earlier example pointed out that the pattern
.sp
(sens|respons)e and \e1ibility
.sp
@@ -1595,13 +1747,21 @@ matches "sense and sensibility" and "response and responsibility", but not
(sens|respons)e and (?1)ibility
.sp
is used, it does match "sense and responsibility" as well as the other two
-strings. Such references, if given numerically, must follow the subpattern to
-which they refer. However, named references can refer to later subpatterns.
+strings. Another example is given in the discussion of DEFINE above.
.P
Like recursive subpatterns, a "subroutine" call is always treated as an atomic
group. That is, once it has matched some of the subject string, it is never
re-entered, even if it contains untried alternatives and there is a subsequent
matching failure.
+.P
+When a subpattern is used as a subroutine, processing options such as
+case-independence are fixed when the subpattern is defined. They cannot be
+changed for different calls. For example, consider this pattern:
+.sp
+ (abc)(?i:(?1))
+.sp
+It matches "abcabc". It does not match "abcABC" because the change of
+processing option does not affect the called subpattern.
.
.
.SH CALLOUTS
@@ -1638,8 +1798,14 @@ description of the interface to the callout function is given in the
\fBpcrecallout\fP
.\"
documentation.
+.
+.
+.SH "SEE ALSO"
+.rs
+.sp
+\fBpcreapi\fP(3), \fBpcrecallout\fP(3), \fBpcrematching\fP(3), \fBpcre\fP(3).
.P
.in 0
-Last updated: 06 June 2006
+Last updated: 06 December 2006
.br
Copyright (c) 1997-2006 University of Cambridge.
diff --git a/doc/pcreperform.3 b/doc/pcreperform.3
index 75e8a16..bf4a8f0 100644
--- a/doc/pcreperform.3
+++ b/doc/pcreperform.3
@@ -4,13 +4,75 @@ PCRE - Perl-compatible regular expressions
.SH "PCRE PERFORMANCE"
.rs
.sp
-Certain items that may appear in regular expression patterns are more efficient
+Two aspects of performance are discussed below: memory usage and processing
+time. The way you express your pattern as a regular expression can affect both
+of them.
+.
+.SH "MEMORY USAGE"
+.rs
+.sp
+Patterns are compiled by PCRE into a reasonably efficient byte code, so that
+most simple patterns do not use much memory. However, there is one case where
+memory usage can be unexpectedly large. When a parenthesized subpattern has a
+quantifier with a minimum greater than 1 and/or a limited maximum, the whole
+subpattern is repeated in the compiled code. For example, the pattern
+.sp
+ (abc|def){2,4}
+.sp
+is compiled as if it were
+.sp
+ (abc|def)(abc|def)((abc|def)(abc|def)?)?
+.sp
+(Technical aside: It is done this way so that backtrack points within each of
+the repetitions can be independently maintained.)
+.P
+For regular expressions whose quantifiers use only small numbers, this is not
+usually a problem. However, if the numbers are large, and particularly if such
+repetitions are nested, the memory usage can become an embarrassment. For
+example, the very simple pattern
+.sp
+ ((ab){1,1000}c){1,3}
+.sp
+uses 51K bytes when compiled. When PCRE is compiled with its default internal
+pointer size of two bytes, the size limit on a compiled pattern is 64K, and
+this is reached with the above pattern if the outer repetition is increased
+from 3 to 4. PCRE can be compiled to use larger internal pointers and thus
+handle larger compiled patterns, but it is better to try to rewrite your
+pattern to use less memory if you can.
+.P
+One way of reducing the memory usage for such patterns is to make use of PCRE's
+.\" HTML <a href="pcrepattern.html#subpatternsassubroutines">
+.\" </a>
+"subroutine"
+.\"
+facility. Re-writing the above pattern as
+.sp
+ ((ab)(?2){0,999}c)(?1){0,2}
+.sp
+reduces the memory requirements to 18K, and indeed it remains under 20K even
+with the outer repetition increased to 100. However, this pattern is not
+exactly equivalent, because the "subroutine" calls are treated as
+.\" HTML <a href="pcrepattern.html#atomicgroup">
+.\" </a>
+atomic groups
+.\"
+into which there can be no backtracking if there is a subsequent matching
+failure. Therefore, PCRE cannot do this kind of rewriting automatically.
+Furthermore, there is a noticeable loss of speed when executing the modified
+pattern. Nevertheless, if the atomic grouping is not a problem and the loss of
+speed is acceptable, this kind of rewriting will allow you to process patterns
+that PCRE cannot otherwise handle.
+.
+.SH "PROCESSING TIME"
+.rs
+.sp
+Certain items in regular expression patterns are processed more efficiently
than others. It is more efficient to use a character class like [aeiou] than a
-set of alternatives such as (a|e|i|o|u). In general, the simplest construction
-that provides the required behaviour is usually the most efficient. Jeffrey
-Friedl's book contains a lot of useful general discussion about optimizing
-regular expressions for efficient performance. This document contains a few
-observations about PCRE.
+set of single-character alternatives such as (a|e|i|o|u). In general, the
+simplest construction that provides the required behaviour is usually the most
+efficient. Jeffrey Friedl's book contains a lot of useful general discussion
+about optimizing regular expressions for efficient performance. This document
+contains a few observations about PCRE.
.P
Using Unicode character properties (the \ep, \eP, and \eX escapes) is slow,
because PCRE has to scan a structure that contains data for over fifteen
@@ -42,14 +104,15 @@ Beware of patterns that contain nested indefinite repeats. These can take a
long time to run when applied to a string that does not match. Consider the
pattern fragment
.sp
- (a+)*
+ ^(a+)*
.sp
-This can match "aaaa" in 33 different ways, and this number increases very
+This can match "aaaa" in 16 different ways, and this number increases very
rapidly as the string gets longer. (The * repeat can match 0, 1, 2, 3, or 4
-times, and for each of those cases other than 0, the + repeats can match
+times, and for each of those cases other than 0 or 4, the + repeats can match
different numbers of times.) When the remainder of the pattern is such that the
entire match is going to fail, PCRE has in principle to try every possible
-variation, and this can take an extremely long time.
+variation, and this can take an extremely long time, even for relatively short
+strings.
.P
An optimization catches some of the more simple cases such as
.sp
@@ -71,6 +134,6 @@ In many cases, the solution to this kind of performance issue is to use an
atomic group or a possessive quantifier.
.P
.in 0
-Last updated: 28 February 2005
+Last updated: 20 September 2006
.br
-Copyright (c) 1997-2005 University of Cambridge.
+Copyright (c) 1997-2006 University of Cambridge.
diff --git a/doc/pcreposix.3 b/doc/pcreposix.3
index 0e9c860..e1c4f79 100644
--- a/doc/pcreposix.3
+++ b/doc/pcreposix.3
@@ -218,7 +218,7 @@ Philip Hazel
.br
University Computing Service,
.br
-Cambridge CB2 3QG, England.
+Cambridge CB2 3QH, England.
.P
.in 0
Last updated: 16 January 2006
diff --git a/doc/pcreprecompile.3 b/doc/pcreprecompile.3
index 556fa7f..13b4ca4 100644
--- a/doc/pcreprecompile.3
+++ b/doc/pcreprecompile.3
@@ -118,14 +118,16 @@ usual way.
The layout of the control block that is at the start of the data that makes up
a compiled pattern was changed for release 5.0. If you have any saved patterns
that were compiled with previous releases (not a facility that was previously
-advertised), you will have to recompile them for release 5.0. However, from now
-on, it should be possible to make changes in a compatible manner.
+advertised), you will have to recompile them for release 5.0 and above.
.P
-Notwithstanding the above, if you have any saved patterns in UTF-8 mode that
-use \ep or \eP that were compiled with any release up to and including 6.4, you
-will have to recompile them for release 6.5 and above.
+If you have any saved patterns in UTF-8 mode that use \ep or \eP that were
+compiled with any release up to and including 6.4, you will have to recompile
+them for release 6.5 and above.
+.P
+All saved patterns from earlier releases must be recompiled for release 7.0 or
+higher, because there was an internal reorganization at that release.
.P
.in 0
-Last updated: 01 February 2006
+Last updated: 28 November 2006
.br
Copyright (c) 1997-2006 University of Cambridge.
diff --git a/doc/pcrestack.3 b/doc/pcrestack.3
index 7685573..5cceeae 100644
--- a/doc/pcrestack.3
+++ b/doc/pcrestack.3
@@ -61,6 +61,10 @@ assume this is relatively rare). A possessive quantifier is used to stop any
backtracking into the runs of non-"<" characters, but that is not related to
stack usage.
.P
+This example shows that one way of avoiding stack problems when matching long
+subject strings is to write repeated parenthesized subpatterns to match more
+than one character whenever possible.
+.P
In environments where stack memory is constrained, you might want to compile
PCRE to use heap memory instead of stack for remembering back-up points. This
makes it run a lot more slowly, however. Details of how to do this are given in
@@ -70,15 +74,16 @@ the
.\"
documentation.
.P
-In Unix-like environments, there is not often a problem with the stack, though
-the default limit on stack size varies from system to system. Values from 8Mb
-to 64Mb are common. You can find your default limit by running the command:
+In Unix-like environments, there is not often a problem with the stack unless
+very long strings are involved, though the default limit on stack size varies
+from system to system. Values from 8Mb to 64Mb are common. You can find your
+default limit by running the command:
.sp
ulimit -s
.sp
-The effect of running out of stack is often SIGSEGV, though sometimes an error
-message is given. You can normally increase the limit on stack size by code
-such as this:
+Unfortunately, the effect of running out of stack is often SIGSEGV, though
+sometimes a more explicit error message is given. You can normally increase the
+limit on stack size by code such as this:
.sp
struct rlimit rlim;
getrlimit(RLIMIT_STACK, &rlim);
@@ -107,9 +112,9 @@ As a very rough rule of thumb, you should reckon on about 500 bytes per
recursion. Thus, if you want to limit your stack usage to 8Mb, you
should set the limit at 16000 recursions. A 64Mb stack, on the other hand, can
support around 128000 recursions. The \fBpcretest\fP test program has a command
-line option (\fB-S\fP) that can be used to increase its stack.
+line option (\fB-S\fP) that can be used to increase the size of its stack.
.P
.in 0
-Last updated: 29 June 2006
+Last updated: 14 September 2006
.br
Copyright (c) 1997-2006 University of Cambridge.
diff --git a/doc/pcretest.1 b/doc/pcretest.1
index 7d3904f..0aa00cd 100644
--- a/doc/pcretest.1
+++ b/doc/pcretest.1
@@ -24,19 +24,27 @@ documentation.
.SH OPTIONS
.rs
.TP 10
+\fB-b\fP
+Behave as if each regex has the \fB/B\fP (show bytecode) modifier; the internal
+form is output after compilation.
+.TP 10
\fB-C\fP
Output the version number of the PCRE library, and all available information
about the optional features that are included, and then exit.
.TP 10
\fB-d\fP
Behave as if each regex has the \fB/D\fP (debug) modifier; the internal
-form is output after compilation.
+form and information about the compiled pattern is output after compilation;
+\fB-d\fP is equivalent to \fB-b -i\fP.
.TP 10
\fB-dfa\fP
Behave as if each data line contains the \eD escape sequence; this causes the
alternative matching function, \fBpcre_dfa_exec()\fP, to be used instead of the
standard \fBpcre_exec()\fP function (more detail is given below).
.TP 10
+\fB-help\fP
+Output a brief summary these options and then exit.
+.TP 10
\fB-i\fP
Behave as if each regex has the \fB/I\fP modifier; information about the
compiled pattern is given after compilation.
@@ -48,9 +56,11 @@ with earlier versions of pcretest, \fB-s\fP is a synonym for \fB-m\fP.
.TP 10
\fB-o\fP \fIosize\fP
Set the number of elements in the output vector that is used when calling
-\fBpcre_exec()\fP to be \fIosize\fP. The default value is 45, which is enough
-for 14 capturing subexpressions. The vector size can be changed for individual
-matching calls by including \eO in the data line (see below).
+\fBpcre_exec()\fP or \fBpcre_dfa_exec()\fP to be \fIosize\fP. The default value
+is 45, which is enough for 14 capturing subexpressions for \fBpcre_exec()\fP or
+22 different matches for \fBpcre_dfa_exec()\fP. The vector size can be
+changed for individual matching calls by including \eO in the data line (see
+below).
.TP 10
\fB-p\fP
Behave as if each regex has the \fB/P\fP modifier; the POSIX wrapper API is
@@ -68,7 +78,14 @@ megabytes.
Run each compile, study, and match many times with a timer, and output
resulting time per compile or match (in milliseconds). Do not set \fB-m\fP with
\fB-t\fP, because you will then get the size output a zillion times, and the
-timing will be distorted.
+timing will be distorted. You can control the number of iterations that are
+used for timing by following \fB-t\fP with a number (as a separate item on the
+command line). For example, "-t 1000" would iterate 1000 times. The default is
+to iterate 500000 times.
+.TP 10
+\fB-tm\fP
+This is like \fB-t\fP except that it times only the matching phase, not the
+compile or study phases.
.
.
.SH DESCRIPTION
@@ -86,8 +103,8 @@ lines to be matched against the pattern.
.P
Each data line is matched separately and independently. If you want to do
multi-line matches, you have to use the \en escape sequence (or \er or \er\en,
-depending on the newline setting) in a single line of input to encode the
-newline characters. There is no limit on the length of data lines; the input
+etc., depending on the newline setting) in a single line of input to encode the
+newline sequences. There is no limit on the length of data lines; the input
buffer is automatically extended if it is too small.
.P
An empty line signals the end of the data lines, at which point a new regular
@@ -151,9 +168,14 @@ not correspond to anything in Perl:
\fB/<cr>\fP PCRE_NEWLINE_CR
\fB/<lf>\fP PCRE_NEWLINE_LF
\fB/<crlf>\fP PCRE_NEWLINE_CRLF
+ \fB/<any>\fP PCRE_NEWLINE_ANY
+.sp
+Those specifying line ending sequencess are literal strings as shown. This
+example sets multiline matching with CRLF as the line ending sequence:
.sp
-Those specifying line endings are literal strings as shown. Details of the
-meanings of these PCRE options are given in the
+ /^abc/m<crlf>
+.sp
+Details of the meanings of these PCRE options are given in the
.\" HREF
\fBpcreapi\fP
.\"
@@ -191,6 +213,9 @@ matched the entire pattern, pcretest should in addition output the remainder of
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.
+.P
The \fB/L\fP modifier must be followed directly by the name of a locale, for
example,
.sp
@@ -207,10 +232,8 @@ compiled pattern (whether it is anchored, has a fixed first character, and
so on). It does this by calling \fBpcre_fullinfo()\fP after compiling a
pattern. If the pattern is studied, the results of that are also output.
.P
-The \fB/D\fP modifier is a PCRE debugging feature, which also assumes \fB/I\fP.
-It causes the internal form of compiled regular expressions to be output after
-compilation. If the pattern was studied, the information returned is also
-output.
+The \fB/D\fP modifier is a PCRE debugging feature, and is equivalent to
+\fB/BI\fP, that is, both the \fP/B\fP and the \fB/I\fP modifiers.
.P
The \fB/F\fP modifier causes \fBpcretest\fP to flip the byte order of the
fields in the compiled pattern that contain 2-byte and 4-byte numbers. This
@@ -254,17 +277,17 @@ complicated features of PCRE. If you are just testing "ordinary" regular
expressions, you probably don't need any of these. The following escapes are
recognized:
.sp
- \ea alarm (= BEL)
- \eb backspace
- \ee escape
- \ef formfeed
- \en newline
+ \ea alarm (BEL, \ex07)
+ \eb backspace (\ex08)
+ \ee escape (\ex27)
+ \ef formfeed (\ex0c)
+ \en newline (\ex0a)
.\" JOIN
\eqdd set the PCRE_MATCH_LIMIT limit to dd
(any number of digits)
- \er carriage return
- \et tab
- \ev vertical tab
+ \er carriage return (\ex0d)
+ \et tab (\ex09)
+ \ev vertical tab (\ex0b)
\ennn octal character (up to 3 octal digits)
\exhh hexadecimal character (up to 2 hex digits)
.\" JOIN
@@ -344,11 +367,17 @@ recognized:
.\" JOIN
\e<crlf> pass the PCRE_NEWLINE_CRLF option to \fBpcre_exec()\fP
or \fBpcre_dfa_exec()\fP
+.\" JOIN
+ \e<any> pass the PCRE_NEWLINE_ANY option to \fBpcre_exec()\fP
+ or \fBpcre_dfa_exec()\fP
.sp
-The escapes that specify line endings are literal strings, exactly as shown.
-A backslash followed by anything else just escapes the anything else. If the
-very last character is a backslash, it is ignored. This gives a way of passing
-an empty line as data, since a real empty line terminates the data input.
+The escapes that specify line ending sequences are literal strings, exactly as
+shown. No more than one newline setting should be present in any data line.
+.P
+A backslash followed by anything else just escapes the anything else. If
+the very last character is a backslash, it is ignored. This gives a way of
+passing an empty line as data, since a real empty line terminates the data
+input.
.P
If \eM is present, \fBpcretest\fP calls \fBpcre_exec()\fP several times, with
different values in the \fImatch_limit\fP and \fImatch_limit_recursion\fP
@@ -411,7 +440,7 @@ respectively, and otherwise the PCRE negative error number. Here is an example
of an interactive \fBpcretest\fP run.
.sp
$ pcretest
- PCRE version 5.00 07-Sep-2004
+ PCRE version 7.0 30-Nov-2006
.sp
re> /^abc(\ed+)/
data> abc123
@@ -422,9 +451,9 @@ of an interactive \fBpcretest\fP run.
.sp
If the strings contain any non-printing characters, they are output as \e0x
escapes, or as \ex{...} escapes if the \fB/8\fP modifier was present on the
-pattern. If the pattern has the \fB/+\fP modifier, the output for substring 0
-is followed by the the rest of the subject string, identified by "0+" like
-this:
+pattern. See below for the definition of non-printing characters. If the
+pattern has the \fB/+\fP modifier, the output for substring 0 is followed by
+the the rest of the subject string, identified by "0+" like this:
.sp
re> /cat/+
data> cataract
@@ -452,10 +481,11 @@ instead of a colon. This is in addition to the normal full list. The string
length (that is, the return from the extraction function) is given in
parentheses after each string for \fB\eC\fP and \fB\eG\fP.
.P
-Note that while patterns can be continued over several lines (a plain ">"
+Note that whereas patterns can be continued over several lines (a plain ">"
prompt is used for continuations), data lines may not. However newlines can be
-included in data by means of the \en escape (or \er or \er\en for those newline
-settings).
+included in data by means of the \en escape (or \er, \er\en, etc., depending on
+the newline sequence setting).
+.
.
.
.SH "OUTPUT FROM THE ALTERNATIVE MATCHING FUNCTION"
@@ -475,7 +505,7 @@ the subject where there is at least one match. For example:
(Using the normal matching function on this data finds only "tang".) The
longest matching string is always given first (and numbered zero).
.P
-If \fB/g\P is present on the pattern, the search for further matches resumes
+If \fB/g\fP is present on the pattern, the search for further matches resumes
at the end of the longest match. For example:
.sp
re> /(tang|tangerine|tan)/g
@@ -556,6 +586,21 @@ the
documentation.
.
.
+.
+.SH "NON-PRINTING CHARACTERS"
+.rs
+.sp
+When \fBpcretest\fP is outputting text in the compiled version of a pattern,
+bytes other than 32-126 are always treated as non-printing characters are are
+therefore shown as hex escapes.
+.P
+When \fBpcretest\fP is outputting text that is a matched part of a subject
+string, it behaves in the same way, unless a different locale has been set for
+the pattern (using the \fB/L\fP modifier). In this case, the \fBisprint()\fP
+function to distinguish printing and non-printing characters.
+.
+.
+.
.SH "SAVING AND RELOADING COMPILED PATTERNS"
.rs
.sp
@@ -616,6 +661,13 @@ Finally, if you attempt to load a file that is not in the correct format, the
result is undefined.
.
.
+.SH "SEE ALSO"
+.rs
+.sp
+\fBpcre\fP(3), \fBpcreapi\fP(3), \fBpcrecallout\fP(3), \fBpcrematching\fP(3),
+\fBpcrepartial\fP(d), \fPpcrepattern\fP(3), \fBpcreprecompile\fP(3).
+.
+.
.SH AUTHOR
.rs
.sp
@@ -623,9 +675,9 @@ Philip Hazel
.br
University Computing Service,
.br
-Cambridge CB2 3QG, England.
+Cambridge CB2 3QH, England.
.P
.in 0
-Last updated: 29 June 2006
+Last updated: 30 November 2006
.br
Copyright (c) 1997-2006 University of Cambridge.
diff --git a/doc/pcretest.txt b/doc/pcretest.txt
index 274e998..3bf8cae 100644
--- a/doc/pcretest.txt
+++ b/doc/pcretest.txt
@@ -19,18 +19,24 @@ SYNOPSIS
OPTIONS
+ -b Behave as if each regex has the /B (show bytecode) modifier;
+ the internal form is output after compilation.
+
-C Output the version number of the PCRE library, and all avail-
- able information about the optional features that are
+ able information about the optional features that are
included, and then exit.
- -d Behave as if each regex has the /D (debug) modifier; the
- internal form is output after compilation.
+ -d Behave as if each regex has the /D (debug) modifier; the
+ internal form and information about the compiled pattern is
+ output after compilation; -d is equivalent to -b -i.
-dfa Behave as if each data line contains the \D escape sequence;
this causes the alternative matching function,
pcre_dfa_exec(), to be used instead of the standard
pcre_exec() function (more detail is given below).
+ -help Output a brief summary these options and then exit.
+
-i Behave as if each regex has the /I modifier; information
about the compiled pattern is given after compilation.
@@ -40,10 +46,12 @@ OPTIONS
pcretest, -s is a synonym for -m.
-o osize Set the number of elements in the output vector that is used
- when calling pcre_exec() to be osize. The default value is
- 45, which is enough for 14 capturing subexpressions. The vec-
- tor size can be changed for individual matching calls by
- including \O in the data line (see below).
+ when calling pcre_exec() or pcre_dfa_exec() to be osize. The
+ default value is 45, which is enough for 14 capturing subex-
+ pressions for pcre_exec() or 22 different matches for
+ pcre_dfa_exec(). The vector size can be changed for individ-
+ ual matching calls by including \O in the data line (see
+ below).
-p Behave as if each regex has the /P modifier; the POSIX wrap-
per API is used to call PCRE. None of the other options has
@@ -59,7 +67,13 @@ OPTIONS
and output resulting time per compile or match (in millisec-
onds). Do not set -m with -t, because you will then get the
size output a zillion times, and the timing will be dis-
- torted.
+ torted. You can control the number of iterations that are
+ used for timing by following -t with a number (as a separate
+ item on the command line). For example, "-t 1000" would iter-
+ ate 1000 times. The default is to iterate 500000 times.
+
+ -tm This is like -t except that it times only the matching phase,
+ not the compile or study phases.
DESCRIPTION
@@ -77,53 +91,54 @@ DESCRIPTION
Each data line is matched separately and independently. If you want to
do multi-line matches, you have to use the \n escape sequence (or \r or
- \r\n, depending on the newline setting) in a single line of input to
- encode the newline characters. There is no limit on the length of data
- lines; the input buffer is automatically extended if it is too small.
+ \r\n, etc., depending on the newline setting) in a single line of input
+ to encode the newline sequences. There is no limit on the length of
+ data lines; the input buffer is automatically extended if it is too
+ small.
- An empty line signals the end of the data lines, at which point a new
- regular expression is read. The regular expressions are given enclosed
+ An empty line signals the end of the data lines, at which point a new
+ regular expression is read. The regular expressions are given enclosed
in any non-alphanumeric delimiters other than backslash, for example:
/(a|bc)x+yz/
- White space before the initial delimiter is ignored. A regular expres-
- sion may be continued over several input lines, in which case the new-
- line characters are included within it. It is possible to include the
+ White space before the initial delimiter is ignored. A regular expres-
+ sion may be continued over several input lines, in which case the new-
+ line characters are included within it. It is possible to include the
delimiter within the pattern by escaping it, for example
/abc\/def/
- If you do so, the escape and the delimiter form part of the pattern,
- but since delimiters are always non-alphanumeric, this does not affect
- its interpretation. If the terminating delimiter is immediately fol-
+ If you do so, the escape and the delimiter form part of the pattern,
+ but since delimiters are always non-alphanumeric, this does not affect
+ its interpretation. If the terminating delimiter is immediately fol-
lowed by a backslash, for example,
/abc/\
- then a backslash is added to the end of the pattern. This is done to
- provide a way of testing the error condition that arises if a pattern
+ then a backslash is added to the end of the pattern. This is done to
+ provide a way of testing the error condition that arises if a pattern
finishes with a backslash, because
/abc\/
- is interpreted as the first line of a pattern that starts with "abc/",
+ is interpreted as the first line of a pattern that starts with "abc/",
causing pcretest to read the next line as a continuation of the regular
expression.
PATTERN MODIFIERS
- A pattern may be followed by any number of modifiers, which are mostly
- single characters. Following Perl usage, these are referred to below
- as, for example, "the /i modifier", even though the delimiter of the
- pattern need not always be a slash, and no slash is used when writing
- modifiers. Whitespace may appear between the final pattern delimiter
+ A pattern may be followed by any number of modifiers, which are mostly
+ single characters. Following Perl usage, these are referred to below
+ as, for example, "the /i modifier", even though the delimiter of the
+ pattern need not always be a slash, and no slash is used when writing
+ modifiers. Whitespace may appear between the final pattern delimiter
and the first modifier, and between the modifiers themselves.
The /i, /m, /s, and /x modifiers set the PCRE_CASELESS, PCRE_MULTILINE,
- PCRE_DOTALL, or PCRE_EXTENDED options, respectively, when pcre_com-
- pile() is called. These four modifier letters have the same effect as
+ PCRE_DOTALL, or PCRE_EXTENDED options, respectively, when pcre_com-
+ pile() is called. These four modifier letters have the same effect as
they do in Perl. For example:
/caseless/i
@@ -142,10 +157,16 @@ PATTERN MODIFIERS
/<cr> PCRE_NEWLINE_CR
/<lf> PCRE_NEWLINE_LF
/<crlf> PCRE_NEWLINE_CRLF
+ /<any> PCRE_NEWLINE_ANY
+
+ Those specifying line ending sequencess are literal strings as shown.
+ This example sets multiline matching with CRLF as the line ending
+ sequence:
- Those specifying line endings are literal strings as shown. Details of
- the meanings of these PCRE options are given in the pcreapi documenta-
- tion.
+ /^abc/m<crlf>
+
+ Details of the meanings of these PCRE options are given in the pcreapi
+ documentation.
Finding all matches in a string
@@ -175,79 +196,80 @@ PATTERN MODIFIERS
remainder of the subject string. This is useful for tests where the
subject contains multiple copies of the same substring.
- The /L modifier must be followed directly by the name of a locale, for
+ The /B modifier is a debugging feature. It requests that pcretest out-
+ put a representation of the compiled byte code after compilation.
+
+ The /L modifier must be followed directly by the name of a locale, for
example,
/pattern/Lfr_FR
For this reason, it must be the last modifier. The given locale is set,
- pcre_maketables() is called to build a set of character tables for the
- locale, and this is then passed to pcre_compile() when compiling the
- regular expression. Without an /L modifier, NULL is passed as the
- tables pointer; that is, /L applies only to the expression on which it
+ pcre_maketables() is called to build a set of character tables for the
+ locale, and this is then passed to pcre_compile() when compiling the
+ regular expression. Without an /L modifier, NULL is passed as the
+ tables pointer; that is, /L applies only to the expression on which it
appears.
- The /I modifier requests that pcretest output information about the
- compiled pattern (whether it is anchored, has a fixed first character,
- and so on). It does this by calling pcre_fullinfo() after compiling a
- pattern. If the pattern is studied, the results of that are also out-
+ The /I modifier requests that pcretest output information about the
+ compiled pattern (whether it is anchored, has a fixed first character,
+ and so on). It does this by calling pcre_fullinfo() after compiling a
+ pattern. If the pattern is studied, the results of that are also out-
put.
- The /D modifier is a PCRE debugging feature, which also assumes /I. It
- causes the internal form of compiled regular expressions to be output
- after compilation. If the pattern was studied, the information returned
- is also output.
+ The /D modifier is a PCRE debugging feature, and is equivalent to /BI,
+ that is, both the /B and the /I modifiers.
The /F modifier causes pcretest to flip the byte order of the fields in
- the compiled pattern that contain 2-byte and 4-byte numbers. This
- facility is for testing the feature in PCRE that allows it to execute
+ the compiled pattern that contain 2-byte and 4-byte numbers. This
+ facility is for testing the feature in PCRE that allows it to execute
patterns that were compiled on a host with a different endianness. This
- feature is not available when the POSIX interface to PCRE is being
- used, that is, when the /P pattern modifier is specified. See also the
+ feature is not available when the POSIX interface to PCRE is being
+ used, that is, when the /P pattern modifier is specified. See also the
section about saving and reloading compiled patterns below.
- The /S modifier causes pcre_study() to be called after the expression
+ The /S modifier causes pcre_study() to be called after the expression
has been compiled, and the results used when the expression is matched.
- The /M modifier causes the size of memory block used to hold the com-
+ The /M modifier causes the size of memory block used to hold the com-
piled pattern to be output.
- The /P modifier causes pcretest to call PCRE via the POSIX wrapper API
- rather than its native API. When this is done, all other modifiers
- except /i, /m, and /+ are ignored. REG_ICASE is set if /i is present,
- and REG_NEWLINE is set if /m is present. The wrapper functions force
- PCRE_DOLLAR_ENDONLY always, and PCRE_DOTALL unless REG_NEWLINE is set.
+ The /P modifier causes pcretest to call PCRE via the POSIX wrapper API
+ rather than its native API. When this is done, all other modifiers
+ except /i, /m, and /+ are ignored. REG_ICASE is set if /i is present,
+ and REG_NEWLINE is set if /m is present. The wrapper functions force
+ PCRE_DOLLAR_ENDONLY always, and PCRE_DOTALL unless REG_NEWLINE is set.
- The /8 modifier causes pcretest to call PCRE with the PCRE_UTF8 option
- set. This turns on support for UTF-8 character handling in PCRE, pro-
- vided that it was compiled with this support enabled. This modifier
+ The /8 modifier causes pcretest to call PCRE with the PCRE_UTF8 option
+ set. This turns on support for UTF-8 character handling in PCRE, pro-
+ vided that it was compiled with this support enabled. This modifier
also causes any non-printing characters in output strings to be printed
using the \x{hh...} notation if they are valid UTF-8 sequences.
- If the /? modifier is used with /8, it causes pcretest to call
- pcre_compile() with the PCRE_NO_UTF8_CHECK option, to suppress the
+ If the /? modifier is used with /8, it causes pcretest to call
+ pcre_compile() with the PCRE_NO_UTF8_CHECK option, to suppress the
checking of the string for UTF-8 validity.
DATA LINES
- Before each data line is passed to pcre_exec(), leading and trailing
- whitespace is removed, and it is then scanned for \ escapes. Some of
- these are pretty esoteric features, intended for checking out some of
- the more complicated features of PCRE. If you are just testing "ordi-
- nary" regular expressions, you probably don't need any of these. The
+ Before each data line is passed to pcre_exec(), leading and trailing
+ whitespace is removed, and it is then scanned for \ escapes. Some of
+ these are pretty esoteric features, intended for checking out some of
+ the more complicated features of PCRE. If you are just testing "ordi-
+ nary" regular expressions, you probably don't need any of these. The
following escapes are recognized:
- \a alarm (= BEL)
- \b backspace
- \e escape
- \f formfeed
- \n newline
+ \a alarm (BEL, \x07)
+ \b backspace (\x08)
+ \e escape (\x27)
+ \f formfeed (\x0c)
+ \n newline (\x0a)
\qdd set the PCRE_MATCH_LIMIT limit to dd
(any number of digits)
- \r carriage return
- \t tab
- \v vertical tab
+ \r carriage return (\x0d)
+ \t tab (\x09)
+ \v vertical tab (\x0b)
\nnn octal character (up to 3 octal digits)
\xhh hexadecimal character (up to 2 hex digits)
\x{hh...} hexadecimal character, any number of digits
@@ -304,12 +326,17 @@ DATA LINES
or pcre_dfa_exec()
\<crlf> pass the PCRE_NEWLINE_CRLF option to pcre_exec()
or pcre_dfa_exec()
+ \<any> pass the PCRE_NEWLINE_ANY option to pcre_exec()
+ or pcre_dfa_exec()
- The escapes that specify line endings are literal strings, exactly as
- shown. A backslash followed by anything else just escapes the anything
- else. If the very last character is a backslash, it is ignored. This
- gives a way of passing an empty line as data, since a real empty line
- terminates the data input.
+ The escapes that specify line ending sequences are literal strings,
+ exactly as shown. No more than one newline setting should be present in
+ any data line.
+
+ A backslash followed by anything else just escapes the anything else.
+ If the very last character is a backslash, it is ignored. This gives a
+ way of passing an empty line as data, since a real empty line termi-
+ nates the data input.
If \M is present, pcretest calls pcre_exec() several times, with dif-
ferent values in the match_limit and match_limit_recursion fields of
@@ -366,7 +393,7 @@ DEFAULT OUTPUT FROM PCRETEST
is an example of an interactive pcretest run.
$ pcretest
- PCRE version 5.00 07-Sep-2004
+ PCRE version 7.0 30-Nov-2006
re> /^abc(\d+)/
data> abc123
@@ -377,16 +404,17 @@ DEFAULT OUTPUT FROM PCRETEST
If the strings contain any non-printing characters, they are output as
\0x escapes, or as \x{...} escapes if the /8 modifier was present on
- the pattern. If the pattern has the /+ modifier, the output for sub-
- string 0 is followed by the the rest of the subject string, identified
- by "0+" like this:
+ the pattern. See below for the definition of non-printing characters.
+ If the pattern has the /+ modifier, the output for substring 0 is fol-
+ lowed by the the rest of the subject string, identified by "0+" like
+ this:
re> /cat/+
data> cataract
0: cat
0+ aract
- If the pattern has the /g or /G modifier, the results of successive
+ If the pattern has the /g or /G modifier, the results of successive
matching attempts are output in sequence, like this:
re> /\Bi(\w\w)/g
@@ -400,24 +428,24 @@ DEFAULT OUTPUT FROM PCRETEST
"No match" is output only if the first match attempt fails.
- If any of the sequences \C, \G, or \L are present in a data line that
- is successfully matched, the substrings extracted by the convenience
+ If any of the sequences \C, \G, or \L are present in a data line that
+ is successfully matched, the substrings extracted by the convenience
functions are output with C, G, or L after the string number instead of
a colon. This is in addition to the normal full list. The string length
- (that is, the return from the extraction function) is given in paren-
+ (that is, the return from the extraction function) is given in paren-
theses after each string for \C and \G.
- Note that while patterns can be continued over several lines (a plain
+ Note that whereas patterns can be continued over several lines (a plain
">" prompt is used for continuations), data lines may not. However new-
- lines can be included in data by means of the \n escape (or \r or \r\n
- for those newline settings).
+ lines can be included in data by means of the \n escape (or \r, \r\n,
+ etc., depending on the newline sequence setting).
OUTPUT FROM THE ALTERNATIVE MATCHING FUNCTION
- When the alternative matching function, pcre_dfa_exec(), is used (by
- means of the \D escape sequence or the -dfa command line option), the
- output consists of a list of all the matches that start at the first
+ When the alternative matching function, pcre_dfa_exec(), is used (by
+ means of the \D escape sequence or the -dfa command line option), the
+ output consists of a list of all the matches that start at the first
point in the subject where there is at least one match. For example:
re> /(tang|tangerine|tan)/
@@ -426,11 +454,11 @@ OUTPUT FROM THE ALTERNATIVE MATCHING FUNCTION
1: tang
2: tan
- (Using the normal matching function on this data finds only "tang".)
- The longest matching string is always given first (and numbered zero).
+ (Using the normal matching function on this data finds only "tang".)
+ The longest matching string is always given first (and numbered zero).
- If /gP is present on the pattern, the search for further matches
- resumes at the end of the longest match. For example:
+ If /g is present on the pattern, the search for further matches resumes
+ at the end of the longest match. For example:
re> /(tang|tangerine|tan)/g
data> yellow tangerine and tangy sultana\D
@@ -441,16 +469,16 @@ OUTPUT FROM THE ALTERNATIVE MATCHING FUNCTION
1: tan
0: tan
- Since the matching function does not support substring capture, the
- escape sequences that are concerned with captured substrings are not
+ Since the matching function does not support substring capture, the
+ escape sequences that are concerned with captured substrings are not
relevant.
RESTARTING AFTER A PARTIAL MATCH
When the alternative matching function has given the PCRE_ERROR_PARTIAL
- return, indicating that the subject partially matched the pattern, you
- can restart the match with additional subject data by means of the \R
+ return, indicating that the subject partially matched the pattern, you
+ can restart the match with additional subject data by means of the \R
escape sequence. For example:
re> /^?(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)$/
@@ -459,30 +487,30 @@ RESTARTING AFTER A PARTIAL MATCH
data> n05\R\D
0: n05
- For further information about partial matching, see the pcrepartial
+ For further information about partial matching, see the pcrepartial
documentation.
CALLOUTS
- If the pattern contains any callout requests, pcretest's callout func-
- tion is called during matching. This works with both matching func-
+ If the pattern contains any callout requests, pcretest's callout func-
+ tion is called during matching. This works with both matching func-
tions. By default, the called function displays the callout number, the
- start and current positions in the text at the callout time, and the
+ start and current positions in the text at the callout time, and the
next pattern item to be tested. For example, the output
--->pqrabcdef
0 ^ ^ \d
- indicates that callout number 0 occurred for a match attempt starting
- at the fourth character of the subject string, when the pointer was at
- the seventh character of the data, and when the next pattern item was
- \d. Just one circumflex is output if the start and current positions
+ indicates that callout number 0 occurred for a match attempt starting
+ at the fourth character of the subject string, when the pointer was at
+ the seventh character of the data, and when the next pattern item was
+ \d. Just one circumflex is output if the start and current positions
are the same.
Callouts numbered 255 are assumed to be automatic callouts, inserted as
- a result of the /C pattern modifier. In this case, instead of showing
- the callout number, the offset in the pattern, preceded by a plus, is
+ a result of the /C pattern modifier. In this case, instead of showing
+ the callout number, the offset in the pattern, preceded by a plus, is
output. For example:
re> /\d?[A-E]\*/C
@@ -494,76 +522,94 @@ CALLOUTS
+10 ^ ^
0: E*
- The callout function in pcretest returns zero (carry on matching) by
- default, but you can use a \C item in a data line (as described above)
+ The callout function in pcretest returns zero (carry on matching) by
+ default, but you can use a \C item in a data line (as described above)
to change this.
- Inserting callouts can be helpful when using pcretest to check compli-
- cated regular expressions. For further information about callouts, see
+ Inserting callouts can be helpful when using pcretest to check compli-
+ cated regular expressions. For further information about callouts, see
the pcrecallout documentation.
+NON-PRINTING CHARACTERS
+
+ When pcretest is outputting text in the compiled version of a pattern,
+ bytes other than 32-126 are always treated as non-printing characters
+ are are therefore shown as hex escapes.
+
+ When pcretest is outputting text that is a matched part of a subject
+ string, it behaves in the same way, unless a different locale has been
+ set for the pattern (using the /L modifier). In this case, the
+ isprint() function to distinguish printing and non-printing characters.
+
+
SAVING AND RELOADING COMPILED PATTERNS
- The facilities described in this section are not available when the
+ The facilities described in this section are not available when the
POSIX inteface to PCRE is being used, that is, when the /P pattern mod-
ifier is specified.
When the POSIX interface is not in use, you can cause pcretest to write
- a compiled pattern to a file, by following the modifiers with > and a
+ a compiled pattern to a file, by following the modifiers with > and a
file name. For example:
/pattern/im >/some/file
- See the pcreprecompile documentation for a discussion about saving and
+ See the pcreprecompile documentation for a discussion about saving and
re-using compiled patterns.
- The data that is written is binary. The first eight bytes are the
- length of the compiled pattern data followed by the length of the
- optional study data, each written as four bytes in big-endian order
- (most significant byte first). If there is no study data (either the
+ The data that is written is binary. The first eight bytes are the
+ length of the compiled pattern data followed by the length of the
+ optional study data, each written as four bytes in big-endian order
+ (most significant byte first). If there is no study data (either the
pattern was not studied, or studying did not return any data), the sec-
- ond length is zero. The lengths are followed by an exact copy of the
+ ond length is zero. The lengths are followed by an exact copy of the
compiled pattern. If there is additional study data, this follows imme-
- diately after the compiled pattern. After writing the file, pcretest
+ diately after the compiled pattern. After writing the file, pcretest
expects to read a new pattern.
A saved pattern can be reloaded into pcretest by specifing < and a file
- name instead of a pattern. The name of the file must not contain a <
- character, as otherwise pcretest will interpret the line as a pattern
+ name instead of a pattern. The name of the file must not contain a <
+ character, as otherwise pcretest will interpret the line as a pattern
delimited by < characters. For example:
re> </some/file
Compiled regex loaded from /some/file
No study data
- When the pattern has been loaded, pcretest proceeds to read data lines
+ When the pattern has been loaded, pcretest proceeds to read data lines
in the usual way.
- You can copy a file written by pcretest to a different host and reload
- it there, even if the new host has opposite endianness to the one on
- which the pattern was compiled. For example, you can compile on an i86
+ You can copy a file written by pcretest to a different host and reload
+ it there, even if the new host has opposite endianness to the one on
+ which the pattern was compiled. For example, you can compile on an i86
machine and run on a SPARC machine.
- File names for saving and reloading can be absolute or relative, but
- note that the shell facility of expanding a file name that starts with
+ File names for saving and reloading can be absolute or relative, but
+ note that the shell facility of expanding a file name that starts with
a tilde (~) is not available.
- The ability to save and reload files in pcretest is intended for test-
- ing and experimentation. It is not intended for production use because
- only a single pattern can be written to a file. Furthermore, there is
- no facility for supplying custom character tables for use with a
- reloaded pattern. If the original pattern was compiled with custom
- tables, an attempt to match a subject string using a reloaded pattern
- is likely to cause pcretest to crash. Finally, if you attempt to load
+ The ability to save and reload files in pcretest is intended for test-
+ ing and experimentation. It is not intended for production use because
+ only a single pattern can be written to a file. Furthermore, there is
+ no facility for supplying custom character tables for use with a
+ reloaded pattern. If the original pattern was compiled with custom
+ tables, an attempt to match a subject string using a reloaded pattern
+ is likely to cause pcretest to crash. Finally, if you attempt to load
a file that is not in the correct format, the result is undefined.
+SEE ALSO
+
+ pcre(3), pcreapi(3), pcrecallout(3), pcrematching(3), pcrepartial(d),
+ pcrepattern(3), pcreprecompile(3).
+
+
AUTHOR
Philip Hazel
University Computing Service,
- Cambridge CB2 3QG, England.
+ Cambridge CB2 3QH, England.
-Last updated: 29 June 2006
+Last updated: 30 November 2006
Copyright (c) 1997-2006 University of Cambridge.
diff --git a/libpcre.a.dev b/libpcre.a.dev
new file mode 100644
index 0000000..eafe9ac
--- /dev/null
+++ b/libpcre.a.dev
@@ -0,0 +1,299 @@
+[Project]
+FileName=libpcre.a.dev
+Name=libpcre.a
+UnitCount=25
+Type=2
+Ver=1
+ObjFiles=
+Includes=
+Libs=
+PrivateResource=
+ResourceIncludes=
+MakeIncludes=
+Compiler=-DSUPPORT_UTF8_@@_-DSUPPORT_UCP_@@_-DPOSIX_MALLOC_THRESHOLD=10_@@_-DPCRE_STATIC_@@_
+CppCompiler=
+Linker=
+IsCpp=0
+Icon=
+ExeOutput=
+ObjectOutput=
+OverrideOutput=1
+OverrideOutputName=libpcre.a
+HostApplication=
+Folders=
+CommandLine=
+UseCustomMakefile=0
+CustomMakefile=
+IncludeVersionInfo=0
+SupportXPThemes=0
+CompilerSet=0
+CompilerSettings=0000000000000000000000
+
+[Unit1]
+FileName=chartables.c
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit2]
+FileName=pcre_compile.c
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit3]
+FileName=pcre_refcount.c
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit4]
+FileName=pcre_config.c
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit5]
+FileName=pcre_dfa_exec.c
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit6]
+FileName=pcre_exec.c
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit7]
+FileName=pcre_fullinfo.c
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit8]
+FileName=pcre_get.c
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit9]
+FileName=pcre_globals.c
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit10]
+FileName=pcre_info.c
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit11]
+FileName=pcre_internal.h
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit12]
+FileName=pcre_maketables.c
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit13]
+FileName=pcre_ord2utf8.c
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit14]
+FileName=pcre_xclass.c
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit15]
+FileName=pcre_study.c
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit16]
+FileName=pcre_tables.c
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit17]
+FileName=pcre_try_flipped.c
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit18]
+FileName=pcre_ucp_findchar.c
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit19]
+FileName=pcre_valid_utf8.c
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit20]
+FileName=pcre_version.c
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[VersionInfo]
+Major=0
+Minor=1
+Release=1
+Build=1
+LanguageID=1033
+CharsetID=1252
+CompanyName=
+FileVersion=
+FileDescription=Developed using the Dev-C++ IDE
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=
+AutoIncBuildNr=0
+
+[Unit21]
+FileName=pcre.h
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit22]
+FileName=pcre_scanner.h
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit23]
+FileName=pcreposix.h
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit24]
+FileName=ucpinternal.h
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit25]
+FileName=ucp.h
+CompileCpp=0
+Folder=libpcre.a
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
diff --git a/libpcrecpp.pc.in b/libpcrecpp.pc.in
new file mode 100644
index 0000000..b5ca534
--- /dev/null
+++ b/libpcrecpp.pc.in
@@ -0,0 +1,12 @@
+# Package Information for pkg-config
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libpcrecpp
+Description: PCRECPP - C++ wrapper for PCRE
+Version: @PCRE_VERSION@
+Libs: -L${libdir} -lpcre -lpcrecpp
+Cflags: -I${includedir}
diff --git a/pcre.h b/pcre.h
index 7a7051c..e973396 100644
--- a/pcre.h
+++ b/pcre.h
@@ -5,7 +5,7 @@
/* This is the public header file for the PCRE library, to be #included by
applications that call the PCRE functions.
- Copyright (c) 1997-2005 University of Cambridge
+ Copyright (c) 1997-2006 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -52,10 +52,10 @@ and libpcre.pc. The values are not put into configure.ac and substituted here
cannot run ./configure. As it now stands, this file need not be edited in that
circumstance. */
-#define PCRE_MAJOR 6
-#define PCRE_MINOR 7
+#define PCRE_MAJOR 7
+#define PCRE_MINOR 0
#define PCRE_PRERELEASE
-#define PCRE_DATE 04-Jul-2006
+#define PCRE_DATE 18-Dec-2006
/* Win32 uses DLL by default; it needs special stuff for exported functions
when building PCRE. */
@@ -118,6 +118,7 @@ extern "C" {
#define PCRE_NEWLINE_CR 0x00100000
#define PCRE_NEWLINE_LF 0x00200000
#define PCRE_NEWLINE_CRLF 0x00300000
+#define PCRE_NEWLINE_ANY 0x00400000
/* Exec-time and get/set-time error codes */
@@ -125,7 +126,8 @@ extern "C" {
#define PCRE_ERROR_NULL (-2)
#define PCRE_ERROR_BADOPTION (-3)
#define PCRE_ERROR_BADMAGIC (-4)
-#define PCRE_ERROR_UNKNOWN_NODE (-5)
+#define PCRE_ERROR_UNKNOWN_OPCODE (-5)
+#define PCRE_ERROR_UNKNOWN_NODE (-5) /* For backward compatibility */
#define PCRE_ERROR_NOMEMORY (-6)
#define PCRE_ERROR_NOSUBSTRING (-7)
#define PCRE_ERROR_MATCHLIMIT (-8)
@@ -142,6 +144,8 @@ extern "C" {
#define PCRE_ERROR_DFA_WSSIZE (-19)
#define PCRE_ERROR_DFA_RECURSE (-20)
#define PCRE_ERROR_RECURSIONLIMIT (-21)
+#define PCRE_ERROR_NULLWSLIMIT (-22)
+#define PCRE_ERROR_BADNEWLINE (-23)
/* Request types for pcre_fullinfo() */
diff --git a/pcre_compile.c b/pcre_compile.c
index 4ea73d9..34721c8 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -42,7 +42,11 @@ POSSIBILITY OF SUCH DAMAGE.
supporting internal functions that are not used by other modules. */
-#define NLBLOCK cd /* The block containing newline information */
+#define NLBLOCK cd /* Block containing newline information */
+#define PSSTART start_pattern /* Field containing processed string start */
+#define PSEND end_pattern /* Field containing processed string end */
+
+
#include "pcre_internal.h"
@@ -54,18 +58,23 @@ used by pcretest. DEBUG is not defined when building a production library. */
#endif
-
/*************************************************
* Code parameters and static tables *
*************************************************/
-/* Maximum number of items on the nested bracket stacks at compile time. This
-applies to the nesting of all kinds of parentheses. It does not limit
-un-nested, non-capturing parentheses. This number can be made bigger if
-necessary - it is used to dimension one int and one unsigned char vector at
-compile time. */
+/* This value specifies the size of stack workspace that is used during the
+first pre-compile phase that determines how much memory is required. The regex
+is partly compiled into this space, but the compiled parts are discarded as
+soon as they can be, so that hopefully there will never be an overrun. The code
+does, however, check for an overrun. The largest amount I've seen used is 218,
+so this number is very generous.
-#define BRASTACK_SIZE 200
+The same workspace is used during the second, actual compile phase for
+remembering forward references to groups so that they can be filled in at the
+end. Each entry in this list occupies LINK_SIZE bytes, so even when LINK_SIZE
+is 4 there is plenty of room. */
+
+#define COMPILE_WORK_SIZE (4096)
/* Table for handling escaped characters in the range '0'-'z'. Positive returns
@@ -79,10 +88,10 @@ static const short int escapes[] = {
0, 0, ':', ';', '<', '=', '>', '?', /* 8 - ? */
'@', -ESC_A, -ESC_B, -ESC_C, -ESC_D, -ESC_E, 0, -ESC_G, /* @ - G */
0, 0, 0, 0, 0, 0, 0, 0, /* H - O */
--ESC_P, -ESC_Q, 0, -ESC_S, 0, 0, 0, -ESC_W, /* P - W */
+-ESC_P, -ESC_Q, -ESC_R, -ESC_S, 0, 0, 0, -ESC_W, /* P - W */
-ESC_X, 0, -ESC_Z, '[', '\\', ']', '^', '_', /* X - _ */
'`', 7, -ESC_b, 0, -ESC_d, ESC_e, ESC_f, 0, /* ` - g */
- 0, 0, 0, 0, 0, 0, ESC_n, 0, /* h - o */
+ 0, 0, 0, -ESC_k, 0, 0, ESC_n, 0, /* h - o */
-ESC_p, 0, ESC_r, -ESC_s, ESC_tee, 0, 0, -ESC_w, /* p - w */
0, 0, -ESC_z /* x - z */
};
@@ -98,7 +107,7 @@ static const short int escapes[] = {
/* 78 */ 0, '`', ':', '#', '@', '\'', '=', '"',
/* 80 */ 0, 7, -ESC_b, 0, -ESC_d, ESC_e, ESC_f, 0,
/* 88 */ 0, 0, 0, '{', 0, 0, 0, 0,
-/* 90 */ 0, 0, 0, 'l', 0, ESC_n, 0, -ESC_p,
+/* 90 */ 0, 0, -ESC_k, 'l', 0, ESC_n, 0, -ESC_p,
/* 98 */ 0, ESC_r, 0, '}', 0, 0, 0, 0,
/* A0 */ 0, '~', -ESC_s, ESC_tee, 0, 0, -ESC_w, 0,
/* A8 */ 0,-ESC_z, 0, 0, 0, '[', 0, 0,
@@ -107,7 +116,7 @@ static const short int escapes[] = {
/* C0 */ '{',-ESC_A, -ESC_B, -ESC_C, -ESC_D,-ESC_E, 0, -ESC_G,
/* C8 */ 0, 0, 0, 0, 0, 0, 0, 0,
/* D0 */ '}', 0, 0, 0, 0, 0, 0, -ESC_P,
-/* D8 */-ESC_Q, 0, 0, 0, 0, 0, 0, 0,
+/* D8 */-ESC_Q,-ESC_R, 0, 0, 0, 0, 0, 0,
/* E0 */ '\\', 0, -ESC_S, 0, 0, 0, -ESC_W, -ESC_X,
/* E8 */ 0,-ESC_Z, 0, 0, 0, 0, 0, 0,
/* F0 */ 0, 0, 0, 0, 0, 0, 0, 0,
@@ -156,8 +165,13 @@ static const int posix_class_maps[] = {
};
+#define STRING(a) # a
+#define XSTRING(s) STRING(s)
+
/* The texts of compile-time error messages. These are "char *" because they
-are passed to the outside world. */
+are passed to the outside world. Do not ever re-use any error number, because
+they are documented. Always add a new error instead. Messages marked DEAD below
+are no longer used. */
static const char *error_texts[] = {
"no error",
@@ -172,7 +186,7 @@ static const char *error_texts[] = {
"range out of order in character class",
"nothing to repeat",
/* 10 */
- "operand of unlimited repeat could match the empty string",
+ "operand of unlimited repeat could match the empty string", /** DEAD **/
"internal error: unexpected repeat",
"unrecognized character after (?",
"POSIX named classes are supported only within a class",
@@ -182,7 +196,7 @@ static const char *error_texts[] = {
"erroffset passed as NULL",
"unknown option bit(s) set",
"missing ) after comment",
- "parentheses nested too deeply",
+ "parentheses nested too deeply", /** DEAD **/
/* 20 */
"regular expression too large",
"failed to get memory",
@@ -199,7 +213,7 @@ static const char *error_texts[] = {
"unknown POSIX class name",
"POSIX collating elements are not supported",
"this version of PCRE is not compiled with PCRE_UTF8 support",
- "spare error",
+ "spare error", /** DEAD **/
"character value in \\x{...} sequence is too large",
/* 35 */
"invalid condition (?(0)",
@@ -210,18 +224,25 @@ static const char *error_texts[] = {
/* 40 */
"recursive call could loop indefinitely",
"unrecognized character after (?P",
- "syntax error after (?P",
+ "syntax error in subpattern name (missing terminator)",
"two named subpatterns have the same name",
"invalid UTF-8 string",
/* 45 */
"support for \\P, \\p, and \\X has not been compiled",
"malformed \\P or \\p sequence",
"unknown property name after \\P or \\p",
- "subpattern name is too long (maximum 32 characters)",
- "too many named subpatterns (maximum 10,000)",
+ "subpattern name is too long (maximum " XSTRING(MAX_NAME_SIZE) " characters)",
+ "too many named subpatterns (maximum " XSTRING(MAX_NAME_COUNT) ")",
/* 50 */
"repeated subpattern is too long",
- "octal value is greater than \\377 (not in UTF-8 mode)"
+ "octal value is greater than \\377 (not in UTF-8 mode)",
+ "internal error: overran compiling workspace",
+ "internal error: previously-checked referenced subpattern not found",
+ "DEFINE group contains more than one branch",
+ /* 55 */
+ "repeating a DEFINE group is not allowed",
+ "inconsistent NEWLINE options",
+ "\\g is not followed by an (optionally braced) non-zero number"
};
@@ -352,8 +373,8 @@ static const unsigned char ebcdic_chartab[] = { /* chartable partial dup */
/* Definition to allow mutual recursion */
static BOOL
- compile_regex(int, int, int *, uschar **, const uschar **, int *, BOOL, int,
- int *, int *, branch_chain *, compile_data *);
+ compile_regex(int, int, uschar **, const uschar **, int *, BOOL, int, int *,
+ int *, branch_chain *, compile_data *, int *);
@@ -363,9 +384,11 @@ static BOOL
/* This function is called when a \ has been encountered. It either returns a
positive value for a simple escape such as \n, or a negative value which
-encodes one of the more complicated things such as \d. When UTF-8 is enabled,
-a positive value greater than 255 may be returned. On entry, ptr is pointing at
-the \. On exit, it is on the final character of the escape sequence.
+encodes one of the more complicated things such as \d. A backreference to group
+n is returned as -(ESC_REF + n); ESC_REF is the highest ESC_xxx macro. When
+UTF-8 is enabled, a positive value greater than 255 may be returned. On entry,
+ptr is pointing at the \. On exit, it is on the final character of the escape
+sequence.
Arguments:
ptrptr points to the pattern position pointer
@@ -412,6 +435,8 @@ else if ((i = escapes[c - 0x48]) != 0) c = i;
else
{
const uschar *oldptr;
+ BOOL braced, negated;
+
switch (c)
{
/* A number of Perl escapes are not handled by PCRE. We give an explicit
@@ -425,6 +450,48 @@ else
*errorcodeptr = ERR37;
break;
+ /* \g must be followed by a number, either plain or braced. If positive, it
+ is an absolute backreference. If negative, it is a relative backreference.
+ This is a Perl 5.10 feature. */
+
+ case 'g':
+ if (ptr[1] == '{')
+ {
+ braced = TRUE;
+ ptr++;
+ }
+ else braced = FALSE;
+
+ if (ptr[1] == '-')
+ {
+ negated = TRUE;
+ ptr++;
+ }
+ else negated = FALSE;
+
+ c = 0;
+ while ((digitab[ptr[1]] & ctype_digit) != 0)
+ c = c * 10 + *(++ptr) - '0';
+
+ if (c == 0 || (braced && *(++ptr) != '}'))
+ {
+ *errorcodeptr = ERR57;
+ return 0;
+ }
+
+ if (negated)
+ {
+ if (c > bracount)
+ {
+ *errorcodeptr = ERR15;
+ return 0;
+ }
+ c = bracount - (c - 1);
+ }
+
+ c = -(ESC_REF + c);
+ break;
+
/* The handling of escape sequences consisting of a string of digits
starting with one that is not zero is not straightforward. By experiment,
the way Perl works seems to be as follows:
@@ -532,7 +599,9 @@ else
}
break;
- /* Other special escapes not starting with a digit are straightforward */
+ /* For \c, a following letter is upper-cased; then the 0x40 bit is flipped.
+ This coding is ASCII-specific, but then the whole concept of \cx is
+ ASCII-specific. (However, an EBCDIC equivalent has now been added.) */
case 'c':
c = *(++ptr);
@@ -542,10 +611,6 @@ else
return 0;
}
- /* A letter is upper-cased; then the 0x40 bit is flipped. This coding
- is ASCII-specific, but then the whole concept of \cx is ASCII-specific.
- (However, an EBCDIC equivalent has now been added.) */
-
#if !EBCDIC /* ASCII coding */
if (c >= 'a' && c <= 'z') c -= 32;
c ^= 0x40;
@@ -772,42 +837,111 @@ return p;
/*************************************************
-* Find forward referenced named subpattern *
+* Find forward referenced subpattern *
*************************************************/
-/* This function scans along a pattern looking for capturing subpatterns, and
-counting them. If it finds a named pattern that matches the name it is given,
-it returns its number. This is used for forward references to named
-subpatterns. We know that if (?P< is encountered, the name will be terminated
-by '>' because that is checked in the first pass.
+/* This function scans along a pattern's text looking for capturing
+subpatterns, and counting them. If it finds a named pattern that matches the
+name it is given, it returns its number. Alternatively, if the name is NULL, it
+returns when it reaches a given numbered subpattern. This is used for forward
+references to subpatterns. We know that if (?P< is encountered, the name will
+be terminated by '>' because that is checked in the first pass.
Arguments:
- pointer current position in the pattern
- count current count of capturing parens
- name name to seek
- namelen name length
+ ptr current position in the pattern
+ count current count of capturing parens so far encountered
+ name name to seek, or NULL if seeking a numbered subpattern
+ lorn name length, or subpattern number if name is NULL
+ xmode TRUE if we are in /x mode
Returns: the number of the named subpattern, or -1 if not found
*/
static int
-find_named_parens(const uschar *ptr, int count, const uschar *name, int namelen)
+find_parens(const uschar *ptr, int count, const uschar *name, int lorn,
+ BOOL xmode)
{
const uschar *thisname;
+
for (; *ptr != 0; ptr++)
{
- if (*ptr == '\\' && ptr[1] != 0) { ptr++; continue; }
+ int term;
+
+ /* Skip over backslashed characters and also entire \Q...\E */
+
+ if (*ptr == '\\')
+ {
+ if (*(++ptr) == 0) return -1;
+ if (*ptr == 'Q') for (;;)
+ {
+ while (*(++ptr) != 0 && *ptr != '\\');
+ if (*ptr == 0) return -1;
+ if (*(++ptr) == 'E') break;
+ }
+ continue;
+ }
+
+ /* Skip over character classes */
+
+ if (*ptr == '[')
+ {
+ while (*(++ptr) != ']')
+ {
+ if (*ptr == '\\')
+ {
+ if (*(++ptr) == 0) return -1;
+ if (*ptr == 'Q') for (;;)
+ {
+ while (*(++ptr) != 0 && *ptr != '\\');
+ if (*ptr == 0) return -1;
+ if (*(++ptr) == 'E') break;
+ }
+ continue;
+ }
+ }
+ continue;
+ }
+
+ /* Skip comments in /x mode */
+
+ if (xmode && *ptr == '#')
+ {
+ while (*(++ptr) != 0 && *ptr != '\n');
+ if (*ptr == 0) return -1;
+ continue;
+ }
+
+ /* An opening parens must now be a real metacharacter */
+
if (*ptr != '(') continue;
- if (ptr[1] != '?') { count++; continue; }
- if (ptr[2] == '(') { ptr += 2; continue; }
- if (ptr[2] != 'P' || ptr[3] != '<') continue;
+ if (ptr[1] != '?')
+ {
+ count++;
+ if (name == NULL && count == lorn) return count;
+ continue;
+ }
+
+ ptr += 2;
+ if (*ptr == 'P') ptr++; /* Allow optional P */
+
+ /* We have to disambiguate (?<! and (?<= from (?<name> */
+
+ if ((*ptr != '<' || ptr[1] == '!' || ptr[1] == '=') &&
+ *ptr != '\'')
+ continue;
+
count++;
- ptr += 4;
+
+ if (name == NULL && count == lorn) return count;
+ term = *ptr++;
+ if (term == '<') term = '>';
thisname = ptr;
- while (*ptr != '>') ptr++;
- if (namelen == ptr - thisname && strncmp(name, thisname, namelen) == 0)
+ while (*ptr != term) ptr++;
+ if (name != NULL && lorn == ptr - thisname &&
+ strncmp((const char *)name, (const char *)thisname, lorn) == 0)
return count;
}
+
return -1;
}
@@ -862,7 +996,8 @@ for (;;)
case OP_CALLOUT:
case OP_CREF:
- case OP_BRANUMBER:
+ case OP_RREF:
+ case OP_DEF:
code += _pcre_OP_lengths[*code];
break;
@@ -907,14 +1042,14 @@ for (;;)
{
int d;
register int op = *cc;
- if (op >= OP_BRA) op = OP_BRA;
switch (op)
{
+ case OP_CBRA:
case OP_BRA:
case OP_ONCE:
case OP_COND:
- d = find_fixedlength(cc, options);
+ d = find_fixedlength(cc + ((op == OP_CBRA)? 2:0), options);
if (d < 0) return d;
branchlength += d;
do cc += GET(cc, 1); while (*cc == OP_ALT);
@@ -949,8 +1084,9 @@ for (;;)
/* Skip over things that don't match chars */
case OP_REVERSE:
- case OP_BRANUMBER:
case OP_CREF:
+ case OP_RREF:
+ case OP_DEF:
case OP_OPT:
case OP_CALLOUT:
case OP_SOD:
@@ -1094,21 +1230,18 @@ for (;;)
if (c == OP_XCLASS) code += GET(code, 1);
- /* Handle bracketed group */
+ /* Handle capturing bracket */
- else if (c > OP_BRA)
+ else if (c == OP_CBRA)
{
- int n = c - OP_BRA;
- if (n > EXTRACT_BASIC_MAX) n = GET2(code, 2+LINK_SIZE);
+ int n = GET2(code, 1+LINK_SIZE);
if (n == number) return (uschar *)code;
- code += _pcre_OP_lengths[OP_BRA];
+ code += _pcre_OP_lengths[c];
}
- /* Otherwise, we get the item's length from the table. In UTF-8 mode, opcodes
- that are followed by a character may be followed by a multi-byte character.
- The length in the table is a minimum, so we have to scan along to skip the
- extra bytes. All opcodes are less than 128, so we can use relatively
- efficient code. */
+ /* In UTF-8 mode, opcodes that are followed by a character may be followed by
+ a multi-byte character. The length in the table is a minimum, so we have to
+ arrange to skip the extra bytes. */
else
{
@@ -1120,13 +1253,17 @@ for (;;)
case OP_EXACT:
case OP_UPTO:
case OP_MINUPTO:
+ case OP_POSUPTO:
case OP_STAR:
case OP_MINSTAR:
+ case OP_POSSTAR:
case OP_PLUS:
case OP_MINPLUS:
+ case OP_POSPLUS:
case OP_QUERY:
case OP_MINQUERY:
- while ((*code & 0xc0) == 0x80) code++;
+ case OP_POSQUERY:
+ if (code[-1] >= 0xc0) code += _pcre_utf8_table4[code[-1] & 0x3f];
break;
}
}
@@ -1164,18 +1301,10 @@ for (;;)
if (c == OP_XCLASS) code += GET(code, 1);
- /* All bracketed groups have the same length. */
-
- else if (c > OP_BRA)
- {
- code += _pcre_OP_lengths[OP_BRA];
- }
-
/* Otherwise, we get the item's length from the table. In UTF-8 mode, opcodes
that are followed by a character may be followed by a multi-byte character.
- The length in the table is a minimum, so we have to scan along to skip the
- extra bytes. All opcodes are less than 128, so we can use relatively
- efficient code. */
+ The length in the table is a minimum, so we have to arrange to skip the extra
+ bytes. */
else
{
@@ -1187,13 +1316,17 @@ for (;;)
case OP_EXACT:
case OP_UPTO:
case OP_MINUPTO:
+ case OP_POSUPTO:
case OP_STAR:
case OP_MINSTAR:
+ case OP_POSSTAR:
case OP_PLUS:
case OP_MINPLUS:
+ case OP_POSPLUS:
case OP_QUERY:
case OP_MINQUERY:
- while ((*code & 0xc0) == 0x80) code++;
+ case OP_POSQUERY:
+ if (code[-1] >= 0xc0) code += _pcre_utf8_table4[code[-1] & 0x3f];
break;
}
}
@@ -1207,10 +1340,11 @@ for (;;)
*************************************************/
/* This function scans through a branch of a compiled pattern to see whether it
-can match the empty string or not. It is called only from could_be_empty()
-below. Note that first_significant_code() skips over assertions. If we hit an
-unclosed bracket, we return "empty" - this means we've struck an inner bracket
-whose current branch will already have been scanned.
+can match the empty string or not. It is called from could_be_empty()
+below and from compile_branch() when checking for an unlimited repeat of a
+group that can match nothing. Note that first_significant_code() skips over
+assertions. If we hit an unclosed bracket, we return "empty" - this means we've
+struck an inner bracket whose current branch will already have been scanned.
Arguments:
code points to start of search
@@ -1224,7 +1358,7 @@ static BOOL
could_be_empty_branch(const uschar *code, const uschar *endcode, BOOL utf8)
{
register int c;
-for (code = first_significant_code(code + 1 + LINK_SIZE, NULL, 0, TRUE);
+for (code = first_significant_code(code + _pcre_OP_lengths[*code], NULL, 0, TRUE);
code < endcode;
code = first_significant_code(code + _pcre_OP_lengths[c], NULL, 0, TRUE))
{
@@ -1232,7 +1366,7 @@ for (code = first_significant_code(code + 1 + LINK_SIZE, NULL, 0, TRUE);
c = *code;
- if (c >= OP_BRA)
+ if (c == OP_BRA || c == OP_CBRA || c == OP_ONCE)
{
BOOL empty_branch;
if (GET(code, 1) == 0) return TRUE; /* Hit unclosed bracket */
@@ -1248,11 +1382,18 @@ for (code = first_significant_code(code + 1 + LINK_SIZE, NULL, 0, TRUE);
}
while (*code == OP_ALT);
if (!empty_branch) return FALSE; /* All branches are non-empty */
- code += 1 + LINK_SIZE;
- c = *code;
+
+ /* Move past the KET and fudge things so that the increment in the "for"
+ above has no effect. */
+
+ c = OP_END;
+ code += 1 + LINK_SIZE - _pcre_OP_lengths[c];
+ continue;
}
- else switch (c)
+ /* Handle the other opcodes */
+
+ switch (c)
{
/* Check for quantifiers after a class */
@@ -1308,12 +1449,15 @@ for (code = first_significant_code(code + 1 + LINK_SIZE, NULL, 0, TRUE);
case OP_NOT:
case OP_PLUS:
case OP_MINPLUS:
+ case OP_POSPLUS:
case OP_EXACT:
case OP_NOTPLUS:
case OP_NOTMINPLUS:
+ case OP_NOTPOSPLUS:
case OP_NOTEXACT:
case OP_TYPEPLUS:
case OP_TYPEMINPLUS:
+ case OP_TYPEPOSPLUS:
case OP_TYPEEXACT:
return FALSE;
@@ -1325,16 +1469,19 @@ for (code = first_significant_code(code + 1 + LINK_SIZE, NULL, 0, TRUE);
case OP_ALT:
return TRUE;
- /* In UTF-8 mode, STAR, MINSTAR, QUERY, MINQUERY, UPTO, and MINUPTO may be
- followed by a multibyte character */
+ /* In UTF-8 mode, STAR, MINSTAR, POSSTAR, QUERY, MINQUERY, POSQUERY, UPTO,
+ MINUPTO, and POSUPTO may be followed by a multibyte character */
#ifdef SUPPORT_UTF8
case OP_STAR:
case OP_MINSTAR:
+ case OP_POSSTAR:
case OP_QUERY:
case OP_MINQUERY:
+ case OP_POSQUERY:
case OP_UPTO:
case OP_MINUPTO:
+ case OP_POSUPTO:
if (utf8) while ((code[2] & 0xc0) == 0x80) code++;
break;
#endif
@@ -1452,26 +1599,57 @@ earlier groups that are outside the current group). However, when a group is
optional (i.e. the minimum quantifier is zero), OP_BRAZERO is inserted before
it, after it has been compiled. This means that any OP_RECURSE items within it
that refer to the group itself or any contained groups have to have their
-offsets adjusted. That is the job of this function. Before it is called, the
-partially compiled regex must be temporarily terminated with OP_END.
+offsets adjusted. That one of the jobs of this function. Before it is called,
+the partially compiled regex must be temporarily terminated with OP_END.
+
+This function has been extended with the possibility of forward references for
+recursions and subroutine calls. It must also check the list of such references
+for the group we are dealing with. If it finds that one of the recursions in
+the current group is on this list, it adjusts the offset in the list, not the
+value in the reference (which is a group number).
Arguments:
group points to the start of the group
adjust the amount by which the group is to be moved
utf8 TRUE in UTF-8 mode
cd contains pointers to tables etc.
+ save_hwm the hwm forward reference pointer at the start of the group
Returns: nothing
*/
static void
-adjust_recurse(uschar *group, int adjust, BOOL utf8, compile_data *cd)
+adjust_recurse(uschar *group, int adjust, BOOL utf8, compile_data *cd,
+ uschar *save_hwm)
{
uschar *ptr = group;
while ((ptr = (uschar *)find_recurse(ptr, utf8)) != NULL)
{
- int offset = GET(ptr, 1);
- if (cd->start_code + offset >= group) PUT(ptr, 1, offset + adjust);
+ int offset;
+ uschar *hc;
+
+ /* See if this recursion is on the forward reference list. If so, adjust the
+ reference. */
+
+ for (hc = save_hwm; hc < cd->hwm; hc += LINK_SIZE)
+ {
+ offset = GET(hc, 0);
+ if (cd->start_code + offset == ptr + 1)
+ {
+ PUT(hc, 0, offset + adjust);
+ break;
+ }
+ }
+
+ /* Otherwise, adjust the recursion offset if it's after the start of this
+ group. */
+
+ if (hc >= cd->hwm)
+ {
+ offset = GET(ptr, 1);
+ if (cd->start_code + offset >= group) PUT(ptr, 1, offset + adjust);
+ }
+
ptr += 1 + LINK_SIZE;
}
}
@@ -1550,12 +1728,13 @@ Yield: TRUE when range returned; FALSE when no more
*/
static BOOL
-get_othercase_range(int *cptr, int d, int *ocptr, int *odptr)
+get_othercase_range(unsigned int *cptr, unsigned int d, unsigned int *ocptr,
+ unsigned int *odptr)
{
-int c, othercase, next;
+unsigned int c, othercase, next;
for (c = *cptr; c <= d; c++)
- { if ((othercase = _pcre_ucp_othercase(c)) >= 0) break; }
+ { if ((othercase = _pcre_ucp_othercase(c)) != NOTACHAR) break; }
if (c > d) return FALSE;
@@ -1576,17 +1755,249 @@ return TRUE;
#endif /* SUPPORT_UCP */
+
+/*************************************************
+* Check if auto-possessifying is possible *
+*************************************************/
+
+/* This function is called for unlimited repeats of certain items, to see
+whether the next thing could possibly match the repeated item. If not, it makes
+sense to automatically possessify the repeated item.
+
+Arguments:
+ op_code the repeated op code
+ this data for this item, depends on the opcode
+ utf8 TRUE in UTF-8 mode
+ utf8_char used for utf8 character bytes, NULL if not relevant
+ ptr next character in pattern
+ options options bits
+ cd contains pointers to tables etc.
+
+Returns: TRUE if possessifying is wanted
+*/
+
+static BOOL
+check_auto_possessive(int op_code, int item, BOOL utf8, uschar *utf8_char,
+ const uschar *ptr, int options, compile_data *cd)
+{
+int next;
+
+/* Skip whitespace and comments in extended mode */
+
+if ((options & PCRE_EXTENDED) != 0)
+ {
+ for (;;)
+ {
+ while ((cd->ctypes[*ptr] & ctype_space) != 0) ptr++;
+ if (*ptr == '#')
+ {
+ while (*(++ptr) != 0)
+ if (IS_NEWLINE(ptr)) { ptr += cd->nllen; break; }
+ }
+ else break;
+ }
+ }
+
+/* If the next item is one that we can handle, get its value. A non-negative
+value is a character, a negative value is an escape value. */
+
+if (*ptr == '\\')
+ {
+ int temperrorcode = 0;
+ next = check_escape(&ptr, &temperrorcode, cd->bracount, options, FALSE);
+ if (temperrorcode != 0) return FALSE;
+ ptr++; /* Point after the escape sequence */
+ }
+
+else if ((cd->ctypes[*ptr] & ctype_meta) == 0)
+ {
+#ifdef SUPPORT_UTF8
+ if (utf8) { GETCHARINC(next, ptr); } else
+#endif
+ next = *ptr++;
+ }
+
+else return FALSE;
+
+/* Skip whitespace and comments in extended mode */
+
+if ((options & PCRE_EXTENDED) != 0)
+ {
+ for (;;)
+ {
+ while ((cd->ctypes[*ptr] & ctype_space) != 0) ptr++;
+ if (*ptr == '#')
+ {
+ while (*(++ptr) != 0)
+ if (IS_NEWLINE(ptr)) { ptr += cd->nllen; break; }
+ }
+ else break;
+ }
+ }
+
+/* If the next thing is itself optional, we have to give up. */
+
+if (*ptr == '*' || *ptr == '?' || strncmp((char *)ptr, "{0,", 3) == 0)
+ return FALSE;
+
+/* Now compare the next item with the previous opcode. If the previous is a
+positive single character match, "item" either contains the character or, if
+"item" is greater than 127 in utf8 mode, the character's bytes are in
+utf8_char. */
+
+
+/* Handle cases when the next item is a character. */
+
+if (next >= 0) switch(op_code)
+ {
+ case OP_CHAR:
+#ifdef SUPPORT_UTF8
+ if (utf8 && item > 127) { GETCHAR(item, utf8_char); }
+#endif
+ return item != next;
+
+ /* For CHARNC (caseless character) we must check the other case. If we have
+ Unicode property support, we can use it to test the other case of
+ high-valued characters. */
+
+ case OP_CHARNC:
+#ifdef SUPPORT_UTF8
+ if (utf8 && item > 127) { GETCHAR(item, utf8_char); }
+#endif
+ if (item == next) return FALSE;
+#ifdef SUPPORT_UTF8
+ if (utf8)
+ {
+ unsigned int othercase;
+ if (next < 128) othercase = cd->fcc[next]; else
+#ifdef SUPPORT_UCP
+ othercase = _pcre_ucp_othercase((unsigned int)next);
+#else
+ othercase = NOTACHAR;
+#endif
+ return (unsigned int)item != othercase;
+ }
+ else
+#endif /* SUPPORT_UTF8 */
+ return (item != cd->fcc[next]); /* Non-UTF-8 mode */
+
+ /* For OP_NOT, "item" must be a single-byte character. */
+
+ case OP_NOT:
+ if (next < 0) return FALSE; /* Not a character */
+ if (item == next) return TRUE;
+ if ((options & PCRE_CASELESS) == 0) return FALSE;
+#ifdef SUPPORT_UTF8
+ if (utf8)
+ {
+ unsigned int othercase;
+ if (next < 128) othercase = cd->fcc[next]; else
+#ifdef SUPPORT_UCP
+ othercase = _pcre_ucp_othercase(next);
+#else
+ othercase = NOTACHAR;
+#endif
+ return (unsigned int)item == othercase;
+ }
+ else
+#endif /* SUPPORT_UTF8 */
+ return (item == cd->fcc[next]); /* Non-UTF-8 mode */
+
+ case OP_DIGIT:
+ return next > 127 || (cd->ctypes[next] & ctype_digit) == 0;
+
+ case OP_NOT_DIGIT:
+ return next <= 127 && (cd->ctypes[next] & ctype_digit) != 0;
+
+ case OP_WHITESPACE:
+ return next > 127 || (cd->ctypes[next] & ctype_space) == 0;
+
+ case OP_NOT_WHITESPACE:
+ return next <= 127 && (cd->ctypes[next] & ctype_space) != 0;
+
+ case OP_WORDCHAR:
+ return next > 127 || (cd->ctypes[next] & ctype_word) == 0;
+
+ case OP_NOT_WORDCHAR:
+ return next <= 127 && (cd->ctypes[next] & ctype_word) != 0;
+
+ default:
+ return FALSE;
+ }
+
+
+/* Handle the case when the next item is \d, \s, etc. */
+
+switch(op_code)
+ {
+ case OP_CHAR:
+ case OP_CHARNC:
+#ifdef SUPPORT_UTF8
+ if (utf8 && item > 127) { GETCHAR(item, utf8_char); }
+#endif
+ switch(-next)
+ {
+ case ESC_d:
+ return item > 127 || (cd->ctypes[item] & ctype_digit) == 0;
+
+ case ESC_D:
+ return item <= 127 && (cd->ctypes[item] & ctype_digit) != 0;
+
+ case ESC_s:
+ return item > 127 || (cd->ctypes[item] & ctype_space) == 0;
+
+ case ESC_S:
+ return item <= 127 && (cd->ctypes[item] & ctype_space) != 0;
+
+ case ESC_w:
+ return item > 127 || (cd->ctypes[item] & ctype_word) == 0;
+
+ case ESC_W:
+ return item <= 127 && (cd->ctypes[item] & ctype_word) != 0;
+
+ default:
+ return FALSE;
+ }
+
+ case OP_DIGIT:
+ return next == -ESC_D || next == -ESC_s || next == -ESC_W;
+
+ case OP_NOT_DIGIT:
+ return next == -ESC_d;
+
+ case OP_WHITESPACE:
+ return next == -ESC_S || next == -ESC_d || next == -ESC_w;
+
+ case OP_NOT_WHITESPACE:
+ return next == -ESC_s;
+
+ case OP_WORDCHAR:
+ return next == -ESC_W || next == -ESC_s;
+
+ case OP_NOT_WORDCHAR:
+ return next == -ESC_w || next == -ESC_d;
+
+ default:
+ return FALSE;
+ }
+
+/* Control does not reach here */
+}
+
+
+
/*************************************************
* Compile one branch *
*************************************************/
-/* Scan the pattern, compiling it into the code vector. If the options are
+/* Scan the pattern, compiling it into the a vector. If the options are
changed during the branch, the pointer is used to change the external options
-bits.
+bits. This function is used during the pre-compile phase when we are trying
+to find out the amount of memory needed, as well as during the real compile
+phase. The value of lengthptr distinguishes the two phases.
Arguments:
optionsptr pointer to the option bits
- brackets points to number of extracting brackets used
codeptr points to the pointer to the current code point
ptrptr points to the current pattern pointer
errorcodeptr points to error code variable
@@ -1594,15 +2005,17 @@ Arguments:
reqbyteptr set to the last literal character required, else < 0
bcptr points to current branch chain
cd contains pointers to tables etc.
+ lengthptr NULL during the real compile phase
+ points to length accumulator during pre-compile phase
Returns: TRUE on success
FALSE, with *errorcodeptr set non-zero on error
*/
static BOOL
-compile_branch(int *optionsptr, int *brackets, uschar **codeptr,
- const uschar **ptrptr, int *errorcodeptr, int *firstbyteptr,
- int *reqbyteptr, branch_chain *bcptr, compile_data *cd)
+compile_branch(int *optionsptr, uschar **codeptr, const uschar **ptrptr,
+ int *errorcodeptr, int *firstbyteptr, int *reqbyteptr, branch_chain *bcptr,
+ compile_data *cd, int *lengthptr)
{
int repeat_type, op_type;
int repeat_min = 0, repeat_max = 0; /* To please picky compilers */
@@ -1613,8 +2026,11 @@ int zeroreqbyte, zerofirstbyte;
int req_caseopt, reqvary, tempreqvary;
int options = *optionsptr;
int after_manual_callout = 0;
+int length_prevgroup = 0;
register int c;
register uschar *code = *codeptr;
+uschar *last_code = code;
+uschar *orig_code = code;
uschar *tempcode;
BOOL inescq = FALSE;
BOOL groupsetfirstbyte = FALSE;
@@ -1622,6 +2038,7 @@ const uschar *ptr = *ptrptr;
const uschar *tempptr;
uschar *previous = NULL;
uschar *previous_callout = NULL;
+uschar *save_hwm = NULL;
uschar classbits[32];
#ifdef SUPPORT_UTF8
@@ -1631,6 +2048,11 @@ uschar *class_utf8data;
uschar utf8_char[6];
#else
BOOL utf8 = FALSE;
+uschar *utf8_char = NULL;
+#endif
+
+#ifdef DEBUG
+if (lengthptr != NULL) DPRINTF((">> start branch\n"));
#endif
/* Set up the default and non-default settings for greediness */
@@ -1664,6 +2086,7 @@ for (;; ptr++)
BOOL negate_class;
BOOL possessive_quantifier;
BOOL is_quantifier;
+ BOOL is_recurse;
int class_charcount;
int class_lastchar;
int newoptions;
@@ -1671,13 +2094,68 @@ for (;; ptr++)
int skipbytes;
int subreqbyte;
int subfirstbyte;
+ int terminator;
int mclength;
uschar mcbuffer[8];
- /* Next byte in the pattern */
+ /* Get next byte in the pattern */
c = *ptr;
+ /* If we are in the pre-compile phase, accumulate the length used for the
+ previous cycle of this loop. */
+
+ if (lengthptr != NULL)
+ {
+#ifdef DEBUG
+ if (code > cd->hwm) cd->hwm = code; /* High water info */
+#endif
+ if (code > cd->start_workspace + COMPILE_WORK_SIZE) /* Check for overrun */
+ {
+ *errorcodeptr = ERR52;
+ goto FAILED;
+ }
+
+ /* There is at least one situation where code goes backwards: this is the
+ case of a zero quantifier after a class (e.g. [ab]{0}). At compile time,
+ the class is simply eliminated. However, it is created first, so we have to
+ allow memory for it. Therefore, don't ever reduce the length at this point.
+ */
+
+ if (code < last_code) code = last_code;
+ *lengthptr += code - last_code;
+ DPRINTF(("length=%d added %d c=%c\n", *lengthptr, code - last_code, c));
+
+ /* If "previous" is set and it is not at the start of the work space, move
+ it back to there, in order to avoid filling up the work space. Otherwise,
+ if "previous" is NULL, reset the current code pointer to the start. */
+
+ if (previous != NULL)
+ {
+ if (previous > orig_code)
+ {
+ memmove(orig_code, previous, code - previous);
+ code -= previous - orig_code;
+ previous = orig_code;
+ }
+ }
+ else code = orig_code;
+
+ /* Remember where this code item starts so we can pick up the length
+ next time round. */
+
+ last_code = code;
+ }
+
+ /* In the real compile phase, just check the workspace used by the forward
+ reference list. */
+
+ else if (cd->hwm > cd->start_workspace + COMPILE_WORK_SIZE)
+ {
+ *errorcodeptr = ERR52;
+ goto FAILED;
+ }
+
/* If in \Q...\E, check for the end; if not, we have a literal */
if (inescq && c != 0)
@@ -1692,7 +2170,8 @@ for (;; ptr++)
{
if (previous_callout != NULL)
{
- complete_callout(previous_callout, ptr, cd);
+ if (lengthptr == NULL) /* Don't attempt in pre-compile phase */
+ complete_callout(previous_callout, ptr, cd);
previous_callout = NULL;
}
if ((options & PCRE_AUTO_CALLOUT) != 0)
@@ -1713,7 +2192,8 @@ for (;; ptr++)
if (!is_quantifier && previous_callout != NULL &&
after_manual_callout-- <= 0)
{
- complete_callout(previous_callout, ptr, cd);
+ if (lengthptr == NULL) /* Don't attempt in pre-compile phase */
+ complete_callout(previous_callout, ptr, cd);
previous_callout = NULL;
}
@@ -1724,12 +2204,12 @@ for (;; ptr++)
if ((cd->ctypes[c] & ctype_space) != 0) continue;
if (c == '#')
{
- while (*(++ptr) != 0) if (IS_NEWLINE(ptr)) break;
- if (*ptr != 0)
+ while (*(++ptr) != 0)
{
- ptr += cd->nllen - 1;
- continue;
+ if (IS_NEWLINE(ptr)) { ptr += cd->nllen - 1; break; }
}
+ if (*ptr != 0) continue;
+
/* Else fall through to handle end of string */
c = 0;
}
@@ -1745,17 +2225,23 @@ for (;; ptr++)
switch(c)
{
- /* The branch terminates at end of string, |, or ). */
-
- case 0:
- case '|':
+ /* ===================================================================*/
+ case 0: /* The branch terminates at string end */
+ case '|': /* or | or ) */
case ')':
*firstbyteptr = firstbyte;
*reqbyteptr = reqbyte;
*codeptr = code;
*ptrptr = ptr;
+ if (lengthptr != NULL)
+ {
+ *lengthptr += code - last_code; /* To include callout length */
+ DPRINTF((">> end branch\n"));
+ }
return TRUE;
+
+ /* ===================================================================*/
/* Handle single-character metacharacters. In multiline mode, ^ disables
the setting of any following char as a first character. */
@@ -1784,6 +2270,8 @@ for (;; ptr++)
*code++ = OP_ANY;
break;
+
+ /* ===================================================================*/
/* Character classes. If the included characters are all < 256, we build a
32-byte bitmap of the permitted characters, except in the special case
where there is only one such character. For negated classes, we build the
@@ -1822,32 +2310,32 @@ for (;; ptr++)
}
/* Keep a count of chars with values < 256 so that we can optimize the case
- of just a single character (as long as it's < 256). For higher valued UTF-8
- characters, we don't yet do any optimization. */
+ of just a single character (as long as it's < 256). However, For higher
+ valued UTF-8 characters, we don't yet do any optimization. */
class_charcount = 0;
class_lastchar = -1;
+ /* Initialize the 32-char bit map to all zeros. We build the map in a
+ temporary bit of memory, in case the class contains only 1 character (less
+ than 256), because in that case the compiled code doesn't use the bit map.
+ */
+
+ memset(classbits, 0, 32 * sizeof(uschar));
+
#ifdef SUPPORT_UTF8
class_utf8 = FALSE; /* No chars >= 256 */
- class_utf8data = code + LINK_SIZE + 34; /* For UTF-8 items */
+ class_utf8data = code + LINK_SIZE + 2; /* For UTF-8 items */
#endif
- /* Initialize the 32-char bit map to all zeros. We have to build the
- map in a temporary bit of store, in case the class contains only 1
- character (< 256), because in that case the compiled code doesn't use the
- bit map. */
-
- memset(classbits, 0, 32 * sizeof(uschar));
-
/* Process characters until ] is reached. By writing this as a "do" it
- means that an initial ] is taken as a data character. The first pass
- through the regex checked the overall syntax, so we don't need to be very
- strict here. At the start of the loop, c contains the first byte of the
- character. */
+ means that an initial ] is taken as a data character. At the start of the
+ loop, c contains the first byte of the character. */
- do
+ if (c != 0) do
{
+ const uschar *oldptr;
+
#ifdef SUPPORT_UTF8
if (utf8 && c > 127)
{ /* Braces are required because the */
@@ -1859,13 +2347,13 @@ for (;; ptr++)
if (inescq)
{
- if (c == '\\' && ptr[1] == 'E')
+ if (c == '\\' && ptr[1] == 'E') /* If we are at \E */
{
- inescq = FALSE;
- ptr++;
- continue;
+ inescq = FALSE; /* Reset literal state */
+ ptr++; /* Skip the 'E' */
+ continue; /* Carry on with next */
}
- else goto LONE_SINGLE_CHARACTER;
+ goto CHECK_RANGE; /* Could be range if \E follows */
}
/* Handle POSIX class names. Perl allows a negation extension of the
@@ -1956,19 +2444,20 @@ for (;; ptr++)
}
/* Backslash may introduce a single character, or it may introduce one
- of the specials, which just set a flag. Escaped items are checked for
- validity in the pre-compiling pass. The sequence \b is a special case.
- Inside a class (and only there) it is treated as backspace. Elsewhere
- it marks a word boundary. Other escapes have preset maps ready to
- or into the one we are building. We assume they have more than one
+ of the specials, which just set a flag. The sequence \b is a special
+ case. Inside a class (and only there) it is treated as backspace.
+ Elsewhere it marks a word boundary. Other escapes have preset maps ready
+ to or into the one we are building. We assume they have more than one
character in them, so set class_charcount bigger than one. */
if (c == '\\')
{
- c = check_escape(&ptr, errorcodeptr, *brackets, options, TRUE);
+ c = check_escape(&ptr, errorcodeptr, cd->bracount, options, TRUE);
+ if (*errorcodeptr != 0) goto FAILED;
if (-c == ESC_b) c = '\b'; /* \b is backslash in a class */
else if (-c == ESC_X) c = 'X'; /* \X is literal X in a class */
+ else if (-c == ESC_R) c = 'R'; /* \R is literal R in a class */
else if (-c == ESC_Q) /* Handle start of quoted string */
{
if (ptr[1] == '\\' && ptr[2] == 'E')
@@ -1983,7 +2472,10 @@ for (;; ptr++)
{
register const uschar *cbits = cd->cbits;
class_charcount += 2; /* Greater than 1 is what matters */
- switch (-c)
+
+ /* Save time by not doing this in the pre-compile phase. */
+
+ if (lengthptr == NULL) switch (-c)
{
case ESC_d:
for (c = 0; c < 32; c++) classbits[c] |= cbits[c+cbit_digit];
@@ -2011,52 +2503,91 @@ for (;; ptr++)
classbits[1] |= 0x08; /* Perl 5.004 onwards omits VT from \s */
continue;
+ case ESC_E: /* Perl ignores an orphan \E */
+ continue;
+
+ default: /* Not recognized; fall through */
+ break; /* Need "default" setting to stop compiler warning. */
+ }
+
+ /* In the pre-compile phase, just do the recognition. */
+
+ else if (c == -ESC_d || c == -ESC_D || c == -ESC_w ||
+ c == -ESC_W || c == -ESC_s || c == -ESC_S) continue;
+
+ /* We need to deal with \P and \p in both phases. */
+
#ifdef SUPPORT_UCP
- case ESC_p:
- case ESC_P:
- {
- BOOL negated;
- int pdata;
- int ptype = get_ucp(&ptr, &negated, &pdata, errorcodeptr);
- if (ptype < 0) goto FAILED;
- class_utf8 = TRUE;
- *class_utf8data++ = ((-c == ESC_p) != negated)?
- XCL_PROP : XCL_NOTPROP;
- *class_utf8data++ = ptype;
- *class_utf8data++ = pdata;
- class_charcount -= 2; /* Not a < 256 character */
- }
+ if (-c == ESC_p || -c == ESC_P)
+ {
+ BOOL negated;
+ int pdata;
+ int ptype = get_ucp(&ptr, &negated, &pdata, errorcodeptr);
+ if (ptype < 0) goto FAILED;
+ class_utf8 = TRUE;
+ *class_utf8data++ = ((-c == ESC_p) != negated)?
+ XCL_PROP : XCL_NOTPROP;
+ *class_utf8data++ = ptype;
+ *class_utf8data++ = pdata;
+ class_charcount -= 2; /* Not a < 256 character */
continue;
+ }
#endif
+ /* Unrecognized escapes are faulted if PCRE is running in its
+ strict mode. By default, for compatibility with Perl, they are
+ treated as literals. */
- /* Unrecognized escapes are faulted if PCRE is running in its
- strict mode. By default, for compatibility with Perl, they are
- treated as literals. */
-
- default:
- if ((options & PCRE_EXTRA) != 0)
- {
- *errorcodeptr = ERR7;
- goto FAILED;
- }
- c = *ptr; /* The final character */
- class_charcount -= 2; /* Undo the default count from above */
+ if ((options & PCRE_EXTRA) != 0)
+ {
+ *errorcodeptr = ERR7;
+ goto FAILED;
}
+
+ class_charcount -= 2; /* Undo the default count from above */
+ c = *ptr; /* Get the final character and fall through */
}
/* Fall through if we have a single character (c >= 0). This may be
- > 256 in UTF-8 mode. */
+ greater than 256 in UTF-8 mode. */
} /* End of backslash handling */
/* A single character may be followed by '-' to form a range. However,
Perl does not permit ']' to be the end of the range. A '-' character
- here is treated as a literal. */
+ at the end is treated as a literal. Perl ignores orphaned \E sequences
+ entirely. The code for handling \Q and \E is messy. */
- if (ptr[1] == '-' && ptr[2] != ']')
+ CHECK_RANGE:
+ while (ptr[1] == '\\' && ptr[2] == 'E')
+ {
+ inescq = FALSE;
+ ptr += 2;
+ }
+
+ oldptr = ptr;
+
+ if (!inescq && ptr[1] == '-')
{
int d;
ptr += 2;
+ while (*ptr == '\\' && ptr[1] == 'E') ptr += 2;
+
+ /* If we hit \Q (not followed by \E) at this point, go into escaped
+ mode. */
+
+ while (*ptr == '\\' && ptr[1] == 'Q')
+ {
+ ptr += 2;
+ if (*ptr == '\\' && ptr[1] == 'E') { ptr += 2; continue; }
+ inescq = TRUE;
+ break;
+ }
+
+ if (*ptr == 0 || (!inescq && *ptr == ']'))
+ {
+ ptr = oldptr;
+ goto LONE_SINGLE_CHARACTER;
+ }
#ifdef SUPPORT_UTF8
if (utf8)
@@ -2071,27 +2602,34 @@ for (;; ptr++)
not any of the other escapes. Perl 5.6 treats a hyphen as a literal
in such circumstances. */
- if (d == '\\')
+ if (!inescq && d == '\\')
{
- const uschar *oldptr = ptr;
- d = check_escape(&ptr, errorcodeptr, *brackets, options, TRUE);
+ d = check_escape(&ptr, errorcodeptr, cd->bracount, options, TRUE);
+ if (*errorcodeptr != 0) goto FAILED;
- /* \b is backslash; \X is literal X; any other special means the '-'
- was literal */
+ /* \b is backslash; \X is literal X; \R is literal R; any other
+ special means the '-' was literal */
if (d < 0)
{
if (d == -ESC_b) d = '\b';
- else if (d == -ESC_X) d = 'X'; else
+ else if (d == -ESC_X) d = 'X';
+ else if (d == -ESC_R) d = 'R'; else
{
- ptr = oldptr - 2;
+ ptr = oldptr;
goto LONE_SINGLE_CHARACTER; /* A few lines below */
}
}
}
- /* The check that the two values are in the correct order happens in
- the pre-pass. Optimize one-character ranges */
+ /* Check that the two values are in the correct order. Optimize
+ one-character ranges */
+
+ if (d < c)
+ {
+ *errorcodeptr = ERR8;
+ goto FAILED;
+ }
if (d == c) goto LONE_SINGLE_CHARACTER; /* A few lines below */
@@ -2112,9 +2650,9 @@ for (;; ptr++)
#ifdef SUPPORT_UCP
if ((options & PCRE_CASELESS) != 0)
{
- int occ, ocd;
- int cc = c;
- int origd = d;
+ unsigned int occ, ocd;
+ unsigned int cc = c;
+ unsigned int origd = d;
while (get_othercase_range(&cc, origd, &occ, &ocd))
{
if (occ >= c && ocd <= d) continue; /* Skip embedded ranges */
@@ -2172,7 +2710,12 @@ for (;; ptr++)
ranges that lie entirely within 0-127 when there is UCP support; else
for partial ranges without UCP support. */
- for (; c <= d; c++)
+ class_charcount += d - c + 1;
+ class_lastchar = d;
+
+ /* We can save a bit of time by skipping this in the pre-compile. */
+
+ if (lengthptr == NULL) for (; c <= d; c++)
{
classbits[c/8] |= (1 << (c&7));
if ((options & PCRE_CASELESS) != 0)
@@ -2180,8 +2723,6 @@ for (;; ptr++)
int uc = cd->fcc[c]; /* flip case */
classbits[uc/8] |= (1 << (uc&7));
}
- class_charcount++; /* in case a one-char range */
- class_lastchar = c;
}
continue; /* Go get the next char in the class */
@@ -2205,8 +2746,8 @@ for (;; ptr++)
#ifdef SUPPORT_UCP
if ((options & PCRE_CASELESS) != 0)
{
- int othercase;
- if ((othercase = _pcre_ucp_othercase(c)) >= 0)
+ unsigned int othercase;
+ if ((othercase = _pcre_ucp_othercase(c)) != NOTACHAR)
{
*class_utf8data++ = XCL_SINGLE;
class_utf8data += _pcre_ord2utf8(othercase, class_utf8data);
@@ -2231,10 +2772,15 @@ for (;; ptr++)
}
}
- /* Loop until ']' reached; the check for end of string happens inside the
- loop. This "while" is the end of the "do" above. */
+ /* Loop until ']' reached. This "while" is the end of the "do" above. */
+
+ while ((c = *(++ptr)) != 0 && (c != ']' || inescq));
- while ((c = *(++ptr)) != ']' || inescq);
+ if (c == 0) /* Missing terminating ']' */
+ {
+ *errorcodeptr = ERR6;
+ goto FAILED;
+ }
/* If class_charcount is 1, we saw precisely one character whose value is
less than 256. In non-UTF-8 mode we can always optimize. In UTF-8 mode, we
@@ -2298,7 +2844,7 @@ for (;; ptr++)
/* If there are characters with values > 255, we have to compile an
extended class, with its own opcode. If there are no characters < 256,
- we can omit the bitmap. */
+ we can omit the bitmap in the actual compiled code. */
#ifdef SUPPORT_UTF8
if (class_utf8)
@@ -2308,24 +2854,17 @@ for (;; ptr++)
code += LINK_SIZE;
*code = negate_class? XCL_NOT : 0;
- /* If the map is required, install it, and move on to the end of
- the extra data */
+ /* If the map is required, move up the extra data to make room for it;
+ otherwise just move the code pointer to the end of the extra data. */
if (class_charcount > 0)
{
*code++ |= XCL_MAP;
+ memmove(code + 32, code, class_utf8data - code);
memcpy(code, classbits, 32);
- code = class_utf8data;
- }
-
- /* If the map is not required, slide down the extra data. */
-
- else
- {
- int len = class_utf8data - (code + 33);
- memmove(code + 1, code + 33, len);
- code += len + 1;
+ code = class_utf8data + 32;
}
+ else code = class_utf8data;
/* Now fill in the complete length of the item */
@@ -2342,7 +2881,8 @@ for (;; ptr++)
if (negate_class)
{
*code++ = OP_NCLASS;
- for (c = 0; c < 32; c++) code[c] = ~classbits[c];
+ if (lengthptr == NULL) /* Save time in the pre-compile phase */
+ for (c = 0; c < 32; c++) code[c] = ~classbits[c];
}
else
{
@@ -2352,6 +2892,8 @@ for (;; ptr++)
code += 32;
break;
+
+ /* ===================================================================*/
/* Various kinds of repeat; '{' is not necessarily a quantifier, but this
has been tested above. */
@@ -2419,20 +2961,6 @@ for (;; ptr++)
}
else repeat_type = greedy_default;
- /* If previous was a recursion, we need to wrap it inside brackets so that
- it can be replicated if necessary. */
-
- if (*previous == OP_RECURSE)
- {
- memmove(previous + 1 + LINK_SIZE, previous, 1 + LINK_SIZE);
- code += 1 + LINK_SIZE;
- *previous = OP_BRA;
- PUT(previous, 1, code - previous);
- *code = OP_KET;
- PUT(code, 1, code - previous);
- code += 1 + LINK_SIZE;
- }
-
/* If previous was a character match, abolish the item and generate a
repeat item instead. If a char item has a minumum of more than one, ensure
that it is set in reqbyte - it might not be if a sequence such as x{3} is
@@ -2466,18 +2994,40 @@ for (;; ptr++)
if (repeat_min > 1) reqbyte = c | req_caseopt | cd->req_varyopt;
}
+ /* If the repetition is unlimited, it pays to see if the next thing on
+ the line is something that cannot possibly match this character. If so,
+ automatically possessifying this item gains some performance in the case
+ where the match fails. */
+
+ if (!possessive_quantifier &&
+ repeat_max < 0 &&
+ check_auto_possessive(*previous, c, utf8, utf8_char, ptr + 1,
+ options, cd))
+ {
+ repeat_type = 0; /* Force greedy */
+ possessive_quantifier = TRUE;
+ }
+
goto OUTPUT_SINGLE_REPEAT; /* Code shared with single character types */
}
/* If previous was a single negated character ([^a] or similar), we use
one of the special opcodes, replacing it. The code is shared with single-
character repeats by setting opt_type to add a suitable offset into
- repeat_type. OP_NOT is currently used only for single-byte chars. */
+ repeat_type. We can also test for auto-possessification. OP_NOT is
+ currently used only for single-byte chars. */
else if (*previous == OP_NOT)
{
op_type = OP_NOTSTAR - OP_STAR; /* Use "not" opcodes */
c = previous[1];
+ if (!possessive_quantifier &&
+ repeat_max < 0 &&
+ check_auto_possessive(OP_NOT, c, utf8, NULL, ptr + 1, options, cd))
+ {
+ repeat_type = 0; /* Force greedy */
+ possessive_quantifier = TRUE;
+ }
goto OUTPUT_SINGLE_REPEAT;
}
@@ -2495,6 +3045,14 @@ for (;; ptr++)
op_type = OP_TYPESTAR - OP_STAR; /* Use type opcodes */
c = *previous;
+ if (!possessive_quantifier &&
+ repeat_max < 0 &&
+ check_auto_possessive(c, 0, utf8, NULL, ptr + 1, options, cd))
+ {
+ repeat_type = 0; /* Force greedy */
+ possessive_quantifier = TRUE;
+ }
+
OUTPUT_SINGLE_REPEAT:
if (*previous == OP_PROP || *previous == OP_NOTPROP)
{
@@ -2535,7 +3093,7 @@ for (;; ptr++)
}
/* A repeat minimum of 1 is optimized into some special cases. If the
- maximum is unlimited, we use OP_PLUS. Otherwise, the original item it
+ maximum is unlimited, we use OP_PLUS. Otherwise, the original item is
left in place and, if the maximum is greater than 1, we use OP_UPTO with
one less than the maximum. */
@@ -2588,7 +3146,8 @@ for (;; ptr++)
}
/* Else insert an UPTO if the max is greater than the min, again
- preceded by the character, for the previously inserted code. */
+ preceded by the character, for the previously inserted code. If the
+ UPTO is just for 1 instance, we can use QUERY instead. */
else if (repeat_max != repeat_min)
{
@@ -2607,8 +3166,16 @@ for (;; ptr++)
*code++ = prop_value;
}
repeat_max -= repeat_min;
- *code++ = OP_UPTO + repeat_type;
- PUT2INC(code, 0, repeat_max);
+
+ if (repeat_max == 1)
+ {
+ *code++ = OP_QUERY + repeat_type;
+ }
+ else
+ {
+ *code++ = OP_UPTO + repeat_type;
+ PUT2INC(code, 0, repeat_max);
+ }
}
}
@@ -2675,14 +3242,30 @@ for (;; ptr++)
/* If previous was a bracket group, we may have to replicate it in certain
cases. */
- else if (*previous >= OP_BRA || *previous == OP_ONCE ||
- *previous == OP_COND)
+ else if (*previous == OP_BRA || *previous == OP_CBRA ||
+ *previous == OP_ONCE || *previous == OP_COND)
{
register int i;
int ketoffset = 0;
int len = code - previous;
uschar *bralink = NULL;
+ /* Repeating a DEFINE group is pointless */
+
+ if (*previous == OP_COND && previous[LINK_SIZE+1] == OP_DEF)
+ {
+ *errorcodeptr = ERR55;
+ goto FAILED;
+ }
+
+ /* This is a paranoid check to stop integer overflow later on */
+
+ if (len > MAX_DUPLENGTH)
+ {
+ *errorcodeptr = ERR50;
+ goto FAILED;
+ }
+
/* If the maximum repeat count is unlimited, find the end of the bracket
by scanning through from the start, and compute the offset back to it
from the current code pointer. There may be an OP_OPT setting following
@@ -2717,13 +3300,14 @@ for (;; ptr++)
/* If the maximum is 1 or unlimited, we just have to stick in the
BRAZERO and do no more at this point. However, we do need to adjust
any OP_RECURSE calls inside the group that refer to the group itself or
- any internal group, because the offset is from the start of the whole
- regex. Temporarily terminate the pattern while doing this. */
+ any internal or forward referenced group, because the offset is from
+ the start of the whole regex. Temporarily terminate the pattern while
+ doing this. */
if (repeat_max <= 1)
{
*code = OP_END;
- adjust_recurse(previous, 1, utf8, cd);
+ adjust_recurse(previous, 1, utf8, cd, save_hwm);
memmove(previous+1, previous, len);
code++;
*previous++ = OP_BRAZERO + repeat_type;
@@ -2741,7 +3325,7 @@ for (;; ptr++)
{
int offset;
*code = OP_END;
- adjust_recurse(previous, 2 + LINK_SIZE, utf8, cd);
+ adjust_recurse(previous, 2 + LINK_SIZE, utf8, cd, save_hwm);
memmove(previous + 2 + LINK_SIZE, previous, len);
code += 2 + LINK_SIZE;
*previous++ = OP_BRAZERO + repeat_type;
@@ -2761,19 +3345,41 @@ for (;; ptr++)
/* If the minimum is greater than zero, replicate the group as many
times as necessary, and adjust the maximum to the number of subsequent
copies that we need. If we set a first char from the group, and didn't
- set a required char, copy the latter from the former. */
+ set a required char, copy the latter from the former. If there are any
+ forward reference subroutine calls in the group, there will be entries on
+ the workspace list; replicate these with an appropriate increment. */
else
{
if (repeat_min > 1)
{
- if (groupsetfirstbyte && reqbyte < 0) reqbyte = firstbyte;
- for (i = 1; i < repeat_min; i++)
+ /* In the pre-compile phase, we don't actually do the replication. We
+ just adjust the length as if we had. */
+
+ if (lengthptr != NULL)
+ *lengthptr += (repeat_min - 1)*length_prevgroup;
+
+ /* This is compiling for real */
+
+ else
{
- memcpy(code, previous, len);
- code += len;
+ if (groupsetfirstbyte && reqbyte < 0) reqbyte = firstbyte;
+ for (i = 1; i < repeat_min; i++)
+ {
+ uschar *hc;
+ uschar *this_hwm = cd->hwm;
+ memcpy(code, previous, len);
+ for (hc = save_hwm; hc < this_hwm; hc += LINK_SIZE)
+ {
+ PUT(cd->hwm, 0, GET(hc, 0) + len);
+ cd->hwm += LINK_SIZE;
+ }
+ save_hwm = this_hwm;
+ code += len;
+ }
}
}
+
if (repeat_max > 0) repeat_max -= repeat_min;
}
@@ -2781,12 +3387,27 @@ for (;; ptr++)
the maximum is limited, it replicates the group in a nested fashion,
remembering the bracket starts on a stack. In the case of a zero minimum,
the first one was set up above. In all cases the repeat_max now specifies
- the number of additional copies needed. */
+ the number of additional copies needed. Again, we must remember to
+ replicate entries on the forward reference list. */
if (repeat_max >= 0)
{
- for (i = repeat_max - 1; i >= 0; i--)
+ /* In the pre-compile phase, we don't actually do the replication. We
+ just adjust the length as if we had. For each repetition we must add 1
+ to the length for BRAZERO and for all but the last repetition we must
+ add 2 + 2*LINKSIZE to allow for the nesting that occurs. */
+
+ if (lengthptr != NULL && repeat_max > 0)
+ *lengthptr += repeat_max * (length_prevgroup + 1 + 2 + 2*LINK_SIZE) -
+ 2 - 2*LINK_SIZE; /* Last one doesn't nest */
+
+ /* This is compiling for real */
+
+ else for (i = repeat_max - 1; i >= 0; i--)
{
+ uschar *hc;
+ uschar *this_hwm = cd->hwm;
+
*code++ = OP_BRAZERO + repeat_type;
/* All but the final copy start a new nesting, maintaining the
@@ -2802,6 +3423,12 @@ for (;; ptr++)
}
memcpy(code, previous, len);
+ for (hc = save_hwm; hc < this_hwm; hc += LINK_SIZE)
+ {
+ PUT(cd->hwm, 0, GET(hc, 0) + len + ((i != 0)? 2+LINK_SIZE : 1));
+ cd->hwm += LINK_SIZE;
+ }
+ save_hwm = this_hwm;
code += len;
}
@@ -2824,9 +3451,34 @@ for (;; ptr++)
/* If the maximum is unlimited, set a repeater in the final copy. We
can't just offset backwards from the current code point, because we
don't know if there's been an options resetting after the ket. The
- correct offset was computed above. */
+ correct offset was computed above.
+
+ Then, when we are doing the actual compile phase, check to see whether
+ this group is a non-atomic one that could match an empty string. If so,
+ convert the initial operator to the S form (e.g. OP_BRA -> OP_SBRA) so
+ that runtime checking can be done. [This check is also applied to
+ atomic groups at runtime, but in a different way.] */
- else code[-ketoffset] = OP_KETRMAX + repeat_type;
+ else
+ {
+ uschar *ketcode = code - ketoffset;
+ uschar *bracode = ketcode - GET(ketcode, 1);
+ *ketcode = OP_KETRMAX + repeat_type;
+ if (lengthptr == NULL && *bracode != OP_ONCE)
+ {
+ uschar *scode = bracode;
+ do
+ {
+ if (could_be_empty_branch(scode, ketcode, utf8))
+ {
+ *bracode += OP_SBRA - OP_BRA;
+ break;
+ }
+ scode += GET(scode, 1);
+ }
+ while (*scode == OP_ALT);
+ }
+ }
}
/* Else there's some kind of shambles */
@@ -2837,22 +3489,53 @@ for (;; ptr++)
goto FAILED;
}
- /* If the character following a repeat is '+', we wrap the entire repeated
- item inside OP_ONCE brackets. This is just syntactic sugar, taken from
- Sun's Java package. The repeated item starts at tempcode, not at previous,
- which might be the first part of a string whose (former) last char we
- repeated. However, we don't support '+' after a greediness '?'. */
+ /* If the character following a repeat is '+', or if certain optimization
+ tests above succeeded, possessive_quantifier is TRUE. For some of the
+ simpler opcodes, there is an special alternative opcode for this. For
+ anything else, we wrap the entire repeated item inside OP_ONCE brackets.
+ The '+' notation is just syntactic sugar, taken from Sun's Java package,
+ but the special opcodes can optimize it a bit. The repeated item starts at
+ tempcode, not at previous, which might be the first part of a string whose
+ (former) last char we repeated.
+
+ Possessifying an 'exact' quantifier has no effect, so we can ignore it. But
+ an 'upto' may follow. We skip over an 'exact' item, and then test the
+ length of what remains before proceeding. */
if (possessive_quantifier)
{
- int len = code - tempcode;
- memmove(tempcode + 1+LINK_SIZE, tempcode, len);
- code += 1 + LINK_SIZE;
- len += 1 + LINK_SIZE;
- tempcode[0] = OP_ONCE;
- *code++ = OP_KET;
- PUTINC(code, 0, len);
- PUT(tempcode, 1, len);
+ int len;
+ if (*tempcode == OP_EXACT || *tempcode == OP_TYPEEXACT ||
+ *tempcode == OP_NOTEXACT)
+ tempcode += _pcre_OP_lengths[*tempcode];
+ len = code - tempcode;
+ if (len > 0) switch (*tempcode)
+ {
+ case OP_STAR: *tempcode = OP_POSSTAR; break;
+ case OP_PLUS: *tempcode = OP_POSPLUS; break;
+ case OP_QUERY: *tempcode = OP_POSQUERY; break;
+ case OP_UPTO: *tempcode = OP_POSUPTO; break;
+
+ case OP_TYPESTAR: *tempcode = OP_TYPEPOSSTAR; break;
+ case OP_TYPEPLUS: *tempcode = OP_TYPEPOSPLUS; break;
+ case OP_TYPEQUERY: *tempcode = OP_TYPEPOSQUERY; break;
+ case OP_TYPEUPTO: *tempcode = OP_TYPEPOSUPTO; break;
+
+ case OP_NOTSTAR: *tempcode = OP_NOTPOSSTAR; break;
+ case OP_NOTPLUS: *tempcode = OP_NOTPOSPLUS; break;
+ case OP_NOTQUERY: *tempcode = OP_NOTPOSQUERY; break;
+ case OP_NOTUPTO: *tempcode = OP_NOTPOSUPTO; break;
+
+ default:
+ memmove(tempcode + 1+LINK_SIZE, tempcode, len);
+ code += 1 + LINK_SIZE;
+ len += 1 + LINK_SIZE;
+ tempcode[0] = OP_ONCE;
+ *code++ = OP_KET;
+ PUTINC(code, 0, len);
+ PUT(tempcode, 1, len);
+ break;
+ }
}
/* In all case we no longer have a previous item. We also set the
@@ -2865,162 +3548,275 @@ for (;; ptr++)
break;
- /* Start of nested bracket sub-expression, or comment or lookahead or
- lookbehind or option setting or condition. First deal with special things
- that can come after a bracket; all are introduced by ?, and the appearance
- of any of them means that this is not a referencing group. They were
- checked for validity in the first pass over the string, so we don't have to
- check for syntax errors here. */
+ /* ===================================================================*/
+ /* Start of nested parenthesized sub-expression, or comment or lookahead or
+ lookbehind or option setting or condition or all the other extended
+ parenthesis forms. First deal with the specials; all are introduced by ?,
+ and the appearance of any of them means that this is not a capturing
+ group. */
case '(':
newoptions = options;
skipbytes = 0;
+ bravalue = OP_CBRA;
+ save_hwm = cd->hwm;
if (*(++ptr) == '?')
{
- int set, unset;
+ int i, set, unset, namelen;
int *optset;
+ const uschar *name;
+ uschar *slot;
switch (*(++ptr))
{
case '#': /* Comment; skip to ket */
ptr++;
- while (*ptr != ')') ptr++;
+ while (*ptr != 0 && *ptr != ')') ptr++;
+ if (*ptr == 0)
+ {
+ *errorcodeptr = ERR18;
+ goto FAILED;
+ }
continue;
- case ':': /* Non-extracting bracket */
+
+ /* ------------------------------------------------------------ */
+ case ':': /* Non-capturing bracket */
bravalue = OP_BRA;
ptr++;
break;
+
+ /* ------------------------------------------------------------ */
case '(':
bravalue = OP_COND; /* Conditional group */
- /* A condition can be a number, referring to a numbered group, a name,
- referring to a named group, 'R', referring to recursion, or an
- assertion. There are two unfortunate ambiguities, caused by history.
- (a) 'R' can be the recursive thing or the name 'R', and (b) a number
- could be a name that consists of digits. In both cases, we look for a
- name first; if not found, we try the other cases. If the first
- character after (?( is a word character, we know the rest up to ) will
- also be word characters because the syntax was checked in the first
- pass. */
-
- if ((cd->ctypes[ptr[1]] & ctype_word) != 0)
+ /* A condition can be an assertion, a number (referring to a numbered
+ group), a name (referring to a named group), or 'R', referring to
+ recursion. R<digits> and R&name are also permitted for recursion tests.
+
+ There are several syntaxes for testing a named group: (?(name)) is used
+ by Python; Perl 5.10 onwards uses (?(<name>) or (?('name')).
+
+ There are two unfortunate ambiguities, caused by history. (a) 'R' can
+ be the recursive thing or the name 'R' (and similarly for 'R' followed
+ by digits), and (b) a number could be a name that consists of digits.
+ In both cases, we look for a name first; if not found, we try the other
+ cases. */
+
+ /* For conditions that are assertions, check the syntax, and then exit
+ the switch. This will take control down to where bracketed groups,
+ including assertions, are processed. */
+
+ if (ptr[1] == '?' && (ptr[2] == '=' || ptr[2] == '!' || ptr[2] == '<'))
+ break;
+
+ /* Most other conditions use OP_CREF (a couple change to OP_RREF
+ below), and all need to skip 3 bytes at the start of the group. */
+
+ code[1+LINK_SIZE] = OP_CREF;
+ skipbytes = 3;
+
+ /* Check for a test for recursion in a named group. */
+
+ if (ptr[1] == 'R' && ptr[2] == '&')
{
- int i, namelen;
- int condref = 0;
- const uschar *name;
- uschar *slot = cd->name_table;
+ terminator = -1;
+ ptr += 2;
+ code[1+LINK_SIZE] = OP_RREF; /* Change the type of test */
+ }
- /* This is needed for all successful cases. */
+ /* Check for a test for a named group's having been set, using the Perl
+ syntax (?(<name>) or (?('name') */
- skipbytes = 3;
+ else if (ptr[1] == '<')
+ {
+ terminator = '>';
+ ptr++;
+ }
+ else if (ptr[1] == '\'')
+ {
+ terminator = '\'';
+ ptr++;
+ }
+ else terminator = 0;
- /* Read the name, but also get it as a number if it's all digits */
+ /* We now expect to read a name; any thing else is an error */
- name = ++ptr;
- while (*ptr != ')')
- {
- if (condref >= 0)
- condref = ((digitab[*ptr] & ctype_digit) != 0)?
- condref * 10 + *ptr - '0' : -1;
- ptr++;
- }
- namelen = ptr - name;
+ if ((cd->ctypes[ptr[1]] & ctype_word) == 0)
+ {
+ ptr += 1; /* To get the right offset */
+ *errorcodeptr = ERR28;
+ goto FAILED;
+ }
+
+ /* Read the name, but also get it as a number if it's all digits */
+
+ recno = 0;
+ name = ++ptr;
+ while ((cd->ctypes[*ptr] & ctype_word) != 0)
+ {
+ if (recno >= 0)
+ recno = ((digitab[*ptr] & ctype_digit) != 0)?
+ recno * 10 + *ptr - '0' : -1;
ptr++;
+ }
+ namelen = ptr - name;
- for (i = 0; i < cd->names_found; i++)
- {
- if (strncmp((char *)name, (char *)slot+2, namelen) == 0) break;
- slot += cd->name_entry_size;
- }
+ if ((terminator > 0 && *ptr++ != terminator) || *ptr++ != ')')
+ {
+ ptr--; /* Error offset */
+ *errorcodeptr = ERR26;
+ goto FAILED;
+ }
- /* Found a previous named subpattern */
+ /* Do no further checking in the pre-compile phase. */
- if (i < cd->names_found)
- {
- condref = GET2(slot, 0);
- code[1+LINK_SIZE] = OP_CREF;
- PUT2(code, 2+LINK_SIZE, condref);
- }
+ if (lengthptr != NULL) break;
- /* Search the pattern for a forward reference */
+ /* In the real compile we do the work of looking for the actual
+ reference. */
- else if ((i = find_named_parens(ptr, *brackets, name, namelen)) > 0)
- {
- code[1+LINK_SIZE] = OP_CREF;
- PUT2(code, 2+LINK_SIZE, i);
- }
+ slot = cd->name_table;
+ for (i = 0; i < cd->names_found; i++)
+ {
+ if (strncmp((char *)name, (char *)slot+2, namelen) == 0) break;
+ slot += cd->name_entry_size;
+ }
- /* Check for 'R' for recursion */
+ /* Found a previous named subpattern */
- else if (namelen == 1 && *name == 'R')
- {
- code[1+LINK_SIZE] = OP_CREF;
- PUT2(code, 2+LINK_SIZE, CREF_RECURSE);
- }
+ if (i < cd->names_found)
+ {
+ recno = GET2(slot, 0);
+ PUT2(code, 2+LINK_SIZE, recno);
+ }
- /* Check for a subpattern number */
+ /* Search the pattern for a forward reference */
- else if (condref > 0)
- {
- code[1+LINK_SIZE] = OP_CREF;
- PUT2(code, 2+LINK_SIZE, condref);
- }
+ else if ((i = find_parens(ptr, cd->bracount, name, namelen,
+ (options & PCRE_EXTENDED) != 0)) > 0)
+ {
+ PUT2(code, 2+LINK_SIZE, i);
+ }
- /* Either an unidentified subpattern, or a reference to (?(0) */
+ /* If terminator == 0 it means that the name followed directly after
+ the opening parenthesis [e.g. (?(abc)...] and in this case there are
+ some further alternatives to try. For the cases where terminator != 0
+ [things like (?(<name>... or (?('name')... or (?(R&name)... ] we have
+ now checked all the possibilities, so give an error. */
- else
+ else if (terminator != 0)
+ {
+ *errorcodeptr = ERR15;
+ goto FAILED;
+ }
+
+ /* Check for (?(R) for recursion. Allow digits after R to specify a
+ specific group number. */
+
+ else if (*name == 'R')
+ {
+ recno = 0;
+ for (i = 1; i < namelen; i++)
{
- *errorcodeptr = (condref == 0)? ERR35: ERR15;
- goto FAILED;
+ if ((digitab[name[i]] & ctype_digit) == 0)
+ {
+ *errorcodeptr = ERR15;
+ goto FAILED;
+ }
+ recno = recno * 10 + name[i] - '0';
}
+ if (recno == 0) recno = RREF_ANY;
+ code[1+LINK_SIZE] = OP_RREF; /* Change test type */
+ PUT2(code, 2+LINK_SIZE, recno);
+ }
+
+ /* Similarly, check for the (?(DEFINE) "condition", which is always
+ false. */
+
+ else if (namelen == 6 && strncmp((char *)name, "DEFINE", 6) == 0)
+ {
+ code[1+LINK_SIZE] = OP_DEF;
+ skipbytes = 1;
+ }
+
+ /* Check for the "name" actually being a subpattern number. */
+
+ else if (recno > 0)
+ {
+ PUT2(code, 2+LINK_SIZE, recno);
}
- /* For conditions that are assertions, we just fall through, having
- set bravalue above. */
+ /* Either an unidentified subpattern, or a reference to (?(0) */
+ else
+ {
+ *errorcodeptr = (recno == 0)? ERR35: ERR15;
+ goto FAILED;
+ }
break;
+
+ /* ------------------------------------------------------------ */
case '=': /* Positive lookahead */
bravalue = OP_ASSERT;
ptr++;
break;
+
+ /* ------------------------------------------------------------ */
case '!': /* Negative lookahead */
bravalue = OP_ASSERT_NOT;
ptr++;
break;
- case '<': /* Lookbehinds */
- switch (*(++ptr))
+
+ /* ------------------------------------------------------------ */
+ case '<': /* Lookbehind or named define */
+ switch (ptr[1])
{
case '=': /* Positive lookbehind */
bravalue = OP_ASSERTBACK;
- ptr++;
+ ptr += 2;
break;
case '!': /* Negative lookbehind */
bravalue = OP_ASSERTBACK_NOT;
- ptr++;
+ ptr += 2;
break;
+
+ default: /* Could be name define, else bad */
+ if ((cd->ctypes[ptr[1]] & ctype_word) != 0) goto DEFINE_NAME;
+ ptr++; /* Correct offset for error */
+ *errorcodeptr = ERR24;
+ goto FAILED;
}
break;
+
+ /* ------------------------------------------------------------ */
case '>': /* One-time brackets */
bravalue = OP_ONCE;
ptr++;
break;
+
+ /* ------------------------------------------------------------ */
case 'C': /* Callout - may be followed by digits; */
previous_callout = code; /* Save for later completion */
after_manual_callout = 1; /* Skip one item before completing */
- *code++ = OP_CALLOUT; /* Already checked that the terminating */
- { /* closing parenthesis is present. */
+ *code++ = OP_CALLOUT;
+ {
int n = 0;
while ((digitab[*(++ptr)] & ctype_digit) != 0)
n = n * 10 + *ptr - '0';
+ if (*ptr != ')')
+ {
+ *errorcodeptr = ERR39;
+ goto FAILED;
+ }
if (n > 255)
{
*errorcodeptr = ERR38;
@@ -3034,58 +3830,138 @@ for (;; ptr++)
previous = NULL;
continue;
- case 'P': /* Named subpattern handling */
- if (*(++ptr) == '<') /* Definition */
+
+ /* ------------------------------------------------------------ */
+ case 'P': /* Python-style named subpattern handling */
+ if (*(++ptr) == '=' || *ptr == '>') /* Reference or recursion */
+ {
+ is_recurse = *ptr == '>';
+ terminator = ')';
+ goto NAMED_REF_OR_RECURSE;
+ }
+ else if (*ptr != '<') /* Test for Python-style definition */
{
- int i, namelen;
- uschar *slot = cd->name_table;
- const uschar *name; /* Don't amalgamate; some compilers */
- name = ++ptr; /* grumble at autoincrement in declaration */
+ *errorcodeptr = ERR41;
+ goto FAILED;
+ }
+ /* Fall through to handle (?P< as (?< is handled */
- while (*ptr++ != '>');
- namelen = ptr - name - 1;
- for (i = 0; i < cd->names_found; i++)
+ /* ------------------------------------------------------------ */
+ DEFINE_NAME: /* Come here from (?< handling */
+ case '\'':
+ {
+ terminator = (*ptr == '<')? '>' : '\'';
+ name = ++ptr;
+
+ while ((cd->ctypes[*ptr] & ctype_word) != 0) ptr++;
+ namelen = ptr - name;
+
+ /* In the pre-compile phase, just do a syntax check. */
+
+ if (lengthptr != NULL)
{
- int crc = memcmp(name, slot+2, namelen);
- if (crc == 0)
+ if (*ptr != terminator)
+ {
+ *errorcodeptr = ERR42;
+ goto FAILED;
+ }
+ if (cd->names_found >= MAX_NAME_COUNT)
{
- if (slot[2+namelen] == 0)
+ *errorcodeptr = ERR49;
+ goto FAILED;
+ }
+ if (namelen + 3 > cd->name_entry_size)
+ {
+ cd->name_entry_size = namelen + 3;
+ if (namelen > MAX_NAME_SIZE)
{
- if ((options & PCRE_DUPNAMES) == 0)
- {
- *errorcodeptr = ERR43;
- goto FAILED;
- }
+ *errorcodeptr = ERR48;
+ goto FAILED;
}
- else crc = -1; /* Current name is substring */
}
- if (crc < 0)
+ }
+
+ /* In the real compile, create the entry in the table */
+
+ else
+ {
+ slot = cd->name_table;
+ for (i = 0; i < cd->names_found; i++)
{
- memmove(slot + cd->name_entry_size, slot,
- (cd->names_found - i) * cd->name_entry_size);
- break;
+ int crc = memcmp(name, slot+2, namelen);
+ if (crc == 0)
+ {
+ if (slot[2+namelen] == 0)
+ {
+ if ((options & PCRE_DUPNAMES) == 0)
+ {
+ *errorcodeptr = ERR43;
+ goto FAILED;
+ }
+ }
+ else crc = -1; /* Current name is substring */
+ }
+ if (crc < 0)
+ {
+ memmove(slot + cd->name_entry_size, slot,
+ (cd->names_found - i) * cd->name_entry_size);
+ break;
+ }
+ slot += cd->name_entry_size;
}
- slot += cd->name_entry_size;
- }
- PUT2(slot, 0, *brackets + 1);
- memcpy(slot + 2, name, namelen);
- slot[2+namelen] = 0;
- cd->names_found++;
- goto NUMBERED_GROUP;
+ PUT2(slot, 0, cd->bracount + 1);
+ memcpy(slot + 2, name, namelen);
+ slot[2+namelen] = 0;
+ }
}
- if (*ptr == '=' || *ptr == '>') /* Reference or recursion */
+ /* In both cases, count the number of names we've encountered. */
+
+ ptr++; /* Move past > or ' */
+ cd->names_found++;
+ goto NUMBERED_GROUP;
+
+
+ /* ------------------------------------------------------------ */
+ case '&': /* Perl recursion/subroutine syntax */
+ terminator = ')';
+ is_recurse = TRUE;
+ /* Fall through */
+
+ /* We come here from the Python syntax above that handles both
+ references (?P=name) and recursion (?P>name), as well as falling
+ through from the Perl recursion syntax (?&name). */
+
+ NAMED_REF_OR_RECURSE:
+ name = ++ptr;
+ while ((cd->ctypes[*ptr] & ctype_word) != 0) ptr++;
+ namelen = ptr - name;
+
+ /* In the pre-compile phase, do a syntax check and set a dummy
+ reference number. */
+
+ if (lengthptr != NULL)
{
- int i, namelen;
- int type = *ptr++;
- const uschar *name = ptr;
- uschar *slot = cd->name_table;
+ if (*ptr != terminator)
+ {
+ *errorcodeptr = ERR42;
+ goto FAILED;
+ }
+ if (namelen > MAX_NAME_SIZE)
+ {
+ *errorcodeptr = ERR48;
+ goto FAILED;
+ }
+ recno = 0;
+ }
- while (*ptr != ')') ptr++;
- namelen = ptr - name;
+ /* In the real compile, seek the name in the table */
+ else
+ {
+ slot = cd->name_table;
for (i = 0; i < cd->names_found; i++)
{
if (strncmp((char *)name, (char *)slot+2, namelen) == 0) break;
@@ -3097,71 +3973,89 @@ for (;; ptr++)
recno = GET2(slot, 0);
}
else if ((recno = /* Forward back reference */
- find_named_parens(ptr, *brackets, name, namelen)) <= 0)
+ find_parens(ptr, cd->bracount, name, namelen,
+ (options & PCRE_EXTENDED) != 0)) <= 0)
{
*errorcodeptr = ERR15;
goto FAILED;
}
+ }
- if (type == '>') goto HANDLE_RECURSION; /* A few lines below */
-
- /* Back reference */
+ /* In both phases, we can now go to the code than handles numerical
+ recursion or backreferences. */
- previous = code;
- *code++ = OP_REF;
- PUT2INC(code, 0, recno);
- cd->backref_map |= (recno < 32)? (1 << recno) : 1;
- if (recno > cd->top_backref) cd->top_backref = recno;
- continue;
- }
+ if (is_recurse) goto HANDLE_RECURSION;
+ else goto HANDLE_REFERENCE;
- /* Should never happen */
- break;
- case 'R': /* Pattern recursion */
+ /* ------------------------------------------------------------ */
+ case 'R': /* Recursion */
ptr++; /* Same as (?0) */
/* Fall through */
- /* Recursion or "subroutine" call */
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
+ /* ------------------------------------------------------------ */
+ case '0': case '1': case '2': case '3': case '4': /* Recursion or */
+ case '5': case '6': case '7': case '8': case '9': /* subroutine */
{
const uschar *called;
recno = 0;
while((digitab[*ptr] & ctype_digit) != 0)
recno = recno * 10 + *ptr++ - '0';
+ if (*ptr != ')')
+ {
+ *errorcodeptr = ERR29;
+ goto FAILED;
+ }
/* Come here from code above that handles a named recursion */
HANDLE_RECURSION:
previous = code;
+ called = cd->start_code;
- /* Find the bracket that is being referenced. Temporarily end the
- regex in case it doesn't exist. */
+ /* When we are actually compiling, find the bracket that is being
+ referenced. Temporarily end the regex in case it doesn't exist before
+ this point. If we end up with a forward reference, first check that
+ the bracket does occur later so we can give the error (and position)
+ now. Then remember this forward reference in the workspace so it can
+ be filled in at the end. */
- *code = OP_END;
- called = (recno == 0)? cd->start_code :
- find_bracket(cd->start_code, utf8, recno);
- if (called == NULL)
+ if (lengthptr == NULL)
{
- *errorcodeptr = ERR15;
- goto FAILED;
- }
+ *code = OP_END;
+ if (recno != 0) called = find_bracket(cd->start_code, utf8, recno);
- /* If the subpattern is still open, this is a recursive call. We
- check to see if this is a left recursion that could loop for ever,
- and diagnose that case. */
+ /* Forward reference */
- if (GET(called, 1) == 0 && could_be_empty(called, code, bcptr, utf8))
- {
- *errorcodeptr = ERR40;
- goto FAILED;
+ if (called == NULL)
+ {
+ if (find_parens(ptr, cd->bracount, NULL, recno,
+ (options & PCRE_EXTENDED) != 0) < 0)
+ {
+ *errorcodeptr = ERR15;
+ goto FAILED;
+ }
+ called = cd->start_code + recno;
+ PUTINC(cd->hwm, 0, code + 2 + LINK_SIZE - cd->start_code);
+ }
+
+ /* If not a forward reference, and the subpattern is still open,
+ this is a recursive call. We check to see if this is a left
+ recursion that could loop for ever, and diagnose that case. */
+
+ else if (GET(called, 1) == 0 &&
+ could_be_empty(called, code, bcptr, utf8))
+ {
+ *errorcodeptr = ERR40;
+ goto FAILED;
+ }
}
/* Insert the recursion/subroutine item, automatically wrapped inside
- "once" brackets. */
+ "once" brackets. Set up a "previous group" length so that a
+ subsequent quantifier will work. */
*code = OP_ONCE;
PUT(code, 1, 2 + 2*LINK_SIZE);
@@ -3174,12 +4068,18 @@ for (;; ptr++)
*code = OP_KET;
PUT(code, 1, 2 + 2*LINK_SIZE);
code += 1 + LINK_SIZE;
+
+ length_prevgroup = 3 + 3*LINK_SIZE;
}
+
+ /* Can't determine a first byte now */
+
+ if (firstbyte == REQ_UNSET) firstbyte = REQ_NONE;
continue;
- /* Character after (? not specially recognized */
- default: /* Option setting */
+ /* ------------------------------------------------------------ */
+ default: /* Other characters: check option setting */
set = unset = 0;
optset = &set;
@@ -3189,13 +4089,21 @@ for (;; ptr++)
{
case '-': optset = &unset; break;
+ case 'J': /* Record that it changed in the external options */
+ *optset |= PCRE_DUPNAMES;
+ cd->external_options |= PCRE_JCHANGED;
+ break;
+
case 'i': *optset |= PCRE_CASELESS; break;
- case 'J': *optset |= PCRE_DUPNAMES; break;
case 'm': *optset |= PCRE_MULTILINE; break;
case 's': *optset |= PCRE_DOTALL; break;
case 'x': *optset |= PCRE_EXTENDED; break;
case 'U': *optset |= PCRE_UNGREEDY; break;
case 'X': *optset |= PCRE_EXTRA; break;
+
+ default: *errorcodeptr = ERR12;
+ ptr--; /* Correct the offset */
+ goto FAILED;
}
}
@@ -3204,32 +4112,54 @@ for (;; ptr++)
newoptions = (options | set) & (~unset);
/* If the options ended with ')' this is not the start of a nested
- group with option changes, so the options change at this level. Compile
- code to change the ims options if this setting actually changes any of
- them. We also pass the new setting back so that it can be put at the
- start of any following branches, and when this group ends (if we are in
- a group), a resetting item can be compiled.
-
- Note that if this item is right at the start of the pattern, the
- options will have been abstracted and made global, so there will be no
- change to compile. */
+ group with option changes, so the options change at this level. If this
+ item is right at the start of the pattern, the options can be
+ abstracted and made external in the pre-compile phase, and ignored in
+ the compile phase. This can be helpful when matching -- for instance in
+ caseless checking of required bytes.
+
+ If the code pointer is not (cd->start_code + 1 + LINK_SIZE), we are
+ definitely *not* at the start of the pattern because something has been
+ compiled. In the pre-compile phase, however, the code pointer can have
+ that value after the start, because it gets reset as code is discarded
+ during the pre-compile. However, this can happen only at top level - if
+ we are within parentheses, the starting BRA will still be present. At
+ any parenthesis level, the length value can be used to test if anything
+ has been compiled at that level. Thus, a test for both these conditions
+ is necessary to ensure we correctly detect the start of the pattern in
+ both phases.
+
+ If we are not at the pattern start, compile code to change the ims
+ options if this setting actually changes any of them. We also pass the
+ new setting back so that it can be put at the start of any following
+ branches, and when this group ends (if we are in a group), a resetting
+ item can be compiled. */
if (*ptr == ')')
{
- if ((options & PCRE_IMS) != (newoptions & PCRE_IMS))
+ if (code == cd->start_code + 1 + LINK_SIZE &&
+ (lengthptr == NULL || *lengthptr == 2 + 2*LINK_SIZE))
{
- *code++ = OP_OPT;
- *code++ = newoptions & PCRE_IMS;
+ cd->external_options = newoptions;
+ options = newoptions;
}
+ else
+ {
+ if ((options & PCRE_IMS) != (newoptions & PCRE_IMS))
+ {
+ *code++ = OP_OPT;
+ *code++ = newoptions & PCRE_IMS;
+ }
- /* Change options at this level, and pass them back for use
- in subsequent branches. Reset the greedy defaults and the case
- value for firstbyte and reqbyte. */
+ /* Change options at this level, and pass them back for use
+ in subsequent branches. Reset the greedy defaults and the case
+ value for firstbyte and reqbyte. */
- *optionsptr = options = newoptions;
- greedy_default = ((newoptions & PCRE_UNGREEDY) != 0);
- greedy_non_default = greedy_default ^ 1;
- req_caseopt = ((options & PCRE_CASELESS) != 0)? REQ_CASELESS : 0;
+ *optionsptr = options = newoptions;
+ greedy_default = ((newoptions & PCRE_UNGREEDY) != 0);
+ greedy_non_default = greedy_default ^ 1;
+ req_caseopt = ((options & PCRE_CASELESS) != 0)? REQ_CASELESS : 0;
+ }
previous = NULL; /* This item can't be repeated */
continue; /* It is complete */
@@ -3242,58 +4172,56 @@ for (;; ptr++)
bravalue = OP_BRA;
ptr++;
- }
- }
+ } /* End of switch for character following (? */
+ } /* End of (? handling */
- /* If PCRE_NO_AUTO_CAPTURE is set, all unadorned brackets become
- non-capturing and behave like (?:...) brackets */
+ /* Opening parenthesis not followed by '?'. If PCRE_NO_AUTO_CAPTURE is set,
+ all unadorned brackets become non-capturing and behave like (?:...)
+ brackets. */
else if ((options & PCRE_NO_AUTO_CAPTURE) != 0)
{
bravalue = OP_BRA;
}
- /* Else we have a referencing group; adjust the opcode. If the bracket
- number is greater than EXTRACT_BASIC_MAX, we set the opcode one higher, and
- arrange for the true number to follow later, in an OP_BRANUMBER item. */
+ /* Else we have a capturing group. */
else
{
NUMBERED_GROUP:
- if (++(*brackets) > EXTRACT_BASIC_MAX)
- {
- bravalue = OP_BRA + EXTRACT_BASIC_MAX + 1;
- code[1+LINK_SIZE] = OP_BRANUMBER;
- PUT2(code, 2+LINK_SIZE, *brackets);
- skipbytes = 3;
- }
- else bravalue = OP_BRA + *brackets;
+ cd->bracount += 1;
+ PUT2(code, 1+LINK_SIZE, cd->bracount);
+ skipbytes = 2;
}
- /* Process nested bracketed re. Assertions may not be repeated, but other
- kinds can be. We copy code into a non-register variable in order to be able
- to pass its address because some compilers complain otherwise. Pass in a
- new setting for the ims options if they have changed. */
+ /* Process nested bracketed regex. Assertions may not be repeated, but
+ other kinds can be. All their opcodes are >= OP_ONCE. We copy code into a
+ non-register variable in order to be able to pass its address because some
+ compilers complain otherwise. Pass in a new setting for the ims options if
+ they have changed. */
previous = (bravalue >= OP_ONCE)? code : NULL;
*code = bravalue;
tempcode = code;
tempreqvary = cd->req_varyopt; /* Save value before bracket */
+ length_prevgroup = 0; /* Initialize for pre-compile phase */
if (!compile_regex(
newoptions, /* The complete new option state */
options & PCRE_IMS, /* The previous ims option state */
- brackets, /* Extracting bracket count */
&tempcode, /* Where to put code (updated) */
&ptr, /* Input pointer (updated) */
errorcodeptr, /* Where to put an error message */
(bravalue == OP_ASSERTBACK ||
bravalue == OP_ASSERTBACK_NOT), /* TRUE if back assert */
- skipbytes, /* Skip over OP_COND/OP_BRANUMBER */
+ skipbytes, /* Skip over bracket number */
&subfirstbyte, /* For possible first char */
&subreqbyte, /* For possible last char */
bcptr, /* Current branch chain */
- cd)) /* Tables block */
+ cd, /* Tables block */
+ (lengthptr == NULL)? NULL : /* Actual compile phase */
+ &length_prevgroup /* Pre-compile phase */
+ ))
goto FAILED;
/* At the end of compiling, code is still pointing to the start of the
@@ -3302,9 +4230,9 @@ for (;; ptr++)
is on the bracket. */
/* If this is a conditional bracket, check that there are no more than
- two branches in the group. */
+ two branches in the group, or just one if it's a DEFINE group. */
- else if (bravalue == OP_COND)
+ if (bravalue == OP_COND)
{
uschar *tc = code;
int condcount = 0;
@@ -3315,29 +4243,77 @@ for (;; ptr++)
}
while (*tc != OP_KET);
- if (condcount > 2)
+ /* A DEFINE group is never obeyed inline (the "condition" is always
+ false). It must have only one branch. */
+
+ if (code[LINK_SIZE+1] == OP_DEF)
{
- *errorcodeptr = ERR27;
- goto FAILED;
+ if (condcount > 1)
+ {
+ *errorcodeptr = ERR54;
+ goto FAILED;
+ }
+ bravalue = OP_DEF; /* Just a flag to suppress char handling below */
}
- /* If there is just one branch, we must not make use of its firstbyte or
- reqbyte, because this is equivalent to an empty second branch. */
+ /* A "normal" conditional group. If there is just one branch, we must not
+ make use of its firstbyte or reqbyte, because this is equivalent to an
+ empty second branch. */
- if (condcount == 1) subfirstbyte = subreqbyte = REQ_NONE;
+ else
+ {
+ if (condcount > 2)
+ {
+ *errorcodeptr = ERR27;
+ goto FAILED;
+ }
+ if (condcount == 1) subfirstbyte = subreqbyte = REQ_NONE;
+ }
}
- /* Handle updating of the required and first characters. Update for normal
- brackets of all kinds, and conditions with two branches (see code above).
- If the bracket is followed by a quantifier with zero repeat, we have to
- back off. Hence the definition of zeroreqbyte and zerofirstbyte outside the
- main loop so that they can be accessed for the back off. */
+ /* Error if hit end of pattern */
+
+ if (*ptr != ')')
+ {
+ *errorcodeptr = ERR14;
+ goto FAILED;
+ }
+
+ /* In the pre-compile phase, update the length by the length of the nested
+ group, less the brackets at either end. Then reduce the compiled code to
+ just the brackets so that it doesn't use much memory if it is duplicated by
+ a quantifier. */
+
+ if (lengthptr != NULL)
+ {
+ *lengthptr += length_prevgroup - 2 - 2*LINK_SIZE;
+ code++;
+ PUTINC(code, 0, 1 + LINK_SIZE);
+ *code++ = OP_KET;
+ PUTINC(code, 0, 1 + LINK_SIZE);
+ }
+
+ /* Otherwise update the main code pointer to the end of the group. */
+
+ else code = tempcode;
+
+ /* For a DEFINE group, required and first character settings are not
+ relevant. */
+
+ if (bravalue == OP_DEF) break;
+
+ /* Handle updating of the required and first characters for other types of
+ group. Update for normal brackets of all kinds, and conditions with two
+ branches (see code above). If the bracket is followed by a quantifier with
+ zero repeat, we have to back off. Hence the definition of zeroreqbyte and
+ zerofirstbyte outside the main loop so that they can be accessed for the
+ back off. */
zeroreqbyte = reqbyte;
zerofirstbyte = firstbyte;
groupsetfirstbyte = FALSE;
- if (bravalue >= OP_BRA || bravalue == OP_ONCE || bravalue == OP_COND)
+ if (bravalue >= OP_ONCE)
{
/* If we have not yet set a firstbyte in this branch, take it from the
subpattern, remembering that it was set here so that a repeat of more
@@ -3378,35 +4354,22 @@ for (;; ptr++)
firstbyte, looking for an asserted first char. */
else if (bravalue == OP_ASSERT && subreqbyte >= 0) reqbyte = subreqbyte;
+ break; /* End of processing '(' */
- /* Now update the main code pointer to the end of the group. */
- code = tempcode;
-
- /* Error if hit end of pattern */
-
- if (*ptr != ')')
- {
- *errorcodeptr = ERR14;
- goto FAILED;
- }
- break;
-
- /* Check \ for being a real metacharacter; if not, fall through and handle
- it as a data character at the start of a string. Escape items are checked
- for validity in the pre-compiling pass. */
-
- case '\\':
- tempptr = ptr;
- c = check_escape(&ptr, errorcodeptr, *brackets, options, FALSE);
-
- /* Handle metacharacters introduced by \. For ones like \d, the ESC_ values
+ /* ===================================================================*/
+ /* Handle metasequences introduced by \. For ones like \d, the ESC_ values
are arranged to be the negation of the corresponding OP_values. For the
back references, the values are ESC_REF plus the reference number. Only
back references and those types that consume a character may be repeated.
We can test for values between ESC_b and ESC_Z for the latter; this may
have to change if any new ones are ever created. */
+ case '\\':
+ tempptr = ptr;
+ c = check_escape(&ptr, errorcodeptr, cd->bracount, options, FALSE);
+ if (*errorcodeptr != 0) goto FAILED;
+
if (c < 0)
{
if (-c == ESC_Q) /* Handle start of quoted string */
@@ -3416,6 +4379,8 @@ for (;; ptr++)
continue;
}
+ if (-c == ESC_E) continue; /* Perl ignores an orphan \E */
+
/* For metasequences that actually match a character, we disable the
setting of a first character if it hasn't already been set. */
@@ -3427,18 +4392,33 @@ for (;; ptr++)
zerofirstbyte = firstbyte;
zeroreqbyte = reqbyte;
- /* Back references are handled specially */
+ /* \k<name> or \k'name' is a back reference by name (Perl syntax) */
+
+ if (-c == ESC_k && (ptr[1] == '<' || ptr[1] == '\''))
+ {
+ is_recurse = FALSE;
+ terminator = (*(++ptr) == '<')? '>' : '\'';
+ goto NAMED_REF_OR_RECURSE;
+ }
+
+ /* Back references are handled specially; must disable firstbyte if
+ not set to cope with cases like (?=(\w+))\1: which would otherwise set
+ ':' later. */
if (-c >= ESC_REF)
{
- int number = -c - ESC_REF;
+ recno = -c - ESC_REF;
+
+ HANDLE_REFERENCE: /* Come here from named backref handling */
+ if (firstbyte == REQ_UNSET) firstbyte = REQ_NONE;
previous = code;
*code++ = OP_REF;
- PUT2INC(code, 0, number);
+ PUT2INC(code, 0, recno);
+ cd->backref_map |= (recno < 32)? (1 << recno) : 1;
+ if (recno > cd->top_backref) cd->top_backref = recno;
}
- /* So are Unicode property matches, if supported. We know that get_ucp
- won't fail because it was tested in the pre-pass. */
+ /* So are Unicode property matches, if supported. */
#ifdef SUPPORT_UCP
else if (-c == ESC_P || -c == ESC_p)
@@ -3446,15 +4426,26 @@ for (;; ptr++)
BOOL negated;
int pdata;
int ptype = get_ucp(&ptr, &negated, &pdata, errorcodeptr);
+ if (ptype < 0) goto FAILED;
previous = code;
*code++ = ((-c == ESC_p) != negated)? OP_PROP : OP_NOTPROP;
*code++ = ptype;
*code++ = pdata;
}
+#else
+
+ /* If Unicode properties are not supported, \X, \P, and \p are not
+ allowed. */
+
+ else if (-c == ESC_X || -c == ESC_P || -c == ESC_p)
+ {
+ *errorcodeptr = ERR45;
+ goto FAILED;
+ }
#endif
- /* For the rest, we can obtain the OP value by negating the escape
- value */
+ /* For the rest (including \X when Unicode properties are supported), we
+ can obtain the OP value by negating the escape value. */
else
{
@@ -3478,9 +4469,10 @@ for (;; ptr++)
mcbuffer[0] = c;
mclength = 1;
}
-
goto ONE_CHAR;
+
+ /* ===================================================================*/
/* Handle a literal character. It is guaranteed not to be whitespace or #
when the extended flag is set. If we are in UTF-8 mode, it may be a
multi-byte literal character. */
@@ -3491,7 +4483,7 @@ for (;; ptr++)
mcbuffer[0] = c;
#ifdef SUPPORT_UTF8
- if (utf8 && (c & 0xc0) == 0xc0)
+ if (utf8 && c >= 0xc0)
{
while ((ptr[1] & 0xc0) == 0x80)
mcbuffer[mclength++] = *(++ptr);
@@ -3542,6 +4534,7 @@ for (;; ptr++)
}
} /* end of big loop */
+
/* Control never reaches here by falling through, only by a goto for all the
error states. Pass back the position in the pattern so that it can be displayed
to the user for diagnosing the error. */
@@ -3558,35 +4551,40 @@ return FALSE;
* Compile sequence of alternatives *
*************************************************/
-/* On entry, ptr is pointing past the bracket character, but on return
-it points to the closing bracket, or vertical bar, or end of string.
-The code variable is pointing at the byte into which the BRA operator has been
-stored. If the ims options are changed at the start (for a (?ims: group) or
-during any branch, we need to insert an OP_OPT item at the start of every
-following branch to ensure they get set correctly at run time, and also pass
-the new options into every subsequent branch compile.
+/* On entry, ptr is pointing past the bracket character, but on return it
+points to the closing bracket, or vertical bar, or end of string. The code
+variable is pointing at the byte into which the BRA operator has been stored.
+If the ims options are changed at the start (for a (?ims: group) or during any
+branch, we need to insert an OP_OPT item at the start of every following branch
+to ensure they get set correctly at run time, and also pass the new options
+into every subsequent branch compile.
+
+This function is used during the pre-compile phase when we are trying to find
+out the amount of memory needed, as well as during the real compile phase. The
+value of lengthptr distinguishes the two phases.
Argument:
options option bits, including any changes for this subpattern
oldims previous settings of ims option bits
- brackets -> int containing the number of extracting brackets used
codeptr -> the address of the current code pointer
ptrptr -> the address of the current pattern pointer
errorcodeptr -> pointer to error code variable
lookbehind TRUE if this is a lookbehind assertion
- skipbytes skip this many bytes at start (for OP_COND, OP_BRANUMBER)
+ skipbytes skip this many bytes at start (for brackets and OP_COND)
firstbyteptr place to put the first required character, or a negative number
reqbyteptr place to put the last required character, or a negative number
bcptr pointer to the chain of currently open branches
cd points to the data block with tables pointers etc.
+ lengthptr NULL during the real compile phase
+ points to length accumulator during pre-compile phase
-Returns: TRUE on success
+Returns: TRUE on success
*/
static BOOL
-compile_regex(int options, int oldims, int *brackets, uschar **codeptr,
- const uschar **ptrptr, int *errorcodeptr, BOOL lookbehind, int skipbytes,
- int *firstbyteptr, int *reqbyteptr, branch_chain *bcptr, compile_data *cd)
+compile_regex(int options, int oldims, uschar **codeptr, const uschar **ptrptr,
+ int *errorcodeptr, BOOL lookbehind, int skipbytes, int *firstbyteptr,
+ int *reqbyteptr, branch_chain *bcptr, compile_data *cd, int *lengthptr)
{
const uschar *ptr = *ptrptr;
uschar *code = *codeptr;
@@ -3595,6 +4593,7 @@ uschar *start_bracket = code;
uschar *reverse_count = NULL;
int firstbyte, reqbyte;
int branchfirstbyte, branchreqbyte;
+int length;
branch_chain bc;
bc.outer = bcptr;
@@ -3602,6 +4601,20 @@ bc.current = code;
firstbyte = reqbyte = REQ_UNSET;
+/* Accumulate the length for use in the pre-compile phase. Start with the
+length of the BRA and KET and any extra bytes that are required at the
+beginning. We accumulate in a local variable to save frequent testing of
+lenthptr for NULL. We cannot do this by looking at the value of code at the
+start and end of each alternative, because compiled items are discarded during
+the pre-compile phase so that the work space is not exceeded. */
+
+length = 2 + 2*LINK_SIZE + skipbytes;
+
+/* WARNING: If the above line is changed for any reason, you must also change
+the code that abstracts option settings at the start of the pattern and makes
+them global. It tests the value of length for (2 + 2*LINK_SIZE) in the
+pre-compile phase to find out whether anything has yet been compiled or not. */
+
/* Offset is set zero to mark that this bracket is still open */
PUT(code, 1, 0);
@@ -3617,6 +4630,7 @@ for (;;)
{
*code++ = OP_OPT;
*code++ = options & PCRE_IMS;
+ length += 2;
}
/* Set up dummy OP_REVERSE if lookbehind assertion */
@@ -3626,73 +4640,80 @@ for (;;)
*code++ = OP_REVERSE;
reverse_count = code;
PUTINC(code, 0, 0);
+ length += 1 + LINK_SIZE;
}
- /* Now compile the branch */
+ /* Now compile the branch; in the pre-compile phase its length gets added
+ into the length. */
- if (!compile_branch(&options, brackets, &code, &ptr, errorcodeptr,
- &branchfirstbyte, &branchreqbyte, &bc, cd))
+ if (!compile_branch(&options, &code, &ptr, errorcodeptr, &branchfirstbyte,
+ &branchreqbyte, &bc, cd, (lengthptr == NULL)? NULL : &length))
{
*ptrptr = ptr;
return FALSE;
}
- /* If this is the first branch, the firstbyte and reqbyte values for the
- branch become the values for the regex. */
+ /* In the real compile phase, there is some post-processing to be done. */
- if (*last_branch != OP_ALT)
+ if (lengthptr == NULL)
{
- firstbyte = branchfirstbyte;
- reqbyte = branchreqbyte;
- }
+ /* If this is the first branch, the firstbyte and reqbyte values for the
+ branch become the values for the regex. */
- /* If this is not the first branch, the first char and reqbyte have to
- match the values from all the previous branches, except that if the previous
- value for reqbyte didn't have REQ_VARY set, it can still match, and we set
- REQ_VARY for the regex. */
+ if (*last_branch != OP_ALT)
+ {
+ firstbyte = branchfirstbyte;
+ reqbyte = branchreqbyte;
+ }
- else
- {
- /* If we previously had a firstbyte, but it doesn't match the new branch,
- we have to abandon the firstbyte for the regex, but if there was previously
- no reqbyte, it takes on the value of the old firstbyte. */
+ /* If this is not the first branch, the first char and reqbyte have to
+ match the values from all the previous branches, except that if the
+ previous value for reqbyte didn't have REQ_VARY set, it can still match,
+ and we set REQ_VARY for the regex. */
- if (firstbyte >= 0 && firstbyte != branchfirstbyte)
+ else
{
- if (reqbyte < 0) reqbyte = firstbyte;
- firstbyte = REQ_NONE;
- }
+ /* If we previously had a firstbyte, but it doesn't match the new branch,
+ we have to abandon the firstbyte for the regex, but if there was
+ previously no reqbyte, it takes on the value of the old firstbyte. */
- /* If we (now or from before) have no firstbyte, a firstbyte from the
- branch becomes a reqbyte if there isn't a branch reqbyte. */
+ if (firstbyte >= 0 && firstbyte != branchfirstbyte)
+ {
+ if (reqbyte < 0) reqbyte = firstbyte;
+ firstbyte = REQ_NONE;
+ }
- if (firstbyte < 0 && branchfirstbyte >= 0 && branchreqbyte < 0)
- branchreqbyte = branchfirstbyte;
+ /* If we (now or from before) have no firstbyte, a firstbyte from the
+ branch becomes a reqbyte if there isn't a branch reqbyte. */
- /* Now ensure that the reqbytes match */
+ if (firstbyte < 0 && branchfirstbyte >= 0 && branchreqbyte < 0)
+ branchreqbyte = branchfirstbyte;
- if ((reqbyte & ~REQ_VARY) != (branchreqbyte & ~REQ_VARY))
- reqbyte = REQ_NONE;
- else reqbyte |= branchreqbyte; /* To "or" REQ_VARY */
- }
+ /* Now ensure that the reqbytes match */
- /* If lookbehind, check that this branch matches a fixed-length string,
- and put the length into the OP_REVERSE item. Temporarily mark the end of
- the branch with OP_END. */
+ if ((reqbyte & ~REQ_VARY) != (branchreqbyte & ~REQ_VARY))
+ reqbyte = REQ_NONE;
+ else reqbyte |= branchreqbyte; /* To "or" REQ_VARY */
+ }
- if (lookbehind)
- {
- int length;
- *code = OP_END;
- length = find_fixedlength(last_branch, options);
- DPRINTF(("fixed length = %d\n", length));
- if (length < 0)
+ /* If lookbehind, check that this branch matches a fixed-length string, and
+ put the length into the OP_REVERSE item. Temporarily mark the end of the
+ branch with OP_END. */
+
+ if (lookbehind)
{
- *errorcodeptr = (length == -2)? ERR36 : ERR25;
- *ptrptr = ptr;
- return FALSE;
+ int fixed_length;
+ *code = OP_END;
+ fixed_length = find_fixedlength(last_branch, options);
+ DPRINTF(("fixed length = %d\n", fixed_length));
+ if (fixed_length < 0)
+ {
+ *errorcodeptr = (fixed_length == -2)? ERR36 : ERR25;
+ *ptrptr = ptr;
+ return FALSE;
+ }
+ PUT(reverse_count, 0, fixed_length);
}
- PUT(reverse_count, 0, length);
}
/* Reached end of expression, either ')' or end of pattern. Go back through
@@ -3706,15 +4727,15 @@ for (;;)
if (*ptr != '|')
{
- int length = code - last_branch;
+ int branch_length = code - last_branch;
do
{
int prev_length = GET(last_branch, 1);
- PUT(last_branch, 1, length);
- length = prev_length;
- last_branch -= length;
+ PUT(last_branch, 1, branch_length);
+ branch_length = prev_length;
+ last_branch -= branch_length;
}
- while (length > 0);
+ while (branch_length > 0);
/* Fill in the ket */
@@ -3728,6 +4749,7 @@ for (;;)
{
*code++ = OP_OPT;
*code++ = oldims;
+ length += 2;
}
/* Set values to pass back */
@@ -3736,6 +4758,7 @@ for (;;)
*ptrptr = ptr;
*firstbyteptr = firstbyte;
*reqbyteptr = reqbyte;
+ if (lengthptr != NULL) *lengthptr += length;
return TRUE;
}
@@ -3749,6 +4772,7 @@ for (;;)
bc.current = last_branch = code;
code += 1 + LINK_SIZE;
ptr++;
+ length += 1 + LINK_SIZE;
}
/* Control never reaches here */
}
@@ -3799,24 +4823,29 @@ is_anchored(register const uschar *code, int *options, unsigned int bracket_map,
unsigned int backref_map)
{
do {
- const uschar *scode =
- first_significant_code(code + 1+LINK_SIZE, options, PCRE_MULTILINE, FALSE);
+ const uschar *scode = first_significant_code(code + _pcre_OP_lengths[*code],
+ options, PCRE_MULTILINE, FALSE);
register int op = *scode;
+ /* Non-capturing brackets */
+
+ if (op == OP_BRA)
+ {
+ if (!is_anchored(scode, options, bracket_map, backref_map)) return FALSE;
+ }
+
/* Capturing brackets */
- if (op > OP_BRA)
+ else if (op == OP_CBRA)
{
- int new_map;
- op -= OP_BRA;
- if (op > EXTRACT_BASIC_MAX) op = GET2(scode, 2+LINK_SIZE);
- new_map = bracket_map | ((op < 32)? (1 << op) : 1);
+ int n = GET2(scode, 1+LINK_SIZE);
+ int new_map = bracket_map | ((n < 32)? (1 << n) : 1);
if (!is_anchored(scode, options, new_map, backref_map)) return FALSE;
}
/* Other brackets */
- else if (op == OP_BRA || op == OP_ASSERT || op == OP_ONCE || op == OP_COND)
+ else if (op == OP_ASSERT || op == OP_ONCE || op == OP_COND)
{
if (!is_anchored(scode, options, bracket_map, backref_map)) return FALSE;
}
@@ -3824,7 +4853,8 @@ do {
/* .* is not anchored unless DOTALL is set and it isn't in brackets that
are or may be referenced. */
- else if ((op == OP_TYPESTAR || op == OP_TYPEMINSTAR) &&
+ else if ((op == OP_TYPESTAR || op == OP_TYPEMINSTAR ||
+ op == OP_TYPEPOSSTAR) &&
(*options & PCRE_DOTALL) != 0)
{
if (scode[1] != OP_ANY || (bracket_map & backref_map) != 0) return FALSE;
@@ -3869,30 +4899,35 @@ is_startline(const uschar *code, unsigned int bracket_map,
unsigned int backref_map)
{
do {
- const uschar *scode = first_significant_code(code + 1+LINK_SIZE, NULL, 0,
- FALSE);
+ const uschar *scode = first_significant_code(code + _pcre_OP_lengths[*code],
+ NULL, 0, FALSE);
register int op = *scode;
+ /* Non-capturing brackets */
+
+ if (op == OP_BRA)
+ {
+ if (!is_startline(scode, bracket_map, backref_map)) return FALSE;
+ }
+
/* Capturing brackets */
- if (op > OP_BRA)
+ else if (op == OP_CBRA)
{
- int new_map;
- op -= OP_BRA;
- if (op > EXTRACT_BASIC_MAX) op = GET2(scode, 2+LINK_SIZE);
- new_map = bracket_map | ((op < 32)? (1 << op) : 1);
+ int n = GET2(scode, 1+LINK_SIZE);
+ int new_map = bracket_map | ((n < 32)? (1 << n) : 1);
if (!is_startline(scode, new_map, backref_map)) return FALSE;
}
/* Other brackets */
- else if (op == OP_BRA || op == OP_ASSERT || op == OP_ONCE || op == OP_COND)
+ else if (op == OP_ASSERT || op == OP_ONCE || op == OP_COND)
{ if (!is_startline(scode, bracket_map, backref_map)) return FALSE; }
/* .* means "start at start or after \n" if it isn't in brackets that
may be referenced. */
- else if (op == OP_TYPESTAR || op == OP_TYPEMINSTAR)
+ else if (op == OP_TYPESTAR || op == OP_TYPEMINSTAR || op == OP_TYPEPOSSTAR)
{
if (scode[1] != OP_ANY || (bracket_map & backref_map) != 0) return FALSE;
}
@@ -3941,14 +4976,13 @@ do {
first_significant_code(code + 1+LINK_SIZE, options, PCRE_CASELESS, TRUE);
register int op = *scode;
- if (op >= OP_BRA) op = OP_BRA;
-
switch(op)
{
default:
return -1;
case OP_BRA:
+ case OP_CBRA:
case OP_ASSERT:
case OP_ONCE:
case OP_COND:
@@ -3964,6 +4998,7 @@ do {
case OP_CHARNC:
case OP_PLUS:
case OP_MINPLUS:
+ case OP_POSPLUS:
if (!inassert) return -1;
if (c < 0)
{
@@ -4012,37 +5047,36 @@ return pcre_compile2(pattern, options, NULL, errorptr, erroroffset, tables);
}
-
PCRE_DATA_SCOPE pcre *
pcre_compile2(const char *pattern, int options, int *errorcodeptr,
const char **errorptr, int *erroroffset, const unsigned char *tables)
{
real_pcre *re;
-int length = 1 + LINK_SIZE; /* For initial BRA plus length */
-int c, firstbyte, reqbyte, newline;
-int bracount = 0;
-int branch_extra = 0;
-int branch_newextra;
-int item_count = -1;
-int name_count = 0;
-int max_name_size = 0;
-int lastitemlength = 0;
+int length = 1; /* For final END opcode */
+int firstbyte, reqbyte, newline;
int errorcode = 0;
#ifdef SUPPORT_UTF8
BOOL utf8;
-BOOL class_utf8;
#endif
-BOOL inescq = FALSE;
-BOOL capturing;
-unsigned int brastackptr = 0;
size_t size;
uschar *code;
const uschar *codestart;
const uschar *ptr;
compile_data compile_block;
compile_data *cd = &compile_block;
-int brastack[BRASTACK_SIZE];
-uschar bralenstack[BRASTACK_SIZE];
+
+/* This space is used for "compiling" into during the first phase, when we are
+computing the amount of memory that is needed. Compiled items are thrown away
+as soon as possible, so that a fairly large buffer should be sufficient for
+this purpose. The same space is used in the second phase for remembering where
+to fill in forward references to subpatterns. */
+
+uschar cworkspace[COMPILE_WORK_SIZE];
+
+
+/* Set this early so that early errors get offset 0. */
+
+ptr = (const uschar *)pattern;
/* We can't pass back an error message if errorptr is NULL; I guess the best we
can do is just return NULL, but we can set a code value if there is a code
@@ -4075,7 +5109,7 @@ if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0 &&
(*erroroffset = _pcre_valid_utf8((uschar *)pattern, -1)) >= 0)
{
errorcode = ERR44;
- goto PCRE_EARLY_ERROR_RETURN;
+ goto PCRE_UTF8_ERROR_RETURN;
}
#else
if ((options & PCRE_UTF8) != 0)
@@ -4099,34 +5133,43 @@ cd->fcc = tables + fcc_offset;
cd->cbits = tables + cbits_offset;
cd->ctypes = tables + ctypes_offset;
-/* Handle different types of newline. The two bits give four cases. The current
-code allows for one- or two-byte sequences. */
+/* Handle different types of newline. The three bits give seven cases. The
+current code allows for fixed one- or two-byte sequences, plus "any". */
-switch (options & PCRE_NEWLINE_CRLF)
+switch (options & (PCRE_NEWLINE_CRLF | PCRE_NEWLINE_ANY))
{
- default: newline = NEWLINE; break; /* Compile-time default */
+ case 0: newline = NEWLINE; break; /* Compile-time default */
case PCRE_NEWLINE_CR: newline = '\r'; break;
case PCRE_NEWLINE_LF: newline = '\n'; break;
case PCRE_NEWLINE_CR+
PCRE_NEWLINE_LF: newline = ('\r' << 8) | '\n'; break;
+ case PCRE_NEWLINE_ANY: newline = -1; break;
+ default: errorcode = ERR56; goto PCRE_EARLY_ERROR_RETURN;
}
-if (newline > 255)
+if (newline < 0)
{
- cd->nllen = 2;
- cd->nl[0] = (newline >> 8) & 255;
- cd->nl[1] = newline & 255;
+ cd->nltype = NLTYPE_ANY;
}
else
{
- cd->nllen = 1;
- cd->nl[0] = newline;
+ cd->nltype = NLTYPE_FIXED;
+ if (newline > 255)
+ {
+ cd->nllen = 2;
+ cd->nl[0] = (newline >> 8) & 255;
+ cd->nl[1] = newline & 255;
+ }
+ else
+ {
+ cd->nllen = 1;
+ cd->nl[0] = newline;
+ }
}
-/* Maximum back reference and backref bitmap. This is updated for numeric
-references during the first pass, but for named references during the actual
-compile pass. The bitmap records up to 31 back references to help in deciding
-whether (.*) can be treated as anchored or not. */
+/* Maximum back reference and backref bitmap. The bitmap records up to 31 back
+references to help in deciding whether (.*) can be treated as anchored or not.
+*/
cd->top_backref = 0;
cd->backref_map = 0;
@@ -4136,952 +5179,40 @@ cd->backref_map = 0;
DPRINTF(("------------------------------------------------------------------\n"));
DPRINTF(("%s\n", pattern));
-/* The first thing to do is to make a pass over the pattern to compute the
-amount of store required to hold the compiled code. This does not have to be
-perfect as long as errors are overestimates. At the same time we can detect any
-flag settings right at the start, and extract them. Make an attempt to correct
-for any counted white space if an "extended" flag setting appears late in the
-pattern. We can't be so clever for #-comments. */
-
-ptr = (const uschar *)(pattern - 1);
-while ((c = *(++ptr)) != 0)
- {
- int min, max;
- int class_optcount;
- int bracket_length;
- int duplength;
-
- /* If we are inside a \Q...\E sequence, all chars are literal */
-
- if (inescq)
- {
- if ((options & PCRE_AUTO_CALLOUT) != 0) length += 2 + 2*LINK_SIZE;
- goto NORMAL_CHAR;
- }
-
- /* Otherwise, first check for ignored whitespace and comments */
-
- if ((options & PCRE_EXTENDED) != 0)
- {
- if ((cd->ctypes[c] & ctype_space) != 0) continue;
- if (c == '#')
- {
- while (*(++ptr) != 0) if (IS_NEWLINE(ptr)) break;
- if (*ptr != 0)
- {
- ptr += cd->nllen - 1;
- continue;
- }
- break; /* End loop at end of pattern */
- }
- }
-
- item_count++; /* Is zero for the first non-comment item */
-
- /* Allow space for auto callout before every item except quantifiers. */
-
- if ((options & PCRE_AUTO_CALLOUT) != 0 &&
- c != '*' && c != '+' && c != '?' &&
- (c != '{' || !is_counted_repeat(ptr + 1)))
- length += 2 + 2*LINK_SIZE;
-
- switch(c)
- {
- /* A backslashed item may be an escaped data character or it may be a
- character type. */
-
- case '\\':
- c = check_escape(&ptr, &errorcode, bracount, options, FALSE);
- if (errorcode != 0) goto PCRE_ERROR_RETURN;
-
- lastitemlength = 1; /* Default length of last item for repeats */
-
- if (c >= 0) /* Data character */
- {
- length += 2; /* For a one-byte character */
-
-#ifdef SUPPORT_UTF8
- if (utf8 && c > 127)
- {
- int i;
- for (i = 0; i < _pcre_utf8_table1_size; i++)
- if (c <= _pcre_utf8_table1[i]) break;
- length += i;
- lastitemlength += i;
- }
-#endif
-
- continue;
- }
-
- /* If \Q, enter "literal" mode */
-
- if (-c == ESC_Q)
- {
- inescq = TRUE;
- continue;
- }
-
- /* \X is supported only if Unicode property support is compiled */
-
-#ifndef SUPPORT_UCP
- if (-c == ESC_X)
- {
- errorcode = ERR45;
- goto PCRE_ERROR_RETURN;
- }
-#endif
-
- /* \P and \p are for Unicode properties, but only when the support has
- been compiled. Each item needs 3 bytes. */
-
- else if (-c == ESC_P || -c == ESC_p)
- {
-#ifdef SUPPORT_UCP
- BOOL negated;
- BOOL pdata;
- length += 3;
- lastitemlength = 3;
- if (get_ucp(&ptr, &negated, &pdata, &errorcode) < 0)
- goto PCRE_ERROR_RETURN;
- continue;
-#else
- errorcode = ERR45;
- goto PCRE_ERROR_RETURN;
-#endif
- }
-
- /* Other escapes need one byte */
-
- length++;
-
- /* A back reference needs an additional 2 bytes, plus either one or 5
- bytes for a repeat. We also need to keep the value of the highest
- back reference. */
-
- if (c <= -ESC_REF)
- {
- int refnum = -c - ESC_REF;
- cd->backref_map |= (refnum < 32)? (1 << refnum) : 1;
- if (refnum > cd->top_backref)
- cd->top_backref = refnum;
- length += 2; /* For single back reference */
- if (ptr[1] == '{' && is_counted_repeat(ptr+2))
- {
- ptr = read_repeat_counts(ptr+2, &min, &max, &errorcode);
- if (errorcode != 0) goto PCRE_ERROR_RETURN;
- if ((min == 0 && (max == 1 || max == -1)) ||
- (min == 1 && max == -1))
- length++;
- else length += 5;
- if (ptr[1] == '?') ptr++;
- }
- }
- continue;
-
- case '^': /* Single-byte metacharacters */
- case '.':
- case '$':
- length++;
- lastitemlength = 1;
- continue;
-
- case '*': /* These repeats won't be after brackets; */
- case '+': /* those are handled separately */
- case '?':
- length++;
- goto POSESSIVE; /* A few lines below */
-
- /* This covers the cases of braced repeats after a single char, metachar,
- class, or back reference. */
-
- case '{':
- if (!is_counted_repeat(ptr+1)) goto NORMAL_CHAR;
- ptr = read_repeat_counts(ptr+1, &min, &max, &errorcode);
- if (errorcode != 0) goto PCRE_ERROR_RETURN;
-
- /* These special cases just insert one extra opcode */
-
- if ((min == 0 && (max == 1 || max == -1)) ||
- (min == 1 && max == -1))
- length++;
-
- /* These cases might insert additional copies of a preceding character. */
-
- else
- {
- if (min != 1)
- {
- length -= lastitemlength; /* Uncount the original char or metachar */
- if (min > 0) length += 3 + lastitemlength;
- }
- length += lastitemlength + ((max > 0)? 3 : 1);
- }
-
- if (ptr[1] == '?') ptr++; /* Needs no extra length */
-
- POSESSIVE: /* Test for possessive quantifier */
- if (ptr[1] == '+')
- {
- ptr++;
- length += 2 + 2*LINK_SIZE; /* Allow for atomic brackets */
- }
- continue;
-
- /* An alternation contains an offset to the next branch or ket. If any ims
- options changed in the previous branch(es), and/or if we are in a
- lookbehind assertion, extra space will be needed at the start of the
- branch. This is handled by branch_extra. */
-
- case '|':
- length += 1 + LINK_SIZE + branch_extra;
- continue;
-
- /* A character class uses 33 characters provided that all the character
- values are less than 256. Otherwise, it uses a bit map for low valued
- characters, and individual items for others. Don't worry about character
- types that aren't allowed in classes - they'll get picked up during the
- compile. A character class that contains only one single-byte character
- uses 2 or 3 bytes, depending on whether it is negated or not. Notice this
- where we can. (In UTF-8 mode we can do this only for chars < 128.) */
-
- case '[':
- if (*(++ptr) == '^')
- {
- class_optcount = 10; /* Greater than one */
- ptr++;
- }
- else class_optcount = 0;
-
-#ifdef SUPPORT_UTF8
- class_utf8 = FALSE;
-#endif
-
- /* Written as a "do" so that an initial ']' is taken as data */
-
- if (*ptr != 0) do
- {
- /* Inside \Q...\E everything is literal except \E */
-
- if (inescq)
- {
- if (*ptr != '\\' || ptr[1] != 'E') goto GET_ONE_CHARACTER;
- inescq = FALSE;
- ptr += 1;
- continue;
- }
-
- /* Outside \Q...\E, check for escapes */
-
- if (*ptr == '\\')
- {
- c = check_escape(&ptr, &errorcode, bracount, options, TRUE);
- if (errorcode != 0) goto PCRE_ERROR_RETURN;
-
- /* \b is backspace inside a class; \X is literal */
-
- if (-c == ESC_b) c = '\b';
- else if (-c == ESC_X) c = 'X';
-
- /* \Q enters quoting mode */
-
- else if (-c == ESC_Q)
- {
- inescq = TRUE;
- continue;
- }
-
- /* Handle escapes that turn into characters */
-
- if (c >= 0) goto NON_SPECIAL_CHARACTER;
-
- /* Escapes that are meta-things. The normal ones just affect the
- bit map, but Unicode properties require an XCLASS extended item. */
-
- else
- {
- class_optcount = 10; /* \d, \s etc; make sure > 1 */
-#ifdef SUPPORT_UTF8
- if (-c == ESC_p || -c == ESC_P)
- {
- if (!class_utf8)
- {
- class_utf8 = TRUE;
- length += LINK_SIZE + 2;
- }
- length += 3;
- }
-#endif
- }
- }
-
- /* Check the syntax for POSIX stuff. The bits we actually handle are
- checked during the real compile phase. */
-
- else if (*ptr == '[' &&
- (ptr[1] == ':' || ptr[1] == '.' || ptr[1] == '=') &&
- check_posix_syntax(ptr, &ptr, cd))
- {
- ptr++;
- class_optcount = 10; /* Make sure > 1 */
- }
-
- /* Anything else increments the possible optimization count. We have to
- detect ranges here so that we can compute the number of extra ranges for
- caseless wide characters when UCP support is available. If there are wide
- characters, we are going to have to use an XCLASS, even for single
- characters. */
-
- else
- {
- int d;
-
- GET_ONE_CHARACTER:
-
-#ifdef SUPPORT_UTF8
- if (utf8)
- {
- int extra = 0;
- GETCHARLEN(c, ptr, extra);
- ptr += extra;
- }
- else c = *ptr;
-#else
- c = *ptr;
-#endif
-
- /* Come here from handling \ above when it escapes to a char value */
-
- NON_SPECIAL_CHARACTER:
- class_optcount++;
-
- d = -1;
- if (ptr[1] == '-')
- {
- uschar const *hyptr = ptr++;
- if (ptr[1] == '\\')
- {
- ptr++;
- d = check_escape(&ptr, &errorcode, bracount, options, TRUE);
- if (errorcode != 0) goto PCRE_ERROR_RETURN;
- if (-d == ESC_b) d = '\b'; /* backspace */
- else if (-d == ESC_X) d = 'X'; /* literal X in a class */
- }
- else if (ptr[1] != 0 && ptr[1] != ']')
- {
- ptr++;
-#ifdef SUPPORT_UTF8
- if (utf8)
- {
- int extra = 0;
- GETCHARLEN(d, ptr, extra);
- ptr += extra;
- }
- else
-#endif
- d = *ptr;
- }
- if (d < 0) ptr = hyptr; /* go back to hyphen as data */
- }
-
- /* If d >= 0 we have a range. In UTF-8 mode, if the end is > 255, or >
- 127 for caseless matching, we will need to use an XCLASS. */
-
- if (d >= 0)
- {
- class_optcount = 10; /* Ensure > 1 */
- if (d < c)
- {
- errorcode = ERR8;
- goto PCRE_ERROR_RETURN;
- }
-
-#ifdef SUPPORT_UTF8
- if (utf8 && (d > 255 || ((options & PCRE_CASELESS) != 0 && d > 127)))
- {
- uschar buffer[6];
- if (!class_utf8) /* Allow for XCLASS overhead */
- {
- class_utf8 = TRUE;
- length += LINK_SIZE + 2;
- }
-
-#ifdef SUPPORT_UCP
- /* If we have UCP support, find out how many extra ranges are
- needed to map the other case of characters within this range. We
- have to mimic the range optimization here, because extending the
- range upwards might push d over a boundary that makes is use
- another byte in the UTF-8 representation. */
-
- if ((options & PCRE_CASELESS) != 0)
- {
- int occ, ocd;
- int cc = c;
- int origd = d;
- while (get_othercase_range(&cc, origd, &occ, &ocd))
- {
- if (occ >= c && ocd <= d) continue; /* Skip embedded */
-
- if (occ < c && ocd >= c - 1) /* Extend the basic range */
- { /* if there is overlap, */
- c = occ; /* noting that if occ < c */
- continue; /* we can't have ocd > d */
- } /* because a subrange is */
- if (ocd > d && occ <= d + 1) /* always shorter than */
- { /* the basic range. */
- d = ocd;
- continue;
- }
-
- /* An extra item is needed */
-
- length += 1 + _pcre_ord2utf8(occ, buffer) +
- ((occ == ocd)? 0 : _pcre_ord2utf8(ocd, buffer));
- }
- }
-#endif /* SUPPORT_UCP */
-
- /* The length of the (possibly extended) range */
-
- length += 1 + _pcre_ord2utf8(c, buffer) + _pcre_ord2utf8(d, buffer);
- }
-#endif /* SUPPORT_UTF8 */
-
- }
-
- /* We have a single character. There is nothing to be done unless we
- are in UTF-8 mode. If the char is > 255, or 127 when caseless, we must
- allow for an XCL_SINGLE item, doubled for caselessness if there is UCP
- support. */
-
- else
- {
-#ifdef SUPPORT_UTF8
- if (utf8 && (c > 255 || ((options & PCRE_CASELESS) != 0 && c > 127)))
- {
- uschar buffer[6];
- class_optcount = 10; /* Ensure > 1 */
- if (!class_utf8) /* Allow for XCLASS overhead */
- {
- class_utf8 = TRUE;
- length += LINK_SIZE + 2;
- }
-#ifdef SUPPORT_UCP
- length += (((options & PCRE_CASELESS) != 0)? 2 : 1) *
- (1 + _pcre_ord2utf8(c, buffer));
-#else /* SUPPORT_UCP */
- length += 1 + _pcre_ord2utf8(c, buffer);
-#endif /* SUPPORT_UCP */
- }
-#endif /* SUPPORT_UTF8 */
- }
- }
- }
- while (*(++ptr) != 0 && (inescq || *ptr != ']')); /* Concludes "do" above */
-
- if (*ptr == 0) /* Missing terminating ']' */
- {
- errorcode = ERR6;
- goto PCRE_ERROR_RETURN;
- }
-
- /* We can optimize when there was only one optimizable character. Repeats
- for positive and negated single one-byte chars are handled by the general
- code. Here, we handle repeats for the class opcodes. */
-
- if (class_optcount == 1) length += 3; else
- {
- length += 33;
-
- /* A repeat needs either 1 or 5 bytes. If it is a possessive quantifier,
- we also need extra for wrapping the whole thing in a sub-pattern. */
-
- if (*ptr != 0 && ptr[1] == '{' && is_counted_repeat(ptr+2))
- {
- ptr = read_repeat_counts(ptr+2, &min, &max, &errorcode);
- if (errorcode != 0) goto PCRE_ERROR_RETURN;
- if ((min == 0 && (max == 1 || max == -1)) ||
- (min == 1 && max == -1))
- length++;
- else length += 5;
- if (ptr[1] == '+')
- {
- ptr++;
- length += 2 + 2*LINK_SIZE;
- }
- else if (ptr[1] == '?') ptr++;
- }
- }
- continue;
-
- /* Brackets may be genuine groups or special things */
-
- case '(':
- branch_newextra = 0;
- bracket_length = 1 + LINK_SIZE;
- capturing = FALSE;
-
- /* Handle special forms of bracket, which all start (? */
-
- if (ptr[1] == '?')
- {
- int set, unset;
- int *optset;
-
- switch (c = ptr[2])
- {
- /* Skip over comments entirely */
- case '#':
- ptr += 3;
- while (*ptr != 0 && *ptr != ')') ptr++;
- if (*ptr == 0)
- {
- errorcode = ERR18;
- goto PCRE_ERROR_RETURN;
- }
- continue;
-
- /* Non-referencing groups and lookaheads just move the pointer on, and
- then behave like a non-special bracket, except that they don't increment
- the count of extracting brackets. Ditto for the "once only" bracket,
- which is in Perl from version 5.005. */
-
- case ':':
- case '=':
- case '!':
- case '>':
- ptr += 2;
- break;
-
- /* Named subpatterns are an extension copied from Python */
-
- case 'P':
- ptr += 3;
-
- /* Handle the definition of a named subpattern */
-
- if (*ptr == '<')
- {
- const uschar *p; /* Don't amalgamate; some compilers */
- p = ++ptr; /* grumble at autoincrement in declaration */
- while ((cd->ctypes[*ptr] & ctype_word) != 0) ptr++;
- if (*ptr != '>')
- {
- errorcode = ERR42;
- goto PCRE_ERROR_RETURN;
- }
- name_count++;
- if (name_count > MAX_NAME_COUNT)
- {
- errorcode = ERR49;
- goto PCRE_ERROR_RETURN;
- }
- if (ptr - p > max_name_size)
- {
- max_name_size = (ptr - p);
- if (max_name_size > MAX_NAME_SIZE)
- {
- errorcode = ERR48;
- goto PCRE_ERROR_RETURN;
- }
- }
- capturing = TRUE; /* Named parentheses are always capturing */
- break; /* Go handle capturing parentheses */
- }
-
- /* Handle back references and recursive calls to named subpatterns */
+/* Pretend to compile the pattern while actually just accumulating the length
+of memory required. This behaviour is triggered by passing a non-NULL final
+argument to compile_regex(). We pass a block of workspace (cworkspace) for it
+to compile parts of the pattern into; the compiled code is discarded when it is
+no longer needed, so hopefully this workspace will never overflow, though there
+is a test for its doing so. */
- if (*ptr == '=' || *ptr == '>')
- {
- length += 3 + 3*LINK_SIZE; /* Allow for the automatic "once" */
- while ((cd->ctypes[*(++ptr)] & ctype_word) != 0);
- if (*ptr != ')')
- {
- errorcode = ERR42;
- goto PCRE_ERROR_RETURN;
- }
- goto RECURSE_CHECK_QUANTIFIED;
- }
-
- /* Unknown character after (?P */
-
- errorcode = ERR41;
- goto PCRE_ERROR_RETURN;
-
- /* (?R) specifies a recursive call to the regex, which is an extension
- to provide the facility which can be obtained by (?p{perl-code}) in
- Perl 5.6. In Perl 5.8 this has become (??{perl-code}).
-
- From PCRE 4.00, items such as (?3) specify subroutine-like "calls" to
- the appropriate numbered brackets. This includes both recursive and
- non-recursive calls. (?R) is now synonymous with (?0). */
-
- case 'R':
- ptr++;
-
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- ptr += 2;
- if (c != 'R')
- while ((digitab[*(++ptr)] & ctype_digit) != 0);
- if (*ptr != ')')
- {
- errorcode = ERR29;
- goto PCRE_ERROR_RETURN;
- }
- length += 3 + 3*LINK_SIZE; /* Allows for the automatic "once" */
-
- /* If this item is quantified, it will get wrapped inside brackets so
- as to use the code for quantified brackets. We jump down and use the
- code that handles this for real brackets. Come here from code for
- named recursions/subroutines. */
-
- RECURSE_CHECK_QUANTIFIED:
- if (ptr[1] == '+' || ptr[1] == '*' || ptr[1] == '?' || ptr[1] == '{')
- {
- length += 2 + 2 * LINK_SIZE; /* to make bracketed */
- duplength = 5 + 3 * LINK_SIZE;
- goto HANDLE_QUANTIFIED_BRACKETS;
- }
- continue;
-
- /* (?C) is an extension which provides "callout" - to provide a bit of
- the functionality of the Perl (?{...}) feature. An optional number may
- follow (default is zero). */
-
- case 'C':
- ptr += 2;
- while ((digitab[*(++ptr)] & ctype_digit) != 0);
- if (*ptr != ')')
- {
- errorcode = ERR39;
- goto PCRE_ERROR_RETURN;
- }
- length += 2 + 2*LINK_SIZE;
- continue;
-
- /* Lookbehinds are in Perl from version 5.005 */
-
- case '<':
- ptr += 3;
- if (*ptr == '=' || *ptr == '!')
- {
- branch_newextra = 1 + LINK_SIZE;
- length += 1 + LINK_SIZE; /* For the first branch */
- break;
- }
- errorcode = ERR24;
- goto PCRE_ERROR_RETURN;
-
- /* Conditionals are in Perl from version 5.005. The bracket must either
- be followed by a number (for bracket reference) or by an assertion
- group. PCRE extends this by allowing a name to reference a named group;
- unfortunately, previously 'R' was implemented for a recursion test.
- When this is compiled, we look for the named group 'R' first. At this
- point we just do a basic syntax check. */
-
- case '(':
- if ((cd->ctypes[ptr[3]] & ctype_word) != 0)
- {
- ptr += 4;
- length += 3;
- while ((cd->ctypes[*ptr] & ctype_word) != 0) ptr++;
- if (*ptr != ')')
- {
- errorcode = ERR26;
- goto PCRE_ERROR_RETURN;
- }
- }
- else /* An assertion must follow */
- {
- ptr++; /* Can treat like ':' as far as spacing is concerned */
- if (ptr[2] != '?' ||
- (ptr[3] != '=' && ptr[3] != '!' && ptr[3] != '<') )
- {
- ptr += 2; /* To get right offset in message */
- errorcode = ERR28;
- goto PCRE_ERROR_RETURN;
- }
- }
- break;
-
- /* Else loop checking valid options until ) is met. Anything else is an
- error. If we are without any brackets, i.e. at top level, the settings
- act as if specified in the options, so massage the options immediately.
- This is for backward compatibility with Perl 5.004. */
-
- default:
- set = unset = 0;
- optset = &set;
- ptr += 2;
-
- for (;; ptr++)
- {
- c = *ptr;
- switch (c)
- {
- case 'i':
- *optset |= PCRE_CASELESS;
- continue;
-
- case 'J':
- *optset |= PCRE_DUPNAMES;
- options |= PCRE_JCHANGED; /* Record that it changed */
- continue;
-
- case 'm':
- *optset |= PCRE_MULTILINE;
- continue;
-
- case 's':
- *optset |= PCRE_DOTALL;
- continue;
-
- case 'x':
- *optset |= PCRE_EXTENDED;
- continue;
-
- case 'X':
- *optset |= PCRE_EXTRA;
- continue;
-
- case 'U':
- *optset |= PCRE_UNGREEDY;
- continue;
-
- case '-':
- optset = &unset;
- continue;
-
- /* A termination by ')' indicates an options-setting-only item; if
- this is at the very start of the pattern (indicated by item_count
- being zero), we use it to set the global options. This is helpful
- when analyzing the pattern for first characters, etc. Otherwise
- nothing is done here and it is handled during the compiling
- process.
-
- We allow for more than one options setting at the start. If such
- settings do not change the existing options, nothing is compiled.
- However, we must leave space just in case something is compiled.
- This can happen for pathological sequences such as (?i)(?-i)
- because the global options will end up with -i set. The space is
- small and not significant. (Before I did this there was a reported
- bug with (?i)(?-i) in a machine-generated pattern.)
-
- [Historical note: Up to Perl 5.8, options settings at top level
- were always global settings, wherever they appeared in the pattern.
- That is, they were equivalent to an external setting. From 5.8
- onwards, they apply only to what follows (which is what you might
- expect).] */
-
- case ')':
- if (item_count == 0)
- {
- options = (options | set) & (~unset);
- set = unset = 0; /* To save length */
- item_count--; /* To allow for several */
- length += 2;
- }
-
- /* Fall through */
-
- /* A termination by ':' indicates the start of a nested group with
- the given options set. This is again handled at compile time, but
- we must allow for compiled space if any of the ims options are
- set. We also have to allow for resetting space at the end of
- the group, which is why 4 is added to the length and not just 2.
- If there are several changes of options within the same group, this
- will lead to an over-estimate on the length, but this shouldn't
- matter very much. We also have to allow for resetting options at
- the start of any alternations, which we do by setting
- branch_newextra to 2. */
-
- case ':':
- if (((set|unset) & PCRE_IMS) != 0)
- {
- length += 4;
- branch_newextra = 2;
- }
- goto END_OPTIONS;
-
- /* Unrecognized option character */
-
- default:
- errorcode = ERR12;
- goto PCRE_ERROR_RETURN;
- }
- }
-
- /* If we hit a closing bracket, that's it - this is a freestanding
- option-setting. We need to ensure that branch_extra is updated if
- necessary. The only values branch_newextra can have here are 0 or 2.
- If the value is 2, then branch_extra must either be 2 or 5, depending
- on whether this is a lookbehind group or not. */
-
- END_OPTIONS:
- if (c == ')')
- {
- if (branch_newextra == 2 &&
- (branch_extra == 0 || branch_extra == 1+LINK_SIZE))
- branch_extra += branch_newextra;
- continue;
- }
-
- /* If options were terminated by ':' control comes here. This is a
- non-capturing group with an options change. There is nothing more that
- needs to be done because "capturing" is already set FALSE by default;
- we can just fall through. */
-
- }
- }
-
- /* Ordinary parentheses, not followed by '?', are capturing unless
- PCRE_NO_AUTO_CAPTURE is set. */
-
- else capturing = (options & PCRE_NO_AUTO_CAPTURE) == 0;
-
- /* Capturing brackets must be counted so we can process escapes in a
- Perlish way. If the number exceeds EXTRACT_BASIC_MAX we are going to need
- an additional 3 bytes of memory per capturing bracket. */
-
- if (capturing)
- {
- bracount++;
- if (bracount > EXTRACT_BASIC_MAX) bracket_length += 3;
- }
-
- /* Save length for computing whole length at end if there's a repeat that
- requires duplication of the group. Also save the current value of
- branch_extra, and start the new group with the new value. If non-zero, this
- will either be 2 for a (?imsx: group, or 3 for a lookbehind assertion. */
-
- if (brastackptr >= sizeof(brastack)/sizeof(int))
- {
- errorcode = ERR19;
- goto PCRE_ERROR_RETURN;
- }
-
- bralenstack[brastackptr] = branch_extra;
- branch_extra = branch_newextra;
-
- brastack[brastackptr++] = length;
- length += bracket_length;
- continue;
-
- /* Handle ket. Look for subsequent max/min; for certain sets of values we
- have to replicate this bracket up to that many times. If brastackptr is
- 0 this is an unmatched bracket which will generate an error, but take care
- not to try to access brastack[-1] when computing the length and restoring
- the branch_extra value. */
-
- case ')':
- length += 1 + LINK_SIZE;
- if (brastackptr > 0)
- {
- duplength = length - brastack[--brastackptr];
- branch_extra = bralenstack[brastackptr];
- /* This is a paranoid check to stop integer overflow later on */
- if (duplength > MAX_DUPLENGTH)
- {
- errorcode = ERR50;
- goto PCRE_ERROR_RETURN;
- }
- }
- else duplength = 0;
-
- /* The following code is also used when a recursion such as (?3) is
- followed by a quantifier, because in that case, it has to be wrapped inside
- brackets so that the quantifier works. The value of duplength must be
- set before arrival. */
-
- HANDLE_QUANTIFIED_BRACKETS:
-
- /* Leave ptr at the final char; for read_repeat_counts this happens
- automatically; for the others we need an increment. */
-
- if ((c = ptr[1]) == '{' && is_counted_repeat(ptr+2))
- {
- ptr = read_repeat_counts(ptr+2, &min, &max, &errorcode);
- if (errorcode != 0) goto PCRE_ERROR_RETURN;
- }
- else if (c == '*') { min = 0; max = -1; ptr++; }
- else if (c == '+') { min = 1; max = -1; ptr++; }
- else if (c == '?') { min = 0; max = 1; ptr++; }
- else { min = 1; max = 1; }
-
- /* If the minimum is zero, we have to allow for an OP_BRAZERO before the
- group, and if the maximum is greater than zero, we have to replicate
- maxval-1 times; each replication acquires an OP_BRAZERO plus a nesting
- bracket set. */
-
- if (min == 0)
- {
- length++;
- if (max > 0) length += (max - 1) * (duplength + 3 + 2*LINK_SIZE);
- }
-
- /* When the minimum is greater than zero, we have to replicate up to
- minval-1 times, with no additions required in the copies. Then, if there
- is a limited maximum we have to replicate up to maxval-1 times allowing
- for a BRAZERO item before each optional copy and nesting brackets for all
- but one of the optional copies. */
-
- else
- {
- length += (min - 1) * duplength;
- if (max > min) /* Need this test as max=-1 means no limit */
- length += (max - min) * (duplength + 3 + 2*LINK_SIZE)
- - (2 + 2*LINK_SIZE);
- }
-
- /* Allow space for once brackets for "possessive quantifier" */
-
- if (ptr[1] == '+')
- {
- ptr++;
- length += 2 + 2*LINK_SIZE;
- }
- continue;
-
- /* Non-special character. It won't be space or # in extended mode, so it is
- always a genuine character. If we are in a \Q...\E sequence, check for the
- end; if not, we have a literal. */
-
- default:
- NORMAL_CHAR:
-
- if (inescq && c == '\\' && ptr[1] == 'E')
- {
- inescq = FALSE;
- ptr++;
- continue;
- }
-
- length += 2; /* For a one-byte character */
- lastitemlength = 1; /* Default length of last item for repeats */
-
- /* In UTF-8 mode, check for additional bytes. */
-
-#ifdef SUPPORT_UTF8
- if (utf8 && (c & 0xc0) == 0xc0)
- {
- while ((ptr[1] & 0xc0) == 0x80) /* Can't flow over the end */
- { /* because the end is marked */
- lastitemlength++; /* by a zero byte. */
- length++;
- ptr++;
- }
- }
-#endif
+cd->bracount = 0;
+cd->names_found = 0;
+cd->name_entry_size = 0;
+cd->name_table = NULL;
+cd->start_workspace = cworkspace;
+cd->start_code = cworkspace;
+cd->hwm = cworkspace;
+cd->start_pattern = (const uschar *)pattern;
+cd->end_pattern = (const uschar *)(pattern + strlen(pattern));
+cd->req_varyopt = 0;
+cd->nopartial = FALSE;
+cd->external_options = options;
- continue;
- }
- }
+/* Now do the pre-compile. On error, errorcode will be set non-zero, so we
+don't need to look at the result of the function here. The initial options have
+been put into the cd block so that they can be changed if an option setting is
+found within the regex right at the beginning. Bringing initial option settings
+outside can help speed up starting point checks. */
-length += 2 + LINK_SIZE; /* For final KET and END */
+code = cworkspace;
+*code = OP_BRA;
+(void)compile_regex(cd->external_options, cd->external_options & PCRE_IMS,
+ &code, &ptr, &errorcode, FALSE, 0, &firstbyte, &reqbyte, NULL, cd, &length);
+if (errorcode != 0) goto PCRE_EARLY_ERROR_RETURN;
-if ((options & PCRE_AUTO_CALLOUT) != 0)
- length += 2 + 2*LINK_SIZE; /* For final callout */
+DPRINTF(("end pre-compile: length=%d workspace=%d\n", length,
+ cd->hwm - cworkspace));
if (length > MAX_PATTERN_SIZE)
{
@@ -5091,9 +5222,10 @@ if (length > MAX_PATTERN_SIZE)
/* Compute the size of data block needed and get it, either from malloc or
externally provided function. Integer overflow should no longer be possible
-because nowadays we limit the maximum value of name_count and max_name size. */
+because nowadays we limit the maximum value of cd->names_found and
+cd->name_entry_size. */
-size = length + sizeof(real_pcre) + name_count * (max_name_size + 3);
+size = length + sizeof(real_pcre) + cd->names_found * (cd->name_entry_size + 3);
re = (real_pcre *)(pcre_malloc)(size);
if (re == NULL)
@@ -5102,31 +5234,37 @@ if (re == NULL)
goto PCRE_EARLY_ERROR_RETURN;
}
-/* Put in the magic number, and save the sizes, options, and character table
-pointer. NULL is used for the default character tables. The nullpad field is at
-the end; it's there to help in the case when a regex compiled on a system with
-4-byte pointers is run on another with 8-byte pointers. */
+/* Put in the magic number, and save the sizes, initial options, and character
+table pointer. NULL is used for the default character tables. The nullpad field
+is at the end; it's there to help in the case when a regex compiled on a system
+with 4-byte pointers is run on another with 8-byte pointers. */
re->magic_number = MAGIC_NUMBER;
re->size = size;
-re->options = options;
+re->options = cd->external_options;
re->dummy1 = 0;
+re->first_byte = 0;
+re->req_byte = 0;
re->name_table_offset = sizeof(real_pcre);
-re->name_entry_size = max_name_size + 3;
-re->name_count = name_count;
+re->name_entry_size = cd->name_entry_size;
+re->name_count = cd->names_found;
re->ref_count = 0;
re->tables = (tables == _pcre_default_tables)? NULL : tables;
re->nullpad = NULL;
/* The starting points of the name/number translation table and of the code are
-passed around in the compile data block. */
+passed around in the compile data block. The start/end pattern and initial
+options are already set from the pre-compile phase, as is the name_entry_size
+field. Reset the bracket count and the names_found field. Also reset the hwm
+field; this time it's used for remembering forward references to subpatterns.
+*/
+cd->bracount = 0;
cd->names_found = 0;
-cd->name_entry_size = max_name_size + 3;
cd->name_table = (uschar *)re + re->name_table_offset;
codestart = cd->name_table + re->name_entry_size * re->name_count;
cd->start_code = codestart;
-cd->start_pattern = (const uschar *)pattern;
+cd->hwm = cworkspace;
cd->req_varyopt = 0;
cd->nopartial = FALSE;
@@ -5137,10 +5275,9 @@ of the function here. */
ptr = (const uschar *)pattern;
code = (uschar *)codestart;
*code = OP_BRA;
-bracount = 0;
-(void)compile_regex(options, options & PCRE_IMS, &bracount, &code, &ptr,
- &errorcode, FALSE, 0, &firstbyte, &reqbyte, NULL, cd);
-re->top_bracket = bracount;
+(void)compile_regex(re->options, re->options & PCRE_IMS, &code, &ptr,
+ &errorcode, FALSE, 0, &firstbyte, &reqbyte, NULL, cd, NULL);
+re->top_bracket = cd->bracount;
re->top_backref = cd->top_backref;
if (cd->nopartial) re->options |= PCRE_NOPARTIAL;
@@ -5158,19 +5295,35 @@ if debugging, leave the test till after things are printed out. */
if (code - codestart > length) errorcode = ERR23;
#endif
+/* Fill in any forward references that are required. */
+
+while (errorcode == 0 && cd->hwm > cworkspace)
+ {
+ int offset, recno;
+ const uschar *groupptr;
+ cd->hwm -= LINK_SIZE;
+ offset = GET(cd->hwm, 0);
+ recno = GET(codestart, offset);
+ groupptr = find_bracket(codestart, (re->options & PCRE_UTF8) != 0, recno);
+ if (groupptr == NULL) errorcode = ERR53;
+ else PUT(((uschar *)codestart), offset, groupptr - codestart);
+ }
+
/* Give an error if there's back reference to a non-existent capturing
subpattern. */
-if (re->top_backref > re->top_bracket) errorcode = ERR15;
+if (errorcode == 0 && re->top_backref > re->top_bracket) errorcode = ERR15;
/* Failed to compile, or error while post-processing */
if (errorcode != 0)
{
(pcre_free)(re);
- PCRE_ERROR_RETURN:
- *erroroffset = ptr - (const uschar *)pattern;
PCRE_EARLY_ERROR_RETURN:
+ *erroroffset = ptr - (const uschar *)pattern;
+#ifdef SUPPORT_UTF8
+ PCRE_UTF8_ERROR_RETURN:
+#endif
*errorptr = error_texts[errorcode];
if (errorcodeptr != NULL) *errorcodeptr = errorcode;
return NULL;
@@ -5180,15 +5333,15 @@ if (errorcode != 0)
the pattern is anchored by virtue of ^ characters or \A or anything else (such
as starting with .* when DOTALL is set).
-Otherwise, if we know what the first character has to be, save it, because that
+Otherwise, if we know what the first byte has to be, save it, because that
speeds up unanchored matches no end. If not, see if we can set the
PCRE_STARTLINE flag. This is helpful for multiline matches when all branches
start with ^. and also when all branches start with .* for non-DOTALL matches.
*/
-if ((options & PCRE_ANCHORED) == 0)
+if ((re->options & PCRE_ANCHORED) == 0)
{
- int temp_options = options;
+ int temp_options = re->options; /* May get changed during these scans */
if (is_anchored(codestart, &temp_options, 0, cd->backref_map))
re->options |= PCRE_ANCHORED;
else
@@ -5273,7 +5426,7 @@ if (code - codestart > length)
if (errorcodeptr != NULL) *errorcodeptr = ERR23;
return NULL;
}
-#endif
+#endif /* DEBUG */
return (pcre *)re;
}
diff --git a/pcre_dfa_exec.c b/pcre_dfa_exec.c
index d05d766..5f1301f 100644
--- a/pcre_dfa_exec.c
+++ b/pcre_dfa_exec.c
@@ -39,11 +39,15 @@ POSSIBILITY OF SUCH DAMAGE.
/* This module contains the external function pcre_dfa_exec(), which is an
-alternative matching function that uses a DFA algorithm. This is NOT Perl-
-compatible, but it has advantages in certain applications. */
+alternative matching function that uses a sort of DFA algorithm (not a true
+FSM). This is NOT Perl- compatible, but it has advantages in certain
+applications. */
-#define NLBLOCK md /* The block containing newline information */
+#define NLBLOCK md /* Block containing newline information */
+#define PSSTART start_subject /* Field containing processed string start */
+#define PSEND end_subject /* Field containing processed string end */
+
#include "pcre_internal.h"
@@ -58,11 +62,12 @@ compatible, but it has advantages in certain applications. */
*************************************************/
/* These are offsets that are used to turn the OP_TYPESTAR and friends opcodes
-into others, under special conditions. A gap of 10 between the blocks should be
+into others, under special conditions. A gap of 20 between the blocks should be
enough. */
-#define OP_PROP_EXTRA (EXTRACT_BASIC_MAX+1)
-#define OP_EXTUNI_EXTRA (EXTRACT_BASIC_MAX+11)
+#define OP_PROP_EXTRA 100
+#define OP_EXTUNI_EXTRA 120
+#define OP_ANYNL_EXTRA 140
/* This table identifies those opcodes that are followed immediately by a
@@ -75,7 +80,7 @@ static uschar coptable[] = {
0, /* End */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* \A, \G, \B, \b, \D, \d, \S, \s, \W, \w */
0, 0, /* Any, Anybyte */
- 0, 0, 0, /* NOTPROP, PROP, EXTUNI */
+ 0, 0, 0, 0, /* NOTPROP, PROP, EXTUNI, ANYNL */
0, 0, 0, 0, 0, /* \Z, \z, Opt, ^, $ */
1, /* Char */
1, /* Charnc */
@@ -83,12 +88,15 @@ static uschar coptable[] = {
/* Positive single-char repeats */
1, 1, 1, 1, 1, 1, /* *, *?, +, +?, ?, ?? */
3, 3, 3, /* upto, minupto, exact */
+ 1, 1, 1, 3, /* *+, ++, ?+, upto+ */
/* Negative single-char repeats - only for chars < 256 */
1, 1, 1, 1, 1, 1, /* NOT *, *?, +, +?, ?, ?? */
3, 3, 3, /* NOT upto, minupto, exact */
+ 1, 1, 1, 3, /* NOT *+, ++, ?+, updo+ */
/* Positive type repeats */
1, 1, 1, 1, 1, 1, /* Type *, *?, +, +?, ?, ?? */
3, 3, 3, /* Type upto, minupto, exact */
+ 1, 1, 1, 3, /* Type *+, ++, ?+, upto+ */
/* Character class & ref repeats */
0, 0, 0, 0, 0, 0, /* *, *?, +, +?, ?, ?? */
0, 0, /* CRRANGE, CRMINRANGE */
@@ -107,12 +115,12 @@ static uschar coptable[] = {
0, /* Assert behind */
0, /* Assert behind not */
0, /* Reverse */
- 0, /* Once */
- 0, /* COND */
+ 0, 0, 0, 0, /* ONCE, BRA, CBRA, COND */
+ 0, 0, 0, /* SBRA, SCBRA, SCOND */
0, /* CREF */
- 0, 0, /* BRAZERO, BRAMINZERO */
- 0, /* BRANUMBER */
- 0 /* BRA */
+ 0, /* RREF */
+ 0, /* DEF */
+ 0, 0 /* BRAZERO, BRAMINZERO */
};
/* These 2 tables allow for compact code for testing for \D, \d, \S, \s, \W,
@@ -278,7 +286,7 @@ stateblock *next_active_state, *next_new_state;
const uschar *ctypes, *lcc, *fcc;
const uschar *ptr;
-const uschar *end_code;
+const uschar *end_code, *first_op;
int active_count, new_count, match_count;
@@ -291,6 +299,8 @@ const uschar *start_code = md->start_code;
#ifdef SUPPORT_UTF8
BOOL utf8 = (md->poptions & PCRE_UTF8) != 0;
+#else
+BOOL utf8 = FALSE;
#endif
rlevel++;
@@ -314,6 +324,9 @@ active_states = (stateblock *)(workspace + 2);
next_new_state = new_states = active_states + wscount;
new_count = 0;
+first_op = this_start_code + 1 + LINK_SIZE +
+ ((*this_start_code == OP_CBRA || *this_start_code == OP_SCBRA)? 2:0);
+
/* The first thing in any (sub) pattern is a bracket of some sort. Push all
the alternative states onto the list, and find out where the end is. This
makes is possible to use this function recursively, when we want to stop at a
@@ -323,7 +336,7 @@ If the first opcode in the first alternative is OP_REVERSE, we are dealing with
a backward assertion. In that case, we have to find out the maximum amount to
move back, and set up each alternative appropriately. */
-if (this_start_code[1+LINK_SIZE] == OP_REVERSE)
+if (*first_op == OP_REVERSE)
{
int max_back = 0;
int gone_back;
@@ -405,10 +418,13 @@ else
else
{
+ int length = 1 + LINK_SIZE +
+ ((*this_start_code == OP_CBRA || *this_start_code == OP_SCBRA)? 2:0);
do
{
- ADD_NEW(end_code - start_code + 1 + LINK_SIZE, 0);
+ ADD_NEW(end_code - start_code + length, 0);
end_code += GET(end_code, 1);
+ length = 1 + LINK_SIZE;
}
while (*end_code == OP_ALT);
}
@@ -461,7 +477,7 @@ for (;;)
if (ptr < end_subject)
{
- clen = 1;
+ clen = 1; /* Number of bytes in the character */
#ifdef SUPPORT_UTF8
if (utf8) { GETCHARLEN(c, ptr, clen); } else
#endif /* SUPPORT_UTF8 */
@@ -469,8 +485,8 @@ for (;;)
}
else
{
- clen = 0; /* At end subject */
- c = -1;
+ clen = 0; /* This indicates the end of the subject */
+ c = NOTACHAR; /* This value should never actually be used */
}
/* Scan up the active states and act on each one. The result of an action
@@ -488,7 +504,7 @@ for (;;)
#ifdef DEBUG
printf ("%.*sProcessing state %d c=", rlevel*2-2, SP, state_offset);
- if (c < 0) printf("-1\n");
+ if (clen == 0) printf("EOL\n");
else if (c > 32 && c < 127) printf("'%c'\n", c);
else printf("0x%02x\n", c);
#endif
@@ -532,7 +548,6 @@ for (;;)
code = start_code + state_offset;
codevalue = *code;
- if (codevalue >= OP_BRA) codevalue = OP_BRA; /* All brackets are equal */
/* If this opcode is followed by an inline character, load it. It is
tempting to test for the presence of a subject character here, but that
@@ -554,15 +569,21 @@ for (;;)
d = code[coptable[codevalue]];
if (codevalue >= OP_TYPESTAR)
{
- if (d == OP_ANYBYTE) return PCRE_ERROR_DFA_UITEM;
- if (d >= OP_NOTPROP)
- codevalue += (d == OP_EXTUNI)? OP_EXTUNI_EXTRA : OP_PROP_EXTRA;
+ switch(d)
+ {
+ case OP_ANYBYTE: return PCRE_ERROR_DFA_UITEM;
+ case OP_NOTPROP:
+ case OP_PROP: codevalue += OP_PROP_EXTRA; break;
+ case OP_ANYNL: codevalue += OP_ANYNL_EXTRA; break;
+ case OP_EXTUNI: codevalue += OP_EXTUNI_EXTRA; break;
+ default: break;
+ }
}
}
else
{
dlen = 0; /* Not strictly necessary, but compilers moan */
- d = -1; /* if these variables are not set. */
+ d = NOTACHAR; /* if these variables are not set. */
}
@@ -624,6 +645,7 @@ for (;;)
/*-----------------------------------------------------------------*/
case OP_BRA:
+ case OP_SBRA:
do
{
ADD_ACTIVE(code - start_code + 1 + LINK_SIZE, 0);
@@ -633,6 +655,18 @@ for (;;)
break;
/*-----------------------------------------------------------------*/
+ case OP_CBRA:
+ case OP_SCBRA:
+ ADD_ACTIVE(code - start_code + 3 + LINK_SIZE, 0);
+ code += GET(code, 1);
+ while (*code == OP_ALT)
+ {
+ ADD_ACTIVE(code - start_code + 1 + LINK_SIZE, 0);
+ code += GET(code, 1);
+ }
+ break;
+
+ /*-----------------------------------------------------------------*/
case OP_BRAZERO:
case OP_BRAMINZERO:
ADD_ACTIVE(state_offset + 1, 0);
@@ -642,17 +676,11 @@ for (;;)
break;
/*-----------------------------------------------------------------*/
- case OP_BRANUMBER:
- ADD_ACTIVE(state_offset + 1 + LINK_SIZE, 0);
- break;
-
- /*-----------------------------------------------------------------*/
case OP_CIRC:
if ((ptr == start_subject && (md->moptions & PCRE_NOTBOL) == 0) ||
((ims & PCRE_MULTILINE) != 0 &&
- ptr >= start_subject + md->nllen &&
ptr != end_subject &&
- IS_NEWLINE(ptr - md->nllen)))
+ WAS_NEWLINE(ptr)))
{ ADD_ACTIVE(state_offset + 1, 0); }
break;
@@ -686,16 +714,13 @@ for (;;)
/*-----------------------------------------------------------------*/
case OP_ANY:
- if (clen > 0 && ((ims & PCRE_DOTALL) != 0 ||
- ptr > end_subject - md->nllen ||
- !IS_NEWLINE(ptr)))
+ if (clen > 0 && ((ims & PCRE_DOTALL) != 0 || !IS_NEWLINE(ptr)))
{ ADD_NEW(state_offset + 1, 0); }
break;
/*-----------------------------------------------------------------*/
case OP_EODN:
- if (clen == 0 ||
- (ptr == end_subject - md->nllen && IS_NEWLINE(ptr)))
+ if (clen == 0 || (IS_NEWLINE(ptr) && ptr == end_subject - md->nllen))
{ ADD_ACTIVE(state_offset + 1, 0); }
break;
@@ -704,13 +729,12 @@ for (;;)
if ((md->moptions & PCRE_NOTEOL) == 0)
{
if (clen == 0 ||
- (ptr <= end_subject - md->nllen && IS_NEWLINE(ptr) &&
+ (IS_NEWLINE(ptr) &&
((ims & PCRE_MULTILINE) != 0 || ptr == end_subject - md->nllen)
))
{ ADD_ACTIVE(state_offset + 1, 0); }
}
- else if ((ims & PCRE_MULTILINE) != 0 &&
- ptr <= end_subject - md->nllen && IS_NEWLINE(ptr))
+ else if ((ims & PCRE_MULTILINE) != 0 && IS_NEWLINE(ptr))
{ ADD_ACTIVE(state_offset + 1, 0); }
break;
@@ -816,6 +840,7 @@ for (;;)
case OP_TYPEPLUS:
case OP_TYPEMINPLUS:
+ case OP_TYPEPOSPLUS:
count = current_state->count; /* Already matched */
if (count > 0) { ADD_ACTIVE(state_offset + 2, 0); }
if (clen > 0)
@@ -824,11 +849,15 @@ for (;;)
(c < 256 &&
(d != OP_ANY ||
(ims & PCRE_DOTALL) != 0 ||
- ptr > end_subject - md->nllen ||
!IS_NEWLINE(ptr)
) &&
((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0))
{
+ if (count > 0 && codevalue == OP_TYPEPOSPLUS)
+ {
+ active_count--; /* Remove non-match possibility */
+ next_active_state--;
+ }
count++;
ADD_NEW(state_offset, count);
}
@@ -838,6 +867,7 @@ for (;;)
/*-----------------------------------------------------------------*/
case OP_TYPEQUERY:
case OP_TYPEMINQUERY:
+ case OP_TYPEPOSQUERY:
ADD_ACTIVE(state_offset + 2, 0);
if (clen > 0)
{
@@ -845,11 +875,15 @@ for (;;)
(c < 256 &&
(d != OP_ANY ||
(ims & PCRE_DOTALL) != 0 ||
- ptr > end_subject - md->nllen ||
!IS_NEWLINE(ptr)
) &&
((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0))
{
+ if (codevalue == OP_TYPEPOSQUERY)
+ {
+ active_count--; /* Remove non-match possibility */
+ next_active_state--;
+ }
ADD_NEW(state_offset + 2, 0);
}
}
@@ -858,6 +892,7 @@ for (;;)
/*-----------------------------------------------------------------*/
case OP_TYPESTAR:
case OP_TYPEMINSTAR:
+ case OP_TYPEPOSSTAR:
ADD_ACTIVE(state_offset + 2, 0);
if (clen > 0)
{
@@ -865,11 +900,15 @@ for (;;)
(c < 256 &&
(d != OP_ANY ||
(ims & PCRE_DOTALL) != 0 ||
- ptr > end_subject - md->nllen ||
!IS_NEWLINE(ptr)
) &&
((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0))
{
+ if (codevalue == OP_TYPEPOSSTAR)
+ {
+ active_count--; /* Remove non-match possibility */
+ next_active_state--;
+ }
ADD_NEW(state_offset, 0);
}
}
@@ -877,10 +916,30 @@ for (;;)
/*-----------------------------------------------------------------*/
case OP_TYPEEXACT:
+ count = current_state->count; /* Number already matched */
+ if (clen > 0)
+ {
+ if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) ||
+ (c < 256 &&
+ (d != OP_ANY ||
+ (ims & PCRE_DOTALL) != 0 ||
+ !IS_NEWLINE(ptr)
+ ) &&
+ ((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0))
+ {
+ if (++count >= GET2(code, 1))
+ { ADD_NEW(state_offset + 4, 0); }
+ else
+ { ADD_NEW(state_offset, count); }
+ }
+ }
+ break;
+
+ /*-----------------------------------------------------------------*/
case OP_TYPEUPTO:
case OP_TYPEMINUPTO:
- if (codevalue != OP_TYPEEXACT)
- { ADD_ACTIVE(state_offset + 4, 0); }
+ case OP_TYPEPOSUPTO:
+ ADD_ACTIVE(state_offset + 4, 0);
count = current_state->count; /* Number already matched */
if (clen > 0)
{
@@ -888,11 +947,15 @@ for (;;)
(c < 256 &&
(d != OP_ANY ||
(ims & PCRE_DOTALL) != 0 ||
- ptr > end_subject - md->nllen ||
!IS_NEWLINE(ptr)
) &&
((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0))
{
+ if (codevalue == OP_TYPEPOSUPTO)
+ {
+ active_count--; /* Remove non-match possibility */
+ next_active_state--;
+ }
if (++count >= GET2(code, 1))
{ ADD_NEW(state_offset + 4, 0); }
else
@@ -903,12 +966,13 @@ for (;;)
/* ========================================================================== */
/* These are virtual opcodes that are used when something like
- OP_TYPEPLUS has OP_PROP, OP_NOTPROP, or OP_EXTUNI as its argument. It
- keeps the code above fast for the other cases. The argument is in the
- d variable. */
+ OP_TYPEPLUS has OP_PROP, OP_NOTPROP, OP_ANYNL, or OP_EXTUNI as its
+ argument. It keeps the code above fast for the other cases. The argument
+ is in the d variable. */
case OP_PROP_EXTRA + OP_TYPEPLUS:
case OP_PROP_EXTRA + OP_TYPEMINPLUS:
+ case OP_PROP_EXTRA + OP_TYPEPOSPLUS:
count = current_state->count; /* Already matched */
if (count > 0) { ADD_ACTIVE(state_offset + 4, 0); }
if (clen > 0)
@@ -944,19 +1008,34 @@ for (;;)
break;
}
- if (OK == (d == OP_PROP)) { count++; ADD_NEW(state_offset, count); }
+ if (OK == (d == OP_PROP))
+ {
+ if (count > 0 && codevalue == OP_PROP_EXTRA + OP_TYPEPOSPLUS)
+ {
+ active_count--; /* Remove non-match possibility */
+ next_active_state--;
+ }
+ count++;
+ ADD_NEW(state_offset, count);
+ }
}
break;
/*-----------------------------------------------------------------*/
case OP_EXTUNI_EXTRA + OP_TYPEPLUS:
case OP_EXTUNI_EXTRA + OP_TYPEMINPLUS:
+ case OP_EXTUNI_EXTRA + OP_TYPEPOSPLUS:
count = current_state->count; /* Already matched */
if (count > 0) { ADD_ACTIVE(state_offset + 2, 0); }
if (clen > 0 && _pcre_ucp_findprop(c, &chartype, &script) != ucp_M)
{
const uschar *nptr = ptr + clen;
int ncount = 0;
+ if (count > 0 && codevalue == OP_EXTUNI_EXTRA + OP_TYPEPOSPLUS)
+ {
+ active_count--; /* Remove non-match possibility */
+ next_active_state--;
+ }
while (nptr < end_subject)
{
int nd;
@@ -972,13 +1051,49 @@ for (;;)
break;
/*-----------------------------------------------------------------*/
+ case OP_ANYNL_EXTRA + OP_TYPEPLUS:
+ case OP_ANYNL_EXTRA + OP_TYPEMINPLUS:
+ case OP_ANYNL_EXTRA + OP_TYPEPOSPLUS:
+ count = current_state->count; /* Already matched */
+ if (count > 0) { ADD_ACTIVE(state_offset + 2, 0); }
+ if (clen > 0)
+ {
+ int ncount = 0;
+ switch (c)
+ {
+ case 0x000d:
+ if (ptr + 1 < end_subject && ptr[1] == 0x0a) ncount = 1;
+ /* Fall through */
+ case 0x000a:
+ case 0x000b:
+ case 0x000c:
+ case 0x0085:
+ case 0x2028:
+ case 0x2029:
+ if (count > 0 && codevalue == OP_ANYNL_EXTRA + OP_TYPEPOSPLUS)
+ {
+ active_count--; /* Remove non-match possibility */
+ next_active_state--;
+ }
+ count++;
+ ADD_NEW_DATA(-state_offset, count, ncount);
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+
+ /*-----------------------------------------------------------------*/
case OP_PROP_EXTRA + OP_TYPEQUERY:
case OP_PROP_EXTRA + OP_TYPEMINQUERY:
+ case OP_PROP_EXTRA + OP_TYPEPOSQUERY:
count = 4;
goto QS1;
case OP_PROP_EXTRA + OP_TYPESTAR:
case OP_PROP_EXTRA + OP_TYPEMINSTAR:
+ case OP_PROP_EXTRA + OP_TYPEPOSSTAR:
count = 0;
QS1:
@@ -1017,18 +1132,29 @@ for (;;)
break;
}
- if (OK == (d == OP_PROP)) { ADD_NEW(state_offset + count, 0); }
+ if (OK == (d == OP_PROP))
+ {
+ if (codevalue == OP_PROP_EXTRA + OP_TYPEPOSSTAR ||
+ codevalue == OP_PROP_EXTRA + OP_TYPEPOSQUERY)
+ {
+ active_count--; /* Remove non-match possibility */
+ next_active_state--;
+ }
+ ADD_NEW(state_offset + count, 0);
+ }
}
break;
/*-----------------------------------------------------------------*/
case OP_EXTUNI_EXTRA + OP_TYPEQUERY:
case OP_EXTUNI_EXTRA + OP_TYPEMINQUERY:
+ case OP_EXTUNI_EXTRA + OP_TYPEPOSQUERY:
count = 2;
goto QS2;
case OP_EXTUNI_EXTRA + OP_TYPESTAR:
case OP_EXTUNI_EXTRA + OP_TYPEMINSTAR:
+ case OP_EXTUNI_EXTRA + OP_TYPEPOSSTAR:
count = 0;
QS2:
@@ -1038,6 +1164,12 @@ for (;;)
{
const uschar *nptr = ptr + clen;
int ncount = 0;
+ if (codevalue == OP_EXTUNI_EXTRA + OP_TYPEPOSSTAR ||
+ codevalue == OP_EXTUNI_EXTRA + OP_TYPEPOSQUERY)
+ {
+ active_count--; /* Remove non-match possibility */
+ next_active_state--;
+ }
while (nptr < end_subject)
{
int nd;
@@ -1052,9 +1184,52 @@ for (;;)
break;
/*-----------------------------------------------------------------*/
+ case OP_ANYNL_EXTRA + OP_TYPEQUERY:
+ case OP_ANYNL_EXTRA + OP_TYPEMINQUERY:
+ case OP_ANYNL_EXTRA + OP_TYPEPOSQUERY:
+ count = 2;
+ goto QS3;
+
+ case OP_ANYNL_EXTRA + OP_TYPESTAR:
+ case OP_ANYNL_EXTRA + OP_TYPEMINSTAR:
+ case OP_ANYNL_EXTRA + OP_TYPEPOSSTAR:
+ count = 0;
+
+ QS3:
+ ADD_ACTIVE(state_offset + 2, 0);
+ if (clen > 0)
+ {
+ int ncount = 0;
+ switch (c)
+ {
+ case 0x000d:
+ if (ptr + 1 < end_subject && ptr[1] == 0x0a) ncount = 1;
+ /* Fall through */
+ case 0x000a:
+ case 0x000b:
+ case 0x000c:
+ case 0x0085:
+ case 0x2028:
+ case 0x2029:
+ if (codevalue == OP_ANYNL_EXTRA + OP_TYPEPOSSTAR ||
+ codevalue == OP_ANYNL_EXTRA + OP_TYPEPOSQUERY)
+ {
+ active_count--; /* Remove non-match possibility */
+ next_active_state--;
+ }
+ ADD_NEW_DATA(-(state_offset + count), 0, ncount);
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+
+ /*-----------------------------------------------------------------*/
case OP_PROP_EXTRA + OP_TYPEEXACT:
case OP_PROP_EXTRA + OP_TYPEUPTO:
case OP_PROP_EXTRA + OP_TYPEMINUPTO:
+ case OP_PROP_EXTRA + OP_TYPEPOSUPTO:
if (codevalue != OP_PROP_EXTRA + OP_TYPEEXACT)
{ ADD_ACTIVE(state_offset + 6, 0); }
count = current_state->count; /* Number already matched */
@@ -1093,6 +1268,11 @@ for (;;)
if (OK == (d == OP_PROP))
{
+ if (codevalue == OP_PROP_EXTRA + OP_TYPEPOSUPTO)
+ {
+ active_count--; /* Remove non-match possibility */
+ next_active_state--;
+ }
if (++count >= GET2(code, 1))
{ ADD_NEW(state_offset + 6, 0); }
else
@@ -1105,6 +1285,7 @@ for (;;)
case OP_EXTUNI_EXTRA + OP_TYPEEXACT:
case OP_EXTUNI_EXTRA + OP_TYPEUPTO:
case OP_EXTUNI_EXTRA + OP_TYPEMINUPTO:
+ case OP_EXTUNI_EXTRA + OP_TYPEPOSUPTO:
if (codevalue != OP_EXTUNI_EXTRA + OP_TYPEEXACT)
{ ADD_ACTIVE(state_offset + 4, 0); }
count = current_state->count; /* Number already matched */
@@ -1112,6 +1293,11 @@ for (;;)
{
const uschar *nptr = ptr + clen;
int ncount = 0;
+ if (codevalue == OP_EXTUNI_EXTRA + OP_TYPEPOSUPTO)
+ {
+ active_count--; /* Remove non-match possibility */
+ next_active_state--;
+ }
while (nptr < end_subject)
{
int nd;
@@ -1128,6 +1314,44 @@ for (;;)
}
break;
+ /*-----------------------------------------------------------------*/
+ case OP_ANYNL_EXTRA + OP_TYPEEXACT:
+ case OP_ANYNL_EXTRA + OP_TYPEUPTO:
+ case OP_ANYNL_EXTRA + OP_TYPEMINUPTO:
+ case OP_ANYNL_EXTRA + OP_TYPEPOSUPTO:
+ if (codevalue != OP_ANYNL_EXTRA + OP_TYPEEXACT)
+ { ADD_ACTIVE(state_offset + 4, 0); }
+ count = current_state->count; /* Number already matched */
+ if (clen > 0)
+ {
+ int ncount = 0;
+ switch (c)
+ {
+ case 0x000d:
+ if (ptr + 1 < end_subject && ptr[1] == 0x0a) ncount = 1;
+ /* Fall through */
+ case 0x000a:
+ case 0x000b:
+ case 0x000c:
+ case 0x0085:
+ case 0x2028:
+ case 0x2029:
+ if (codevalue == OP_ANYNL_EXTRA + OP_TYPEPOSUPTO)
+ {
+ active_count--; /* Remove non-match possibility */
+ next_active_state--;
+ }
+ if (++count >= GET2(code, 1))
+ { ADD_NEW_DATA(-(state_offset + 4), 0, ncount); }
+ else
+ { ADD_NEW_DATA(-state_offset, count, ncount); }
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+
/* ========================================================================== */
/* These opcodes are followed by a character that is usually compared
to the current subject character; it is loaded into d. We still get
@@ -1148,7 +1372,7 @@ for (;;)
{
if (c == d) { ADD_NEW(state_offset + dlen + 1, 0); } else
{
- int othercase;
+ unsigned int othercase;
if (c < 128) othercase = fcc[c]; else
/* If we have Unicode property support, we can use it to test the
@@ -1157,7 +1381,7 @@ for (;;)
#ifdef SUPPORT_UCP
othercase = _pcre_ucp_othercase(c);
#else
- othercase = -1;
+ othercase = NOTACHAR;
#endif
if (d == othercase) { ADD_NEW(state_offset + dlen + 1, 0); }
@@ -1198,6 +1422,35 @@ for (;;)
#endif
/*-----------------------------------------------------------------*/
+ /* This is a tricky like EXTUNI because it too can match more than one
+ character (when CR is followed by LF). In this case, set up a negative
+ state to wait for one character to pass before continuing. */
+
+ case OP_ANYNL:
+ if (clen > 0) switch(c)
+ {
+ case 0x000a:
+ case 0x000b:
+ case 0x000c:
+ case 0x0085:
+ case 0x2028:
+ case 0x2029:
+ ADD_NEW(state_offset + 1, 0);
+ break;
+ case 0x000d:
+ if (ptr + 1 < end_subject && ptr[1] == 0x0a)
+ {
+ ADD_NEW_DATA(-(state_offset + 1), 0, 1);
+ }
+ else
+ {
+ ADD_NEW(state_offset + 1, 0);
+ }
+ break;
+ }
+ break;
+
+ /*-----------------------------------------------------------------*/
/* Match a negated single character. This is only used for one-byte
characters, that is, we know that d < 256. The character we are
checking (c) can be multibyte. */
@@ -1205,7 +1458,7 @@ for (;;)
case OP_NOT:
if (clen > 0)
{
- int otherd = ((ims & PCRE_CASELESS) != 0)? fcc[d] : d;
+ unsigned int otherd = ((ims & PCRE_CASELESS) != 0)? fcc[d] : d;
if (c != d && c != otherd) { ADD_NEW(state_offset + dlen + 1, 0); }
}
break;
@@ -1213,13 +1466,15 @@ for (;;)
/*-----------------------------------------------------------------*/
case OP_PLUS:
case OP_MINPLUS:
+ case OP_POSPLUS:
case OP_NOTPLUS:
case OP_NOTMINPLUS:
+ case OP_NOTPOSPLUS:
count = current_state->count; /* Already matched */
if (count > 0) { ADD_ACTIVE(state_offset + dlen + 1, 0); }
if (clen > 0)
{
- int otherd = -1;
+ unsigned int otherd = NOTACHAR;
if ((ims & PCRE_CASELESS) != 0)
{
#ifdef SUPPORT_UTF8
@@ -1234,19 +1489,30 @@ for (;;)
otherd = fcc[d];
}
if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
- { count++; ADD_NEW(state_offset, count); }
+ {
+ if (count > 0 &&
+ (codevalue == OP_POSPLUS || codevalue == OP_NOTPOSPLUS))
+ {
+ active_count--; /* Remove non-match possibility */
+ next_active_state--;
+ }
+ count++;
+ ADD_NEW(state_offset, count);
+ }
}
break;
/*-----------------------------------------------------------------*/
case OP_QUERY:
case OP_MINQUERY:
+ case OP_POSQUERY:
case OP_NOTQUERY:
case OP_NOTMINQUERY:
+ case OP_NOTPOSQUERY:
ADD_ACTIVE(state_offset + dlen + 1, 0);
if (clen > 0)
{
- int otherd = -1;
+ unsigned int otherd = NOTACHAR;
if ((ims & PCRE_CASELESS) != 0)
{
#ifdef SUPPORT_UTF8
@@ -1261,19 +1527,28 @@ for (;;)
otherd = fcc[d];
}
if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
- { ADD_NEW(state_offset + dlen + 1, 0); }
+ {
+ if (codevalue == OP_POSQUERY || codevalue == OP_NOTPOSQUERY)
+ {
+ active_count--; /* Remove non-match possibility */
+ next_active_state--;
+ }
+ ADD_NEW(state_offset + dlen + 1, 0);
+ }
}
break;
/*-----------------------------------------------------------------*/
case OP_STAR:
case OP_MINSTAR:
+ case OP_POSSTAR:
case OP_NOTSTAR:
case OP_NOTMINSTAR:
+ case OP_NOTPOSSTAR:
ADD_ACTIVE(state_offset + dlen + 1, 0);
if (clen > 0)
{
- int otherd = -1;
+ unsigned int otherd = NOTACHAR;
if ((ims & PCRE_CASELESS) != 0)
{
#ifdef SUPPORT_UTF8
@@ -1288,23 +1563,59 @@ for (;;)
otherd = fcc[d];
}
if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
- { ADD_NEW(state_offset, 0); }
+ {
+ if (codevalue == OP_POSSTAR || codevalue == OP_NOTPOSSTAR)
+ {
+ active_count--; /* Remove non-match possibility */
+ next_active_state--;
+ }
+ ADD_NEW(state_offset, 0);
+ }
}
break;
/*-----------------------------------------------------------------*/
case OP_EXACT:
+ case OP_NOTEXACT:
+ count = current_state->count; /* Number already matched */
+ if (clen > 0)
+ {
+ unsigned int otherd = NOTACHAR;
+ if ((ims & PCRE_CASELESS) != 0)
+ {
+#ifdef SUPPORT_UTF8
+ if (utf8 && d >= 128)
+ {
+#ifdef SUPPORT_UCP
+ otherd = _pcre_ucp_othercase(d);
+#endif /* SUPPORT_UCP */
+ }
+ else
+#endif /* SUPPORT_UTF8 */
+ otherd = fcc[d];
+ }
+ if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
+ {
+ if (++count >= GET2(code, 1))
+ { ADD_NEW(state_offset + dlen + 3, 0); }
+ else
+ { ADD_NEW(state_offset, count); }
+ }
+ }
+ break;
+
+ /*-----------------------------------------------------------------*/
case OP_UPTO:
case OP_MINUPTO:
- case OP_NOTEXACT:
+ case OP_POSUPTO:
case OP_NOTUPTO:
case OP_NOTMINUPTO:
- if (codevalue != OP_EXACT && codevalue != OP_NOTEXACT)
- { ADD_ACTIVE(state_offset + dlen + 3, 0); }
+ case OP_NOTPOSUPTO:
+ ADD_ACTIVE(state_offset + dlen + 3, 0);
count = current_state->count; /* Number already matched */
if (clen > 0)
{
- int otherd = -1;
+ unsigned int otherd = NOTACHAR;
if ((ims & PCRE_CASELESS) != 0)
{
#ifdef SUPPORT_UTF8
@@ -1320,6 +1631,11 @@ for (;;)
}
if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
{
+ if (codevalue == OP_POSUPTO || codevalue == OP_NOTPOSUPTO)
+ {
+ active_count--; /* Remove non-match possibility */
+ next_active_state--;
+ }
if (++count >= GET2(code, 1))
{ ADD_NEW(state_offset + dlen + 3, 0); }
else
@@ -1448,18 +1764,31 @@ for (;;)
/*-----------------------------------------------------------------*/
case OP_COND:
+ case OP_SCOND:
{
int local_offsets[1000];
int local_workspace[1000];
int condcode = code[LINK_SIZE+1];
- /* The only supported version of OP_CREF is for the value 0xffff, which
- means "test if in a recursion". */
+ /* Back reference conditions are not supported */
+
+ if (condcode == OP_CREF) return PCRE_ERROR_DFA_UCOND;
- if (condcode == OP_CREF)
+ /* The DEFINE condition is always false */
+
+ if (condcode == OP_DEF)
+ {
+ ADD_ACTIVE(state_offset + GET(code, 1) + LINK_SIZE + 1, 0);
+ }
+
+ /* The only supported version of OP_RREF is for the value RREF_ANY,
+ which means "test if in any recursion". We can't test for specifically
+ recursed groups. */
+
+ else if (condcode == OP_RREF)
{
int value = GET2(code, LINK_SIZE+2);
- if (value != 0xffff) return PCRE_ERROR_DFA_UCOND;
+ if (value != RREF_ANY) return PCRE_ERROR_DFA_UCOND;
if (recursing > 0) { ADD_ACTIVE(state_offset + LINK_SIZE + 4, 0); }
else { ADD_ACTIVE(state_offset + GET(code, 1) + LINK_SIZE + 1, 0); }
}
@@ -1837,26 +2166,36 @@ md->poptions = re->options;
/* Handle different types of newline. The two bits give four cases. If nothing
is set at run time, whatever was used at compile time applies. */
-switch ((((options & PCRE_NEWLINE_CRLF) == 0)? re->options : options) &
- PCRE_NEWLINE_CRLF)
+switch ((((options & PCRE_NEWLINE_BITS) == 0)? re->options : options) &
+ PCRE_NEWLINE_BITS)
{
- default: newline = NEWLINE; break; /* Compile-time default */
+ case 0: newline = NEWLINE; break; /* Compile-time default */
case PCRE_NEWLINE_CR: newline = '\r'; break;
case PCRE_NEWLINE_LF: newline = '\n'; break;
case PCRE_NEWLINE_CR+
PCRE_NEWLINE_LF: newline = ('\r' << 8) | '\n'; break;
+ case PCRE_NEWLINE_ANY: newline = -1; break;
+ default: return PCRE_ERROR_BADNEWLINE;
}
-if (newline > 255)
+if (newline < 0)
{
- md->nllen = 2;
- md->nl[0] = (newline >> 8) & 255;
- md->nl[1] = newline & 255;
+ md->nltype = NLTYPE_ANY;
}
else
{
- md->nllen = 1;
- md->nl[0] = newline;
+ md->nltype = NLTYPE_FIXED;
+ if (newline > 255)
+ {
+ md->nllen = 2;
+ md->nl[0] = (newline >> 8) & 255;
+ md->nl[1] = newline & 255;
+ }
+ else
+ {
+ md->nllen = 1;
+ md->nl[0] = newline;
+ }
}
/* Check a UTF-8 string if required. Unfortunately there's no way of passing
@@ -1946,7 +2285,7 @@ for (;;)
if (firstline)
{
const uschar *t = current_subject;
- while (t <= save_end_subject - md->nllen && !IS_NEWLINE(t)) t++;
+ while (t < md->end_subject && !IS_NEWLINE(t)) t++;
end_subject = t;
}
@@ -1965,11 +2304,9 @@ for (;;)
else if (startline)
{
- if (current_subject > md->start_subject + md->nllen +
- start_offset)
+ if (current_subject > md->start_subject + start_offset)
{
- while (current_subject <= end_subject &&
- !IS_NEWLINE(current_subject - md->nllen))
+ while (current_subject <= end_subject && !WAS_NEWLINE(current_subject))
current_subject++;
}
}
@@ -2070,9 +2407,7 @@ for (;;)
/* Advance to the next subject character unless we are at the end of a line
and firstline is set. */
- if (firstline &&
- current_subject <= end_subject - md->nllen &&
- IS_NEWLINE(current_subject)) break;
+ if (firstline && IS_NEWLINE(current_subject)) break;
current_subject++;
if (utf8)
{
@@ -2080,7 +2415,17 @@ for (;;)
current_subject++;
}
if (current_subject > end_subject) break;
- }
+
+ /* If we have just passed a CR and the newline option is CRLF or ANY, and we
+ are now at a LF, advance the match position by one more character. */
+
+ if (current_subject[-1] == '\r' &&
+ (md->nltype == NLTYPE_ANY || md->nllen == 2) &&
+ current_subject < end_subject &&
+ *current_subject == '\n')
+ current_subject++;
+
+ } /* "Bumpalong" loop */
return PCRE_ERROR_NOMATCH;
}
diff --git a/pcre_exec.c b/pcre_exec.c
index 882a1d1..890e0f7 100644
--- a/pcre_exec.c
+++ b/pcre_exec.c
@@ -42,25 +42,22 @@ POSSIBILITY OF SUCH DAMAGE.
pattern matching using an NFA algorithm, trying to mimic Perl as closely as
possible. There are also some static supporting functions. */
-#define NLBLOCK md /* The block containing newline information */
-#include "pcre_internal.h"
+#define NLBLOCK md /* Block containing newline information */
+#define PSSTART start_subject /* Field containing processed string start */
+#define PSEND end_subject /* Field containing processed string end */
+#include "pcre_internal.h"
-/* Structure for building a chain of data that actually lives on the
-stack, for holding the values of the subject pointer at the start of each
-subpattern, so as to detect when an empty string has been matched by a
-subpattern - to break infinite loops. When NO_RECURSE is set, these blocks
-are on the heap, not on the stack. */
+/* The chain of eptrblocks for tail recursions uses memory in stack workspace,
+obtained at top level, the size of which is defined by EPTR_WORK_SIZE. */
-typedef struct eptrblock {
- struct eptrblock *epb_prev;
- USPTR epb_saved_eptr;
-} eptrblock;
+#define EPTR_WORK_SIZE (1000)
/* Flag bits for the match() function */
-#define match_condassert 0x01 /* Called to check a condition assertion */
-#define match_isgroup 0x02 /* Set if start of bracketed group */
+#define match_condassert 0x01 /* Called to check a condition assertion */
+#define match_cbegroup 0x02 /* Could-be-empty unlimited repeat group */
+#define match_tail_recursed 0x04 /* Tail recursive call */
/* Non-error returns from the match() function. Error returns are externally
defined PCRE_ERROR_xxx codes, which are all negative. */
@@ -101,7 +98,7 @@ Returns: nothing
static void
pchars(const uschar *p, int length, BOOL is_subject, match_data *md)
{
-int c;
+unsigned int c;
if (is_subject && length > md->end_subject - p) length = md->end_subject - p;
while (length-- > 0)
if (isprint(c = *(p++))) printf("%c", c); else printf("\\x%02x", c);
@@ -291,7 +288,6 @@ typedef struct heapframe {
BOOL Xcur_is_word;
BOOL Xcondition;
- BOOL Xminimize;
BOOL Xprev_is_word;
unsigned long int Xoriginal_ims;
@@ -303,11 +299,10 @@ typedef struct heapframe {
int Xprop_category;
int Xprop_chartype;
int Xprop_script;
- int *Xprop_test_variable;
#endif
int Xctype;
- int Xfc;
+ unsigned int Xfc;
int Xfi;
int Xlength;
int Xmax;
@@ -340,10 +335,7 @@ typedef struct heapframe {
* Match from current position *
*************************************************/
-/* On entry ecode points to the first opcode, and eptr to the first character
-in the subject string, while eptrb holds the value of eptr at the start of the
-last bracketed group - used for breaking infinite loops matching zero-length
-strings. This function is called recursively in many circumstances. Whenever it
+/* This function is called recursively in many circumstances. Whenever it
returns a negative (error) response, the outer incarnation must also return the
same response.
@@ -353,8 +345,8 @@ performance. Tests using gcc on a SPARC disproved this; in the first case, it
made performance worse.
Arguments:
- eptr pointer in subject
- ecode position in code
+ eptr pointer to current character in subject
+ ecode pointer to current position in compiled code
offset_top current top pointer
md pointer to "static" info for the match
ims current /i, /m, and /s options
@@ -362,7 +354,9 @@ Arguments:
brackets - for testing for empty matches
flags can contain
match_condassert - this is an assertion condition
- match_isgroup - this is the start of a bracketed group
+ match_cbegroup - this is the start of an unlimited repeat
+ group that can match an empty string
+ match_tail_recursed - this is a tail_recursed group
rdepth the recursion depth
Returns: MATCH_MATCH if matched ) these values are >= 0
@@ -377,14 +371,16 @@ match(REGISTER USPTR eptr, REGISTER const uschar *ecode,
int flags, unsigned int rdepth)
{
/* These variables do not need to be preserved over recursion in this function,
-so they can be ordinary variables in all cases. Mark them with "register"
-because they are used a lot in loops. */
+so they can be ordinary variables in all cases. Mark some of them with
+"register" because they are used a lot in loops. */
register int rrc; /* Returns from recursive calls */
register int i; /* Used for loops not involving calls to RMATCH() */
-register unsigned int c; /* Character values not kept over RMATCH() calls */
+register unsigned int c; /* Character values not kept over RMATCH() calls */
register BOOL utf8; /* Local copy of UTF-8 flag for speed */
+BOOL minimize, possessive; /* Quantifier options */
+
/* When recursion is not being used, all "local" variables that have to be
preserved over calls to RMATCH() are part of a "frame" which is obtained from
heap storage. Set up the top-level frame here; others are obtained from the
@@ -434,7 +430,6 @@ HEAP_RECURSE:
#define cur_is_word frame->Xcur_is_word
#define condition frame->Xcondition
-#define minimize frame->Xminimize
#define prev_is_word frame->Xprev_is_word
#define original_ims frame->Xoriginal_ims
@@ -446,7 +441,6 @@ HEAP_RECURSE:
#define prop_category frame->Xprop_category
#define prop_chartype frame->Xprop_chartype
#define prop_script frame->Xprop_script
-#define prop_test_variable frame->Xprop_test_variable
#endif
#define ctype frame->Xctype
@@ -470,7 +464,7 @@ HEAP_RECURSE:
get preserved during recursion in the normal way. In this environment, fi and
i, and fc and c, can be the same variables. */
-#else
+#else /* NO_RECURSE not defined */
#define fi i
#define fc c
@@ -489,7 +483,6 @@ recursion_info new_recursive; /* within blocks below are for variables */
/* that do not have to be preserved over */
BOOL cur_is_word; /* a recursive call to RMATCH(). */
BOOL condition;
-BOOL minimize;
BOOL prev_is_word;
unsigned long int original_ims;
@@ -501,7 +494,6 @@ int prop_fail_result;
int prop_category;
int prop_chartype;
int prop_script;
-int *prop_test_variable;
#endif
int ctype;
@@ -516,7 +508,7 @@ int save_offset1, save_offset2, save_offset3;
int stacksave[REC_STACK_SAVE_MAX];
eptrblock newptrb;
-#endif
+#endif /* NO_RECURSE */
/* These statements are here to stop the compiler complaining about unitialized
variables. */
@@ -524,9 +516,9 @@ variables. */
#ifdef SUPPORT_UCP
prop_value = 0;
prop_fail_result = 0;
-prop_test_variable = NULL;
#endif
+
/* This label is used for tail recursion, which is used in a few cases even
when NO_RECURSE is not defined, in order to reduce the amount of stack that is
used. Thanks to Ian Taylor for noticing this possibility and sending the
@@ -556,24 +548,34 @@ utf8 = md->utf8; /* Local copy of the flag */
utf8 = FALSE;
#endif
-/* At the start of a bracketed group, add the current subject pointer to the
-stack of such pointers, to be re-instated at the end of the group when we hit
-the closing ket. When match() is called in other circumstances, we don't add to
-this stack. */
+/* At the start of a group with an unlimited repeat that may match an empty
+string, the match_cbegroup flag is set. When this is the case, add the current
+subject pointer to the chain of such remembered pointers, to be checked when we
+hit the closing ket, in order to break infinite loops that match no characters.
+When match() is called in other circumstances, don't add to the chain. If this
+is a tail recursion, use a block from the workspace, as the one on the stack is
+already used. */
-if ((flags & match_isgroup) != 0)
+if ((flags & match_cbegroup) != 0)
{
- newptrb.epb_prev = eptrb;
- newptrb.epb_saved_eptr = eptr;
- eptrb = &newptrb;
+ eptrblock *p;
+ if ((flags & match_tail_recursed) != 0)
+ {
+ if (md->eptrn >= EPTR_WORK_SIZE) RRETURN(PCRE_ERROR_NULLWSLIMIT);
+ p = md->eptrchain + md->eptrn++;
+ }
+ else p = &newptrb;
+ p->epb_saved_eptr = eptr;
+ p->epb_prev = eptrb;
+ eptrb = p;
}
-/* Now start processing the operations. */
+/* Now start processing the opcodes. */
for (;;)
{
+ minimize = possessive = FALSE;
op = *ecode;
- minimize = FALSE;
/* For partial matching, remember if we ever hit the end of the subject after
matching at least one subject character. */
@@ -583,33 +585,30 @@ for (;;)
eptr > md->start_match)
md->hitend = TRUE;
- /* Opening capturing bracket. If there is space in the offset vector, save
- the current subject position in the working slot at the top of the vector. We
- mustn't change the current values of the data slot, because they may be set
- from a previous iteration of this group, and be referred to by a reference
- inside the group.
-
- If the bracket fails to match, we need to restore this value and also the
- values of the final offsets, in case they were set by a previous iteration of
- the same bracket.
-
- If there isn't enough space in the offset vector, treat this as if it were a
- non-capturing bracket. Don't worry about setting the flag for the error case
- here; that is handled in the code for KET. */
-
- if (op > OP_BRA)
+ switch(op)
{
- number = op - OP_BRA;
-
- /* For extended extraction brackets (large number), we have to fish out the
- number from a dummy opcode at the start. */
-
- if (number > EXTRACT_BASIC_MAX)
- number = GET2(ecode, 2+LINK_SIZE);
+ /* Handle a capturing bracket. If there is space in the offset vector, save
+ the current subject position in the working slot at the top of the vector.
+ We mustn't change the current values of the data slot, because they may be
+ set from a previous iteration of this group, and be referred to by a
+ reference inside the group.
+
+ If the bracket fails to match, we need to restore this value and also the
+ values of the final offsets, in case they were set by a previous iteration
+ of the same bracket.
+
+ If there isn't enough space in the offset vector, treat this as if it were
+ a non-capturing bracket. Don't worry about setting the flag for the error
+ case here; that is handled in the code for KET. */
+
+ case OP_CBRA:
+ case OP_SCBRA:
+ number = GET2(ecode, 1+LINK_SIZE);
offset = number << 1;
#ifdef DEBUG
- printf("start bracket %d subject=", number);
+ printf("start bracket %d\n", number);
+ printf("subject=");
pchars(eptr, 16, TRUE, md);
printf("\n");
#endif
@@ -624,10 +623,11 @@ for (;;)
DPRINTF(("saving %d %d %d\n", save_offset1, save_offset2, save_offset3));
md->offset_vector[md->offset_end - number] = eptr - md->start_subject;
+ flags = (op == OP_SCBRA)? match_cbegroup : 0;
do
{
- RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb,
- match_isgroup);
+ RMATCH(rrc, eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
+ ims, eptrb, flags);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
md->capture_last = save_capture_last;
ecode += GET(ecode, 1);
@@ -643,39 +643,35 @@ for (;;)
RRETURN(MATCH_NOMATCH);
}
- /* Insufficient room for saving captured contents */
+ /* Insufficient room for saving captured contents. Treat as a non-capturing
+ bracket. */
- else op = OP_BRA;
- }
+ DPRINTF(("insufficient capture room: treat as non-capturing\n"));
- /* Other types of node can be handled by a switch */
-
- switch(op)
- {
- case OP_BRA: /* Non-capturing bracket: optimized */
- DPRINTF(("start bracket 0\n"));
-
- /* Loop for all the alternatives */
+ /* Non-capturing bracket. Loop for all the alternatives. When we get to the
+ final alternative within the brackets, we would return the result of a
+ recursive call to match() whatever happened. We can reduce stack usage by
+ turning this into a tail recursion. */
+ case OP_BRA:
+ case OP_SBRA:
+ DPRINTF(("start non-capturing bracket\n"));
+ flags = (op >= OP_SBRA)? match_cbegroup : 0;
for (;;)
{
- /* When we get to the final alternative within the brackets, we would
- return the result of a recursive call to match() whatever happened. We
- can reduce stack usage by turning this into a tail recursion. */
-
if (ecode[GET(ecode, 1)] != OP_ALT)
- {
- ecode += 1 + LINK_SIZE;
- flags = match_isgroup;
- DPRINTF(("bracket 0 tail recursion\n"));
- goto TAIL_RECURSE;
- }
+ {
+ ecode += _pcre_OP_lengths[*ecode];
+ flags |= match_tail_recursed;
+ DPRINTF(("bracket 0 tail recursion\n"));
+ goto TAIL_RECURSE;
+ }
/* For non-final alternatives, continue the loop for a NOMATCH result;
otherwise return. */
- RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb,
- match_isgroup);
+ RMATCH(rrc, eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims,
+ eptrb, flags);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
ecode += GET(ecode, 1);
}
@@ -688,54 +684,72 @@ for (;;)
obeyed, we can use tail recursion to avoid using another stack frame. */
case OP_COND:
- if (ecode[LINK_SIZE+1] == OP_CREF) /* Condition extract or recurse test */
+ case OP_SCOND:
+ if (ecode[LINK_SIZE+1] == OP_RREF) /* Recursion test */
+ {
+ offset = GET2(ecode, LINK_SIZE + 2); /* Recursion group number*/
+ condition = md->recursive != NULL &&
+ (offset == RREF_ANY || offset == md->recursive->group_num);
+ ecode += condition? 3 : GET(ecode, 1);
+ }
+
+ else if (ecode[LINK_SIZE+1] == OP_CREF) /* Group used test */
{
offset = GET2(ecode, LINK_SIZE+2) << 1; /* Doubled ref number */
- condition = (offset == CREF_RECURSE * 2)?
- (md->recursive != NULL) :
- (offset < offset_top && md->offset_vector[offset] >= 0);
- ecode += condition? (LINK_SIZE + 4) : (LINK_SIZE + 1 + GET(ecode, 1));
- flags = match_isgroup;
- goto TAIL_RECURSE;
+ condition = offset < offset_top && md->offset_vector[offset] >= 0;
+ ecode += condition? 3 : GET(ecode, 1);
+ }
+
+ else if (ecode[LINK_SIZE+1] == OP_DEF) /* DEFINE - always false */
+ {
+ condition = FALSE;
+ ecode += GET(ecode, 1);
}
/* The condition is an assertion. Call match() to evaluate it - setting
- the final argument TRUE causes it to stop at the end of an assertion. */
+ the final argument match_condassert causes it to stop at the end of an
+ assertion. */
else
{
RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL,
- match_condassert | match_isgroup);
+ match_condassert);
if (rrc == MATCH_MATCH)
{
- ecode += 1 + LINK_SIZE + GET(ecode, LINK_SIZE+2);
+ condition = TRUE;
+ ecode += 1 + LINK_SIZE + GET(ecode, LINK_SIZE + 2);
while (*ecode == OP_ALT) ecode += GET(ecode, 1);
}
else if (rrc != MATCH_NOMATCH)
{
RRETURN(rrc); /* Need braces because of following else */
}
- else ecode += GET(ecode, 1);
+ else
+ {
+ condition = FALSE;
+ ecode += GET(ecode, 1);
+ }
+ }
- /* We are now at the branch that is to be obeyed. As there is only one,
- we can use tail recursion to avoid using another stack frame. */
+ /* We are now at the branch that is to be obeyed. As there is only one,
+ we can use tail recursion to avoid using another stack frame. If the second
+ alternative doesn't exist, we can just plough on. */
+ if (condition || *ecode == OP_ALT)
+ {
ecode += 1 + LINK_SIZE;
- flags = match_isgroup;
+ flags = match_tail_recursed | ((op == OP_SCOND)? match_cbegroup : 0);
goto TAIL_RECURSE;
}
- /* Control never reaches here */
-
- /* Skip over conditional reference or large extraction number data if
- encountered. */
-
- case OP_CREF:
- case OP_BRANUMBER:
- ecode += 3;
+ else
+ {
+ ecode += 1 + LINK_SIZE;
+ }
break;
- /* End of the pattern. If we are in a recursion, we should restore the
- offsets appropriately and continue from after the call. */
+
+ /* End of the pattern. If we are in a top-level recursion, we should
+ restore the offsets appropriately and continue from after the call. */
case OP_END:
if (md->recursive != NULL && md->recursive->group_num == 0)
@@ -777,8 +791,7 @@ for (;;)
case OP_ASSERTBACK:
do
{
- RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL,
- match_isgroup);
+ RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0);
if (rrc == MATCH_MATCH) break;
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
ecode += GET(ecode, 1);
@@ -804,8 +817,7 @@ for (;;)
case OP_ASSERTBACK_NOT:
do
{
- RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL,
- match_isgroup);
+ RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0);
if (rrc == MATCH_MATCH) RRETURN(MATCH_NOMATCH);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
ecode += GET(ecode,1);
@@ -826,8 +838,8 @@ for (;;)
#ifdef SUPPORT_UTF8
if (utf8)
{
- c = GET(ecode,1);
- for (i = 0; i < c; i++)
+ i = GET(ecode, 1);
+ while (i-- > 0)
{
eptr--;
if (eptr < md->start_subject) RRETURN(MATCH_NOMATCH);
@@ -840,7 +852,7 @@ for (;;)
/* No UTF-8 support, or not in UTF-8 mode: count is byte count */
{
- eptr -= GET(ecode,1);
+ eptr -= GET(ecode, 1);
if (eptr < md->start_subject) RRETURN(MATCH_NOMATCH);
}
@@ -897,13 +909,8 @@ for (;;)
case OP_RECURSE:
{
callpat = md->start_code + GET(ecode, 1);
- new_recursive.group_num = *callpat - OP_BRA;
-
- /* For extended extraction brackets (large number), we have to fish out
- the number from a dummy opcode at the start. */
-
- if (new_recursive.group_num > EXTRACT_BASIC_MAX)
- new_recursive.group_num = GET2(callpat, 2+LINK_SIZE);
+ new_recursive.group_num = (callpat == md->start_code)? 0 :
+ GET2(callpat, 1 + LINK_SIZE);
/* Add to "recursing stack" */
@@ -936,10 +943,11 @@ for (;;)
restore the offset and recursion data. */
DPRINTF(("Recursing into group %d\n", new_recursive.group_num));
+ flags = (*callpat >= OP_SBRA)? match_cbegroup : 0;
do
{
- RMATCH(rrc, eptr, callpat + 1 + LINK_SIZE, offset_top, md, ims,
- eptrb, match_isgroup);
+ RMATCH(rrc, eptr, callpat + _pcre_OP_lengths[*callpat], offset_top,
+ md, ims, eptrb, flags);
if (rrc == MATCH_MATCH)
{
DPRINTF(("Recursion matched\n"));
@@ -983,7 +991,7 @@ for (;;)
do
{
RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims,
- eptrb, match_isgroup);
+ eptrb, 0);
if (rrc == MATCH_MATCH) break;
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
ecode += GET(ecode,1);
@@ -997,7 +1005,7 @@ for (;;)
/* Continue as from after the assertion, updating the offsets high water
mark, since extracts may have been taken. */
- do ecode += GET(ecode,1); while (*ecode == OP_ALT);
+ do ecode += GET(ecode, 1); while (*ecode == OP_ALT);
offset_top = md->end_offset_top;
eptr = md->end_match_ptr;
@@ -1031,15 +1039,15 @@ for (;;)
RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
ecode = prev;
- flags = match_isgroup;
+ flags = match_tail_recursed;
goto TAIL_RECURSE;
}
else /* OP_KETRMAX */
{
- RMATCH(rrc, eptr, prev, offset_top, md, ims, eptrb, match_isgroup);
+ RMATCH(rrc, eptr, prev, offset_top, md, ims, eptrb, match_cbegroup);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
ecode += 1 + LINK_SIZE;
- flags = 0;
+ flags = match_tail_recursed;
goto TAIL_RECURSE;
}
/* Control never gets here */
@@ -1060,38 +1068,44 @@ for (;;)
case OP_BRAZERO:
{
next = ecode+1;
- RMATCH(rrc, eptr, next, offset_top, md, ims, eptrb, match_isgroup);
+ RMATCH(rrc, eptr, next, offset_top, md, ims, eptrb, 0);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
do next += GET(next,1); while (*next == OP_ALT);
- ecode = next + 1+LINK_SIZE;
+ ecode = next + 1 + LINK_SIZE;
}
break;
case OP_BRAMINZERO:
{
next = ecode+1;
- do next += GET(next,1); while (*next == OP_ALT);
- RMATCH(rrc, eptr, next + 1+LINK_SIZE, offset_top, md, ims, eptrb,
- match_isgroup);
+ do next += GET(next, 1); while (*next == OP_ALT);
+ RMATCH(rrc, eptr, next + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
ecode++;
}
break;
- /* End of a group, repeated or non-repeating. If we are at the end of
- an assertion "group", stop matching and return MATCH_MATCH, but record the
- current high water mark for use by positive assertions. Do this also
- for the "once" (not-backup up) groups. */
+ /* End of a group, repeated or non-repeating. */
case OP_KET:
case OP_KETRMIN:
case OP_KETRMAX:
prev = ecode - GET(ecode, 1);
- saved_eptr = eptrb->epb_saved_eptr;
- /* Back up the stack of bracket start pointers. */
+ /* If this was a group that remembered the subject start, in order to break
+ infinite repeats of empty string matches, retrieve the subject start from
+ the chain. Otherwise, set it NULL. */
+
+ if (*prev >= OP_SBRA)
+ {
+ saved_eptr = eptrb->epb_saved_eptr; /* Value at start of group */
+ eptrb = eptrb->epb_prev; /* Backup to previous group */
+ }
+ else saved_eptr = NULL;
- eptrb = eptrb->epb_prev;
+ /* If we are at the end of an assertion group, stop matching and return
+ MATCH_MATCH, but record the current high water mark for use by positive
+ assertions. Do this also for the "once" (atomic) groups. */
if (*prev == OP_ASSERT || *prev == OP_ASSERT_NOT ||
*prev == OP_ASSERTBACK || *prev == OP_ASSERTBACK_NOT ||
@@ -1102,18 +1116,15 @@ for (;;)
RRETURN(MATCH_MATCH);
}
- /* In all other cases except a conditional group we have to check the
- group number back at the start and if necessary complete handling an
- extraction by setting the offsets and bumping the high water mark. */
+ /* For capturing groups we have to check the group number back at the start
+ and if necessary complete handling an extraction by setting the offsets and
+ bumping the high water mark. Note that whole-pattern recursion is coded as
+ a recurse into group 0, so it won't be picked up here. Instead, we catch it
+ when the OP_END is reached. Other recursion is handled here. */
- if (*prev != OP_COND)
+ if (*prev == OP_CBRA || *prev == OP_SCBRA)
{
- number = *prev - OP_BRA;
-
- /* For extended extraction brackets (large number), we have to fish out
- the number from a dummy opcode at the start. */
-
- if (number > EXTRACT_BASIC_MAX) number = GET2(prev, 2+LINK_SIZE);
+ number = GET2(prev, 1+LINK_SIZE);
offset = number << 1;
#ifdef DEBUG
@@ -1121,42 +1132,34 @@ for (;;)
printf("\n");
#endif
- /* Test for a numbered group. This includes groups called as a result
- of recursion. Note that whole-pattern recursion is coded as a recurse
- into group 0, so it won't be picked up here. Instead, we catch it when
- the OP_END is reached. */
-
- if (number > 0)
+ md->capture_last = number;
+ if (offset >= md->offset_max) md->offset_overflow = TRUE; else
{
- md->capture_last = number;
- if (offset >= md->offset_max) md->offset_overflow = TRUE; else
- {
- md->offset_vector[offset] =
- md->offset_vector[md->offset_end - number];
- md->offset_vector[offset+1] = eptr - md->start_subject;
- if (offset_top <= offset) offset_top = offset + 2;
- }
+ md->offset_vector[offset] =
+ md->offset_vector[md->offset_end - number];
+ md->offset_vector[offset+1] = eptr - md->start_subject;
+ if (offset_top <= offset) offset_top = offset + 2;
+ }
- /* Handle a recursively called group. Restore the offsets
- appropriately and continue from after the call. */
+ /* Handle a recursively called group. Restore the offsets
+ appropriately and continue from after the call. */
- if (md->recursive != NULL && md->recursive->group_num == number)
- {
- recursion_info *rec = md->recursive;
- DPRINTF(("Recursion (%d) succeeded - continuing\n", number));
- md->recursive = rec->prevrec;
- md->start_match = rec->save_start;
- memcpy(md->offset_vector, rec->offset_save,
- rec->saved_max * sizeof(int));
- ecode = rec->after_call;
- ims = original_ims;
- break;
- }
+ if (md->recursive != NULL && md->recursive->group_num == number)
+ {
+ recursion_info *rec = md->recursive;
+ DPRINTF(("Recursion (%d) succeeded - continuing\n", number));
+ md->recursive = rec->prevrec;
+ md->start_match = rec->save_start;
+ memcpy(md->offset_vector, rec->offset_save,
+ rec->saved_max * sizeof(int));
+ ecode = rec->after_call;
+ ims = original_ims;
+ break;
}
}
- /* Reset the value of the ims flags, in case they got changed during
- the group. */
+ /* For both capturing and non-capturing groups, reset the value of the ims
+ flags, in case they got changed during the group. */
ims = original_ims;
DPRINTF(("ims reset to %02lx\n", ims));
@@ -1177,20 +1180,22 @@ for (;;)
preceding bracket, in the appropriate order. In the second case, we can use
tail recursion to avoid using another stack frame. */
+ flags = (*prev >= OP_SBRA)? match_cbegroup : 0;
+
if (*ecode == OP_KETRMIN)
{
RMATCH(rrc, eptr, ecode + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
ecode = prev;
- flags = match_isgroup;
+ flags |= match_tail_recursed;
goto TAIL_RECURSE;
}
else /* OP_KETRMAX */
{
- RMATCH(rrc, eptr, prev, offset_top, md, ims, eptrb, match_isgroup);
+ RMATCH(rrc, eptr, prev, offset_top, md, ims, eptrb, flags);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
ecode += 1 + LINK_SIZE;
- flags = 0;
+ flags = match_tail_recursed;
goto TAIL_RECURSE;
}
/* Control never gets here */
@@ -1202,9 +1207,7 @@ for (;;)
if ((ims & PCRE_MULTILINE) != 0)
{
if (eptr != md->start_subject &&
- (eptr == md->end_subject ||
- eptr < md->start_subject + md->nllen ||
- !IS_NEWLINE(eptr - md->nllen)))
+ (eptr == md->end_subject || !WAS_NEWLINE(eptr)))
RRETURN(MATCH_NOMATCH);
ecode++;
break;
@@ -1244,7 +1247,7 @@ for (;;)
if (!md->endonly)
{
if (eptr != md->end_subject &&
- (eptr != md->end_subject - md->nllen || !IS_NEWLINE(eptr)))
+ (!IS_NEWLINE(eptr) || eptr != md->end_subject - md->nllen))
RRETURN(MATCH_NOMATCH);
ecode++;
break;
@@ -1263,7 +1266,7 @@ for (;;)
case OP_EODN:
if (eptr != md->end_subject &&
- (eptr != md->end_subject - md->nllen || !IS_NEWLINE(eptr)))
+ (!IS_NEWLINE(eptr) || eptr != md->end_subject - md->nllen))
RRETURN(MATCH_NOMATCH);
ecode++;
break;
@@ -1319,8 +1322,7 @@ for (;;)
case OP_ANY:
if ((ims & PCRE_DOTALL) == 0)
{
- if (eptr <= md->end_subject - md->nllen && IS_NEWLINE(eptr))
- RRETURN(MATCH_NOMATCH);
+ if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH);
}
if (eptr++ >= md->end_subject) RRETURN(MATCH_NOMATCH);
if (utf8)
@@ -1414,6 +1416,26 @@ for (;;)
ecode++;
break;
+ case OP_ANYNL:
+ if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+ GETCHARINCTEST(c, eptr);
+ switch(c)
+ {
+ default: RRETURN(MATCH_NOMATCH);
+ case 0x000d:
+ if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
+ break;
+ case 0x000a:
+ case 0x000b:
+ case 0x000c:
+ case 0x0085:
+ case 0x2028:
+ case 0x2029:
+ break;
+ }
+ ecode++;
+ break;
+
#ifdef SUPPORT_UCP
/* Check the next character by Unicode property. We will get here only
if the support is in the binary; otherwise a compile-time error occurs. */
@@ -1456,7 +1478,6 @@ for (;;)
default:
RRETURN(PCRE_ERROR_INTERNAL);
- break;
}
ecode += 3;
@@ -1926,7 +1947,7 @@ for (;;)
else
{
- int dc;
+ unsigned int dc;
GETCHARINC(dc, eptr);
ecode += length;
@@ -1953,13 +1974,17 @@ for (;;)
}
break;
- /* Match a single character repeatedly; different opcodes share code. */
+ /* Match a single character repeatedly. */
case OP_EXACT:
min = max = GET2(ecode, 1);
ecode += 3;
goto REPEATCHAR;
+ case OP_POSUPTO:
+ possessive = TRUE;
+ /* Fall through */
+
case OP_UPTO:
case OP_MINUPTO:
min = 0;
@@ -1968,6 +1993,27 @@ for (;;)
ecode += 3;
goto REPEATCHAR;
+ case OP_POSSTAR:
+ possessive = TRUE;
+ min = 0;
+ max = INT_MAX;
+ ecode++;
+ goto REPEATCHAR;
+
+ case OP_POSPLUS:
+ possessive = TRUE;
+ min = 1;
+ max = INT_MAX;
+ ecode++;
+ goto REPEATCHAR;
+
+ case OP_POSQUERY:
+ possessive = TRUE;
+ min = 0;
+ max = 1;
+ ecode++;
+ goto REPEATCHAR;
+
case OP_STAR:
case OP_MINSTAR:
case OP_PLUS:
@@ -2003,10 +2049,9 @@ for (;;)
uschar occhars[8];
#ifdef SUPPORT_UCP
- int othercase;
+ unsigned int othercase;
if ((ims & PCRE_CASELESS) != 0 &&
- (othercase = _pcre_ucp_othercase(fc)) >= 0 &&
- othercase >= 0)
+ (othercase = _pcre_ucp_othercase(fc)) != NOTACHAR)
oclength = _pcre_ord2utf8(othercase, occhars);
#endif /* SUPPORT_UCP */
@@ -2042,7 +2087,8 @@ for (;;)
}
/* Control never gets here */
}
- else
+
+ else /* Maximize */
{
pp = eptr;
for (i = min; i < max; i++)
@@ -2056,6 +2102,8 @@ for (;;)
eptr += oclength;
}
}
+
+ if (possessive) continue;
while (eptr >= pp)
{
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
@@ -2110,7 +2158,7 @@ for (;;)
}
/* Control never gets here */
}
- else
+ else /* Maximize */
{
pp = eptr;
for (i = min; i < max; i++)
@@ -2118,6 +2166,7 @@ for (;;)
if (eptr >= md->end_subject || fc != md->lcc[*eptr]) break;
eptr++;
}
+ if (possessive) continue;
while (eptr >= pp)
{
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
@@ -2146,7 +2195,7 @@ for (;;)
}
/* Control never gets here */
}
- else
+ else /* Maximize */
{
pp = eptr;
for (i = min; i < max; i++)
@@ -2154,6 +2203,7 @@ for (;;)
if (eptr >= md->end_subject || fc != *eptr) break;
eptr++;
}
+ if (possessive) continue;
while (eptr >= pp)
{
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
@@ -2206,6 +2256,34 @@ for (;;)
ecode += 3;
goto REPEATNOTCHAR;
+ case OP_NOTPOSSTAR:
+ possessive = TRUE;
+ min = 0;
+ max = INT_MAX;
+ ecode++;
+ goto REPEATNOTCHAR;
+
+ case OP_NOTPOSPLUS:
+ possessive = TRUE;
+ min = 1;
+ max = INT_MAX;
+ ecode++;
+ goto REPEATNOTCHAR;
+
+ case OP_NOTPOSQUERY:
+ possessive = TRUE;
+ min = 0;
+ max = 1;
+ ecode++;
+ goto REPEATNOTCHAR;
+
+ case OP_NOTPOSUPTO:
+ possessive = TRUE;
+ min = 0;
+ max = GET2(ecode, 1);
+ ecode += 3;
+ goto REPEATNOTCHAR;
+
case OP_NOTSTAR:
case OP_NOTMINSTAR:
case OP_NOTPLUS:
@@ -2245,7 +2323,7 @@ for (;;)
/* UTF-8 mode */
if (utf8)
{
- register int d;
+ register unsigned int d;
for (i = 1; i <= min; i++)
{
GETCHARINC(d, eptr);
@@ -2270,7 +2348,7 @@ for (;;)
/* UTF-8 mode */
if (utf8)
{
- register int d;
+ register unsigned int d;
for (fi = min;; fi++)
{
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
@@ -2306,7 +2384,7 @@ for (;;)
/* UTF-8 mode */
if (utf8)
{
- register int d;
+ register unsigned int d;
for (i = min; i < max; i++)
{
int len = 1;
@@ -2316,7 +2394,8 @@ for (;;)
if (fc == d) break;
eptr += len;
}
- for(;;)
+ if (possessive) continue;
+ for(;;)
{
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
@@ -2333,6 +2412,7 @@ for (;;)
if (eptr >= md->end_subject || fc == md->lcc[*eptr]) break;
eptr++;
}
+ if (possessive) continue;
while (eptr >= pp)
{
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
@@ -2354,7 +2434,7 @@ for (;;)
/* UTF-8 mode */
if (utf8)
{
- register int d;
+ register unsigned int d;
for (i = 1; i <= min; i++)
{
GETCHARINC(d, eptr);
@@ -2377,7 +2457,7 @@ for (;;)
/* UTF-8 mode */
if (utf8)
{
- register int d;
+ register unsigned int d;
for (fi = min;; fi++)
{
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
@@ -2412,7 +2492,7 @@ for (;;)
/* UTF-8 mode */
if (utf8)
{
- register int d;
+ register unsigned int d;
for (i = min; i < max; i++)
{
int len = 1;
@@ -2421,6 +2501,7 @@ for (;;)
if (fc == d) break;
eptr += len;
}
+ if (possessive) continue;
for(;;)
{
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
@@ -2438,6 +2519,7 @@ for (;;)
if (eptr >= md->end_subject || fc == *eptr) break;
eptr++;
}
+ if (possessive) continue;
while (eptr >= pp)
{
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
@@ -2469,6 +2551,34 @@ for (;;)
ecode += 3;
goto REPEATTYPE;
+ case OP_TYPEPOSSTAR:
+ possessive = TRUE;
+ min = 0;
+ max = INT_MAX;
+ ecode++;
+ goto REPEATTYPE;
+
+ case OP_TYPEPOSPLUS:
+ possessive = TRUE;
+ min = 1;
+ max = INT_MAX;
+ ecode++;
+ goto REPEATTYPE;
+
+ case OP_TYPEPOSQUERY:
+ possessive = TRUE;
+ min = 0;
+ max = 1;
+ ecode++;
+ goto REPEATTYPE;
+
+ case OP_TYPEPOSUPTO:
+ possessive = TRUE;
+ min = 0;
+ max = GET2(ecode, 1);
+ ecode += 3;
+ goto REPEATTYPE;
+
case OP_TYPESTAR:
case OP_TYPEMINSTAR:
case OP_TYPEPLUS:
@@ -2571,7 +2681,6 @@ for (;;)
default:
RRETURN(PCRE_ERROR_INTERNAL);
- break;
}
}
@@ -2611,9 +2720,7 @@ for (;;)
for (i = 1; i <= min; i++)
{
if (eptr >= md->end_subject ||
- ((ims & PCRE_DOTALL) == 0 &&
- eptr <= md->end_subject - md->nllen &&
- IS_NEWLINE(eptr)))
+ ((ims & PCRE_DOTALL) == 0 && IS_NEWLINE(eptr)))
RRETURN(MATCH_NOMATCH);
eptr++;
while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
@@ -2624,6 +2731,28 @@ for (;;)
eptr += min;
break;
+ case OP_ANYNL:
+ for (i = 1; i <= min; i++)
+ {
+ if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+ GETCHARINC(c, eptr);
+ switch(c)
+ {
+ default: RRETURN(MATCH_NOMATCH);
+ case 0x000d:
+ if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
+ break;
+ case 0x000a:
+ case 0x000b:
+ case 0x000c:
+ case 0x0085:
+ case 0x2028:
+ case 0x2029:
+ break;
+ }
+ }
+ break;
+
case OP_NOT_DIGIT:
for (i = 1; i <= min; i++)
{
@@ -2692,7 +2821,8 @@ for (;;)
#endif /* SUPPORT_UTF8 */
/* Code for the non-UTF-8 case for minimum matching of operators other
- than OP_PROP and OP_NOTPROP. */
+ than OP_PROP and OP_NOTPROP. We can assume that there are the minimum
+ number of bytes present, as this was tested above. */
switch(ctype)
{
@@ -2701,8 +2831,7 @@ for (;;)
{
for (i = 1; i <= min; i++)
{
- if (eptr <= md->end_subject - md->nllen && IS_NEWLINE(eptr))
- RRETURN(MATCH_NOMATCH);
+ if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH);
eptr++;
}
}
@@ -2713,6 +2842,28 @@ for (;;)
eptr += min;
break;
+ /* Because of the CRLF case, we can't assume the minimum number of
+ bytes are present in this case. */
+
+ case OP_ANYNL:
+ for (i = 1; i <= min; i++)
+ {
+ if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+ switch(*eptr++)
+ {
+ default: RRETURN(MATCH_NOMATCH);
+ case 0x000d:
+ if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
+ break;
+ case 0x000a:
+ case 0x000b:
+ case 0x000c:
+ case 0x0085:
+ break;
+ }
+ }
+ break;
+
case OP_NOT_DIGIT:
for (i = 1; i <= min; i++)
if ((md->ctypes[*eptr++] & ctype_digit) != 0) RRETURN(MATCH_NOMATCH);
@@ -2774,7 +2925,7 @@ for (;;)
GETCHARINC(c, eptr);
if (prop_fail_result) RRETURN(MATCH_NOMATCH);
}
- break;
+ /* Control never gets here */
case PT_LAMP:
for (fi = min;; fi++)
@@ -2789,7 +2940,7 @@ for (;;)
prop_chartype == ucp_Lt) == prop_fail_result)
RRETURN(MATCH_NOMATCH);
}
- break;
+ /* Control never gets here */
case PT_GC:
for (fi = min;; fi++)
@@ -2802,7 +2953,7 @@ for (;;)
if ((prop_category == prop_value) == prop_fail_result)
RRETURN(MATCH_NOMATCH);
}
- break;
+ /* Control never gets here */
case PT_PC:
for (fi = min;; fi++)
@@ -2815,7 +2966,7 @@ for (;;)
if ((prop_chartype == prop_value) == prop_fail_result)
RRETURN(MATCH_NOMATCH);
}
- break;
+ /* Control never gets here */
case PT_SC:
for (fi = min;; fi++)
@@ -2828,11 +2979,10 @@ for (;;)
if ((prop_script == prop_value) == prop_fail_result)
RRETURN(MATCH_NOMATCH);
}
- break;
+ /* Control never gets here */
default:
RRETURN(PCRE_ERROR_INTERNAL);
- break;
}
}
@@ -2876,7 +3026,7 @@ for (;;)
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
if (fi >= max || eptr >= md->end_subject ||
(ctype == OP_ANY && (ims & PCRE_DOTALL) == 0 &&
- eptr <= md->end_subject - md->nllen && IS_NEWLINE(eptr)))
+ IS_NEWLINE(eptr)))
RRETURN(MATCH_NOMATCH);
GETCHARINC(c, eptr);
@@ -2888,6 +3038,23 @@ for (;;)
case OP_ANYBYTE:
break;
+ case OP_ANYNL:
+ switch(c)
+ {
+ default: RRETURN(MATCH_NOMATCH);
+ case 0x000d:
+ if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
+ break;
+ case 0x000a:
+ case 0x000b:
+ case 0x000c:
+ case 0x0085:
+ case 0x2028:
+ case 0x2029:
+ break;
+ }
+ break;
+
case OP_NOT_DIGIT:
if (c < 256 && (md->ctypes[c] & ctype_digit) != 0)
RRETURN(MATCH_NOMATCH);
@@ -2932,8 +3099,7 @@ for (;;)
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
if (fi >= max || eptr >= md->end_subject ||
- ((ims & PCRE_DOTALL) == 0 &&
- eptr <= md->end_subject - md->nllen && IS_NEWLINE(eptr)))
+ ((ims & PCRE_DOTALL) == 0 && IS_NEWLINE(eptr)))
RRETURN(MATCH_NOMATCH);
c = *eptr++;
@@ -2945,6 +3111,21 @@ for (;;)
case OP_ANYBYTE:
break;
+ case OP_ANYNL:
+ switch(c)
+ {
+ default: RRETURN(MATCH_NOMATCH);
+ case 0x000d:
+ if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
+ break;
+ case 0x000a:
+ case 0x000b:
+ case 0x000c:
+ case 0x0085:
+ break;
+ }
+ break;
+
case OP_NOT_DIGIT:
if ((md->ctypes[c] & ctype_digit) != 0) RRETURN(MATCH_NOMATCH);
break;
@@ -2977,7 +3158,7 @@ for (;;)
/* Control never gets here */
}
- /* If maximizing it is worth using inline code for speed, doing the type
+ /* If maximizing, it is worth using inline code for speed, doing the type
test once at the start (i.e. keep it out of the loop). Again, keep the
UTF-8 and UCP stuff separate. */
@@ -3058,6 +3239,7 @@ for (;;)
/* eptr is now past the end of the maximum run */
+ if (possessive) continue;
for(;;)
{
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
@@ -3093,6 +3275,7 @@ for (;;)
/* eptr is now past the end of the maximum run */
+ if (possessive) continue;
for(;;)
{
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
@@ -3135,9 +3318,7 @@ for (;;)
{
for (i = min; i < max; i++)
{
- if (eptr >= md->end_subject ||
- (eptr <= md->end_subject - md->nllen && IS_NEWLINE(eptr)))
- break;
+ if (eptr >= md->end_subject || IS_NEWLINE(eptr)) break;
eptr++;
while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
}
@@ -3161,9 +3342,7 @@ for (;;)
{
for (i = min; i < max; i++)
{
- if (eptr >= md->end_subject ||
- (eptr <= md->end_subject - md->nllen && IS_NEWLINE(eptr)))
- break;
+ if (eptr >= md->end_subject || IS_NEWLINE(eptr)) break;
eptr++;
}
break;
@@ -3171,7 +3350,8 @@ for (;;)
else
{
c = max - min;
- if (c > md->end_subject - eptr) c = md->end_subject - eptr;
+ if (c > (unsigned int)(md->end_subject - eptr))
+ c = md->end_subject - eptr;
eptr += c;
}
}
@@ -3181,10 +3361,32 @@ for (;;)
case OP_ANYBYTE:
c = max - min;
- if (c > md->end_subject - eptr) c = md->end_subject - eptr;
+ if (c > (unsigned int)(md->end_subject - eptr))
+ c = md->end_subject - eptr;
eptr += c;
break;
+ case OP_ANYNL:
+ for (i = min; i < max; i++)
+ {
+ int len = 1;
+ if (eptr >= md->end_subject) break;
+ GETCHARLEN(c, eptr, len);
+ if (c == 0x000d)
+ {
+ if (++eptr >= md->end_subject) break;
+ if (*eptr == 0x000a) eptr++;
+ }
+ else
+ {
+ if (c != 0x000a && c != 0x000b && c != 0x000c &&
+ c != 0x0085 && c != 0x2028 && c != 0x2029)
+ break;
+ eptr += len;
+ }
+ }
+ break;
+
case OP_NOT_DIGIT:
for (i = min; i < max; i++)
{
@@ -3257,6 +3459,7 @@ for (;;)
/* eptr is now past the end of the maximum run */
+ if (possessive) continue;
for(;;)
{
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
@@ -3277,9 +3480,7 @@ for (;;)
{
for (i = min; i < max; i++)
{
- if (eptr >= md->end_subject ||
- (eptr <= md->end_subject - md->nllen && IS_NEWLINE(eptr)))
- break;
+ if (eptr >= md->end_subject || IS_NEWLINE(eptr)) break;
eptr++;
}
break;
@@ -3288,10 +3489,30 @@ for (;;)
case OP_ANYBYTE:
c = max - min;
- if (c > md->end_subject - eptr) c = md->end_subject - eptr;
+ if (c > (unsigned int)(md->end_subject - eptr))
+ c = md->end_subject - eptr;
eptr += c;
break;
+ case OP_ANYNL:
+ for (i = min; i < max; i++)
+ {
+ if (eptr >= md->end_subject) break;
+ c = *eptr;
+ if (c == 0x000d)
+ {
+ if (++eptr >= md->end_subject) break;
+ if (*eptr == 0x000a) eptr++;
+ }
+ else
+ {
+ if (c != 0x000a && c != 0x000b && c != 0x000c && c != 0x0085)
+ break;
+ eptr++;
+ }
+ }
+ break;
+
case OP_NOT_DIGIT:
for (i = min; i < max; i++)
{
@@ -3352,6 +3573,7 @@ for (;;)
/* eptr is now past the end of the maximum run */
+ if (possessive) continue;
while (eptr >= pp)
{
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
@@ -3366,14 +3588,12 @@ for (;;)
}
/* Control never gets here */
- /* There's been some horrible disaster. Since all codes > OP_BRA are
- for capturing brackets, and there shouldn't be any gaps between 0 and
- OP_BRA, arrival here can only mean there is something seriously wrong
- in the code above or the OP_xxx definitions. */
+ /* There's been some horrible disaster. Arrival here can only mean there is
+ something seriously wrong in the code above or the OP_xxx definitions. */
default:
DPRINTF(("Unknown opcode %d\n", *ecode));
- RRETURN(PCRE_ERROR_UNKNOWN_NODE);
+ RRETURN(PCRE_ERROR_UNKNOWN_OPCODE);
}
/* Do not stick any code in here without much thought; it is assumed
@@ -3411,7 +3631,6 @@ Undefine all the macros that were defined above to handle this. */
#undef cur_is_word
#undef condition
-#undef minimize
#undef prev_is_word
#undef original_ims
@@ -3484,6 +3703,7 @@ BOOL startline;
BOOL firstline;
BOOL first_byte_caseless = FALSE;
BOOL req_byte_caseless = FALSE;
+BOOL utf8;
match_data match_block;
match_data *md = &match_block;
const uschar *tables;
@@ -3491,6 +3711,7 @@ const uschar *start_bits = NULL;
USPTR start_match = (USPTR)subject + start_offset;
USPTR end_subject;
USPTR req_byte_ptr = start_match - 1;
+eptrblock eptrchain[EPTR_WORK_SIZE];
pcre_study_data internal_study;
const pcre_study_data *study;
@@ -3567,7 +3788,7 @@ md->end_subject = md->start_subject + length;
end_subject = md->end_subject;
md->endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0;
-md->utf8 = (re->options & PCRE_UTF8) != 0;
+utf8 = md->utf8 = (re->options & PCRE_UTF8) != 0;
md->notbol = (options & PCRE_NOTBOL) != 0;
md->noteol = (options & PCRE_NOTEOL) != 0;
@@ -3576,6 +3797,7 @@ md->partial = (options & PCRE_PARTIAL) != 0;
md->hitend = FALSE;
md->recursive = NULL; /* No recursion at top level */
+md->eptrchain = eptrchain; /* Make workspace generally available */
md->lcc = tables + lcc_offset;
md->ctypes = tables + ctypes_offset;
@@ -3583,26 +3805,36 @@ md->ctypes = tables + ctypes_offset;
/* Handle different types of newline. The two bits give four cases. If nothing
is set at run time, whatever was used at compile time applies. */
-switch ((((options & PCRE_NEWLINE_CRLF) == 0)? re->options : options) &
- PCRE_NEWLINE_CRLF)
+switch ((((options & PCRE_NEWLINE_BITS) == 0)? re->options : options) &
+ PCRE_NEWLINE_BITS)
{
- default: newline = NEWLINE; break; /* Compile-time default */
+ case 0: newline = NEWLINE; break; /* Compile-time default */
case PCRE_NEWLINE_CR: newline = '\r'; break;
case PCRE_NEWLINE_LF: newline = '\n'; break;
case PCRE_NEWLINE_CR+
PCRE_NEWLINE_LF: newline = ('\r' << 8) | '\n'; break;
+ case PCRE_NEWLINE_ANY: newline = -1; break;
+ default: return PCRE_ERROR_BADNEWLINE;
}
-if (newline > 255)
+if (newline < 0)
{
- md->nllen = 2;
- md->nl[0] = (newline >> 8) & 255;
- md->nl[1] = newline & 255;
+ md->nltype = NLTYPE_ANY;
}
else
{
- md->nllen = 1;
- md->nl[0] = newline;
+ md->nltype = NLTYPE_FIXED;
+ if (newline > 255)
+ {
+ md->nllen = 2;
+ md->nl[0] = (newline >> 8) & 255;
+ md->nl[1] = newline & 255;
+ }
+ else
+ {
+ md->nllen = 1;
+ md->nl[0] = newline;
+ }
}
/* Partial matching is supported only for a restricted set of regexes at the
@@ -3615,7 +3847,7 @@ if (md->partial && (re->options & PCRE_NOPARTIAL) != 0)
back the character offset. */
#ifdef SUPPORT_UTF8
-if (md->utf8 && (options & PCRE_NO_UTF8_CHECK) == 0)
+if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0)
{
if (_pcre_valid_utf8((uschar *)subject, length) >= 0)
return PCRE_ERROR_BADUTF8;
@@ -3707,10 +3939,13 @@ if ((re->options & PCRE_REQCHSET) != 0)
req_byte2 = (tables + fcc_offset)[req_byte]; /* case flipped */
}
+
+/* ==========================================================================*/
+
/* Loop for handling unanchored repeated matching attempts; for anchored regexs
the loop runs just once. */
-do
+for(;;)
{
USPTR save_end_subject = end_subject;
@@ -3725,14 +3960,14 @@ do
/* Advance to a unique first char if possible. If firstline is TRUE, the
start of the match is constrained to the first line of a multiline string.
- Implement this by temporarily adjusting end_subject so that we stop scanning
- at a newline. If the match fails at the newline, later code breaks this loop.
- */
+ That is, the match must be before or at the first newline. Implement this by
+ temporarily adjusting end_subject so that we stop scanning at a newline. If
+ the match fails at the newline, later code breaks this loop. */
if (firstline)
{
USPTR t = start_match;
- while (t <= save_end_subject - md->nllen && !IS_NEWLINE(t)) t++;
+ while (t < md->end_subject && !IS_NEWLINE(t)) t++;
end_subject = t;
}
@@ -3753,11 +3988,9 @@ do
else if (startline)
{
- if (start_match >= md->start_subject + md->nllen +
- start_offset)
+ if (start_match > md->start_subject + start_offset)
{
- while (start_match <= end_subject &&
- !IS_NEWLINE(start_match - md->nllen))
+ while (start_match <= end_subject && !WAS_NEWLINE(start_match))
start_match++;
}
}
@@ -3793,8 +4026,8 @@ do
HOWEVER: when the subject string is very, very long, searching to its end can
take a long time, and give bad performance on quite ordinary patterns. This
- showed up when somebody was matching /^C/ on a 32-megabyte string... so we
- don't do this when the string is sufficiently long.
+ showed up when somebody was matching something like /^\d+C/ on a 32-megabyte
+ string... so we don't do this when the string is sufficiently long.
ALSO: this processing is disabled when partial matching is requested.
*/
@@ -3826,9 +4059,14 @@ do
}
}
- /* If we can't find the required character, break the matching loop */
+ /* If we can't find the required character, break the matching loop,
+ forcing a match failure. */
- if (p >= end_subject) break;
+ if (p >= end_subject)
+ {
+ rc = MATCH_NOMATCH;
+ break;
+ }
/* If we have found the required character, save the point where we
found it, so that we don't search again next time round the loop if
@@ -3838,49 +4076,70 @@ do
}
}
- /* When a match occurs, substrings will be set for all internal extractions;
- we just need to set up the whole thing as substring 0 before returning. If
- there were too many extractions, set the return code to zero. In the case
- where we had to get some local store to hold offsets for backreferences, copy
- those back references that we can. In this case there need not be overflow
- if certain parts of the pattern were not used. */
+ /* OK, we can now run the match. */
md->start_match = start_match;
md->match_call_count = 0;
+ md->eptrn = 0; /* Next free eptrchain slot */
+ rc = match(start_match, md->start_code, 2, md, ims, NULL, 0, 0);
- rc = match(start_match, md->start_code, 2, md, ims, NULL, match_isgroup, 0);
+ /* Any return other than MATCH_NOMATCH breaks the loop. */
- /* When the result is no match, if the subject's first character was a
- newline and the PCRE_FIRSTLINE option is set, break (which will return
- PCRE_ERROR_NOMATCH). The option requests that a match occur before the first
- newline in the subject. Otherwise, advance the pointer to the next character
- and continue - but the continuation will actually happen only when the
- pattern is not anchored. */
+ if (rc != MATCH_NOMATCH) break;
- if (rc == MATCH_NOMATCH)
- {
- if (firstline &&
- start_match <= md->end_subject - md->nllen &&
- IS_NEWLINE(start_match))
- break;
- start_match++;
+ /* If PCRE_FIRSTLINE is set, the match must happen before or at the first
+ newline in the subject (though it may continue over the newline). Therefore,
+ if we have just failed to match, starting at a newline, do not continue. */
+
+ if (firstline && IS_NEWLINE(start_match)) break;
+
+ /* Advance the match position by one character. */
+
+ start_match++;
#ifdef SUPPORT_UTF8
- if (md->utf8)
- while(start_match < end_subject && (*start_match & 0xc0) == 0x80)
- start_match++;
+ if (utf8)
+ while(start_match < end_subject && (*start_match & 0xc0) == 0x80)
+ start_match++;
#endif
- continue;
- }
- if (rc != MATCH_MATCH)
- {
- DPRINTF((">>>> error: returning %d\n", rc));
- return rc;
- }
+ /* Break the loop if the pattern is anchored or if we have passed the end of
+ the subject. */
+
+ if (anchored || start_match > end_subject) break;
+
+ /* If we have just passed a CR and the newline option is CRLF or ANY, and we
+ are now at a LF, advance the match position by one more character. */
+
+ if (start_match[-1] == '\r' &&
+ (md->nltype == NLTYPE_ANY || md->nllen == 2) &&
+ start_match < end_subject &&
+ *start_match == '\n')
+ start_match++;
+
+ } /* End of for(;;) "bumpalong" loop */
+
+/* ==========================================================================*/
+
+/* We reach here when rc is not MATCH_NOMATCH, or if one of the stopping
+conditions is true:
- /* We have a match! Copy the offset information from temporary store if
- necessary */
+(1) The pattern is anchored;
+(2) We are past the end of the subject;
+
+(3) PCRE_FIRSTLINE is set and we have failed to match at a newline, because
+ this option requests that a match occur at or before the first newline in
+ the subject.
+
+When we have a match and the offset vector is big enough to deal with any
+backreferences, captured substring offsets will already be set up. In the case
+where we had to get some local store to hold offsets for backreference
+processing, copy those that we can. In this case there need not be overflow if
+certain parts of the pattern were not used, even though there are more
+capturing parentheses than vector slots. */
+
+if (rc == MATCH_MATCH)
+ {
if (using_temporary_offsets)
{
if (offsetcount >= 4)
@@ -3889,15 +4148,18 @@ do
(offsetcount - 2) * sizeof(int));
DPRINTF(("Copied offsets from temporary memory\n"));
}
- if (md->end_offset_top > offsetcount)
- md->offset_overflow = TRUE;
-
+ if (md->end_offset_top > offsetcount) md->offset_overflow = TRUE;
DPRINTF(("Freeing temporary memory\n"));
(pcre_free)(md->offset_vector);
}
+ /* Set the return code to the number of captured strings, or 0 if there are
+ too many to fit into the vector. */
+
rc = md->offset_overflow? 0 : md->end_offset_top/2;
+ /* If there is space, set up the whole thing as substring 0. */
+
if (offsetcount < 2) rc = 0; else
{
offsets[0] = start_match - md->start_subject;
@@ -3908,9 +4170,8 @@ do
return rc;
}
-/* This "while" is the end of the "do" above */
-
-while (!anchored && start_match <= end_subject);
+/* Control gets here if there has been an error, or if the overall match
+attempt has failed at all permitted starting positions. */
if (using_temporary_offsets)
{
@@ -3918,7 +4179,12 @@ if (using_temporary_offsets)
(pcre_free)(md->offset_vector);
}
-if (md->partial && md->hitend)
+if (rc != MATCH_NOMATCH)
+ {
+ DPRINTF((">>>> error: returning %d\n", rc));
+ return rc;
+ }
+else if (md->partial && md->hitend)
{
DPRINTF((">>>> returning PCRE_ERROR_PARTIAL\n"));
return PCRE_ERROR_PARTIAL;
diff --git a/pcre_get.c b/pcre_get.c
index 0588c61..856e955 100644
--- a/pcre_get.c
+++ b/pcre_get.c
@@ -436,7 +436,6 @@ pcre_get_named_substring(const pcre *code, const char *subject, int *ovector,
int n = get_first_set(code, stringname, ovector);
if (n <= 0) return n;
return pcre_get_substring(subject, ovector, stringcount, n, stringptr);
-
}
diff --git a/pcre_globals.c b/pcre_globals.c
index f829acf..f29983e 100644
--- a/pcre_globals.c
+++ b/pcre_globals.c
@@ -51,6 +51,18 @@ differently, and global variables are not used (see pcre.in). */
#ifndef VPCOMPAT
+
+/**************************************************************************
+This code used to be here for use when compiling as a C++ library. However,
+according to Dair Grant it is not needed: "
+
+ Including 'extern "C"' in the declaration generates an "initialized and
+ declared `extern'" warning from gcc 4.0.1. Since we include pcre_internal.h,
+ which includes pcre.h, which declares these prototypes within an extern "C" {}
+ block, we shouldn't need the prefix here.
+
+So, from Release 7.0 I have cut this out.
+
#ifdef __cplusplus
extern "C" void *(*pcre_malloc)(size_t) = malloc;
extern "C" void (*pcre_free)(void *) = free;
@@ -58,12 +70,13 @@ extern "C" void *(*pcre_stack_malloc)(size_t) = malloc;
extern "C" void (*pcre_stack_free)(void *) = free;
extern "C" int (*pcre_callout)(pcre_callout_block *) = NULL;
#else
+**************************************************************************/
+
void *(*pcre_malloc)(size_t) = malloc;
void (*pcre_free)(void *) = free;
void *(*pcre_stack_malloc)(size_t) = malloc;
void (*pcre_stack_free)(void *) = free;
int (*pcre_callout)(pcre_callout_block *) = NULL;
#endif
-#endif
/* End of pcre_globals.c */
diff --git a/pcre_internal.h b/pcre_internal.h
index 952598e..47fa59a 100644
--- a/pcre_internal.h
+++ b/pcre_internal.h
@@ -54,12 +54,16 @@ functions whose names all begin with "_pcre_". */
/* Use a macro for debugging printing, 'cause that eliminates the use of #ifdef
inline, and there are *still* stupid compilers about that don't like indented
pre-processor statements, or at least there were when I first wrote this. After
-all, it had only been about 10 years then... */
+all, it had only been about 10 years then...
+It turns out that the Mac Debugging.h header also defines the macro DPRINTF, so
+be absolutely sure we get our version. */
+
+#undef DPRINTF
#ifdef DEBUG
#define DPRINTF(p) printf p
#else
-#define DPRINTF(p) /*nothing*/
+#define DPRINTF(p) /* Nothing */
#endif
@@ -114,13 +118,48 @@ Unix, where it is defined in sys/types, so use "uschar" instead. */
typedef unsigned char uschar;
-/* PCRE is able to support 3 different kinds of newline (CR, LF, CRLF). The
-following macro is used to package up testing for newlines. NLBLOCK is defined
-in the various modules to indicate in which datablock the parameters exist. */
+/* This is an unsigned int value that no character can ever have. UTF-8
+characters only go up to 0x7fffffff (though Unicode doesn't go beyond
+0x0010ffff). */
+
+#define NOTACHAR 0xffffffff
+
+/* PCRE is able to support several different kinds of newline (CR, LF, CRLF,
+and "all" at present). The following macros are used to package up testing for
+newlines. NLBLOCK, PSSTART, and PSEND are defined in the various modules to
+indicate in which datablock the parameters exist, and what the start/end of
+string field names are. */
+
+#define NLTYPE_FIXED 0 /* Newline is a fixed length string */
+#define NLTYPE_ANY 1 /* Newline is any Unicode line ending */
+
+/* This macro checks for a newline at the given position */
#define IS_NEWLINE(p) \
- ((p)[0] == NLBLOCK->nl[0] && \
- (NLBLOCK->nllen == 1 || (p)[1] == NLBLOCK->nl[1]))
+ ((NLBLOCK->nltype != NLTYPE_FIXED)? \
+ ((p) < NLBLOCK->PSEND && \
+ _pcre_is_newline((p), NLBLOCK->PSEND, &(NLBLOCK->nllen), utf8) \
+ ) \
+ : \
+ ((p) <= NLBLOCK->PSEND - NLBLOCK->nllen && \
+ (p)[0] == NLBLOCK->nl[0] && \
+ (NLBLOCK->nllen == 1 || (p)[1] == NLBLOCK->nl[1]) \
+ ) \
+ )
+
+/* This macro checks for a newline immediately preceding the given position */
+
+#define WAS_NEWLINE(p) \
+ ((NLBLOCK->nltype != NLTYPE_FIXED)? \
+ ((p) > NLBLOCK->PSSTART && \
+ _pcre_was_newline((p), NLBLOCK->PSSTART, &(NLBLOCK->nllen), utf8) \
+ ) \
+ : \
+ ((p) >= NLBLOCK->PSSTART + NLBLOCK->nllen && \
+ (p)[-NLBLOCK->nllen] == NLBLOCK->nl[0] && \
+ (NLBLOCK->nllen == 1 || (p)[-NLBLOCK->nllen+1] == NLBLOCK->nl[1]) \
+ ) \
+ )
/* When PCRE is compiled as a C++ library, the subject pointer can be replaced
with a custom type. This makes it possible, for example, to allow pcre_exec()
@@ -278,7 +317,7 @@ we know we are in UTF-8 mode. */
#define GETCHAR(c, eptr) \
c = *eptr; \
- if ((c & 0xc0) == 0xc0) \
+ if (c >= 0xc0) \
{ \
int gcii; \
int gcaa = _pcre_utf8_table4[c & 0x3f]; /* Number of additional bytes */ \
@@ -296,7 +335,7 @@ pointer. */
#define GETCHARTEST(c, eptr) \
c = *eptr; \
- if (utf8 && (c & 0xc0) == 0xc0) \
+ if (utf8 && c >= 0xc0) \
{ \
int gcii; \
int gcaa = _pcre_utf8_table4[c & 0x3f]; /* Number of additional bytes */ \
@@ -314,7 +353,7 @@ know we are in UTF-8 mode. */
#define GETCHARINC(c, eptr) \
c = *eptr++; \
- if ((c & 0xc0) == 0xc0) \
+ if (c >= 0xc0) \
{ \
int gcaa = _pcre_utf8_table4[c & 0x3f]; /* Number of additional bytes */ \
int gcss = 6*gcaa; \
@@ -330,7 +369,7 @@ know we are in UTF-8 mode. */
#define GETCHARINCTEST(c, eptr) \
c = *eptr++; \
- if (utf8 && (c & 0xc0) == 0xc0) \
+ if (utf8 && c >= 0xc0) \
{ \
int gcaa = _pcre_utf8_table4[c & 0x3f]; /* Number of additional bytes */ \
int gcss = 6*gcaa; \
@@ -347,7 +386,7 @@ if there are extra bytes. This is called when we know we are in UTF-8 mode. */
#define GETCHARLEN(c, eptr, len) \
c = *eptr; \
- if ((c & 0xc0) == 0xc0) \
+ if (c >= 0xc0) \
{ \
int gcii; \
int gcaa = _pcre_utf8_table4[c & 0x3f]; /* Number of additional bytes */ \
@@ -400,20 +439,21 @@ bits. */
/* Masks for identifying the public options that are permitted at compile
time, run time, or study time, respectively. */
+#define PCRE_NEWLINE_BITS (PCRE_NEWLINE_CR|PCRE_NEWLINE_LF|PCRE_NEWLINE_ANY)
+
#define PUBLIC_OPTIONS \
(PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \
PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY|PCRE_UTF8| \
PCRE_NO_AUTO_CAPTURE|PCRE_NO_UTF8_CHECK|PCRE_AUTO_CALLOUT|PCRE_FIRSTLINE| \
- PCRE_DUPNAMES|PCRE_NEWLINE_CR|PCRE_NEWLINE_LF)
+ PCRE_DUPNAMES|PCRE_NEWLINE_BITS)
#define PUBLIC_EXEC_OPTIONS \
(PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \
- PCRE_PARTIAL|PCRE_NEWLINE_CR|PCRE_NEWLINE_LF)
+ PCRE_PARTIAL|PCRE_NEWLINE_BITS)
#define PUBLIC_DFA_EXEC_OPTIONS \
(PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \
- PCRE_PARTIAL|PCRE_DFA_SHORTEST|PCRE_DFA_RESTART|PCRE_NEWLINE_CR| \
- PCRE_NEWLINE_LF)
+ PCRE_PARTIAL|PCRE_DFA_SHORTEST|PCRE_DFA_RESTART|PCRE_NEWLINE_BITS)
#define PUBLIC_STUDY_OPTIONS 0 /* None defined */
@@ -445,9 +485,7 @@ typedef int BOOL;
#define FALSE 0
#define TRUE 1
-/* Escape items that are just an encoding of a particular data value. Note that
-ESC_n is defined as yet another macro, which is set in config.h to either \n
-(the default) or \r (which some people want). */
+/* Escape items that are just an encoding of a particular data value. */
#ifndef ESC_e
#define ESC_e 27
@@ -458,7 +496,7 @@ ESC_n is defined as yet another macro, which is set in config.h to either \n
#endif
#ifndef ESC_n
-#define ESC_n NEWLINE
+#define ESC_n '\n'
#endif
#ifndef ESC_r
@@ -497,21 +535,28 @@ value such as \n. They must have non-zero values, as check_escape() returns
their negation. Also, they must appear in the same order as in the opcode
definitions below, up to ESC_z. There's a dummy for OP_ANY because it
corresponds to "." rather than an escape sequence. The final one must be
-ESC_REF as subsequent values are used for \1, \2, \3, etc. There is are two
-tests in the code for an escape greater than ESC_b and less than ESC_Z to
-detect the types that may be repeated. These are the types that consume
-characters. If any new escapes are put in between that don't consume a
+ESC_REF as subsequent values are used for backreferences (\1, \2, \3, etc).
+There are two tests in the code for an escape greater than ESC_b and less than
+ESC_Z to detect the types that may be repeated. These are the types that
+consume characters. If any new escapes are put in between that don't consume a
character, that code will have to change. */
enum { ESC_A = 1, ESC_G, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s, ESC_W,
- ESC_w, ESC_dum1, ESC_C, ESC_P, ESC_p, ESC_X, ESC_Z, ESC_z, ESC_E,
- ESC_Q, ESC_REF };
+ ESC_w, ESC_dum1, ESC_C, ESC_P, ESC_p, ESC_R, ESC_X, ESC_Z, ESC_z,
+ ESC_E, ESC_Q, ESC_k, ESC_REF };
+
/* Opcode table: OP_BRA must be last, as all values >= it are used for brackets
that extract substrings. Starting from 1 (i.e. after OP_END), the values up to
OP_EOD must correspond in order to the list of escapes immediately above.
-Note that whenever this list is updated, the two macro definitions that follow
-must also be updated to match. */
+
+To keep stored, compiled patterns compatible, new opcodes should be added
+immediately before OP_BRA, where (since release 7.0) a gap is left for this
+purpose.
+
+*** NOTE NOTE NOTE *** Whenever this list is updated, the two macro definitions
+that follow must also be updated to match. There is also a table called
+"coptable" in pcre_dfa_exec.c that must be updated. */
enum {
OP_END, /* 0 End of pattern */
@@ -532,110 +577,122 @@ enum {
OP_ANYBYTE, /* 12 Match any byte (\C); different to OP_ANY for UTF-8 */
OP_NOTPROP, /* 13 \P (not Unicode property) */
OP_PROP, /* 14 \p (Unicode property) */
- OP_EXTUNI, /* 15 \X (extended Unicode sequence */
- OP_EODN, /* 16 End of data or \n at end of data: \Z. */
- OP_EOD, /* 17 End of data: \z */
-
- OP_OPT, /* 18 Set runtime options */
- OP_CIRC, /* 19 Start of line - varies with multiline switch */
- OP_DOLL, /* 20 End of line - varies with multiline switch */
- OP_CHAR, /* 21 Match one character, casefully */
- OP_CHARNC, /* 22 Match one character, caselessly */
- OP_NOT, /* 23 Match one character, not the following one */
-
- OP_STAR, /* 24 The maximizing and minimizing versions of */
- OP_MINSTAR, /* 25 all these opcodes must come in pairs, with */
- OP_PLUS, /* 26 the minimizing one second. */
- OP_MINPLUS, /* 27 This first set applies to single characters */
- OP_QUERY, /* 28 */
- OP_MINQUERY, /* 29 */
- OP_UPTO, /* 30 From 0 to n matches */
- OP_MINUPTO, /* 31 */
- OP_EXACT, /* 32 Exactly n matches */
-
- OP_NOTSTAR, /* 33 The maximizing and minimizing versions of */
- OP_NOTMINSTAR, /* 34 all these opcodes must come in pairs, with */
- OP_NOTPLUS, /* 35 the minimizing one second. */
- OP_NOTMINPLUS, /* 36 This set applies to "not" single characters */
- OP_NOTQUERY, /* 37 */
- OP_NOTMINQUERY, /* 38 */
- OP_NOTUPTO, /* 39 From 0 to n matches */
- OP_NOTMINUPTO, /* 40 */
- OP_NOTEXACT, /* 41 Exactly n matches */
-
- OP_TYPESTAR, /* 42 The maximizing and minimizing versions of */
- OP_TYPEMINSTAR, /* 43 all these opcodes must come in pairs, with */
- OP_TYPEPLUS, /* 44 the minimizing one second. These codes must */
- OP_TYPEMINPLUS, /* 45 be in exactly the same order as those above. */
- OP_TYPEQUERY, /* 46 This set applies to character types such as \d */
- OP_TYPEMINQUERY, /* 47 */
- OP_TYPEUPTO, /* 48 From 0 to n matches */
- OP_TYPEMINUPTO, /* 49 */
- OP_TYPEEXACT, /* 50 Exactly n matches */
-
- OP_CRSTAR, /* 51 The maximizing and minimizing versions of */
- OP_CRMINSTAR, /* 52 all these opcodes must come in pairs, with */
- OP_CRPLUS, /* 53 the minimizing one second. These codes must */
- OP_CRMINPLUS, /* 54 be in exactly the same order as those above. */
- OP_CRQUERY, /* 55 These are for character classes and back refs */
- OP_CRMINQUERY, /* 56 */
- OP_CRRANGE, /* 57 These are different to the three sets above. */
- OP_CRMINRANGE, /* 58 */
-
- OP_CLASS, /* 59 Match a character class, chars < 256 only */
- OP_NCLASS, /* 60 Same, but the bitmap was created from a negative
+ OP_ANYNL, /* 15 \R (any newline sequence) */
+ OP_EXTUNI, /* 16 \X (extended Unicode sequence */
+ OP_EODN, /* 17 End of data or \n at end of data: \Z. */
+ OP_EOD, /* 18 End of data: \z */
+
+ OP_OPT, /* 19 Set runtime options */
+ OP_CIRC, /* 20 Start of line - varies with multiline switch */
+ OP_DOLL, /* 21 End of line - varies with multiline switch */
+ OP_CHAR, /* 22 Match one character, casefully */
+ OP_CHARNC, /* 23 Match one character, caselessly */
+ OP_NOT, /* 24 Match one character, not the following one */
+
+ OP_STAR, /* 25 The maximizing and minimizing versions of */
+ OP_MINSTAR, /* 26 these six opcodes must come in pairs, with */
+ OP_PLUS, /* 27 the minimizing one second. */
+ OP_MINPLUS, /* 28 This first set applies to single characters.*/
+ OP_QUERY, /* 29 */
+ OP_MINQUERY, /* 30 */
+
+ OP_UPTO, /* 31 From 0 to n matches */
+ OP_MINUPTO, /* 32 */
+ OP_EXACT, /* 33 Exactly n matches */
+
+ OP_POSSTAR, /* 34 Possessified star */
+ OP_POSPLUS, /* 35 Possessified plus */
+ OP_POSQUERY, /* 36 Posesssified query */
+ OP_POSUPTO, /* 37 Possessified upto */
+
+ OP_NOTSTAR, /* 38 The maximizing and minimizing versions of */
+ OP_NOTMINSTAR, /* 39 these six opcodes must come in pairs, with */
+ OP_NOTPLUS, /* 40 the minimizing one second. They must be in */
+ OP_NOTMINPLUS, /* 41 exactly the same order as those above. */
+ OP_NOTQUERY, /* 42 This set applies to "not" single characters. */
+ OP_NOTMINQUERY, /* 43 */
+
+ OP_NOTUPTO, /* 44 From 0 to n matches */
+ OP_NOTMINUPTO, /* 45 */
+ OP_NOTEXACT, /* 46 Exactly n matches */
+
+ OP_NOTPOSSTAR, /* 47 Possessified versions */
+ OP_NOTPOSPLUS, /* 48 */
+ OP_NOTPOSQUERY, /* 49 */
+ OP_NOTPOSUPTO, /* 50 */
+
+ OP_TYPESTAR, /* 51 The maximizing and minimizing versions of */
+ OP_TYPEMINSTAR, /* 52 these six opcodes must come in pairs, with */
+ OP_TYPEPLUS, /* 53 the minimizing one second. These codes must */
+ OP_TYPEMINPLUS, /* 54 be in exactly the same order as those above. */
+ OP_TYPEQUERY, /* 55 This set applies to character types such as \d */
+ OP_TYPEMINQUERY, /* 56 */
+
+ OP_TYPEUPTO, /* 57 From 0 to n matches */
+ OP_TYPEMINUPTO, /* 58 */
+ OP_TYPEEXACT, /* 59 Exactly n matches */
+
+ OP_TYPEPOSSTAR, /* 60 Possessified versions */
+ OP_TYPEPOSPLUS, /* 61 */
+ OP_TYPEPOSQUERY, /* 62 */
+ OP_TYPEPOSUPTO, /* 63 */
+
+ OP_CRSTAR, /* 64 The maximizing and minimizing versions of */
+ OP_CRMINSTAR, /* 65 all these opcodes must come in pairs, with */
+ OP_CRPLUS, /* 66 the minimizing one second. These codes must */
+ OP_CRMINPLUS, /* 67 be in exactly the same order as those above. */
+ OP_CRQUERY, /* 68 These are for character classes and back refs */
+ OP_CRMINQUERY, /* 69 */
+ OP_CRRANGE, /* 70 These are different to the three sets above. */
+ OP_CRMINRANGE, /* 71 */
+
+ OP_CLASS, /* 72 Match a character class, chars < 256 only */
+ OP_NCLASS, /* 73 Same, but the bitmap was created from a negative
class - the difference is relevant only when a UTF-8
character > 255 is encountered. */
- OP_XCLASS, /* 61 Extended class for handling UTF-8 chars within the
+ OP_XCLASS, /* 74 Extended class for handling UTF-8 chars within the
class. This does both positive and negative. */
- OP_REF, /* 62 Match a back reference */
- OP_RECURSE, /* 63 Match a numbered subpattern (possibly recursive) */
- OP_CALLOUT, /* 64 Call out to external function if provided */
-
- OP_ALT, /* 65 Start of alternation */
- OP_KET, /* 66 End of group that doesn't have an unbounded repeat */
- OP_KETRMAX, /* 67 These two must remain together and in this */
- OP_KETRMIN, /* 68 order. They are for groups the repeat for ever. */
+ OP_REF, /* 75 Match a back reference */
+ OP_RECURSE, /* 76 Match a numbered subpattern (possibly recursive) */
+ OP_CALLOUT, /* 77 Call out to external function if provided */
- /* The assertions must come before ONCE and COND */
+ OP_ALT, /* 78 Start of alternation */
+ OP_KET, /* 79 End of group that doesn't have an unbounded repeat */
+ OP_KETRMAX, /* 80 These two must remain together and in this */
+ OP_KETRMIN, /* 81 order. They are for groups the repeat for ever. */
- OP_ASSERT, /* 69 Positive lookahead */
- OP_ASSERT_NOT, /* 70 Negative lookahead */
- OP_ASSERTBACK, /* 71 Positive lookbehind */
- OP_ASSERTBACK_NOT, /* 72 Negative lookbehind */
- OP_REVERSE, /* 73 Move pointer back - used in lookbehind assertions */
+ /* The assertions must come before BRA, CBRA, ONCE, and COND.*/
- /* ONCE and COND must come after the assertions, with ONCE first, as there's
- a test for >= ONCE for a subpattern that isn't an assertion. */
+ OP_ASSERT, /* 82 Positive lookahead */
+ OP_ASSERT_NOT, /* 83 Negative lookahead */
+ OP_ASSERTBACK, /* 84 Positive lookbehind */
+ OP_ASSERTBACK_NOT, /* 85 Negative lookbehind */
+ OP_REVERSE, /* 86 Move pointer back - used in lookbehind assertions */
- OP_ONCE, /* 74 Once matched, don't back up into the subpattern */
- OP_COND, /* 75 Conditional group */
- OP_CREF, /* 76 Used to hold an extraction string number (cond ref) */
+ /* ONCE, BRA, CBRA, and COND must come after the assertions, with ONCE first,
+ as there's a test for >= ONCE for a subpattern that isn't an assertion. */
- OP_BRAZERO, /* 77 These two must remain together and in this */
- OP_BRAMINZERO, /* 78 order. */
+ OP_ONCE, /* 87 Atomic group */
+ OP_BRA, /* 88 Start of non-capturing bracket */
+ OP_CBRA, /* 89 Start of capturing bracket */
+ OP_COND, /* 90 Conditional group */
- OP_BRANUMBER, /* 79 Used for extracting brackets whose number is greater
- than can fit into an opcode. */
-
- OP_BRA /* 80 This and greater values are used for brackets that
- extract substrings up to EXTRACT_BASIC_MAX. After
- that, use is made of OP_BRANUMBER. */
-};
+ /* These three must follow the previous three, in the same order. There's a
+ check for >= SBRA to distinguish the two sets. */
-/* WARNING WARNING WARNING: There is an implicit assumption in pcre.c and
-study.c that all opcodes are less than 128 in value. This makes handling UTF-8
-character sequences easier. */
+ OP_SBRA, /* 91 Start of non-capturing bracket, check empty */
+ OP_SCBRA, /* 92 Start of capturing bracket, check empty */
+ OP_SCOND, /* 93 Conditional group, check empty */
-/* The highest extraction number before we have to start using additional
-bytes. (Originally PCRE didn't have support for extraction counts highter than
-this number.) The value is limited by the number of opcodes left after OP_BRA,
-i.e. 255 - OP_BRA. We actually set it a bit lower to leave room for additional
-opcodes. */
+ OP_CREF, /* 94 Used to hold a capture number as condition */
+ OP_RREF, /* 95 Used to hold a recursion number as condition */
+ OP_DEF, /* 96 The DEFINE condition */
-#define EXTRACT_BASIC_MAX 100
+ OP_BRAZERO, /* 97 These two must remain together and in this */
+ OP_BRAMINZERO /* 98 order. */
+};
/* This macro defines textual names for all the opcodes. These are used only
@@ -644,17 +701,21 @@ for debugging. The macro is referenced only in pcre_printint.c. */
#define OP_NAME_LIST \
"End", "\\A", "\\G", "\\B", "\\b", "\\D", "\\d", \
"\\S", "\\s", "\\W", "\\w", "Any", "Anybyte", \
- "notprop", "prop", "extuni", \
+ "notprop", "prop", "anynl", "extuni", \
"\\Z", "\\z", \
"Opt", "^", "$", "char", "charnc", "not", \
"*", "*?", "+", "+?", "?", "??", "{", "{", "{", \
+ "*+","++", "?+", "{", \
"*", "*?", "+", "+?", "?", "??", "{", "{", "{", \
+ "*+","++", "?+", "{", \
"*", "*?", "+", "+?", "?", "??", "{", "{", "{", \
+ "*+","++", "?+", "{", \
"*", "*?", "+", "+?", "?", "??", "{", "{", \
"class", "nclass", "xclass", "Ref", "Recurse", "Callout", \
"Alt", "Ket", "KetRmax", "KetRmin", "Assert", "Assert not", \
- "AssertB", "AssertB not", "Reverse", "Once", "Cond", "Cond ref",\
- "Brazero", "Braminzero", "Branumber", "Bra"
+ "AssertB", "AssertB not", "Reverse", \
+ "Once", "Bra 0", "Bra", "Cond", "SBra 0", "SBra", "SCond", \
+ "Cond ref", "Cond rec", "Cond def", "Brazero", "Braminzero"
/* This macro defines the length of fixed length operations in the compiled
@@ -670,7 +731,7 @@ in UTF-8 mode. The code that uses this table must know about such things. */
1, /* End */ \
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* \A, \G, \B, \B, \D, \d, \S, \s, \W, \w */ \
1, 1, /* Any, Anybyte */ \
- 3, 3, 1, /* NOTPROP, PROP, EXTUNI */ \
+ 3, 3, 1, 1, /* NOTPROP, PROP, EXTUNI, ANYNL */ \
1, 1, 2, 1, 1, /* \Z, \z, Opt, ^, $ */ \
2, /* Char - the minimum length */ \
2, /* Charnc - the minimum length */ \
@@ -678,12 +739,15 @@ in UTF-8 mode. The code that uses this table must know about such things. */
/* Positive single-char repeats ** These are */ \
2, 2, 2, 2, 2, 2, /* *, *?, +, +?, ?, ?? ** minima in */ \
4, 4, 4, /* upto, minupto, exact ** UTF-8 mode */ \
+ 2, 2, 2, 4, /* *+, ++, ?+, upto+ */ \
/* Negative single-char repeats - only for chars < 256 */ \
2, 2, 2, 2, 2, 2, /* NOT *, *?, +, +?, ?, ?? */ \
4, 4, 4, /* NOT upto, minupto, exact */ \
+ 2, 2, 2, 4, /* Possessive *, +, ?, upto */ \
/* Positive type repeats */ \
2, 2, 2, 2, 2, 2, /* Type *, *?, +, +?, ?, ?? */ \
4, 4, 4, /* Type upto, minupto, exact */ \
+ 2, 2, 2, 4, /* Possessive *+, ++, ?+, upto+ */ \
/* Character class & ref repeats */ \
1, 1, 1, 1, 1, 1, /* *, *?, +, +?, ?, ?? */ \
5, 5, /* CRRANGE, CRMINRANGE */ \
@@ -702,17 +766,22 @@ in UTF-8 mode. The code that uses this table must know about such things. */
1+LINK_SIZE, /* Assert behind */ \
1+LINK_SIZE, /* Assert behind not */ \
1+LINK_SIZE, /* Reverse */ \
- 1+LINK_SIZE, /* Once */ \
+ 1+LINK_SIZE, /* ONCE */ \
+ 1+LINK_SIZE, /* BRA */ \
+ 3+LINK_SIZE, /* CBRA */ \
1+LINK_SIZE, /* COND */ \
+ 1+LINK_SIZE, /* SBRA */ \
+ 3+LINK_SIZE, /* SCBRA */ \
+ 1+LINK_SIZE, /* SCOND */ \
3, /* CREF */ \
+ 3, /* RREF */ \
+ 1, /* DEF */ \
1, 1, /* BRAZERO, BRAMINZERO */ \
- 3, /* BRANUMBER */ \
- 1+LINK_SIZE /* BRA */ \
-/* A magic value for OP_CREF to indicate the "in recursion" condition. */
+/* A magic value for OP_RREF to indicate the "any recursion" condition. */
-#define CREF_RECURSE 0xffff
+#define RREF_ANY 0xffff
/* Error code numbers. They are given names so that they can more easily be
tracked. */
@@ -722,7 +791,7 @@ enum { ERR0, ERR1, ERR2, ERR3, ERR4, ERR5, ERR6, ERR7, ERR8, ERR9,
ERR20, ERR21, ERR22, ERR23, ERR24, ERR25, ERR26, ERR27, ERR28, ERR29,
ERR30, ERR31, ERR32, ERR33, ERR34, ERR35, ERR36, ERR37, ERR38, ERR39,
ERR40, ERR41, ERR42, ERR43, ERR44, ERR45, ERR46, ERR47, ERR48, ERR49,
- ERR50, ERR51 };
+ ERR50, ERR51, ERR52, ERR53, ERR54, ERR55, ERR56, ERR57 };
/* The real format of the start of the pcre block; the index of names and the
code vector run on as long as necessary after the end. We store an explicit
@@ -777,17 +846,23 @@ typedef struct compile_data {
const uschar *fcc; /* Points to case-flipping table */
const uschar *cbits; /* Points to character type table */
const uschar *ctypes; /* Points to table of type maps */
+ const uschar *start_workspace;/* The start of working space */
const uschar *start_code; /* The start of the compiled code */
const uschar *start_pattern; /* The start of the pattern */
+ const uschar *end_pattern; /* The end of the pattern */
+ uschar *hwm; /* High watermark of workspace */
uschar *name_table; /* The name/number table */
int names_found; /* Number of entries so far */
int name_entry_size; /* Size of each entry */
+ int bracount; /* Count of capturing parens */
int top_backref; /* Maximum back reference */
unsigned int backref_map; /* Bitmap of low back refs */
+ int external_options; /* External (initial) options */
int req_varyopt; /* "After variable item" flag for reqbyte */
BOOL nopartial; /* Set TRUE if partial won't work */
- int nllen; /* 1 or 2 for newline string length */
- uschar nl[4]; /* Newline string */
+ int nltype; /* Newline type */
+ int nllen; /* Newline string length */
+ uschar nl[4]; /* Newline string when fixed length */
} compile_data;
/* Structure for maintaining a chain of pointers to the currently incomplete
@@ -820,6 +895,16 @@ This isn't used for a "normal" compilation of pcre. */
struct heapframe;
+/* Structure for building a chain of data for holding the values of the subject
+pointer at the start of each subpattern, so as to detect when an empty string
+has been matched by a subpattern - to break infinite loops. */
+
+typedef struct eptrblock {
+ struct eptrblock *epb_prev;
+ USPTR epb_saved_eptr;
+} eptrblock;
+
+
/* Structure for passing "static" information around between the functions
doing traditional NFA matching, so that they are thread-safe. */
@@ -830,8 +915,9 @@ typedef struct match_data {
int *offset_vector; /* Offset vector */
int offset_end; /* One past the end */
int offset_max; /* The maximum usable for return data */
- int nllen; /* 1 or 2 for newline string length */
- uschar nl[4]; /* Newline string */
+ int nltype; /* Newline type */
+ int nllen; /* Newline string length */
+ uschar nl[4]; /* Newline string when fixed */
const uschar *lcc; /* Points to lower casing table */
const uschar *ctypes; /* Points to table of type maps */
BOOL offset_overflow; /* Set if too many extractions */
@@ -850,6 +936,8 @@ typedef struct match_data {
int end_offset_top; /* Highwater mark at end of match */
int capture_last; /* Most recent capture number */
int start_offset; /* The start offset value */
+ eptrblock *eptrchain; /* Chain of eptrblocks for tail recursions */
+ int eptrn; /* Next free eptrblock */
recursion_info *recursive; /* Linked list of recursion data */
void *callout_data; /* To pass back to callouts */
struct heapframe *thisframe; /* Used only when compiling for no recursion */
@@ -865,8 +953,9 @@ typedef struct dfa_match_data {
const uschar *tables; /* Character tables */
int moptions; /* Match options */
int poptions; /* Pattern options */
- int nllen; /* 1 or 2 for newline string length */
- uschar nl[4]; /* Newline string */
+ int nltype; /* Newline type */
+ int nllen; /* Newline string length */
+ uschar nl[4]; /* Newline string when fixed */
void *callout_data; /* To pass back to callouts */
} dfa_match_data;
@@ -937,13 +1026,17 @@ extern const uschar _pcre_OP_lengths[];
one of the exported public functions. They have to be "external" in the C
sense, but are not part of the PCRE public API. */
-extern int _pcre_ord2utf8(int, uschar *);
-extern real_pcre * _pcre_try_flipped(const real_pcre *, real_pcre *,
- const pcre_study_data *, pcre_study_data *);
-extern int _pcre_ucp_findprop(const unsigned int, int *, int *);
-extern int _pcre_ucp_othercase(const int);
-extern int _pcre_valid_utf8(const uschar *, int);
-extern BOOL _pcre_xclass(int, const uschar *);
+extern BOOL _pcre_is_newline(const uschar *, const uschar *, int *,
+ BOOL);
+extern int _pcre_ord2utf8(int, uschar *);
+extern real_pcre *_pcre_try_flipped(const real_pcre *, real_pcre *,
+ const pcre_study_data *, pcre_study_data *);
+extern int _pcre_ucp_findprop(const unsigned int, int *, int *);
+extern unsigned int _pcre_ucp_othercase(const unsigned int);
+extern int _pcre_valid_utf8(const uschar *, int);
+extern BOOL _pcre_was_newline(const uschar *, const uschar *, int *,
+ BOOL);
+extern BOOL _pcre_xclass(int, const uschar *);
#endif
diff --git a/pcre_maketables.c b/pcre_maketables.c
index afe63d1..29e4098 100644
--- a/pcre_maketables.c
+++ b/pcre_maketables.c
@@ -130,7 +130,7 @@ for (i = 0; i < 256; i++)
meta-character, which in this sense is any character that terminates a run
of data characters. */
- if (strchr("*+?{^.$|()[", i) != 0) x += ctype_meta;
+ if (strchr("\\*+?{^.$|()[", i) != 0) x += ctype_meta;
*p++ = x;
}
diff --git a/pcre_newline.c b/pcre_newline.c
new file mode 100644
index 0000000..348791b
--- /dev/null
+++ b/pcre_newline.c
@@ -0,0 +1,135 @@
+/*************************************************
+* Perl-Compatible Regular Expressions *
+*************************************************/
+
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
+
+ Written by Philip Hazel
+ Copyright (c) 1997-2006 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the University of Cambridge nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+
+/* This module contains internal functions for testing newlines when more than
+one kind of newline is to be recognized. When a newline is found, its length is
+returned. In principle, we could implement several newline "types", each
+referring to a different set of newline characters. At present, PCRE supports
+only NLTYPE_FIXED, which gets handled without these functions, and NLTYPE_ALL,
+so for now the type isn't passed into the functions. It can easily be added
+later if required. The full list of Unicode newline characters is taken from
+http://unicode.org/unicode/reports/tr18/. */
+
+
+#include "pcre_internal.h"
+
+
+
+/*************************************************
+* Check for newline at given position *
+*************************************************/
+
+/* It is guaranteed that the initial value of ptr is less than the end of the
+string that is being processed.
+
+Arguments:
+ ptr pointer to possible newline
+ endptr pointer to the end of the string
+ lenptr where to return the length
+ utf8 TRUE if in utf8 mode
+
+Returns: TRUE or FALSE
+*/
+
+BOOL
+_pcre_is_newline(const uschar *ptr, const uschar *endptr, int *lenptr,
+ BOOL utf8)
+{
+int c;
+if (utf8) { GETCHAR(c, ptr); } else c = *ptr;
+switch(c)
+ {
+ case 0x000a: /* LF */
+ case 0x000b: /* VT */
+ case 0x000c: *lenptr = 1; return TRUE; /* FF */
+ case 0x000d: *lenptr = (ptr < endptr - 1 && ptr[1] == 0x0a)? 2 : 1;
+ return TRUE; /* CR */
+ case 0x0085: *lenptr = utf8? 2 : 1; return TRUE; /* NEL */
+ case 0x2028: /* LS */
+ case 0x2029: *lenptr = 3; return TRUE; /* PS */
+ default: return FALSE;
+ }
+}
+
+
+
+/*************************************************
+* Check for newline at previous position *
+*************************************************/
+
+/* It is guaranteed that the initial value of ptr is greater than the start of
+the string that is being processed.
+
+Arguments:
+ ptr pointer to possible newline
+ startptr pointer to the start of the string
+ lenptr where to return the length
+ utf8 TRUE if in utf8 mode
+
+Returns: TRUE or FALSE
+*/
+
+BOOL
+_pcre_was_newline(const uschar *ptr, const uschar *startptr, int *lenptr,
+ BOOL utf8)
+{
+int c;
+ptr--;
+if (utf8)
+ {
+ BACKCHAR(ptr);
+ GETCHAR(c, ptr);
+ }
+else c = *ptr;
+switch(c)
+ {
+ case 0x000a: *lenptr = (ptr > startptr && ptr[-1] == 0x0d)? 2 : 1;
+ return TRUE; /* LF */
+ case 0x000b: /* VT */
+ case 0x000c: /* FF */
+ case 0x000d: *lenptr = 1; return TRUE; /* CR */
+ case 0x0085: *lenptr = utf8? 2 : 1; return TRUE; /* NEL */
+ case 0x2028: /* LS */
+ case 0x2029: *lenptr = 3; return TRUE; /* PS */
+ default: return FALSE;
+ }
+}
+
+/* End of pcre_newline.c */
diff --git a/pcre_printint.src b/pcre_printint.src
index e4de825..a6f4333 100644
--- a/pcre_printint.src
+++ b/pcre_printint.src
@@ -49,9 +49,19 @@ local functions. This source file is used in two places:
compiled regex for debugging purposes. */
+/* Macro that decides whether a character should be output as a literal or in
+hexadecimal. We don't use isprint() because that can vary from system to system
+(even without the use of locales) and we want the output always to be the same,
+for testing purposes. This macro is used in pcretest as well as in this file. */
+
+#define PRINTABLE(c) ((c) >= 32 && (c) < 127)
+
+/* The table of operator names. */
+
static const char *OP_names[] = { OP_NAME_LIST };
+
/*************************************************
* Print single- or multi-byte character *
*************************************************/
@@ -63,7 +73,7 @@ int c = *ptr;
if (!utf8 || (c & 0xc0) != 0xc0)
{
- if (isprint(c)) fprintf(f, "%c", c); else fprintf(f, "\\x%02x", c);
+ if (PRINTABLE(c)) fprintf(f, "%c", c); else fprintf(f, "\\x%02x", c);
return 0;
}
else
@@ -160,16 +170,6 @@ for(;;)
fprintf(f, "%3d ", (int)(code - codestart));
- if (*code >= OP_BRA)
- {
- if (*code - OP_BRA > EXTRACT_BASIC_MAX)
- fprintf(f, "%3d Bra extra\n", GET(code, 1));
- else
- fprintf(f, "%3d Bra %d\n", GET(code, 1), *code - OP_BRA);
- code += _pcre_OP_lengths[OP_BRA];
- continue;
- }
-
switch(*code)
{
case OP_END:
@@ -203,6 +203,14 @@ for(;;)
fprintf(f, "\n");
continue;
+ case OP_CBRA:
+ case OP_SCBRA:
+ fprintf(f, "%3d %s %d", GET(code, 1), OP_names[*code],
+ GET2(code, 1+LINK_SIZE));
+ break;
+
+ case OP_BRA:
+ case OP_SBRA:
case OP_KETRMAX:
case OP_KETRMIN:
case OP_ALT:
@@ -213,33 +221,45 @@ for(;;)
case OP_ASSERTBACK_NOT:
case OP_ONCE:
case OP_COND:
+ case OP_SCOND:
case OP_REVERSE:
fprintf(f, "%3d %s", GET(code, 1), OP_names[*code]);
break;
- case OP_BRANUMBER:
- printf("%3d %s", GET2(code, 1), OP_names[*code]);
+ case OP_CREF:
+ fprintf(f, "%3d %s", GET2(code,1), OP_names[*code]);
break;
- case OP_CREF:
- if (GET2(code, 1) == CREF_RECURSE)
- fprintf(f, " Cond recurse");
+ case OP_RREF:
+ c = GET2(code, 1);
+ if (c == RREF_ANY)
+ fprintf(f, " Cond recurse any");
else
- fprintf(f, "%3d %s", GET2(code,1), OP_names[*code]);
+ fprintf(f, " Cond recurse %d", c);
+ break;
+
+ case OP_DEF:
+ fprintf(f, " Cond def");
break;
case OP_STAR:
case OP_MINSTAR:
+ case OP_POSSTAR:
case OP_PLUS:
case OP_MINPLUS:
+ case OP_POSPLUS:
case OP_QUERY:
case OP_MINQUERY:
+ case OP_POSQUERY:
case OP_TYPESTAR:
case OP_TYPEMINSTAR:
+ case OP_TYPEPOSSTAR:
case OP_TYPEPLUS:
case OP_TYPEMINPLUS:
+ case OP_TYPEPOSPLUS:
case OP_TYPEQUERY:
case OP_TYPEMINQUERY:
+ case OP_TYPEPOSQUERY:
fprintf(f, " ");
if (*code >= OP_TYPESTAR)
{
@@ -257,17 +277,20 @@ for(;;)
case OP_EXACT:
case OP_UPTO:
case OP_MINUPTO:
+ case OP_POSUPTO:
fprintf(f, " ");
extra = print_char(f, code+3, utf8);
fprintf(f, "{");
- if (*code != OP_EXACT) fprintf(f, ",");
+ if (*code != OP_EXACT) fprintf(f, "0,");
fprintf(f, "%d}", GET2(code,1));
if (*code == OP_MINUPTO) fprintf(f, "?");
+ else if (*code == OP_POSUPTO) fprintf(f, "+");
break;
case OP_TYPEEXACT:
case OP_TYPEUPTO:
case OP_TYPEMINUPTO:
+ case OP_TYPEPOSUPTO:
fprintf(f, " %s", OP_names[code[3]]);
if (code[3] == OP_PROP || code[3] == OP_NOTPROP)
{
@@ -278,20 +301,26 @@ for(;;)
if (*code != OP_TYPEEXACT) fprintf(f, "0,");
fprintf(f, "%d}", GET2(code,1));
if (*code == OP_TYPEMINUPTO) fprintf(f, "?");
+ else if (*code == OP_TYPEPOSUPTO) fprintf(f, "+");
break;
case OP_NOT:
- if (isprint(c = code[1])) fprintf(f, " [^%c]", c);
+ c = code[1];
+ if (PRINTABLE(c)) fprintf(f, " [^%c]", c);
else fprintf(f, " [^\\x%02x]", c);
break;
case OP_NOTSTAR:
case OP_NOTMINSTAR:
+ case OP_NOTPOSSTAR:
case OP_NOTPLUS:
case OP_NOTMINPLUS:
+ case OP_NOTPOSPLUS:
case OP_NOTQUERY:
case OP_NOTMINQUERY:
- if (isprint(c = code[1])) fprintf(f, " [^%c]", c);
+ case OP_NOTPOSQUERY:
+ c = code[1];
+ if (PRINTABLE(c)) fprintf(f, " [^%c]", c);
else fprintf(f, " [^\\x%02x]", c);
fprintf(f, "%s", OP_names[*code]);
break;
@@ -299,11 +328,14 @@ for(;;)
case OP_NOTEXACT:
case OP_NOTUPTO:
case OP_NOTMINUPTO:
- if (isprint(c = code[3])) fprintf(f, " [^%c]{", c);
+ case OP_NOTPOSUPTO:
+ c = code[3];
+ if (PRINTABLE(c)) fprintf(f, " [^%c]{", c);
else fprintf(f, " [^\\x%02x]{", c);
if (*code != OP_NOTEXACT) fprintf(f, "0,");
fprintf(f, "%d}", GET2(code,1));
if (*code == OP_NOTMINUPTO) fprintf(f, "?");
+ else if (*code == OP_NOTPOSUPTO) fprintf(f, "+");
break;
case OP_RECURSE:
@@ -363,12 +395,14 @@ for(;;)
for (j = i+1; j < 256; j++)
if ((ccode[j/8] & (1 << (j&7))) == 0) break;
if (i == '-' || i == ']') fprintf(f, "\\");
- if (isprint(i)) fprintf(f, "%c", i); else fprintf(f, "\\x%02x", i);
+ if (PRINTABLE(i)) fprintf(f, "%c", i);
+ else fprintf(f, "\\x%02x", i);
if (--j > i)
{
if (j != i + 1) fprintf(f, "-");
if (j == '-' || j == ']') fprintf(f, "\\");
- if (isprint(j)) fprintf(f, "%c", j); else fprintf(f, "\\x%02x", j);
+ if (PRINTABLE(j)) fprintf(f, "%c", j);
+ else fprintf(f, "\\x%02x", j);
}
i = j;
}
diff --git a/pcre_scanner.cc b/pcre_scanner.cc
index 29e0d84..bdc8d4d 100644
--- a/pcre_scanner.cc
+++ b/pcre_scanner.cc
@@ -43,6 +43,7 @@ Scanner::Scanner()
input_(data_),
skip_(NULL),
should_skip_(false),
+ skip_repeat_(false),
save_comments_(false),
comments_(NULL),
comments_offset_(0) {
@@ -53,6 +54,7 @@ Scanner::Scanner(const string& in)
input_(data_),
skip_(NULL),
should_skip_(false),
+ skip_repeat_(false),
save_comments_(false),
comments_(NULL),
comments_offset_(0) {
@@ -63,15 +65,31 @@ Scanner::~Scanner() {
delete comments_;
}
+void Scanner::SetSkipExpression(const char* re) {
+ delete skip_;
+ if (re != NULL) {
+ skip_ = new RE(re);
+ should_skip_ = true;
+ skip_repeat_ = true;
+ ConsumeSkip();
+ } else {
+ skip_ = NULL;
+ should_skip_ = false;
+ skip_repeat_ = false;
+ }
+}
+
void Scanner::Skip(const char* re) {
delete skip_;
if (re != NULL) {
skip_ = new RE(re);
should_skip_ = true;
+ skip_repeat_ = false;
ConsumeSkip();
} else {
skip_ = NULL;
should_skip_ = false;
+ skip_repeat_ = false;
}
}
@@ -118,19 +136,22 @@ bool Scanner::Consume(const RE& re,
// helper function to consume *skip_ and honour save_comments_
void Scanner::ConsumeSkip() {
+ const char* start_data = input_.data();
+ while (skip_->Consume(&input_)) {
+ if (!skip_repeat_) {
+ // Only one skip allowed.
+ break;
+ }
+ }
if (save_comments_) {
- if (NULL == comments_) {
+ if (comments_ == NULL) {
comments_ = new vector<StringPiece>;
}
- const char *start_data = input_.data();
- skip_->Consume(&input_);
// already pointing one past end, so no need to +1
int length = input_.data() - start_data;
if (length > 0) {
comments_->push_back(StringPiece(start_data, length));
}
- } else {
- skip_->Consume(&input_);
}
}
diff --git a/pcre_scanner.h b/pcre_scanner.h
index a73b72f..ab4583e 100644
--- a/pcre_scanner.h
+++ b/pcre_scanner.h
@@ -36,7 +36,7 @@
// Scanner scanner(input);
// string var;
// int number;
-// scanner.Skip("\\s+"); // Skip any white space we encounter
+// scanner.SetSkipExpression("\\s+"); // Skip any white space we encounter
// while (scanner.Consume("(\\w+) = (\\d+)", &var, &number)) {
// ...;
// }
@@ -90,10 +90,16 @@ class Scanner {
// skipped. For example, a programming language scanner would use
// a skip RE that matches white space and comments.
//
- // scanner.Skip("(\\s|//.*|/[*](.|\n)*?[*]/)*");
+ // scanner.SetSkipExpression("\\s+|//.*|/[*](.|\n)*?[*]/");
+ //
+ // Skipping repeats as long as it succeeds. We used to let people do
+ // this by writing "(...)*" in the regular expression, but that added
+ // up to lots of recursive calls within the pcre library, so now we
+ // control repetition explicitly via the function call API.
//
// You can pass NULL for "re" if you do not want any data to be skipped.
- void Skip(const char* re);
+ void Skip(const char* re); // DEPRECATED; does *not* repeat
+ void SetSkipExpression(const char* re);
// Temporarily pause "skip"ing. This
// Skip("Foo"); code ; DisableSkip(); code; EnableSkip()
@@ -109,12 +115,13 @@ class Scanner {
/***** Special wrappers around SetSkip() for some common idioms *****/
// Arranges to skip whitespace, C comments, C++ comments.
- // The overall RE is a repeated disjunction of the following REs:
+ // The overall RE is a disjunction of the following REs:
// \\s whitespace
// //.*\n C++ comment
// /[*](.|\n)*?[*]/ C comment (x*? means minimal repetitions of x)
+ // We get repetition via the semantics of SetSkipExpression, not by using *
void SkipCXXComments() {
- Skip("((\\s|//.*\n|/[*](.|\n)*?[*]/)*)");
+ SetSkipExpression("\\s|//.*\n|/[*](?:\n|.)*?[*]/");
}
void set_save_comments(bool comments) {
@@ -143,6 +150,7 @@ class Scanner {
StringPiece input_; // Unprocessed input
RE* skip_; // If non-NULL, RE for skipping input
bool should_skip_; // If true, use skip_
+ bool skip_repeat_; // If true, repeat skip_ as long as it works
bool save_comments_; // If true, aggregate the skip expression
// the skipped comments
diff --git a/pcre_scanner_unittest.cc b/pcre_scanner_unittest.cc
index 756823c..d939fed 100644
--- a/pcre_scanner_unittest.cc
+++ b/pcre_scanner_unittest.cc
@@ -33,10 +33,13 @@
// functionality.
#include <stdio.h>
+#include <string>
#include <vector>
#include <pcre_stringpiece.h>
#include <pcre_scanner.h>
+#define FLAGS_unittest_stack_size 49152
+
// Dies with a fatal error if the two values are not equal.
#define CHECK_EQ(a, b) do { \
if ( (a) != (b) ) { \
@@ -116,8 +119,31 @@ static void TestScanner() {
comments.resize(0);
}
+static void TestBigComment() {
+ string input;
+ for (int i = 0; i < 1024; ++i) {
+ char buf[1024];
+ snprintf(buf, sizeof(buf), " # Comment %d\n", i);
+ input += buf;
+ }
+ input += "name = value;\n";
+
+ Scanner s(input.c_str());
+ s.SetSkipExpression("\\s+|#.*\n");
+
+ string name;
+ string value;
+ s.Consume("(\\w+) = (\\w+);", &name, &value);
+ CHECK_EQ(name, "name");
+ CHECK_EQ(value, "value");
+}
+
+// TODO: also test scanner and big-comment in a thread with a
+// small stack size
+
int main(int argc, char** argv) {
TestScanner();
+ TestBigComment();
// Done
printf("OK\n");
diff --git a/pcre_study.c b/pcre_study.c
index 5091324..87f8c6f 100644
--- a/pcre_study.c
+++ b/pcre_study.c
@@ -45,6 +45,11 @@ supporting functions. */
#include "pcre_internal.h"
+/* Returns from set_start_bits() */
+
+enum { SSB_FAIL, SSB_DONE, SSB_CONTINUE };
+
+
/*************************************************
* Set a bit and maybe its alternate case *
*************************************************/
@@ -72,12 +77,16 @@ if (caseless && (cd->ctypes[c] & ctype_letter) != 0)
/*************************************************
-* Create bitmap of starting chars *
+* Create bitmap of starting bytes *
*************************************************/
-/* This function scans a compiled unanchored expression and attempts to build a
-bitmap of the set of initial characters. If it can't, it returns FALSE. As time
-goes by, we may be able to get more clever at doing this.
+/* This function scans a compiled unanchored expression recursively and
+attempts to build a bitmap of the set of possible starting bytes. As time goes
+by, we may be able to get more clever at doing this. The SSB_CONTINUE return is
+useful for parenthesized groups in patterns such as (a*)b where the group
+provides some optional starting bytes but scanning must continue at the outer
+level to find at least one mandatory byte. At the outermost level, this
+function fails unless the result is SSB_DONE.
Arguments:
code points to an expression
@@ -86,14 +95,17 @@ Arguments:
utf8 TRUE if in UTF-8 mode
cd the block with char table pointers
-Returns: TRUE if table built, FALSE otherwise
+Returns: SSB_FAIL => Failed to find any starting bytes
+ SSB_DONE => Found mandatory starting bytes
+ SSB_CONTINUE => Found optional starting bytes
*/
-static BOOL
+static int
set_start_bits(const uschar *code, uschar *start_bits, BOOL caseless,
BOOL utf8, compile_data *cd)
{
register int c;
+int yield = SSB_DONE;
#if 0
/* ========================================================================= */
@@ -114,36 +126,60 @@ volatile int dummy;
do
{
- const uschar *tcode = code + 1 + LINK_SIZE;
+ const uschar *tcode = code + (((int)*code == OP_CBRA)? 3:1) + LINK_SIZE;
BOOL try_next = TRUE;
- while (try_next)
+ while (try_next) /* Loop for items in this branch */
{
- /* If a branch starts with a bracket or a positive lookahead assertion,
- recurse to set bits from within them. That's all for this branch. */
-
- if ((int)*tcode >= OP_BRA || *tcode == OP_ASSERT)
+ int rc;
+ switch(*tcode)
{
- if (!set_start_bits(tcode, start_bits, caseless, utf8, cd))
- return FALSE;
- try_next = FALSE;
- }
+ /* Fail if we reach something we don't understand */
- else switch(*tcode)
- {
default:
- return FALSE;
+ return SSB_FAIL;
+
+ /* If we hit a bracket or a positive lookahead assertion, recurse to set
+ bits from within the subpattern. If it can't find anything, we have to
+ give up. If it finds some mandatory character(s), we are done for this
+ branch. Otherwise, carry on scanning after the subpattern. */
+
+ case OP_BRA:
+ case OP_SBRA:
+ case OP_CBRA:
+ case OP_SCBRA:
+ case OP_ONCE:
+ case OP_ASSERT:
+ rc = set_start_bits(tcode, start_bits, caseless, utf8, cd);
+ if (rc == SSB_FAIL) return SSB_FAIL;
+ if (rc == SSB_DONE) try_next = FALSE; else
+ {
+ do tcode += GET(tcode, 1); while (*tcode == OP_ALT);
+ tcode += 1 + LINK_SIZE;
+ }
+ break;
- /* Skip over callout */
+ /* If we hit ALT or KET, it means we haven't found anything mandatory in
+ this branch, though we might have found something optional. For ALT, we
+ continue with the next alternative, but we have to arrange that the final
+ result from subpattern is SSB_CONTINUE rather than SSB_DONE. For KET,
+ return SSB_CONTINUE: if this is the top level, that indicates failure,
+ but after a nested subpattern, it causes scanning to continue. */
- case OP_CALLOUT:
- tcode += 2 + 2*LINK_SIZE;
+ case OP_ALT:
+ yield = SSB_CONTINUE;
+ try_next = FALSE;
break;
- /* Skip over extended extraction bracket number */
+ case OP_KET:
+ case OP_KETRMAX:
+ case OP_KETRMIN:
+ return SSB_CONTINUE;
- case OP_BRANUMBER:
- tcode += 3;
+ /* Skip over callout */
+
+ case OP_CALLOUT:
+ tcode += 2 + 2*LINK_SIZE;
break;
/* Skip over lookbehind and negative lookahead assertions */
@@ -152,7 +188,7 @@ do
case OP_ASSERTBACK:
case OP_ASSERTBACK_NOT:
do tcode += GET(tcode, 1); while (*tcode == OP_ALT);
- tcode += 1+LINK_SIZE;
+ tcode += 1 + LINK_SIZE;
break;
/* Skip over an option setting, changing the caseless flag */
@@ -166,27 +202,30 @@ do
case OP_BRAZERO:
case OP_BRAMINZERO:
- if (!set_start_bits(++tcode, start_bits, caseless, utf8, cd))
- return FALSE;
+ if (set_start_bits(++tcode, start_bits, caseless, utf8, cd) == SSB_FAIL)
+ return SSB_FAIL;
/* =========================================================================
See the comment at the head of this function concerning the next line,
which was an old fudge for the benefit of OS/2.
dummy = 1;
========================================================================= */
do tcode += GET(tcode,1); while (*tcode == OP_ALT);
- tcode += 1+LINK_SIZE;
+ tcode += 1 + LINK_SIZE;
break;
/* Single-char * or ? sets the bit and tries the next item */
case OP_STAR:
case OP_MINSTAR:
+ case OP_POSSTAR:
case OP_QUERY:
case OP_MINQUERY:
+ case OP_POSQUERY:
set_bit(start_bits, tcode[1], caseless, cd);
tcode += 2;
#ifdef SUPPORT_UTF8
- if (utf8) while ((*tcode & 0xc0) == 0x80) tcode++;
+ if (utf8 && tcode[-1] >= 0xc0)
+ tcode += _pcre_utf8_table4[tcode[-1] & 0x3f];
#endif
break;
@@ -194,10 +233,12 @@ do
case OP_UPTO:
case OP_MINUPTO:
+ case OP_POSUPTO:
set_bit(start_bits, tcode[3], caseless, cd);
tcode += 4;
#ifdef SUPPORT_UTF8
- if (utf8) while ((*tcode & 0xc0) == 0x80) tcode++;
+ if (utf8 && tcode[-1] >= 0xc0)
+ tcode += _pcre_utf8_table4[tcode[-1] & 0x3f];
#endif
break;
@@ -210,6 +251,7 @@ do
case OP_CHARNC:
case OP_PLUS:
case OP_MINPLUS:
+ case OP_POSPLUS:
set_bit(start_bits, tcode[1], caseless, cd);
try_next = FALSE;
break;
@@ -283,16 +325,19 @@ do
case OP_TYPEUPTO:
case OP_TYPEMINUPTO:
+ case OP_TYPEPOSUPTO:
tcode += 2; /* Fall through */
case OP_TYPESTAR:
case OP_TYPEMINSTAR:
+ case OP_TYPEPOSSTAR:
case OP_TYPEQUERY:
case OP_TYPEMINQUERY:
+ case OP_TYPEPOSQUERY:
switch(tcode[1])
{
case OP_ANY:
- return FALSE;
+ return SSB_FAIL;
case OP_NOT_DIGIT:
for (c = 0; c < 32; c++)
@@ -418,7 +463,7 @@ do
code += GET(code, 1); /* Advance to next branch */
}
while (*code == OP_ALT);
-return TRUE;
+return yield;
}
@@ -492,8 +537,8 @@ compile_block.ctypes = tables + ctypes_offset;
/* See if we can find a fixed set of initial characters for the pattern. */
memset(start_bits, 0, 32 * sizeof(uschar));
-if (!set_start_bits(code, start_bits, (re->options & PCRE_CASELESS) != 0,
- (re->options & PCRE_UTF8) != 0, &compile_block)) return NULL;
+if (set_start_bits(code, start_bits, (re->options & PCRE_CASELESS) != 0,
+ (re->options & PCRE_UTF8) != 0, &compile_block) != SSB_DONE) return NULL;
/* Get a pcre_extra block and a pcre_study_data block. The study data is put in
the latter, which is pointed to by the former, which may also get additional
diff --git a/pcre_tables.c b/pcre_tables.c
index 480257c..53690d7 100644
--- a/pcre_tables.c
+++ b/pcre_tables.c
@@ -72,9 +72,8 @@ first byte of a character, indexed by the number of additional bytes. */
const int _pcre_utf8_table2[] = { 0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc};
const int _pcre_utf8_table3[] = { 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01};
-/* Table of the number of extra characters, indexed by the first character
-masked with 0x3f. The highest number for a valid UTF-8 character is in fact
-0x3d. */
+/* Table of the number of extra bytes, indexed by the first byte masked with
+0x3f. The highest number for a valid UTF-8 first byte is in fact 0x3d. */
const uschar _pcre_utf8_table4[] = {
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
@@ -89,6 +88,7 @@ const ucp_type_table _pcre_utt[] = {
{ "Any", PT_ANY, 0 },
{ "Arabic", PT_SC, ucp_Arabic },
{ "Armenian", PT_SC, ucp_Armenian },
+ { "Balinese", PT_SC, ucp_Balinese },
{ "Bengali", PT_SC, ucp_Bengali },
{ "Bopomofo", PT_SC, ucp_Bopomofo },
{ "Braille", PT_SC, ucp_Braille },
@@ -104,6 +104,7 @@ const ucp_type_table _pcre_utt[] = {
{ "Common", PT_SC, ucp_Common },
{ "Coptic", PT_SC, ucp_Coptic },
{ "Cs", PT_PC, ucp_Cs },
+ { "Cuneiform", PT_SC, ucp_Cuneiform },
{ "Cypriot", PT_SC, ucp_Cypriot },
{ "Cyrillic", PT_SC, ucp_Cyrillic },
{ "Deseret", PT_SC, ucp_Deseret },
@@ -146,6 +147,7 @@ const ucp_type_table _pcre_utt[] = {
{ "N", PT_GC, ucp_N },
{ "Nd", PT_PC, ucp_Nd },
{ "New_Tai_Lue", PT_SC, ucp_New_Tai_Lue },
+ { "Nko", PT_SC, ucp_Nko },
{ "Nl", PT_PC, ucp_Nl },
{ "No", PT_PC, ucp_No },
{ "Ogham", PT_SC, ucp_Ogham },
@@ -158,6 +160,8 @@ const ucp_type_table _pcre_utt[] = {
{ "Pd", PT_PC, ucp_Pd },
{ "Pe", PT_PC, ucp_Pe },
{ "Pf", PT_PC, ucp_Pf },
+ { "Phags_Pa", PT_SC, ucp_Phags_Pa },
+ { "Phoenician", PT_SC, ucp_Phoenician },
{ "Pi", PT_PC, ucp_Pi },
{ "Po", PT_PC, ucp_Po },
{ "Ps", PT_PC, ucp_Ps },
diff --git a/pcre_ucp_searchfuncs.c b/pcre_ucp_searchfuncs.c
index 7a4be94..20bb7be 100644
--- a/pcre_ucp_searchfuncs.c
+++ b/pcre_ucp_searchfuncs.c
@@ -131,11 +131,11 @@ letter, return the other case. Otherwise, return -1.
Arguments:
c the character value
-Returns: the other case or -1 if none
+Returns: the other case or NOTACHAR if none
*/
-int
-_pcre_ucp_othercase(const int c)
+unsigned int
+_pcre_ucp_othercase(const unsigned int c)
{
int bot = 0;
int top = sizeof(ucp_table)/sizeof(cnode);
@@ -161,14 +161,14 @@ for (;;)
}
}
-/* Found an entry in the table. Return -1 for a range entry. Otherwise return
-the other case if there is one, else -1. */
+/* Found an entry in the table. Return NOTACHAR for a range entry. Otherwise
+return the other case if there is one, else NOTACHAR. */
-if ((ucp_table[mid].f0 & f0_rangeflag) != 0) return -1;
+if ((ucp_table[mid].f0 & f0_rangeflag) != 0) return NOTACHAR;
offset = ucp_table[mid].f1 & f1_casemask;
if ((offset & f1_caseneg) != 0) offset |= f1_caseneg;
-return (offset == 0)? -1 : c + offset;
+return (offset == 0)? NOTACHAR : c + offset;
}
diff --git a/pcre_valid_utf8.c b/pcre_valid_utf8.c
index 1c6094a..727fbe8 100644
--- a/pcre_valid_utf8.c
+++ b/pcre_valid_utf8.c
@@ -79,7 +79,7 @@ for (p = string; length-- > 0; p++)
register int ab;
register int c = *p;
if (c < 128) continue;
- if ((c & 0xc0) != 0xc0) return p - string;
+ if (c < 0xc0) return p - string;
ab = _pcre_utf8_table4[c & 0x3f]; /* Number of additional bytes */
if (length < ab) return p - string;
length -= ab;
diff --git a/pcre_version.c b/pcre_version.c
index c2aad4d..9edf3e0 100644
--- a/pcre_version.c
+++ b/pcre_version.c
@@ -49,16 +49,38 @@ string that identifies the PCRE version that is in use. */
* Return version string *
*************************************************/
+/* These macros are the standard way of turning unquoted text into C strings.
+They allow macros like PCRE_MAJOR to be defined without quotes, which is
+convenient for user programs that want to test its value. */
+
#define STRING(a) # a
#define XSTRING(s) STRING(s)
+/* A problem turned up with PCRE_PRERELEASE, which is defined empty for
+production releases. Originally, it was used naively in this code:
+
+ return XSTRING(PCRE_MAJOR)
+ "." XSTRING(PCRE_MINOR)
+ XSTRING(PCRE_PRERELEASE)
+ " " XSTRING(PCRE_DATE);
+
+However, when PCRE_PRERELEASE is empty, this leads to an attempted expansion of
+STRING(). The C standard states: "If (before argument substitution) any
+argument consists of no preprocessing tokens, the behavior is undefined." It
+turns out the gcc treats this case as a single empty string - which is what we
+really want - but Visual C grumbles about the lack of an argument for the
+macro. Unfortunately, both are within their rights. To cope with both ways of
+handling this, I had resort to some messy hackery that does a test at run time.
+I could find no way of detecting that a macro is defined as an empty string at
+pre-processor time. This hack uses a standard trick for avoiding calling
+the STRING macro with an empty argument when doing the test. */
+
PCRE_DATA_SCOPE const char *
pcre_version(void)
{
-return XSTRING(PCRE_MAJOR)
- "." XSTRING(PCRE_MINOR)
- XSTRING(PCRE_PRERELEASE)
- " " XSTRING(PCRE_DATE);
+return (XSTRING(Z PCRE_PRERELEASE)[1] == 0)?
+ XSTRING(PCRE_MAJOR.PCRE_MINOR PCRE_DATE) :
+ XSTRING(PCRE_MAJOR.PCRE_MINOR) XSTRING(PCRE_PRERELEASE PCRE_DATE);
}
/* End of pcre_version.c */
diff --git a/pcrecpp.cc b/pcrecpp.cc
index f828de7..b75738b 100644
--- a/pcrecpp.cc
+++ b/pcrecpp.cc
@@ -61,7 +61,7 @@ static const string empty_string;
// If the user doesn't ask for any options, we just use this one
static RE_Options default_options;
-void RE::Init(const char* pat, const RE_Options* options) {
+void RE::Init(const string& pat, const RE_Options* options) {
pattern_ = pat;
if (options == NULL) {
options_ = default_options;
@@ -78,7 +78,7 @@ void RE::Init(const char* pat, const RE_Options* options) {
// conservative in that it may treat some "simple" patterns
// as "complex" (e.g., if the vertical bar is in a character
// class or is escaped). But it seems good enough.
- if (strchr(pat, '|') == NULL) {
+ if (strchr(pat.c_str(), '|') == NULL) {
// Simple pattern: we can use position-based checks to perform
// fully anchored matches
re_full_ = re_partial_;
@@ -89,12 +89,18 @@ void RE::Init(const char* pat, const RE_Options* options) {
}
}
-RE::~RE() {
+void RE::Cleanup() {
if (re_full_ != NULL && re_full_ != re_partial_) (*pcre_free)(re_full_);
if (re_partial_ != NULL) (*pcre_free)(re_partial_);
if (error_ != &empty_string) delete error_;
}
+
+RE::~RE() {
+ Cleanup();
+}
+
+
pcre* RE::Compile(Anchor anchor) {
// First, convert RE_Options into pcre options
int pcre_options = 0;
@@ -424,6 +430,34 @@ bool RE::Extract(const StringPiece& rewrite,
return Rewrite(out, rewrite, text, vec, matches);
}
+/*static*/ string RE::QuoteMeta(const StringPiece& unquoted) {
+ string result;
+
+ // Escape any ascii character not in [A-Za-z_0-9].
+ //
+ // Note that it's legal to escape a character even if it has no
+ // special meaning in a regular expression -- so this function does
+ // that. (This also makes it identical to the perl function of the
+ // same name; see `perldoc -f quotemeta`.)
+ for (int ii = 0; ii < unquoted.size(); ++ii) {
+ // Note that using 'isalnum' here raises the benchmark time from
+ // 32ns to 58ns:
+ if ((unquoted[ii] < 'a' || unquoted[ii] > 'z') &&
+ (unquoted[ii] < 'A' || unquoted[ii] > 'Z') &&
+ (unquoted[ii] < '0' || unquoted[ii] > '9') &&
+ unquoted[ii] != '_' &&
+ // If this is the part of a UTF8 or Latin1 character, we need
+ // to copy this byte without escaping. Experimentally this is
+ // what works correctly with the regexp library.
+ !(unquoted[ii] & 128)) {
+ result += '\\';
+ }
+ result += unquoted[ii];
+ }
+
+ return result;
+}
+
/***** Actual matching and rewriting code *****/
int RE::TryMatch(const StringPiece& text,
@@ -809,14 +843,14 @@ bool Arg::parse_float(const char* str, int n, void* dest) {
return parse_##name##_radix(str, n, dest, 0); \
}
-DEFINE_INTEGER_PARSERS(short);
-DEFINE_INTEGER_PARSERS(ushort);
-DEFINE_INTEGER_PARSERS(int);
-DEFINE_INTEGER_PARSERS(uint);
-DEFINE_INTEGER_PARSERS(long);
-DEFINE_INTEGER_PARSERS(ulong);
-DEFINE_INTEGER_PARSERS(longlong);
-DEFINE_INTEGER_PARSERS(ulonglong);
+DEFINE_INTEGER_PARSERS(short) /* */
+DEFINE_INTEGER_PARSERS(ushort) /* */
+DEFINE_INTEGER_PARSERS(int) /* Don't use semicolons after these */
+DEFINE_INTEGER_PARSERS(uint) /* statements because they can cause */
+DEFINE_INTEGER_PARSERS(long) /* compiler warnings if the checking */
+DEFINE_INTEGER_PARSERS(ulong) /* level is turned up high enough. */
+DEFINE_INTEGER_PARSERS(longlong) /* */
+DEFINE_INTEGER_PARSERS(ulonglong) /* */
#undef DEFINE_INTEGER_PARSERS
diff --git a/pcrecpp.h b/pcrecpp.h
index 5916d86..e3f1b71 100644
--- a/pcrecpp.h
+++ b/pcrecpp.h
@@ -112,6 +112,12 @@
// T (where "bool T::ParseFrom(const char*, int)" exists)
// NULL (the corresponding matched sub-pattern is not copied)
//
+// CAVEAT: An optional sub-pattern that does not exist in the matched
+// string is assigned the empty string. Therefore, the following will
+// return false (because the empty string is not a valid number):
+// int number;
+// pcrecpp::RE::FullMatch("abc", "[a-z]+(\\d+)?", &number);
+//
// -----------------------------------------------------------------------
// DO_MATCH
//
@@ -488,8 +494,25 @@ class RE {
// pass in a string or a "const char*" wherever an "RE" is expected.
RE(const char* pat) { Init(pat, NULL); }
RE(const char *pat, const RE_Options& option) { Init(pat, &option); }
- RE(const string& pat) { Init(pat.c_str(), NULL); }
- RE(const string& pat, const RE_Options& option) { Init(pat.c_str(), &option); }
+ RE(const string& pat) { Init(pat, NULL); }
+ RE(const string& pat, const RE_Options& option) { Init(pat, &option); }
+
+ // Copy constructor & assignment - note that these are expensive
+ // because they recompile the expression.
+ RE(const RE& re) { Init(re.pattern_, &re.options_); }
+ const RE& operator=(const RE& re) {
+ if (this != &re) {
+ Cleanup();
+
+ // This is the code that originally came from Google
+ // Init(re.pattern_.c_str(), &re.options_);
+
+ // This is the replacement from Ari Pollak
+ Init(re.pattern_, &re.options_);
+ }
+ return *this;
+ }
+
~RE();
@@ -589,6 +612,15 @@ class RE {
const StringPiece &text,
string *out) const;
+ // Escapes all potentially meaningful regexp characters in
+ // 'unquoted'. The returned string, used as a regular expression,
+ // will exactly match the original string. For example,
+ // 1.5-2.0?
+ // may become:
+ // 1\.5\-2\.0\?
+ static string QuoteMeta(const StringPiece& unquoted);
+
+
/***** Generic matching interface *****/
// Type of match (TODO: Should be restructured as part of RE_Options)
@@ -611,7 +643,8 @@ class RE {
private:
- void Init(const char* pattern, const RE_Options* options);
+ void Init(const string& pattern, const RE_Options* options);
+ void Cleanup();
// Match against "text", filling in "vec" (up to "vecsize" * 2/3) with
// pairs of integers for the beginning and end positions of matched
@@ -655,11 +688,6 @@ class RE {
pcre* re_full_; // For full matches
pcre* re_partial_; // For partial matches
const string* error_; // Error indicator (or points to empty string)
-
- // Don't allow the default copy or assignment constructors --
- // they're expensive and too easy to do by accident.
- RE(const RE&);
- void operator=(const RE&);
};
} // namespace pcrecpp
diff --git a/pcrecpp_unittest.cc b/pcrecpp_unittest.cc
index ccd876d..858728c 100644
--- a/pcrecpp_unittest.cc
+++ b/pcrecpp_unittest.cc
@@ -1,4 +1,6 @@
-// Copyright (c) 2005, Google Inc.
+// -*- coding: utf-8 -*-
+//
+// Copyright (c) 2005 - 2006, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -445,6 +447,80 @@ static void TestRecursion() {
CHECK(re4.FullMatch(text_bad) == false);
}
+// A meta-quoted string, interpreted as a pattern, should always match
+// the original unquoted string.
+static void TestQuoteMeta(string unquoted, RE_Options options = RE_Options()) {
+ string quoted = RE::QuoteMeta(unquoted);
+ RE re(quoted, options);
+ CHECK(re.FullMatch(unquoted));
+}
+
+// A string containing meaningful regexp characters, which is then meta-
+// quoted, should not generally match a string the unquoted string does.
+static void NegativeTestQuoteMeta(string unquoted, string should_not_match,
+ RE_Options options = RE_Options()) {
+ string quoted = RE::QuoteMeta(unquoted);
+ RE re(quoted, options);
+ CHECK(!re.FullMatch(should_not_match));
+}
+
+// Tests that quoted meta characters match their original strings,
+// and that a few things that shouldn't match indeed do not.
+static void TestQuotaMetaSimple() {
+ TestQuoteMeta("foo");
+ TestQuoteMeta("foo.bar");
+ TestQuoteMeta("foo\\.bar");
+ TestQuoteMeta("[1-9]");
+ TestQuoteMeta("1.5-2.0?");
+ TestQuoteMeta("\\d");
+ TestQuoteMeta("Who doesn't like ice cream?");
+ TestQuoteMeta("((a|b)c?d*e+[f-h]i)");
+ TestQuoteMeta("((?!)xxx).*yyy");
+ TestQuoteMeta("([");
+}
+
+static void TestQuoteMetaSimpleNegative() {
+ NegativeTestQuoteMeta("foo", "bar");
+ NegativeTestQuoteMeta("...", "bar");
+ NegativeTestQuoteMeta("\\.", ".");
+ NegativeTestQuoteMeta("\\.", "..");
+ NegativeTestQuoteMeta("(a)", "a");
+ NegativeTestQuoteMeta("(a|b)", "a");
+ NegativeTestQuoteMeta("(a|b)", "(a)");
+ NegativeTestQuoteMeta("(a|b)", "a|b");
+ NegativeTestQuoteMeta("[0-9]", "0");
+ NegativeTestQuoteMeta("[0-9]", "0-9");
+ NegativeTestQuoteMeta("[0-9]", "[9]");
+ NegativeTestQuoteMeta("((?!)xxx)", "xxx");
+}
+
+static void TestQuoteMetaLatin1() {
+ TestQuoteMeta("3\xb2 = 9");
+}
+
+static void TestQuoteMetaUtf8() {
+#ifdef SUPPORT_UTF8
+ TestQuoteMeta("Pl\xc3\xa1\x63ido Domingo", pcrecpp::UTF8());
+ TestQuoteMeta("xyz", pcrecpp::UTF8()); // No fancy utf8
+ TestQuoteMeta("\xc2\xb0", pcrecpp::UTF8()); // 2-byte utf8 (degree symbol)
+ TestQuoteMeta("27\xc2\xb0 degrees", pcrecpp::UTF8()); // As a middle character
+ TestQuoteMeta("\xe2\x80\xb3", pcrecpp::UTF8()); // 3-byte utf8 (double prime)
+ TestQuoteMeta("\xf0\x9d\x85\x9f", pcrecpp::UTF8()); // 4-byte utf8 (music note)
+ TestQuoteMeta("27\xc2\xb0"); // Interpreted as Latin-1, but should still work
+ NegativeTestQuoteMeta("27\xc2\xb0", // 2-byte utf (degree symbol)
+ "27\\\xc2\\\xb0",
+ pcrecpp::UTF8());
+#endif
+}
+
+static void TestQuoteMetaAll() {
+ printf("Testing QuoteMeta\n");
+ TestQuotaMetaSimple();
+ TestQuoteMetaSimpleNegative();
+ TestQuoteMetaLatin1();
+ TestQuoteMetaUtf8();
+}
+
//
// Options tests contributed by
// Giuseppe Maxia, CTO, Stardata s.r.l.
@@ -667,6 +743,35 @@ static void TestOptions() {
Test_all_options();
}
+static void TestConstructors() {
+ printf("Testing constructors\n");
+
+ RE_Options options;
+ options.set_dotall(true);
+ const char *str = "HELLO\n" "cruel\n" "world";
+
+ RE orig("HELLO.*world", options);
+ CHECK(orig.FullMatch(str));
+
+ RE copy1(orig);
+ CHECK(copy1.FullMatch(str));
+
+ RE copy2("not a match");
+ CHECK(!copy2.FullMatch(str));
+ copy2 = copy1;
+ CHECK(copy2.FullMatch(str));
+ copy2 = orig;
+ CHECK(copy2.FullMatch(str));
+
+ // Make sure when we assign to ourselves, nothing bad happens
+ orig = orig;
+ copy1 = copy1;
+ copy2 = copy2;
+ CHECK(orig.FullMatch(str));
+ CHECK(copy1.FullMatch(str));
+ CHECK(copy2.FullMatch(str));
+}
+
int main(int argc, char** argv) {
// Treat any flag as --help
if (argc > 1 && argv[1][0] == '-') {
@@ -985,11 +1090,14 @@ int main(int argc, char** argv) {
CHECK(RE("h.*o").PartialMatch("hello!"));
CHECK(RE("((((((((((((((((((((x))))))))))))))))))))").PartialMatch("x"));
+ /***** other tests *****/
+
RadixTests();
TestReplace();
TestExtract();
TestConsume();
TestFindAndConsume();
+ TestQuoteMetaAll();
TestMatchNumberPeculiarity();
// Check the pattern() accessor
@@ -1109,6 +1217,9 @@ int main(int argc, char** argv) {
VERBOSE_TEST = true;
TestOptions();
+ // Test the constructors
+ TestConstructors();
+
// Done
printf("OK\n");
diff --git a/pcrecpparg.h.in b/pcrecpparg.h.in
index ad17296..3e866cf 100644
--- a/pcrecpparg.h.in
+++ b/pcrecpparg.h.in
@@ -148,17 +148,17 @@ inline bool Arg::Parse(const char* str, int n) const {
inline Arg CRadix(type* ptr) { \
return Arg(ptr, Arg::parse_ ## name ## _cradix); }
-MAKE_INTEGER_PARSER(short, short);
-MAKE_INTEGER_PARSER(unsigned short, ushort);
-MAKE_INTEGER_PARSER(int, int);
-MAKE_INTEGER_PARSER(unsigned int, uint);
-MAKE_INTEGER_PARSER(long, long);
-MAKE_INTEGER_PARSER(unsigned long, ulong);
-#if @pcre_have_long_long@
-MAKE_INTEGER_PARSER(long long, longlong);
-#endif
-#if @pcre_have_ulong_long@
-MAKE_INTEGER_PARSER(unsigned long long, ulonglong);
+MAKE_INTEGER_PARSER(short, short) /* */
+MAKE_INTEGER_PARSER(unsigned short, ushort) /* */
+MAKE_INTEGER_PARSER(int, int) /* Don't use semicolons */
+MAKE_INTEGER_PARSER(unsigned int, uint) /* after these statement */
+MAKE_INTEGER_PARSER(long, long) /* because they can cause */
+MAKE_INTEGER_PARSER(unsigned long, ulong) /* compiler warnings if */
+#if @pcre_have_long_long@ /* the checking level is */
+MAKE_INTEGER_PARSER(long long, longlong) /* turned up high enough. */
+#endif /* */
+#if @pcre_have_ulong_long@ /* */
+MAKE_INTEGER_PARSER(unsigned long long, ulonglong) /* */
#endif
#undef PCRE_IS_SET
diff --git a/pcregrep.c b/pcregrep.c
index 001588b..0e57e56 100644
--- a/pcregrep.c
+++ b/pcregrep.c
@@ -56,7 +56,7 @@ POSSIBILITY OF SUCH DAMAGE.
typedef int BOOL;
-#define VERSION "4.3 01-Jun-2006"
+#define VERSION "4.4 29-Nov-2006"
#define MAX_PATTERN_COUNT 100
#if BUFSIZ > 8192
@@ -65,7 +65,6 @@ typedef int BOOL;
#define MBUFTHIRD 8192
#endif
-
/* Values for the "filenames" variable, which specifies options for file name
output. The order is important; it is assumed that a file name is wanted for
all values greater than FN_DEFAULT. */
@@ -83,6 +82,10 @@ enum { DEE_READ, DEE_SKIP };
#define PO_LINE_MATCH 0x0002
#define PO_FIXED_STRINGS 0x0004
+/* Line ending types */
+
+enum { EL_LF, EL_CR, EL_CRLF, EL_ANY };
+
/*************************************************
@@ -100,8 +103,7 @@ static const char *jfriedl_prefix = "";
static const char *jfriedl_postfix = "";
#endif
-static int endlinebyte = '\n'; /* Last byte of endline sequence */
-static int endlineextra = 0; /* Extra bytes for endline sequence */
+static int endlinetype;
static char *colour_string = (char *)"1;31";
static char *colour_option = NULL;
@@ -142,6 +144,7 @@ static BOOL number = FALSE;
static BOOL only_matching = FALSE;
static BOOL quiet = FALSE;
static BOOL silent = FALSE;
+static BOOL utf8 = FALSE;
/* Structure for options and list of them */
@@ -219,6 +222,16 @@ static const char *prefix[] = {
static const char *suffix[] = {
"", "\\b", ")$", ")$", "\\E", "\\E\\b", "\\E)$", "\\E)$" };
+/* UTF-8 tables - used only when the newline setting is "all". */
+
+const int utf8_table3[] = { 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01};
+
+const char utf8_table4[] = {
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+ 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 };
+
/*************************************************
@@ -471,6 +484,216 @@ return sys_errlist[n];
/*************************************************
+* Find end of line *
+*************************************************/
+
+/* The length of the endline sequence that is found is set via lenptr. This may
+be zero at the very end of the file if there is no line-ending sequence there.
+
+Arguments:
+ p current position in line
+ endptr end of available data
+ lenptr where to put the length of the eol sequence
+
+Returns: pointer to the last byte of the line
+*/
+
+static char *
+end_of_line(char *p, char *endptr, int *lenptr)
+{
+switch(endlinetype)
+ {
+ default: /* Just in case */
+ case EL_LF:
+ while (p < endptr && *p != '\n') p++;
+ if (p < endptr)
+ {
+ *lenptr = 1;
+ return p + 1;
+ }
+ *lenptr = 0;
+ return endptr;
+
+ case EL_CR:
+ while (p < endptr && *p != '\r') p++;
+ if (p < endptr)
+ {
+ *lenptr = 1;
+ return p + 1;
+ }
+ *lenptr = 0;
+ return endptr;
+
+ case EL_CRLF:
+ for (;;)
+ {
+ while (p < endptr && *p != '\r') p++;
+ if (++p >= endptr)
+ {
+ *lenptr = 0;
+ return endptr;
+ }
+ if (*p == '\n')
+ {
+ *lenptr = 2;
+ return p + 1;
+ }
+ }
+ break;
+
+ case EL_ANY:
+ while (p < endptr)
+ {
+ int extra = 0;
+ register int c = *((unsigned char *)p);
+
+ if (utf8 && c >= 0xc0)
+ {
+ int gcii, gcss;
+ extra = utf8_table4[c & 0x3f]; /* Number of additional bytes */
+ gcss = 6*extra;
+ c = (c & utf8_table3[extra]) << gcss;
+ for (gcii = 1; gcii <= extra; gcii++)
+ {
+ gcss -= 6;
+ c |= (p[gcii] & 0x3f) << gcss;
+ }
+ }
+
+ p += 1 + extra;
+
+ switch (c)
+ {
+ case 0x0a: /* LF */
+ case 0x0b: /* VT */
+ case 0x0c: /* FF */
+ *lenptr = 1;
+ return p;
+
+ case 0x0d: /* CR */
+ if (p < endptr && *p == 0x0a)
+ {
+ *lenptr = 2;
+ p++;
+ }
+ else *lenptr = 1;
+ return p;
+
+ case 0x85: /* NEL */
+ *lenptr = utf8? 2 : 1;
+ return p;
+
+ case 0x2028: /* LS */
+ case 0x2029: /* PS */
+ *lenptr = 3;
+ return p;
+
+ default:
+ break;
+ }
+ } /* End of loop for ANY case */
+
+ *lenptr = 0; /* Must have hit the end */
+ return endptr;
+ } /* End of overall switch */
+}
+
+
+
+/*************************************************
+* Find start of previous line *
+*************************************************/
+
+/* This is called when looking back for before lines to print.
+
+Arguments:
+ p start of the subsequent line
+ startptr start of available data
+
+Returns: pointer to the start of the previous line
+*/
+
+static char *
+previous_line(char *p, char *startptr)
+{
+switch(endlinetype)
+ {
+ default: /* Just in case */
+ case EL_LF:
+ p--;
+ while (p > startptr && p[-1] != '\n') p--;
+ return p;
+
+ case EL_CR:
+ p--;
+ while (p > startptr && p[-1] != '\n') p--;
+ return p;
+
+ case EL_CRLF:
+ for (;;)
+ {
+ p -= 2;
+ while (p > startptr && p[-1] != '\n') p--;
+ if (p <= startptr + 1 || p[-2] == '\r') return p;
+ }
+ return p; /* But control should never get here */
+
+ case EL_ANY:
+ if (*(--p) == '\n' && p > startptr && p[-1] == '\r') p--;
+ if (utf8) while ((*p & 0xc0) == 0x80) p--;
+
+ while (p > startptr)
+ {
+ register int c;
+ char *pp = p - 1;
+
+ if (utf8)
+ {
+ int extra = 0;
+ while ((*pp & 0xc0) == 0x80) pp--;
+ c = *((unsigned char *)pp);
+ if (c >= 0xc0)
+ {
+ int gcii, gcss;
+ extra = utf8_table4[c & 0x3f]; /* Number of additional bytes */
+ gcss = 6*extra;
+ c = (c & utf8_table3[extra]) << gcss;
+ for (gcii = 1; gcii <= extra; gcii++)
+ {
+ gcss -= 6;
+ c |= (pp[gcii] & 0x3f) << gcss;
+ }
+ }
+ }
+ else c = *((unsigned char *)pp);
+
+ switch (c)
+ {
+ case 0x0a: /* LF */
+ case 0x0b: /* VT */
+ case 0x0c: /* FF */
+ case 0x0d: /* CR */
+ case 0x85: /* NEL */
+ case 0x2028: /* LS */
+ case 0x2029: /* PS */
+ return p;
+
+ default:
+ break;
+ }
+
+ p = pp; /* Back one character */
+ } /* End of loop for ANY case */
+
+ return startptr; /* Hit start of data */
+ } /* End of overall switch */
+}
+
+
+
+
+
+/*************************************************
* Print the previous "after" lines *
*************************************************/
@@ -495,13 +718,13 @@ if (after_context > 0 && lastmatchnumber > 0)
int count = 0;
while (lastmatchrestart < endptr && count++ < after_context)
{
+ int ellength;
char *pp = lastmatchrestart;
if (printname != NULL) fprintf(stdout, "%s-", printname);
if (number) fprintf(stdout, "%d-", lastmatchnumber++);
- while (*pp != endlinebyte) pp++;
- fwrite(lastmatchrestart, 1, pp - lastmatchrestart + (1 + endlineextra),
- stdout);
- lastmatchrestart = pp + 1;
+ pp = end_of_line(pp, endptr, &ellength);
+ fwrite(lastmatchrestart, 1, pp - lastmatchrestart, stdout);
+ lastmatchrestart = pp;
}
hyphenpending = TRUE;
}
@@ -558,7 +781,7 @@ way, the buffer is shifted left and re-filled. */
while (ptr < endptr)
{
- int i;
+ int i, endlinelength;
int mrc = 0;
BOOL match = FALSE;
char *t = ptr;
@@ -571,11 +794,10 @@ while (ptr < endptr)
line. In multiline mode the PCRE_FIRSTLINE option is used for compiling, so
that any match is constrained to be in the first line. */
- linelength = 0;
- while (t < endptr && *t++ != endlinebyte) linelength++;
+ t = end_of_line(t, endptr, &endlinelength);
+ linelength = t - ptr - endlinelength;
length = multiline? endptr - ptr : linelength;
-
/* Extra processing for Jeffrey Friedl's debugging. */
#ifdef JFRIEDL_DEBUG
@@ -706,13 +928,13 @@ while (ptr < endptr)
if (after_context > 0 && lastmatchnumber > 0)
{
+ int ellength;
int linecount = 0;
char *p = lastmatchrestart;
while (p < ptr && linecount < after_context)
{
- while (*p != endlinebyte) p++;
- p++;
+ p = end_of_line(p, ptr, &ellength);
linecount++;
}
@@ -725,10 +947,9 @@ while (ptr < endptr)
char *pp = lastmatchrestart;
if (printname != NULL) fprintf(stdout, "%s-", printname);
if (number) fprintf(stdout, "%d-", lastmatchnumber++);
- while (*pp != endlinebyte) pp++;
- fwrite(lastmatchrestart, 1, pp - lastmatchrestart +
- (1 + endlineextra), stdout);
- lastmatchrestart = pp + 1;
+ pp = end_of_line(pp, endptr, &ellength);
+ fwrite(lastmatchrestart, 1, pp - lastmatchrestart, stdout);
+ lastmatchrestart = pp;
}
if (lastmatchrestart != ptr) hyphenpending = TRUE;
}
@@ -754,8 +975,7 @@ while (ptr < endptr)
linecount < before_context)
{
linecount++;
- p--;
- while (p > buffer && p[-1] != endlinebyte) p--;
+ p = previous_line(p, buffer);
}
if (lastmatchnumber > 0 && p > lastmatchrestart && !hyphenprinted)
@@ -763,12 +983,13 @@ while (ptr < endptr)
while (p < ptr)
{
+ int ellength;
char *pp = p;
if (printname != NULL) fprintf(stdout, "%s-", printname);
if (number) fprintf(stdout, "%d-", linenumber - linecount--);
- while (*pp != endlinebyte) pp++;
- fwrite(p, 1, pp - p + (1 + endlineextra), stdout);
- p = pp + 1;
+ pp = end_of_line(pp, endptr, &ellength);
+ fwrite(p, 1, pp - p, stdout);
+ p = pp;
}
}
@@ -788,11 +1009,16 @@ while (ptr < endptr)
if (multiline)
{
+ int ellength;
char *endmatch = ptr + offsets[1];
t = ptr;
- while (t < endmatch) { if (*t++ == endlinebyte) linenumber++; }
- while (endmatch < endptr && *endmatch != endlinebyte) endmatch++;
- linelength = endmatch - ptr;
+ while (t < endmatch)
+ {
+ t = end_of_line(t, endptr, &ellength);
+ if (t <= endmatch) linenumber++; else break;
+ }
+ endmatch = end_of_line(endmatch, endptr, &ellength);
+ linelength = endmatch - ptr - ellength;
}
/*** NOTE: Use only fwrite() to output the data line, so that binary
@@ -824,9 +1050,7 @@ while (ptr < endptr)
fprintf(stdout, "%c[00m", 0x1b);
fwrite(ptr + offsets[1], 1, linelength - offsets[1], stdout);
}
- else fwrite(ptr, 1, linelength, stdout);
-
- fprintf(stdout, "\n");
+ else fwrite(ptr, 1, linelength + endlinelength, stdout);
}
/* End of doing what has to be done for a match */
@@ -836,13 +1060,13 @@ while (ptr < endptr)
/* Remember where the last match happened for after_context. We remember
where we are about to restart, and that line's number. */
- lastmatchrestart = ptr + linelength + 1;
+ lastmatchrestart = ptr + linelength + endlinelength;
lastmatchnumber = linenumber + 1;
}
/* Advance to after the newline and increment the line number. */
- ptr += linelength + 1;
+ ptr += linelength + endlinelength;
linenumber++;
/* If we haven't yet reached the end of the file (the buffer is full), and
@@ -1098,7 +1322,7 @@ switch(letter)
case 'q': quiet = TRUE; break;
case 'r': dee_action = dee_RECURSE; break;
case 's': silent = TRUE; break;
- case 'u': options |= PCRE_UTF8; break;
+ case 'u': options |= PCRE_UTF8; utf8 = TRUE; break;
case 'v': invert = TRUE; break;
case 'w': process_options |= PO_WORD_MATCH; break;
case 'x': process_options |= PO_LINE_MATCH; break;
@@ -1231,14 +1455,16 @@ compile_pattern(char *pattern, int options, char *filename, int count)
{
if ((process_options & PO_FIXED_STRINGS) != 0)
{
+ char *eop = pattern + strlen(pattern);
char buffer[MBUFTHIRD];
for(;;)
{
- char *p = strchr(pattern, endlinebyte);
- if (p == NULL)
+ int ellength;
+ char *p = end_of_line(pattern, eop, &ellength);
+ if (ellength == 0)
return compile_single_pattern(pattern, options, filename, count);
- sprintf(buffer, "%.*s", p - pattern - endlineextra, pattern);
- pattern = p + 1;
+ sprintf(buffer, "%.*s", p - pattern - ellength, pattern);
+ pattern = p;
if (!compile_single_pattern(buffer, options, filename, count))
return FALSE;
}
@@ -1267,7 +1493,9 @@ char *patterns[MAX_PATTERN_COUNT];
const char *locale_from = "--locale";
const char *error;
-/* Set the default line ending value from the default in the PCRE library. */
+/* Set the default line ending value from the default in the PCRE library;
+"lf", "cr", "crlf", and "any" are supported. Anything else is treated as "lf".
+*/
(void)pcre_config(PCRE_CONFIG_NEWLINE, &i);
switch(i)
@@ -1275,6 +1503,7 @@ switch(i)
default: newline = (char *)"lf"; break;
case '\r': newline = (char *)"cr"; break;
case ('\r' << 8) | '\n': newline = (char *)"crlf"; break;
+ case -1: newline = (char *)"any"; break;
}
/* Process the options */
@@ -1565,16 +1794,22 @@ if (colour_option != NULL && strcmp(colour_option, "never") != 0)
if (strcmp(newline, "cr") == 0 || strcmp(newline, "CR") == 0)
{
pcre_options |= PCRE_NEWLINE_CR;
- endlinebyte = '\r';
+ endlinetype = EL_CR;
}
else if (strcmp(newline, "lf") == 0 || strcmp(newline, "LF") == 0)
{
pcre_options |= PCRE_NEWLINE_LF;
+ endlinetype = EL_LF;
}
else if (strcmp(newline, "crlf") == 0 || strcmp(newline, "CRLF") == 0)
{
pcre_options |= PCRE_NEWLINE_CRLF;
- endlineextra = 1;
+ endlinetype = EL_CRLF;
+ }
+else if (strcmp(newline, "any") == 0 || strcmp(newline, "ANY") == 0)
+ {
+ pcre_options |= PCRE_NEWLINE_ANY;
+ endlinetype = EL_ANY;
}
else
{
diff --git a/pcreposix.c b/pcreposix.c
index b347236..31c7a31 100644
--- a/pcreposix.c
+++ b/pcreposix.c
@@ -78,7 +78,7 @@ static const int eint[] = {
REG_BADPAT, /* unrecognized character after (?< */
REG_BADPAT, /* lookbehind assertion is not fixed length */
REG_BADPAT, /* malformed number or name after (?( */
- REG_BADPAT, /* conditional group containe more than two branches */
+ REG_BADPAT, /* conditional group contains more than two branches */
REG_BADPAT, /* assertion expected after (?( */
REG_BADPAT, /* (?R or (?digits must be followed by ) */
REG_ECTYPE, /* unknown POSIX class name */
@@ -93,7 +93,7 @@ static const int eint[] = {
REG_BADPAT, /* closing ) for (?C expected */
REG_BADPAT, /* recursive call could loop indefinitely */
REG_BADPAT, /* unrecognized character after (?P */
- REG_BADPAT, /* syntax error after (?P */
+ REG_BADPAT, /* syntax error in subpattern name (missing terminator) */
REG_BADPAT, /* two named subpatterns have the same name */
REG_BADPAT, /* invalid UTF-8 string */
REG_BADPAT, /* support for \P, \p, and \X has not been compiled */
@@ -102,7 +102,13 @@ static const int eint[] = {
REG_BADPAT, /* subpattern name is too long (maximum 32 characters) */
REG_BADPAT, /* too many named subpatterns (maximum 10,000) */
REG_BADPAT, /* repeated subpattern is too long */
- REG_BADPAT /* octal value is greater than \377 (not in UTF-8 mode) */
+ REG_BADPAT, /* octal value is greater than \377 (not in UTF-8 mode) */
+ REG_BADPAT, /* internal error: overran compiling workspace */
+ REG_BADPAT, /* internal error: previously-checked referenced subpattern not found */
+ REG_BADPAT, /* DEFINE group contains more than one branch */
+ REG_BADPAT, /* repeating a DEFINE group is not allowed */
+ REG_INVARG, /* inconsistent NEWLINE options */
+ REG_BADPAT /* \g is not followed followed by an (optionally braced) non-zero number */
};
/* Table of texts corresponding to POSIX error codes */
diff --git a/pcretest.c b/pcretest.c
index 431378c..d5249fa 100644
--- a/pcretest.c
+++ b/pcretest.c
@@ -44,10 +44,29 @@ POSSIBILITY OF SUCH DAMAGE.
#include <locale.h>
#include <errno.h>
-#ifndef _WIN32
-#include <sys/resource.h>
+
+/* A number of things vary for Windows builds. Originally, pcretest opened its
+input and output without "b"; then I was told that "b" was needed in some
+environments, so it was added for release 5.0 to both the input and output. (It
+makes no difference on Unix-like systems.) Later I was told that it is wrong
+for the input on Windows. I've now abstracted the modes into two macros that
+are set here, to make it easier to fiddle with them, and removed "b" from the
+input mode under Windows. */
+
+#if defined(_WIN32) || defined(WIN32)
+#include <io.h> /* For _setmode() */
+#include <fcntl.h> /* For _O_BINARY */
+#define INPUT_MODE "r"
+#define OUTPUT_MODE "wb"
+
+#else
+#include <sys/time.h> /* These two includes are needed */
+#include <sys/resource.h> /* for setrlimit(). */
+#define INPUT_MODE "rb"
+#define OUTPUT_MODE "wb"
#endif
+
#define PCRE_SPY /* For Win32 build, import data, not export */
/* We include pcre_internal.h because we need the internal info for displaying
@@ -74,10 +93,18 @@ symbols to prevent clashes. */
/* We also need the pcre_printint() function for printing out compiled
patterns. This function is in a separate file so that it can be included in
-pcre_compile.c when that module is compiled with debugging enabled. */
+pcre_compile.c when that module is compiled with debugging enabled.
+
+The definition of the macro PRINTABLE, which determines whether to print an
+output character as-is or as a hex value when showing compiled patterns, is
+contained in this file. We uses it here also, in cases when the locale has not
+been explicitly changed, so as to get consistent output from systems that
+differ in their output from isprint() even in the "C" locale. */
#include "pcre_printint.src"
+#define PRINTHEX(c) (locale_set? isprint(c) : PRINTABLE(c))
+
/* It is possible to compile this test program without including support for
testing the POSIX interface, though this is not available via the standard
@@ -103,6 +130,8 @@ function (define NOINFOCHECK). */
#endif
#endif
+/* This is the default loop count for timing. */
+
#define LOOPREPEAT 500000
/* Static variables */
@@ -114,6 +143,7 @@ static int callout_extra;
static int callout_fail_count;
static int callout_fail_id;
static int first_callout;
+static int locale_set = 0;
static int show_malloc;
static int use_utf8;
static size_t gotten_store;
@@ -157,6 +187,7 @@ uschar *here = start;
for (;;)
{
int rlen = buffer_size - (here - buffer);
+
if (rlen > 1000)
{
int dlen;
@@ -213,7 +244,7 @@ return NULL; /* Control never gets here */
/* We don't use strtoul() because SunOS4 doesn't have it. Rather than mess
around with conditional compilation, just do the job by hand. It is only used
-for unpicking the -o argument, so just keep it simple.
+for unpicking arguments, so just keep it simple.
Arguments:
str string to be converted
@@ -311,6 +342,8 @@ Arguments:
Returns: number of characters placed in the buffer
*/
+#if !defined NOUTF8
+
static int
ord2utf8(int cvalue, uschar *utf8bytes)
{
@@ -327,6 +360,8 @@ for (j = i; j > 0; j--)
return i + 1;
}
+#endif
+
/*************************************************
@@ -353,16 +388,19 @@ while (length-- > 0)
{
length -= rc - 1;
p += rc;
- if (c < 256 && isprint(c))
+ if (PRINTHEX(c))
{
if (f != NULL) fprintf(f, "%c", c);
yield++;
}
else
{
- int n;
- if (f != NULL) fprintf(f, "\\x{%02x}%n", c, &n);
- yield += n;
+ int n = 4;
+ if (f != NULL) fprintf(f, "\\x{%02x}", c);
+ yield += (n <= 0x000000ff)? 2 :
+ (n <= 0x00000fff)? 3 :
+ (n <= 0x0000ffff)? 4 :
+ (n <= 0x000fffff)? 5 : 6;
}
continue;
}
@@ -371,7 +409,8 @@ while (length-- > 0)
/* Not UTF-8, or malformed UTF-8 */
- if (isprint(c = *(p++)))
+ c = *p++;
+ if (PRINTHEX(c))
{
if (f != NULL) fprintf(f, "%c", c);
yield++;
@@ -614,7 +653,7 @@ return count;
*************************************************/
/* This is used both at compile and run-time to check for <xxx> escapes, where
-xxx is LF, CR, or CRLF. Print a message and return 0 if there is no match.
+xxx is LF, CR, CRLF, or ANY. Print a message and return 0 if there is no match.
Arguments:
p points after the leading '<'
@@ -629,6 +668,7 @@ check_newline(uschar *p, FILE *f)
if (strncmp((char *)p, "cr>", 3) == 0) return PCRE_NEWLINE_CR;
if (strncmp((char *)p, "lf>", 3) == 0) return PCRE_NEWLINE_LF;
if (strncmp((char *)p, "crlf>", 5) == 0) return PCRE_NEWLINE_CRLF;
+if (strncmp((char *)p, "any>", 4) == 0) return PCRE_NEWLINE_ANY;
fprintf(f, "Unknown newline type at: <%s\n", p);
return 0;
}
@@ -636,6 +676,38 @@ return 0;
/*************************************************
+* Usage function *
+*************************************************/
+
+static void
+usage(void)
+{
+printf("Usage: pcretest [options] [<input> [<output>]]\n");
+printf(" -b show compiled code (bytecode)\n");
+printf(" -C show PCRE compile-time options and exit\n");
+printf(" -d debug: show compiled code and information (-b and -i)\n");
+#if !defined NODFA
+printf(" -dfa force DFA matching for all subjects\n");
+#endif
+printf(" -help show usage information\n");
+printf(" -i show information about compiled patterns\n"
+ " -m output memory used information\n"
+ " -o <n> set size of offsets vector to <n>\n");
+#if !defined NOPOSIX
+printf(" -p use POSIX interface\n");
+#endif
+printf(" -q quiet: do not output PCRE version number at start\n");
+printf(" -S <n> set stack size to <n> megabytes\n");
+printf(" -s output store (memory) used information\n"
+ " -t time compilation and execution\n");
+printf(" -t <n> time compilation and execution, repeating <n> times\n");
+printf(" -tm time execution (matching) only\n");
+printf(" -tm <n> time execution (matching) only, repeating <n> times\n");
+}
+
+
+
+/*************************************************
* Main Program *
*************************************************/
@@ -650,6 +722,7 @@ int options = 0;
int study_options = 0;
int op = 1;
int timeit = 0;
+int timeitm = 0;
int showinfo = 0;
int showstore = 0;
int quiet = 0;
@@ -681,16 +754,19 @@ buffer = (unsigned char *)malloc(buffer_size);
dbuffer = (unsigned char *)malloc(buffer_size);
pbuffer = (unsigned char *)malloc(buffer_size);
-/* The outfile variable is static so that new_malloc can use it. The _setmode()
-stuff is some magic that I don't understand, but which apparently does good
-things in Windows. It's related to line terminations. */
-
-#if defined(_WIN32) || defined(WIN32)
-_setmode( _fileno( stdout ), 0x8000 );
-#endif /* defined(_WIN32) || defined(WIN32) */
+/* The outfile variable is static so that new_malloc can use it. */
outfile = stdout;
+/* The following _setmode() stuff is some Windows magic that tells its runtime
+library to translate CRLF into a single LF character. At least, that's what
+I've been told: never having used Windows I take this all on trust. Originally
+it set 0x8000, but then I was advised that _O_BINARY was better. */
+
+#if defined(_WIN32) || defined(WIN32)
+_setmode( _fileno( stdout ), _O_BINARY );
+#endif
+
/* Scan options */
while (argc > 1 && argv[op][0] == '-')
@@ -699,8 +775,8 @@ while (argc > 1 && argv[op][0] == '-')
if (strcmp(argv[op], "-s") == 0 || strcmp(argv[op], "-m") == 0)
showstore = 1;
- else if (strcmp(argv[op], "-t") == 0) timeit = 1;
else if (strcmp(argv[op], "-q") == 0) quiet = 1;
+ else if (strcmp(argv[op], "-b") == 0) debug = 1;
else if (strcmp(argv[op], "-i") == 0) showinfo = 1;
else if (strcmp(argv[op], "-d") == 0) showinfo = debug = 1;
#if !defined NODFA
@@ -713,11 +789,25 @@ while (argc > 1 && argv[op][0] == '-')
op++;
argc--;
}
+ else if (strcmp(argv[op], "-t") == 0 || strcmp(argv[op], "-tm") == 0)
+ {
+ int both = argv[op][2] == 0;
+ int temp;
+ if (argc > 2 && (temp = get_value((unsigned char *)argv[op+1], &endptr),
+ *endptr == 0))
+ {
+ timeitm = temp;
+ op++;
+ argc--;
+ }
+ else timeitm = LOOPREPEAT;
+ if (both) timeit = timeitm;
+ }
else if (strcmp(argv[op], "-S") == 0 && argc > 2 &&
((stack_size = get_value((unsigned char *)argv[op+1], &endptr)),
*endptr == 0))
{
-#ifdef _WIN32
+#if defined(_WIN32) || defined(WIN32)
printf("PCRE: -S not supported on this OS\n");
exit(1);
#else
@@ -749,7 +839,8 @@ while (argc > 1 && argv[op][0] == '-')
printf(" %sUnicode properties support\n", rc? "" : "No ");
(void)pcre_config(PCRE_CONFIG_NEWLINE, &rc);
printf(" Newline sequence is %s\n", (rc == '\r')? "CR" :
- (rc == '\n')? "LF" : "CRLF");
+ (rc == '\n')? "LF" : (rc == ('\r'<<8 | '\n'))? "CRLF" :
+ (rc == -1)? "ANY" : "???");
(void)pcre_config(PCRE_CONFIG_LINK_SIZE, &rc);
printf(" Internal link size = %d\n", rc);
(void)pcre_config(PCRE_CONFIG_POSIX_MALLOC_THRESHOLD, &rc);
@@ -762,24 +853,16 @@ while (argc > 1 && argv[op][0] == '-')
printf(" Match recursion uses %s\n", rc? "stack" : "heap");
exit(0);
}
+ else if (strcmp(argv[op], "-help") == 0 ||
+ strcmp(argv[op], "--help") == 0)
+ {
+ usage();
+ goto EXIT;
+ }
else
{
printf("** Unknown or malformed option %s\n", argv[op]);
- printf("Usage: pcretest [options] [<input> [<output>]]\n");
- printf(" -C show PCRE compile-time options and exit\n");
- printf(" -d debug: show compiled code; implies -i\n");
-#if !defined NODFA
- printf(" -dfa force DFA matching for all subjects\n");
-#endif
- printf(" -i show information about compiled pattern\n"
- " -m output memory used information\n"
- " -o <n> set size of offsets vector to <n>\n");
-#if !defined NOPOSIX
- printf(" -p use POSIX interface\n");
-#endif
- printf(" -S <n> set stack size to <n> megabytes\n");
- printf(" -s output store (memory) used information\n"
- " -t time compilation and execution\n");
+ usage();
yield = 1;
goto EXIT;
}
@@ -803,7 +886,7 @@ if (offsets == NULL)
if (argc > 1)
{
- infile = fopen(argv[op], "rb");
+ infile = fopen(argv[op], INPUT_MODE);
if (infile == NULL)
{
printf("** Failed to open %s\n", argv[op]);
@@ -814,7 +897,7 @@ if (argc > 1)
if (argc > 2)
{
- outfile = fopen(argv[op+1], "wb");
+ outfile = fopen(argv[op+1], OUTPUT_MODE);
if (outfile == NULL)
{
printf("** Failed to open %s\n", argv[op+1]);
@@ -859,7 +942,7 @@ while (!done)
int do_showinfo = showinfo;
int do_showrest = 0;
int do_flip = 0;
- int erroroffset, len, delimiter;
+ int erroroffset, len, delimiter, poffset;
use_utf8 = 0;
@@ -969,6 +1052,7 @@ while (!done)
}
pp = p;
+ poffset = p - buffer;
for(;;)
{
@@ -989,6 +1073,11 @@ while (!done)
if (infile != stdin) fprintf(outfile, "%s", (char *)pp);
}
+ /* The buffer may have moved while being extended; reset the start of data
+ pointer to the correct relative point in the buffer. */
+
+ p = buffer + poffset;
+
/* If the first character after the delimiter is backslash, make
the pattern end with backslash. This is purely to provide a way
of testing for the error message when a pattern ends with backslash. */
@@ -1020,6 +1109,7 @@ while (!done)
case '+': do_showrest = 1; break;
case 'A': options |= PCRE_ANCHORED; break;
+ case 'B': do_debug = 1; break;
case 'C': options |= PCRE_AUTO_CALLOUT; break;
case 'D': do_debug = do_showinfo = 1; break;
case 'E': options |= PCRE_DOLLAR_ENDONLY; break;
@@ -1042,14 +1132,16 @@ while (!done)
case 'L':
ppp = pp;
- /* The '\r' test here is so that it works on Windows */
- while (*ppp != '\n' && *ppp != '\r' && *ppp != ' ') ppp++;
+ /* The '\r' test here is so that it works on Windows. */
+ /* The '0' test is just in case this is an unterminated line. */
+ while (*ppp != 0 && *ppp != '\n' && *ppp != '\r' && *ppp != ' ') ppp++;
*ppp = 0;
if (setlocale(LC_CTYPE, (const char *)pp) == NULL)
{
fprintf(outfile, "** Failed to set locale \"%s\"\n", pp);
goto SKIP_DATA;
}
+ locale_set = 1;
tables = pcre_maketables();
pp = ppp;
break;
@@ -1116,19 +1208,19 @@ while (!done)
#endif /* !defined NOPOSIX */
{
- if (timeit)
+ if (timeit > 0)
{
register int i;
clock_t time_taken;
clock_t start_time = clock();
- for (i = 0; i < LOOPREPEAT; i++)
+ for (i = 0; i < timeit; i++)
{
re = pcre_compile((char *)p, options, &error, &erroroffset, tables);
if (re != NULL) free(re);
}
time_taken = clock() - start_time;
- fprintf(outfile, "Compile time %.3f milliseconds\n",
- (((double)time_taken * 1000.0) / (double)LOOPREPEAT) /
+ fprintf(outfile, "Compile time %.4f milliseconds\n",
+ (((double)time_taken * 1000.0) / (double)timeit) /
(double)CLOCKS_PER_SEC);
}
@@ -1180,17 +1272,17 @@ while (!done)
if (do_study)
{
- if (timeit)
+ if (timeit > 0)
{
register int i;
clock_t time_taken;
clock_t start_time = clock();
- for (i = 0; i < LOOPREPEAT; i++)
+ for (i = 0; i < timeit; i++)
extra = pcre_study(re, study_options, &error);
time_taken = clock() - start_time;
if (extra != NULL) free(extra);
- fprintf(outfile, " Study time %.3f milliseconds\n",
- (((double)time_taken * 1000.0) / (double)LOOPREPEAT) /
+ fprintf(outfile, " Study time %.4f milliseconds\n",
+ (((double)time_taken * 1000.0) / (double)timeit) /
(double)CLOCKS_PER_SEC);
}
extra = pcre_study(re, study_options, &error);
@@ -1233,6 +1325,12 @@ while (!done)
SHOW_INFO:
+ if (do_debug)
+ {
+ fprintf(outfile, "------------------------------------------------------------------\n");
+ pcre_printint(re, outfile);
+ }
+
if (do_showinfo)
{
unsigned long int get_options, all_options;
@@ -1243,12 +1341,6 @@ while (!done)
int nameentrysize, namecount;
const uschar *nametable;
- if (do_debug)
- {
- fprintf(outfile, "------------------------------------------------------------------\n");
- pcre_printint(re, outfile);
- }
-
new_info(re, NULL, PCRE_INFO_OPTIONS, &get_options);
new_info(re, NULL, PCRE_INFO_SIZE, &size);
new_info(re, NULL, PCRE_INFO_CAPTURECOUNT, &count);
@@ -1327,7 +1419,7 @@ while (!done)
((get_options & PCRE_NO_UTF8_CHECK) != 0)? " no_utf8_check" : "",
((get_options & PCRE_DUPNAMES) != 0)? " dupnames" : "");
- switch (get_options & PCRE_NEWLINE_CRLF)
+ switch (get_options & PCRE_NEWLINE_BITS)
{
case PCRE_NEWLINE_CR:
fprintf(outfile, "Forced newline sequence: CR\n");
@@ -1341,6 +1433,10 @@ while (!done)
fprintf(outfile, "Forced newline sequence: CRLF\n");
break;
+ case PCRE_NEWLINE_ANY:
+ fprintf(outfile, "Forced newline sequence: ANY\n");
+ break;
+
default:
break;
}
@@ -1358,7 +1454,7 @@ while (!done)
int ch = first_char & 255;
const char *caseless = ((first_char & REQ_CASELESS) == 0)?
"" : " (caseless)";
- if (isprint(ch))
+ if (PRINTHEX(ch))
fprintf(outfile, "First char = \'%c\'%s\n", ch, caseless);
else
fprintf(outfile, "First char = %d%s\n", ch, caseless);
@@ -1373,7 +1469,7 @@ while (!done)
int ch = need_char & 255;
const char *caseless = ((need_char & REQ_CASELESS) == 0)?
"" : " (caseless)";
- if (isprint(ch))
+ if (PRINTHEX(ch))
fprintf(outfile, "Need char = \'%c\'%s\n", ch, caseless);
else
fprintf(outfile, "Need char = %d%s\n", ch, caseless);
@@ -1409,7 +1505,7 @@ while (!done)
fprintf(outfile, "\n ");
c = 2;
}
- if (isprint(i) && i != ' ')
+ if (PRINTHEX(i) && i != ' ')
{
fprintf(outfile, "%c ", i);
c += 2;
@@ -1468,6 +1564,7 @@ while (!done)
strerror(errno));
}
else fprintf(outfile, "Study data written to %s\n", to_file);
+
}
}
fclose(f);
@@ -1866,7 +1963,7 @@ while (!done)
for (;; gmatched++) /* Loop for /g or /G */
{
- if (timeit)
+ if (timeitm > 0)
{
register int i;
clock_t time_taken;
@@ -1876,7 +1973,7 @@ while (!done)
if (all_use_dfa || use_dfa)
{
int workspace[1000];
- for (i = 0; i < LOOPREPEAT; i++)
+ for (i = 0; i < timeitm; i++)
count = pcre_dfa_exec(re, NULL, (char *)bptr, len, start_offset,
options | g_notempty, use_offsets, use_size_offsets, workspace,
sizeof(workspace)/sizeof(int));
@@ -1884,13 +1981,13 @@ while (!done)
else
#endif
- for (i = 0; i < LOOPREPEAT; i++)
+ for (i = 0; i < timeitm; i++)
count = pcre_exec(re, extra, (char *)bptr, len,
start_offset, options | g_notempty, use_offsets, use_size_offsets);
time_taken = clock() - start_time;
- fprintf(outfile, "Execute time %.3f milliseconds\n",
- (((double)time_taken * 1000.0) / (double)LOOPREPEAT) /
+ fprintf(outfile, "Execute time %.4f milliseconds\n",
+ (((double)time_taken * 1000.0) / (double)timeitm) /
(double)CLOCKS_PER_SEC);
}
@@ -1966,7 +2063,28 @@ while (!done)
if (count >= 0)
{
- int i;
+ int i, maxcount;
+
+#if !defined NODFA
+ if (all_use_dfa || use_dfa) maxcount = use_size_offsets/2; else
+#endif
+ maxcount = use_size_offsets/3;
+
+ /* This is a check against a lunatic return value. */
+
+ if (count > maxcount)
+ {
+ fprintf(outfile,
+ "** PCRE error: returned count %d is too big for offset size %d\n",
+ count, use_size_offsets);
+ count = use_size_offsets/3;
+ if (do_g || do_G)
+ {
+ fprintf(outfile, "** /%c loop abandoned\n", do_g? 'g' : 'G');
+ do_g = do_G = FALSE; /* Break g/G loop */
+ }
+ }
+
for (i = 0; i < count * 2; i += 2)
{
if (use_offsets[i] < 0)
@@ -2165,6 +2283,7 @@ while (!done)
{
new_free((void *)tables);
setlocale(LC_CTYPE, "C");
+ locale_set = 0;
}
}
diff --git a/testdata/grepinput8 b/testdata/grepinput8
new file mode 100644
index 0000000..c4b8c44
--- /dev/null
+++ b/testdata/grepinput8
@@ -0,0 +1,11 @@
+X one
+X two X three X four X five
+X six
+X seven…X eight
X nine
X ten
+
+Before 111
+Before 222
Before 333…Match
+After 111
+After 222
After 333
+And so on and so on
+And so on and so on
diff --git a/testdata/grepoutput b/testdata/grepoutput
index 99b81bd..11afbb6 100644
--- a/testdata/grepoutput
+++ b/testdata/grepoutput
@@ -343,6 +343,7 @@ RC=2
RC=0
---------------------------- Test 36 -----------------------------
./testdata/grepinputx
+./testdata/grepinput8
RC=0
---------------------------- Test 37 -----------------------------
aaaaa0
@@ -400,18 +401,23 @@ abc def
ghi
jkl
---------------------------- Test 50 ------------------------------
-def
----------------------------- Test 51 ------------------------------
-abc def
+def ---------------------------- Test 51 ------------------------------
ghi
jkl
----------------------------- Test 52 ------------------------------
-def
+This is the last line of this file.
+---------------------------- Test 52 ------------------------------
+def
ghi
jkl
This is the last line of this file.
-
---------------------------- Test 53 ------------------------------
+ghi
jkl
+
+This is the last line of this file.
+---------------------------- Test 54 ------------------------------
+44:abc 45:def
+46:ghi
+47:jkl
diff --git a/testdata/grepoutput8 b/testdata/grepoutput8
new file mode 100644
index 0000000..0a8b7ec
--- /dev/null
+++ b/testdata/grepoutput8
@@ -0,0 +1,10 @@
+---------------------------- Test U1 ------------------------------
+1:X one
+2:X two 3:X three 4:X four 5:X five
+6:X six
+7:X seven…8:X eight
9:X nine
10:X ten
+---------------------------- Test U2 ------------------------------
+12-Before 111
+13-Before 222
14-Before 333…15:Match
+16-After 111
+17-After 222
18-After 333
diff --git a/testdata/testinput1 b/testdata/testinput1
index 042db24..d8ef12b 100644
--- a/testdata/testinput1
+++ b/testdata/testinput1
@@ -1297,7 +1297,7 @@
abc
/^a b
- c/x
+ c/x
abc
/^(a|)\1*b/
@@ -1453,11 +1453,6 @@
/{4,5a}bc/
{4,5a}bc
-/^a.b/
- a\rb
- *** Failers
- a\nb
-
/abc$/
abc
abc\n
@@ -1499,8 +1494,8 @@
/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
abcdefghijk\12S
-/ab\gdef/
- abgdef
+/ab\hdef/
+ abhdef
/a{0}bc/
bc
@@ -3381,9 +3376,14 @@
cdaccb
/^(?:a?b?)*$/
+ \
+ a
+ ab
+ aaa
*** Failers
dbcb
a--
+ aa--
/((?s)^a(.))((?m)^b$)/
a\nb\nc\n
@@ -3883,4 +3883,139 @@
a,b]
[a,b,c]
+/(?-x: )/x
+ A\x20B
+
+"(?x)(?-x: \s*#\s*)"
+ A # B
+ ** Failers
+ #
+
+"(?x-is)(?:(?-ixs) \s*#\s*) include"
+ A #include
+ ** Failers
+ A#include
+ A #Include
+
+/a*b*\w/
+ aaabbbb
+ aaaa
+ a
+
+/a*b?\w/
+ aaabbbb
+ aaaa
+ a
+
+/a*b{0,4}\w/
+ aaabbbb
+ aaaa
+ a
+
+/a*b{0,}\w/
+ aaabbbb
+ aaaa
+ a
+
+/a*\d*\w/
+ 0a
+ a
+
+/a*b *\w/x
+ a
+
+/a*b#comment
+ *\w/x
+ a
+
+/a* b *\w/x
+ a
+
+/^\w+=.*(\\\n.*)*/
+ abc=xyz\\\npqr
+
+/(?=(\w+))\1:/
+ abcd:
+
+/^(?=(\w+))\1:/
+ abcd:
+
+/^\Eabc/
+ abc
+
+/^[\Eabc]/
+ a
+ ** Failers
+ E
+
+/^[a-\Ec]/
+ b
+ ** Failers
+ -
+ E
+
+/^[a\E\E-\Ec]/
+ b
+ ** Failers
+ -
+ E
+
+/^[\E\Qa\E-\Qz\E]+/
+ b
+ ** Failers
+ -
+
+/^[a\Q]bc\E]/
+ a
+ ]
+ c
+
+/^[a-\Q\E]/
+ a
+ -
+
+/^(a()*)*/
+ aaaa
+
+/^(?:a(?:(?:))*)*/
+ aaaa
+
+/^(a()+)+/
+ aaaa
+
+/^(?:a(?:(?:))+)+/
+ aaaa
+
+/(a){0,3}(?(1)b|(c|))*D/
+ abbD
+ ccccD
+ D
+
+/(a|)*\d/
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/(?>a|)*\d/
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/(?:a|)*\d/
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/\Z/g
+ abc\n
+
+/^(?s)(?>.*)(?<!\n)/
+ abc
+ abc\n
+
+/^(?![^\n]*\n\z)/
+ abc
+ abc\n
+
+/\z(?<!\n)/
+ abc
+ abc\n
+
/ End of testinput1 /
diff --git a/testdata/testinput2 b/testdata/testinput2
index 0a87466..bb21f48 100644
--- a/testdata/testinput2
+++ b/testdata/testinput2
@@ -1,6 +1,6 @@
-/(a)b|/
+/(a)b|/I
-/abc/
+/abc/I
abc
defabc
\Aabc
@@ -8,29 +8,29 @@
\Adefabc
ABC
-/^abc/
+/^abc/I
abc
\Aabc
*** Failers
defabc
\Adefabc
-/a+bc/
+/a+bc/I
-/a*bc/
+/a*bc/I
-/a{3}bc/
+/a{3}bc/I
-/(abc|a+z)/
+/(abc|a+z)/I
-/^abc$/
+/^abc$/I
abc
*** Failers
def\nabc
-/ab\gdef/X
+/ab\hdef/X
-/(?X)ab\gdef/X
+/(?X)ab\hdef/X
/x{5,4}/
@@ -50,33 +50,33 @@
/(?z)abc/
-/.*b/
+/.*b/I
-/.*?b/
+/.*?b/I
-/cat|dog|elephant/
+/cat|dog|elephant/I
this sentence eventually mentions a cat
this sentences rambles on and on for a while and then reaches elephant
-/cat|dog|elephant/S
+/cat|dog|elephant/IS
this sentence eventually mentions a cat
this sentences rambles on and on for a while and then reaches elephant
-/cat|dog|elephant/iS
+/cat|dog|elephant/IiS
this sentence eventually mentions a CAT cat
this sentences rambles on and on for a while to elephant ElePhant
-/a|[bcd]/S
+/a|[bcd]/IS
-/(a|[^\dZ])/S
+/(a|[^\dZ])/IS
-/(a|b)*[\s]/S
+/(a|b)*[\s]/IS
/(ab\2)/
/{4,5}abc/
-/(a)(b)(c)\2/
+/(a)(b)(c)\2/I
abcb
\O0abcb
\O3abcb
@@ -84,7 +84,7 @@
\O9abcb
\O12abcb
-/(a)bc|(a)(b)\2/
+/(a)bc|(a)(b)\2/I
abc
\O0abc
\O3abc
@@ -96,7 +96,7 @@
\O9aba
\O12aba
-/abc$/E
+/abc$/IE
abc
*** Failers
abc\n
@@ -104,88 +104,88 @@
/(a)(b)(c)(d)(e)\6/
-/the quick brown fox/
+/the quick brown fox/I
the quick brown fox
this is a line with the quick brown fox
-/the quick brown fox/A
+/the quick brown fox/IA
the quick brown fox
*** Failers
this is a line with the quick brown fox
/ab(?z)cd/
-/^abc|def/
+/^abc|def/I
abcdef
abcdef\B
-/.*((abc)$|(def))/
+/.*((abc)$|(def))/I
defabc
\Zdefabc
-/abc/P
+/abc/IP
abc
*** Failers
-/^abc|def/P
+/^abc|def/IP
abcdef
abcdef\B
-/.*((abc)$|(def))/P
+/.*((abc)$|(def))/IP
defabc
\Zdefabc
-/the quick brown fox/P
+/the quick brown fox/IP
the quick brown fox
*** Failers
The Quick Brown Fox
-/the quick brown fox/Pi
+/the quick brown fox/IPi
the quick brown fox
The Quick Brown Fox
-/abc.def/P
+/abc.def/IP
*** Failers
abc\ndef
-/abc$/P
+/abc$/IP
abc
abc\n
-/(abc)\2/P
+/(abc)\2/IP
-/(abc\1)/P
+/(abc\1)/IP
abc
/)/
/a[]b/
-/[^aeiou ]{3,}/
+/[^aeiou ]{3,}/I
co-processors, and for
-/<.*>/
+/<.*>/I
abc<def>ghi<klm>nop
-/<.*?>/
+/<.*?>/I
abc<def>ghi<klm>nop
-/<.*>/U
+/<.*>/IU
abc<def>ghi<klm>nop
-/(?U)<.*>/
+/(?U)<.*>/I
abc<def>ghi<klm>nop
-/<.*?>/U
+/<.*?>/IU
abc<def>ghi<klm>nop
-/={3,}/U
+/={3,}/IU
abc========def
-/(?U)={3,}?/
+/(?U)={3,}?/I
abc========def
-/(?<!bar|cattle)foo/
+/(?<!bar|cattle)foo/I
foo
catfoo
*** Failers
@@ -198,25 +198,25 @@
/(?<!(foo)a\1)bar/
-/(?i)abc/
+/(?i)abc/I
-/(a|(?m)a)/
+/(a|(?m)a)/I
-/(?i)^1234/
+/(?i)^1234/I
-/(^b|(?i)^d)/
+/(^b|(?i)^d)/I
-/(?s).*/
+/(?s).*/I
-/[abcd]/S
+/[abcd]/IS
-/(?i)[abcd]/S
+/(?i)[abcd]/IS
-/(?m)[xy]|(b|c)/S
+/(?m)[xy]|(b|c)/IS
-/(^a|^b)/m
+/(^a|^b)/Im
-/(?i)(^a|^b)/m
+/(?i)(^a|^b)/Im
/(a)(?(1)a|b|c)/
@@ -224,62 +224,64 @@
/(?(1a)/
+/(?(1a))/
+
/(?(?i))/
/(?(abc))/
/(?(?<ab))/
-/((?s)blah)\s+\1/
+/((?s)blah)\s+\1/I
-/((?i)blah)\s+\1/
+/((?i)blah)\s+\1/I
-/((?i)b)/DS
+/((?i)b)/IDS
-/(a*b|(?i:c*(?-i)d))/S
+/(a*b|(?i:c*(?-i)d))/IS
-/a$/
+/a$/I
a
a\n
*** Failers
\Za
\Za\n
-/a$/m
+/a$/Im
a
a\n
\Za\n
*** Failers
\Za
-/\Aabc/m
+/\Aabc/Im
-/^abc/m
+/^abc/Im
-/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/
+/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/I
aaaaabbbbbcccccdef
-/(?<=foo)[ab]/S
+/(?<=foo)[ab]/IS
-/(?<!foo)(alpha|omega)/S
+/(?<!foo)(alpha|omega)/IS
-/(?!alphabet)[ab]/S
+/(?!alphabet)[ab]/IS
-/(?<=foo\n)^bar/m
+/(?<=foo\n)^bar/Im
foo\nbarbar
***Failers
rhubarb
barbell
abc\nbarton
-/^(?<=foo\n)bar/m
+/^(?<=foo\n)bar/Im
foo\nbarbar
***Failers
rhubarb
barbell
abc\nbarton
-/(?>^abc)/m
+/(?>^abc)/Im
abc
def\nabc
*** Failers
@@ -293,20 +295,20 @@
/The next three are in testinput2 because they have variable length branches/
-/(?<=bullock|donkey)-cart/
+/(?<=bullock|donkey)-cart/I
the bullock-cart
a donkey-cart race
*** Failers
cart
horse-and-cart
-/(?<=ab(?i)x|y|z)/
+/(?<=ab(?i)x|y|z)/I
-/(?>.*)(?<=(abcd)|(xyz))/
+/(?>.*)(?<=(abcd)|(xyz))/I
alphabetabcd
endingxyz
-/(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ/
+/(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ/I
abxyZZ
abXyZZ
ZZZ
@@ -319,24 +321,24 @@
zzz
bzz
-/(?<!(foo)a)bar/
+/(?<!(foo)a)bar/I
bar
foobbar
*** Failers
fooabar
-/This one is here because Perl 5.005_02 doesn't fail it/
+/This one is here because Perl 5.005_02 doesn't fail it/I
-/^(a)?(?(1)a|b)+$/
+/^(a)?(?(1)a|b)+$/I
*** Failers
a
-/This one is here because I think Perl 5.005_02 gets the setting of $1 wrong/
+/This one is here because I think Perl 5.005_02 gets the setting of $1 wrong/I
-/^(a\1?){4}$/
+/^(a\1?){4}$/I
aaaaaa
-/These are syntax tests from Perl 5.005/
+/These are syntax tests from Perl 5.005/I
/a[b-a]/
@@ -362,23 +364,23 @@
/(a)|\2/
-/a[b-a]/i
+/a[b-a]/Ii
-/a[]b/i
+/a[]b/Ii
-/a[/i
+/a[/Ii
-/*a/i
+/*a/Ii
-/(*)b/i
+/(*)b/Ii
-/abc)/i
+/abc)/Ii
-/(abc/i
+/(abc/Ii
-/a**/i
+/a**/Ii
-/)(/i
+/)(/Ii
/:(?:/
@@ -410,175 +412,175 @@
/abc/\i
-/(a)bc(d)/
+/(a)bc(d)/I
abcd
abcd\C2
abcd\C5
-/(.{20})/
+/(.{20})/I
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz\C1
abcdefghijklmnopqrstuvwxyz\G1
-/(.{15})/
+/(.{15})/I
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz\C1\G1
-/(.{16})/
+/(.{16})/I
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz\C1\G1\L
-/^(a|(bc))de(f)/
+/^(a|(bc))de(f)/I
adef\G1\G2\G3\G4\L
bcdef\G1\G2\G3\G4\L
adefghijk\C0
-/^abc\00def/
+/^abc\00def/I
abc\00def\L\C0
/word ((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
)((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
-)?)?)?)?)?)?)?)?)?otherword/M
+)?)?)?)?)?)?)?)?)?otherword/IM
-/.*X/D
+/.*X/ID
-/.*X/Ds
+/.*X/IDs
-/(.*X|^B)/D
+/(.*X|^B)/ID
-/(.*X|^B)/Ds
+/(.*X|^B)/IDs
-/(?s)(.*X|^B)/D
+/(?s)(.*X|^B)/ID
-/(?s:.*X|^B)/D
+/(?s:.*X|^B)/ID
-/\Biss\B/+
+/\Biss\B/I+
Mississippi
-/\Biss\B/+P
+/\Biss\B/I+P
Mississippi
-/iss/G+
+/iss/IG+
Mississippi
-/\Biss\B/G+
+/\Biss\B/IG+
Mississippi
-/\Biss\B/g+
+/\Biss\B/Ig+
Mississippi
*** Failers
Mississippi\A
-/(?<=[Ms])iss/g+
+/(?<=[Ms])iss/Ig+
Mississippi
-/(?<=[Ms])iss/G+
+/(?<=[Ms])iss/IG+
Mississippi
-/^iss/g+
+/^iss/Ig+
ississippi
-/.*iss/g+
+/.*iss/Ig+
abciss\nxyzisspqr
-/.i./+g
+/.i./I+g
Mississippi
Mississippi\A
Missouri river
Missouri river\A
-/^.is/+g
+/^.is/I+g
Mississippi
-/^ab\n/g+
+/^ab\n/Ig+
ab\nab\ncd
-/^ab\n/mg+
+/^ab\n/Img+
ab\nab\ncd
-/abc/
+/abc/I
-/abc|bac/
+/abc|bac/I
-/(abc|bac)/
+/(abc|bac)/I
-/(abc|(c|dc))/
+/(abc|(c|dc))/I
-/(abc|(d|de)c)/
+/(abc|(d|de)c)/I
-/a*/
+/a*/I
-/a+/
+/a+/I
-/(baa|a+)/
+/(baa|a+)/I
-/a{0,3}/
+/a{0,3}/I
-/baa{3,}/
+/baa{3,}/I
-/"([^\\"]+|\\.)*"/
+/"([^\\"]+|\\.)*"/I
-/(abc|ab[cd])/
+/(abc|ab[cd])/I
-/(a|.)/
+/(a|.)/I
-/a|ba|\w/
+/a|ba|\w/I
-/abc(?=pqr)/
+/abc(?=pqr)/I
-/...(?<=abc)/
+/...(?<=abc)/I
-/abc(?!pqr)/
+/abc(?!pqr)/I
-/ab./
+/ab./I
-/ab[xyz]/
+/ab[xyz]/I
-/abc*/
+/abc*/I
-/ab.c*/
+/ab.c*/I
-/a.c*/
+/a.c*/I
-/.c*/
+/.c*/I
-/ac*/
+/ac*/I
-/(a.c*|b.c*)/
+/(a.c*|b.c*)/I
-/a.c*|aba/
+/a.c*|aba/I
-/.+a/
+/.+a/I
-/(?=abcda)a.*/
+/(?=abcda)a.*/I
-/(?=a)a.*/
+/(?=a)a.*/I
-/a(b)*/
+/a(b)*/I
-/a\d*/
+/a\d*/I
-/ab\d*/
+/ab\d*/I
-/a(\d)*/
+/a(\d)*/I
-/abcde{0,0}/
+/abcde{0,0}/I
-/ab\d+/
+/ab\d+/I
-/a(?(1)b)/
+/a(?(1)b)/I
-/a(?(1)bag|big)/
+/a(?(1)bag|big)/I
-/a(?(1)bag|big)*/
+/a(?(1)bag|big)*/I
-/a(?(1)bag|big)+/
+/a(?(1)bag|big)+/I
-/a(?(1)b..|b..)/
+/a(?(1)b..|b..)/I
-/ab\d{0}e/
+/ab\d{0}e/I
-/a?b?/
+/a?b?/I
a
b
ab
@@ -586,14 +588,14 @@
*** Failers
\N
-/|-/
+/|-/I
abcd
-abc
\Nab-c
*** Failers
\Nabc
-/a*(b+)(z)(z)/P
+/a*(b+)(z)(z)/IP
aaaabbbbzzzz
aaaabbbbzzzz\O0
aaaabbbbzzzz\O1
@@ -602,7 +604,7 @@
aaaabbbbzzzz\O4
aaaabbbbzzzz\O5
-/^.?abcd/S
+/^.?abcd/IS
/\( # ( at start
(?: # Non-capturing bracket
@@ -611,7 +613,7 @@
(?R) # Recurse - i.e. nested bracketed string
)* # Zero or more contents
\) # Closing )
- /x
+ /Ix
(abcd)
(abcd)xyz
xyz(abcd)
@@ -624,11 +626,11 @@
abcd)
(abcd
-/\( ( (?>[^()]+) | (?R) )* \) /xg
+/\( ( (?>[^()]+) | (?R) )* \) /Ixg
(ab(xy)cd)pqr
1(abcd)(x(y)z)pqr
-/\( (?: (?>[^()]+) | (?R) ) \) /x
+/\( (?: (?>[^()]+) | (?R) ) \) /Ix
(abcd)
(ab(xy)cd)
(a(b(c)d)e)
@@ -636,31 +638,31 @@
*** Failers
()
-/\( (?: (?>[^()]+) | (?R) )? \) /x
+/\( (?: (?>[^()]+) | (?R) )? \) /Ix
()
12(abcde(fsh)xyz(foo(bar))lmno)89
-/\( ( (?>[^()]+) | (?R) )* \) /x
+/\( ( (?>[^()]+) | (?R) )* \) /Ix
(ab(xy)cd)
-/\( ( ( (?>[^()]+) | (?R) )* ) \) /x
+/\( ( ( (?>[^()]+) | (?R) )* ) \) /Ix
(ab(xy)cd)
-/\( (123)? ( ( (?>[^()]+) | (?R) )* ) \) /x
+/\( (123)? ( ( (?>[^()]+) | (?R) )* ) \) /Ix
(ab(xy)cd)
(123ab(xy)cd)
-/\( ( (123)? ( (?>[^()]+) | (?R) )* ) \) /x
+/\( ( (123)? ( (?>[^()]+) | (?R) )* ) \) /Ix
(ab(xy)cd)
(123ab(xy)cd)
-/\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /x
+/\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /Ix
(ab(xy)cd)
-/\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /x
+/\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /Ix
(abcd(xyz<p>qrs)123)
-/\( ( ( (?>[^()]+) | ((?R)) )* ) \) /x
+/\( ( ( (?>[^()]+) | ((?R)) )* ) \) /Ix
(ab(cd)ef)
(ab(cd(ef)gh)ij)
@@ -712,91 +714,91 @@
/[01[:alpha:]%]/D
-/[[.ch.]]/
+/[[.ch.]]/I
-/[[=ch=]]/
+/[[=ch=]]/I
-/[[:rhubarb:]]/
+/[[:rhubarb:]]/I
-/[[:upper:]]/i
+/[[:upper:]]/Ii
A
a
-/[[:lower:]]/i
+/[[:lower:]]/Ii
A
a
-/((?-i)[[:lower:]])[[:lower:]]/i
+/((?-i)[[:lower:]])[[:lower:]]/Ii
ab
aB
*** Failers
Ab
AB
-/[\200-\110]/
+/[\200-\110]/I
-/^(?(0)f|b)oo/
+/^(?(0)f|b)oo/I
-/This one's here because of the large output vector needed/
+/This one's here because of the large output vector needed/I
-/(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\w+)\s+(\270)/
+/(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\w+)\s+(\270)/I
\O900 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 ABC ABC
-/This one's here because Perl does this differently and PCRE can't at present/
+/This one's here because Perl does this differently and PCRE can't at present/I
-/(main(O)?)+/
+/(main(O)?)+/I
mainmain
mainOmain
-/These are all cases where Perl does it differently (nested captures)/
+/These are all cases where Perl does it differently (nested captures)/I
-/^(a(b)?)+$/
+/^(a(b)?)+$/I
aba
-/^(aa(bb)?)+$/
+/^(aa(bb)?)+$/I
aabbaa
-/^(aa|aa(bb))+$/
+/^(aa|aa(bb))+$/I
aabbaa
-/^(aa(bb)??)+$/
+/^(aa(bb)??)+$/I
aabbaa
-/^(?:aa(bb)?)+$/
+/^(?:aa(bb)?)+$/I
aabbaa
-/^(aa(b(b))?)+$/
+/^(aa(b(b))?)+$/I
aabbaa
-/^(?:aa(b(b))?)+$/
+/^(?:aa(b(b))?)+$/I
aabbaa
-/^(?:aa(b(?:b))?)+$/
+/^(?:aa(b(?:b))?)+$/I
aabbaa
-/^(?:aa(bb(?:b))?)+$/
+/^(?:aa(bb(?:b))?)+$/I
aabbbaa
-/^(?:aa(b(?:bb))?)+$/
+/^(?:aa(b(?:bb))?)+$/I
aabbbaa
-/^(?:aa(?:b(b))?)+$/
+/^(?:aa(?:b(b))?)+$/I
aabbaa
-/^(?:aa(?:b(bb))?)+$/
+/^(?:aa(?:b(bb))?)+$/I
aabbbaa
-/^(aa(b(bb))?)+$/
+/^(aa(b(bb))?)+$/I
aabbbaa
-/^(aa(bb(bb))?)+$/
+/^(aa(bb(bb))?)+$/I
aabbbbaa
-/--------------------------------------------------------------------/
+/--------------------------------------------------------------------/I
-/#/xMD
+/#/IxMD
-/a#/xMD
+/a#/IxMD
/[\s]/D
@@ -814,10 +816,10 @@
*** Failers
AB
-/ (?i)abc/xD
+/ (?i)abc/IxD
/#this is a comment
- (?i)abc/xD
+ (?i)abc/IxD
/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/D
@@ -852,29 +854,29 @@
/(x)*+/D
-/^(\w++|\s++)*$/
+/^(\w++|\s++)*$/I
now is the time for all good men to come to the aid of the party
*** Failers
this is not a line with only words and spaces!
-/(\d++)(\w)/
+/(\d++)(\w)/I
12345a
*** Failers
12345+
-/a++b/
+/a++b/I
aaab
-/(a++b)/
+/(a++b)/I
aaab
-/(a++)b/
+/(a++)b/I
aaab
-/([^()]++|\([^()]*\))+/
+/([^()]++|\([^()]*\))+/I
((abc(ade)ufh()()x
-/\(([^()]++|\([^()]+\))+\)/
+/\(([^()]++|\([^()]+\))+\)/I
(abc)
(abc(def)xyz)
*** Failers
@@ -882,13 +884,13 @@
/(abc){1,3}+/D
-/a+?+/
+/a+?+/I
-/a{2,3}?+b/
+/a{2,3}?+b/I
-/(?U)a+?+/
+/(?U)a+?+/I
-/a{2,3}?+b/U
+/a{2,3}?+b/IU
/x(?U)a++b/D
xaaaab
@@ -902,35 +904,35 @@
/^x(?U)(a+)b/D
-/[.x.]/
+/[.x.]/I
-/[=x=]/
+/[=x=]/I
-/[:x:]/
+/[:x:]/I
-/\l/
+/\l/I
-/\L/
+/\L/I
-/\N{name}/
+/\N{name}/I
-/\u/
+/\u/I
-/\U/
+/\U/I
-/[/
+/[/I
-/[a-/
+/[a-/I
-/[[:space:]/
+/[[:space:]/I
-/[\s]/DM
+/[\s]/IDM
-/[[:space:]]/DM
+/[[:space:]]/IDM
-/[[:space:]abcde]/DM
+/[[:space:]abcde]/IDM
-/< (?: (?(R) \d++ | [^<>]*+) | (?R)) * >/x
+/< (?: (?(R) \d++ | [^<>]*+) | (?R)) * >/Ix
<>
<abcd>
<abc <123> hij>
@@ -940,9 +942,9 @@
*** Failers
<abc
-|8J\$WE\<\.rX\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|DM
+|8J\$WE\<\.rX\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|IDM
-|\$\<\.X\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|DM
+|\$\<\.X\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|IDM
/(.*)\d+\1/I
@@ -961,7 +963,7 @@
/(?=a).*/I
-/(?=abc).xyz/iI
+/(?=abc).xyz/IiI
/(?=abc)(?i).xyz/I
@@ -1003,7 +1005,7 @@
/a^b/I
-/^a/mI
+/^a/Im
abcde
xy\nabc
*** Failers
@@ -1015,85 +1017,85 @@
/[ab](?i)cd/IS
-/abc(?C)def/
+/abc(?C)def/I
abcdef
1234abcdef
*** Failers
abcxyz
abcxyzf
-/abc(?C)de(?C1)f/
+/abc(?C)de(?C1)f/I
123abcdef
-/(?C1)\dabc(?C2)def/
+/(?C1)\dabc(?C2)def/I
1234abcdef
*** Failers
abcdef
-/(?C255)ab/
+/(?C255)ab/I
-/(?C256)ab/
+/(?C256)ab/I
-/(?Cab)xx/
+/(?Cab)xx/I
-/(?C12vr)x/
+/(?C12vr)x/I
-/abc(?C)def/
+/abc(?C)def/I
*** Failers
\x83\x0\x61bcdef
-/(abc)(?C)de(?C1)f/
+/(abc)(?C)de(?C1)f/I
123abcdef
123abcdef\C+
123abcdef\C-
*** Failers
123abcdef\C!1
-/(?C0)(abc(?C1))*/
+/(?C0)(abc(?C1))*/I
abcabcabc
abcabc\C!1!3
*** Failers
abcabcabc\C!1!3
-/(\d{3}(?C))*/
+/(\d{3}(?C))*/I
123\C+
123456\C+
123456789\C+
-/((xyz)(?C)p|(?C1)xyzabc)/
+/((xyz)(?C)p|(?C1)xyzabc)/I
xyzabc\C+
-/(X)((xyz)(?C)p|(?C1)xyzabc)/
+/(X)((xyz)(?C)p|(?C1)xyzabc)/I
Xxyzabc\C+
-/(?=(abc))(?C)abcdef/
+/(?=(abc))(?C)abcdef/I
abcdef\C+
-/(?!(abc)(?C1)d)(?C2)abcxyz/
+/(?!(abc)(?C1)d)(?C2)abcxyz/I
abcxyz\C+
-/(?<=(abc)(?C))xyz/
+/(?<=(abc)(?C))xyz/I
abcxyz\C+
-/a(b+)(c*)(?C1)/
+/a(b+)(c*)(?C1)/I
abbbbbccc\C*1
-/a(b+?)(c*?)(?C1)/
+/a(b+?)(c*?)(?C1)/I
abbbbbccc\C*1
-/(?C)abc/
+/(?C)abc/I
-/(?C)^abc/
+/(?C)^abc/I
-/(?C)a|b/S
+/(?C)a|b/IS
-/(?R)/
+/(?R)/I
-/(a|(?R))/
+/(a|(?R))/I
-/(ab|(bc|(de|(?R))))/
+/(ab|(bc|(de|(?R))))/I
-/x(ab|(bc|(de|(?R))))/
+/x(ab|(bc|(de|(?R))))/I
xab
xbc
xde
@@ -1102,18 +1104,18 @@
*** Failers
xyab
-/(ab|(bc|(de|(?1))))/
+/(ab|(bc|(de|(?1))))/I
-/x(ab|(bc|(de|(?1)x)x)x)/
+/x(ab|(bc|(de|(?1)x)x)x)/I
-/^([^()]|\((?1)*\))*$/
+/^([^()]|\((?1)*\))*$/I
abc
a(b)c
a(b(c))d
*** Failers)
a(b(c)d
-/^>abc>([^()]|\((?1)*\))*<xyz<$/
+/^>abc>([^()]|\((?1)*\))*<xyz<$/I
>abc>123<xyz<
>abc>1(2)3<xyz<
>abc>(1(2)3)<xyz<
@@ -1122,7 +1124,7 @@
/(a(?1)+b)/D
-/^\W*(?:((.)\W*(?1)\W*\2|)|((.)\W*(?3)\W*\4|\W*.\W*))\W*$/i
+/^\W*(?:((.)\W*(?1)\W*\2|)|((.)\W*(?3)\W*\4|\W*.\W*))\W*$/Ii
1221
Satan, oscillate my metallic sonatas!
A man, a plan, a canal: Panama!
@@ -1130,21 +1132,21 @@
*** Failers
The quick brown fox
-/^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/
+/^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/I
12
(((2+2)*-3)-7)
-12
*** Failers
((2+2)*-3)-7)
-/^(x(y|(?1){2})z)/
+/^(x(y|(?1){2})z)/I
xyz
xxyzxyzz
*** Failers
xxyzz
xxyzxyzxyzz
-/((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))/x
+/((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))/Ix
<>
<abcd>
<abc <123> hij>
@@ -1154,19 +1156,19 @@
*** Failers
<abc
-/(?1)/
+/(?1)/I
-/((?2)(abc)/
+/((?2)(abc)/I
-/^(abc)def(?1)/
+/^(abc)def(?1)/I
abcdefabc
-/^(a|b|c)=(?1)+/
+/^(a|b|c)=(?1)+/I
a=a
a=b
a=bc
-/^(a|b|c)=((?1))+/
+/^(a|b|c)=((?1))+/I
a=a
a=b
a=bc
@@ -1179,7 +1181,7 @@
/(?P<a>a)...(?P=a)bbb(?P>a)d/D
-/^\W*(?:(?P<one>(?P<two>.)\W*(?P>one)\W*(?P=two)|)|(?P<three>(?P<four>.)\W*(?P>three)\W*(?P=four)|\W*.\W*))\W*$/i
+/^\W*(?:(?P<one>(?P<two>.)\W*(?P>one)\W*(?P=two)|)|(?P<three>(?P<four>.)\W*(?P>three)\W*(?P=four)|\W*.\W*))\W*$/Ii
1221
Satan, oscillate my metallic sonatas!
A man, a plan, a canal: Panama!
@@ -1187,51 +1189,51 @@
*** Failers
The quick brown fox
-/((?(R)a|b))\1(?1)?/
+/((?(R)a|b))\1(?1)?/I
bb
bbaa
-/(.*)a/sI
+/(.*)a/Is
-/(.*)a\1/sI
+/(.*)a\1/Is
-/(.*)a(b)\2/sI
+/(.*)a(b)\2/Is
-/((.*)a|(.*)b)z/sI
+/((.*)a|(.*)b)z/Is
-/((.*)a|(.*)b)z\1/sI
+/((.*)a|(.*)b)z\1/Is
-/((.*)a|(.*)b)z\2/sI
+/((.*)a|(.*)b)z\2/Is
-/((.*)a|(.*)b)z\3/sI
+/((.*)a|(.*)b)z\3/Is
-/((.*)a|^(.*)b)z\3/sI
+/((.*)a|^(.*)b)z\3/Is
-/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a/sI
+/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a/Is
-/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\31/sI
+/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\31/Is
-/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\32/sI
+/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\32/Is
-/(a)(bc)/ND
+/(a)(bc)/IND
abc
-/(?P<one>a)(bc)/ND
+/(?P<one>a)(bc)/IND
abc
-/(a)(?P<named>bc)/ND
+/(a)(?P<named>bc)/IND
-/(a+)*zz/
+/(a+)*zz/I
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazzbbbbbb\M
aaaaaaaaaaaaaz\M
-/(aaa(?C1)bbb|ab)/
+/(aaa(?C1)bbb|ab)/I
aaabbb
aaabbb\C*0
aaabbb\C*1
aaabbb\C*-1
-/ab(?P<one>cd)ef(?P<two>gh)/
+/ab(?P<one>cd)ef(?P<two>gh)/I
abcdefgh
abcdefgh\C1\Gtwo
abcdefgh\Cone\Ctwo
@@ -1241,20 +1243,20 @@
/(?P<Test>)(?P<Tes>)/D
-/(?P<Z>zz)(?P<A>aa)/
+/(?P<Z>zz)(?P<A>aa)/I
zzaa\CZ
zzaa\CA
-/(?P<x>eks)(?P<x>eccs)/
+/(?P<x>eks)(?P<x>eccs)/I
-/(?P<abc>abc(?P<def>def)(?P<abc>xyz))/
+/(?P<abc>abc(?P<def>def)(?P<abc>xyz))/I
-"\[((?P<elem>\d+)(,(?P>elem))*)\]"
+"\[((?P<elem>\d+)(,(?P>elem))*)\]"I
[10,20,30,5,5,4,4,2,43,23,4234]
*** Failers
[]
-"\[((?P<elem>\d+)(,(?P>elem))*)?\]"
+"\[((?P<elem>\d+)(,(?P>elem))*)?\]"I
[10,20,30,5,5,4,4,2,43,23,4234]
[]
@@ -1266,46 +1268,46 @@
/[ab]{1}+/D
-/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/i
+/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/Ii
Baby Bjorn Active Carrier - With free SHIPPING!!
-/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/iS
+/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/IiS
Baby Bjorn Active Carrier - With free SHIPPING!!
-/a*.*b/SD
+/a*.*b/ISD
-/(a|b)*.?c/SD
+/(a|b)*.?c/ISD
/abc(?C255)de(?C)f/D
-/abcde/CD
+/abcde/ICD
abcde
abcdfe
-/a*b/CD
+/a*b/ICD
ab
aaaab
aaaacb
-/a+b/CD
+/a+b/ICD
ab
aaaab
aaaacb
-/(abc|def)x/CD
+/(abc|def)x/ICD
abcx
defx
abcdefzx
-/(ab|cd){3,4}/C
+/(ab|cd){3,4}/IC
ababab
abcdabcd
abcdcdcdcdcd
-/([ab]{,4}c|xy)/CD
+/([ab]{,4}c|xy)/ICD
Note: that { does NOT introduce a quantifier
-/([ab]{1,4}c|xy){4,5}?123/CD
+/([ab]{1,4}c|xy){4,5}?123/ICD
aacaacaacaacaac123
/\b.*/I
@@ -1317,7 +1319,7 @@
/(?!.bcd).*/I
Xbcd12345
-/abcde/
+/abcde/I
ab\P
abc\P
abcd\P
@@ -1326,7 +1328,7 @@
** Failers\P
the quick brown abxyz fox\P
-"^(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/(20)?\d\d$"
+"^(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/(20)?\d\d$"I
13/05/04\P
13/5/2004\P
02/05/09\P
@@ -1356,7 +1358,7 @@
/[abc]+DE/I
-/[abc]?123/
+/[abc]?123/I
123\P
a\P
b\P
@@ -1364,7 +1366,7 @@
c12\P
c123\P
-/^(?:\d){3,5}X/
+/^(?:\d){3,5}X/I
1\P
123\P
123X
@@ -1376,202 +1378,202 @@
1X
123456\P
-/abc/>testsavedregex
+/abc/I>testsavedregex
<testsavedregex
abc
** Failers
bca
-/abc/F>testsavedregex
+/abc/IF>testsavedregex
<testsavedregex
abc
** Failers
bca
-/(a|b)/S>testsavedregex
+/(a|b)/IS>testsavedregex
<testsavedregex
abc
** Failers
def
-/(a|b)/SF>testsavedregex
+/(a|b)/ISF>testsavedregex
<testsavedregex
abc
** Failers
def
-~<(\w+)/?>(.)*</(\1)>~smg
+~<(\w+)/?>(.)*</(\1)>~smgI
<!DOCTYPE seite SYSTEM "http://www.lco.lineas.de/xmlCms.dtd">\n<seite>\n<dokumenteninformation>\n<seitentitel>Partner der LCO</seitentitel>\n<sprache>de</sprache>\n<seitenbeschreibung>Partner der LINEAS Consulting\nGmbH</seitenbeschreibung>\n<schluesselworte>LINEAS Consulting GmbH Hamburg\nPartnerfirmen</schluesselworte>\n<revisit>30 days</revisit>\n<robots>index,follow</robots>\n<menueinformation>\n<aktiv>ja</aktiv>\n<menueposition>3</menueposition>\n<menuetext>Partner</menuetext>\n</menueinformation>\n<lastedited>\n<autor>LCO</autor>\n<firma>LINEAS Consulting</firma>\n<datum>15.10.2003</datum>\n</lastedited>\n</dokumenteninformation>\n<inhalt>\n\n<absatzueberschrift>Die Partnerfirmen der LINEAS Consulting\nGmbH</absatzueberschrift>\n\n<absatz><link ziel="http://www.ca.com/" zielfenster="_blank">\n<bild name="logo_ca.gif" rahmen="no"/></link> <link\nziel="http://www.ey.com/" zielfenster="_blank"><bild\nname="logo_euy.gif" rahmen="no"/></link>\n</absatz>\n\n<absatz><link ziel="http://www.cisco.de/" zielfenster="_blank">\n<bild name="logo_cisco.gif" rahmen="ja"/></link></absatz>\n\n<absatz><link ziel="http://www.atelion.de/"\nzielfenster="_blank"><bild\nname="logo_atelion.gif" rahmen="no"/></link>\n</absatz>\n\n<absatz><link ziel="http://www.line-information.de/"\nzielfenster="_blank">\n<bild name="logo_line_information.gif" rahmen="no"/></link>\n</absatz>\n\n<absatz><bild name="logo_aw.gif" rahmen="no"/></absatz>\n\n<absatz><link ziel="http://www.incognis.de/"\nzielfenster="_blank"><bild\nname="logo_incognis.gif" rahmen="no"/></link></absatz>\n\n<absatz><link ziel="http://www.addcraft.com/"\nzielfenster="_blank"><bild\nname="logo_addcraft.gif" rahmen="no"/></link></absatz>\n\n<absatz><link ziel="http://www.comendo.com/"\nzielfenster="_blank"><bild\nname="logo_comendo.gif" rahmen="no"/></link></absatz>\n\n</inhalt>\n</seite>
/^a/IF
-/line\nbreak/
+/line\nbreak/I
this is a line\nbreak
line one\nthis is a line\nbreak in the second line
-/line\nbreak/f
+/line\nbreak/If
this is a line\nbreak
** Failers
line one\nthis is a line\nbreak in the second line
-/line\nbreak/mf
+/line\nbreak/Imf
this is a line\nbreak
** Failers
line one\nthis is a line\nbreak in the second line
-/ab.cd/P
+/ab.cd/IP
ab-cd
ab=cd
** Failers
ab\ncd
-/ab.cd/Ps
+/ab.cd/IPs
ab-cd
ab=cd
ab\ncd
-/(?i)(?-i)AbCd/
+/(?i)(?-i)AbCd/I
AbCd
** Failers
abcd
-/a{11111111111111111111}/
+/a{11111111111111111111}/I
-/(){64294967295}/
+/(){64294967295}/I
-/(){2,4294967295}/
+/(){2,4294967295}/I
-"(?i:a)(?i:b)(?i:c)(?i:d)(?i:e)(?i:f)(?i:g)(?i:h)(?i:i)(?i:j)(k)(?i:l)A\1B"
+"(?i:a)(?i:b)(?i:c)(?i:d)(?i:e)(?i:f)(?i:g)(?i:h)(?i:i)(?i:j)(k)(?i:l)A\1B"I
abcdefghijklAkB
-"(?P<n0>a)(?P<n1>b)(?P<n2>c)(?P<n3>d)(?P<n4>e)(?P<n5>f)(?P<n6>g)(?P<n7>h)(?P<n8>i)(?P<n9>j)(?P<n10>k)(?P<n11>l)A\11B"
+"(?P<n0>a)(?P<n1>b)(?P<n2>c)(?P<n3>d)(?P<n4>e)(?P<n5>f)(?P<n6>g)(?P<n7>h)(?P<n8>i)(?P<n9>j)(?P<n10>k)(?P<n11>l)A\11B"I
abcdefghijklAkB
-"(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)A\11B"
+"(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)A\11B"I
abcdefghijklAkB
-"(?P<name0>a)(?P<name1>a)(?P<name2>a)(?P<name3>a)(?P<name4>a)(?P<name5>a)(?P<name6>a)(?P<name7>a)(?P<name8>a)(?P<name9>a)(?P<name10>a)(?P<name11>a)(?P<name12>a)(?P<name13>a)(?P<name14>a)(?P<name15>a)(?P<name16>a)(?P<name17>a)(?P<name18>a)(?P<name19>a)(?P<name20>a)(?P<name21>a)(?P<name22>a)(?P<name23>a)(?P<name24>a)(?P<name25>a)(?P<name26>a)(?P<name27>a)(?P<name28>a)(?P<name29>a)(?P<name30>a)(?P<name31>a)(?P<name32>a)(?P<name33>a)(?P<name34>a)(?P<name35>a)(?P<name36>a)(?P<name37>a)(?P<name38>a)(?P<name39>a)(?P<name40>a)(?P<name41>a)(?P<name42>a)(?P<name43>a)(?P<name44>a)(?P<name45>a)(?P<name46>a)(?P<name47>a)(?P<name48>a)(?P<name49>a)(?P<name50>a)(?P<name51>a)(?P<name52>a)(?P<name53>a)(?P<name54>a)(?P<name55>a)(?P<name56>a)(?P<name57>a)(?P<name58>a)(?P<name59>a)(?P<name60>a)(?P<name61>a)(?P<name62>a)(?P<name63>a)(?P<name64>a)(?P<name65>a)(?P<name66>a)(?P<name67>a)(?P<name68>a)(?P<name69>a)(?P<name70>a)(?P<name71>a)(?P<name72>a)(?P<name73>a)(?P<name74>a)(?P<name75>a)(?P<name76>a)(?P<name77>a)(?P<name78>a)(?P<name79>a)(?P<name80>a)(?P<name81>a)(?P<name82>a)(?P<name83>a)(?P<name84>a)(?P<name85>a)(?P<name86>a)(?P<name87>a)(?P<name88>a)(?P<name89>a)(?P<name90>a)(?P<name91>a)(?P<name92>a)(?P<name93>a)(?P<name94>a)(?P<name95>a)(?P<name96>a)(?P<name97>a)(?P<name98>a)(?P<name99>a)(?P<name100>a)"
+"(?P<name0>a)(?P<name1>a)(?P<name2>a)(?P<name3>a)(?P<name4>a)(?P<name5>a)(?P<name6>a)(?P<name7>a)(?P<name8>a)(?P<name9>a)(?P<name10>a)(?P<name11>a)(?P<name12>a)(?P<name13>a)(?P<name14>a)(?P<name15>a)(?P<name16>a)(?P<name17>a)(?P<name18>a)(?P<name19>a)(?P<name20>a)(?P<name21>a)(?P<name22>a)(?P<name23>a)(?P<name24>a)(?P<name25>a)(?P<name26>a)(?P<name27>a)(?P<name28>a)(?P<name29>a)(?P<name30>a)(?P<name31>a)(?P<name32>a)(?P<name33>a)(?P<name34>a)(?P<name35>a)(?P<name36>a)(?P<name37>a)(?P<name38>a)(?P<name39>a)(?P<name40>a)(?P<name41>a)(?P<name42>a)(?P<name43>a)(?P<name44>a)(?P<name45>a)(?P<name46>a)(?P<name47>a)(?P<name48>a)(?P<name49>a)(?P<name50>a)(?P<name51>a)(?P<name52>a)(?P<name53>a)(?P<name54>a)(?P<name55>a)(?P<name56>a)(?P<name57>a)(?P<name58>a)(?P<name59>a)(?P<name60>a)(?P<name61>a)(?P<name62>a)(?P<name63>a)(?P<name64>a)(?P<name65>a)(?P<name66>a)(?P<name67>a)(?P<name68>a)(?P<name69>a)(?P<name70>a)(?P<name71>a)(?P<name72>a)(?P<name73>a)(?P<name74>a)(?P<name75>a)(?P<name76>a)(?P<name77>a)(?P<name78>a)(?P<name79>a)(?P<name80>a)(?P<name81>a)(?P<name82>a)(?P<name83>a)(?P<name84>a)(?P<name85>a)(?P<name86>a)(?P<name87>a)(?P<name88>a)(?P<name89>a)(?P<name90>a)(?P<name91>a)(?P<name92>a)(?P<name93>a)(?P<name94>a)(?P<name95>a)(?P<name96>a)(?P<name97>a)(?P<name98>a)(?P<name99>a)(?P<name100>a)"I
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-"(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)"
+"(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)"I
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-/[^()]*(?:\((?R)\)[^()]*)*/
+/[^()]*(?:\((?R)\)[^()]*)*/I
(this(and)that
(this(and)that)
(this(and)that)stuff
-/[^()]*(?:\((?>(?R))\)[^()]*)*/
+/[^()]*(?:\((?>(?R))\)[^()]*)*/I
(this(and)that
(this(and)that)
-/[^()]*(?:\((?R)\))*[^()]*/
+/[^()]*(?:\((?R)\))*[^()]*/I
(this(and)that
(this(and)that)
-/(?:\((?R)\))*[^()]*/
+/(?:\((?R)\))*[^()]*/I
(this(and)that
(this(and)that)
((this))
-/(?:\((?R)\))|[^()]*/
+/(?:\((?R)\))|[^()]*/I
(this(and)that
(this(and)that)
(this)
((this))
-/a(b)c/PN
+/a(b)c/IPN
abc
-/a(?P<name>b)c/PN
+/a(?P<name>b)c/IPN
abc
-/\x{100}/
+/\x{100}/I
-/\x{0000ff}/
+/\x{0000ff}/I
-/^((?P<A>a1)|(?P<A>a2)b)/
+/^((?P<A>a1)|(?P<A>a2)b)/I
-/^((?P<A>a1)|(?P<A>a2)b)/J
+/^((?P<A>a1)|(?P<A>a2)b)/IJ
a1b\CA
a2b\CA
** Failers
a1b\CZ\CA
-/^(?P<A>a)(?P<A>b)/J
+/^(?P<A>a)(?P<A>b)/IJ
ab\CA
-/^(?P<A>a)(?P<A>b)|cd/J
+/^(?P<A>a)(?P<A>b)|cd/IJ
ab\CA
cd\CA
-/^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/J
+/^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/IJ
cdefgh\CA
-/^((?P<A>a1)|(?P<A>a2)b)/J
+/^((?P<A>a1)|(?P<A>a2)b)/IJ
a1b\GA
a2b\GA
** Failers
a1b\GZ\GA
-/^(?P<A>a)(?P<A>b)/J
+/^(?P<A>a)(?P<A>b)/IJ
ab\GA
-/^(?P<A>a)(?P<A>b)|cd/J
+/^(?P<A>a)(?P<A>b)|cd/IJ
ab\GA
cd\GA
-/^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/J
+/^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/IJ
cdefgh\GA
-/(?J)^((?P<A>a1)|(?P<A>a2)b)/
+/(?J)^((?P<A>a1)|(?P<A>a2)b)/I
a1b\CA
a2b\CA
-/^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<A>d)/
+/^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<A>d)/I
/ In this next test, J is not set at the outer level; consequently it isn't
set in the pattern's options; consequently pcre_get_named_substring() produces
-a random value. /x
+a random value. /Ix
-/^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<C>d)/
+/^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<C>d)/I
a bc d\CA\CB\CC
-/^(?P<A>a)?(?(A)a|b)/
+/^(?P<A>a)?(?(A)a|b)/I
aabc
bc
** Failers
abc
-/(?:(?(ZZ)a|b)(?P<ZZ>X))+/
+/(?:(?(ZZ)a|b)(?P<ZZ>X))+/I
bXaX
-/(?:(?(2y)a|b)(X))+/
+/(?:(?(2y)a|b)(X))+/I
-/(?:(?(ZA)a|b)(?P<ZZ>X))+/
+/(?:(?(ZA)a|b)(?P<ZZ>X))+/I
-/(?:(?(ZZ)a|b)(?(ZZ)a|b)(?P<ZZ>X))+/
+/(?:(?(ZZ)a|b)(?(ZZ)a|b)(?P<ZZ>X))+/I
bbXaaX
-/(?:(?(ZZ)a|\(b\))\\(?P<ZZ>X))+/
+/(?:(?(ZZ)a|\(b\))\\(?P<ZZ>X))+/I
(b)\\Xa\\X
-/(?P<ABC/
+/(?P<ABC/I
-/(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/
+/(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/I
bXXaYYaY
bXYaXXaX
-/()()()()()()()()()(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/
+/()()()()()()()()()(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/I
bXXaYYaY
-/\777/
+/\777/I
-/\s*,\s*/S
+/\s*,\s*/IS
\x0b,\x0b
\x0c,\x0d
-/^abc/m
+/^abc/Im
xyz\nabc
xyz\nabc\<lf>
xyz\r\nabc\<lf>
@@ -1584,7 +1586,7 @@ a random value. /x
xyz\rabc\<crlf>
xyz\rabc\<lf>
-/abc$/m
+/abc$/Im<lf>
xyzabc
xyzabc\n
xyzabc\npqr
@@ -1598,31 +1600,31 @@ a random value. /x
xyzabc\r\n
xyzabc\r\npqr
-/^abc/m<cr>
+/^abc/Im<cr>
xyz\rabcdef
xyz\nabcdef\<lf>
** Failers
xyz\nabcdef
-/^abc/m<lf>
+/^abc/Im<lf>
xyz\nabcdef
xyz\rabcdef\<cr>
** Failers
xyz\rabcdef
-/^abc/m<crlf>
+/^abc/Im<crlf>
xyz\r\nabcdef
xyz\rabcdef\<cr>
** Failers
xyz\rabcdef
-/^abc/m<bad>
+/^abc/Im<bad>
-/abc/
+/abc/I
xyz\rabc\<bad>
abc
-/.*/
+/.*/I<lf>
abc\ndef
abc\rdef
abc\r\ndef
@@ -1633,14 +1635,499 @@ a random value. /x
\<crlf>abc\rdef
\<crlf>abc\r\ndef
-/\w+(.)(.)?def/s
+/\w+(.)(.)?def/Is
abc\ndef
abc\rdef
abc\r\ndef
-+((?:\s|//.*\\n|/[*](?:\\n|.)*?[*]/)*)+
++((?:\s|//.*\\n|/[*](?:\\n|.)*?[*]/)*)+I
/* this is a C style comment */\M
-/(?P<B>25[0-5]|2[0-4]\d|[01]?\d?\d)(?:\.(?P>B)){3}/
+/(?P<B>25[0-5]|2[0-4]\d|[01]?\d?\d)(?:\.(?P>B)){3}/I
+
+/()()()()()()()()()()()()()()()()()()()()
+ ()()()()()()()()()()()()()()()()()()()()
+ ()()()()()()()()()()()()()()()()()()()()
+ ()()()()()()()()()()()()()()()()()()()()
+ ()()()()()()()()()()()()()()()()()()()()
+ (.(.))/Ix
+ XY\O400
+
+/(a*b|(?i:c*(?-i)d))/IS
+
+/()[ab]xyz/IS
+
+/(|)[ab]xyz/IS
+
+/(|c)[ab]xyz/IS
+
+/(|c?)[ab]xyz/IS
+
+/(d?|c?)[ab]xyz/IS
+
+/(d?|c)[ab]xyz/IS
+
+/^a*b\d/D
+
+/^a*+b\d/D
+
+/^a*?b\d/D
+
+/^a+A\d/D
+ aaaA5
+ ** Failers
+ aaaa5
+
+/^a*A\d/IiD
+ aaaA5
+ aaaa5
+
+/(a*|b*)[cd]/IS
+
+/(a+|b*)[cd]/IS
+
+/(a*|b+)[cd]/IS
+
+/(a+|b+)[cd]/IS
+
+/((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
+ ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
+ (((
+ a
+ ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
+ ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
+ )))
+/Ix
+ large nest
+
+/a*\d/B
+
+/a*\D/B
+
+/0*\d/B
+
+/0*\D/B
+
+/a*\s/B
+
+/a*\S/B
+
+/ *\s/B
+
+/ *\S/B
+
+/a*\w/B
+
+/a*\W/B
+
+/=*\w/B
+
+/=*\W/B
+
+/\d*a/B
+
+/\d*2/B
+
+/\d*\d/B
+
+/\d*\D/B
+
+/\d*\s/B
+
+/\d*\S/B
+
+/\d*\w/B
+
+/\d*\W/B
+
+/\D*a/B
+
+/\D*2/B
+
+/\D*\d/B
+
+/\D*\D/B
+
+/\D*\s/B
+
+/\D*\S/B
+
+/\D*\w/B
+
+/\D*\W/B
+
+/\s*a/B
+
+/\s*2/B
+
+/\s*\d/B
+
+/\s*\D/B
+
+/\s*\s/B
+
+/\s*\S/B
+
+/\s*\w/B
+
+/\s*\W/B
+
+/\S*a/B
+
+/\S*2/B
+
+/\S*\d/B
+
+/\S*\D/B
+
+/\S*\s/B
+
+/\S*\S/B
+
+/\S*\w/B
+
+/\S*\W/B
+
+/\w*a/B
+
+/\w*2/B
+
+/\w*\d/B
+
+/\w*\D/B
+
+/\w*\s/B
+
+/\w*\S/B
+
+/\w*\w/B
+
+/\w*\W/B
+
+/\W*a/B
+
+/\W*2/B
+
+/\W*\d/B
+
+/\W*\D/B
+
+/\W*\s/B
+
+/\W*\S/B
+
+/\W*\w/B
+
+/\W*\W/B
+
+/[^a]+a/B
+
+/[^a]+a/Bi
+
+/[^a]+A/Bi
+
+/[^a]+b/B
+
+/[^a]+\d/B
+
+/a*[^a]/B
+
+/(?P<abc>x)(?P<xyz>y)/I
+ xy\Cabc\Cxyz
+
+/(?<abc>x)(?'xyz'y)/I
+ xy\Cabc\Cxyz
+
+/(?<abc'x)(?'xyz'y)/I
+
+/(?<abc>x)(?'xyz>y)/I
+
+/(?P'abc'x)(?P<xyz>y)/I
+
+/^(?:(?(ZZ)a|b)(?<ZZ>X))+/
+ bXaX
+ bXbX
+ ** Failers
+ aXaX
+ aXbX
+
+/^(?P>abc)(?<abcd>xxx)/
+
+/^(?P>abc)(?<abc>x|y)/
+ xx
+ xy
+ yy
+ yx
+
+/^(?P>abc)(?P<abc>x|y)/
+ xx
+ xy
+ yy
+ yx
+
+/^((?(abc)a|b)(?<abc>x|y))+/
+ bxay
+ bxby
+ ** Failers
+ axby
+
+/^(((?P=abc)|X)(?<abc>x|y))+/
+ XxXxxx
+ XxXyyx
+ XxXyxx
+ ** Failers
+ x
+
+/^(?1)(abc)/
+ abcabc
+
+/^(?:(?:\1|X)(a|b))+/
+ Xaaa
+ Xaba
+
+/^[\E\Qa\E-\Qz\E]+/B
+
+/^[a\Q]bc\E]/B
+
+/^[a-\Q\E]/B
+
+/^(?P>abc)[()](?<abc>)/B
+
+/^((?(abc)y)[()](?P<abc>x))+/B
+ (xy)x
+
+/^(?P>abc)\Q()\E(?<abc>)/B
+
+/^(?P>abc)[a\Q(]\E(](?<abc>)/B
+
+/^(?P>abc) # this is (a comment)
+ (?<abc>)/Bx
+
+/^\W*(?:(?<one>(?<two>.)\W*(?&one)\W*\k<two>|)|(?<three>(?<four>.)\W*(?&three)\W*\k'four'|\W*.\W*))\W*$/Ii
+ 1221
+ Satan, oscillate my metallic sonatas!
+ A man, a plan, a canal: Panama!
+ Able was I ere I saw Elba.
+ *** Failers
+ The quick brown fox
+
+/(?=(\w+))\1:/I
+ abcd:
+
+/(?=(?'abc'\w+))\k<abc>:/I
+ abcd:
+
+/(?'abc'\w+):\k<abc>{2}/
+ a:aaxyz
+ ab:ababxyz
+ ** Failers
+ a:axyz
+ ab:abxyz
+
+/(?'abc'a|b)(?<abc>d|e)\k<abc>{2}/J
+ adaa
+ ** Failers
+ addd
+ adbb
+
+/(?'abc'a|b)(?<abc>d|e)(?&abc){2}/J
+ bdaa
+ bdab
+ ** Failers
+ bddd
+
+/^(?<ab>a)? (?(<ab>)b|c) (?('ab')d|e)/x
+ abd
+ ce
+
+/(?(<bc))/
+
+/(?(''))/
+
+/(?('R')stuff)/
+
+/((abc (?(R) (?(R1)1) (?(R2)2) X | (?1) (?2) (?R) ))) /x
+ abcabc1Xabc2XabcXabcabc
+
+/(?<A> (?'B' abc (?(R) (?(R&A)1) (?(R&B)2) X | (?1) (?2) (?R) ))) /x
+ abcabc1Xabc2XabcXabcabc
+
+/(?<A> (?'B' abc (?(R) (?(R&1)1) (?(R&B)2) X | (?1) (?2) (?R) ))) /x
+
+/(?<1> (?'B' abc (?(R) (?(R&1)1) (?(R&B)2) X | (?1) (?2) (?R) ))) /x
+ abcabc1Xabc2XabcXabcabc
+
+/^(?(DEFINE) (?<A> a) (?<B> b) ) (?&A) (?&B) /x
+ abcd
+
+/(?<NAME>(?&NAME_PAT))\s+(?<ADDR>(?&ADDRESS_PAT))
+ (?(DEFINE)
+ (?<NAME_PAT>[a-z]+)
+ (?<ADDRESS_PAT>\d+)
+ )/x
+ metcalfe 33
+
+/^(?(DEFINE) abc | xyz ) /x
+
+/(?(DEFINE) abc) xyz/xI
+
+/(?(DEFINE) abc){3} xyz/x
+
+/(a|)*\d/
+ \O0aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ \O0aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/^a.b/<lf>
+ a\rb
+ a\nb\<cr>
+ ** Failers
+ a\nb
+ a\nb\<any>
+ a\rb\<cr>
+ a\rb\<any>
+
+/^abc./mgx<any>
+ abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x85abc7 \x{2028}abc8 \x{2029}abc9 JUNK
+
+/abc.$/mgx<any>
+ abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc7\x{2028} abc8\x{2029} abc9
+
+/a/<cr><any>
+
+/a/<any><crlf>
+
+/^a\Rb/
+ a\nb
+ a\rb
+ a\r\nb
+ a\x0bb
+ a\x0cb
+ a\x85b
+ ** Failers
+ a\n\rb
+
+/^a\R*b/
+ ab
+ a\nb
+ a\rb
+ a\r\nb
+ a\x0bb
+ a\x0cb
+ a\x85b
+ a\n\rb
+ a\n\r\x85\x0cb
+
+/^a\R+b/
+ a\nb
+ a\rb
+ a\r\nb
+ a\x0bb
+ a\x0cb
+ a\x85b
+ a\n\rb
+ a\n\r\x85\x0cb
+ ** Failers
+ ab
+
+/^a\R{1,3}b/
+ a\nb
+ a\n\rb
+ a\n\r\x85b
+ a\r\n\r\nb
+ a\r\n\r\n\r\nb
+ a\n\r\n\rb
+ a\n\n\r\nb
+ ** Failers
+ a\n\n\n\rb
+ a\r
+
+/^a[\R]b/
+ aRb
+ ** Failers
+ a\nb
+
+/(?&abc)X(?<abc>P)/I
+ abcPXP123
+
+/(?1)X(?<abc>P)/I
+ abcPXP123
+
+/(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))\b(?&byte)(\.(?&byte)){3}/
+ 1.2.3.4
+ 131.111.10.206
+ 10.0.0.0
+ ** Failers
+ 10.6
+ 455.3.4.5
+
+/\b(?&byte)(\.(?&byte)){3}(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))/
+ 1.2.3.4
+ 131.111.10.206
+ 10.0.0.0
+ ** Failers
+ 10.6
+ 455.3.4.5
+
+/(?:a(?&abc)b)*(?<abc>x)/
+ 123axbaxbaxbx456
+ 123axbaxbaxb456
+
+/(?:a(?&abc)b){1,5}(?<abc>x)/
+ 123axbaxbaxbx456
+
+/(?:a(?&abc)b){2,5}(?<abc>x)/
+ 123axbaxbaxbx456
+
+/(?:a(?&abc)b){2,}(?<abc>x)/
+ 123axbaxbaxbx456
+
+/(abc)(?i:(?1))/
+ defabcabcxyz
+ DEFabcABCXYZ
+
+/(abc)(?:(?i)(?1))/
+ defabcabcxyz
+ DEFabcABCXYZ
+
+/^(a(b))\1\g1\g{1}\g-1\g{-1}\g{-02}Z/
+ ababababbbabZXXXX
+
+/^(a)\g-2/
+
+/^(a)\g/
+
+/^(a)\g{0}/
+
+/^(a)\g{3/
+
+/^(a)\g{4a}/
+
+/^a.b/<lf>
+ a\rb
+ *** Failers
+ a\nb
+
+/.+foo/
+ afoo
+ ** Failers
+ \r\nfoo
+ \nfoo
+
+/.+foo/<crlf>
+ afoo
+ \nfoo
+ ** Failers
+ \r\nfoo
+
+/.+foo/<any>
+ afoo
+ ** Failers
+ \nfoo
+ \r\nfoo
+
+/.+foo/s
+ afoo
+ \r\nfoo
+ \nfoo
/ End of testinput2 /
diff --git a/testdata/testinput4 b/testdata/testinput4
index 9ff0fc7..0fb850b 100644
--- a/testdata/testinput4
+++ b/testdata/testinput4
@@ -520,4 +520,7 @@
abcdefg
ab
+/a*\x{100}*\w/8
+ a
+
/ End of testinput4 /
diff --git a/testdata/testinput5 b/testdata/testinput5
index 54643f6..85d3ce6 100644
--- a/testdata/testinput5
+++ b/testdata/testinput5
@@ -270,5 +270,89 @@
/\777/8I
\x{1ff}
\777
+
+/\x{100}*\d/8D
+
+/\x{100}*\s/8D
+
+/\x{100}*\w/8D
+
+/\x{100}*\D/8D
+
+/\x{100}*\S/8D
+
+/\x{100}*\W/8D
+
+/\x{100}+\x{200}/8D
+
+/\x{100}+X/8D
+
+/X+\x{200}/8D
+
+/()()()()()()()()()()
+ ()()()()()()()()()()
+ ()()()()()()()()()()
+ ()()()()()()()()()()
+ A (x) (?41) B/8x
+ AxxB
+
+/^[\x{100}\E-\Q\E\x{150}]/B8
+
+/^[\QĀ\E-\QŐ\E]/B8
+
+/^[\QĀ\E-\QŐ\E/B8
+
+/^abc./mgx8<any>
+ abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x{0085}abc7 \x{2028}abc8 \x{2029}abc9 JUNK
+
+/abc.$/mgx8<any>
+ abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x{0085} abc7\x{2028} abc8\x{2029} abc9
+
+/^a\Rb/8
+ a\nb
+ a\rb
+ a\r\nb
+ a\x0bb
+ a\x0cb
+ a\x{85}b
+ a\x{2028}b
+ a\x{2029}b
+ ** Failers
+ a\n\rb
+
+/^a\R*b/8
+ ab
+ a\nb
+ a\rb
+ a\r\nb
+ a\x0bb
+ a\x0c\x{2028}\x{2029}b
+ a\x{85}b
+ a\n\rb
+ a\n\r\x{85}\x0cb
+
+/^a\R+b/8
+ a\nb
+ a\rb
+ a\r\nb
+ a\x0bb
+ a\x0c\x{2028}\x{2029}b
+ a\x{85}b
+ a\n\rb
+ a\n\r\x{85}\x0cb
+ ** Failers
+ ab
+
+/^a\R{1,3}b/8
+ a\nb
+ a\n\rb
+ a\n\r\x{85}b
+ a\r\n\r\nb
+ a\r\n\r\n\r\nb
+ a\n\r\n\rb
+ a\n\n\r\nb
+ ** Failers
+ a\n\n\n\rb
+ a\r
/ End of testinput5 /
diff --git a/testdata/testinput6 b/testdata/testinput6
index da5b9ca..5a541f3 100644
--- a/testdata/testinput6
+++ b/testdata/testinput6
@@ -747,4 +747,19 @@
/([\pL]=(abc))*X/
L=abcX
+/The next two should be Perl-compatible, but it fails to match \x{e0}. PCRE
+will match it only with UCP support, because without that it has no notion
+of case for anything other than the ASCII letters. /
+
+/((?i)[\x{c0}])/8
+ \x{c0}
+ \x{e0}
+
+/(?i:[\x{c0}])/8
+ \x{c0}
+ \x{e0}
+
+/^\p{Balinese}\p{Cuneiform}\p{Nko}\p{Phags_Pa}\p{Phoenician}/8
+ \x{1b00}\x{12000}\x{7c0}\x{a840}\x{10900}
+
/ End of testinput6 /
diff --git a/testdata/testinput7 b/testdata/testinput7
index 6c8e864..23b35f1 100644
--- a/testdata/testinput7
+++ b/testdata/testinput7
@@ -1775,7 +1775,7 @@
abc
/^a b
- c/x
+ c/x
abc
/ab{1,3}bc/
@@ -1888,7 +1888,7 @@
/{4,5a}bc/
{4,5a}bc
-/^a.b/
+/^a.b/<lf>
a\rb
*** Failers
a\nb
@@ -1931,8 +1931,8 @@
/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
abcdefghijk\12S
-/ab\gdef/
- abgdef
+/ab\hdef/
+ abhdef
/a{0}bc/
bc
@@ -4066,7 +4066,7 @@
xyz\rabc\<crlf>
xyz\rabc\<lf>
-/abc$/m
+/abc$/m<lf>
xyzabc
xyzabc\n
xyzabc\npqr
@@ -4098,7 +4098,7 @@
** Failers
xyz\rabcdef
-/.*/
+/.*/<lf>
abc\ndef
abc\rdef
abc\r\ndef
@@ -4114,4 +4114,119 @@
abc\rdef
abc\r\ndef
+/^\w+=.*(\\\n.*)*/
+ abc=xyz\\\npqr
+
+/^(a()*)*/
+ aaaa
+
+/^(?:a(?:(?:))*)*/
+ aaaa
+
+/^(a()+)+/
+ aaaa
+
+/^(?:a(?:(?:))+)+/
+ aaaa
+
+/(a|)*\d/
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/(?>a|)*\d/
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/(?:a|)*\d/
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/^a.b/<lf>
+ a\rb
+ a\nb\<cr>
+ ** Failers
+ a\nb
+ a\nb\<any>
+ a\rb\<cr>
+ a\rb\<any>
+
+/^abc./mgx<any>
+ abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x85abc7 \x{2028}abc8 \x{2029}abc9 JUNK
+
+/abc.$/mgx<any>
+ abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc7\x{2028} abc8\x{2029} abc9
+
+/^a\Rb/
+ a\nb
+ a\rb
+ a\r\nb
+ a\x0bb
+ a\x0cb
+ a\x85b
+ ** Failers
+ a\n\rb
+
+/^a\R*b/
+ ab
+ a\nb
+ a\rb
+ a\r\nb
+ a\x0bb
+ a\x0cb
+ a\x85b
+ a\n\rb
+ a\n\r\x85\x0cb
+
+/^a\R+b/
+ a\nb
+ a\rb
+ a\r\nb
+ a\x0bb
+ a\x0cb
+ a\x85b
+ a\n\rb
+ a\n\r\x85\x0cb
+ ** Failers
+ ab
+
+/^a\R{1,3}b/
+ a\nb
+ a\n\rb
+ a\n\r\x85b
+ a\r\n\r\nb
+ a\r\n\r\n\r\nb
+ a\n\r\n\rb
+ a\n\n\r\nb
+ ** Failers
+ a\n\n\n\rb
+ a\r
+
+/^a[\R]b/
+ aRb
+ ** Failers
+ a\nb
+
+/.+foo/
+ afoo
+ ** Failers
+ \r\nfoo
+ \nfoo
+
+/.+foo/<crlf>
+ afoo
+ \nfoo
+ ** Failers
+ \r\nfoo
+
+/.+foo/<any>
+ afoo
+ ** Failers
+ \nfoo
+ \r\nfoo
+
+/.+foo/s
+ afoo
+ \r\nfoo
+ \nfoo
+
/ End of testinput7 /
diff --git a/testdata/testinput8 b/testdata/testinput8
index 36db243..a19493f 100644
--- a/testdata/testinput8
+++ b/testdata/testinput8
@@ -537,4 +537,57 @@
/^\x{85}$/8i
\x{85}
+/^abc./mgx8<any>
+ abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x{0085}abc7 \x{2028}abc8 \x{2029}abc9 JUNK
+
+/abc.$/mgx8<any>
+ abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x{0085} abc7\x{2028} abc8\x{2029} abc9
+
+/^a\Rb/8
+ a\nb
+ a\rb
+ a\r\nb
+ a\x0bb
+ a\x0cb
+ a\x{85}b
+ a\x{2028}b
+ a\x{2029}b
+ ** Failers
+ a\n\rb
+
+/^a\R*b/8
+ ab
+ a\nb
+ a\rb
+ a\r\nb
+ a\x0bb
+ a\x0c\x{2028}\x{2029}b
+ a\x{85}b
+ a\n\rb
+ a\n\r\x{85}\x0cb
+
+/^a\R+b/8
+ a\nb
+ a\rb
+ a\r\nb
+ a\x0bb
+ a\x0c\x{2028}\x{2029}b
+ a\x{85}b
+ a\n\rb
+ a\n\r\x{85}\x0cb
+ ** Failers
+ ab
+
+/^a\R{1,3}b/8
+ a\nb
+ a\n\rb
+ a\n\r\x{85}b
+ a\r\n\r\nb
+ a\r\n\r\n\r\nb
+ a\n\r\n\rb
+ a\n\n\r\nb
+ ** Failers
+ a\n\n\n\rb
+ a\r
+
/ End of testinput 8 /
diff --git a/testdata/testoutput1 b/testdata/testoutput1
index a71f41a..b513dca 100644
--- a/testdata/testoutput1
+++ b/testdata/testoutput1
@@ -1817,7 +1817,7 @@ No match
No match
/^a b
- c/x
+ c/x
abc
0: abc
@@ -2093,14 +2093,6 @@ No match
{4,5a}bc
0: {4,5a}bc
-/^a.b/
- a\rb
- 0: a\x0db
- *** Failers
-No match
- a\nb
-No match
-
/abc$/
abc
0: abc
@@ -2197,9 +2189,9 @@ No match
10: j
11: k
-/ab\gdef/
- abgdef
- 0: abgdef
+/ab\hdef/
+ abhdef
+ 0: abhdef
/a{0}bc/
bc
@@ -5480,12 +5472,22 @@ No match
0: b
/^(?:a?b?)*$/
+ \
+ 0:
+ a
+ 0: a
+ ab
+ 0: ab
+ aaa
+ 0: aaa
*** Failers
No match
dbcb
No match
a--
No match
+ aa--
+No match
/((?s)^a(.))((?m)^b$)/
a\nb\nc\n
@@ -6353,4 +6355,220 @@ No match
[a,b,c]
0: [a,b,c]
+/(?-x: )/x
+ A\x20B
+ 0:
+
+"(?x)(?-x: \s*#\s*)"
+ A # B
+ 0: #
+ ** Failers
+No match
+ #
+No match
+
+"(?x-is)(?:(?-ixs) \s*#\s*) include"
+ A #include
+ 0: #include
+ ** Failers
+No match
+ A#include
+No match
+ A #Include
+No match
+
+/a*b*\w/
+ aaabbbb
+ 0: aaabbbb
+ aaaa
+ 0: aaaa
+ a
+ 0: a
+
+/a*b?\w/
+ aaabbbb
+ 0: aaabb
+ aaaa
+ 0: aaaa
+ a
+ 0: a
+
+/a*b{0,4}\w/
+ aaabbbb
+ 0: aaabbbb
+ aaaa
+ 0: aaaa
+ a
+ 0: a
+
+/a*b{0,}\w/
+ aaabbbb
+ 0: aaabbbb
+ aaaa
+ 0: aaaa
+ a
+ 0: a
+
+/a*\d*\w/
+ 0a
+ 0: 0a
+ a
+ 0: a
+
+/a*b *\w/x
+ a
+ 0: a
+
+/a*b#comment
+ *\w/x
+ a
+ 0: a
+
+/a* b *\w/x
+ a
+ 0: a
+
+/^\w+=.*(\\\n.*)*/
+ abc=xyz\\\npqr
+ 0: abc=xyz\
+
+/(?=(\w+))\1:/
+ abcd:
+ 0: abcd:
+ 1: abcd
+
+/^(?=(\w+))\1:/
+ abcd:
+ 0: abcd:
+ 1: abcd
+
+/^\Eabc/
+ abc
+ 0: abc
+
+/^[\Eabc]/
+ a
+ 0: a
+ ** Failers
+No match
+ E
+No match
+
+/^[a-\Ec]/
+ b
+ 0: b
+ ** Failers
+No match
+ -
+No match
+ E
+No match
+
+/^[a\E\E-\Ec]/
+ b
+ 0: b
+ ** Failers
+No match
+ -
+No match
+ E
+No match
+
+/^[\E\Qa\E-\Qz\E]+/
+ b
+ 0: b
+ ** Failers
+No match
+ -
+No match
+
+/^[a\Q]bc\E]/
+ a
+ 0: a
+ ]
+ 0: ]
+ c
+ 0: c
+
+/^[a-\Q\E]/
+ a
+ 0: a
+ -
+ 0: -
+
+/^(a()*)*/
+ aaaa
+ 0: aaaa
+ 1: a
+ 2:
+
+/^(?:a(?:(?:))*)*/
+ aaaa
+ 0: aaaa
+
+/^(a()+)+/
+ aaaa
+ 0: aaaa
+ 1: a
+ 2:
+
+/^(?:a(?:(?:))+)+/
+ aaaa
+ 0: aaaa
+
+/(a){0,3}(?(1)b|(c|))*D/
+ abbD
+ 0: abbD
+ 1: a
+ ccccD
+ 0: ccccD
+ 1: <unset>
+ 2:
+ D
+ 0: D
+ 1: <unset>
+ 2:
+
+/(a|)*\d/
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+No match
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+ 1:
+
+/(?>a|)*\d/
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+No match
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/(?:a|)*\d/
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+No match
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/\Z/g
+ abc\n
+ 0:
+ 0:
+
+/^(?s)(?>.*)(?<!\n)/
+ abc
+ 0: abc
+ abc\n
+No match
+
+/^(?![^\n]*\n\z)/
+ abc
+ 0:
+ abc\n
+No match
+
+/\z(?<!\n)/
+ abc
+ 0:
+ abc\n
+No match
+
/ End of testinput1 /
diff --git a/testdata/testoutput2 b/testdata/testoutput2
index bcde708..4590749 100644
--- a/testdata/testoutput2
+++ b/testdata/testoutput2
@@ -1,10 +1,10 @@
-/(a)b|/
+/(a)b|/I
Capturing subpattern count = 1
No options
No first char
No need char
-/abc/
+/abc/I
Capturing subpattern count = 0
No options
First char = 'a'
@@ -22,7 +22,7 @@ No match
ABC
No match
-/^abc/
+/^abc/I
Capturing subpattern count = 0
Options: anchored
No first char
@@ -38,35 +38,35 @@ No match
\Adefabc
No match
-/a+bc/
+/a+bc/I
Capturing subpattern count = 0
Partial matching not supported
No options
First char = 'a'
Need char = 'c'
-/a*bc/
+/a*bc/I
Capturing subpattern count = 0
Partial matching not supported
No options
No first char
Need char = 'c'
-/a{3}bc/
+/a{3}bc/I
Capturing subpattern count = 0
Partial matching not supported
No options
First char = 'a'
Need char = 'c'
-/(abc|a+z)/
+/(abc|a+z)/I
Capturing subpattern count = 1
Partial matching not supported
No options
First char = 'a'
No need char
-/^abc$/
+/^abc$/I
Capturing subpattern count = 0
Options: anchored
No first char
@@ -78,10 +78,10 @@ No match
def\nabc
No match
-/ab\gdef/X
+/ab\hdef/X
Failed: unrecognized character follows \ at offset 3
-/(?X)ab\gdef/X
+/(?X)ab\hdef/X
Failed: unrecognized character follows \ at offset 7
/x{5,4}/
@@ -111,21 +111,21 @@ Failed: missing ) after comment at offset 7
/(?z)abc/
Failed: unrecognized character after (? at offset 2
-/.*b/
+/.*b/I
Capturing subpattern count = 0
Partial matching not supported
No options
First char at start or follows newline
Need char = 'b'
-/.*?b/
+/.*?b/I
Capturing subpattern count = 0
Partial matching not supported
No options
First char at start or follows newline
Need char = 'b'
-/cat|dog|elephant/
+/cat|dog|elephant/I
Capturing subpattern count = 0
No options
No first char
@@ -135,7 +135,7 @@ No need char
this sentences rambles on and on for a while and then reaches elephant
0: elephant
-/cat|dog|elephant/S
+/cat|dog|elephant/IS
Capturing subpattern count = 0
No options
No first char
@@ -146,7 +146,7 @@ Starting byte set: c d e
this sentences rambles on and on for a while and then reaches elephant
0: elephant
-/cat|dog|elephant/iS
+/cat|dog|elephant/IiS
Capturing subpattern count = 0
Options: caseless
No first char
@@ -157,14 +157,14 @@ Starting byte set: C D E c d e
this sentences rambles on and on for a while to elephant ElePhant
0: elephant
-/a|[bcd]/S
+/a|[bcd]/IS
Capturing subpattern count = 0
No options
No first char
No need char
Starting byte set: a b c d
-/(a|[^\dZ])/S
+/(a|[^\dZ])/IS
Capturing subpattern count = 1
No options
No first char
@@ -184,7 +184,7 @@ Starting byte set: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a
\xed \xee \xef \xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 \xf8 \xf9 \xfa \xfb
\xfc \xfd \xfe \xff
-/(a|b)*[\s]/S
+/(a|b)*[\s]/IS
Capturing subpattern count = 1
No options
No first char
@@ -197,7 +197,7 @@ Failed: reference to non-existent subpattern at offset 6
/{4,5}abc/
Failed: nothing to repeat at offset 4
-/(a)(b)(c)\2/
+/(a)(b)(c)\2/I
Capturing subpattern count = 3
Max back reference = 2
No options
@@ -228,7 +228,7 @@ Matched, but too many substrings
2: b
3: c
-/(a)bc|(a)(b)\2/
+/(a)bc|(a)(b)\2/I
Capturing subpattern count = 3
Max back reference = 2
No options
@@ -270,7 +270,7 @@ Matched, but too many substrings
2: a
3: b
-/abc$/E
+/abc$/IE
Capturing subpattern count = 0
Options: dollar_endonly
First char = 'a'
@@ -287,7 +287,7 @@ No match
/(a)(b)(c)(d)(e)\6/
Failed: reference to non-existent subpattern at offset 17
-/the quick brown fox/
+/the quick brown fox/I
Capturing subpattern count = 0
No options
First char = 't'
@@ -297,7 +297,7 @@ Need char = 'x'
this is a line with the quick brown fox
0: the quick brown fox
-/the quick brown fox/A
+/the quick brown fox/IA
Capturing subpattern count = 0
Options: anchored
No first char
@@ -312,7 +312,7 @@ No match
/ab(?z)cd/
Failed: unrecognized character after (? at offset 4
-/^abc|def/
+/^abc|def/I
Capturing subpattern count = 0
No options
No first char
@@ -322,7 +322,7 @@ No need char
abcdef\B
0: def
-/.*((abc)$|(def))/
+/.*((abc)$|(def))/I
Capturing subpattern count = 3
Partial matching not supported
No options
@@ -338,19 +338,19 @@ No need char
2: <unset>
3: def
-/abc/P
+/abc/IP
abc
0: abc
*** Failers
No match: POSIX code 17: match failed
-/^abc|def/P
+/^abc|def/IP
abcdef
0: abc
abcdef\B
0: def
-/.*((abc)$|(def))/P
+/.*((abc)$|(def))/IP
defabc
0: defabc
1: abc
@@ -360,7 +360,7 @@ No match: POSIX code 17: match failed
1: def
3: def
-/the quick brown fox/P
+/the quick brown fox/IP
the quick brown fox
0: the quick brown fox
*** Failers
@@ -368,28 +368,28 @@ No match: POSIX code 17: match failed
The Quick Brown Fox
No match: POSIX code 17: match failed
-/the quick brown fox/Pi
+/the quick brown fox/IPi
the quick brown fox
0: the quick brown fox
The Quick Brown Fox
0: The Quick Brown Fox
-/abc.def/P
+/abc.def/IP
*** Failers
No match: POSIX code 17: match failed
abc\ndef
No match: POSIX code 17: match failed
-/abc$/P
+/abc$/IP
abc
0: abc
abc\n
0: abc
-/(abc)\2/P
+/(abc)\2/IP
Failed: POSIX code 15: bad back reference at offset 7
-/(abc\1)/P
+/(abc\1)/IP
abc
No match: POSIX code 17: match failed
@@ -399,7 +399,7 @@ Failed: unmatched parentheses at offset 0
/a[]b/
Failed: missing terminating ] for character class at offset 4
-/[^aeiou ]{3,}/
+/[^aeiou ]{3,}/I
Capturing subpattern count = 0
Partial matching not supported
No options
@@ -408,7 +408,7 @@ No need char
co-processors, and for
0: -pr
-/<.*>/
+/<.*>/I
Capturing subpattern count = 0
Partial matching not supported
No options
@@ -417,7 +417,7 @@ Need char = '>'
abc<def>ghi<klm>nop
0: <def>ghi<klm>
-/<.*?>/
+/<.*?>/I
Capturing subpattern count = 0
Partial matching not supported
No options
@@ -426,7 +426,7 @@ Need char = '>'
abc<def>ghi<klm>nop
0: <def>
-/<.*>/U
+/<.*>/IU
Capturing subpattern count = 0
Partial matching not supported
Options: ungreedy
@@ -435,7 +435,7 @@ Need char = '>'
abc<def>ghi<klm>nop
0: <def>
-/(?U)<.*>/
+/(?U)<.*>/I
Capturing subpattern count = 0
Partial matching not supported
Options: ungreedy
@@ -444,7 +444,7 @@ Need char = '>'
abc<def>ghi<klm>nop
0: <def>
-/<.*?>/U
+/<.*?>/IU
Capturing subpattern count = 0
Partial matching not supported
Options: ungreedy
@@ -453,7 +453,7 @@ Need char = '>'
abc<def>ghi<klm>nop
0: <def>ghi<klm>
-/={3,}/U
+/={3,}/IU
Capturing subpattern count = 0
Partial matching not supported
Options: ungreedy
@@ -462,7 +462,7 @@ Need char = '='
abc========def
0: ===
-/(?U)={3,}?/
+/(?U)={3,}?/I
Capturing subpattern count = 0
Partial matching not supported
Options: ungreedy
@@ -471,7 +471,7 @@ Need char = '='
abc========def
0: ========
-/(?<!bar|cattle)foo/
+/(?<!bar|cattle)foo/I
Capturing subpattern count = 0
No options
First char = 'f'
@@ -496,65 +496,65 @@ Failed: lookbehind assertion is not fixed length at offset 14
/(?<!(foo)a\1)bar/
Failed: lookbehind assertion is not fixed length at offset 12
-/(?i)abc/
+/(?i)abc/I
Capturing subpattern count = 0
Options: caseless
First char = 'a' (caseless)
Need char = 'c' (caseless)
-/(a|(?m)a)/
+/(a|(?m)a)/I
Capturing subpattern count = 1
No options
First char = 'a'
No need char
-/(?i)^1234/
+/(?i)^1234/I
Capturing subpattern count = 0
Options: anchored caseless
No first char
No need char
-/(^b|(?i)^d)/
+/(^b|(?i)^d)/I
Capturing subpattern count = 1
Options: anchored
No first char
No need char
-/(?s).*/
+/(?s).*/I
Capturing subpattern count = 0
Partial matching not supported
Options: anchored dotall
No first char
No need char
-/[abcd]/S
+/[abcd]/IS
Capturing subpattern count = 0
No options
No first char
No need char
Starting byte set: a b c d
-/(?i)[abcd]/S
+/(?i)[abcd]/IS
Capturing subpattern count = 0
Options: caseless
No first char
No need char
Starting byte set: A B C D a b c d
-/(?m)[xy]|(b|c)/S
+/(?m)[xy]|(b|c)/IS
Capturing subpattern count = 1
Options: multiline
No first char
No need char
Starting byte set: b c x y
-/(^a|^b)/m
+/(^a|^b)/Im
Capturing subpattern count = 1
Options: multiline
First char at start or follows newline
No need char
-/(?i)(^a|^b)/m
+/(?i)(^a|^b)/Im
Capturing subpattern count = 1
Options: caseless multiline
First char at start or follows newline
@@ -567,6 +567,9 @@ Failed: conditional group contains more than two branches at offset 13
Failed: conditional group contains more than two branches at offset 12
/(?(1a)/
+Failed: missing ) at offset 6
+
+/(?(1a))/
Failed: reference to non-existent subpattern at offset 6
/(?(?i))/
@@ -576,9 +579,9 @@ Failed: assertion expected after (?( at offset 3
Failed: reference to non-existent subpattern at offset 7
/(?(?<ab))/
-Failed: unrecognized character after (?< at offset 5
+Failed: syntax error in subpattern name (missing terminator) at offset 7
-/((?s)blah)\s+\1/
+/((?s)blah)\s+\1/I
Capturing subpattern count = 1
Max back reference = 1
Partial matching not supported
@@ -586,7 +589,7 @@ No options
First char = 'b'
Need char = 'h'
-/((?i)blah)\s+\1/
+/((?i)blah)\s+\1/I
Capturing subpattern count = 1
Max back reference = 1
Partial matching not supported
@@ -594,16 +597,16 @@ No options
First char = 'b' (caseless)
Need char = 'h' (caseless)
-/((?i)b)/DS
+/((?i)b)/IDS
------------------------------------------------------------------
- 0 15 Bra 0
- 3 7 Bra 1
- 6 01 Opt
- 8 NC b
- 10 7 Ket
- 13 00 Opt
- 15 15 Ket
- 18 End
+ 0 17 Bra 0
+ 3 9 Bra 1
+ 8 01 Opt
+ 10 NC b
+ 12 9 Ket
+ 15 00 Opt
+ 17 17 Ket
+ 20 End
------------------------------------------------------------------
Capturing subpattern count = 1
No options
@@ -611,7 +614,7 @@ First char = 'b' (caseless)
No need char
Study returned NULL
-/(a*b|(?i:c*(?-i)d))/S
+/(a*b|(?i:c*(?-i)d))/IS
Capturing subpattern count = 1
Partial matching not supported
No options
@@ -619,7 +622,7 @@ No first char
No need char
Starting byte set: C a b c d
-/a$/
+/a$/I
Capturing subpattern count = 0
No options
First char = 'a'
@@ -635,7 +638,7 @@ No match
\Za\n
No match
-/a$/m
+/a$/Im
Capturing subpattern count = 0
Options: multiline
First char = 'a'
@@ -651,19 +654,19 @@ No match
\Za
No match
-/\Aabc/m
+/\Aabc/Im
Capturing subpattern count = 0
Options: anchored multiline
No first char
No need char
-/^abc/m
+/^abc/Im
Capturing subpattern count = 0
Options: multiline
First char at start or follows newline
Need char = 'c'
-/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/
+/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/I
Capturing subpattern count = 5
Partial matching not supported
Options: anchored
@@ -677,28 +680,28 @@ No need char
4: bbbbccccc
5: def
-/(?<=foo)[ab]/S
+/(?<=foo)[ab]/IS
Capturing subpattern count = 0
No options
No first char
No need char
Starting byte set: a b
-/(?<!foo)(alpha|omega)/S
+/(?<!foo)(alpha|omega)/IS
Capturing subpattern count = 1
No options
No first char
Need char = 'a'
Starting byte set: a o
-/(?!alphabet)[ab]/S
+/(?!alphabet)[ab]/IS
Capturing subpattern count = 0
No options
No first char
No need char
Starting byte set: a b
-/(?<=foo\n)^bar/m
+/(?<=foo\n)^bar/Im
Capturing subpattern count = 0
Options: multiline
No first char
@@ -714,7 +717,7 @@ No match
abc\nbarton
No match
-/^(?<=foo\n)bar/m
+/^(?<=foo\n)bar/Im
Capturing subpattern count = 0
Options: multiline
First char at start or follows newline
@@ -730,7 +733,7 @@ No match
abc\nbarton
No match
-/(?>^abc)/m
+/(?>^abc)/Im
Capturing subpattern count = 0
Options: multiline
First char at start or follows newline
@@ -754,12 +757,8 @@ Failed: lookbehind assertion is not fixed length at offset 12
Failed: lookbehind assertion is not fixed length at offset 13
/The next three are in testinput2 because they have variable length branches/
-Capturing subpattern count = 0
-No options
-First char = 'T'
-Need char = 's'
-/(?<=bullock|donkey)-cart/
+/(?<=bullock|donkey)-cart/I
Capturing subpattern count = 0
No options
First char = '-'
@@ -775,13 +774,13 @@ No match
horse-and-cart
No match
-/(?<=ab(?i)x|y|z)/
+/(?<=ab(?i)x|y|z)/I
Capturing subpattern count = 0
No options
No first char
No need char
-/(?>.*)(?<=(abcd)|(xyz))/
+/(?>.*)(?<=(abcd)|(xyz))/I
Capturing subpattern count = 2
Partial matching not supported
No options
@@ -795,7 +794,7 @@ No need char
1: <unset>
2: xyz
-/(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ/
+/(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ/I
Capturing subpattern count = 0
No options
First char = 'Z'
@@ -823,7 +822,7 @@ No match
bzz
No match
-/(?<!(foo)a)bar/
+/(?<!(foo)a)bar/I
Capturing subpattern count = 1
No options
First char = 'b'
@@ -837,13 +836,13 @@ No match
fooabar
No match
-/This one is here because Perl 5.005_02 doesn't fail it/
+/This one is here because Perl 5.005_02 doesn't fail it/I
Capturing subpattern count = 0
No options
First char = 'T'
Need char = 't'
-/^(a)?(?(1)a|b)+$/
+/^(a)?(?(1)a|b)+$/I
Capturing subpattern count = 1
Options: anchored
No first char
@@ -853,13 +852,13 @@ No match
a
No match
-/This one is here because I think Perl 5.005_02 gets the setting of $1 wrong/
+/This one is here because I think Perl 5.005_02 gets the setting of $1 wrong/I
Capturing subpattern count = 0
No options
First char = 'T'
Need char = 'g'
-/^(a\1?){4}$/
+/^(a\1?){4}$/I
Capturing subpattern count = 1
Max back reference = 1
Options: anchored
@@ -869,7 +868,7 @@ No need char
0: aaaaaa
1: aa
-/These are syntax tests from Perl 5.005/
+/These are syntax tests from Perl 5.005/I
Capturing subpattern count = 0
No options
First char = 'T'
@@ -911,31 +910,31 @@ Failed: reference to non-existent subpattern at offset 2
/(a)|\2/
Failed: reference to non-existent subpattern at offset 6
-/a[b-a]/i
+/a[b-a]/Ii
Failed: range out of order in character class at offset 4
-/a[]b/i
+/a[]b/Ii
Failed: missing terminating ] for character class at offset 4
-/a[/i
+/a[/Ii
Failed: missing terminating ] for character class at offset 2
-/*a/i
+/*a/Ii
Failed: nothing to repeat at offset 0
-/(*)b/i
+/(*)b/Ii
Failed: nothing to repeat at offset 1
-/abc)/i
+/abc)/Ii
Failed: unmatched parentheses at offset 3
-/(abc/i
+/(abc/Ii
Failed: missing ) at offset 4
-/a**/i
+/a**/Ii
Failed: nothing to repeat at offset 2
-/)(/i
+/)(/Ii
Failed: unmatched parentheses at offset 0
/:(?:/
@@ -983,7 +982,7 @@ Failed: POSIX code 9: bad escape sequence at offset 4
/abc/\i
Failed: \ at end of pattern at offset 4
-/(a)bc(d)/
+/(a)bc(d)/I
Capturing subpattern count = 2
No options
First char = 'a'
@@ -1003,7 +1002,7 @@ Need char = 'd'
2: d
copy substring 5 failed -7
-/(.{20})/
+/(.{20})/I
Capturing subpattern count = 1
Partial matching not supported
No options
@@ -1021,7 +1020,7 @@ No need char
1: abcdefghijklmnopqrst
1G abcdefghijklmnopqrst (20)
-/(.{15})/
+/(.{15})/I
Capturing subpattern count = 1
Partial matching not supported
No options
@@ -1036,7 +1035,7 @@ No need char
1C abcdefghijklmno (15)
1G abcdefghijklmno (15)
-/(.{16})/
+/(.{16})/I
Capturing subpattern count = 1
Partial matching not supported
No options
@@ -1053,7 +1052,7 @@ No need char
0L abcdefghijklmnop
1L abcdefghijklmnop
-/^(a|(bc))de(f)/
+/^(a|(bc))de(f)/I
Capturing subpattern count = 3
Options: anchored
No first char
@@ -1091,7 +1090,7 @@ get substring 4 failed -7
3: f
0C adef (4)
-/^abc\00def/
+/^abc\00def/I
Capturing subpattern count = 0
Options: anchored
No first char
@@ -1103,15 +1102,15 @@ No need char
/word ((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
)((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
-)?)?)?)?)?)?)?)?)?otherword/M
-Memory allocation (code space): 432
+)?)?)?)?)?)?)?)?)?otherword/IM
+Memory allocation (code space): 448
Capturing subpattern count = 8
Partial matching not supported
No options
First char = 'w'
Need char = 'd'
-/.*X/D
+/.*X/ID
------------------------------------------------------------------
0 7 Bra 0
3 Any*
@@ -1125,7 +1124,7 @@ No options
First char at start or follows newline
Need char = 'X'
-/.*X/Ds
+/.*X/IDs
------------------------------------------------------------------
0 7 Bra 0
3 Any*
@@ -1139,18 +1138,18 @@ Options: anchored dotall
No first char
Need char = 'X'
-/(.*X|^B)/D
+/(.*X|^B)/ID
------------------------------------------------------------------
- 0 19 Bra 0
- 3 7 Bra 1
- 6 Any*
- 8 X
- 10 6 Alt
- 13 ^
- 14 B
- 16 13 Ket
- 19 19 Ket
- 22 End
+ 0 21 Bra 0
+ 3 9 Bra 1
+ 8 Any*
+ 10 X
+ 12 6 Alt
+ 15 ^
+ 16 B
+ 18 15 Ket
+ 21 21 Ket
+ 24 End
------------------------------------------------------------------
Capturing subpattern count = 1
Partial matching not supported
@@ -1158,18 +1157,18 @@ No options
First char at start or follows newline
No need char
-/(.*X|^B)/Ds
+/(.*X|^B)/IDs
------------------------------------------------------------------
- 0 19 Bra 0
- 3 7 Bra 1
- 6 Any*
- 8 X
- 10 6 Alt
- 13 ^
- 14 B
- 16 13 Ket
- 19 19 Ket
- 22 End
+ 0 21 Bra 0
+ 3 9 Bra 1
+ 8 Any*
+ 10 X
+ 12 6 Alt
+ 15 ^
+ 16 B
+ 18 15 Ket
+ 21 21 Ket
+ 24 End
------------------------------------------------------------------
Capturing subpattern count = 1
Partial matching not supported
@@ -1177,18 +1176,18 @@ Options: anchored dotall
No first char
No need char
-/(?s)(.*X|^B)/D
+/(?s)(.*X|^B)/ID
------------------------------------------------------------------
- 0 19 Bra 0
- 3 7 Bra 1
- 6 Any*
- 8 X
- 10 6 Alt
- 13 ^
- 14 B
- 16 13 Ket
- 19 19 Ket
- 22 End
+ 0 21 Bra 0
+ 3 9 Bra 1
+ 8 Any*
+ 10 X
+ 12 6 Alt
+ 15 ^
+ 16 B
+ 18 15 Ket
+ 21 21 Ket
+ 24 End
------------------------------------------------------------------
Capturing subpattern count = 1
Partial matching not supported
@@ -1196,7 +1195,7 @@ Options: anchored dotall
No first char
No need char
-/(?s:.*X|^B)/D
+/(?s:.*X|^B)/ID
------------------------------------------------------------------
0 25 Bra 0
3 9 Bra 0
@@ -1218,7 +1217,7 @@ No options
First char at start or follows newline
No need char
-/\Biss\B/+
+/\Biss\B/I+
Capturing subpattern count = 0
No options
First char = 'i'
@@ -1227,12 +1226,12 @@ Need char = 's'
0: iss
0+ issippi
-/\Biss\B/+P
+/\Biss\B/I+P
Mississippi
0: iss
0+ issippi
-/iss/G+
+/iss/IG+
Capturing subpattern count = 0
No options
First char = 'i'
@@ -1243,7 +1242,7 @@ Need char = 's'
0: iss
0+ ippi
-/\Biss\B/G+
+/\Biss\B/IG+
Capturing subpattern count = 0
No options
First char = 'i'
@@ -1252,7 +1251,7 @@ Need char = 's'
0: iss
0+ issippi
-/\Biss\B/g+
+/\Biss\B/Ig+
Capturing subpattern count = 0
No options
First char = 'i'
@@ -1267,7 +1266,7 @@ No match
Mississippi\A
No match
-/(?<=[Ms])iss/g+
+/(?<=[Ms])iss/Ig+
Capturing subpattern count = 0
No options
First char = 'i'
@@ -1278,7 +1277,7 @@ Need char = 's'
0: iss
0+ ippi
-/(?<=[Ms])iss/G+
+/(?<=[Ms])iss/IG+
Capturing subpattern count = 0
No options
First char = 'i'
@@ -1287,7 +1286,7 @@ Need char = 's'
0: iss
0+ issippi
-/^iss/g+
+/^iss/Ig+
Capturing subpattern count = 0
Options: anchored
No first char
@@ -1296,7 +1295,7 @@ No need char
0: iss
0+ issippi
-/.*iss/g+
+/.*iss/Ig+
Capturing subpattern count = 0
Partial matching not supported
No options
@@ -1308,7 +1307,7 @@ Need char = 's'
0: xyziss
0+ pqr
-/.i./+g
+/.i./I+g
Capturing subpattern count = 0
No options
No first char
@@ -1338,7 +1337,7 @@ Need char = 'i'
0: Mis
0+ souri river
-/^.is/+g
+/^.is/I+g
Capturing subpattern count = 0
Options: anchored
No first char
@@ -1347,7 +1346,7 @@ No need char
0: Mis
0+ sissippi
-/^ab\n/g+
+/^ab\n/Ig+
Capturing subpattern count = 0
Options: anchored
No first char
@@ -1356,7 +1355,7 @@ No need char
0: ab\x0a
0+ ab\x0acd
-/^ab\n/mg+
+/^ab\n/Img+
Capturing subpattern count = 0
Options: multiline
First char at start or follows newline
@@ -1367,272 +1366,272 @@ Need char = 10
0: ab\x0a
0+ cd
-/abc/
+/abc/I
Capturing subpattern count = 0
No options
First char = 'a'
Need char = 'c'
-/abc|bac/
+/abc|bac/I
Capturing subpattern count = 0
No options
No first char
Need char = 'c'
-/(abc|bac)/
+/(abc|bac)/I
Capturing subpattern count = 1
No options
No first char
Need char = 'c'
-/(abc|(c|dc))/
+/(abc|(c|dc))/I
Capturing subpattern count = 2
No options
No first char
Need char = 'c'
-/(abc|(d|de)c)/
+/(abc|(d|de)c)/I
Capturing subpattern count = 2
No options
No first char
Need char = 'c'
-/a*/
+/a*/I
Capturing subpattern count = 0
Partial matching not supported
No options
No first char
No need char
-/a+/
+/a+/I
Capturing subpattern count = 0
Partial matching not supported
No options
First char = 'a'
No need char
-/(baa|a+)/
+/(baa|a+)/I
Capturing subpattern count = 1
Partial matching not supported
No options
No first char
Need char = 'a'
-/a{0,3}/
+/a{0,3}/I
Capturing subpattern count = 0
Partial matching not supported
No options
No first char
No need char
-/baa{3,}/
+/baa{3,}/I
Capturing subpattern count = 0
Partial matching not supported
No options
First char = 'b'
Need char = 'a'
-/"([^\\"]+|\\.)*"/
+/"([^\\"]+|\\.)*"/I
Capturing subpattern count = 1
Partial matching not supported
No options
First char = '"'
Need char = '"'
-/(abc|ab[cd])/
+/(abc|ab[cd])/I
Capturing subpattern count = 1
No options
First char = 'a'
No need char
-/(a|.)/
+/(a|.)/I
Capturing subpattern count = 1
No options
No first char
No need char
-/a|ba|\w/
+/a|ba|\w/I
Capturing subpattern count = 0
No options
No first char
No need char
-/abc(?=pqr)/
+/abc(?=pqr)/I
Capturing subpattern count = 0
No options
First char = 'a'
Need char = 'r'
-/...(?<=abc)/
+/...(?<=abc)/I
Capturing subpattern count = 0
No options
No first char
No need char
-/abc(?!pqr)/
+/abc(?!pqr)/I
Capturing subpattern count = 0
No options
First char = 'a'
Need char = 'c'
-/ab./
+/ab./I
Capturing subpattern count = 0
No options
First char = 'a'
Need char = 'b'
-/ab[xyz]/
+/ab[xyz]/I
Capturing subpattern count = 0
No options
First char = 'a'
Need char = 'b'
-/abc*/
+/abc*/I
Capturing subpattern count = 0
Partial matching not supported
No options
First char = 'a'
Need char = 'b'
-/ab.c*/
+/ab.c*/I
Capturing subpattern count = 0
Partial matching not supported
No options
First char = 'a'
Need char = 'b'
-/a.c*/
+/a.c*/I
Capturing subpattern count = 0
Partial matching not supported
No options
First char = 'a'
No need char
-/.c*/
+/.c*/I
Capturing subpattern count = 0
Partial matching not supported
No options
No first char
No need char
-/ac*/
+/ac*/I
Capturing subpattern count = 0
Partial matching not supported
No options
First char = 'a'
No need char
-/(a.c*|b.c*)/
+/(a.c*|b.c*)/I
Capturing subpattern count = 1
Partial matching not supported
No options
No first char
No need char
-/a.c*|aba/
+/a.c*|aba/I
Capturing subpattern count = 0
Partial matching not supported
No options
First char = 'a'
No need char
-/.+a/
+/.+a/I
Capturing subpattern count = 0
Partial matching not supported
No options
No first char
Need char = 'a'
-/(?=abcda)a.*/
+/(?=abcda)a.*/I
Capturing subpattern count = 0
Partial matching not supported
No options
First char = 'a'
Need char = 'a'
-/(?=a)a.*/
+/(?=a)a.*/I
Capturing subpattern count = 0
Partial matching not supported
No options
First char = 'a'
No need char
-/a(b)*/
+/a(b)*/I
Capturing subpattern count = 1
No options
First char = 'a'
No need char
-/a\d*/
+/a\d*/I
Capturing subpattern count = 0
Partial matching not supported
No options
First char = 'a'
No need char
-/ab\d*/
+/ab\d*/I
Capturing subpattern count = 0
Partial matching not supported
No options
First char = 'a'
Need char = 'b'
-/a(\d)*/
+/a(\d)*/I
Capturing subpattern count = 1
No options
First char = 'a'
No need char
-/abcde{0,0}/
+/abcde{0,0}/I
Capturing subpattern count = 0
No options
First char = 'a'
Need char = 'd'
-/ab\d+/
+/ab\d+/I
Capturing subpattern count = 0
Partial matching not supported
No options
First char = 'a'
Need char = 'b'
-/a(?(1)b)/
+/a(?(1)b)/I
Capturing subpattern count = 0
No options
First char = 'a'
No need char
-/a(?(1)bag|big)/
+/a(?(1)bag|big)/I
Capturing subpattern count = 0
No options
First char = 'a'
Need char = 'g'
-/a(?(1)bag|big)*/
+/a(?(1)bag|big)*/I
Capturing subpattern count = 0
No options
First char = 'a'
No need char
-/a(?(1)bag|big)+/
+/a(?(1)bag|big)+/I
Capturing subpattern count = 0
No options
First char = 'a'
Need char = 'g'
-/a(?(1)b..|b..)/
+/a(?(1)b..|b..)/I
Capturing subpattern count = 0
No options
First char = 'a'
Need char = 'b'
-/ab\d{0}e/
+/ab\d{0}e/I
Capturing subpattern count = 0
No options
First char = 'a'
Need char = 'e'
-/a?b?/
+/a?b?/I
Capturing subpattern count = 0
No options
No first char
@@ -1650,7 +1649,7 @@ No need char
\N
No match
-/|-/
+/|-/I
Capturing subpattern count = 0
No options
No first char
@@ -1666,7 +1665,7 @@ No need char
\Nabc
No match
-/a*(b+)(z)(z)/P
+/a*(b+)(z)(z)/IP
aaaabbbbzzzz
0: aaaabbbbzz
1: bbbb
@@ -1693,7 +1692,7 @@ No match
2: z
3: z
-/^.?abcd/S
+/^.?abcd/IS
Capturing subpattern count = 0
Options: anchored
No first char
@@ -1707,7 +1706,7 @@ Study returned NULL
(?R) # Recurse - i.e. nested bracketed string
)* # Zero or more contents
\) # Closing )
- /x
+ /Ix
Capturing subpattern count = 0
Partial matching not supported
Options: extended
@@ -1736,7 +1735,7 @@ No match
(abcd
No match
-/\( ( (?>[^()]+) | (?R) )* \) /xg
+/\( ( (?>[^()]+) | (?R) )* \) /Ixg
Capturing subpattern count = 1
Partial matching not supported
Options: extended
@@ -1751,7 +1750,7 @@ Need char = ')'
0: (x(y)z)
1: z
-/\( (?: (?>[^()]+) | (?R) ) \) /x
+/\( (?: (?>[^()]+) | (?R) ) \) /Ix
Capturing subpattern count = 0
Partial matching not supported
Options: extended
@@ -1770,7 +1769,7 @@ No match
()
No match
-/\( (?: (?>[^()]+) | (?R) )? \) /x
+/\( (?: (?>[^()]+) | (?R) )? \) /Ix
Capturing subpattern count = 0
Partial matching not supported
Options: extended
@@ -1781,7 +1780,7 @@ Need char = ')'
12(abcde(fsh)xyz(foo(bar))lmno)89
0: (fsh)
-/\( ( (?>[^()]+) | (?R) )* \) /x
+/\( ( (?>[^()]+) | (?R) )* \) /Ix
Capturing subpattern count = 1
Partial matching not supported
Options: extended
@@ -1791,7 +1790,7 @@ Need char = ')'
0: (ab(xy)cd)
1: cd
-/\( ( ( (?>[^()]+) | (?R) )* ) \) /x
+/\( ( ( (?>[^()]+) | (?R) )* ) \) /Ix
Capturing subpattern count = 2
Partial matching not supported
Options: extended
@@ -1802,7 +1801,7 @@ Need char = ')'
1: ab(xy)cd
2: cd
-/\( (123)? ( ( (?>[^()]+) | (?R) )* ) \) /x
+/\( (123)? ( ( (?>[^()]+) | (?R) )* ) \) /Ix
Capturing subpattern count = 3
Partial matching not supported
Options: extended
@@ -1819,7 +1818,7 @@ Need char = ')'
2: ab(xy)cd
3: cd
-/\( ( (123)? ( (?>[^()]+) | (?R) )* ) \) /x
+/\( ( (123)? ( (?>[^()]+) | (?R) )* ) \) /Ix
Capturing subpattern count = 3
Partial matching not supported
Options: extended
@@ -1836,7 +1835,7 @@ Need char = ')'
2: 123
3: cd
-/\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /x
+/\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /Ix
Capturing subpattern count = 11
Partial matching not supported
Options: extended
@@ -1856,7 +1855,7 @@ Need char = ')'
10: ab(xy)cd
11: cd
-/\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /x
+/\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /Ix
Capturing subpattern count = 3
Partial matching not supported
Options: extended
@@ -1868,7 +1867,7 @@ Need char = ')'
2: 123
3: <unset>
-/\( ( ( (?>[^()]+) | ((?R)) )* ) \) /x
+/\( ( ( (?>[^()]+) | ((?R)) )* ) \) /Ix
Capturing subpattern count = 3
Partial matching not supported
Options: extended
@@ -2185,16 +2184,16 @@ No options
No first char
No need char
-/[[.ch.]]/
+/[[.ch.]]/I
Failed: POSIX collating elements are not supported at offset 1
-/[[=ch=]]/
+/[[=ch=]]/I
Failed: POSIX collating elements are not supported at offset 1
-/[[:rhubarb:]]/
+/[[:rhubarb:]]/I
Failed: unknown POSIX class name at offset 3
-/[[:upper:]]/i
+/[[:upper:]]/Ii
Capturing subpattern count = 0
Options: caseless
No first char
@@ -2204,7 +2203,7 @@ No need char
a
0: a
-/[[:lower:]]/i
+/[[:lower:]]/Ii
Capturing subpattern count = 0
Options: caseless
No first char
@@ -2214,7 +2213,7 @@ No need char
a
0: a
-/((?-i)[[:lower:]])[[:lower:]]/i
+/((?-i)[[:lower:]])[[:lower:]]/Ii
Capturing subpattern count = 1
Options: caseless
No first char
@@ -2233,19 +2232,19 @@ No match
AB
No match
-/[\200-\110]/
+/[\200-\110]/I
Failed: range out of order in character class at offset 9
-/^(?(0)f|b)oo/
+/^(?(0)f|b)oo/I
Failed: invalid condition (?(0) at offset 6
-/This one's here because of the large output vector needed/
+/This one's here because of the large output vector needed/I
Capturing subpattern count = 0
No options
First char = 'T'
Need char = 'd'
-/(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\w+)\s+(\270)/
+/(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\w+)\s+(\270)/I
Capturing subpattern count = 271
Max back reference = 270
Partial matching not supported
@@ -2526,13 +2525,13 @@ No need char
270: ABC
271: ABC
-/This one's here because Perl does this differently and PCRE can't at present/
+/This one's here because Perl does this differently and PCRE can't at present/I
Capturing subpattern count = 0
No options
First char = 'T'
Need char = 't'
-/(main(O)?)+/
+/(main(O)?)+/I
Capturing subpattern count = 2
No options
First char = 'm'
@@ -2545,13 +2544,13 @@ Need char = 'n'
1: main
2: O
-/These are all cases where Perl does it differently (nested captures)/
+/These are all cases where Perl does it differently (nested captures)/I
Capturing subpattern count = 1
No options
First char = 'T'
Need char = 's'
-/^(a(b)?)+$/
+/^(a(b)?)+$/I
Capturing subpattern count = 2
Options: anchored
No first char
@@ -2561,7 +2560,7 @@ No need char
1: a
2: b
-/^(aa(bb)?)+$/
+/^(aa(bb)?)+$/I
Capturing subpattern count = 2
Options: anchored
No first char
@@ -2571,7 +2570,7 @@ No need char
1: aa
2: bb
-/^(aa|aa(bb))+$/
+/^(aa|aa(bb))+$/I
Capturing subpattern count = 2
Options: anchored
No first char
@@ -2581,7 +2580,7 @@ No need char
1: aa
2: bb
-/^(aa(bb)??)+$/
+/^(aa(bb)??)+$/I
Capturing subpattern count = 2
Options: anchored
No first char
@@ -2591,7 +2590,7 @@ No need char
1: aa
2: bb
-/^(?:aa(bb)?)+$/
+/^(?:aa(bb)?)+$/I
Capturing subpattern count = 1
Options: anchored
No first char
@@ -2600,7 +2599,7 @@ No need char
0: aabbaa
1: bb
-/^(aa(b(b))?)+$/
+/^(aa(b(b))?)+$/I
Capturing subpattern count = 3
Options: anchored
No first char
@@ -2611,7 +2610,7 @@ No need char
2: bb
3: b
-/^(?:aa(b(b))?)+$/
+/^(?:aa(b(b))?)+$/I
Capturing subpattern count = 2
Options: anchored
No first char
@@ -2621,7 +2620,7 @@ No need char
1: bb
2: b
-/^(?:aa(b(?:b))?)+$/
+/^(?:aa(b(?:b))?)+$/I
Capturing subpattern count = 1
Options: anchored
No first char
@@ -2630,7 +2629,7 @@ No need char
0: aabbaa
1: bb
-/^(?:aa(bb(?:b))?)+$/
+/^(?:aa(bb(?:b))?)+$/I
Capturing subpattern count = 1
Options: anchored
No first char
@@ -2639,7 +2638,7 @@ No need char
0: aabbbaa
1: bbb
-/^(?:aa(b(?:bb))?)+$/
+/^(?:aa(b(?:bb))?)+$/I
Capturing subpattern count = 1
Options: anchored
No first char
@@ -2648,7 +2647,7 @@ No need char
0: aabbbaa
1: bbb
-/^(?:aa(?:b(b))?)+$/
+/^(?:aa(?:b(b))?)+$/I
Capturing subpattern count = 1
Options: anchored
No first char
@@ -2657,7 +2656,7 @@ No need char
0: aabbaa
1: b
-/^(?:aa(?:b(bb))?)+$/
+/^(?:aa(?:b(bb))?)+$/I
Capturing subpattern count = 1
Options: anchored
No first char
@@ -2666,7 +2665,7 @@ No need char
0: aabbbaa
1: bb
-/^(aa(b(bb))?)+$/
+/^(aa(b(bb))?)+$/I
Capturing subpattern count = 3
Options: anchored
No first char
@@ -2677,7 +2676,7 @@ No need char
2: bbb
3: bb
-/^(aa(bb(bb))?)+$/
+/^(aa(bb(bb))?)+$/I
Capturing subpattern count = 3
Options: anchored
No first char
@@ -2688,13 +2687,13 @@ No need char
2: bbbb
3: bb
-/--------------------------------------------------------------------/
+/--------------------------------------------------------------------/I
Capturing subpattern count = 0
No options
First char = '-'
Need char = '-'
-/#/xMD
+/#/IxMD
Memory allocation (code space): 7
------------------------------------------------------------------
0 3 Bra 0
@@ -2706,7 +2705,7 @@ Options: extended
No first char
No need char
-/a#/xMD
+/a#/IxMD
Memory allocation (code space): 9
------------------------------------------------------------------
0 5 Bra 0
@@ -2767,15 +2766,15 @@ No match
/(a(?i)b)/D
------------------------------------------------------------------
- 0 17 Bra 0
- 3 9 Bra 1
- 6 a
- 8 01 Opt
- 10 NC b
- 12 9 Ket
- 15 00 Opt
- 17 17 Ket
- 20 End
+ 0 19 Bra 0
+ 3 11 Bra 1
+ 8 a
+ 10 01 Opt
+ 12 NC b
+ 14 11 Ket
+ 17 00 Opt
+ 19 19 Ket
+ 22 End
------------------------------------------------------------------
Capturing subpattern count = 1
No options
@@ -2792,7 +2791,7 @@ No match
AB
No match
-/ (?i)abc/xD
+/ (?i)abc/IxD
------------------------------------------------------------------
0 9 Bra 0
3 NC abc
@@ -2805,7 +2804,7 @@ First char = 'a' (caseless)
Need char = 'c' (caseless)
/#this is a comment
- (?i)abc/xD
+ (?i)abc/IxD
------------------------------------------------------------------
0 9 Bra 0
3 NC abc
@@ -2924,13 +2923,11 @@ Need char = 'c'
/x*+\w/D
------------------------------------------------------------------
- 0 12 Bra 0
- 3 5 Once
- 6 x*
- 8 5 Ket
- 11 \w
- 12 12 Ket
- 15 End
+ 0 6 Bra 0
+ 3 x*+
+ 5 \w
+ 6 6 Ket
+ 9 End
------------------------------------------------------------------
Capturing subpattern count = 0
Partial matching not supported
@@ -2944,12 +2941,10 @@ No match
/x?+/D
------------------------------------------------------------------
- 0 11 Bra 0
- 3 5 Once
- 6 x?
- 8 5 Ket
- 11 11 Ket
- 14 End
+ 0 5 Bra 0
+ 3 x?+
+ 5 5 Ket
+ 8 End
------------------------------------------------------------------
Capturing subpattern count = 0
No options
@@ -2958,12 +2953,10 @@ No need char
/x++/D
------------------------------------------------------------------
- 0 11 Bra 0
- 3 5 Once
- 6 x+
- 8 5 Ket
- 11 11 Ket
- 14 End
+ 0 5 Bra 0
+ 3 x++
+ 5 5 Ket
+ 8 End
------------------------------------------------------------------
Capturing subpattern count = 0
Partial matching not supported
@@ -2976,7 +2969,7 @@ No need char
0 15 Bra 0
3 9 Once
6 x
- 8 x{,2}
+ 8 x{0,2}
12 9 Ket
15 15 Ket
18 End
@@ -2989,22 +2982,22 @@ No need char
/(x)*+/D
------------------------------------------------------------------
- 0 18 Bra 0
- 3 12 Once
+ 0 20 Bra 0
+ 3 14 Once
6 Brazero
- 7 5 Bra 1
- 10 x
- 12 5 KetRmax
- 15 12 Ket
- 18 18 Ket
- 21 End
+ 7 7 Bra 1
+ 12 x
+ 14 7 KetRmax
+ 17 14 Ket
+ 20 20 Ket
+ 23 End
------------------------------------------------------------------
Capturing subpattern count = 1
No options
No first char
No need char
-/^(\w++|\s++)*$/
+/^(\w++|\s++)*$/I
Capturing subpattern count = 1
Partial matching not supported
Options: anchored
@@ -3018,7 +3011,7 @@ No match
this is not a line with only words and spaces!
No match
-/(\d++)(\w)/
+/(\d++)(\w)/I
Capturing subpattern count = 2
Partial matching not supported
No options
@@ -3033,7 +3026,7 @@ No match
12345+
No match
-/a++b/
+/a++b/I
Capturing subpattern count = 0
Partial matching not supported
No options
@@ -3042,7 +3035,7 @@ Need char = 'b'
aaab
0: aaab
-/(a++b)/
+/(a++b)/I
Capturing subpattern count = 1
Partial matching not supported
No options
@@ -3052,7 +3045,7 @@ Need char = 'b'
0: aaab
1: aaab
-/(a++)b/
+/(a++)b/I
Capturing subpattern count = 1
Partial matching not supported
No options
@@ -3062,7 +3055,7 @@ Need char = 'b'
0: aaab
1: aaa
-/([^()]++|\([^()]*\))+/
+/([^()]++|\([^()]*\))+/I
Capturing subpattern count = 1
Partial matching not supported
No options
@@ -3072,7 +3065,7 @@ No need char
0: abc(ade)ufh()()x
1: x
-/\(([^()]++|\([^()]+\))+\)/
+/\(([^()]++|\([^()]+\))+\)/I
Capturing subpattern count = 1
Partial matching not supported
No options
@@ -3091,52 +3084,50 @@ No match
/(abc){1,3}+/D
------------------------------------------------------------------
- 0 53 Bra 0
- 3 47 Once
- 6 9 Bra 1
- 9 abc
- 15 9 Ket
- 18 Brazero
- 19 28 Bra 0
- 22 9 Bra 1
- 25 abc
- 31 9 Ket
- 34 Brazero
- 35 9 Bra 1
- 38 abc
- 44 9 Ket
- 47 28 Ket
- 50 47 Ket
- 53 53 Ket
- 56 End
+ 0 59 Bra 0
+ 3 53 Once
+ 6 11 Bra 1
+ 11 abc
+ 17 11 Ket
+ 20 Brazero
+ 21 32 Bra 0
+ 24 11 Bra 1
+ 29 abc
+ 35 11 Ket
+ 38 Brazero
+ 39 11 Bra 1
+ 44 abc
+ 50 11 Ket
+ 53 32 Ket
+ 56 53 Ket
+ 59 59 Ket
+ 62 End
------------------------------------------------------------------
Capturing subpattern count = 1
No options
First char = 'a'
Need char = 'c'
-/a+?+/
+/a+?+/I
Failed: nothing to repeat at offset 3
-/a{2,3}?+b/
+/a{2,3}?+b/I
Failed: nothing to repeat at offset 7
-/(?U)a+?+/
+/(?U)a+?+/I
Failed: nothing to repeat at offset 7
-/a{2,3}?+b/U
+/a{2,3}?+b/IU
Failed: nothing to repeat at offset 7
/x(?U)a++b/D
------------------------------------------------------------------
- 0 15 Bra 0
+ 0 9 Bra 0
3 x
- 5 5 Once
- 8 a+
- 10 5 Ket
- 13 b
- 15 15 Ket
- 18 End
+ 5 a++
+ 7 b
+ 9 9 Ket
+ 12 End
------------------------------------------------------------------
Capturing subpattern count = 0
Partial matching not supported
@@ -3148,14 +3139,12 @@ Need char = 'b'
/(?U)xa++b/D
------------------------------------------------------------------
- 0 15 Bra 0
+ 0 9 Bra 0
3 x
- 5 5 Once
- 8 a+
- 10 5 Ket
- 13 b
- 15 15 Ket
- 18 End
+ 5 a++
+ 7 b
+ 9 9 Ket
+ 12 End
------------------------------------------------------------------
Capturing subpattern count = 0
Partial matching not supported
@@ -3167,24 +3156,24 @@ Need char = 'b'
/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/D
------------------------------------------------------------------
- 0 106 Bra 0
+ 0 116 Bra 0
3 ^
- 4 99 Bra 1
- 7 5 Bra 2
- 10 a+
- 12 5 Ket
- 15 37 Bra 3
- 18 [ab]+?
- 52 37 Ket
- 55 37 Bra 4
- 58 [bc]+
- 92 37 Ket
- 95 5 Bra 5
- 98 \w*
-100 5 Ket
-103 99 Ket
-106 106 Ket
-109 End
+ 4 109 Bra 1
+ 9 7 Bra 2
+ 14 a+
+ 16 7 Ket
+ 19 39 Bra 3
+ 24 [ab]+?
+ 58 39 Ket
+ 61 39 Bra 4
+ 66 [bc]+
+100 39 Ket
+103 7 Bra 5
+108 \w*
+110 7 Ket
+113 109 Ket
+116 116 Ket
+119 End
------------------------------------------------------------------
Capturing subpattern count = 5
Partial matching not supported
@@ -3197,7 +3186,7 @@ No need char
0 10 Bra 0
3 ^
4 x
- 6 a+?
+ 6 a++
8 b
10 10 Ket
13 End
@@ -3210,15 +3199,15 @@ Need char = 'b'
/^x(?U)(a+)b/D
------------------------------------------------------------------
- 0 16 Bra 0
+ 0 18 Bra 0
3 ^
4 x
- 6 5 Bra 1
- 9 a+?
- 11 5 Ket
- 14 b
- 16 16 Ket
- 19 End
+ 6 7 Bra 1
+ 11 a+?
+ 13 7 Ket
+ 16 b
+ 18 18 Ket
+ 21 End
------------------------------------------------------------------
Capturing subpattern count = 1
Partial matching not supported
@@ -3226,40 +3215,40 @@ Options: anchored
No first char
Need char = 'b'
-/[.x.]/
+/[.x.]/I
Failed: POSIX collating elements are not supported at offset 0
-/[=x=]/
+/[=x=]/I
Failed: POSIX collating elements are not supported at offset 0
-/[:x:]/
+/[:x:]/I
Failed: POSIX named classes are supported only within a class at offset 0
-/\l/
+/\l/I
Failed: PCRE does not support \L, \l, \N, \U, or \u at offset 1
-/\L/
+/\L/I
Failed: PCRE does not support \L, \l, \N, \U, or \u at offset 1
-/\N{name}/
+/\N{name}/I
Failed: PCRE does not support \L, \l, \N, \U, or \u at offset 1
-/\u/
+/\u/I
Failed: PCRE does not support \L, \l, \N, \U, or \u at offset 1
-/\U/
+/\U/I
Failed: PCRE does not support \L, \l, \N, \U, or \u at offset 1
-/[/
+/[/I
Failed: missing terminating ] for character class at offset 1
-/[a-/
+/[a-/I
Failed: missing terminating ] for character class at offset 3
-/[[:space:]/
+/[[:space:]/I
Failed: missing terminating ] for character class at offset 10
-/[\s]/DM
+/[\s]/IDM
Memory allocation (code space): 40
------------------------------------------------------------------
0 36 Bra 0
@@ -3272,7 +3261,7 @@ No options
No first char
No need char
-/[[:space:]]/DM
+/[[:space:]]/IDM
Memory allocation (code space): 40
------------------------------------------------------------------
0 36 Bra 0
@@ -3285,7 +3274,7 @@ No options
No first char
No need char
-/[[:space:]abcde]/DM
+/[[:space:]abcde]/IDM
Memory allocation (code space): 40
------------------------------------------------------------------
0 36 Bra 0
@@ -3298,7 +3287,7 @@ No options
No first char
No need char
-/< (?: (?(R) \d++ | [^<>]*+) | (?R)) * >/x
+/< (?: (?(R) \d++ | [^<>]*+) | (?R)) * >/Ix
Capturing subpattern count = 0
Partial matching not supported
Options: extended
@@ -3321,7 +3310,7 @@ No match
<abc
No match
-|8J\$WE\<\.rX\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|DM
+|8J\$WE\<\.rX\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|IDM
Memory allocation (code space): 826
------------------------------------------------------------------
0 822 Bra 0
@@ -3335,7 +3324,7 @@ No options
First char = '8'
Need char = 'X'
-|\$\<\.X\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|DM
+|\$\<\.X\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|IDM
Memory allocation (code space): 816
------------------------------------------------------------------
0 812 Bra 0
@@ -3412,7 +3401,7 @@ No options
First char = 'a'
No need char
-/(?=abc).xyz/iI
+/(?=abc).xyz/IiI
Capturing subpattern count = 0
Options: caseless
First char = 'a' (caseless)
@@ -3540,7 +3529,7 @@ No options
First char = 'a'
Need char = 'b'
-/^a/mI
+/^a/Im
Capturing subpattern count = 0
Options: multiline
First char at start or follows newline
@@ -3574,7 +3563,7 @@ No first char
Need char = 'd' (caseless)
Starting byte set: a b
-/abc(?C)def/
+/abc(?C)def/I
Capturing subpattern count = 0
No options
First char = 'a'
@@ -3596,7 +3585,7 @@ No match
0 ^ ^ d
No match
-/abc(?C)de(?C1)f/
+/abc(?C)de(?C1)f/I
Capturing subpattern count = 0
No options
First char = 'a'
@@ -3607,7 +3596,7 @@ Need char = 'f'
1 ^ ^ f
0: abcdef
-/(?C1)\dabc(?C2)def/
+/(?C1)\dabc(?C2)def/I
Capturing subpattern count = 0
No options
No first char
@@ -3632,22 +3621,22 @@ No match
1 ^ \d
No match
-/(?C255)ab/
+/(?C255)ab/I
Capturing subpattern count = 0
No options
First char = 'a'
Need char = 'b'
-/(?C256)ab/
+/(?C256)ab/I
Failed: number after (?C is > 255 at offset 6
-/(?Cab)xx/
+/(?Cab)xx/I
Failed: closing ) for (?C expected at offset 3
-/(?C12vr)x/
+/(?C12vr)x/I
Failed: closing ) for (?C expected at offset 5
-/abc(?C)def/
+/abc(?C)def/I
Capturing subpattern count = 0
No options
First char = 'a'
@@ -3659,7 +3648,7 @@ No match
0 ^ ^ d
0: abcdef
-/(abc)(?C)de(?C1)f/
+/(abc)(?C)de(?C1)f/I
Capturing subpattern count = 1
No options
First char = 'a'
@@ -3694,7 +3683,7 @@ No match
1 ^ ^ f
No match
-/(?C0)(abc(?C1))*/
+/(?C0)(abc(?C1))*/I
Capturing subpattern count = 1
No options
No first char
@@ -3727,7 +3716,7 @@ No need char
0: abcabc
1: abc
-/(\d{3}(?C))*/
+/(\d{3}(?C))*/I
Capturing subpattern count = 1
Partial matching not supported
No options
@@ -3770,7 +3759,7 @@ Callout 0: last capture = 1
0: 123456789
1: 789
-/((xyz)(?C)p|(?C1)xyzabc)/
+/((xyz)(?C)p|(?C1)xyzabc)/I
Capturing subpattern count = 2
No options
First char = 'x'
@@ -3789,7 +3778,7 @@ Callout 1: last capture = -1
0: xyzabc
1: xyzabc
-/(X)((xyz)(?C)p|(?C1)xyzabc)/
+/(X)((xyz)(?C)p|(?C1)xyzabc)/I
Capturing subpattern count = 3
No options
First char = 'X'
@@ -3811,7 +3800,7 @@ Callout 1: last capture = 1
1: X
2: xyzabc
-/(?=(abc))(?C)abcdef/
+/(?=(abc))(?C)abcdef/I
Capturing subpattern count = 1
No options
First char = 'a'
@@ -3825,7 +3814,7 @@ Callout 0: last capture = 1
0: abcdef
1: abc
-/(?!(abc)(?C1)d)(?C2)abcxyz/
+/(?!(abc)(?C1)d)(?C2)abcxyz/I
Capturing subpattern count = 1
No options
First char = 'a'
@@ -3842,7 +3831,7 @@ Callout 2: last capture = -1
^ a
0: abcxyz
-/(?<=(abc)(?C))xyz/
+/(?<=(abc)(?C))xyz/I
Capturing subpattern count = 1
No options
First char = 'x'
@@ -3856,7 +3845,7 @@ Callout 0: last capture = 1
0: xyz
1: abc
-/a(b+)(c*)(?C1)/
+/a(b+)(c*)(?C1)/I
Capturing subpattern count = 2
Partial matching not supported
No options
@@ -3882,7 +3871,7 @@ Callout data = 1
Callout data = 1
No match
-/a(b+?)(c*?)(?C1)/
+/a(b+?)(c*?)(?C1)/I
Capturing subpattern count = 2
Partial matching not supported
No options
@@ -3908,35 +3897,35 @@ Callout data = 1
Callout data = 1
No match
-/(?C)abc/
+/(?C)abc/I
Capturing subpattern count = 0
No options
First char = 'a'
Need char = 'c'
-/(?C)^abc/
+/(?C)^abc/I
Capturing subpattern count = 0
Options: anchored
No first char
No need char
-/(?C)a|b/S
+/(?C)a|b/IS
Capturing subpattern count = 0
No options
No first char
No need char
Starting byte set: a b
-/(?R)/
+/(?R)/I
Failed: recursive call could loop indefinitely at offset 3
-/(a|(?R))/
+/(a|(?R))/I
Failed: recursive call could loop indefinitely at offset 6
-/(ab|(bc|(de|(?R))))/
+/(ab|(bc|(de|(?R))))/I
Failed: recursive call could loop indefinitely at offset 15
-/x(ab|(bc|(de|(?R))))/
+/x(ab|(bc|(de|(?R))))/I
Capturing subpattern count = 3
No options
First char = 'x'
@@ -3968,13 +3957,13 @@ No match
xyab
No match
-/(ab|(bc|(de|(?1))))/
+/(ab|(bc|(de|(?1))))/I
Failed: recursive call could loop indefinitely at offset 15
-/x(ab|(bc|(de|(?1)x)x)x)/
+/x(ab|(bc|(de|(?1)x)x)x)/I
Failed: recursive call could loop indefinitely at offset 16
-/^([^()]|\((?1)*\))*$/
+/^([^()]|\((?1)*\))*$/I
Capturing subpattern count = 1
Options: anchored
No first char
@@ -3993,7 +3982,7 @@ No match
a(b(c)d
No match
-/^>abc>([^()]|\((?1)*\))*<xyz<$/
+/^>abc>([^()]|\((?1)*\))*<xyz<$/I
Capturing subpattern count = 1
Options: anchored
No first char
@@ -4010,16 +3999,16 @@ Need char = '<'
/(a(?1)b)/D
------------------------------------------------------------------
- 0 22 Bra 0
- 3 16 Bra 1
- 6 a
- 8 6 Once
- 11 3 Recurse
- 14 6 Ket
- 17 b
- 19 16 Ket
- 22 22 Ket
- 25 End
+ 0 24 Bra 0
+ 3 18 Bra 1
+ 8 a
+ 10 6 Once
+ 13 3 Recurse
+ 16 6 Ket
+ 19 b
+ 21 18 Ket
+ 24 24 Ket
+ 27 End
------------------------------------------------------------------
Capturing subpattern count = 1
No options
@@ -4028,23 +4017,23 @@ Need char = 'b'
/(a(?1)+b)/D
------------------------------------------------------------------
- 0 22 Bra 0
- 3 16 Bra 1
- 6 a
- 8 6 Once
- 11 3 Recurse
- 14 6 KetRmax
- 17 b
- 19 16 Ket
- 22 22 Ket
- 25 End
+ 0 24 Bra 0
+ 3 18 Bra 1
+ 8 a
+ 10 6 Once
+ 13 3 Recurse
+ 16 6 KetRmax
+ 19 b
+ 21 18 Ket
+ 24 24 Ket
+ 27 End
------------------------------------------------------------------
Capturing subpattern count = 1
No options
First char = 'a'
Need char = 'b'
-/^\W*(?:((.)\W*(?1)\W*\2|)|((.)\W*(?3)\W*\4|\W*.\W*))\W*$/i
+/^\W*(?:((.)\W*(?1)\W*\2|)|((.)\W*(?3)\W*\4|\W*.\W*))\W*$/Ii
Capturing subpattern count = 4
Max back reference = 4
Partial matching not supported
@@ -4078,7 +4067,7 @@ No match
The quick brown fox
No match
-/^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/
+/^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/I
Capturing subpattern count = 2
Partial matching not supported
Options: anchored
@@ -4099,7 +4088,7 @@ No match
((2+2)*-3)-7)
No match
-/^(x(y|(?1){2})z)/
+/^(x(y|(?1){2})z)/I
Capturing subpattern count = 2
Options: anchored
No first char
@@ -4119,7 +4108,7 @@ No match
xxyzxyzxyzz
No match
-/((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))/x
+/((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))/Ix
Capturing subpattern count = 2
Partial matching not supported
Options: extended
@@ -4154,13 +4143,13 @@ No match
<abc
No match
-/(?1)/
+/(?1)/I
Failed: reference to non-existent subpattern at offset 3
-/((?2)(abc)/
-Failed: reference to non-existent subpattern at offset 4
+/((?2)(abc)/I
+Failed: missing ) at offset 10
-/^(abc)def(?1)/
+/^(abc)def(?1)/I
Capturing subpattern count = 1
Options: anchored
No first char
@@ -4169,7 +4158,7 @@ No need char
0: abcdefabc
1: abc
-/^(a|b|c)=(?1)+/
+/^(a|b|c)=(?1)+/I
Capturing subpattern count = 1
Options: anchored
No first char
@@ -4184,7 +4173,7 @@ No need char
0: a=bc
1: a
-/^(a|b|c)=((?1))+/
+/^(a|b|c)=((?1))+/I
Capturing subpattern count = 2
Options: anchored
No first char
@@ -4204,19 +4193,19 @@ No need char
/a(?P<name1>b|c)d(?P<longername2>e)/D
------------------------------------------------------------------
- 0 28 Bra 0
+ 0 32 Bra 0
3 a
- 5 5 Bra 1
- 8 b
- 10 5 Alt
- 13 c
- 15 10 Ket
- 18 d
- 20 5 Bra 2
- 23 e
- 25 5 Ket
- 28 28 Ket
- 31 End
+ 5 7 Bra 1
+ 10 b
+ 12 5 Alt
+ 15 c
+ 17 12 Ket
+ 20 d
+ 22 7 Bra 2
+ 27 e
+ 29 7 Ket
+ 32 32 Ket
+ 35 End
------------------------------------------------------------------
Capturing subpattern count = 2
Named capturing subpatterns:
@@ -4236,21 +4225,21 @@ Need char = 'e'
/(?:a(?P<c>c(?P<d>d)))(?P<a>a)/D
------------------------------------------------------------------
- 0 35 Bra 0
- 3 21 Bra 0
+ 0 41 Bra 0
+ 3 25 Bra 0
6 a
- 8 13 Bra 1
- 11 c
- 13 5 Bra 2
- 16 d
- 18 5 Ket
- 21 13 Ket
- 24 21 Ket
- 27 5 Bra 3
- 30 a
- 32 5 Ket
- 35 35 Ket
- 38 End
+ 8 17 Bra 1
+ 13 c
+ 15 7 Bra 2
+ 20 d
+ 22 7 Ket
+ 25 17 Ket
+ 28 25 Ket
+ 31 7 Bra 3
+ 36 a
+ 38 7 Ket
+ 41 41 Ket
+ 44 End
------------------------------------------------------------------
Capturing subpattern count = 3
Named capturing subpatterns:
@@ -4263,21 +4252,21 @@ Need char = 'a'
/(?P<a>a)...(?P=a)bbb(?P>a)d/D
------------------------------------------------------------------
- 0 34 Bra 0
- 3 5 Bra 1
- 6 a
- 8 5 Ket
- 11 Any
- 12 Any
+ 0 36 Bra 0
+ 3 7 Bra 1
+ 8 a
+ 10 7 Ket
13 Any
- 14 \1
- 17 bbb
- 23 6 Once
- 26 3 Recurse
- 29 6 Ket
- 32 d
- 34 34 Ket
- 37 End
+ 14 Any
+ 15 Any
+ 16 \1
+ 19 bbb
+ 25 6 Once
+ 28 3 Recurse
+ 31 6 Ket
+ 34 d
+ 36 36 Ket
+ 39 End
------------------------------------------------------------------
Capturing subpattern count = 1
Max back reference = 1
@@ -4287,7 +4276,7 @@ No options
First char = 'a'
Need char = 'd'
-/^\W*(?:(?P<one>(?P<two>.)\W*(?P>one)\W*(?P=two)|)|(?P<three>(?P<four>.)\W*(?P>three)\W*(?P=four)|\W*.\W*))\W*$/i
+/^\W*(?:(?P<one>(?P<two>.)\W*(?P>one)\W*(?P=two)|)|(?P<three>(?P<four>.)\W*(?P>three)\W*(?P=four)|\W*.\W*))\W*$/Ii
Capturing subpattern count = 4
Max back reference = 4
Named capturing subpatterns:
@@ -4326,7 +4315,7 @@ No match
The quick brown fox
No match
-/((?(R)a|b))\1(?1)?/
+/((?(R)a|b))\1(?1)?/I
Capturing subpattern count = 1
Max back reference = 1
No options
@@ -4339,14 +4328,14 @@ No need char
0: bba
1: b
-/(.*)a/sI
+/(.*)a/Is
Capturing subpattern count = 1
Partial matching not supported
Options: anchored dotall
No first char
Need char = 'a'
-/(.*)a\1/sI
+/(.*)a\1/Is
Capturing subpattern count = 1
Max back reference = 1
Partial matching not supported
@@ -4354,7 +4343,7 @@ Options: dotall
No first char
Need char = 'a'
-/(.*)a(b)\2/sI
+/(.*)a(b)\2/Is
Capturing subpattern count = 2
Max back reference = 2
Partial matching not supported
@@ -4362,14 +4351,14 @@ Options: anchored dotall
No first char
Need char = 'b'
-/((.*)a|(.*)b)z/sI
+/((.*)a|(.*)b)z/Is
Capturing subpattern count = 3
Partial matching not supported
Options: anchored dotall
No first char
Need char = 'z'
-/((.*)a|(.*)b)z\1/sI
+/((.*)a|(.*)b)z\1/Is
Capturing subpattern count = 3
Max back reference = 1
Partial matching not supported
@@ -4377,7 +4366,7 @@ Options: dotall
No first char
Need char = 'z'
-/((.*)a|(.*)b)z\2/sI
+/((.*)a|(.*)b)z\2/Is
Capturing subpattern count = 3
Max back reference = 2
Partial matching not supported
@@ -4385,7 +4374,7 @@ Options: dotall
No first char
Need char = 'z'
-/((.*)a|(.*)b)z\3/sI
+/((.*)a|(.*)b)z\3/Is
Capturing subpattern count = 3
Max back reference = 3
Partial matching not supported
@@ -4393,7 +4382,7 @@ Options: dotall
No first char
Need char = 'z'
-/((.*)a|^(.*)b)z\3/sI
+/((.*)a|^(.*)b)z\3/Is
Capturing subpattern count = 3
Max back reference = 3
Partial matching not supported
@@ -4401,14 +4390,14 @@ Options: anchored dotall
No first char
Need char = 'z'
-/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a/sI
+/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a/Is
Capturing subpattern count = 31
Partial matching not supported
Options: anchored dotall
No first char
No need char
-/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\31/sI
+/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\31/Is
Capturing subpattern count = 31
Max back reference = 31
Partial matching not supported
@@ -4416,7 +4405,7 @@ Options: dotall
No first char
No need char
-/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\32/sI
+/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\32/Is
Capturing subpattern count = 32
Max back reference = 32
Partial matching not supported
@@ -4424,7 +4413,7 @@ Options: dotall
No first char
No need char
-/(a)(bc)/ND
+/(a)(bc)/IND
------------------------------------------------------------------
0 21 Bra 0
3 5 Bra 0
@@ -4443,17 +4432,17 @@ Need char = 'c'
abc
0: abc
-/(?P<one>a)(bc)/ND
+/(?P<one>a)(bc)/IND
------------------------------------------------------------------
- 0 21 Bra 0
- 3 5 Bra 1
- 6 a
- 8 5 Ket
- 11 7 Bra 0
- 14 bc
- 18 7 Ket
- 21 21 Ket
- 24 End
+ 0 23 Bra 0
+ 3 7 Bra 1
+ 8 a
+ 10 7 Ket
+ 13 7 Bra 0
+ 16 bc
+ 20 7 Ket
+ 23 23 Ket
+ 26 End
------------------------------------------------------------------
Capturing subpattern count = 1
Named capturing subpatterns:
@@ -4465,17 +4454,17 @@ Need char = 'c'
0: abc
1: a
-/(a)(?P<named>bc)/ND
+/(a)(?P<named>bc)/IND
------------------------------------------------------------------
- 0 21 Bra 0
+ 0 23 Bra 0
3 5 Bra 0
6 a
8 5 Ket
- 11 7 Bra 1
- 14 bc
- 18 7 Ket
- 21 21 Ket
- 24 End
+ 11 9 Bra 1
+ 16 bc
+ 20 9 Ket
+ 23 23 Ket
+ 26 End
------------------------------------------------------------------
Capturing subpattern count = 1
Named capturing subpatterns:
@@ -4484,7 +4473,7 @@ Options: no_auto_capture
First char = 'a'
Need char = 'c'
-/(a+)*zz/
+/(a+)*zz/I
Capturing subpattern count = 1
Partial matching not supported
No options
@@ -4500,7 +4489,7 @@ Minimum match() limit = 32768
Minimum match() recursion limit = 42
No match
-/(aaa(?C1)bbb|ab)/
+/(aaa(?C1)bbb|ab)/I
Capturing subpattern count = 1
No options
First char = 'a'
@@ -4527,7 +4516,7 @@ Callout data = 1
Callout data = -1
No match
-/ab(?P<one>cd)ef(?P<two>gh)/
+/ab(?P<one>cd)ef(?P<two>gh)/I
Capturing subpattern count = 2
Named capturing subpatterns:
one 1
@@ -4560,13 +4549,13 @@ copy substring three failed -7
/(?P<Tes>)(?P<Test>)/D
------------------------------------------------------------------
- 0 15 Bra 0
- 3 3 Bra 1
- 6 3 Ket
- 9 3 Bra 2
- 12 3 Ket
- 15 15 Ket
- 18 End
+ 0 19 Bra 0
+ 3 5 Bra 1
+ 8 5 Ket
+ 11 5 Bra 2
+ 16 5 Ket
+ 19 19 Ket
+ 22 End
------------------------------------------------------------------
Capturing subpattern count = 2
Named capturing subpatterns:
@@ -4578,13 +4567,13 @@ No need char
/(?P<Test>)(?P<Tes>)/D
------------------------------------------------------------------
- 0 15 Bra 0
- 3 3 Bra 1
- 6 3 Ket
- 9 3 Bra 2
- 12 3 Ket
- 15 15 Ket
- 18 End
+ 0 19 Bra 0
+ 3 5 Bra 1
+ 8 5 Ket
+ 11 5 Bra 2
+ 16 5 Ket
+ 19 19 Ket
+ 22 End
------------------------------------------------------------------
Capturing subpattern count = 2
Named capturing subpatterns:
@@ -4594,7 +4583,7 @@ No options
No first char
No need char
-/(?P<Z>zz)(?P<A>aa)/
+/(?P<Z>zz)(?P<A>aa)/I
Capturing subpattern count = 2
Named capturing subpatterns:
A 2
@@ -4613,13 +4602,13 @@ Need char = 'a'
2: aa
C aa (2) A
-/(?P<x>eks)(?P<x>eccs)/
-Failed: two named subpatterns have the same name at offset 16
+/(?P<x>eks)(?P<x>eccs)/I
+Failed: two named subpatterns have the same name at offset 15
-/(?P<abc>abc(?P<def>def)(?P<abc>xyz))/
-Failed: two named subpatterns have the same name at offset 31
+/(?P<abc>abc(?P<def>def)(?P<abc>xyz))/I
+Failed: two named subpatterns have the same name at offset 30
-"\[((?P<elem>\d+)(,(?P>elem))*)\]"
+"\[((?P<elem>\d+)(,(?P>elem))*)\]"I
Capturing subpattern count = 3
Named capturing subpatterns:
elem 2
@@ -4637,7 +4626,7 @@ No match
[]
No match
-"\[((?P<elem>\d+)(,(?P>elem))*)?\]"
+"\[((?P<elem>\d+)(,(?P>elem))*)?\]"I
Capturing subpattern count = 3
Named capturing subpatterns:
elem 2
@@ -4655,20 +4644,20 @@ Need char = ']'
/(a(b(?2)c))?/D
------------------------------------------------------------------
- 0 31 Bra 0
+ 0 35 Bra 0
3 Brazero
- 4 24 Bra 1
- 7 a
- 9 16 Bra 2
- 12 b
- 14 6 Once
- 17 9 Recurse
- 20 6 Ket
- 23 c
- 25 16 Ket
- 28 24 Ket
- 31 31 Ket
- 34 End
+ 4 28 Bra 1
+ 9 a
+ 11 18 Bra 2
+ 16 b
+ 18 6 Once
+ 21 11 Recurse
+ 24 6 Ket
+ 27 c
+ 29 18 Ket
+ 32 28 Ket
+ 35 35 Ket
+ 38 End
------------------------------------------------------------------
Capturing subpattern count = 2
No options
@@ -4677,20 +4666,20 @@ No need char
/(a(b(?2)c))*/D
------------------------------------------------------------------
- 0 31 Bra 0
+ 0 35 Bra 0
3 Brazero
- 4 24 Bra 1
- 7 a
- 9 16 Bra 2
- 12 b
- 14 6 Once
- 17 9 Recurse
- 20 6 Ket
- 23 c
- 25 16 Ket
- 28 24 KetRmax
- 31 31 Ket
- 34 End
+ 4 28 Bra 1
+ 9 a
+ 11 18 Bra 2
+ 16 b
+ 18 6 Once
+ 21 11 Recurse
+ 24 6 Ket
+ 27 c
+ 29 18 Ket
+ 32 28 KetRmax
+ 35 35 Ket
+ 38 End
------------------------------------------------------------------
Capturing subpattern count = 2
No options
@@ -4699,33 +4688,33 @@ No need char
/(a(b(?2)c)){0,2}/D
------------------------------------------------------------------
- 0 65 Bra 0
+ 0 73 Bra 0
3 Brazero
- 4 58 Bra 0
- 7 24 Bra 1
- 10 a
- 12 16 Bra 2
- 15 b
- 17 6 Once
- 20 12 Recurse
- 23 6 Ket
- 26 c
- 28 16 Ket
- 31 24 Ket
- 34 Brazero
- 35 24 Bra 1
- 38 a
- 40 16 Bra 2
- 43 b
- 45 6 Once
- 48 12 Recurse
- 51 6 Ket
- 54 c
- 56 16 Ket
- 59 24 Ket
- 62 58 Ket
- 65 65 Ket
- 68 End
+ 4 66 Bra 0
+ 7 28 Bra 1
+ 12 a
+ 14 18 Bra 2
+ 19 b
+ 21 6 Once
+ 24 14 Recurse
+ 27 6 Ket
+ 30 c
+ 32 18 Ket
+ 35 28 Ket
+ 38 Brazero
+ 39 28 Bra 1
+ 44 a
+ 46 18 Bra 2
+ 51 b
+ 53 6 Once
+ 56 14 Recurse
+ 59 6 Ket
+ 62 c
+ 64 18 Ket
+ 67 28 Ket
+ 70 66 Ket
+ 73 73 Ket
+ 76 End
------------------------------------------------------------------
Capturing subpattern count = 2
No options
@@ -4746,7 +4735,7 @@ No options
No first char
No need char
-/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/i
+/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/Ii
Capturing subpattern count = 3
Partial matching not supported
Options: caseless
@@ -4756,7 +4745,7 @@ Need char = 'g' (caseless)
0: Baby Bjorn Active Carrier - With free SHIPPING!!
1: Baby Bjorn Active Carrier - With free SHIPPING!!
-/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/iS
+/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/IiS
Capturing subpattern count = 3
Partial matching not supported
Options: caseless
@@ -4767,7 +4756,7 @@ Study returned NULL
0: Baby Bjorn Active Carrier - With free SHIPPING!!
1: Baby Bjorn Active Carrier - With free SHIPPING!!
-/a*.*b/SD
+/a*.*b/ISD
------------------------------------------------------------------
0 9 Bra 0
3 a*
@@ -4783,19 +4772,19 @@ No first char
Need char = 'b'
Study returned NULL
-/(a|b)*.?c/SD
+/(a|b)*.?c/ISD
------------------------------------------------------------------
- 0 21 Bra 0
+ 0 23 Bra 0
3 Brazero
- 4 5 Bra 1
- 7 a
- 9 5 Alt
- 12 b
- 14 10 KetRmax
- 17 Any?
- 19 c
- 21 21 Ket
- 24 End
+ 4 7 Bra 1
+ 9 a
+ 11 5 Alt
+ 14 b
+ 16 12 KetRmax
+ 19 Any?
+ 21 c
+ 23 23 Ket
+ 26 End
------------------------------------------------------------------
Capturing subpattern count = 1
No options
@@ -4819,7 +4808,7 @@ No options
First char = 'a'
Need char = 'f'
-/abcde/CD
+/abcde/ICD
------------------------------------------------------------------
0 49 Bra 0
3 Callout 255 0 1
@@ -4858,11 +4847,11 @@ Need char = 'e'
+4 ^ ^ e
No match
-/a*b/CD
+/a*b/ICD
------------------------------------------------------------------
0 25 Bra 0
3 Callout 255 0 2
- 9 a*
+ 9 a*+
11 Callout 255 2 1
17 b
19 Callout 255 3 0
@@ -4890,22 +4879,12 @@ Need char = 'b'
--->aaaacb
+0 ^ a*
+2 ^ ^ b
- +2 ^ ^ b
- +2 ^ ^ b
- +2 ^^ b
- +2 ^ b
+0 ^ a*
+2 ^ ^ b
- +2 ^ ^ b
- +2 ^^ b
- +2 ^ b
+0 ^ a*
+2 ^ ^ b
- +2 ^^ b
- +2 ^ b
+0 ^ a*
+2 ^^ b
- +2 ^ b
+0 ^ a*
+2 ^ b
+0 ^ a*
@@ -4913,11 +4892,11 @@ Need char = 'b'
+3 ^^
0: b
-/a+b/CD
+/a+b/ICD
------------------------------------------------------------------
0 25 Bra 0
3 Callout 255 0 2
- 9 a+
+ 9 a++
11 Callout 255 2 1
17 b
19 Callout 255 3 0
@@ -4945,46 +4924,40 @@ Need char = 'b'
--->aaaacb
+0 ^ a+
+2 ^ ^ b
- +2 ^ ^ b
- +2 ^ ^ b
- +2 ^^ b
+0 ^ a+
+2 ^ ^ b
- +2 ^ ^ b
- +2 ^^ b
+0 ^ a+
+2 ^ ^ b
- +2 ^^ b
+0 ^ a+
+2 ^^ b
No match
-/(abc|def)x/CD
+/(abc|def)x/ICD
------------------------------------------------------------------
- 0 92 Bra 0
+ 0 94 Bra 0
3 Callout 255 0 9
- 9 33 Bra 1
- 12 Callout 255 1 1
- 18 a
- 20 Callout 255 2 1
- 26 b
- 28 Callout 255 3 1
- 34 c
- 36 Callout 255 4 0
- 42 33 Alt
- 45 Callout 255 5 1
- 51 d
- 53 Callout 255 6 1
- 59 e
- 61 Callout 255 7 1
- 67 f
- 69 Callout 255 8 0
- 75 66 Ket
- 78 Callout 255 9 1
- 84 x
- 86 Callout 255 10 0
- 92 92 Ket
- 95 End
+ 9 35 Bra 1
+ 14 Callout 255 1 1
+ 20 a
+ 22 Callout 255 2 1
+ 28 b
+ 30 Callout 255 3 1
+ 36 c
+ 38 Callout 255 4 0
+ 44 33 Alt
+ 47 Callout 255 5 1
+ 53 d
+ 55 Callout 255 6 1
+ 61 e
+ 63 Callout 255 7 1
+ 69 f
+ 71 Callout 255 8 0
+ 77 68 Ket
+ 80 Callout 255 9 1
+ 86 x
+ 88 Callout 255 10 0
+ 94 94 Ket
+ 97 End
------------------------------------------------------------------
Capturing subpattern count = 1
Options:
@@ -5049,7 +5022,7 @@ Need char = 'x'
+5 ^ d
No match
-/(ab|cd){3,4}/C
+/(ab|cd){3,4}/IC
Capturing subpattern count = 1
Options:
No first char
@@ -5113,34 +5086,34 @@ No need char
0: abcdcdcd
1: cd
-/([ab]{,4}c|xy)/CD
+/([ab]{,4}c|xy)/ICD
------------------------------------------------------------------
- 0 131 Bra 0
+ 0 133 Bra 0
3 Callout 255 0 14
- 9 88 Bra 1
- 12 Callout 255 1 4
- 18 [ab]
- 51 Callout 255 5 1
- 57 {
- 59 Callout 255 6 1
- 65 ,
- 67 Callout 255 7 1
- 73 4
- 75 Callout 255 8 1
- 81 }
- 83 Callout 255 9 1
- 89 c
- 91 Callout 255 10 0
- 97 25 Alt
-100 Callout 255 11 1
-106 x
-108 Callout 255 12 1
-114 y
-116 Callout 255 13 0
-122 113 Ket
-125 Callout 255 14 0
-131 131 Ket
-134 End
+ 9 90 Bra 1
+ 14 Callout 255 1 4
+ 20 [ab]
+ 53 Callout 255 5 1
+ 59 {
+ 61 Callout 255 6 1
+ 67 ,
+ 69 Callout 255 7 1
+ 75 4
+ 77 Callout 255 8 1
+ 83 }
+ 85 Callout 255 9 1
+ 91 c
+ 93 Callout 255 10 0
+ 99 25 Alt
+102 Callout 255 11 1
+108 x
+110 Callout 255 12 1
+116 y
+118 Callout 255 13 0
+124 115 Ket
+127 Callout 255 14 0
+133 133 Ket
+136 End
------------------------------------------------------------------
Capturing subpattern count = 1
Options:
@@ -5288,85 +5261,85 @@ No need char
+11 ^ x
No match
-/([ab]{1,4}c|xy){4,5}?123/CD
+/([ab]{1,4}c|xy){4,5}?123/ICD
------------------------------------------------------------------
- 0 485 Bra 0
+ 0 495 Bra 0
3 Callout 255 0 21
- 9 61 Bra 1
- 12 Callout 255 1 9
- 18 [ab]{1,4}
- 56 Callout 255 10 1
- 62 c
- 64 Callout 255 11 0
- 70 25 Alt
- 73 Callout 255 12 1
- 79 x
- 81 Callout 255 13 1
- 87 y
- 89 Callout 255 14 0
- 95 86 Ket
- 98 61 Bra 1
-101 Callout 255 1 9
-107 [ab]{1,4}
-145 Callout 255 10 1
-151 c
-153 Callout 255 11 0
-159 25 Alt
-162 Callout 255 12 1
-168 x
-170 Callout 255 13 1
-176 y
-178 Callout 255 14 0
-184 86 Ket
-187 61 Bra 1
-190 Callout 255 1 9
-196 [ab]{1,4}
-234 Callout 255 10 1
-240 c
-242 Callout 255 11 0
-248 25 Alt
-251 Callout 255 12 1
-257 x
-259 Callout 255 13 1
-265 y
-267 Callout 255 14 0
-273 86 Ket
-276 61 Bra 1
-279 Callout 255 1 9
-285 [ab]{1,4}
-323 Callout 255 10 1
-329 c
-331 Callout 255 11 0
-337 25 Alt
-340 Callout 255 12 1
-346 x
-348 Callout 255 13 1
-354 y
-356 Callout 255 14 0
-362 86 Ket
-365 Braminzero
-366 61 Bra 1
-369 Callout 255 1 9
-375 [ab]{1,4}
-413 Callout 255 10 1
-419 c
-421 Callout 255 11 0
-427 25 Alt
-430 Callout 255 12 1
-436 x
-438 Callout 255 13 1
-444 y
-446 Callout 255 14 0
-452 86 Ket
-455 Callout 255 21 1
-461 1
-463 Callout 255 22 1
-469 2
-471 Callout 255 23 1
-477 3
-479 Callout 255 24 0
-485 485 Ket
-488 End
+ 9 63 Bra 1
+ 14 Callout 255 1 9
+ 20 [ab]{1,4}
+ 58 Callout 255 10 1
+ 64 c
+ 66 Callout 255 11 0
+ 72 25 Alt
+ 75 Callout 255 12 1
+ 81 x
+ 83 Callout 255 13 1
+ 89 y
+ 91 Callout 255 14 0
+ 97 88 Ket
+100 63 Bra 1
+105 Callout 255 1 9
+111 [ab]{1,4}
+149 Callout 255 10 1
+155 c
+157 Callout 255 11 0
+163 25 Alt
+166 Callout 255 12 1
+172 x
+174 Callout 255 13 1
+180 y
+182 Callout 255 14 0
+188 88 Ket
+191 63 Bra 1
+196 Callout 255 1 9
+202 [ab]{1,4}
+240 Callout 255 10 1
+246 c
+248 Callout 255 11 0
+254 25 Alt
+257 Callout 255 12 1
+263 x
+265 Callout 255 13 1
+271 y
+273 Callout 255 14 0
+279 88 Ket
+282 63 Bra 1
+287 Callout 255 1 9
+293 [ab]{1,4}
+331 Callout 255 10 1
+337 c
+339 Callout 255 11 0
+345 25 Alt
+348 Callout 255 12 1
+354 x
+356 Callout 255 13 1
+362 y
+364 Callout 255 14 0
+370 88 Ket
+373 Braminzero
+374 63 Bra 1
+379 Callout 255 1 9
+385 [ab]{1,4}
+423 Callout 255 10 1
+429 c
+431 Callout 255 11 0
+437 25 Alt
+440 Callout 255 12 1
+446 x
+448 Callout 255 13 1
+454 y
+456 Callout 255 14 0
+462 88 Ket
+465 Callout 255 21 1
+471 1
+473 Callout 255 22 1
+479 2
+481 Callout 255 23 1
+487 3
+489 Callout 255 24 0
+495 495 Ket
+498 End
------------------------------------------------------------------
Capturing subpattern count = 1
Partial matching not supported
@@ -5426,7 +5399,7 @@ No need char
Xbcd12345
0: bcd12345
-/abcde/
+/abcde/I
Capturing subpattern count = 0
No options
First char = 'a'
@@ -5446,7 +5419,7 @@ No match
the quick brown abxyz fox\P
No match
-"^(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/(20)?\d\d$"
+"^(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/(20)?\d\d$"I
Capturing subpattern count = 3
Options: anchored
No first char
@@ -5529,7 +5502,7 @@ No options
No first char
Need char = 'E'
-/[abc]?123/
+/[abc]?123/I
Capturing subpattern count = 0
No options
No first char
@@ -5547,7 +5520,7 @@ Partial match
c123\P
0: c123
-/^(?:\d){3,5}X/
+/^(?:\d){3,5}X/I
Capturing subpattern count = 0
Options: anchored
No first char
@@ -5573,7 +5546,7 @@ No match
123456\P
No match
-/abc/>testsavedregex
+/abc/I>testsavedregex
Capturing subpattern count = 0
No options
First char = 'a'
@@ -5582,10 +5555,6 @@ Compiled regex written to testsavedregex
<testsavedregex
Compiled regex loaded from testsavedregex
No study data
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'c'
abc
0: abc
** Failers
@@ -5593,7 +5562,7 @@ No match
bca
No match
-/abc/F>testsavedregex
+/abc/IF>testsavedregex
Capturing subpattern count = 0
No options
First char = 'a'
@@ -5602,10 +5571,6 @@ Compiled regex written to testsavedregex
<testsavedregex
Compiled regex (byte-inverted) loaded from testsavedregex
No study data
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'c'
abc
0: abc
** Failers
@@ -5613,7 +5578,7 @@ No match
bca
No match
-/(a|b)/S>testsavedregex
+/(a|b)/IS>testsavedregex
Capturing subpattern count = 1
No options
No first char
@@ -5624,11 +5589,6 @@ Study data written to testsavedregex
<testsavedregex
Compiled regex loaded from testsavedregex
Study data loaded from testsavedregex
-Capturing subpattern count = 1
-No options
-No first char
-No need char
-Starting byte set: a b
abc
0: a
1: a
@@ -5638,7 +5598,7 @@ Starting byte set: a b
def
No match
-/(a|b)/SF>testsavedregex
+/(a|b)/ISF>testsavedregex
Capturing subpattern count = 1
No options
No first char
@@ -5649,11 +5609,6 @@ Study data written to testsavedregex
<testsavedregex
Compiled regex (byte-inverted) loaded from testsavedregex
Study data loaded from testsavedregex
-Capturing subpattern count = 1
-No options
-No first char
-No need char
-Starting byte set: a b
abc
0: a
1: a
@@ -5663,7 +5618,7 @@ Starting byte set: a b
def
No match
-~<(\w+)/?>(.)*</(\1)>~smg
+~<(\w+)/?>(.)*</(\1)>~smgI
Capturing subpattern count = 3
Max back reference = 1
Partial matching not supported
@@ -5682,7 +5637,7 @@ Options: anchored
No first char
No need char
-/line\nbreak/
+/line\nbreak/I
Capturing subpattern count = 0
No options
First char = 'l'
@@ -5692,7 +5647,7 @@ Need char = 'k'
line one\nthis is a line\nbreak in the second line
0: line\x0abreak
-/line\nbreak/f
+/line\nbreak/If
Capturing subpattern count = 0
Options: firstline
First char = 'l'
@@ -5704,7 +5659,7 @@ No match
line one\nthis is a line\nbreak in the second line
No match
-/line\nbreak/mf
+/line\nbreak/Imf
Capturing subpattern count = 0
Options: multiline firstline
First char = 'l'
@@ -5716,7 +5671,7 @@ No match
line one\nthis is a line\nbreak in the second line
No match
-/ab.cd/P
+/ab.cd/IP
ab-cd
0: ab-cd
ab=cd
@@ -5726,7 +5681,7 @@ No match: POSIX code 17: match failed
ab\ncd
No match: POSIX code 17: match failed
-/ab.cd/Ps
+/ab.cd/IPs
ab-cd
0: ab-cd
ab=cd
@@ -5734,7 +5689,7 @@ No match: POSIX code 17: match failed
ab\ncd
0: ab\x0acd
-/(?i)(?-i)AbCd/
+/(?i)(?-i)AbCd/I
Capturing subpattern count = 0
No options
First char = 'A'
@@ -5746,16 +5701,16 @@ No match
abcd
No match
-/a{11111111111111111111}/
+/a{11111111111111111111}/I
Failed: number too big in {} quantifier at offset 22
-/(){64294967295}/
+/(){64294967295}/I
Failed: number too big in {} quantifier at offset 14
-/(){2,4294967295}/
+/(){2,4294967295}/I
Failed: number too big in {} quantifier at offset 15
-"(?i:a)(?i:b)(?i:c)(?i:d)(?i:e)(?i:f)(?i:g)(?i:h)(?i:i)(?i:j)(k)(?i:l)A\1B"
+"(?i:a)(?i:b)(?i:c)(?i:d)(?i:e)(?i:f)(?i:g)(?i:h)(?i:i)(?i:j)(k)(?i:l)A\1B"I
Capturing subpattern count = 1
Max back reference = 1
No options
@@ -5765,7 +5720,7 @@ Need char = 'B'
0: abcdefghijklAkB
1: k
-"(?P<n0>a)(?P<n1>b)(?P<n2>c)(?P<n3>d)(?P<n4>e)(?P<n5>f)(?P<n6>g)(?P<n7>h)(?P<n8>i)(?P<n9>j)(?P<n10>k)(?P<n11>l)A\11B"
+"(?P<n0>a)(?P<n1>b)(?P<n2>c)(?P<n3>d)(?P<n4>e)(?P<n5>f)(?P<n6>g)(?P<n7>h)(?P<n8>i)(?P<n9>j)(?P<n10>k)(?P<n11>l)A\11B"I
Capturing subpattern count = 12
Max back reference = 11
Named capturing subpatterns:
@@ -5799,7 +5754,7 @@ Need char = 'B'
11: k
12: l
-"(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)A\11B"
+"(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)A\11B"I
Capturing subpattern count = 12
Max back reference = 11
No options
@@ -5820,7 +5775,7 @@ Need char = 'B'
11: k
12: l
-"(?P<name0>a)(?P<name1>a)(?P<name2>a)(?P<name3>a)(?P<name4>a)(?P<name5>a)(?P<name6>a)(?P<name7>a)(?P<name8>a)(?P<name9>a)(?P<name10>a)(?P<name11>a)(?P<name12>a)(?P<name13>a)(?P<name14>a)(?P<name15>a)(?P<name16>a)(?P<name17>a)(?P<name18>a)(?P<name19>a)(?P<name20>a)(?P<name21>a)(?P<name22>a)(?P<name23>a)(?P<name24>a)(?P<name25>a)(?P<name26>a)(?P<name27>a)(?P<name28>a)(?P<name29>a)(?P<name30>a)(?P<name31>a)(?P<name32>a)(?P<name33>a)(?P<name34>a)(?P<name35>a)(?P<name36>a)(?P<name37>a)(?P<name38>a)(?P<name39>a)(?P<name40>a)(?P<name41>a)(?P<name42>a)(?P<name43>a)(?P<name44>a)(?P<name45>a)(?P<name46>a)(?P<name47>a)(?P<name48>a)(?P<name49>a)(?P<name50>a)(?P<name51>a)(?P<name52>a)(?P<name53>a)(?P<name54>a)(?P<name55>a)(?P<name56>a)(?P<name57>a)(?P<name58>a)(?P<name59>a)(?P<name60>a)(?P<name61>a)(?P<name62>a)(?P<name63>a)(?P<name64>a)(?P<name65>a)(?P<name66>a)(?P<name67>a)(?P<name68>a)(?P<name69>a)(?P<name70>a)(?P<name71>a)(?P<name72>a)(?P<name73>a)(?P<name74>a)(?P<name75>a)(?P<name76>a)(?P<name77>a)(?P<name78>a)(?P<name79>a)(?P<name80>a)(?P<name81>a)(?P<name82>a)(?P<name83>a)(?P<name84>a)(?P<name85>a)(?P<name86>a)(?P<name87>a)(?P<name88>a)(?P<name89>a)(?P<name90>a)(?P<name91>a)(?P<name92>a)(?P<name93>a)(?P<name94>a)(?P<name95>a)(?P<name96>a)(?P<name97>a)(?P<name98>a)(?P<name99>a)(?P<name100>a)"
+"(?P<name0>a)(?P<name1>a)(?P<name2>a)(?P<name3>a)(?P<name4>a)(?P<name5>a)(?P<name6>a)(?P<name7>a)(?P<name8>a)(?P<name9>a)(?P<name10>a)(?P<name11>a)(?P<name12>a)(?P<name13>a)(?P<name14>a)(?P<name15>a)(?P<name16>a)(?P<name17>a)(?P<name18>a)(?P<name19>a)(?P<name20>a)(?P<name21>a)(?P<name22>a)(?P<name23>a)(?P<name24>a)(?P<name25>a)(?P<name26>a)(?P<name27>a)(?P<name28>a)(?P<name29>a)(?P<name30>a)(?P<name31>a)(?P<name32>a)(?P<name33>a)(?P<name34>a)(?P<name35>a)(?P<name36>a)(?P<name37>a)(?P<name38>a)(?P<name39>a)(?P<name40>a)(?P<name41>a)(?P<name42>a)(?P<name43>a)(?P<name44>a)(?P<name45>a)(?P<name46>a)(?P<name47>a)(?P<name48>a)(?P<name49>a)(?P<name50>a)(?P<name51>a)(?P<name52>a)(?P<name53>a)(?P<name54>a)(?P<name55>a)(?P<name56>a)(?P<name57>a)(?P<name58>a)(?P<name59>a)(?P<name60>a)(?P<name61>a)(?P<name62>a)(?P<name63>a)(?P<name64>a)(?P<name65>a)(?P<name66>a)(?P<name67>a)(?P<name68>a)(?P<name69>a)(?P<name70>a)(?P<name71>a)(?P<name72>a)(?P<name73>a)(?P<name74>a)(?P<name75>a)(?P<name76>a)(?P<name77>a)(?P<name78>a)(?P<name79>a)(?P<name80>a)(?P<name81>a)(?P<name82>a)(?P<name83>a)(?P<name84>a)(?P<name85>a)(?P<name86>a)(?P<name87>a)(?P<name88>a)(?P<name89>a)(?P<name90>a)(?P<name91>a)(?P<name92>a)(?P<name93>a)(?P<name94>a)(?P<name95>a)(?P<name96>a)(?P<name97>a)(?P<name98>a)(?P<name99>a)(?P<name100>a)"I
Capturing subpattern count = 101
Named capturing subpatterns:
name0 1
@@ -5945,7 +5900,7 @@ Matched, but too many substrings
13: a
14: a
-"(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)"
+"(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)"I
Capturing subpattern count = 101
No options
First char = 'a'
@@ -5968,7 +5923,7 @@ Matched, but too many substrings
13: a
14: a
-/[^()]*(?:\((?R)\)[^()]*)*/
+/[^()]*(?:\((?R)\)[^()]*)*/I
Capturing subpattern count = 0
Partial matching not supported
No options
@@ -5981,7 +5936,7 @@ No need char
(this(and)that)stuff
0: (this(and)that)stuff
-/[^()]*(?:\((?>(?R))\)[^()]*)*/
+/[^()]*(?:\((?>(?R))\)[^()]*)*/I
Capturing subpattern count = 0
Partial matching not supported
No options
@@ -5992,7 +5947,7 @@ No need char
(this(and)that)
0: (this(and)that)
-/[^()]*(?:\((?R)\))*[^()]*/
+/[^()]*(?:\((?R)\))*[^()]*/I
Capturing subpattern count = 0
Partial matching not supported
No options
@@ -6003,7 +5958,7 @@ No need char
(this(and)that)
0: (this(and)that)
-/(?:\((?R)\))*[^()]*/
+/(?:\((?R)\))*[^()]*/I
Capturing subpattern count = 0
Partial matching not supported
No options
@@ -6016,7 +5971,7 @@ No need char
((this))
0: ((this))
-/(?:\((?R)\))|[^()]*/
+/(?:\((?R)\))|[^()]*/I
Capturing subpattern count = 0
Partial matching not supported
No options
@@ -6031,27 +5986,27 @@ No need char
((this))
0: ((this))
-/a(b)c/PN
+/a(b)c/IPN
abc
Matched with REG_NOSUB
-/a(?P<name>b)c/PN
+/a(?P<name>b)c/IPN
abc
Matched with REG_NOSUB
-/\x{100}/
+/\x{100}/I
Failed: character value in \x{...} sequence is too large at offset 6
-/\x{0000ff}/
+/\x{0000ff}/I
Capturing subpattern count = 0
No options
First char = 255
No need char
-/^((?P<A>a1)|(?P<A>a2)b)/
-Failed: two named subpatterns have the same name at offset 18
+/^((?P<A>a1)|(?P<A>a2)b)/I
+Failed: two named subpatterns have the same name at offset 17
-/^((?P<A>a1)|(?P<A>a2)b)/J
+/^((?P<A>a1)|(?P<A>a2)b)/IJ
Capturing subpattern count = 3
Named capturing subpatterns:
A 2
@@ -6080,7 +6035,7 @@ no parentheses with name "Z"
copy substring Z failed -7
C a1 (2) A
-/^(?P<A>a)(?P<A>b)/J
+/^(?P<A>a)(?P<A>b)/IJ
Capturing subpattern count = 2
Named capturing subpatterns:
A 1
@@ -6094,7 +6049,7 @@ No need char
2: b
C a (1) A
-/^(?P<A>a)(?P<A>b)|cd/J
+/^(?P<A>a)(?P<A>b)|cd/IJ
Capturing subpattern count = 2
Named capturing subpatterns:
A 1
@@ -6111,7 +6066,7 @@ No need char
0: cd
copy substring A failed -7
-/^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/J
+/^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/IJ
Capturing subpattern count = 4
Named capturing subpatterns:
A 1
@@ -6129,7 +6084,7 @@ No need char
4: gh
C ef (2) A
-/^((?P<A>a1)|(?P<A>a2)b)/J
+/^((?P<A>a1)|(?P<A>a2)b)/IJ
Capturing subpattern count = 3
Named capturing subpatterns:
A 2
@@ -6158,7 +6113,7 @@ no parentheses with name "Z"
copy substring Z failed -7
G a1 (2) A
-/^(?P<A>a)(?P<A>b)/J
+/^(?P<A>a)(?P<A>b)/IJ
Capturing subpattern count = 2
Named capturing subpatterns:
A 1
@@ -6172,7 +6127,7 @@ No need char
2: b
G a (1) A
-/^(?P<A>a)(?P<A>b)|cd/J
+/^(?P<A>a)(?P<A>b)|cd/IJ
Capturing subpattern count = 2
Named capturing subpatterns:
A 1
@@ -6189,7 +6144,7 @@ No need char
0: cd
copy substring A failed -7
-/^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/J
+/^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/IJ
Capturing subpattern count = 4
Named capturing subpatterns:
A 1
@@ -6207,7 +6162,7 @@ No need char
4: gh
G ef (2) A
-/(?J)^((?P<A>a1)|(?P<A>a2)b)/
+/(?J)^((?P<A>a1)|(?P<A>a2)b)/I
Capturing subpattern count = 3
Named capturing subpatterns:
A 2
@@ -6227,18 +6182,18 @@ No need char
3: a2
C a2 (2) A
-/^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<A>d)/
-Failed: two named subpatterns have the same name at offset 38
+/^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<A>d)/I
+Failed: two named subpatterns have the same name at offset 37
/ In this next test, J is not set at the outer level; consequently it isn't
set in the pattern's options; consequently pcre_get_named_substring() produces
-a random value. /x
+a random value. /Ix
Capturing subpattern count = 1
Options: extended
First char = 'I'
Need char = 'e'
-/^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<C>d)/
+/^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<C>d)/I
Capturing subpattern count = 4
Named capturing subpatterns:
A 1
@@ -6258,7 +6213,7 @@ No need char
C b (1) B
C d (1) C
-/^(?P<A>a)?(?(A)a|b)/
+/^(?P<A>a)?(?(A)a|b)/I
Capturing subpattern count = 1
Named capturing subpatterns:
A 1
@@ -6275,7 +6230,7 @@ No match
abc
No match
-/(?:(?(ZZ)a|b)(?P<ZZ>X))+/
+/(?:(?(ZZ)a|b)(?P<ZZ>X))+/I
Capturing subpattern count = 1
Named capturing subpatterns:
ZZ 1
@@ -6286,13 +6241,13 @@ Need char = 'X'
0: bXaX
1: X
-/(?:(?(2y)a|b)(X))+/
+/(?:(?(2y)a|b)(X))+/I
Failed: reference to non-existent subpattern at offset 9
-/(?:(?(ZA)a|b)(?P<ZZ>X))+/
+/(?:(?(ZA)a|b)(?P<ZZ>X))+/I
Failed: reference to non-existent subpattern at offset 9
-/(?:(?(ZZ)a|b)(?(ZZ)a|b)(?P<ZZ>X))+/
+/(?:(?(ZZ)a|b)(?(ZZ)a|b)(?P<ZZ>X))+/I
Capturing subpattern count = 1
Named capturing subpatterns:
ZZ 1
@@ -6303,7 +6258,7 @@ Need char = 'X'
0: bbXaaX
1: X
-/(?:(?(ZZ)a|\(b\))\\(?P<ZZ>X))+/
+/(?:(?(ZZ)a|\(b\))\\(?P<ZZ>X))+/I
Capturing subpattern count = 1
Named capturing subpatterns:
ZZ 1
@@ -6314,10 +6269,10 @@ Need char = 'X'
0: (b)\Xa\X
1: X
-/(?P<ABC/
-Failed: syntax error after (?P at offset 7
+/(?P<ABC/I
+Failed: syntax error in subpattern name (missing terminator) at offset 7
-/(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/
+/(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/I
Capturing subpattern count = 1
Max back reference = 1
Named capturing subpatterns:
@@ -6332,7 +6287,7 @@ No need char
0: bX
1: X
-/()()()()()()()()()(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/
+/()()()()()()()()()(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/I
Capturing subpattern count = 10
Max back reference = 10
Named capturing subpatterns:
@@ -6353,10 +6308,10 @@ No need char
9:
10: Y
-/\777/
+/\777/I
Failed: octal value is greater than \377 (not in UTF-8 mode) at offset 3
-/\s*,\s*/S
+/\s*,\s*/IS
Capturing subpattern count = 0
Partial matching not supported
No options
@@ -6368,7 +6323,7 @@ Starting byte set: \x09 \x0a \x0c \x0d \x20 ,
\x0c,\x0d
0: \x0c,\x0d
-/^abc/m
+/^abc/Im
Capturing subpattern count = 0
Options: multiline
First char at start or follows newline
@@ -6396,9 +6351,10 @@ No match
xyz\rabc\<lf>
No match
-/abc$/m
+/abc$/Im<lf>
Capturing subpattern count = 0
Options: multiline
+Forced newline sequence: LF
First char = 'a'
Need char = 'c'
xyzabc
@@ -6426,7 +6382,7 @@ No match
xyzabc\r\npqr
No match
-/^abc/m<cr>
+/^abc/Im<cr>
Capturing subpattern count = 0
Options: multiline
Forced newline sequence: CR
@@ -6441,7 +6397,7 @@ No match
xyz\nabcdef
No match
-/^abc/m<lf>
+/^abc/Im<lf>
Capturing subpattern count = 0
Options: multiline
Forced newline sequence: LF
@@ -6456,7 +6412,7 @@ No match
xyz\rabcdef
No match
-/^abc/m<crlf>
+/^abc/Im<crlf>
Capturing subpattern count = 0
Options: multiline
Forced newline sequence: CRLF
@@ -6471,11 +6427,11 @@ No match
xyz\rabcdef
No match
-/^abc/m<bad>
+/^abc/Im<bad>
Unknown newline type at: <bad>
-/abc/
+/abc/I
Capturing subpattern count = 0
No options
First char = 'a'
@@ -6485,10 +6441,11 @@ Unknown newline type at: <bad>
abc
0: abc
-/.*/
+/.*/I<lf>
Capturing subpattern count = 0
Partial matching not supported
-No options
+Options:
+Forced newline sequence: LF
First char at start or follows newline
No need char
abc\ndef
@@ -6510,7 +6467,7 @@ No need char
\<crlf>abc\r\ndef
0: abc
-/\w+(.)(.)?def/s
+/\w+(.)(.)?def/Is
Capturing subpattern count = 2
Partial matching not supported
Options: dotall
@@ -6527,7 +6484,7 @@ Need char = 'f'
1: \x0d
2: \x0a
-+((?:\s|//.*\\n|/[*](?:\\n|.)*?[*]/)*)+
++((?:\s|//.*\\n|/[*](?:\\n|.)*?[*]/)*)+I
Capturing subpattern count = 1
Partial matching not supported
No options
@@ -6539,7 +6496,7 @@ Minimum match() recursion limit = 6
0: /* this is a C style comment */
1: /* this is a C style comment */
-/(?P<B>25[0-5]|2[0-4]\d|[01]?\d?\d)(?:\.(?P>B)){3}/
+/(?P<B>25[0-5]|2[0-4]\d|[01]?\d?\d)(?:\.(?P>B)){3}/I
Capturing subpattern count = 1
Named capturing subpatterns:
B 1
@@ -6547,8 +6504,1626 @@ No options
No first char
Need char = '.'
-/ End of testinput2 /
+/()()()()()()()()()()()()()()()()()()()()
+ ()()()()()()()()()()()()()()()()()()()()
+ ()()()()()()()()()()()()()()()()()()()()
+ ()()()()()()()()()()()()()()()()()()()()
+ ()()()()()()()()()()()()()()()()()()()()
+ (.(.))/Ix
+Capturing subpattern count = 102
+Options: extended
+No first char
+No need char
+ XY\O400
+ 0: XY
+ 1:
+ 2:
+ 3:
+ 4:
+ 5:
+ 6:
+ 7:
+ 8:
+ 9:
+10:
+11:
+12:
+13:
+14:
+15:
+16:
+17:
+18:
+19:
+20:
+21:
+22:
+23:
+24:
+25:
+26:
+27:
+28:
+29:
+30:
+31:
+32:
+33:
+34:
+35:
+36:
+37:
+38:
+39:
+40:
+41:
+42:
+43:
+44:
+45:
+46:
+47:
+48:
+49:
+50:
+51:
+52:
+53:
+54:
+55:
+56:
+57:
+58:
+59:
+60:
+61:
+62:
+63:
+64:
+65:
+66:
+67:
+68:
+69:
+70:
+71:
+72:
+73:
+74:
+75:
+76:
+77:
+78:
+79:
+80:
+81:
+82:
+83:
+84:
+85:
+86:
+87:
+88:
+89:
+90:
+91:
+92:
+93:
+94:
+95:
+96:
+97:
+98:
+99:
+100:
+101: XY
+102: Y
+
+/(a*b|(?i:c*(?-i)d))/IS
+Capturing subpattern count = 1
+Partial matching not supported
+No options
+No first char
+No need char
+Starting byte set: C a b c d
+
+/()[ab]xyz/IS
+Capturing subpattern count = 1
+No options
+No first char
+Need char = 'z'
+Starting byte set: a b
+
+/(|)[ab]xyz/IS
+Capturing subpattern count = 1
+No options
+No first char
+Need char = 'z'
+Starting byte set: a b
+
+/(|c)[ab]xyz/IS
+Capturing subpattern count = 1
+No options
+No first char
+Need char = 'z'
+Starting byte set: a b c
+
+/(|c?)[ab]xyz/IS
+Capturing subpattern count = 1
+No options
+No first char
+Need char = 'z'
+Starting byte set: a b c
+
+/(d?|c?)[ab]xyz/IS
+Capturing subpattern count = 1
+No options
+No first char
+Need char = 'z'
+Starting byte set: a b c d
+
+/(d?|c)[ab]xyz/IS
+Capturing subpattern count = 1
+No options
+No first char
+Need char = 'z'
+Starting byte set: a b c d
+
+/^a*b\d/D
+------------------------------------------------------------------
+ 0 9 Bra 0
+ 3 ^
+ 4 a*+
+ 6 b
+ 8 \d
+ 9 9 Ket
+ 12 End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: anchored
+No first char
+Need char = 'b'
+
+/^a*+b\d/D
+------------------------------------------------------------------
+ 0 9 Bra 0
+ 3 ^
+ 4 a*+
+ 6 b
+ 8 \d
+ 9 9 Ket
+ 12 End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: anchored
+No first char
+Need char = 'b'
+
+/^a*?b\d/D
+------------------------------------------------------------------
+ 0 9 Bra 0
+ 3 ^
+ 4 a*+
+ 6 b
+ 8 \d
+ 9 9 Ket
+ 12 End
+------------------------------------------------------------------
Capturing subpattern count = 0
+Partial matching not supported
+Options: anchored
+No first char
+Need char = 'b'
+
+/^a+A\d/D
+------------------------------------------------------------------
+ 0 9 Bra 0
+ 3 ^
+ 4 a++
+ 6 A
+ 8 \d
+ 9 9 Ket
+ 12 End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: anchored
+No first char
+Need char = 'A'
+ aaaA5
+ 0: aaaA5
+ ** Failers
+No match
+ aaaa5
+No match
+
+/^a*A\d/IiD
+------------------------------------------------------------------
+ 0 9 Bra 0
+ 3 ^
+ 4 a*
+ 6 NC A
+ 8 \d
+ 9 9 Ket
+ 12 End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: anchored caseless
+No first char
+Need char = 'A' (caseless)
+ aaaA5
+ 0: aaaA5
+ aaaa5
+ 0: aaaa5
+
+/(a*|b*)[cd]/IS
+Capturing subpattern count = 1
+Partial matching not supported
No options
-First char = ' '
-Need char = ' '
+No first char
+No need char
+Starting byte set: a b c d
+
+/(a+|b*)[cd]/IS
+Capturing subpattern count = 1
+Partial matching not supported
+No options
+No first char
+No need char
+Starting byte set: a b c d
+
+/(a*|b+)[cd]/IS
+Capturing subpattern count = 1
+Partial matching not supported
+No options
+No first char
+No need char
+Starting byte set: a b c d
+
+/(a+|b+)[cd]/IS
+Capturing subpattern count = 1
+Partial matching not supported
+No options
+No first char
+No need char
+Starting byte set: a b
+
+/((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
+ ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
+ (((
+ a
+ ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
+ ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
+ )))
+/Ix
+Capturing subpattern count = 203
+Options: extended
+First char = 'a'
+No need char
+ large nest
+Matched, but too many substrings
+ 0: a
+ 1: a
+ 2: a
+ 3: a
+ 4: a
+ 5: a
+ 6: a
+ 7: a
+ 8: a
+ 9: a
+10: a
+11: a
+12: a
+13: a
+14: a
+
+/a*\d/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 a*+
+ 5 \d
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/a*\D/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 a*
+ 5 \D
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/0*\d/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 0*
+ 5 \d
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/0*\D/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 0*+
+ 5 \D
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/a*\s/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 a*+
+ 5 \s
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/a*\S/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 a*
+ 5 \S
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/ *\s/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 *
+ 5 \s
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/ *\S/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 *+
+ 5 \S
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/a*\w/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 a*
+ 5 \w
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/a*\W/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 a*+
+ 5 \W
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/=*\w/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 =*+
+ 5 \w
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/=*\W/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 =*
+ 5 \W
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\d*a/B
+------------------------------------------------------------------
+ 0 7 Bra 0
+ 3 \d*+
+ 5 a
+ 7 7 Ket
+ 10 End
+------------------------------------------------------------------
+
+/\d*2/B
+------------------------------------------------------------------
+ 0 7 Bra 0
+ 3 \d*
+ 5 2
+ 7 7 Ket
+ 10 End
+------------------------------------------------------------------
+
+/\d*\d/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \d*
+ 5 \d
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\d*\D/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \d*+
+ 5 \D
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\d*\s/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \d*+
+ 5 \s
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\d*\S/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \d*
+ 5 \S
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\d*\w/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \d*
+ 5 \w
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\d*\W/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \d*+
+ 5 \W
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\D*a/B
+------------------------------------------------------------------
+ 0 7 Bra 0
+ 3 \D*
+ 5 a
+ 7 7 Ket
+ 10 End
+------------------------------------------------------------------
+
+/\D*2/B
+------------------------------------------------------------------
+ 0 7 Bra 0
+ 3 \D*+
+ 5 2
+ 7 7 Ket
+ 10 End
+------------------------------------------------------------------
+
+/\D*\d/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \D*+
+ 5 \d
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\D*\D/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \D*
+ 5 \D
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\D*\s/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \D*
+ 5 \s
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\D*\S/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \D*
+ 5 \S
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\D*\w/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \D*
+ 5 \w
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\D*\W/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \D*
+ 5 \W
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\s*a/B
+------------------------------------------------------------------
+ 0 7 Bra 0
+ 3 \s*+
+ 5 a
+ 7 7 Ket
+ 10 End
+------------------------------------------------------------------
+
+/\s*2/B
+------------------------------------------------------------------
+ 0 7 Bra 0
+ 3 \s*+
+ 5 2
+ 7 7 Ket
+ 10 End
+------------------------------------------------------------------
+
+/\s*\d/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \s*+
+ 5 \d
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\s*\D/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \s*
+ 5 \D
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\s*\s/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \s*
+ 5 \s
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\s*\S/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \s*+
+ 5 \S
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\s*\w/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \s*+
+ 5 \w
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\s*\W/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \s*
+ 5 \W
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\S*a/B
+------------------------------------------------------------------
+ 0 7 Bra 0
+ 3 \S*
+ 5 a
+ 7 7 Ket
+ 10 End
+------------------------------------------------------------------
+
+/\S*2/B
+------------------------------------------------------------------
+ 0 7 Bra 0
+ 3 \S*
+ 5 2
+ 7 7 Ket
+ 10 End
+------------------------------------------------------------------
+
+/\S*\d/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \S*
+ 5 \d
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\S*\D/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \S*
+ 5 \D
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\S*\s/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \S*+
+ 5 \s
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\S*\S/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \S*
+ 5 \S
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\S*\w/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \S*
+ 5 \w
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\S*\W/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \S*
+ 5 \W
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\w*a/B
+------------------------------------------------------------------
+ 0 7 Bra 0
+ 3 \w*
+ 5 a
+ 7 7 Ket
+ 10 End
+------------------------------------------------------------------
+
+/\w*2/B
+------------------------------------------------------------------
+ 0 7 Bra 0
+ 3 \w*
+ 5 2
+ 7 7 Ket
+ 10 End
+------------------------------------------------------------------
+
+/\w*\d/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \w*
+ 5 \d
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\w*\D/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \w*
+ 5 \D
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\w*\s/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \w*+
+ 5 \s
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\w*\S/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \w*
+ 5 \S
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\w*\w/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \w*
+ 5 \w
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\w*\W/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \w*+
+ 5 \W
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\W*a/B
+------------------------------------------------------------------
+ 0 7 Bra 0
+ 3 \W*+
+ 5 a
+ 7 7 Ket
+ 10 End
+------------------------------------------------------------------
+
+/\W*2/B
+------------------------------------------------------------------
+ 0 7 Bra 0
+ 3 \W*+
+ 5 2
+ 7 7 Ket
+ 10 End
+------------------------------------------------------------------
+
+/\W*\d/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \W*+
+ 5 \d
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\W*\D/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \W*
+ 5 \D
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\W*\s/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \W*
+ 5 \s
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\W*\S/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \W*
+ 5 \S
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\W*\w/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \W*+
+ 5 \w
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/\W*\W/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 \W*
+ 5 \W
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/[^a]+a/B
+------------------------------------------------------------------
+ 0 7 Bra 0
+ 3 [^a]++
+ 5 a
+ 7 7 Ket
+ 10 End
+------------------------------------------------------------------
+
+/[^a]+a/Bi
+------------------------------------------------------------------
+ 0 7 Bra 0
+ 3 [^A]++
+ 5 NC a
+ 7 7 Ket
+ 10 End
+------------------------------------------------------------------
+
+/[^a]+A/Bi
+------------------------------------------------------------------
+ 0 7 Bra 0
+ 3 [^A]++
+ 5 NC A
+ 7 7 Ket
+ 10 End
+------------------------------------------------------------------
+
+/[^a]+b/B
+------------------------------------------------------------------
+ 0 7 Bra 0
+ 3 [^a]+
+ 5 b
+ 7 7 Ket
+ 10 End
+------------------------------------------------------------------
+
+/[^a]+\d/B
+------------------------------------------------------------------
+ 0 6 Bra 0
+ 3 [^a]+
+ 5 \d
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/a*[^a]/B
+------------------------------------------------------------------
+ 0 7 Bra 0
+ 3 a*
+ 5 [^a]
+ 7 7 Ket
+ 10 End
+------------------------------------------------------------------
+
+/(?P<abc>x)(?P<xyz>y)/I
+Capturing subpattern count = 2
+Named capturing subpatterns:
+ abc 1
+ xyz 2
+No options
+First char = 'x'
+Need char = 'y'
+ xy\Cabc\Cxyz
+ 0: xy
+ 1: x
+ 2: y
+ C x (1) abc
+ C y (1) xyz
+
+/(?<abc>x)(?'xyz'y)/I
+Capturing subpattern count = 2
+Named capturing subpatterns:
+ abc 1
+ xyz 2
+No options
+First char = 'x'
+Need char = 'y'
+ xy\Cabc\Cxyz
+ 0: xy
+ 1: x
+ 2: y
+ C x (1) abc
+ C y (1) xyz
+
+/(?<abc'x)(?'xyz'y)/I
+Failed: syntax error in subpattern name (missing terminator) at offset 6
+
+/(?<abc>x)(?'xyz>y)/I
+Failed: syntax error in subpattern name (missing terminator) at offset 15
+
+/(?P'abc'x)(?P<xyz>y)/I
+Failed: unrecognized character after (?P at offset 3
+
+/^(?:(?(ZZ)a|b)(?<ZZ>X))+/
+ bXaX
+ 0: bXaX
+ 1: X
+ bXbX
+ 0: bX
+ 1: X
+ ** Failers
+No match
+ aXaX
+No match
+ aXbX
+No match
+
+/^(?P>abc)(?<abcd>xxx)/
+Failed: reference to non-existent subpattern at offset 8
+
+/^(?P>abc)(?<abc>x|y)/
+ xx
+ 0: xx
+ 1: x
+ xy
+ 0: xy
+ 1: y
+ yy
+ 0: yy
+ 1: y
+ yx
+ 0: yx
+ 1: x
+
+/^(?P>abc)(?P<abc>x|y)/
+ xx
+ 0: xx
+ 1: x
+ xy
+ 0: xy
+ 1: y
+ yy
+ 0: yy
+ 1: y
+ yx
+ 0: yx
+ 1: x
+
+/^((?(abc)a|b)(?<abc>x|y))+/
+ bxay
+ 0: bxay
+ 1: ay
+ 2: y
+ bxby
+ 0: bx
+ 1: bx
+ 2: x
+ ** Failers
+No match
+ axby
+No match
+
+/^(((?P=abc)|X)(?<abc>x|y))+/
+ XxXxxx
+ 0: XxXxxx
+ 1: xx
+ 2: x
+ 3: x
+ XxXyyx
+ 0: XxXyyx
+ 1: yx
+ 2: y
+ 3: x
+ XxXyxx
+ 0: XxXy
+ 1: Xy
+ 2: X
+ 3: y
+ ** Failers
+No match
+ x
+No match
+
+/^(?1)(abc)/
+ abcabc
+ 0: abcabc
+ 1: abc
+
+/^(?:(?:\1|X)(a|b))+/
+ Xaaa
+ 0: Xaaa
+ 1: a
+ Xaba
+ 0: Xa
+ 1: a
+
+/^[\E\Qa\E-\Qz\E]+/B
+------------------------------------------------------------------
+ 0 38 Bra 0
+ 3 ^
+ 4 [a-z]+
+ 38 38 Ket
+ 41 End
+------------------------------------------------------------------
+
+/^[a\Q]bc\E]/B
+------------------------------------------------------------------
+ 0 37 Bra 0
+ 3 ^
+ 4 [\]a-c]
+ 37 37 Ket
+ 40 End
+------------------------------------------------------------------
+
+/^[a-\Q\E]/B
+------------------------------------------------------------------
+ 0 37 Bra 0
+ 3 ^
+ 4 [\-a]
+ 37 37 Ket
+ 40 End
+------------------------------------------------------------------
+
+/^(?P>abc)[()](?<abc>)/B
+------------------------------------------------------------------
+ 0 54 Bra 0
+ 3 ^
+ 4 6 Once
+ 7 46 Recurse
+ 10 6 Ket
+ 13 [()]
+ 46 5 Bra 1
+ 51 5 Ket
+ 54 54 Ket
+ 57 End
+------------------------------------------------------------------
+
+/^((?(abc)y)[()](?P<abc>x))+/B
+------------------------------------------------------------------
+ 0 66 Bra 0
+ 3 ^
+ 4 59 Bra 1
+ 9 8 Cond
+ 12 2 Cond ref
+ 15 y
+ 17 8 Ket
+ 20 [()]
+ 53 7 Bra 2
+ 58 x
+ 60 7 Ket
+ 63 59 KetRmax
+ 66 66 Ket
+ 69 End
+------------------------------------------------------------------
+ (xy)x
+ 0: (xy)x
+ 1: y)x
+ 2: x
+
+/^(?P>abc)\Q()\E(?<abc>)/B
+------------------------------------------------------------------
+ 0 25 Bra 0
+ 3 ^
+ 4 6 Once
+ 7 17 Recurse
+ 10 6 Ket
+ 13 ()
+ 17 5 Bra 1
+ 22 5 Ket
+ 25 25 Ket
+ 28 End
+------------------------------------------------------------------
+
+/^(?P>abc)[a\Q(]\E(](?<abc>)/B
+------------------------------------------------------------------
+ 0 54 Bra 0
+ 3 ^
+ 4 6 Once
+ 7 46 Recurse
+ 10 6 Ket
+ 13 [(\]a]
+ 46 5 Bra 1
+ 51 5 Ket
+ 54 54 Ket
+ 57 End
+------------------------------------------------------------------
+
+/^(?P>abc) # this is (a comment)
+ (?<abc>)/Bx
+------------------------------------------------------------------
+ 0 21 Bra 0
+ 3 ^
+ 4 6 Once
+ 7 13 Recurse
+ 10 6 Ket
+ 13 5 Bra 1
+ 18 5 Ket
+ 21 21 Ket
+ 24 End
+------------------------------------------------------------------
+
+/^\W*(?:(?<one>(?<two>.)\W*(?&one)\W*\k<two>|)|(?<three>(?<four>.)\W*(?&three)\W*\k'four'|\W*.\W*))\W*$/Ii
+Capturing subpattern count = 4
+Max back reference = 4
+Named capturing subpatterns:
+ four 4
+ one 1
+ three 3
+ two 2
+Partial matching not supported
+Options: anchored caseless
+No first char
+No need char
+ 1221
+ 0: 1221
+ 1: 1221
+ 2: 1
+ Satan, oscillate my metallic sonatas!
+ 0: Satan, oscillate my metallic sonatas!
+ 1: <unset>
+ 2: <unset>
+ 3: Satan, oscillate my metallic sonatas
+ 4: S
+ A man, a plan, a canal: Panama!
+ 0: A man, a plan, a canal: Panama!
+ 1: <unset>
+ 2: <unset>
+ 3: A man, a plan, a canal: Panama
+ 4: A
+ Able was I ere I saw Elba.
+ 0: Able was I ere I saw Elba.
+ 1: <unset>
+ 2: <unset>
+ 3: Able was I ere I saw Elba
+ 4: A
+ *** Failers
+No match
+ The quick brown fox
+No match
+
+/(?=(\w+))\1:/I
+Capturing subpattern count = 1
+Max back reference = 1
+Partial matching not supported
+No options
+No first char
+Need char = ':'
+ abcd:
+ 0: abcd:
+ 1: abcd
+
+/(?=(?'abc'\w+))\k<abc>:/I
+Capturing subpattern count = 1
+Max back reference = 1
+Named capturing subpatterns:
+ abc 1
+Partial matching not supported
+No options
+No first char
+Need char = ':'
+ abcd:
+ 0: abcd:
+ 1: abcd
+
+/(?'abc'\w+):\k<abc>{2}/
+ a:aaxyz
+ 0: a:aa
+ 1: a
+ ab:ababxyz
+ 0: ab:abab
+ 1: ab
+ ** Failers
+No match
+ a:axyz
+No match
+ ab:abxyz
+No match
+
+/(?'abc'a|b)(?<abc>d|e)\k<abc>{2}/J
+ adaa
+ 0: adaa
+ 1: a
+ 2: d
+ ** Failers
+No match
+ addd
+No match
+ adbb
+No match
+
+/(?'abc'a|b)(?<abc>d|e)(?&abc){2}/J
+ bdaa
+ 0: bdaa
+ 1: b
+ 2: d
+ bdab
+ 0: bdab
+ 1: b
+ 2: d
+ ** Failers
+No match
+ bddd
+No match
+
+/^(?<ab>a)? (?(<ab>)b|c) (?('ab')d|e)/x
+ abd
+ 0: abd
+ 1: a
+ ce
+ 0: ce
+
+/(?(<bc))/
+Failed: malformed number or name after (?( at offset 6
+
+/(?(''))/
+Failed: assertion expected after (?( at offset 4
+
+/(?('R')stuff)/
+Failed: reference to non-existent subpattern at offset 7
+
+/((abc (?(R) (?(R1)1) (?(R2)2) X | (?1) (?2) (?R) ))) /x
+ abcabc1Xabc2XabcXabcabc
+ 0: abcabc1Xabc2XabcX
+ 1: abcabc1Xabc2XabcX
+ 2: abcabc1Xabc2XabcX
+
+/(?<A> (?'B' abc (?(R) (?(R&A)1) (?(R&B)2) X | (?1) (?2) (?R) ))) /x
+ abcabc1Xabc2XabcXabcabc
+ 0: abcabc1Xabc2XabcX
+ 1: abcabc1Xabc2XabcX
+ 2: abcabc1Xabc2XabcX
+
+/(?<A> (?'B' abc (?(R) (?(R&1)1) (?(R&B)2) X | (?1) (?2) (?R) ))) /x
+Failed: reference to non-existent subpattern at offset 29
+
+/(?<1> (?'B' abc (?(R) (?(R&1)1) (?(R&B)2) X | (?1) (?2) (?R) ))) /x
+ abcabc1Xabc2XabcXabcabc
+ 0: abcabc1Xabc2XabcX
+ 1: abcabc1Xabc2XabcX
+ 2: abcabc1Xabc2XabcX
+
+/^(?(DEFINE) (?<A> a) (?<B> b) ) (?&A) (?&B) /x
+ abcd
+ 0: ab
+ 1: <unset>
+ 2: <unset>
+
+/(?<NAME>(?&NAME_PAT))\s+(?<ADDR>(?&ADDRESS_PAT))
+ (?(DEFINE)
+ (?<NAME_PAT>[a-z]+)
+ (?<ADDRESS_PAT>\d+)
+ )/x
+ metcalfe 33
+ 0: metcalfe 33
+ 1: metcalfe
+ 2: 33
+ 3: <unset>
+ 4: <unset>
+
+/^(?(DEFINE) abc | xyz ) /x
+Failed: DEFINE group contains more than one branch at offset 22
+
+/(?(DEFINE) abc) xyz/xI
+Capturing subpattern count = 0
+Options: extended
+First char = 'x'
+Need char = 'z'
+
+/(?(DEFINE) abc){3} xyz/x
+Failed: repeating a DEFINE group is not allowed at offset 17
+
+/(a|)*\d/
+ \O0aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+No match
+ \O0aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+Matched, but too many substrings
+
+/^a.b/<lf>
+ a\rb
+ 0: a\x0db
+ a\nb\<cr>
+ 0: a\x0ab
+ ** Failers
+No match
+ a\nb
+No match
+ a\nb\<any>
+No match
+ a\rb\<cr>
+No match
+ a\rb\<any>
+No match
+
+/^abc./mgx<any>
+ abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x85abc7 \x{2028}abc8 \x{2029}abc9 JUNK
+ 0: abc1
+ 0: abc2
+ 0: abc3
+ 0: abc4
+ 0: abc5
+ 0: abc6
+ 0: abc7
+
+/abc.$/mgx<any>
+ abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc7\x{2028} abc8\x{2029} abc9
+ 0: abc1
+ 0: abc2
+ 0: abc3
+ 0: abc4
+ 0: abc5
+ 0: abc6
+ 0: abc9
+
+/a/<cr><any>
+Failed: inconsistent NEWLINE options at offset 0
+
+/a/<any><crlf>
+Failed: inconsistent NEWLINE options at offset 0
+
+/^a\Rb/
+ a\nb
+ 0: a\x0ab
+ a\rb
+ 0: a\x0db
+ a\r\nb
+ 0: a\x0d\x0ab
+ a\x0bb
+ 0: a\x0bb
+ a\x0cb
+ 0: a\x0cb
+ a\x85b
+ 0: a\x85b
+ ** Failers
+No match
+ a\n\rb
+No match
+
+/^a\R*b/
+ ab
+ 0: ab
+ a\nb
+ 0: a\x0ab
+ a\rb
+ 0: a\x0db
+ a\r\nb
+ 0: a\x0d\x0ab
+ a\x0bb
+ 0: a\x0bb
+ a\x0cb
+ 0: a\x0cb
+ a\x85b
+ 0: a\x85b
+ a\n\rb
+ 0: a\x0a\x0db
+ a\n\r\x85\x0cb
+ 0: a\x0a\x0d\x85\x0cb
+
+/^a\R+b/
+ a\nb
+ 0: a\x0ab
+ a\rb
+ 0: a\x0db
+ a\r\nb
+ 0: a\x0d\x0ab
+ a\x0bb
+ 0: a\x0bb
+ a\x0cb
+ 0: a\x0cb
+ a\x85b
+ 0: a\x85b
+ a\n\rb
+ 0: a\x0a\x0db
+ a\n\r\x85\x0cb
+ 0: a\x0a\x0d\x85\x0cb
+ ** Failers
+No match
+ ab
+No match
+
+/^a\R{1,3}b/
+ a\nb
+ 0: a\x0ab
+ a\n\rb
+ 0: a\x0a\x0db
+ a\n\r\x85b
+ 0: a\x0a\x0d\x85b
+ a\r\n\r\nb
+ 0: a\x0d\x0a\x0d\x0ab
+ a\r\n\r\n\r\nb
+ 0: a\x0d\x0a\x0d\x0a\x0d\x0ab
+ a\n\r\n\rb
+ 0: a\x0a\x0d\x0a\x0db
+ a\n\n\r\nb
+ 0: a\x0a\x0a\x0d\x0ab
+ ** Failers
+No match
+ a\n\n\n\rb
+No match
+ a\r
+No match
+
+/^a[\R]b/
+ aRb
+ 0: aRb
+ ** Failers
+No match
+ a\nb
+No match
+
+/(?&abc)X(?<abc>P)/I
+Capturing subpattern count = 1
+Named capturing subpatterns:
+ abc 1
+No options
+No first char
+Need char = 'P'
+ abcPXP123
+ 0: PXP
+ 1: P
+
+/(?1)X(?<abc>P)/I
+Capturing subpattern count = 1
+Named capturing subpatterns:
+ abc 1
+No options
+No first char
+Need char = 'P'
+ abcPXP123
+ 0: PXP
+ 1: P
+
+/(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))\b(?&byte)(\.(?&byte)){3}/
+ 1.2.3.4
+ 0: 1.2.3.4
+ 1: <unset>
+ 2: .4
+ 131.111.10.206
+ 0: 131.111.10.206
+ 1: <unset>
+ 2: .206
+ 10.0.0.0
+ 0: 10.0.0.0
+ 1: <unset>
+ 2: .0
+ ** Failers
+No match
+ 10.6
+No match
+ 455.3.4.5
+No match
+
+/\b(?&byte)(\.(?&byte)){3}(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))/
+ 1.2.3.4
+ 0: 1.2.3.4
+ 1: .4
+ 2: <unset>
+ 131.111.10.206
+ 0: 131.111.10.206
+ 1: .206
+ 2: <unset>
+ 10.0.0.0
+ 0: 10.0.0.0
+ 1: .0
+ 2: <unset>
+ ** Failers
+No match
+ 10.6
+No match
+ 455.3.4.5
+No match
+
+/(?:a(?&abc)b)*(?<abc>x)/
+ 123axbaxbaxbx456
+ 0: axbaxbaxbx
+ 1: x
+ 123axbaxbaxb456
+ 0: x
+ 1: x
+
+/(?:a(?&abc)b){1,5}(?<abc>x)/
+ 123axbaxbaxbx456
+ 0: axbaxbaxbx
+ 1: x
+
+/(?:a(?&abc)b){2,5}(?<abc>x)/
+ 123axbaxbaxbx456
+ 0: axbaxbaxbx
+ 1: x
+
+/(?:a(?&abc)b){2,}(?<abc>x)/
+ 123axbaxbaxbx456
+ 0: axbaxbaxbx
+ 1: x
+
+/(abc)(?i:(?1))/
+ defabcabcxyz
+ 0: abcabc
+ 1: abc
+ DEFabcABCXYZ
+No match
+
+/(abc)(?:(?i)(?1))/
+ defabcabcxyz
+ 0: abcabc
+ 1: abc
+ DEFabcABCXYZ
+No match
+
+/^(a(b))\1\g1\g{1}\g-1\g{-1}\g{-02}Z/
+ ababababbbabZXXXX
+ 0: ababababbbabZ
+ 1: ab
+ 2: b
+
+/^(a)\g-2/
+Failed: reference to non-existent subpattern at offset 4
+
+/^(a)\g/
+Failed: \g is not followed by an (optionally braced) non-zero number at offset 4
+
+/^(a)\g{0}/
+Failed: \g is not followed by an (optionally braced) non-zero number at offset 4
+
+/^(a)\g{3/
+Failed: \g is not followed by an (optionally braced) non-zero number at offset 4
+
+/^(a)\g{4a}/
+Failed: \g is not followed by an (optionally braced) non-zero number at offset 4
+
+/^a.b/<lf>
+ a\rb
+ 0: a\x0db
+ *** Failers
+No match
+ a\nb
+No match
+
+/.+foo/
+ afoo
+ 0: afoo
+ ** Failers
+No match
+ \r\nfoo
+No match
+ \nfoo
+No match
+
+/.+foo/<crlf>
+ afoo
+ 0: afoo
+ \nfoo
+ 0: \x0afoo
+ ** Failers
+No match
+ \r\nfoo
+No match
+
+/.+foo/<any>
+ afoo
+ 0: afoo
+ ** Failers
+No match
+ \nfoo
+No match
+ \r\nfoo
+No match
+
+/.+foo/s
+ afoo
+ 0: afoo
+ \r\nfoo
+ 0: \x0d\x0afoo
+ \nfoo
+ 0: \x0afoo
+
+/ End of testinput2 /
diff --git a/testdata/testoutput3 b/testdata/testoutput3
index 06e2888..c539579 100644
--- a/testdata/testoutput3
+++ b/testdata/testoutput3
@@ -149,9 +149,9 @@ No match
/[[:alpha:]][[:lower:]][[:upper:]]/DLfr_FR
------------------------------------------------------------------
0 102 Bra 0
- 3 [A-Za-z---]
- 36 [a-z--]
- 69 [A-Z--]
+ 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
------------------------------------------------------------------
diff --git a/testdata/testoutput4 b/testdata/testoutput4
index 3b49455..966b285 100644
--- a/testdata/testoutput4
+++ b/testdata/testoutput4
@@ -914,4 +914,8 @@ No match
0: ab
1: ab
+/a*\x{100}*\w/8
+ a
+ 0: a
+
/ End of testinput4 /
diff --git a/testdata/testoutput5 b/testdata/testoutput5
index 2c5e3c0..61c6842 100644
--- a/testdata/testoutput5
+++ b/testdata/testoutput5
@@ -103,7 +103,7 @@ First char = 195
Need char = 191
/[\x{100}]/8DM
-Memory allocation (code space): 47
+Memory allocation (code space): 15
------------------------------------------------------------------
0 11 Bra 0
3 [\x{100}]
@@ -429,11 +429,11 @@ No match
/Ā{3,4}/8SD
------------------------------------------------------------------
- 0 13 Bra 0
+ 0 11 Bra 0
3 \x{100}{3}
- 8 \x{100}{,1}
- 13 13 Ket
- 16 End
+ 8 \x{100}?
+ 11 11 Ket
+ 14 End
------------------------------------------------------------------
Capturing subpattern count = 0
Partial matching not supported
@@ -446,28 +446,9 @@ Study returned NULL
/(\x{100}+|x)/8SD
------------------------------------------------------------------
- 0 17 Bra 0
- 3 6 Bra 1
- 6 \x{100}+
- 9 5 Alt
- 12 x
- 14 11 Ket
- 17 17 Ket
- 20 End
-------------------------------------------------------------------
-Capturing subpattern count = 1
-Partial matching not supported
-Options: utf8
-No first char
-No need char
-Starting byte set: x \xc4
-
-/(\x{100}*a|x)/8SD
-------------------------------------------------------------------
0 19 Bra 0
3 8 Bra 1
- 6 \x{100}*
- 9 a
+ 8 \x{100}+
11 5 Alt
14 x
16 13 Ket
@@ -479,13 +460,13 @@ Partial matching not supported
Options: utf8
No first char
No need char
-Starting byte set: a x \xc4
+Starting byte set: x \xc4
-/(\x{100}{0,2}a|x)/8SD
+/(\x{100}*a|x)/8SD
------------------------------------------------------------------
0 21 Bra 0
3 10 Bra 1
- 6 \x{100}{,2}
+ 8 \x{100}*+
11 a
13 5 Alt
16 x
@@ -500,18 +481,37 @@ No first char
No need char
Starting byte set: a x \xc4
+/(\x{100}{0,2}a|x)/8SD
+------------------------------------------------------------------
+ 0 23 Bra 0
+ 3 12 Bra 1
+ 8 \x{100}{0,2}
+ 13 a
+ 15 5 Alt
+ 18 x
+ 20 17 Ket
+ 23 23 Ket
+ 26 End
+------------------------------------------------------------------
+Capturing subpattern count = 1
+Partial matching not supported
+Options: utf8
+No first char
+No need char
+Starting byte set: a x \xc4
+
/(\x{100}{1,2}a|x)/8SD
------------------------------------------------------------------
- 0 24 Bra 0
- 3 13 Bra 1
- 6 \x{100}
- 9 \x{100}{,1}
- 14 a
- 16 5 Alt
- 19 x
- 21 18 Ket
- 24 24 Ket
- 27 End
+ 0 26 Bra 0
+ 3 15 Bra 1
+ 8 \x{100}
+ 11 \x{100}{0,1}
+ 16 a
+ 18 5 Alt
+ 21 x
+ 23 20 Ket
+ 26 26 Ket
+ 29 End
------------------------------------------------------------------
Capturing subpattern count = 1
Partial matching not supported
@@ -628,7 +628,7 @@ Need char = 129
/\x{100}*A/8D
------------------------------------------------------------------
0 8 Bra 0
- 3 \x{100}*
+ 3 \x{100}*+
6 A
8 8 Ket
11 End
@@ -644,7 +644,7 @@ Need char = 'A'
/\x{100}*\d(?R)/8D
------------------------------------------------------------------
0 16 Bra 0
- 3 \x{100}*
+ 3 \x{100}*+
6 \d
7 6 Once
10 0 Recurse
@@ -683,7 +683,7 @@ No first char
No need char
/[\x{100}]/8DM
-Memory allocation (code space): 47
+Memory allocation (code space): 15
------------------------------------------------------------------
0 11 Bra 0
3 [\x{100}]
@@ -912,16 +912,16 @@ No match
/\x{100}abc(xyz(?1))/8D
------------------------------------------------------------------
- 0 33 Bra 0
+ 0 35 Bra 0
3 \x{100}abc
- 12 18 Bra 1
- 15 xyz
- 21 6 Once
- 24 12 Recurse
- 27 6 Ket
- 30 18 Ket
- 33 33 Ket
- 36 End
+ 12 20 Bra 1
+ 17 xyz
+ 23 6 Once
+ 26 12 Recurse
+ 29 6 Ket
+ 32 20 Ket
+ 35 35 Ket
+ 38 End
------------------------------------------------------------------
Capturing subpattern count = 1
Options: utf8
@@ -930,17 +930,17 @@ Need char = 'z'
/[^\x{100}]abc(xyz(?1))/8D
------------------------------------------------------------------
- 0 38 Bra 0
+ 0 40 Bra 0
3 [^\x{100}]
11 abc
- 17 18 Bra 1
- 20 xyz
- 26 6 Once
- 29 17 Recurse
- 32 6 Ket
- 35 18 Ket
- 38 38 Ket
- 41 End
+ 17 20 Bra 1
+ 22 xyz
+ 28 6 Once
+ 31 17 Recurse
+ 34 6 Ket
+ 37 20 Ket
+ 40 40 Ket
+ 43 End
------------------------------------------------------------------
Capturing subpattern count = 1
Options: utf8
@@ -949,17 +949,17 @@ Need char = 'z'
/[ab\x{100}]abc(xyz(?1))/8D
------------------------------------------------------------------
- 0 70 Bra 0
+ 0 72 Bra 0
3 [ab\x{100}]
43 abc
- 49 18 Bra 1
- 52 xyz
- 58 6 Once
- 61 49 Recurse
- 64 6 Ket
- 67 18 Ket
- 70 70 Ket
- 73 End
+ 49 20 Bra 1
+ 54 xyz
+ 60 6 Once
+ 63 49 Recurse
+ 66 6 Ket
+ 69 20 Ket
+ 72 72 Ket
+ 75 End
------------------------------------------------------------------
Capturing subpattern count = 1
Options: utf8
@@ -968,20 +968,20 @@ Need char = 'z'
/(\x{100}(b(?2)c))?/D8
------------------------------------------------------------------
- 0 32 Bra 0
+ 0 36 Bra 0
3 Brazero
- 4 25 Bra 1
- 7 \x{100}
- 10 16 Bra 2
- 13 b
- 15 6 Once
- 18 10 Recurse
- 21 6 Ket
- 24 c
- 26 16 Ket
- 29 25 Ket
- 32 32 Ket
- 35 End
+ 4 29 Bra 1
+ 9 \x{100}
+ 12 18 Bra 2
+ 17 b
+ 19 6 Once
+ 22 12 Recurse
+ 25 6 Ket
+ 28 c
+ 30 18 Ket
+ 33 29 Ket
+ 36 36 Ket
+ 39 End
------------------------------------------------------------------
Capturing subpattern count = 2
Options: utf8
@@ -990,33 +990,33 @@ No need char
/(\x{100}(b(?2)c)){0,2}/D8
------------------------------------------------------------------
- 0 67 Bra 0
+ 0 75 Bra 0
3 Brazero
- 4 60 Bra 0
- 7 25 Bra 1
- 10 \x{100}
- 13 16 Bra 2
- 16 b
- 18 6 Once
- 21 13 Recurse
- 24 6 Ket
- 27 c
- 29 16 Ket
- 32 25 Ket
- 35 Brazero
- 36 25 Bra 1
- 39 \x{100}
- 42 16 Bra 2
- 45 b
- 47 6 Once
- 50 13 Recurse
- 53 6 Ket
- 56 c
- 58 16 Ket
- 61 25 Ket
- 64 60 Ket
- 67 67 Ket
- 70 End
+ 4 68 Bra 0
+ 7 29 Bra 1
+ 12 \x{100}
+ 15 18 Bra 2
+ 20 b
+ 22 6 Once
+ 25 15 Recurse
+ 28 6 Ket
+ 31 c
+ 33 18 Ket
+ 36 29 Ket
+ 39 Brazero
+ 40 29 Bra 1
+ 45 \x{100}
+ 48 18 Bra 2
+ 53 b
+ 55 6 Once
+ 58 15 Recurse
+ 61 6 Ket
+ 64 c
+ 66 18 Ket
+ 69 29 Ket
+ 72 68 Ket
+ 75 75 Ket
+ 78 End
------------------------------------------------------------------
Capturing subpattern count = 2
Options: utf8
@@ -1025,20 +1025,20 @@ No need char
/(\x{100}(b(?1)c))?/D8
------------------------------------------------------------------
- 0 32 Bra 0
+ 0 36 Bra 0
3 Brazero
- 4 25 Bra 1
- 7 \x{100}
- 10 16 Bra 2
- 13 b
- 15 6 Once
- 18 4 Recurse
- 21 6 Ket
- 24 c
- 26 16 Ket
- 29 25 Ket
- 32 32 Ket
- 35 End
+ 4 29 Bra 1
+ 9 \x{100}
+ 12 18 Bra 2
+ 17 b
+ 19 6 Once
+ 22 4 Recurse
+ 25 6 Ket
+ 28 c
+ 30 18 Ket
+ 33 29 Ket
+ 36 36 Ket
+ 39 End
------------------------------------------------------------------
Capturing subpattern count = 2
Options: utf8
@@ -1047,33 +1047,33 @@ No need char
/(\x{100}(b(?1)c)){0,2}/D8
------------------------------------------------------------------
- 0 67 Bra 0
+ 0 75 Bra 0
3 Brazero
- 4 60 Bra 0
- 7 25 Bra 1
- 10 \x{100}
- 13 16 Bra 2
- 16 b
- 18 6 Once
- 21 7 Recurse
- 24 6 Ket
- 27 c
- 29 16 Ket
- 32 25 Ket
- 35 Brazero
- 36 25 Bra 1
- 39 \x{100}
- 42 16 Bra 2
- 45 b
- 47 6 Once
- 50 7 Recurse
- 53 6 Ket
- 56 c
- 58 16 Ket
- 61 25 Ket
- 64 60 Ket
- 67 67 Ket
- 70 End
+ 4 68 Bra 0
+ 7 29 Bra 1
+ 12 \x{100}
+ 15 18 Bra 2
+ 20 b
+ 22 6 Once
+ 25 7 Recurse
+ 28 6 Ket
+ 31 c
+ 33 18 Ket
+ 36 29 Ket
+ 39 Brazero
+ 40 29 Bra 1
+ 45 \x{100}
+ 48 18 Bra 2
+ 53 b
+ 55 6 Once
+ 58 7 Recurse
+ 61 6 Ket
+ 64 c
+ 66 18 Ket
+ 69 29 Ket
+ 72 68 Ket
+ 75 75 Ket
+ 78 End
------------------------------------------------------------------
Capturing subpattern count = 2
Options: utf8
@@ -1119,5 +1119,285 @@ Need char = 191
0: \x{1ff}
\777
0: \x{1ff}
+
+/\x{100}*\d/8D
+------------------------------------------------------------------
+ 0 7 Bra 0
+ 3 \x{100}*+
+ 6 \d
+ 7 7 Ket
+ 10 End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+No first char
+No need char
+
+/\x{100}*\s/8D
+------------------------------------------------------------------
+ 0 7 Bra 0
+ 3 \x{100}*+
+ 6 \s
+ 7 7 Ket
+ 10 End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+No first char
+No need char
+
+/\x{100}*\w/8D
+------------------------------------------------------------------
+ 0 7 Bra 0
+ 3 \x{100}*+
+ 6 \w
+ 7 7 Ket
+ 10 End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+No first char
+No need char
+
+/\x{100}*\D/8D
+------------------------------------------------------------------
+ 0 7 Bra 0
+ 3 \x{100}*
+ 6 \D
+ 7 7 Ket
+ 10 End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+No first char
+No need char
+
+/\x{100}*\S/8D
+------------------------------------------------------------------
+ 0 7 Bra 0
+ 3 \x{100}*
+ 6 \S
+ 7 7 Ket
+ 10 End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+No first char
+No need char
+
+/\x{100}*\W/8D
+------------------------------------------------------------------
+ 0 7 Bra 0
+ 3 \x{100}*
+ 6 \W
+ 7 7 Ket
+ 10 End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+No first char
+No need char
+
+/\x{100}+\x{200}/8D
+------------------------------------------------------------------
+ 0 9 Bra 0
+ 3 \x{100}++
+ 6 \x{200}
+ 9 9 Ket
+ 12 End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+First char = 196
+Need char = 128
+
+/\x{100}+X/8D
+------------------------------------------------------------------
+ 0 8 Bra 0
+ 3 \x{100}++
+ 6 X
+ 8 8 Ket
+ 11 End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+First char = 196
+Need char = 'X'
+
+/X+\x{200}/8D
+------------------------------------------------------------------
+ 0 8 Bra 0
+ 3 X++
+ 5 \x{200}
+ 8 8 Ket
+ 11 End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+First char = 'X'
+Need char = 128
+
+/()()()()()()()()()()
+ ()()()()()()()()()()
+ ()()()()()()()()()()
+ ()()()()()()()()()()
+ A (x) (?41) B/8x
+ AxxB
+Matched, but too many substrings
+ 0: AxxB
+ 1:
+ 2:
+ 3:
+ 4:
+ 5:
+ 6:
+ 7:
+ 8:
+ 9:
+10:
+11:
+12:
+13:
+14:
+
+/^[\x{100}\E-\Q\E\x{150}]/B8
+------------------------------------------------------------------
+ 0 14 Bra 0
+ 3 ^
+ 4 [\x{100}-\x{150}]
+ 14 14 Ket
+ 17 End
+------------------------------------------------------------------
+
+/^[\QĀ\E-\QŐ\E]/B8
+------------------------------------------------------------------
+ 0 14 Bra 0
+ 3 ^
+ 4 [\x{100}-\x{150}]
+ 14 14 Ket
+ 17 End
+------------------------------------------------------------------
+
+/^[\QĀ\E-\QŐ\E/B8
+Failed: missing terminating ] for character class at offset 15
+
+/^abc./mgx8<any>
+ abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x{0085}abc7 \x{2028}abc8 \x{2029}abc9 JUNK
+ 0: abc1
+ 0: abc2
+ 0: abc3
+ 0: abc4
+ 0: abc5
+ 0: abc6
+ 0: abc7
+ 0: abc8
+ 0: abc9
+
+/abc.$/mgx8<any>
+ abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x{0085} abc7\x{2028} abc8\x{2029} abc9
+ 0: abc1
+ 0: abc2
+ 0: abc3
+ 0: abc4
+ 0: abc5
+ 0: abc6
+ 0: abc7
+ 0: abc8
+ 0: abc9
+
+/^a\Rb/8
+ a\nb
+ 0: a\x{0a}b
+ a\rb
+ 0: a\x{0d}b
+ a\r\nb
+ 0: a\x{0d}\x{0a}b
+ a\x0bb
+ 0: a\x{0b}b
+ a\x0cb
+ 0: a\x{0c}b
+ a\x{85}b
+ 0: a\x{85}b
+ a\x{2028}b
+ 0: a\x{2028}b
+ a\x{2029}b
+ 0: a\x{2029}b
+ ** Failers
+No match
+ a\n\rb
+No match
+
+/^a\R*b/8
+ ab
+ 0: ab
+ a\nb
+ 0: a\x{0a}b
+ a\rb
+ 0: a\x{0d}b
+ a\r\nb
+ 0: a\x{0d}\x{0a}b
+ a\x0bb
+ 0: a\x{0b}b
+ a\x0c\x{2028}\x{2029}b
+ 0: a\x{0c}\x{2028}\x{2029}b
+ a\x{85}b
+ 0: a\x{85}b
+ a\n\rb
+ 0: a\x{0a}\x{0d}b
+ a\n\r\x{85}\x0cb
+ 0: a\x{0a}\x{0d}\x{85}\x{0c}b
+
+/^a\R+b/8
+ a\nb
+ 0: a\x{0a}b
+ a\rb
+ 0: a\x{0d}b
+ a\r\nb
+ 0: a\x{0d}\x{0a}b
+ a\x0bb
+ 0: a\x{0b}b
+ a\x0c\x{2028}\x{2029}b
+ 0: a\x{0c}\x{2028}\x{2029}b
+ a\x{85}b
+ 0: a\x{85}b
+ a\n\rb
+ 0: a\x{0a}\x{0d}b
+ a\n\r\x{85}\x0cb
+ 0: a\x{0a}\x{0d}\x{85}\x{0c}b
+ ** Failers
+No match
+ ab
+No match
+
+/^a\R{1,3}b/8
+ a\nb
+ 0: a\x{0a}b
+ a\n\rb
+ 0: a\x{0a}\x{0d}b
+ a\n\r\x{85}b
+ 0: a\x{0a}\x{0d}\x{85}b
+ a\r\n\r\nb
+ 0: a\x{0d}\x{0a}\x{0d}\x{0a}b
+ a\r\n\r\n\r\nb
+ 0: a\x{0d}\x{0a}\x{0d}\x{0a}\x{0d}\x{0a}b
+ a\n\r\n\rb
+ 0: a\x{0a}\x{0d}\x{0a}\x{0d}b
+ a\n\n\r\nb
+ 0: a\x{0a}\x{0a}\x{0d}\x{0a}b
+ ** Failers
+No match
+ a\n\n\n\rb
+No match
+ a\r
+No match
/ End of testinput5 /
diff --git a/testdata/testoutput6 b/testdata/testoutput6
index ee174a6..a8bb0ad 100644
--- a/testdata/testoutput6
+++ b/testdata/testoutput6
@@ -609,7 +609,7 @@ No first char
No need char
/[\p{Nd}]/8DM
-Memory allocation (code space): 47
+Memory allocation (code space): 15
------------------------------------------------------------------
0 11 Bra 0
3 [\p{Nd}]
@@ -1410,4 +1410,26 @@ No match
1: L=abc
2: abc
+/The next two should be Perl-compatible, but it fails to match \x{e0}. PCRE
+will match it only with UCP support, because without that it has no notion
+of case for anything other than the ASCII letters. /
+
+/((?i)[\x{c0}])/8
+ \x{c0}
+ 0: \x{c0}
+ 1: \x{c0}
+ \x{e0}
+ 0: \x{e0}
+ 1: \x{e0}
+
+/(?i:[\x{c0}])/8
+ \x{c0}
+ 0: \x{c0}
+ \x{e0}
+ 0: \x{e0}
+
+/^\p{Balinese}\p{Cuneiform}\p{Nko}\p{Phags_Pa}\p{Phoenician}/8
+ \x{1b00}\x{12000}\x{7c0}\x{a840}\x{10900}
+ 0: \x{1b00}\x{12000}\x{7c0}\x{a840}\x{10900}
+
/ End of testinput6 /
diff --git a/testdata/testoutput7 b/testdata/testoutput7
index 24a3ba8..5bddc1e 100644
--- a/testdata/testoutput7
+++ b/testdata/testoutput7
@@ -2735,7 +2735,7 @@ No match
No match
/^a b
- c/x
+ c/x
abc
0: abc
@@ -2973,7 +2973,7 @@ No match
{4,5a}bc
0: {4,5a}bc
-/^a.b/
+/^a.b/<lf>
a\rb
0: a\x0db
*** Failers
@@ -3039,9 +3039,9 @@ No match
abcdefghijk\12S
0: abcdefghijk\x0aS
-/ab\gdef/
- abgdef
- 0: abgdef
+/ab\hdef/
+ abhdef
+ 0: abhdef
/a{0}bc/
bc
@@ -6600,7 +6600,7 @@ No match
xyz\rabc\<lf>
No match
-/abc$/m
+/abc$/m<lf>
xyzabc
0: abc
xyzabc\n
@@ -6656,7 +6656,7 @@ No match
xyz\rabcdef
No match
-/.*/
+/.*/<lf>
abc\ndef
0: abc
1: ab
@@ -6728,4 +6728,228 @@ No match
abc\r\ndef
0: abc\x0d\x0adef
+/^\w+=.*(\\\n.*)*/
+ abc=xyz\\\npqr
+ 0: abc=xyz\\x0apqr
+ 1: abc=xyz\\x0apq
+ 2: abc=xyz\\x0ap
+ 3: abc=xyz\\x0a
+ 4: abc=xyz\
+ 5: abc=xyz
+ 6: abc=xy
+ 7: abc=x
+ 8: abc=
+
+/^(a()*)*/
+ aaaa
+ 0: aaaa
+ 1: aaa
+ 2: aa
+ 3: a
+ 4:
+
+/^(?:a(?:(?:))*)*/
+ aaaa
+ 0: aaaa
+ 1: aaa
+ 2: aa
+ 3: a
+ 4:
+
+/^(a()+)+/
+ aaaa
+ 0: aaaa
+ 1: aaa
+ 2: aa
+ 3: a
+
+/^(?:a(?:(?:))+)+/
+ aaaa
+ 0: aaaa
+ 1: aaa
+ 2: aa
+ 3: a
+
+/(a|)*\d/
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+No match
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/(?>a|)*\d/
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+No match
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/(?:a|)*\d/
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+No match
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/^a.b/<lf>
+ a\rb
+ 0: a\x0db
+ a\nb\<cr>
+ 0: a\x0ab
+ ** Failers
+No match
+ a\nb
+No match
+ a\nb\<any>
+No match
+ a\rb\<cr>
+No match
+ a\rb\<any>
+No match
+
+/^abc./mgx<any>
+ abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x85abc7 \x{2028}abc8 \x{2029}abc9 JUNK
+ 0: abc1
+ 0: abc2
+ 0: abc3
+ 0: abc4
+ 0: abc5
+ 0: abc6
+ 0: abc7
+
+/abc.$/mgx<any>
+ abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc7\x{2028} abc8\x{2029} abc9
+ 0: abc1
+ 0: abc2
+ 0: abc3
+ 0: abc4
+ 0: abc5
+ 0: abc6
+ 0: abc9
+
+/^a\Rb/
+ a\nb
+ 0: a\x0ab
+ a\rb
+ 0: a\x0db
+ a\r\nb
+ 0: a\x0d\x0ab
+ a\x0bb
+ 0: a\x0bb
+ a\x0cb
+ 0: a\x0cb
+ a\x85b
+ 0: a\x85b
+ ** Failers
+No match
+ a\n\rb
+No match
+
+/^a\R*b/
+ ab
+ 0: ab
+ a\nb
+ 0: a\x0ab
+ a\rb
+ 0: a\x0db
+ a\r\nb
+ 0: a\x0d\x0ab
+ a\x0bb
+ 0: a\x0bb
+ a\x0cb
+ 0: a\x0cb
+ a\x85b
+ 0: a\x85b
+ a\n\rb
+ 0: a\x0a\x0db
+ a\n\r\x85\x0cb
+ 0: a\x0a\x0d\x85\x0cb
+
+/^a\R+b/
+ a\nb
+ 0: a\x0ab
+ a\rb
+ 0: a\x0db
+ a\r\nb
+ 0: a\x0d\x0ab
+ a\x0bb
+ 0: a\x0bb
+ a\x0cb
+ 0: a\x0cb
+ a\x85b
+ 0: a\x85b
+ a\n\rb
+ 0: a\x0a\x0db
+ a\n\r\x85\x0cb
+ 0: a\x0a\x0d\x85\x0cb
+ ** Failers
+No match
+ ab
+No match
+
+/^a\R{1,3}b/
+ a\nb
+ 0: a\x0ab
+ a\n\rb
+ 0: a\x0a\x0db
+ a\n\r\x85b
+ 0: a\x0a\x0d\x85b
+ a\r\n\r\nb
+ 0: a\x0d\x0a\x0d\x0ab
+ a\r\n\r\n\r\nb
+ 0: a\x0d\x0a\x0d\x0a\x0d\x0ab
+ a\n\r\n\rb
+ 0: a\x0a\x0d\x0a\x0db
+ a\n\n\r\nb
+ 0: a\x0a\x0a\x0d\x0ab
+ ** Failers
+No match
+ a\n\n\n\rb
+No match
+ a\r
+No match
+
+/^a[\R]b/
+ aRb
+ 0: aRb
+ ** Failers
+No match
+ a\nb
+No match
+
+/.+foo/
+ afoo
+ 0: afoo
+ ** Failers
+No match
+ \r\nfoo
+No match
+ \nfoo
+No match
+
+/.+foo/<crlf>
+ afoo
+ 0: afoo
+ \nfoo
+ 0: \x0afoo
+ ** Failers
+No match
+ \r\nfoo
+No match
+
+/.+foo/<any>
+ afoo
+ 0: afoo
+ ** Failers
+No match
+ \nfoo
+No match
+ \r\nfoo
+No match
+
+/.+foo/s
+ afoo
+ 0: afoo
+ \r\nfoo
+ 0: \x0d\x0afoo
+ \nfoo
+ 0: \x0afoo
+
/ End of testinput7 /
diff --git a/testdata/testoutput8 b/testdata/testoutput8
index 72e7673..f8251ff 100644
--- a/testdata/testoutput8
+++ b/testdata/testoutput8
@@ -1028,4 +1028,114 @@ No match
\x{85}
0: \x{85}
+/^abc./mgx8<any>
+ abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x{0085}abc7 \x{2028}abc8 \x{2029}abc9 JUNK
+ 0: abc1
+ 0: abc2
+ 0: abc3
+ 0: abc4
+ 0: abc5
+ 0: abc6
+ 0: abc7
+ 0: abc8
+ 0: abc9
+
+/abc.$/mgx8<any>
+ abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x{0085} abc7\x{2028} abc8\x{2029} abc9
+ 0: abc1
+ 0: abc2
+ 0: abc3
+ 0: abc4
+ 0: abc5
+ 0: abc6
+ 0: abc7
+ 0: abc8
+ 0: abc9
+
+/^a\Rb/8
+ a\nb
+ 0: a\x{0a}b
+ a\rb
+ 0: a\x{0d}b
+ a\r\nb
+ 0: a\x{0d}\x{0a}b
+ a\x0bb
+ 0: a\x{0b}b
+ a\x0cb
+ 0: a\x{0c}b
+ a\x{85}b
+ 0: a\x{85}b
+ a\x{2028}b
+ 0: a\x{2028}b
+ a\x{2029}b
+ 0: a\x{2029}b
+ ** Failers
+No match
+ a\n\rb
+No match
+
+/^a\R*b/8
+ ab
+ 0: ab
+ a\nb
+ 0: a\x{0a}b
+ a\rb
+ 0: a\x{0d}b
+ a\r\nb
+ 0: a\x{0d}\x{0a}b
+ a\x0bb
+ 0: a\x{0b}b
+ a\x0c\x{2028}\x{2029}b
+ 0: a\x{0c}\x{2028}\x{2029}b
+ a\x{85}b
+ 0: a\x{85}b
+ a\n\rb
+ 0: a\x{0a}\x{0d}b
+ a\n\r\x{85}\x0cb
+ 0: a\x{0a}\x{0d}\x{85}\x{0c}b
+
+/^a\R+b/8
+ a\nb
+ 0: a\x{0a}b
+ a\rb
+ 0: a\x{0d}b
+ a\r\nb
+ 0: a\x{0d}\x{0a}b
+ a\x0bb
+ 0: a\x{0b}b
+ a\x0c\x{2028}\x{2029}b
+ 0: a\x{0c}\x{2028}\x{2029}b
+ a\x{85}b
+ 0: a\x{85}b
+ a\n\rb
+ 0: a\x{0a}\x{0d}b
+ a\n\r\x{85}\x0cb
+ 0: a\x{0a}\x{0d}\x{85}\x{0c}b
+ ** Failers
+No match
+ ab
+No match
+
+/^a\R{1,3}b/8
+ a\nb
+ 0: a\x{0a}b
+ a\n\rb
+ 0: a\x{0a}\x{0d}b
+ a\n\r\x{85}b
+ 0: a\x{0a}\x{0d}\x{85}b
+ a\r\n\r\nb
+ 0: a\x{0d}\x{0a}\x{0d}\x{0a}b
+ a\r\n\r\n\r\nb
+ 0: a\x{0d}\x{0a}\x{0d}\x{0a}\x{0d}\x{0a}b
+ a\n\r\n\rb
+ 0: a\x{0a}\x{0d}\x{0a}\x{0d}b
+ a\n\n\r\nb
+ 0: a\x{0a}\x{0a}\x{0d}\x{0a}b
+ ** Failers
+No match
+ a\n\n\n\rb
+No match
+ a\r
+No match
+
/ End of testinput 8 /
diff --git a/ucp.h b/ucp.h
index 1ca23c9..3a4179b 100644
--- a/ucp.h
+++ b/ucp.h
@@ -6,7 +6,9 @@
#define _UCP_H
/* This file contains definitions of the property values that are returned by
-the function _pcre_ucp_findprop(). */
+the function _pcre_ucp_findprop(). New values that are added for new releases
+of Unicode should always be at the end of each enum, for backwards
+compatibility. */
/* These are the general character categories. */
@@ -118,7 +120,12 @@ enum {
ucp_Tibetan,
ucp_Tifinagh,
ucp_Ugaritic,
- ucp_Yi
+ ucp_Yi,
+ ucp_Balinese, /* New for Unicode 5.0.0 */
+ ucp_Cuneiform, /* New for Unicode 5.0.0 */
+ ucp_Nko, /* New for Unicode 5.0.0 */
+ ucp_Phags_Pa, /* New for Unicode 5.0.0 */
+ ucp_Phoenician /* New for Unicode 5.0.0 */
};
#endif
diff --git a/ucpinternal.h b/ucpinternal.h
index 16dfbe9..811a373 100644
--- a/ucpinternal.h
+++ b/ucpinternal.h
@@ -2,6 +2,9 @@
* Unicode Property Table handler *
*************************************************/
+#ifndef _UCPINTERNAL_H
+#define _UCPINTERNAL_H
+
/* Internal header file defining the layout of the bits in each pair of 32-bit
words that form a data item in the table. */
@@ -84,4 +87,6 @@ When searching the data, proceed as follows:
(2).
*/
+#endif /* _UCPINTERNAL_H */
+
/* End of ucpinternal.h */
diff --git a/ucptable.c b/ucptable.c
index ae665b3..0b17906 100644
--- a/ucptable.c
+++ b/ucptable.c
@@ -1,5 +1,6 @@
/* This source module is automatically generated from the Unicode
-property table. See ucpinternal.h for a description of the layout. */
+property table. See ucpinternal.h for a description of the layout.
+This version was made from the Unicode 5.0.0 tables. */
static cnode ucp_table[] = {
{ 0x09800000, 0x0000001f },
@@ -298,7 +299,7 @@ static cnode ucp_table[] = {
{ 0x2100017d, 0x24000001 },
{ 0x2100017e, 0x1400ffff },
{ 0x2100017f, 0x1400fed4 },
- { 0x21000180, 0x14000000 },
+ { 0x21000180, 0x140000c3 },
{ 0x21000181, 0x240000d2 },
{ 0x21000182, 0x24000001 },
{ 0x21000183, 0x1400ffff },
@@ -475,13 +476,27 @@ static cnode ucp_table[] = {
{ 0x21000232, 0x24000001 },
{ 0x21000233, 0x1400ffff },
{ 0x21800234, 0x14000005 },
- { 0x2100023a, 0x24000000 },
+ { 0x2100023a, 0x24002a2b },
{ 0x2100023b, 0x24000001 },
{ 0x2100023c, 0x1400ffff },
{ 0x2100023d, 0x2400ff5d },
- { 0x2100023e, 0x24000000 },
+ { 0x2100023e, 0x24002a28 },
{ 0x2180023f, 0x14000001 },
- { 0x21000241, 0x24000053 },
+ { 0x21000241, 0x24000001 },
+ { 0x21000242, 0x1400ffff },
+ { 0x21000243, 0x2400ff3d },
+ { 0x21000244, 0x24000045 },
+ { 0x21000245, 0x24000047 },
+ { 0x21000246, 0x24000001 },
+ { 0x21000247, 0x1400ffff },
+ { 0x21000248, 0x24000001 },
+ { 0x21000249, 0x1400ffff },
+ { 0x2100024a, 0x24000001 },
+ { 0x2100024b, 0x1400ffff },
+ { 0x2100024c, 0x24000001 },
+ { 0x2100024d, 0x1400ffff },
+ { 0x2100024e, 0x24000001 },
+ { 0x2100024f, 0x1400ffff },
{ 0x21800250, 0x14000002 },
{ 0x21000253, 0x1400ff2e },
{ 0x21000254, 0x1400ff32 },
@@ -499,25 +514,30 @@ static cnode ucp_table[] = {
{ 0x21800264, 0x14000003 },
{ 0x21000268, 0x1400ff2f },
{ 0x21000269, 0x1400ff2d },
- { 0x2180026a, 0x14000004 },
+ { 0x2100026a, 0x14000000 },
+ { 0x2100026b, 0x140029f7 },
+ { 0x2180026c, 0x14000002 },
{ 0x2100026f, 0x1400ff2d },
{ 0x21800270, 0x14000001 },
{ 0x21000272, 0x1400ff2b },
{ 0x21800273, 0x14000001 },
{ 0x21000275, 0x1400ff2a },
- { 0x21800276, 0x14000009 },
+ { 0x21800276, 0x14000006 },
+ { 0x2100027d, 0x140029e7 },
+ { 0x2180027e, 0x14000001 },
{ 0x21000280, 0x1400ff26 },
{ 0x21800281, 0x14000001 },
{ 0x21000283, 0x1400ff26 },
{ 0x21800284, 0x14000003 },
{ 0x21000288, 0x1400ff26 },
- { 0x21000289, 0x14000000 },
+ { 0x21000289, 0x1400ffbb },
{ 0x2100028a, 0x1400ff27 },
{ 0x2100028b, 0x1400ff27 },
- { 0x2180028c, 0x14000005 },
+ { 0x2100028c, 0x1400ffb9 },
+ { 0x2180028d, 0x14000004 },
{ 0x21000292, 0x1400ff25 },
{ 0x21000293, 0x14000000 },
- { 0x21000294, 0x1400ffad },
+ { 0x21000294, 0x1c000000 },
{ 0x21800295, 0x1400001a },
{ 0x218002b0, 0x18000011 },
{ 0x098002c2, 0x60000003 },
@@ -532,6 +552,9 @@ static cnode ucp_table[] = {
{ 0x1b800346, 0x30000029 },
{ 0x13800374, 0x60000001 },
{ 0x1300037a, 0x18000000 },
+ { 0x1300037b, 0x14000082 },
+ { 0x1300037c, 0x14000082 },
+ { 0x1300037d, 0x14000082 },
{ 0x0900037e, 0x54000000 },
{ 0x13800384, 0x60000001 },
{ 0x13000386, 0x24000026 },
@@ -647,7 +670,9 @@ static cnode ucp_table[] = {
{ 0x130003fa, 0x24000001 },
{ 0x130003fb, 0x1400ffff },
{ 0x130003fc, 0x14000000 },
- { 0x138003fd, 0x24000002 },
+ { 0x130003fd, 0x2400ff7e },
+ { 0x130003fe, 0x2400ff7e },
+ { 0x130003ff, 0x2400ff7e },
{ 0x0c000400, 0x24000050 },
{ 0x0c000401, 0x24000050 },
{ 0x0c000402, 0x24000050 },
@@ -835,7 +860,7 @@ static cnode ucp_table[] = {
{ 0x0c0004bd, 0x1400ffff },
{ 0x0c0004be, 0x24000001 },
{ 0x0c0004bf, 0x1400ffff },
- { 0x0c0004c0, 0x24000000 },
+ { 0x0c0004c0, 0x2400000f },
{ 0x0c0004c1, 0x24000001 },
{ 0x0c0004c2, 0x1400ffff },
{ 0x0c0004c3, 0x24000001 },
@@ -850,6 +875,7 @@ static cnode ucp_table[] = {
{ 0x0c0004cc, 0x1400ffff },
{ 0x0c0004cd, 0x24000001 },
{ 0x0c0004ce, 0x1400ffff },
+ { 0x0c0004cf, 0x1400fff1 },
{ 0x0c0004d0, 0x24000001 },
{ 0x0c0004d1, 0x1400ffff },
{ 0x0c0004d2, 0x24000001 },
@@ -892,6 +918,12 @@ static cnode ucp_table[] = {
{ 0x0c0004f7, 0x1400ffff },
{ 0x0c0004f8, 0x24000001 },
{ 0x0c0004f9, 0x1400ffff },
+ { 0x0c0004fa, 0x24000001 },
+ { 0x0c0004fb, 0x1400ffff },
+ { 0x0c0004fc, 0x24000001 },
+ { 0x0c0004fd, 0x1400ffff },
+ { 0x0c0004fe, 0x24000001 },
+ { 0x0c0004ff, 0x1400ffff },
{ 0x0c000500, 0x24000001 },
{ 0x0c000501, 0x1400ffff },
{ 0x0c000502, 0x24000001 },
@@ -908,6 +940,10 @@ static cnode ucp_table[] = {
{ 0x0c00050d, 0x1400ffff },
{ 0x0c00050e, 0x24000001 },
{ 0x0c00050f, 0x1400ffff },
+ { 0x0c000510, 0x24000001 },
+ { 0x0c000511, 0x1400ffff },
+ { 0x0c000512, 0x24000001 },
+ { 0x0c000513, 0x1400ffff },
{ 0x01000531, 0x24000030 },
{ 0x01000532, 0x24000030 },
{ 0x01000533, 0x24000030 },
@@ -989,8 +1025,7 @@ static cnode ucp_table[] = {
{ 0x01000587, 0x14000000 },
{ 0x09000589, 0x54000000 },
{ 0x0100058a, 0x44000000 },
- { 0x19800591, 0x30000028 },
- { 0x198005bb, 0x30000002 },
+ { 0x19800591, 0x3000002c },
{ 0x190005be, 0x54000000 },
{ 0x190005bf, 0x30000000 },
{ 0x190005c0, 0x54000000 },
@@ -1043,6 +1078,13 @@ static cnode ucp_table[] = {
{ 0x37800780, 0x1c000025 },
{ 0x378007a6, 0x3000000a },
{ 0x370007b1, 0x1c000000 },
+ { 0x3f8007c0, 0x34000009 },
+ { 0x3f8007ca, 0x1c000020 },
+ { 0x3f8007eb, 0x30000008 },
+ { 0x3f8007f4, 0x18000001 },
+ { 0x3f0007f6, 0x68000000 },
+ { 0x3f8007f7, 0x54000002 },
+ { 0x3f0007fa, 0x18000000 },
{ 0x0e800901, 0x30000001 },
{ 0x0e000903, 0x28000000 },
{ 0x0e800904, 0x1c000035 },
@@ -1059,7 +1101,7 @@ static cnode ucp_table[] = {
{ 0x09800964, 0x54000001 },
{ 0x0e800966, 0x34000009 },
{ 0x09000970, 0x54000000 },
- { 0x0e00097d, 0x1c000000 },
+ { 0x0e80097b, 0x1c000004 },
{ 0x02000981, 0x30000000 },
{ 0x02800982, 0x28000001 },
{ 0x02800985, 0x1c000007 },
@@ -1203,7 +1245,9 @@ static cnode ucp_table[] = {
{ 0x1c800cd5, 0x28000001 },
{ 0x1c000cde, 0x1c000000 },
{ 0x1c800ce0, 0x1c000001 },
+ { 0x1c800ce2, 0x30000001 },
{ 0x1c800ce6, 0x34000009 },
+ { 0x1c800cf1, 0x68000001 },
{ 0x24800d02, 0x28000001 },
{ 0x24800d05, 0x1c000007 },
{ 0x24800d0e, 0x1c000002 },
@@ -1452,13 +1496,33 @@ static cnode ucp_table[] = {
{ 0x05801a17, 0x30000001 },
{ 0x05801a19, 0x28000002 },
{ 0x05801a1e, 0x54000001 },
+ { 0x3d801b00, 0x30000003 },
+ { 0x3d001b04, 0x28000000 },
+ { 0x3d801b05, 0x1c00002e },
+ { 0x3d001b34, 0x30000000 },
+ { 0x3d001b35, 0x28000000 },
+ { 0x3d801b36, 0x30000004 },
+ { 0x3d001b3b, 0x28000000 },
+ { 0x3d001b3c, 0x30000000 },
+ { 0x3d801b3d, 0x28000004 },
+ { 0x3d001b42, 0x30000000 },
+ { 0x3d801b43, 0x28000001 },
+ { 0x3d801b45, 0x1c000006 },
+ { 0x3d801b50, 0x34000009 },
+ { 0x3d801b5a, 0x54000006 },
+ { 0x3d801b61, 0x68000009 },
+ { 0x3d801b6b, 0x30000008 },
+ { 0x3d801b74, 0x68000008 },
{ 0x21801d00, 0x1400002b },
{ 0x21801d2c, 0x18000035 },
{ 0x21801d62, 0x14000015 },
{ 0x0c001d78, 0x18000000 },
- { 0x21801d79, 0x14000021 },
+ { 0x21801d79, 0x14000003 },
+ { 0x21001d7d, 0x14000ee6 },
+ { 0x21801d7e, 0x1400001c },
{ 0x21801d9b, 0x18000024 },
- { 0x1b801dc0, 0x30000003 },
+ { 0x1b801dc0, 0x3000000a },
+ { 0x1b801dfe, 0x30000001 },
{ 0x21001e00, 0x24000001 },
{ 0x21001e01, 0x1400ffff },
{ 0x21001e02, 0x24000001 },
@@ -1967,7 +2031,7 @@ static cnode ucp_table[] = {
{ 0x1b8020dd, 0x2c000003 },
{ 0x1b0020e1, 0x30000000 },
{ 0x1b8020e2, 0x2c000002 },
- { 0x1b8020e5, 0x30000006 },
+ { 0x1b8020e5, 0x3000000a },
{ 0x09802100, 0x68000001 },
{ 0x09002102, 0x24000000 },
{ 0x09802103, 0x68000003 },
@@ -1995,7 +2059,7 @@ static cnode ucp_table[] = {
{ 0x0900212e, 0x68000000 },
{ 0x0900212f, 0x14000000 },
{ 0x09802130, 0x24000001 },
- { 0x09002132, 0x68000000 },
+ { 0x21002132, 0x2400001c },
{ 0x09002133, 0x24000000 },
{ 0x09002134, 0x14000000 },
{ 0x09802135, 0x1c000003 },
@@ -2008,7 +2072,8 @@ static cnode ucp_table[] = {
{ 0x09802146, 0x14000003 },
{ 0x0900214a, 0x68000000 },
{ 0x0900214b, 0x64000000 },
- { 0x0900214c, 0x68000000 },
+ { 0x0980214c, 0x68000001 },
+ { 0x2100214e, 0x1400ffe4 },
{ 0x09802153, 0x3c00000c },
{ 0x09002160, 0x38000010 },
{ 0x09002161, 0x38000010 },
@@ -2042,7 +2107,9 @@ static cnode ucp_table[] = {
{ 0x0900217d, 0x3800fff0 },
{ 0x0900217e, 0x3800fff0 },
{ 0x0900217f, 0x3800fff0 },
- { 0x09802180, 0x38000003 },
+ { 0x09802180, 0x38000002 },
+ { 0x09002183, 0x24000001 },
+ { 0x21002184, 0x1400ffff },
{ 0x09802190, 0x64000004 },
{ 0x09802195, 0x68000004 },
{ 0x0980219a, 0x64000001 },
@@ -2073,10 +2140,9 @@ static cnode ucp_table[] = {
{ 0x0900237c, 0x64000000 },
{ 0x0980237d, 0x6800001d },
{ 0x0980239b, 0x64000018 },
- { 0x090023b4, 0x58000000 },
- { 0x090023b5, 0x48000000 },
- { 0x090023b6, 0x54000000 },
- { 0x098023b7, 0x68000024 },
+ { 0x098023b4, 0x68000027 },
+ { 0x098023dc, 0x64000005 },
+ { 0x098023e2, 0x68000005 },
{ 0x09802400, 0x68000026 },
{ 0x09802440, 0x6800000a },
{ 0x09802460, 0x3c00003b },
@@ -2143,7 +2209,7 @@ static cnode ucp_table[] = {
{ 0x09802600, 0x6800006e },
{ 0x0900266f, 0x64000000 },
{ 0x09802670, 0x6800002c },
- { 0x098026a0, 0x68000011 },
+ { 0x098026a0, 0x68000012 },
{ 0x09802701, 0x68000003 },
{ 0x09802706, 0x68000003 },
{ 0x0980270c, 0x6800001b },
@@ -2174,6 +2240,7 @@ static cnode ucp_table[] = {
{ 0x098027c0, 0x64000004 },
{ 0x090027c5, 0x58000000 },
{ 0x090027c6, 0x48000000 },
+ { 0x098027c7, 0x64000003 },
{ 0x098027d0, 0x64000015 },
{ 0x090027e6, 0x58000000 },
{ 0x090027e7, 0x48000000 },
@@ -2215,7 +2282,8 @@ static cnode ucp_table[] = {
{ 0x090029fc, 0x58000000 },
{ 0x090029fd, 0x48000000 },
{ 0x098029fe, 0x64000101 },
- { 0x09802b00, 0x68000013 },
+ { 0x09802b00, 0x6800001a },
+ { 0x09802b20, 0x68000003 },
{ 0x11002c00, 0x24000030 },
{ 0x11002c01, 0x24000030 },
{ 0x11002c02, 0x24000030 },
@@ -2310,6 +2378,23 @@ static cnode ucp_table[] = {
{ 0x11002c5c, 0x1400ffd0 },
{ 0x11002c5d, 0x1400ffd0 },
{ 0x11002c5e, 0x1400ffd0 },
+ { 0x21002c60, 0x24000001 },
+ { 0x21002c61, 0x1400ffff },
+ { 0x21002c62, 0x2400d609 },
+ { 0x21002c63, 0x2400f11a },
+ { 0x21002c64, 0x2400d619 },
+ { 0x21002c65, 0x1400d5d5 },
+ { 0x21002c66, 0x1400d5d8 },
+ { 0x21002c67, 0x24000001 },
+ { 0x21002c68, 0x1400ffff },
+ { 0x21002c69, 0x24000001 },
+ { 0x21002c6a, 0x1400ffff },
+ { 0x21002c6b, 0x24000001 },
+ { 0x21002c6c, 0x1400ffff },
+ { 0x21002c74, 0x14000000 },
+ { 0x21002c75, 0x24000001 },
+ { 0x21002c76, 0x1400ffff },
+ { 0x21002c77, 0x14000000 },
{ 0x0a002c80, 0x24000001 },
{ 0x0a002c81, 0x1400ffff },
{ 0x0a002c82, 0x24000001 },
@@ -2559,6 +2644,8 @@ static cnode ucp_table[] = {
{ 0x3c80a016, 0x1c000476 },
{ 0x3c80a490, 0x68000036 },
{ 0x0980a700, 0x60000016 },
+ { 0x0980a717, 0x18000003 },
+ { 0x0980a720, 0x60000001 },
{ 0x3080a800, 0x1c000001 },
{ 0x3000a802, 0x28000000 },
{ 0x3080a803, 0x1c000002 },
@@ -2570,6 +2657,8 @@ static cnode ucp_table[] = {
{ 0x3080a825, 0x30000001 },
{ 0x3000a827, 0x28000000 },
{ 0x3080a828, 0x68000003 },
+ { 0x4080a840, 0x1c000033 },
+ { 0x4080a874, 0x54000003 },
{ 0x1780ac00, 0x1c002ba3 },
{ 0x0980d800, 0x1000037f },
{ 0x0980db80, 0x1000007f },
@@ -2765,13 +2854,15 @@ static cnode ucp_table[] = {
{ 0x1301018a, 0x3c000000 },
{ 0x29810300, 0x1c00001e },
{ 0x29810320, 0x3c000003 },
- { 0x12810330, 0x1c000019 },
+ { 0x12810330, 0x1c000010 },
+ { 0x12010341, 0x38000000 },
+ { 0x12810342, 0x1c000007 },
{ 0x1201034a, 0x38000000 },
{ 0x3b810380, 0x1c00001d },
{ 0x3b01039f, 0x54000000 },
{ 0x2a8103a0, 0x1c000023 },
{ 0x2a8103c8, 0x1c000007 },
- { 0x2a0103d0, 0x68000000 },
+ { 0x2a0103d0, 0x54000000 },
{ 0x2a8103d1, 0x38000004 },
{ 0x0d010400, 0x24000028 },
{ 0x0d010401, 0x24000028 },
@@ -2861,6 +2952,9 @@ static cnode ucp_table[] = {
{ 0x0b810837, 0x1c000001 },
{ 0x0b01083c, 0x1c000000 },
{ 0x0b01083f, 0x1c000000 },
+ { 0x41810900, 0x1c000015 },
+ { 0x41810916, 0x3c000003 },
+ { 0x4101091f, 0x54000000 },
{ 0x1e010a00, 0x1c000000 },
{ 0x1e810a01, 0x30000002 },
{ 0x1e810a05, 0x30000001 },
@@ -2872,6 +2966,9 @@ static cnode ucp_table[] = {
{ 0x1e010a3f, 0x30000000 },
{ 0x1e810a40, 0x3c000007 },
{ 0x1e810a50, 0x54000008 },
+ { 0x3e812000, 0x1c00036e },
+ { 0x3e812400, 0x38000062 },
+ { 0x3e812470, 0x54000003 },
{ 0x0981d000, 0x680000f5 },
{ 0x0981d100, 0x68000026 },
{ 0x0981d12a, 0x6800003a },
@@ -2890,6 +2987,7 @@ static cnode ucp_table[] = {
{ 0x1381d242, 0x30000002 },
{ 0x1301d245, 0x68000000 },
{ 0x0981d300, 0x68000056 },
+ { 0x0981d360, 0x3c000011 },
{ 0x0981d400, 0x24000019 },
{ 0x0981d41a, 0x14000019 },
{ 0x0981d434, 0x24000019 },
@@ -2957,6 +3055,8 @@ static cnode ucp_table[] = {
{ 0x0981d7aa, 0x14000018 },
{ 0x0901d7c3, 0x64000000 },
{ 0x0981d7c4, 0x14000005 },
+ { 0x0901d7ca, 0x24000000 },
+ { 0x0901d7cb, 0x14000000 },
{ 0x0981d7ce, 0x34000031 },
{ 0x16820000, 0x1c00a6d6 },
{ 0x1682f800, 0x1c00021d },