tools/pcre/ChangeLog
author John Schoenick <john@pointysoftware.net>
Wed Jun 01 20:36:16 2011 -0400 (2011-06-01)
changeset 3292 f428ffc8a3fe
parent 2762 d2d467bf1b5a
child 3831 babd0eee3c5e
permissions -rw-r--r--
Fixed regression in FindEntityByClassname from bug 4899 (bug 4941, r=predcrab).
dvander@2762
     1
ChangeLog for PCRE
dvander@2762
     2
------------------
dvander@2762
     3
dvander@2762
     4
Version 7.9 11-Apr-09
dvander@2762
     5
---------------------
dvander@2762
     6
dvander@2762
     7
1.  When building with support for bzlib/zlib (pcregrep) and/or readline
dvander@2762
     8
    (pcretest), all targets were linked against these libraries. This included
dvander@2762
     9
    libpcre, libpcreposix, and libpcrecpp, even though they do not use these
dvander@2762
    10
    libraries. This caused unwanted dependencies to be created. This problem
dvander@2762
    11
    has been fixed, and now only pcregrep is linked with bzlib/zlib and only
dvander@2762
    12
    pcretest is linked with readline.
dvander@2762
    13
dvander@2762
    14
2.  The "typedef int BOOL" in pcre_internal.h that was included inside the
dvander@2762
    15
    "#ifndef FALSE" condition by an earlier change (probably 7.8/18) has been
dvander@2762
    16
    moved outside it again, because FALSE and TRUE are already defined in AIX,
dvander@2762
    17
    but BOOL is not.
dvander@2762
    18
dvander@2762
    19
3.  The pcre_config() function was treating the PCRE_MATCH_LIMIT and
dvander@2762
    20
    PCRE_MATCH_LIMIT_RECURSION values as ints, when they should be long ints.
dvander@2762
    21
dvander@2762
    22
4.  The pcregrep documentation said spaces were inserted as well as colons (or
dvander@2762
    23
    hyphens) following file names and line numbers when outputting matching
dvander@2762
    24
    lines. This is not true; no spaces are inserted. I have also clarified the
dvander@2762
    25
    wording for the --colour (or --color) option.
dvander@2762
    26
dvander@2762
    27
5.  In pcregrep, when --colour was used with -o, the list of matching strings
dvander@2762
    28
    was not coloured; this is different to GNU grep, so I have changed it to be
dvander@2762
    29
    the same.
dvander@2762
    30
dvander@2762
    31
6.  When --colo(u)r was used in pcregrep, only the first matching substring in
dvander@2762
    32
    each matching line was coloured. Now it goes on to look for further matches
dvander@2762
    33
    of any of the test patterns, which is the same behaviour as GNU grep.
dvander@2762
    34
dvander@2762
    35
7.  A pattern that could match an empty string could cause pcregrep to loop; it
dvander@2762
    36
    doesn't make sense to accept an empty string match in pcregrep, so I have
dvander@2762
    37
    locked it out (using PCRE's PCRE_NOTEMPTY option). By experiment, this
dvander@2762
    38
    seems to be how GNU grep behaves.
dvander@2762
    39
dvander@2762
    40
8.  The pattern (?(?=.*b)b|^) was incorrectly compiled as "match must be at
dvander@2762
    41
    start or after a newline", because the conditional assertion was not being
dvander@2762
    42
    correctly handled. The rule now is that both the assertion and what follows
dvander@2762
    43
    in the first alternative must satisfy the test.
dvander@2762
    44
dvander@2762
    45
9.  If auto-callout was enabled in a pattern with a conditional group whose
dvander@2762
    46
    condition was an assertion, PCRE could crash during matching, both with
dvander@2762
    47
    pcre_exec() and pcre_dfa_exec().
dvander@2762
    48
dvander@2762
    49
10. The PCRE_DOLLAR_ENDONLY option was not working when pcre_dfa_exec() was
dvander@2762
    50
    used for matching.
dvander@2762
    51
dvander@2762
    52
11. Unicode property support in character classes was not working for
dvander@2762
    53
    characters (bytes) greater than 127 when not in UTF-8 mode.
dvander@2762
    54
dvander@2762
    55
12. Added the -M command line option to pcretest.
dvander@2762
    56
dvander@2762
    57
14. Added the non-standard REG_NOTEMPTY option to the POSIX interface.
dvander@2762
    58
dvander@2762
    59
15. Added the PCRE_NO_START_OPTIMIZE match-time option.
dvander@2762
    60
dvander@2762
    61
16. Added comments and documentation about mis-use of no_arg in the C++
dvander@2762
    62
    wrapper.
dvander@2762
    63
dvander@2762
    64
17. Implemented support for UTF-8 encoding in EBCDIC environments, a patch
dvander@2762
    65
    from Martin Jerabek that uses macro names for all relevant character and
dvander@2762
    66
    string constants.
dvander@2762
    67
dvander@2762
    68
18. Added to pcre_internal.h two configuration checks: (a) If both EBCDIC and
dvander@2762
    69
    SUPPORT_UTF8 are set, give an error; (b) If SUPPORT_UCP is set without
dvander@2762
    70
    SUPPORT_UTF8, define SUPPORT_UTF8. The "configure" script handles both of
dvander@2762
    71
    these, but not everybody uses configure.
dvander@2762
    72
dvander@2762
    73
19. A conditional group that had only one branch was not being correctly
dvander@2762
    74
    recognized as an item that could match an empty string. This meant that an
dvander@2762
    75
    enclosing group might also not be so recognized, causing infinite looping
dvander@2762
    76
    (and probably a segfault) for patterns such as ^"((?(?=[a])[^"])|b)*"$
dvander@2762
    77
    with the subject "ab", where knowledge that the repeated group can match
dvander@2762
    78
    nothing is needed in order to break the loop.
dvander@2762
    79
dvander@2762
    80
20. If a pattern that was compiled with callouts was matched using pcre_dfa_
dvander@2762
    81
    exec(), but without supplying a callout function, matching went wrong.
dvander@2762
    82
dvander@2762
    83
21. If PCRE_ERROR_MATCHLIMIT occurred during a recursion, there was a memory
dvander@2762
    84
    leak if the size of the offset vector was greater than 30. When the vector
dvander@2762
    85
    is smaller, the saved offsets during recursion go onto a local stack
dvander@2762
    86
    vector, but for larger vectors malloc() is used. It was failing to free
dvander@2762
    87
    when the recursion yielded PCRE_ERROR_MATCH_LIMIT (or any other "abnormal"
dvander@2762
    88
    error, in fact).
dvander@2762
    89
dvander@2762
    90
22. There was a missing #ifdef SUPPORT_UTF8 round one of the variables in the
dvander@2762
    91
    heapframe that is used only when UTF-8 support is enabled. This caused no
dvander@2762
    92
    problem, but was untidy.
dvander@2762
    93
dvander@2762
    94
23. Steven Van Ingelgem's patch to CMakeLists.txt to change the name
dvander@2762
    95
    CMAKE_BINARY_DIR to PROJECT_BINARY_DIR so that it works when PCRE is
dvander@2762
    96
    included within another project.
dvander@2762
    97
dvander@2762
    98
24. Steven Van Ingelgem's patches to add more options to the CMake support,
dvander@2762
    99
    slightly modified by me:
dvander@2762
   100
dvander@2762
   101
      (a) PCRE_BUILD_TESTS can be set OFF not to build the tests, including
dvander@2762
   102
          not building pcregrep.
dvander@2762
   103
dvander@2762
   104
      (b) PCRE_BUILD_PCREGREP can be see OFF not to build pcregrep, but only
dvander@2762
   105
          if PCRE_BUILD_TESTS is also set OFF, because the tests use pcregrep.
dvander@2762
   106
dvander@2762
   107
25. Forward references, both numeric and by name, in patterns that made use of
dvander@2762
   108
    duplicate group numbers, could behave incorrectly or give incorrect errors,
dvander@2762
   109
    because when scanning forward to find the reference group, PCRE was not
dvander@2762
   110
    taking into account the duplicate group numbers. A pattern such as
dvander@2762
   111
    ^X(?3)(a)(?|(b)|(q))(Y) is an example.
dvander@2762
   112
dvander@2762
   113
26. Changed a few more instances of "const unsigned char *" to USPTR, making
dvander@2762
   114
    the feature of a custom pointer more persuasive (as requested by a user).
dvander@2762
   115
dvander@2762
   116
27. Wrapped the definitions of fileno and isatty for Windows, which appear in
dvander@2762
   117
    pcretest.c, inside #ifndefs, because it seems they are sometimes already
dvander@2762
   118
    pre-defined.
dvander@2762
   119
dvander@2762
   120
28. Added support for (*UTF8) at the start of a pattern.
dvander@2762
   121
dvander@2762
   122
29. Arrange for flags added by the "release type" setting in CMake to be shown
dvander@2762
   123
    in the configuration summary.
dvander@2762
   124
dvander@2762
   125
dvander@2762
   126
Version 7.8 05-Sep-08
dvander@2762
   127
---------------------
dvander@2762
   128
dvander@2762
   129
1.  Replaced UCP searching code with optimized version as implemented for Ad
dvander@2762
   130
    Muncher (http://www.admuncher.com/) by Peter Kankowski. This uses a two-
dvander@2762
   131
    stage table and inline lookup instead of a function, giving speed ups of 2
dvander@2762
   132
    to 5 times on some simple patterns that I tested. Permission was given to
dvander@2762
   133
    distribute the MultiStage2.py script that generates the tables (it's not in
dvander@2762
   134
    the tarball, but is in the Subversion repository).
dvander@2762
   135
dvander@2762
   136
2.  Updated the Unicode datatables to Unicode 5.1.0. This adds yet more
dvander@2762
   137
    scripts.
dvander@2762
   138
dvander@2762
   139
3.  Change 12 for 7.7 introduced a bug in pcre_study() when a pattern contained
dvander@2762
   140
    a group with a zero qualifier. The result of the study could be incorrect,
dvander@2762
   141
    or the function might crash, depending on the pattern.
dvander@2762
   142
dvander@2762
   143
4.  Caseless matching was not working for non-ASCII characters in back
dvander@2762
   144
    references. For example, /(\x{de})\1/8i was not matching \x{de}\x{fe}.
dvander@2762
   145
    It now works when Unicode Property Support is available.
dvander@2762
   146
dvander@2762
   147
5.  In pcretest, an escape such as \x{de} in the data was always generating
dvander@2762
   148
    a UTF-8 string, even in non-UTF-8 mode. Now it generates a single byte in
dvander@2762
   149
    non-UTF-8 mode. If the value is greater than 255, it gives a warning about
dvander@2762
   150
    truncation.
dvander@2762
   151
dvander@2762
   152
6.  Minor bugfix in pcrecpp.cc (change "" == ... to NULL == ...).
dvander@2762
   153
dvander@2762
   154
7.  Added two (int) casts to pcregrep when printing the difference of two
dvander@2762
   155
    pointers, in case they are 64-bit values.
dvander@2762
   156
dvander@2762
   157
8.  Added comments about Mac OS X stack usage to the pcrestack man page and to
dvander@2762
   158
    test 2 if it fails.
dvander@2762
   159
dvander@2762
   160
9.  Added PCRE_CALL_CONVENTION just before the names of all exported functions,
dvander@2762
   161
    and a #define of that name to empty if it is not externally set. This is to
dvander@2762
   162
    allow users of MSVC to set it if necessary.
dvander@2762
   163
dvander@2762
   164
10. The PCRE_EXP_DEFN macro which precedes exported functions was missing from
dvander@2762
   165
    the convenience functions in the pcre_get.c source file.
dvander@2762
   166
dvander@2762
   167
11. An option change at the start of a pattern that had top-level alternatives
dvander@2762
   168
    could cause overwriting and/or a crash. This command provoked a crash in
dvander@2762
   169
    some environments:
dvander@2762
   170
dvander@2762
   171
      printf "/(?i)[\xc3\xa9\xc3\xbd]|[\xc3\xa9\xc3\xbdA]/8\n" | pcretest
dvander@2762
   172
dvander@2762
   173
    This potential security problem was recorded as CVE-2008-2371.
dvander@2762
   174
dvander@2762
   175
12. For a pattern where the match had to start at the beginning or immediately
dvander@2762
   176
    after a newline (e.g /.*anything/ without the DOTALL flag), pcre_exec() and
dvander@2762
   177
    pcre_dfa_exec() could read past the end of the passed subject if there was
dvander@2762
   178
    no match. To help with detecting such bugs (e.g. with valgrind), I modified
dvander@2762
   179
    pcretest so that it places the subject at the end of its malloc-ed buffer.
dvander@2762
   180
dvander@2762
   181
13. The change to pcretest in 12 above threw up a couple more cases when pcre_
dvander@2762
   182
    exec() might read past the end of the data buffer in UTF-8 mode.
dvander@2762
   183
dvander@2762
   184
14. A similar bug to 7.3/2 existed when the PCRE_FIRSTLINE option was set and
dvander@2762
   185
    the data contained the byte 0x85 as part of a UTF-8 character within its
dvander@2762
   186
    first line. This applied both to normal and DFA matching.
dvander@2762
   187
dvander@2762
   188
15. Lazy qualifiers were not working in some cases in UTF-8 mode. For example,
dvander@2762
   189
    /^[^d]*?$/8 failed to match "abc".
dvander@2762
   190
dvander@2762
   191
16. Added a missing copyright notice to pcrecpp_internal.h.
dvander@2762
   192
dvander@2762
   193
17. Make it more clear in the documentation that values returned from
dvander@2762
   194
    pcre_exec() in ovector are byte offsets, not character counts.
dvander@2762
   195
dvander@2762
   196
18. Tidied a few places to stop certain compilers from issuing warnings.
dvander@2762
   197
dvander@2762
   198
19. Updated the Virtual Pascal + BCC files to compile the latest v7.7, as
dvander@2762
   199
    supplied by Stefan Weber. I made a further small update for 7.8 because
dvander@2762
   200
    there is a change of source arrangements: the pcre_searchfuncs.c module is
dvander@2762
   201
    replaced by pcre_ucd.c.
dvander@2762
   202
dvander@2762
   203
dvander@2762
   204
Version 7.7 07-May-08
dvander@2762
   205
---------------------
dvander@2762
   206
dvander@2762
   207
1.  Applied Craig's patch to sort out a long long problem: "If we can't convert
dvander@2762
   208
    a string to a long long, pretend we don't even have a long long." This is
dvander@2762
   209
    done by checking for the strtoq, strtoll, and _strtoi64 functions.
dvander@2762
   210
dvander@2762
   211
2.  Applied Craig's patch to pcrecpp.cc to restore ABI compatibility with
dvander@2762
   212
    pre-7.6 versions, which defined a global no_arg variable instead of putting
dvander@2762
   213
    it in the RE class. (See also #8 below.)
dvander@2762
   214
dvander@2762
   215
3.  Remove a line of dead code, identified by coverity and reported by Nuno
dvander@2762
   216
    Lopes.
dvander@2762
   217
dvander@2762
   218
4.  Fixed two related pcregrep bugs involving -r with --include or --exclude:
dvander@2762
   219
dvander@2762
   220
    (1) The include/exclude patterns were being applied to the whole pathnames
dvander@2762
   221
        of files, instead of just to the final components.
dvander@2762
   222
dvander@2762
   223
    (2) If there was more than one level of directory, the subdirectories were
dvander@2762
   224
        skipped unless they satisfied the include/exclude conditions. This is
dvander@2762
   225
        inconsistent with GNU grep (and could even be seen as contrary to the
dvander@2762
   226
        pcregrep specification - which I improved to make it absolutely clear).
dvander@2762
   227
        The action now is always to scan all levels of directory, and just
dvander@2762
   228
        apply the include/exclude patterns to regular files.
dvander@2762
   229
dvander@2762
   230
5.  Added the --include_dir and --exclude_dir patterns to pcregrep, and used
dvander@2762
   231
    --exclude_dir in the tests to avoid scanning .svn directories.
dvander@2762
   232
dvander@2762
   233
6.  Applied Craig's patch to the QuoteMeta function so that it escapes the
dvander@2762
   234
    NUL character as backslash + 0 rather than backslash + NUL, because PCRE
dvander@2762
   235
    doesn't support NULs in patterns.
dvander@2762
   236
dvander@2762
   237
7.  Added some missing "const"s to declarations of static tables in
dvander@2762
   238
    pcre_compile.c and pcre_dfa_exec.c.
dvander@2762
   239
dvander@2762
   240
8.  Applied Craig's patch to pcrecpp.cc to fix a problem in OS X that was
dvander@2762
   241
    caused by fix #2  above. (Subsequently also a second patch to fix the
dvander@2762
   242
    first patch. And a third patch - this was a messy problem.)
dvander@2762
   243
dvander@2762
   244
9.  Applied Craig's patch to remove the use of push_back().
dvander@2762
   245
dvander@2762
   246
10. Applied Alan Lehotsky's patch to add REG_STARTEND support to the POSIX
dvander@2762
   247
    matching function regexec().
dvander@2762
   248
dvander@2762
   249
11. Added support for the Oniguruma syntax \g<name>, \g<n>, \g'name', \g'n',
dvander@2762
   250
    which, however, unlike Perl's \g{...}, are subroutine calls, not back
dvander@2762
   251
    references. PCRE supports relative numbers with this syntax (I don't think
dvander@2762
   252
    Oniguruma does).
dvander@2762
   253
dvander@2762
   254
12. Previously, a group with a zero repeat such as (...){0} was completely
dvander@2762
   255
    omitted from the compiled regex. However, this means that if the group
dvander@2762
   256
    was called as a subroutine from elsewhere in the pattern, things went wrong
dvander@2762
   257
    (an internal error was given). Such groups are now left in the compiled
dvander@2762
   258
    pattern, with a new opcode that causes them to be skipped at execution
dvander@2762
   259
    time.
dvander@2762
   260
dvander@2762
   261
13. Added the PCRE_JAVASCRIPT_COMPAT option. This makes the following changes
dvander@2762
   262
    to the way PCRE behaves:
dvander@2762
   263
dvander@2762
   264
    (a) A lone ] character is dis-allowed (Perl treats it as data).
dvander@2762
   265
dvander@2762
   266
    (b) A back reference to an unmatched subpattern matches an empty string
dvander@2762
   267
        (Perl fails the current match path).
dvander@2762
   268
dvander@2762
   269
    (c) A data ] in a character class must be notated as \] because if the
dvander@2762
   270
        first data character in a class is ], it defines an empty class. (In
dvander@2762
   271
        Perl it is not possible to have an empty class.) The empty class []
dvander@2762
   272
        never matches; it forces failure and is equivalent to (*FAIL) or (?!).
dvander@2762
   273
        The negative empty class [^] matches any one character, independently
dvander@2762
   274
        of the DOTALL setting.
dvander@2762
   275
dvander@2762
   276
14. A pattern such as /(?2)[]a()b](abc)/ which had a forward reference to a
dvander@2762
   277
    non-existent subpattern following a character class starting with ']' and
dvander@2762
   278
    containing () gave an internal compiling error instead of "reference to
dvander@2762
   279
    non-existent subpattern". Fortunately, when the pattern did exist, the
dvander@2762
   280
    compiled code was correct. (When scanning forwards to check for the
dvander@2762
   281
    existencd of the subpattern, it was treating the data ']' as terminating
dvander@2762
   282
    the class, so got the count wrong. When actually compiling, the reference
dvander@2762
   283
    was subsequently set up correctly.)
dvander@2762
   284
dvander@2762
   285
15. The "always fail" assertion (?!) is optimzed to (*FAIL) by pcre_compile;
dvander@2762
   286
    it was being rejected as not supported by pcre_dfa_exec(), even though
dvander@2762
   287
    other assertions are supported. I have made pcre_dfa_exec() support
dvander@2762
   288
    (*FAIL).
dvander@2762
   289
dvander@2762
   290
16. The implementation of 13c above involved the invention of a new opcode,
dvander@2762
   291
    OP_ALLANY, which is like OP_ANY but doesn't check the /s flag. Since /s
dvander@2762
   292
    cannot be changed at match time, I realized I could make a small
dvander@2762
   293
    improvement to matching performance by compiling OP_ALLANY instead of
dvander@2762
   294
    OP_ANY for "." when DOTALL was set, and then removing the runtime tests
dvander@2762
   295
    on the OP_ANY path.
dvander@2762
   296
dvander@2762
   297
17. Compiling pcretest on Windows with readline support failed without the
dvander@2762
   298
    following two fixes: (1) Make the unistd.h include conditional on
dvander@2762
   299
    HAVE_UNISTD_H; (2) #define isatty and fileno as _isatty and _fileno.
dvander@2762
   300
dvander@2762
   301
18. Changed CMakeLists.txt and cmake/FindReadline.cmake to arrange for the
dvander@2762
   302
    ncurses library to be included for pcretest when ReadLine support is
dvander@2762
   303
    requested, but also to allow for it to be overridden. This patch came from
dvander@2762
   304
    Daniel Bergstr�m.
dvander@2762
   305
dvander@2762
   306
19. There was a typo in the file ucpinternal.h where f0_rangeflag was defined
dvander@2762
   307
    as 0x00f00000 instead of 0x00800000. Luckily, this would not have caused
dvander@2762
   308
    any errors with the current Unicode tables. Thanks to Peter Kankowski for
dvander@2762
   309
    spotting this.
dvander@2762
   310
dvander@2762
   311
dvander@2762
   312
Version 7.6 28-Jan-08
dvander@2762
   313
---------------------
dvander@2762
   314
dvander@2762
   315
1.  A character class containing a very large number of characters with
dvander@2762
   316
    codepoints greater than 255 (in UTF-8 mode, of course) caused a buffer
dvander@2762
   317
    overflow.
dvander@2762
   318
dvander@2762
   319
2.  Patch to cut out the "long long" test in pcrecpp_unittest when
dvander@2762
   320
    HAVE_LONG_LONG is not defined.
dvander@2762
   321
dvander@2762
   322
3.  Applied Christian Ehrlicher's patch to update the CMake build files to
dvander@2762
   323
    bring them up to date and include new features. This patch includes:
dvander@2762
   324
dvander@2762
   325
    - Fixed PH's badly added libz and libbz2 support.
dvander@2762
   326
    - Fixed a problem with static linking.
dvander@2762
   327
    - Added pcredemo. [But later removed - see 7 below.]
dvander@2762
   328
    - Fixed dftables problem and added an option.
dvander@2762
   329
    - Added a number of HAVE_XXX tests, including HAVE_WINDOWS_H and
dvander@2762
   330
        HAVE_LONG_LONG.
dvander@2762
   331
    - Added readline support for pcretest.
dvander@2762
   332
    - Added an listing of the option settings after cmake has run.
dvander@2762
   333
dvander@2762
   334
4.  A user submitted a patch to Makefile that makes it easy to create
dvander@2762
   335
    "pcre.dll" under mingw when using Configure/Make. I added stuff to
dvander@2762
   336
    Makefile.am that cause it to include this special target, without
dvander@2762
   337
    affecting anything else. Note that the same mingw target plus all
dvander@2762
   338
    the other distribution libraries and programs are now supported
dvander@2762
   339
    when configuring with CMake (see 6 below) instead of with
dvander@2762
   340
    Configure/Make.
dvander@2762
   341
dvander@2762
   342
5.  Applied Craig's patch that moves no_arg into the RE class in the C++ code.
dvander@2762
   343
    This is an attempt to solve the reported problem "pcrecpp::no_arg is not
dvander@2762
   344
    exported in the Windows port". It has not yet been confirmed that the patch
dvander@2762
   345
    solves the problem, but it does no harm.
dvander@2762
   346
dvander@2762
   347
6.  Applied Sheri's patch to CMakeLists.txt to add NON_STANDARD_LIB_PREFIX and
dvander@2762
   348
    NON_STANDARD_LIB_SUFFIX for dll names built with mingw when configured
dvander@2762
   349
    with CMake, and also correct the comment about stack recursion.
dvander@2762
   350
dvander@2762
   351
7.  Remove the automatic building of pcredemo from the ./configure system and
dvander@2762
   352
    from CMakeLists.txt. The whole idea of pcredemo.c is that it is an example
dvander@2762
   353
    of a program that users should build themselves after PCRE is installed, so
dvander@2762
   354
    building it automatically is not really right. What is more, it gave
dvander@2762
   355
    trouble in some build environments.
dvander@2762
   356
dvander@2762
   357
8.  Further tidies to CMakeLists.txt from Sheri and Christian.
dvander@2762
   358
dvander@2762
   359
dvander@2762
   360
Version 7.5 10-Jan-08
dvander@2762
   361
---------------------
dvander@2762
   362
dvander@2762
   363
1.  Applied a patch from Craig: "This patch makes it possible to 'ignore'
dvander@2762
   364
    values in parens when parsing an RE using the C++ wrapper."
dvander@2762
   365
dvander@2762
   366
2.  Negative specials like \S did not work in character classes in UTF-8 mode.
dvander@2762
   367
    Characters greater than 255 were excluded from the class instead of being
dvander@2762
   368
    included.
dvander@2762
   369
dvander@2762
   370
3.  The same bug as (2) above applied to negated POSIX classes such as
dvander@2762
   371
    [:^space:].
dvander@2762
   372
dvander@2762
   373
4.  PCRECPP_STATIC was referenced in pcrecpp_internal.h, but nowhere was it
dvander@2762
   374
    defined or documented. It seems to have been a typo for PCRE_STATIC, so
dvander@2762
   375
    I have changed it.
dvander@2762
   376
dvander@2762
   377
5.  The construct (?&) was not diagnosed as a syntax error (it referenced the
dvander@2762
   378
    first named subpattern) and a construct such as (?&a) would reference the
dvander@2762
   379
    first named subpattern whose name started with "a" (in other words, the
dvander@2762
   380
    length check was missing). Both these problems are fixed. "Subpattern name
dvander@2762
   381
    expected" is now given for (?&) (a zero-length name), and this patch also
dvander@2762
   382
    makes it give the same error for \k'' (previously it complained that that
dvander@2762
   383
    was a reference to a non-existent subpattern).
dvander@2762
   384
dvander@2762
   385
6.  The erroneous patterns (?+-a) and (?-+a) give different error messages;
dvander@2762
   386
    this is right because (?- can be followed by option settings as well as by
dvander@2762
   387
    digits. I have, however, made the messages clearer.
dvander@2762
   388
dvander@2762
   389
7.  Patterns such as (?(1)a|b) (a pattern that contains fewer subpatterns
dvander@2762
   390
    than the number used in the conditional) now cause a compile-time error.
dvander@2762
   391
    This is actually not compatible with Perl, which accepts such patterns, but
dvander@2762
   392
    treats the conditional as always being FALSE (as PCRE used to), but it
dvander@2762
   393
    seems to me that giving a diagnostic is better.
dvander@2762
   394
dvander@2762
   395
8.  Change "alphameric" to the more common word "alphanumeric" in comments
dvander@2762
   396
    and messages.
dvander@2762
   397
dvander@2762
   398
9.  Fix two occurrences of "backslash" in comments that should have been
dvander@2762
   399
    "backspace".
dvander@2762
   400
dvander@2762
   401
10. Remove two redundant lines of code that can never be obeyed (their function
dvander@2762
   402
    was moved elsewhere).
dvander@2762
   403
dvander@2762
   404
11. The program that makes PCRE's Unicode character property table had a bug
dvander@2762
   405
    which caused it to generate incorrect table entries for sequences of
dvander@2762
   406
    characters that have the same character type, but are in different scripts.
dvander@2762
   407
    It amalgamated them into a single range, with the script of the first of
dvander@2762
   408
    them. In other words, some characters were in the wrong script. There were
dvander@2762
   409
    thirteen such cases, affecting characters in the following ranges:
dvander@2762
   410
dvander@2762
   411
      U+002b0 - U+002c1
dvander@2762
   412
      U+0060c - U+0060d
dvander@2762
   413
      U+0061e - U+00612
dvander@2762
   414
      U+0064b - U+0065e
dvander@2762
   415
      U+0074d - U+0076d
dvander@2762
   416
      U+01800 - U+01805
dvander@2762
   417
      U+01d00 - U+01d77
dvander@2762
   418
      U+01d9b - U+01dbf
dvander@2762
   419
      U+0200b - U+0200f
dvander@2762
   420
      U+030fc - U+030fe
dvander@2762
   421
      U+03260 - U+0327f
dvander@2762
   422
      U+0fb46 - U+0fbb1
dvander@2762
   423
      U+10450 - U+1049d
dvander@2762
   424
dvander@2762
   425
12. The -o option (show only the matching part of a line) for pcregrep was not
dvander@2762
   426
    compatible with GNU grep in that, if there was more than one match in a
dvander@2762
   427
    line, it showed only the first of them. It now behaves in the same way as
dvander@2762
   428
    GNU grep.
dvander@2762
   429
dvander@2762
   430
13. If the -o and -v options were combined for pcregrep, it printed a blank
dvander@2762
   431
    line for every non-matching line. GNU grep prints nothing, and pcregrep now
dvander@2762
   432
    does the same. The return code can be used to tell if there were any
dvander@2762
   433
    non-matching lines.
dvander@2762
   434
dvander@2762
   435
14. Added --file-offsets and --line-offsets to pcregrep.
dvander@2762
   436
dvander@2762
   437
15. The pattern (?=something)(?R) was not being diagnosed as a potentially
dvander@2762
   438
    infinitely looping recursion. The bug was that positive lookaheads were not
dvander@2762
   439
    being skipped when checking for a possible empty match (negative lookaheads
dvander@2762
   440
    and both kinds of lookbehind were skipped).
dvander@2762
   441
dvander@2762
   442
16. Fixed two typos in the Windows-only code in pcregrep.c, and moved the
dvander@2762
   443
    inclusion of <windows.h> to before rather than after the definition of
dvander@2762
   444
    INVALID_FILE_ATTRIBUTES (patch from David Byron).
dvander@2762
   445
dvander@2762
   446
17. Specifying a possessive quantifier with a specific limit for a Unicode
dvander@2762
   447
    character property caused pcre_compile() to compile bad code, which led at
dvander@2762
   448
    runtime to PCRE_ERROR_INTERNAL (-14). Examples of patterns that caused this
dvander@2762
   449
    are: /\p{Zl}{2,3}+/8 and /\p{Cc}{2}+/8. It was the possessive "+" that
dvander@2762
   450
    caused the error; without that there was no problem.
dvander@2762
   451
dvander@2762
   452
18. Added --enable-pcregrep-libz and --enable-pcregrep-libbz2.
dvander@2762
   453
dvander@2762
   454
19. Added --enable-pcretest-libreadline.
dvander@2762
   455
dvander@2762
   456
20. In pcrecpp.cc, the variable 'count' was incremented twice in
dvander@2762
   457
    RE::GlobalReplace(). As a result, the number of replacements returned was
dvander@2762
   458
    double what it should be. I removed one of the increments, but Craig sent a
dvander@2762
   459
    later patch that removed the other one (the right fix) and added unit tests
dvander@2762
   460
    that check the return values (which was not done before).
dvander@2762
   461
dvander@2762
   462
21. Several CMake things:
dvander@2762
   463
dvander@2762
   464
    (1) Arranged that, when cmake is used on Unix, the libraries end up with
dvander@2762
   465
        the names libpcre and libpcreposix, not just pcre and pcreposix.
dvander@2762
   466
dvander@2762
   467
    (2) The above change means that pcretest and pcregrep are now correctly
dvander@2762
   468
        linked with the newly-built libraries, not previously installed ones.
dvander@2762
   469
dvander@2762
   470
    (3) Added PCRE_SUPPORT_LIBREADLINE, PCRE_SUPPORT_LIBZ, PCRE_SUPPORT_LIBBZ2.
dvander@2762
   471
dvander@2762
   472
22. In UTF-8 mode, with newline set to "any", a pattern such as .*a.*=.b.*
dvander@2762
   473
    crashed when matching a string such as a\x{2029}b (note that \x{2029} is a
dvander@2762
   474
    UTF-8 newline character). The key issue is that the pattern starts .*;
dvander@2762
   475
    this means that the match must be either at the beginning, or after a
dvander@2762
   476
    newline. The bug was in the code for advancing after a failed match and
dvander@2762
   477
    checking that the new position followed a newline. It was not taking
dvander@2762
   478
    account of UTF-8 characters correctly.
dvander@2762
   479
dvander@2762
   480
23. PCRE was behaving differently from Perl in the way it recognized POSIX
dvander@2762
   481
    character classes. PCRE was not treating the sequence [:...:] as a
dvander@2762
   482
    character class unless the ... were all letters. Perl, however, seems to
dvander@2762
   483
    allow any characters between [: and :], though of course it rejects as
dvander@2762
   484
    unknown any "names" that contain non-letters, because all the known class
dvander@2762
   485
    names consist only of letters. Thus, Perl gives an error for [[:1234:]],
dvander@2762
   486
    for example, whereas PCRE did not - it did not recognize a POSIX character
dvander@2762
   487
    class. This seemed a bit dangerous, so the code has been changed to be
dvander@2762
   488
    closer to Perl. The behaviour is not identical to Perl, because PCRE will
dvander@2762
   489
    diagnose an unknown class for, for example, [[:l\ower:]] where Perl will
dvander@2762
   490
    treat it as [[:lower:]]. However, PCRE does now give "unknown" errors where
dvander@2762
   491
    Perl does, and where it didn't before.
dvander@2762
   492
dvander@2762
   493
24. Rewrite so as to remove the single use of %n from pcregrep because in some
dvander@2762
   494
    Windows environments %n is disabled by default.
dvander@2762
   495
dvander@2762
   496
dvander@2762
   497
Version 7.4 21-Sep-07
dvander@2762
   498
---------------------
dvander@2762
   499
dvander@2762
   500
1.  Change 7.3/28 was implemented for classes by looking at the bitmap. This
dvander@2762
   501
    means that a class such as [\s] counted as "explicit reference to CR or
dvander@2762
   502
    LF". That isn't really right - the whole point of the change was to try to
dvander@2762
   503
    help when there was an actual mention of one of the two characters. So now
dvander@2762
   504
    the change happens only if \r or \n (or a literal CR or LF) character is
dvander@2762
   505
    encountered.
dvander@2762
   506
dvander@2762
   507
2.  The 32-bit options word was also used for 6 internal flags, but the numbers
dvander@2762
   508
    of both had grown to the point where there were only 3 bits left.
dvander@2762
   509
    Fortunately, there was spare space in the data structure, and so I have
dvander@2762
   510
    moved the internal flags into a new 16-bit field to free up more option
dvander@2762
   511
    bits.
dvander@2762
   512
dvander@2762
   513
3.  The appearance of (?J) at the start of a pattern set the DUPNAMES option,
dvander@2762
   514
    but did not set the internal JCHANGED flag - either of these is enough to
dvander@2762
   515
    control the way the "get" function works - but the PCRE_INFO_JCHANGED
dvander@2762
   516
    facility is supposed to tell if (?J) was ever used, so now (?J) at the
dvander@2762
   517
    start sets both bits.
dvander@2762
   518
dvander@2762
   519
4.  Added options (at build time, compile time, exec time) to change \R from
dvander@2762
   520
    matching any Unicode line ending sequence to just matching CR, LF, or CRLF.
dvander@2762
   521
dvander@2762
   522
5.  doc/pcresyntax.html was missing from the distribution.
dvander@2762
   523
dvander@2762
   524
6.  Put back the definition of PCRE_ERROR_NULLWSLIMIT, for backward
dvander@2762
   525
    compatibility, even though it is no longer used.
dvander@2762
   526
dvander@2762
   527
7.  Added macro for snprintf to pcrecpp_unittest.cc and also for strtoll and
dvander@2762
   528
    strtoull to pcrecpp.cc to select the available functions in WIN32 when the
dvander@2762
   529
    windows.h file is present (where different names are used). [This was
dvander@2762
   530
    reversed later after testing - see 16 below.]
dvander@2762
   531
dvander@2762
   532
8.  Changed all #include <config.h> to #include "config.h". There were also
dvander@2762
   533
    some further <pcre.h> cases that I changed to "pcre.h".
dvander@2762
   534
dvander@2762
   535
9.  When pcregrep was used with the --colour option, it missed the line ending
dvander@2762
   536
    sequence off the lines that it output.
dvander@2762
   537
dvander@2762
   538
10. It was pointed out to me that arrays of string pointers cause lots of
dvander@2762
   539
    relocations when a shared library is dynamically loaded. A technique of
dvander@2762
   540
    using a single long string with a table of offsets can drastically reduce
dvander@2762
   541
    these. I have refactored PCRE in four places to do this. The result is
dvander@2762
   542
    dramatic:
dvander@2762
   543
dvander@2762
   544
      Originally:                          290
dvander@2762
   545
      After changing UCP table:            187
dvander@2762
   546
      After changing error message table:   43
dvander@2762
   547
      After changing table of "verbs"       36
dvander@2762
   548
      After changing table of Posix names   22
dvander@2762
   549
dvander@2762
   550
    Thanks to the folks working on Gregex for glib for this insight.
dvander@2762
   551
dvander@2762
   552
11. --disable-stack-for-recursion caused compiling to fail unless -enable-
dvander@2762
   553
    unicode-properties was also set.
dvander@2762
   554
dvander@2762
   555
12. Updated the tests so that they work when \R is defaulted to ANYCRLF.
dvander@2762
   556
dvander@2762
   557
13. Added checks for ANY and ANYCRLF to pcrecpp.cc where it previously
dvander@2762
   558
    checked only for CRLF.
dvander@2762
   559
dvander@2762
   560
14. Added casts to pcretest.c to avoid compiler warnings.
dvander@2762
   561
dvander@2762
   562
15. Added Craig's patch to various pcrecpp modules to avoid compiler warnings.
dvander@2762
   563
dvander@2762
   564
16. Added Craig's patch to remove the WINDOWS_H tests, that were not working,
dvander@2762
   565
    and instead check for _strtoi64 explicitly, and avoid the use of snprintf()
dvander@2762
   566
    entirely. This removes changes made in 7 above.
dvander@2762
   567
dvander@2762
   568
17. The CMake files have been updated, and there is now more information about
dvander@2762
   569
    building with CMake in the NON-UNIX-USE document.
dvander@2762
   570
dvander@2762
   571
dvander@2762
   572
Version 7.3 28-Aug-07
dvander@2762
   573
---------------------
dvander@2762
   574
dvander@2762
   575
 1. In the rejigging of the build system that eventually resulted in 7.1, the
dvander@2762
   576
    line "#include <pcre.h>" was included in pcre_internal.h. The use of angle
dvander@2762
   577
    brackets there is not right, since it causes compilers to look for an
dvander@2762
   578
    installed pcre.h, not the version that is in the source that is being
dvander@2762
   579
    compiled (which of course may be different). I have changed it back to:
dvander@2762
   580
dvander@2762
   581
      #include "pcre.h"
dvander@2762
   582
dvander@2762
   583
    I have a vague recollection that the change was concerned with compiling in
dvander@2762
   584
    different directories, but in the new build system, that is taken care of
dvander@2762
   585
    by the VPATH setting the Makefile.
dvander@2762
   586
dvander@2762
   587
 2. The pattern .*$ when run in not-DOTALL UTF-8 mode with newline=any failed
dvander@2762
   588
    when the subject happened to end in the byte 0x85 (e.g. if the last
dvander@2762
   589
    character was \x{1ec5}). *Character* 0x85 is one of the "any" newline
dvander@2762
   590
    characters but of course it shouldn't be taken as a newline when it is part
dvander@2762
   591
    of another character. The bug was that, for an unlimited repeat of . in
dvander@2762
   592
    not-DOTALL UTF-8 mode, PCRE was advancing by bytes rather than by
dvander@2762
   593
    characters when looking for a newline.
dvander@2762
   594
dvander@2762
   595
 3. A small performance improvement in the DOTALL UTF-8 mode .* case.
dvander@2762
   596
dvander@2762
   597
 4. Debugging: adjusted the names of opcodes for different kinds of parentheses
dvander@2762
   598
    in debug output.
dvander@2762
   599
dvander@2762
   600
 5. Arrange to use "%I64d" instead of "%lld" and "%I64u" instead of "%llu" for
dvander@2762
   601
    long printing in the pcrecpp unittest when running under MinGW.
dvander@2762
   602
dvander@2762
   603
 6. ESC_K was left out of the EBCDIC table.
dvander@2762
   604
dvander@2762
   605
 7. Change 7.0/38 introduced a new limit on the number of nested non-capturing
dvander@2762
   606
    parentheses; I made it 1000, which seemed large enough. Unfortunately, the
dvander@2762
   607
    limit also applies to "virtual nesting" when a pattern is recursive, and in
dvander@2762
   608
    this case 1000 isn't so big. I have been able to remove this limit at the
dvander@2762
   609
    expense of backing off one optimization in certain circumstances. Normally,
dvander@2762
   610
    when pcre_exec() would call its internal match() function recursively and
dvander@2762
   611
    immediately return the result unconditionally, it uses a "tail recursion"
dvander@2762
   612
    feature to save stack. However, when a subpattern that can match an empty
dvander@2762
   613
    string has an unlimited repetition quantifier, it no longer makes this
dvander@2762
   614
    optimization. That gives it a stack frame in which to save the data for
dvander@2762
   615
    checking that an empty string has been matched. Previously this was taken
dvander@2762
   616
    from the 1000-entry workspace that had been reserved. So now there is no
dvander@2762
   617
    explicit limit, but more stack is used.
dvander@2762
   618
dvander@2762
   619
 8. Applied Daniel's patches to solve problems with the import/export magic
dvander@2762
   620
    syntax that is required for Windows, and which was going wrong for the
dvander@2762
   621
    pcreposix and pcrecpp parts of the library. These were overlooked when this
dvander@2762
   622
    problem was solved for the main library.
dvander@2762
   623
dvander@2762
   624
 9. There were some crude static tests to avoid integer overflow when computing
dvander@2762
   625
    the size of patterns that contain repeated groups with explicit upper
dvander@2762
   626
    limits. As the maximum quantifier is 65535, the maximum group length was
dvander@2762
   627
    set at 30,000 so that the product of these two numbers did not overflow a
dvander@2762
   628
    32-bit integer. However, it turns out that people want to use groups that
dvander@2762
   629
    are longer than 30,000 bytes (though not repeat them that many times).
dvander@2762
   630
    Change 7.0/17 (the refactoring of the way the pattern size is computed) has
dvander@2762
   631
    made it possible to implement the integer overflow checks in a much more
dvander@2762
   632
    dynamic way, which I have now done. The artificial limitation on group
dvander@2762
   633
    length has been removed - we now have only the limit on the total length of
dvander@2762
   634
    the compiled pattern, which depends on the LINK_SIZE setting.
dvander@2762
   635
dvander@2762
   636
10. Fixed a bug in the documentation for get/copy named substring when
dvander@2762
   637
    duplicate names are permitted. If none of the named substrings are set, the
dvander@2762
   638
    functions return PCRE_ERROR_NOSUBSTRING (7); the doc said they returned an
dvander@2762
   639
    empty string.
dvander@2762
   640
dvander@2762
   641
11. Because Perl interprets \Q...\E at a high level, and ignores orphan \E
dvander@2762
   642
    instances, patterns such as [\Q\E] or [\E] or even [^\E] cause an error,
dvander@2762
   643
    because the ] is interpreted as the first data character and the
dvander@2762
   644
    terminating ] is not found. PCRE has been made compatible with Perl in this
dvander@2762
   645
    regard. Previously, it interpreted [\Q\E] as an empty class, and [\E] could
dvander@2762
   646
    cause memory overwriting.
dvander@2762
   647
dvander@2762
   648
10. Like Perl, PCRE automatically breaks an unlimited repeat after an empty
dvander@2762
   649
    string has been matched (to stop an infinite loop). It was not recognizing
dvander@2762
   650
    a conditional subpattern that could match an empty string if that
dvander@2762
   651
    subpattern was within another subpattern. For example, it looped when
dvander@2762
   652
    trying to match  (((?(1)X|))*)  but it was OK with  ((?(1)X|)*)  where the
dvander@2762
   653
    condition was not nested. This bug has been fixed.
dvander@2762
   654
dvander@2762
   655
12. A pattern like \X?\d or \P{L}?\d in non-UTF-8 mode could cause a backtrack
dvander@2762
   656
    past the start of the subject in the presence of bytes with the top bit
dvander@2762
   657
    set, for example "\x8aBCD".
dvander@2762
   658
dvander@2762
   659
13. Added Perl 5.10 experimental backtracking controls (*FAIL), (*F), (*PRUNE),
dvander@2762
   660
    (*SKIP), (*THEN), (*COMMIT), and (*ACCEPT).
dvander@2762
   661
dvander@2762
   662
14. Optimized (?!) to (*FAIL).
dvander@2762
   663
dvander@2762
   664
15. Updated the test for a valid UTF-8 string to conform to the later RFC 3629.
dvander@2762
   665
    This restricts code points to be within the range 0 to 0x10FFFF, excluding
dvander@2762
   666
    the "low surrogate" sequence 0xD800 to 0xDFFF. Previously, PCRE allowed the
dvander@2762
   667
    full range 0 to 0x7FFFFFFF, as defined by RFC 2279. Internally, it still
dvander@2762
   668
    does: it's just the validity check that is more restrictive.
dvander@2762
   669
dvander@2762
   670
16. Inserted checks for integer overflows during escape sequence (backslash)
dvander@2762
   671
    processing, and also fixed erroneous offset values for syntax errors during
dvander@2762
   672
    backslash processing.
dvander@2762
   673
dvander@2762
   674
17. Fixed another case of looking too far back in non-UTF-8 mode (cf 12 above)
dvander@2762
   675
    for patterns like [\PPP\x8a]{1,}\x80 with the subject "A\x80".
dvander@2762
   676
dvander@2762
   677
18. An unterminated class in a pattern like (?1)\c[ with a "forward reference"
dvander@2762
   678
    caused an overrun.
dvander@2762
   679
dvander@2762
   680
19. A pattern like (?:[\PPa*]*){8,} which had an "extended class" (one with
dvander@2762
   681
    something other than just ASCII characters) inside a group that had an
dvander@2762
   682
    unlimited repeat caused a loop at compile time (while checking to see
dvander@2762
   683
    whether the group could match an empty string).
dvander@2762
   684
dvander@2762
   685
20. Debugging a pattern containing \p or \P could cause a crash. For example,
dvander@2762
   686
    [\P{Any}] did so. (Error in the code for printing property names.)
dvander@2762
   687
dvander@2762
   688
21. An orphan \E inside a character class could cause a crash.
dvander@2762
   689
dvander@2762
   690
22. A repeated capturing bracket such as (A)? could cause a wild memory
dvander@2762
   691
    reference during compilation.
dvander@2762
   692
dvander@2762
   693
23. There are several functions in pcre_compile() that scan along a compiled
dvander@2762
   694
    expression for various reasons (e.g. to see if it's fixed length for look
dvander@2762
   695
    behind). There were bugs in these functions when a repeated \p or \P was
dvander@2762
   696
    present in the pattern. These operators have additional parameters compared
dvander@2762
   697
    with \d, etc, and these were not being taken into account when moving along
dvander@2762
   698
    the compiled data. Specifically:
dvander@2762
   699
dvander@2762
   700
    (a) A item such as \p{Yi}{3} in a lookbehind was not treated as fixed
dvander@2762
   701
        length.
dvander@2762
   702
dvander@2762
   703
    (b) An item such as \pL+ within a repeated group could cause crashes or
dvander@2762
   704
        loops.
dvander@2762
   705
dvander@2762
   706
    (c) A pattern such as \p{Yi}+(\P{Yi}+)(?1) could give an incorrect
dvander@2762
   707
        "reference to non-existent subpattern" error.
dvander@2762
   708
dvander@2762
   709
    (d) A pattern like (\P{Yi}{2}\277)? could loop at compile time.
dvander@2762
   710
dvander@2762
   711
24. A repeated \S or \W in UTF-8 mode could give wrong answers when multibyte
dvander@2762
   712
    characters were involved (for example /\S{2}/8g with "A\x{a3}BC").
dvander@2762
   713
dvander@2762
   714
25. Using pcregrep in multiline, inverted mode (-Mv) caused it to loop.
dvander@2762
   715
dvander@2762
   716
26. Patterns such as [\P{Yi}A] which include \p or \P and just one other
dvander@2762
   717
    character were causing crashes (broken optimization).
dvander@2762
   718
dvander@2762
   719
27. Patterns such as (\P{Yi}*\277)* (group with possible zero repeat containing
dvander@2762
   720
    \p or \P) caused a compile-time loop.
dvander@2762
   721
dvander@2762
   722
28. More problems have arisen in unanchored patterns when CRLF is a valid line
dvander@2762
   723
    break. For example, the unstudied pattern [\r\n]A does not match the string
dvander@2762
   724
    "\r\nA" because change 7.0/46 below moves the current point on by two
dvander@2762
   725
    characters after failing to match at the start. However, the pattern \nA
dvander@2762
   726
    *does* match, because it doesn't start till \n, and if [\r\n]A is studied,
dvander@2762
   727
    the same is true. There doesn't seem any very clean way out of this, but
dvander@2762
   728
    what I have chosen to do makes the common cases work: PCRE now takes note
dvander@2762
   729
    of whether there can be an explicit match for \r or \n anywhere in the
dvander@2762
   730
    pattern, and if so, 7.0/46 no longer applies. As part of this change,
dvander@2762
   731
    there's a new PCRE_INFO_HASCRORLF option for finding out whether a compiled
dvander@2762
   732
    pattern has explicit CR or LF references.
dvander@2762
   733
dvander@2762
   734
29. Added (*CR) etc for changing newline setting at start of pattern.
dvander@2762
   735
dvander@2762
   736
dvander@2762
   737
Version 7.2 19-Jun-07
dvander@2762
   738
---------------------
dvander@2762
   739
dvander@2762
   740
 1. If the fr_FR locale cannot be found for test 3, try the "french" locale,
dvander@2762
   741
    which is apparently normally available under Windows.
dvander@2762
   742
dvander@2762
   743
 2. Re-jig the pcregrep tests with different newline settings in an attempt
dvander@2762
   744
    to make them independent of the local environment's newline setting.
dvander@2762
   745
dvander@2762
   746
 3. Add code to configure.ac to remove -g from the CFLAGS default settings.
dvander@2762
   747
dvander@2762
   748
 4. Some of the "internals" tests were previously cut out when the link size
dvander@2762
   749
    was not 2, because the output contained actual offsets. The recent new
dvander@2762
   750
    "Z" feature of pcretest means that these can be cut out, making the tests
dvander@2762
   751
    usable with all link sizes.
dvander@2762
   752
dvander@2762
   753
 5. Implemented Stan Switzer's goto replacement for longjmp() when not using
dvander@2762
   754
    stack recursion. This gives a massive performance boost under BSD, but just
dvander@2762
   755
    a small improvement under Linux. However, it saves one field in the frame
dvander@2762
   756
    in all cases.
dvander@2762
   757
dvander@2762
   758
 6. Added more features from the forthcoming Perl 5.10:
dvander@2762
   759
dvander@2762
   760
    (a) (?-n) (where n is a string of digits) is a relative subroutine or
dvander@2762
   761
        recursion call. It refers to the nth most recently opened parentheses.
dvander@2762
   762
dvander@2762
   763
    (b) (?+n) is also a relative subroutine call; it refers to the nth next
dvander@2762
   764
        to be opened parentheses.
dvander@2762
   765
dvander@2762
   766
    (c) Conditions that refer to capturing parentheses can be specified
dvander@2762
   767
        relatively, for example, (?(-2)... or (?(+3)...
dvander@2762
   768
dvander@2762
   769
    (d) \K resets the start of the current match so that everything before
dvander@2762
   770
        is not part of it.
dvander@2762
   771
dvander@2762
   772
    (e) \k{name} is synonymous with \k<name> and \k'name' (.NET compatible).
dvander@2762
   773
dvander@2762
   774
    (f) \g{name} is another synonym - part of Perl 5.10's unification of
dvander@2762
   775
        reference syntax.
dvander@2762
   776
dvander@2762
   777
    (g) (?| introduces a group in which the numbering of parentheses in each
dvander@2762
   778
        alternative starts with the same number.
dvander@2762
   779
dvander@2762
   780
    (h) \h, \H, \v, and \V match horizontal and vertical whitespace.
dvander@2762
   781
dvander@2762
   782
 7. Added two new calls to pcre_fullinfo(): PCRE_INFO_OKPARTIAL and
dvander@2762
   783
    PCRE_INFO_JCHANGED.
dvander@2762
   784
dvander@2762
   785
 8. A pattern such as  (.*(.)?)*  caused pcre_exec() to fail by either not
dvander@2762
   786
    terminating or by crashing. Diagnosed by Viktor Griph; it was in the code
dvander@2762
   787
    for detecting groups that can match an empty string.
dvander@2762
   788
dvander@2762
   789
 9. A pattern with a very large number of alternatives (more than several
dvander@2762
   790
    hundred) was running out of internal workspace during the pre-compile
dvander@2762
   791
    phase, where pcre_compile() figures out how much memory will be needed. A
dvander@2762
   792
    bit of new cunning has reduced the workspace needed for groups with
dvander@2762
   793
    alternatives. The 1000-alternative test pattern now uses 12 bytes of
dvander@2762
   794
    workspace instead of running out of the 4096 that are available.
dvander@2762
   795
dvander@2762
   796
10. Inserted some missing (unsigned int) casts to get rid of compiler warnings.
dvander@2762
   797
dvander@2762
   798
11. Applied patch from Google to remove an optimization that didn't quite work.
dvander@2762
   799
    The report of the bug said:
dvander@2762
   800
dvander@2762
   801
      pcrecpp::RE("a*").FullMatch("aaa") matches, while
dvander@2762
   802
      pcrecpp::RE("a*?").FullMatch("aaa") does not, and
dvander@2762
   803
      pcrecpp::RE("a*?\\z").FullMatch("aaa") does again.
dvander@2762
   804
dvander@2762
   805
12. If \p or \P was used in non-UTF-8 mode on a character greater than 127
dvander@2762
   806
    it matched the wrong number of bytes.
dvander@2762
   807
dvander@2762
   808
dvander@2762
   809
Version 7.1 24-Apr-07
dvander@2762
   810
---------------------
dvander@2762
   811
dvander@2762
   812
 1. Applied Bob Rossi and Daniel G's patches to convert the build system to one
dvander@2762
   813
    that is more "standard", making use of automake and other Autotools. There
dvander@2762
   814
    is some re-arrangement of the files and adjustment of comments consequent
dvander@2762
   815
    on this.
dvander@2762
   816
dvander@2762
   817
 2. Part of the patch fixed a problem with the pcregrep tests. The test of -r
dvander@2762
   818
    for recursive directory scanning broke on some systems because the files
dvander@2762
   819
    are not scanned in any specific order and on different systems the order
dvander@2762
   820
    was different. A call to "sort" has been inserted into RunGrepTest for the
dvander@2762
   821
    approprate test as a short-term fix. In the longer term there may be an
dvander@2762
   822
    alternative.
dvander@2762
   823
dvander@2762
   824
 3. I had an email from Eric Raymond about problems translating some of PCRE's
dvander@2762
   825
    man pages to HTML (despite the fact that I distribute HTML pages, some
dvander@2762
   826
    people do their own conversions for various reasons). The problems
dvander@2762
   827
    concerned the use of low-level troff macros .br and .in. I have therefore
dvander@2762
   828
    removed all such uses from the man pages (some were redundant, some could
dvander@2762
   829
    be replaced by .nf/.fi pairs). The 132html script that I use to generate
dvander@2762
   830
    HTML has been updated to handle .nf/.fi and to complain if it encounters
dvander@2762
   831
    .br or .in.
dvander@2762
   832
dvander@2762
   833
 4. Updated comments in configure.ac that get placed in config.h.in and also
dvander@2762
   834
    arranged for config.h to be included in the distribution, with the name
dvander@2762
   835
    config.h.generic, for the benefit of those who have to compile without
dvander@2762
   836
    Autotools (compare pcre.h, which is now distributed as pcre.h.generic).
dvander@2762
   837
dvander@2762
   838
 5. Updated the support (such as it is) for Virtual Pascal, thanks to Stefan
dvander@2762
   839
    Weber: (1) pcre_internal.h was missing some function renames; (2) updated
dvander@2762
   840
    makevp.bat for the current PCRE, using the additional files
dvander@2762
   841
    makevp_c.txt, makevp_l.txt, and pcregexp.pas.
dvander@2762
   842
dvander@2762
   843
 6. A Windows user reported a minor discrepancy with test 2, which turned out
dvander@2762
   844
    to be caused by a trailing space on an input line that had got lost in his
dvander@2762
   845
    copy. The trailing space was an accident, so I've just removed it.
dvander@2762
   846
dvander@2762
   847
 7. Add -Wl,-R... flags in pcre-config.in for *BSD* systems, as I'm told
dvander@2762
   848
    that is needed.
dvander@2762
   849
dvander@2762
   850
 8. Mark ucp_table (in ucptable.h) and ucp_gentype (in pcre_ucp_searchfuncs.c)
dvander@2762
   851
    as "const" (a) because they are and (b) because it helps the PHP
dvander@2762
   852
    maintainers who have recently made a script to detect big data structures
dvander@2762
   853
    in the php code that should be moved to the .rodata section. I remembered
dvander@2762
   854
    to update Builducptable as well, so it won't revert if ucptable.h is ever
dvander@2762
   855
    re-created.
dvander@2762
   856
dvander@2762
   857
 9. Added some extra #ifdef SUPPORT_UTF8 conditionals into pcretest.c,
dvander@2762
   858
    pcre_printint.src, pcre_compile.c, pcre_study.c, and pcre_tables.c, in
dvander@2762
   859
    order to be able to cut out the UTF-8 tables in the latter when UTF-8
dvander@2762
   860
    support is not required. This saves 1.5-2K of code, which is important in
dvander@2762
   861
    some applications.
dvander@2762
   862
dvander@2762
   863
    Later: more #ifdefs are needed in pcre_ord2utf8.c and pcre_valid_utf8.c
dvander@2762
   864
    so as not to refer to the tables, even though these functions will never be
dvander@2762
   865
    called when UTF-8 support is disabled. Otherwise there are problems with a
dvander@2762
   866
    shared library.
dvander@2762
   867
dvander@2762
   868
10. Fixed two bugs in the emulated memmove() function in pcre_internal.h:
dvander@2762
   869
dvander@2762
   870
    (a) It was defining its arguments as char * instead of void *.
dvander@2762
   871
dvander@2762
   872
    (b) It was assuming that all moves were upwards in memory; this was true
dvander@2762
   873
        a long time ago when I wrote it, but is no longer the case.
dvander@2762
   874
dvander@2762
   875
    The emulated memove() is provided for those environments that have neither
dvander@2762
   876
    memmove() nor bcopy(). I didn't think anyone used it these days, but that
dvander@2762
   877
    is clearly not the case, as these two bugs were recently reported.
dvander@2762
   878
dvander@2762
   879
11. The script PrepareRelease is now distributed: it calls 132html, CleanTxt,
dvander@2762
   880
    and Detrail to create the HTML documentation, the .txt form of the man
dvander@2762
   881
    pages, and it removes trailing spaces from listed files. It also creates
dvander@2762
   882
    pcre.h.generic and config.h.generic from pcre.h and config.h. In the latter
dvander@2762
   883
    case, it wraps all the #defines with #ifndefs. This script should be run
dvander@2762
   884
    before "make dist".
dvander@2762
   885
dvander@2762
   886
12. Fixed two fairly obscure bugs concerned with quantified caseless matching
dvander@2762
   887
    with Unicode property support.
dvander@2762
   888
dvander@2762
   889
    (a) For a maximizing quantifier, if the two different cases of the
dvander@2762
   890
        character were of different lengths in their UTF-8 codings (there are
dvander@2762
   891
        some cases like this - I found 11), and the matching function had to
dvander@2762
   892
        back up over a mixture of the two cases, it incorrectly assumed they
dvander@2762
   893
        were both the same length.
dvander@2762
   894
dvander@2762
   895
    (b) When PCRE was configured to use the heap rather than the stack for
dvander@2762
   896
        recursion during matching, it was not correctly preserving the data for
dvander@2762
   897
        the other case of a UTF-8 character when checking ahead for a match
dvander@2762
   898
        while processing a minimizing repeat. If the check also involved
dvander@2762
   899
        matching a wide character, but failed, corruption could cause an
dvander@2762
   900
        erroneous result when trying to check for a repeat of the original
dvander@2762
   901
        character.
dvander@2762
   902
dvander@2762
   903
13. Some tidying changes to the testing mechanism:
dvander@2762
   904
dvander@2762
   905
    (a) The RunTest script now detects the internal link size and whether there
dvander@2762
   906
        is UTF-8 and UCP support by running ./pcretest -C instead of relying on
dvander@2762
   907
        values substituted by "configure". (The RunGrepTest script already did
dvander@2762
   908
        this for UTF-8.) The configure.ac script no longer substitutes the
dvander@2762
   909
        relevant variables.
dvander@2762
   910
dvander@2762
   911
    (b) The debugging options /B and /D in pcretest show the compiled bytecode
dvander@2762
   912
        with length and offset values. This means that the output is different
dvander@2762
   913
        for different internal link sizes. Test 2 is skipped for link sizes
dvander@2762
   914
        other than 2 because of this, bypassing the problem. Unfortunately,
dvander@2762
   915
        there was also a test in test 3 (the locale tests) that used /B and
dvander@2762
   916
        failed for link sizes other than 2. Rather than cut the whole test out,
dvander@2762
   917
        I have added a new /Z option to pcretest that replaces the length and
dvander@2762
   918
        offset values with spaces. This is now used to make test 3 independent
dvander@2762
   919
        of link size. (Test 2 will be tidied up later.)
dvander@2762
   920
dvander@2762
   921
14. If erroroffset was passed as NULL to pcre_compile, it provoked a
dvander@2762
   922
    segmentation fault instead of returning the appropriate error message.
dvander@2762
   923
dvander@2762
   924
15. In multiline mode when the newline sequence was set to "any", the pattern
dvander@2762
   925
    ^$ would give a match between the \r and \n of a subject such as "A\r\nB".
dvander@2762
   926
    This doesn't seem right; it now treats the CRLF combination as the line
dvander@2762
   927
    ending, and so does not match in that case. It's only a pattern such as ^$
dvander@2762
   928
    that would hit this one: something like ^ABC$ would have failed after \r
dvander@2762
   929
    and then tried again after \r\n.
dvander@2762
   930
dvander@2762
   931
16. Changed the comparison command for RunGrepTest from "diff -u" to "diff -ub"
dvander@2762
   932
    in an attempt to make files that differ only in their line terminators
dvander@2762
   933
    compare equal. This works on Linux.
dvander@2762
   934
dvander@2762
   935
17. Under certain error circumstances pcregrep might try to free random memory
dvander@2762
   936
    as it exited. This is now fixed, thanks to valgrind.
dvander@2762
   937
dvander@2762
   938
19. In pcretest, if the pattern /(?m)^$/g<any> was matched against the string
dvander@2762
   939
    "abc\r\n\r\n", it found an unwanted second match after the second \r. This
dvander@2762
   940
    was because its rules for how to advance for /g after matching an empty
dvander@2762
   941
    string at the end of a line did not allow for this case. They now check for
dvander@2762
   942
    it specially.
dvander@2762
   943
dvander@2762
   944
20. pcretest is supposed to handle patterns and data of any length, by
dvander@2762
   945
    extending its buffers when necessary. It was getting this wrong when the
dvander@2762
   946
    buffer for a data line had to be extended.
dvander@2762
   947
dvander@2762
   948
21. Added PCRE_NEWLINE_ANYCRLF which is like ANY, but matches only CR, LF, or
dvander@2762
   949
    CRLF as a newline sequence.
dvander@2762
   950
dvander@2762
   951
22. Code for handling Unicode properties in pcre_dfa_exec() wasn't being cut
dvander@2762
   952
    out by #ifdef SUPPORT_UCP. This did no harm, as it could never be used, but
dvander@2762
   953
    I have nevertheless tidied it up.
dvander@2762
   954
dvander@2762
   955
23. Added some casts to kill warnings from HP-UX ia64 compiler.
dvander@2762
   956
dvander@2762
   957
24. Added a man page for pcre-config.
dvander@2762
   958
dvander@2762
   959
dvander@2762
   960
Version 7.0 19-Dec-06
dvander@2762
   961
---------------------
dvander@2762
   962
dvander@2762
   963
 1. Fixed a signed/unsigned compiler warning in pcre_compile.c, shown up by
dvander@2762
   964
    moving to gcc 4.1.1.
dvander@2762
   965
dvander@2762
   966
 2. The -S option for pcretest uses setrlimit(); I had omitted to #include
dvander@2762
   967
    sys/time.h, which is documented as needed for this function. It doesn't
dvander@2762
   968
    seem to matter on Linux, but it showed up on some releases of OS X.
dvander@2762
   969
dvander@2762
   970
 3. It seems that there are systems where bytes whose values are greater than
dvander@2762
   971
    127 match isprint() in the "C" locale. The "C" locale should be the
dvander@2762
   972
    default when a C program starts up. In most systems, only ASCII printing
dvander@2762
   973
    characters match isprint(). This difference caused the output from pcretest
dvander@2762
   974
    to vary, making some of the tests fail. I have changed pcretest so that:
dvander@2762
   975
dvander@2762
   976
    (a) When it is outputting text in the compiled version of a pattern, bytes
dvander@2762
   977
        other than 32-126 are always shown as hex escapes.
dvander@2762
   978
dvander@2762
   979
    (b) When it is outputting text that is a matched part of a subject string,
dvander@2762
   980
        it does the same, unless a different locale has been set for the match
dvander@2762
   981
        (using the /L modifier). In this case, it uses isprint() to decide.
dvander@2762
   982
dvander@2762
   983
 4. Fixed a major bug that caused incorrect computation of the amount of memory
dvander@2762
   984
    required for a compiled pattern when options that changed within the
dvander@2762
   985
    pattern affected the logic of the preliminary scan that determines the
dvander@2762
   986
    length. The relevant options are -x, and -i in UTF-8 mode. The result was
dvander@2762
   987
    that the computed length was too small. The symptoms of this bug were
dvander@2762
   988
    either the PCRE error "internal error: code overflow" from pcre_compile(),
dvander@2762
   989
    or a glibc crash with a message such as "pcretest: free(): invalid next
dvander@2762
   990
    size (fast)". Examples of patterns that provoked this bug (shown in
dvander@2762
   991
    pcretest format) are:
dvander@2762
   992
dvander@2762
   993
      /(?-x: )/x
dvander@2762
   994
      /(?x)(?-x: \s*#\s*)/
dvander@2762
   995
      /((?i)[\x{c0}])/8
dvander@2762
   996
      /(?i:[\x{c0}])/8
dvander@2762
   997
dvander@2762
   998
    HOWEVER: Change 17 below makes this fix obsolete as the memory computation
dvander@2762
   999
    is now done differently.
dvander@2762
  1000
dvander@2762
  1001
 5. Applied patches from Google to: (a) add a QuoteMeta function to the C++
dvander@2762
  1002
    wrapper classes; (b) implement a new function in the C++ scanner that is
dvander@2762
  1003
    more efficient than the old way of doing things because it avoids levels of
dvander@2762
  1004
    recursion in the regex matching; (c) add a paragraph to the documentation
dvander@2762
  1005
    for the FullMatch() function.
dvander@2762
  1006
dvander@2762
  1007
 6. The escape sequence \n was being treated as whatever was defined as
dvander@2762
  1008
    "newline". Not only was this contrary to the documentation, which states
dvander@2762
  1009
    that \n is character 10 (hex 0A), but it also went horribly wrong when
dvander@2762
  1010
    "newline" was defined as CRLF. This has been fixed.
dvander@2762
  1011
dvander@2762
  1012
 7. In pcre_dfa_exec.c the value of an unsigned integer (the variable called c)
dvander@2762
  1013
    was being set to -1 for the "end of line" case (supposedly a value that no
dvander@2762
  1014
    character can have). Though this value is never used (the check for end of
dvander@2762
  1015
    line is "zero bytes in current character"), it caused compiler complaints.
dvander@2762
  1016
    I've changed it to 0xffffffff.
dvander@2762
  1017
dvander@2762
  1018
 8. In pcre_version.c, the version string was being built by a sequence of
dvander@2762
  1019
    C macros that, in the event of PCRE_PRERELEASE being defined as an empty
dvander@2762
  1020
    string (as it is for production releases) called a macro with an empty
dvander@2762
  1021
    argument. The C standard says the result of this is undefined. The gcc
dvander@2762
  1022
    compiler treats it as an empty string (which was what was wanted) but it is
dvander@2762
  1023
    reported that Visual C gives an error. The source has been hacked around to
dvander@2762
  1024
    avoid this problem.
dvander@2762
  1025
dvander@2762
  1026
 9. On the advice of a Windows user, included <io.h> and <fcntl.h> in Windows
dvander@2762
  1027
    builds of pcretest, and changed the call to _setmode() to use _O_BINARY
dvander@2762
  1028
    instead of 0x8000. Made all the #ifdefs test both _WIN32 and WIN32 (not all
dvander@2762
  1029
    of them did).
dvander@2762
  1030
dvander@2762
  1031
10. Originally, pcretest opened its input and output without "b"; then I was
dvander@2762
  1032
    told that "b" was needed in some environments, so it was added for release
dvander@2762
  1033
    5.0 to both the input and output. (It makes no difference on Unix-like
dvander@2762
  1034
    systems.) Later I was told that it is wrong for the input on Windows. I've
dvander@2762
  1035
    now abstracted the modes into two macros, to make it easier to fiddle with
dvander@2762
  1036
    them, and removed "b" from the input mode under Windows.
dvander@2762
  1037
dvander@2762
  1038
11. Added pkgconfig support for the C++ wrapper library, libpcrecpp.
dvander@2762
  1039
dvander@2762
  1040
12. Added -help and --help to pcretest as an official way of being reminded
dvander@2762
  1041
    of the options.
dvander@2762
  1042
dvander@2762
  1043
13. Removed some redundant semicolons after macro calls in pcrecpparg.h.in
dvander@2762
  1044
    and pcrecpp.cc because they annoy compilers at high warning levels.
dvander@2762
  1045
dvander@2762
  1046
14. A bit of tidying/refactoring in pcre_exec.c in the main bumpalong loop.
dvander@2762
  1047
dvander@2762
  1048
15. Fixed an occurrence of == in configure.ac that should have been = (shell
dvander@2762
  1049
    scripts are not C programs :-) and which was not noticed because it works
dvander@2762
  1050
    on Linux.
dvander@2762
  1051
dvander@2762
  1052
16. pcretest is supposed to handle any length of pattern and data line (as one
dvander@2762
  1053
    line or as a continued sequence of lines) by extending its input buffer if
dvander@2762
  1054
    necessary. This feature was broken for very long pattern lines, leading to
dvander@2762
  1055
    a string of junk being passed to pcre_compile() if the pattern was longer
dvander@2762
  1056
    than about 50K.
dvander@2762
  1057
dvander@2762
  1058
17. I have done a major re-factoring of the way pcre_compile() computes the
dvander@2762
  1059
    amount of memory needed for a compiled pattern. Previously, there was code
dvander@2762
  1060
    that made a preliminary scan of the pattern in order to do this. That was
dvander@2762
  1061
    OK when PCRE was new, but as the facilities have expanded, it has become
dvander@2762
  1062
    harder and harder to keep it in step with the real compile phase, and there
dvander@2762
  1063
    have been a number of bugs (see for example, 4 above). I have now found a
dvander@2762
  1064
    cunning way of running the real compile function in a "fake" mode that
dvander@2762
  1065
    enables it to compute how much memory it would need, while actually only
dvander@2762
  1066
    ever using a few hundred bytes of working memory and without too many
dvander@2762
  1067
    tests of the mode. This should make future maintenance and development
dvander@2762
  1068
    easier. A side effect of this work is that the limit of 200 on the nesting
dvander@2762
  1069
    depth of parentheses has been removed (though this was never a serious
dvander@2762
  1070
    limitation, I suspect). However, there is a downside: pcre_compile() now
dvander@2762
  1071
    runs more slowly than before (30% or more, depending on the pattern). I
dvander@2762
  1072
    hope this isn't a big issue. There is no effect on runtime performance.
dvander@2762
  1073
dvander@2762
  1074
18. Fixed a minor bug in pcretest: if a pattern line was not terminated by a
dvander@2762
  1075
    newline (only possible for the last line of a file) and it was a
dvander@2762
  1076
    pattern that set a locale (followed by /Lsomething), pcretest crashed.
dvander@2762
  1077
dvander@2762
  1078
19. Added additional timing features to pcretest. (1) The -tm option now times
dvander@2762
  1079
    matching only, not compiling. (2) Both -t and -tm can be followed, as a
dvander@2762
  1080
    separate command line item, by a number that specifies the number of
dvander@2762
  1081
    repeats to use when timing. The default is 50000; this gives better
dvander@2762
  1082
    precision, but takes uncomfortably long for very large patterns.
dvander@2762
  1083
dvander@2762
  1084
20. Extended pcre_study() to be more clever in cases where a branch of a
dvander@2762
  1085
    subpattern has no definite first character. For example, (a*|b*)[cd] would
dvander@2762
  1086
    previously give no result from pcre_study(). Now it recognizes that the
dvander@2762
  1087
    first character must be a, b, c, or d.
dvander@2762
  1088
dvander@2762
  1089
21. There was an incorrect error "recursive call could loop indefinitely" if
dvander@2762
  1090
    a subpattern (or the entire pattern) that was being tested for matching an
dvander@2762
  1091
    empty string contained only one non-empty item after a nested subpattern.
dvander@2762
  1092
    For example, the pattern (?>\x{100}*)\d(?R) provoked this error
dvander@2762
  1093
    incorrectly, because the \d was being skipped in the check.
dvander@2762
  1094
dvander@2762
  1095
22. The pcretest program now has a new pattern option /B and a command line
dvander@2762
  1096
    option -b, which is equivalent to adding /B to every pattern. This causes
dvander@2762
  1097
    it to show the compiled bytecode, without the additional information that
dvander@2762
  1098
    -d shows. The effect of -d is now the same as -b with -i (and similarly, /D
dvander@2762
  1099
    is the same as /B/I).
dvander@2762
  1100
dvander@2762
  1101
23. A new optimization is now able automatically to treat some sequences such
dvander@2762
  1102
    as a*b as a*+b. More specifically, if something simple (such as a character
dvander@2762
  1103
    or a simple class like \d) has an unlimited quantifier, and is followed by
dvander@2762
  1104
    something that cannot possibly match the quantified thing, the quantifier
dvander@2762
  1105
    is automatically "possessified".
dvander@2762
  1106
dvander@2762
  1107
24. A recursive reference to a subpattern whose number was greater than 39
dvander@2762
  1108
    went wrong under certain circumstances in UTF-8 mode. This bug could also
dvander@2762
  1109
    have affected the operation of pcre_study().
dvander@2762
  1110
dvander@2762
  1111
25. Realized that a little bit of performance could be had by replacing
dvander@2762
  1112
    (c & 0xc0) == 0xc0 with c >= 0xc0 when processing UTF-8 characters.
dvander@2762
  1113
dvander@2762
  1114
26. Timing data from pcretest is now shown to 4 decimal places instead of 3.
dvander@2762
  1115
dvander@2762
  1116
27. Possessive quantifiers such as a++ were previously implemented by turning
dvander@2762
  1117
    them into atomic groups such as ($>a+). Now they have their own opcodes,
dvander@2762
  1118
    which improves performance. This includes the automatically created ones
dvander@2762
  1119
    from 23 above.
dvander@2762
  1120
dvander@2762
  1121
28. A pattern such as (?=(\w+))\1: which simulates an atomic group using a
dvander@2762
  1122
    lookahead was broken if it was not anchored. PCRE was mistakenly expecting
dvander@2762
  1123
    the first matched character to be a colon. This applied both to named and
dvander@2762
  1124
    numbered groups.
dvander@2762
  1125
dvander@2762
  1126
29. The ucpinternal.h header file was missing its idempotency #ifdef.
dvander@2762
  1127
dvander@2762
  1128
30. I was sent a "project" file called libpcre.a.dev which I understand makes
dvander@2762
  1129
    building PCRE on Windows easier, so I have included it in the distribution.
dvander@2762
  1130
dvander@2762
  1131
31. There is now a check in pcretest against a ridiculously large number being
dvander@2762
  1132
    returned by pcre_exec() or pcre_dfa_exec(). If this happens in a /g or /G
dvander@2762
  1133
    loop, the loop is abandoned.
dvander@2762
  1134
dvander@2762
  1135
32. Forward references to subpatterns in conditions such as (?(2)...) where
dvander@2762
  1136
    subpattern 2 is defined later cause pcre_compile() to search forwards in
dvander@2762
  1137
    the pattern for the relevant set of parentheses. This search went wrong
dvander@2762
  1138
    when there were unescaped parentheses in a character class, parentheses
dvander@2762
  1139
    escaped with \Q...\E, or parentheses in a #-comment in /x mode.
dvander@2762
  1140
dvander@2762
  1141
33. "Subroutine" calls and backreferences were previously restricted to
dvander@2762
  1142
    referencing subpatterns earlier in the regex. This restriction has now
dvander@2762
  1143
    been removed.
dvander@2762
  1144
dvander@2762
  1145
34. Added a number of extra features that are going to be in Perl 5.10. On the
dvander@2762
  1146
    whole, these are just syntactic alternatives for features that PCRE had
dvander@2762
  1147
    previously implemented using the Python syntax or my own invention. The
dvander@2762
  1148
    other formats are all retained for compatibility.
dvander@2762
  1149
dvander@2762
  1150
    (a) Named groups can now be defined as (?<name>...) or (?'name'...) as well
dvander@2762
  1151
        as (?P<name>...). The new forms, as well as being in Perl 5.10, are
dvander@2762
  1152
        also .NET compatible.
dvander@2762
  1153
dvander@2762
  1154
    (b) A recursion or subroutine call to a named group can now be defined as
dvander@2762
  1155
        (?&name) as well as (?P>name).
dvander@2762
  1156
dvander@2762
  1157
    (c) A backreference to a named group can now be defined as \k<name> or
dvander@2762
  1158
        \k'name' as well as (?P=name). The new forms, as well as being in Perl
dvander@2762
  1159
        5.10, are also .NET compatible.
dvander@2762
  1160
dvander@2762
  1161
    (d) A conditional reference to a named group can now use the syntax
dvander@2762
  1162
        (?(<name>) or (?('name') as well as (?(name).
dvander@2762
  1163
dvander@2762
  1164
    (e) A "conditional group" of the form (?(DEFINE)...) can be used to define
dvander@2762
  1165
        groups (named and numbered) that are never evaluated inline, but can be
dvander@2762
  1166
        called as "subroutines" from elsewhere. In effect, the DEFINE condition
dvander@2762
  1167
        is always false. There may be only one alternative in such a group.
dvander@2762
  1168
dvander@2762
  1169
    (f) A test for recursion can be given as (?(R1).. or (?(R&name)... as well
dvander@2762
  1170
        as the simple (?(R). The condition is true only if the most recent
dvander@2762
  1171
        recursion is that of the given number or name. It does not search out
dvander@2762
  1172
        through the entire recursion stack.
dvander@2762
  1173
dvander@2762
  1174
    (g) The escape \gN or \g{N} has been added, where N is a positive or
dvander@2762
  1175
        negative number, specifying an absolute or relative reference.
dvander@2762
  1176
dvander@2762
  1177
35. Tidied to get rid of some further signed/unsigned compiler warnings and
dvander@2762
  1178
    some "unreachable code" warnings.
dvander@2762
  1179
dvander@2762
  1180
36. Updated the Unicode property tables to Unicode version 5.0.0. Amongst other
dvander@2762
  1181
    things, this adds five new scripts.
dvander@2762
  1182
dvander@2762
  1183
37. Perl ignores orphaned \E escapes completely. PCRE now does the same.
dvander@2762
  1184
    There were also incompatibilities regarding the handling of \Q..\E inside
dvander@2762
  1185
    character classes, for example with patterns like [\Qa\E-\Qz\E] where the
dvander@2762
  1186
    hyphen was adjacent to \Q or \E. I hope I've cleared all this up now.
dvander@2762
  1187
dvander@2762
  1188
38. Like Perl, PCRE detects when an indefinitely repeated parenthesized group
dvander@2762
  1189
    matches an empty string, and forcibly breaks the loop. There were bugs in
dvander@2762
  1190
    this code in non-simple cases. For a pattern such as  ^(a()*)*  matched
dvander@2762
  1191
    against  aaaa  the result was just "a" rather than "aaaa", for example. Two
dvander@2762
  1192
    separate and independent bugs (that affected different cases) have been
dvander@2762
  1193
    fixed.
dvander@2762
  1194
dvander@2762
  1195
39. Refactored the code to abolish the use of different opcodes for small
dvander@2762
  1196
    capturing bracket numbers. This is a tidy that I avoided doing when I
dvander@2762
  1197
    removed the limit on the number of capturing brackets for 3.5 back in 2001.
dvander@2762
  1198
    The new approach is not only tidier, it makes it possible to reduce the
dvander@2762
  1199
    memory needed to fix the previous bug (38).
dvander@2762
  1200
dvander@2762
  1201
40. Implemented PCRE_NEWLINE_ANY to recognize any of the Unicode newline
dvander@2762
  1202
    sequences (http://unicode.org/unicode/reports/tr18/) as "newline" when
dvander@2762
  1203
    processing dot, circumflex, or dollar metacharacters, or #-comments in /x
dvander@2762
  1204
    mode.
dvander@2762
  1205
dvander@2762
  1206
41. Add \R to match any Unicode newline sequence, as suggested in the Unicode
dvander@2762
  1207
    report.
dvander@2762
  1208
dvander@2762
  1209
42. Applied patch, originally from Ari Pollak, modified by Google, to allow
dvander@2762
  1210
    copy construction and assignment in the C++ wrapper.
dvander@2762
  1211
dvander@2762
  1212
43. Updated pcregrep to support "--newline=any". In the process, I fixed a
dvander@2762
  1213
    couple of bugs that could have given wrong results in the "--newline=crlf"
dvander@2762
  1214
    case.
dvander@2762
  1215
dvander@2762
  1216
44. Added a number of casts and did some reorganization of signed/unsigned int
dvander@2762
  1217
    variables following suggestions from Dair Grant. Also renamed the variable
dvander@2762
  1218
    "this" as "item" because it is a C++ keyword.
dvander@2762
  1219
dvander@2762
  1220
45. Arranged for dftables to add
dvander@2762
  1221
dvander@2762
  1222
      #include "pcre_internal.h"
dvander@2762
  1223
dvander@2762
  1224
    to pcre_chartables.c because without it, gcc 4.x may remove the array
dvander@2762
  1225
    definition from the final binary if PCRE is built into a static library and
dvander@2762
  1226
    dead code stripping is activated.
dvander@2762
  1227
dvander@2762
  1228
46. For an unanchored pattern, if a match attempt fails at the start of a
dvander@2762
  1229
    newline sequence, and the newline setting is CRLF or ANY, and the next two
dvander@2762
  1230
    characters are CRLF, advance by two characters instead of one.
dvander@2762
  1231
dvander@2762
  1232
dvander@2762
  1233
Version 6.7 04-Jul-06
dvander@2762
  1234
---------------------
dvander@2762
  1235
dvander@2762
  1236
 1. In order to handle tests when input lines are enormously long, pcretest has
dvander@2762
  1237
    been re-factored so that it automatically extends its buffers when
dvander@2762
  1238
    necessary. The code is crude, but this _is_ just a test program. The
dvander@2762
  1239
    default size has been increased from 32K to 50K.
dvander@2762
  1240
dvander@2762
  1241
 2. The code in pcre_study() was using the value of the re argument before
dvander@2762
  1242
    testing it for NULL. (Of course, in any sensible call of the function, it
dvander@2762
  1243
    won't be NULL.)
dvander@2762
  1244
dvander@2762
  1245
 3. The memmove() emulation function in pcre_internal.h, which is used on
dvander@2762
  1246
    systems that lack both memmove() and bcopy() - that is, hardly ever -
dvander@2762
  1247
    was missing a "static" storage class specifier.
dvander@2762
  1248
dvander@2762
  1249
 4. When UTF-8 mode was not set, PCRE looped when compiling certain patterns
dvander@2762
  1250
    containing an extended class (one that cannot be represented by a bitmap
dvander@2762
  1251
    because it contains high-valued characters or Unicode property items, e.g.
dvander@2762
  1252
    [\pZ]). Almost always one would set UTF-8 mode when processing such a
dvander@2762
  1253
    pattern, but PCRE should not loop if you do not (it no longer does).
dvander@2762
  1254
    [Detail: two cases were found: (a) a repeated subpattern containing an
dvander@2762
  1255
    extended class; (b) a recursive reference to a subpattern that followed a
dvander@2762
  1256
    previous extended class. It wasn't skipping over the extended class
dvander@2762
  1257
    correctly when UTF-8 mode was not set.]
dvander@2762
  1258
dvander@2762
  1259
 5. A negated single-character class was not being recognized as fixed-length
dvander@2762
  1260
    in lookbehind assertions such as (?<=[^f]), leading to an incorrect
dvander@2762
  1261
    compile error "lookbehind assertion is not fixed length".
dvander@2762
  1262
dvander@2762
  1263
 6. The RunPerlTest auxiliary script was showing an unexpected difference
dvander@2762
  1264
    between PCRE and Perl for UTF-8 tests. It turns out that it is hard to
dvander@2762
  1265
    write a Perl script that can interpret lines of an input file either as
dvander@2762
  1266
    byte characters or as UTF-8, which is what "perltest" was being required to
dvander@2762
  1267
    do for the non-UTF-8 and UTF-8 tests, respectively. Essentially what you
dvander@2762
  1268
    can't do is switch easily at run time between having the "use utf8;" pragma
dvander@2762
  1269
    or not. In the end, I fudged it by using the RunPerlTest script to insert
dvander@2762
  1270
    "use utf8;" explicitly for the UTF-8 tests.
dvander@2762
  1271
dvander@2762
  1272
 7. In multiline (/m) mode, PCRE was matching ^ after a terminating newline at
dvander@2762
  1273
    the end of the subject string, contrary to the documentation and to what
dvander@2762
  1274
    Perl does. This was true of both matching functions. Now it matches only at
dvander@2762
  1275
    the start of the subject and immediately after *internal* newlines.
dvander@2762
  1276
dvander@2762
  1277
 8. A call of pcre_fullinfo() from pcretest to get the option bits was passing
dvander@2762
  1278
    a pointer to an int instead of a pointer to an unsigned long int. This
dvander@2762
  1279
    caused problems on 64-bit systems.
dvander@2762
  1280
dvander@2762
  1281
 9. Applied a patch from the folks at Google to pcrecpp.cc, to fix "another
dvander@2762
  1282
    instance of the 'standard' template library not being so standard".
dvander@2762
  1283
dvander@2762
  1284
10. There was no check on the number of named subpatterns nor the maximum
dvander@2762
  1285
    length of a subpattern name. The product of these values is used to compute
dvander@2762
  1286
    the size of the memory block for a compiled pattern. By supplying a very
dvander@2762
  1287
    long subpattern name and a large number of named subpatterns, the size
dvander@2762
  1288
    computation could be caused to overflow. This is now prevented by limiting
dvander@2762
  1289
    the length of names to 32 characters, and the number of named subpatterns
dvander@2762
  1290
    to 10,000.
dvander@2762
  1291
dvander@2762
  1292
11. Subpatterns that are repeated with specific counts have to be replicated in
dvander@2762
  1293
    the compiled pattern. The size of memory for this was computed from the
dvander@2762
  1294
    length of the subpattern and the repeat count. The latter is limited to
dvander@2762
  1295
    65535, but there was no limit on the former, meaning that integer overflow
dvander@2762
  1296
    could in principle occur. The compiled length of a repeated subpattern is
dvander@2762
  1297
    now limited to 30,000 bytes in order to prevent this.
dvander@2762
  1298
dvander@2762
  1299
12. Added the optional facility to have named substrings with the same name.
dvander@2762
  1300
dvander@2762
  1301
13. Added the ability to use a named substring as a condition, using the
dvander@2762
  1302
    Python syntax: (?(name)yes|no). This overloads (?(R)... and names that
dvander@2762
  1303
    are numbers (not recommended). Forward references are permitted.
dvander@2762
  1304
dvander@2762
  1305
14. Added forward references in named backreferences (if you see what I mean).
dvander@2762
  1306
dvander@2762
  1307
15. In UTF-8 mode, with the PCRE_DOTALL option set, a quantified dot in the
dvander@2762
  1308
    pattern could run off the end of the subject. For example, the pattern
dvander@2762
  1309
    "(?s)(.{1,5})"8 did this with the subject "ab".
dvander@2762
  1310
dvander@2762
  1311
16. If PCRE_DOTALL or PCRE_MULTILINE were set, pcre_dfa_exec() behaved as if
dvander@2762
  1312
    PCRE_CASELESS was set when matching characters that were quantified with ?
dvander@2762
  1313
    or *.
dvander@2762
  1314
dvander@2762
  1315
17. A character class other than a single negated character that had a minimum
dvander@2762
  1316
    but no maximum quantifier - for example [ab]{6,} - was not handled
dvander@2762
  1317
    correctly by pce_dfa_exec(). It would match only one character.
dvander@2762
  1318
dvander@2762
  1319
18. A valid (though odd) pattern that looked like a POSIX character
dvander@2762
  1320
    class but used an invalid character after [ (for example [[,abc,]]) caused
dvander@2762
  1321
    pcre_compile() to give the error "Failed: internal error: code overflow" or
dvander@2762
  1322
    in some cases to crash with a glibc free() error. This could even happen if
dvander@2762
  1323
    the pattern terminated after [[ but there just happened to be a sequence of
dvander@2762
  1324
    letters, a binary zero, and a closing ] in the memory that followed.
dvander@2762
  1325
dvander@2762
  1326
19. Perl's treatment of octal escapes in the range \400 to \777 has changed
dvander@2762
  1327
    over the years. Originally (before any Unicode support), just the bottom 8
dvander@2762
  1328
    bits were taken. Thus, for example, \500 really meant \100. Nowadays the
dvander@2762
  1329
    output from "man perlunicode" includes this:
dvander@2762
  1330
dvander@2762
  1331
      The regular expression compiler produces polymorphic opcodes.  That
dvander@2762
  1332
      is, the pattern adapts to the data and automatically switches to
dvander@2762
  1333
      the Unicode character scheme when presented with Unicode data--or
dvander@2762
  1334
      instead uses a traditional byte scheme when presented with byte
dvander@2762
  1335
      data.
dvander@2762
  1336
dvander@2762
  1337
    Sadly, a wide octal escape does not cause a switch, and in a string with
dvander@2762
  1338
    no other multibyte characters, these octal escapes are treated as before.
dvander@2762
  1339
    Thus, in Perl, the pattern  /\500/ actually matches \100 but the pattern
dvander@2762
  1340
    /\500|\x{1ff}/ matches \500 or \777 because the whole thing is treated as a
dvander@2762
  1341
    Unicode string.
dvander@2762
  1342
dvander@2762
  1343
    I have not perpetrated such confusion in PCRE. Up till now, it took just
dvander@2762
  1344
    the bottom 8 bits, as in old Perl. I have now made octal escapes with
dvander@2762
  1345
    values greater than \377 illegal in non-UTF-8 mode. In UTF-8 mode they
dvander@2762
  1346
    translate to the appropriate multibyte character.
dvander@2762
  1347
dvander@2762
  1348
29. Applied some refactoring to reduce the number of warnings from Microsoft
dvander@2762
  1349
    and Borland compilers. This has included removing the fudge introduced
dvander@2762
  1350
    seven years ago for the OS/2 compiler (see 2.02/2 below) because it caused
dvander@2762
  1351
    a warning about an unused variable.
dvander@2762
  1352
dvander@2762
  1353
21. PCRE has not included VT (character 0x0b) in the set of whitespace
dvander@2762
  1354
    characters since release 4.0, because Perl (from release 5.004) does not.
dvander@2762
  1355
    [Or at least, is documented not to: some releases seem to be in conflict
dvander@2762
  1356
    with the documentation.] However, when a pattern was studied with
dvander@2762
  1357
    pcre_study() and all its branches started with \s, PCRE still included VT
dvander@2762
  1358
    as a possible starting character. Of course, this did no harm; it just
dvander@2762
  1359
    caused an unnecessary match attempt.
dvander@2762
  1360
dvander@2762
  1361
22. Removed a now-redundant internal flag bit that recorded the fact that case
dvander@2762
  1362
    dependency changed within the pattern. This was once needed for "required
dvander@2762
  1363
    byte" processing, but is no longer used. This recovers a now-scarce options
dvander@2762
  1364
    bit. Also moved the least significant internal flag bit to the most-
dvander@2762
  1365
    significant bit of the word, which was not previously used (hangover from
dvander@2762
  1366
    the days when it was an int rather than a uint) to free up another bit for
dvander@2762
  1367
    the future.
dvander@2762
  1368
dvander@2762
  1369
23. Added support for CRLF line endings as well as CR and LF. As well as the
dvander@2762
  1370
    default being selectable at build time, it can now be changed at runtime
dvander@2762
  1371
    via the PCRE_NEWLINE_xxx flags. There are now options for pcregrep to
dvander@2762
  1372
    specify that it is scanning data with non-default line endings.
dvander@2762
  1373
dvander@2762
  1374
24. Changed the definition of CXXLINK to make it agree with the definition of
dvander@2762
  1375
    LINK in the Makefile, by replacing LDFLAGS to CXXFLAGS.
dvander@2762
  1376
dvander@2762
  1377
25. Applied Ian Taylor's patches to avoid using another stack frame for tail
dvander@2762
  1378
    recursions. This makes a big different to stack usage for some patterns.
dvander@2762
  1379
dvander@2762
  1380
26. If a subpattern containing a named recursion or subroutine reference such
dvander@2762
  1381
    as (?P>B) was quantified, for example (xxx(?P>B)){3}, the calculation of
dvander@2762
  1382
    the space required for the compiled pattern went wrong and gave too small a
dvander@2762
  1383
    value. Depending on the environment, this could lead to "Failed: internal
dvander@2762
  1384
    error: code overflow at offset 49" or "glibc detected double free or
dvander@2762
  1385
    corruption" errors.
dvander@2762
  1386
dvander@2762
  1387
27. Applied patches from Google (a) to support the new newline modes and (b) to
dvander@2762
  1388
    advance over multibyte UTF-8 characters in GlobalReplace.
dvander@2762
  1389
dvander@2762
  1390
28. Change free() to pcre_free() in pcredemo.c. Apparently this makes a
dvander@2762
  1391
    difference for some implementation of PCRE in some Windows version.
dvander@2762
  1392
dvander@2762
  1393
29. Added some extra testing facilities to pcretest:
dvander@2762
  1394
dvander@2762
  1395
    \q<number>   in a data line sets the "match limit" value
dvander@2762
  1396
    \Q<number>   in a data line sets the "match recursion limt" value
dvander@2762
  1397
    -S <number>  sets the stack size, where <number> is in megabytes
dvander@2762
  1398
dvander@2762
  1399
    The -S option isn't available for Windows.
dvander@2762
  1400
dvander@2762
  1401
dvander@2762
  1402
Version 6.6 06-Feb-06
dvander@2762
  1403
---------------------
dvander@2762
  1404
dvander@2762
  1405
 1. Change 16(a) for 6.5 broke things, because PCRE_DATA_SCOPE was not defined
dvander@2762
  1406
    in pcreposix.h. I have copied the definition from pcre.h.
dvander@2762
  1407
dvander@2762
  1408
 2. Change 25 for 6.5 broke compilation in a build directory out-of-tree
dvander@2762
  1409
    because pcre.h is no longer a built file.
dvander@2762
  1410
dvander@2762
  1411
 3. Added Jeff Friedl's additional debugging patches to pcregrep. These are
dvander@2762
  1412
    not normally included in the compiled code.
dvander@2762
  1413
dvander@2762
  1414
dvander@2762
  1415
Version 6.5 01-Feb-06
dvander@2762
  1416
---------------------
dvander@2762
  1417
dvander@2762
  1418
 1. When using the partial match feature with pcre_dfa_exec(), it was not
dvander@2762
  1419
    anchoring the second and subsequent partial matches at the new starting
dvander@2762
  1420
    point. This could lead to incorrect results. For example, with the pattern
dvander@2762
  1421
    /1234/, partially matching against "123" and then "a4" gave a match.
dvander@2762
  1422
dvander@2762
  1423
 2. Changes to pcregrep:
dvander@2762
  1424
dvander@2762
  1425
    (a) All non-match returns from pcre_exec() were being treated as failures
dvander@2762
  1426
        to match the line. Now, unless the error is PCRE_ERROR_NOMATCH, an
dvander@2762
  1427
        error message is output. Some extra information is given for the
dvander@2762
  1428
        PCRE_ERROR_MATCHLIMIT and PCRE_ERROR_RECURSIONLIMIT errors, which are
dvander@2762
  1429
        probably the only errors that are likely to be caused by users (by
dvander@2762
  1430
        specifying a regex that has nested indefinite repeats, for instance).
dvander@2762
  1431
        If there are more than 20 of these errors, pcregrep is abandoned.
dvander@2762
  1432
dvander@2762
  1433
    (b) A binary zero was treated as data while matching, but terminated the
dvander@2762
  1434
        output line if it was written out. This has been fixed: binary zeroes
dvander@2762
  1435
        are now no different to any other data bytes.
dvander@2762
  1436
dvander@2762
  1437
    (c) Whichever of the LC_ALL or LC_CTYPE environment variables is set is
dvander@2762
  1438
        used to set a locale for matching. The --locale=xxxx long option has
dvander@2762
  1439
        been added (no short equivalent) to specify a locale explicitly on the
dvander@2762
  1440
        pcregrep command, overriding the environment variables.
dvander@2762
  1441
dvander@2762
  1442
    (d) When -B was used with -n, some line numbers in the output were one less
dvander@2762
  1443
        than they should have been.
dvander@2762
  1444
dvander@2762
  1445
    (e) Added the -o (--only-matching) option.
dvander@2762
  1446
dvander@2762
  1447
    (f) If -A or -C was used with -c (count only), some lines of context were
dvander@2762
  1448
        accidentally printed for the final match.
dvander@2762
  1449
dvander@2762
  1450
    (g) Added the -H (--with-filename) option.
dvander@2762
  1451
dvander@2762
  1452
    (h) The combination of options -rh failed to suppress file names for files
dvander@2762
  1453
        that were found from directory arguments.
dvander@2762
  1454
dvander@2762
  1455
    (i) Added the -D (--devices) and -d (--directories) options.
dvander@2762
  1456
dvander@2762
  1457
    (j) Added the -F (--fixed-strings) option.
dvander@2762
  1458
dvander@2762
  1459
    (k) Allow "-" to be used as a file name for -f as well as for a data file.
dvander@2762
  1460
dvander@2762
  1461
    (l) Added the --colo(u)r option.
dvander@2762
  1462
dvander@2762
  1463
    (m) Added Jeffrey Friedl's -S testing option, but within #ifdefs so that it
dvander@2762
  1464
        is not present by default.
dvander@2762
  1465
dvander@2762
  1466
 3. A nasty bug was discovered in the handling of recursive patterns, that is,
dvander@2762
  1467
    items such as (?R) or (?1), when the recursion could match a number of
dvander@2762
  1468
    alternatives. If it matched one of the alternatives, but subsequently,
dvander@2762
  1469
    outside the recursion, there was a failure, the code tried to back up into
dvander@2762
  1470
    the recursion. However, because of the way PCRE is implemented, this is not
dvander@2762
  1471
    possible, and the result was an incorrect result from the match.
dvander@2762
  1472
dvander@2762
  1473
    In order to prevent this happening, the specification of recursion has
dvander@2762
  1474
    been changed so that all such subpatterns are automatically treated as
dvander@2762
  1475
    atomic groups. Thus, for example, (?R) is treated as if it were (?>(?R)).
dvander@2762
  1476
dvander@2762
  1477
 4. I had overlooked the fact that, in some locales, there are characters for
dvander@2762
  1478
    which isalpha() is true but neither isupper() nor islower() are true. In
dvander@2762
  1479
    the fr_FR locale, for instance, the \xAA and \xBA characters (ordmasculine
dvander@2762
  1480
    and ordfeminine) are like this. This affected the treatment of \w and \W
dvander@2762
  1481
    when they appeared in character classes, but not when they appeared outside
dvander@2762
  1482
    a character class. The bit map for "word" characters is now created
dvander@2762
  1483
    separately from the results of isalnum() instead of just taking it from the
dvander@2762
  1484
    upper, lower, and digit maps. (Plus the underscore character, of course.)
dvander@2762
  1485
dvander@2762
  1486
 5. The above bug also affected the handling of POSIX character classes such as
dvander@2762
  1487
    [[:alpha:]] and [[:alnum:]]. These do not have their own bit maps in PCRE's
dvander@2762
  1488
    permanent tables. Instead, the bit maps for such a class were previously
dvander@2762
  1489
    created as the appropriate unions of the upper, lower, and digit bitmaps.
dvander@2762
  1490
    Now they are created by subtraction from the [[:word:]] class, which has
dvander@2762
  1491
    its own bitmap.
dvander@2762
  1492
dvander@2762
  1493
 6. The [[:blank:]] character class matches horizontal, but not vertical space.
dvander@2762
  1494
    It is created by subtracting the vertical space characters (\x09, \x0a,
dvander@2762
  1495
    \x0b, \x0c) from the [[:space:]] bitmap. Previously, however, the
dvander@2762
  1496
    subtraction was done in the overall bitmap for a character class, meaning
dvander@2762
  1497
    that a class such as [\x0c[:blank:]] was incorrect because \x0c would not
dvander@2762
  1498
    be recognized. This bug has been fixed.
dvander@2762
  1499
dvander@2762
  1500
 7. Patches from the folks at Google:
dvander@2762
  1501
dvander@2762
  1502
      (a) pcrecpp.cc: "to handle a corner case that may or may not happen in
dvander@2762
  1503
      real life, but is still worth protecting against".
dvander@2762
  1504
dvander@2762
  1505
      (b) pcrecpp.cc: "corrects a bug when negative radixes are used with
dvander@2762
  1506
      regular expressions".
dvander@2762
  1507
dvander@2762
  1508
      (c) pcre_scanner.cc: avoid use of std::count() because not all systems
dvander@2762
  1509
      have it.
dvander@2762
  1510
dvander@2762
  1511
      (d) Split off pcrecpparg.h from pcrecpp.h and had the former built by
dvander@2762
  1512
      "configure" and the latter not, in order to fix a problem somebody had
dvander@2762
  1513
      with compiling the Arg class on HP-UX.
dvander@2762
  1514
dvander@2762
  1515
      (e) Improve the error-handling of the C++ wrapper a little bit.
dvander@2762
  1516
dvander@2762
  1517
      (f) New tests for checking recursion limiting.
dvander@2762
  1518
dvander@2762
  1519
 8. The pcre_memmove() function, which is used only if the environment does not
dvander@2762
  1520
    have a standard memmove() function (and is therefore rarely compiled),
dvander@2762
  1521
    contained two bugs: (a) use of int instead of size_t, and (b) it was not
dvander@2762
  1522
    returning a result (though PCRE never actually uses the result).
dvander@2762
  1523
dvander@2762
  1524
 9. In the POSIX regexec() interface, if nmatch is specified as a ridiculously
dvander@2762
  1525
    large number - greater than INT_MAX/(3*sizeof(int)) - REG_ESPACE is
dvander@2762
  1526
    returned instead of calling malloc() with an overflowing number that would
dvander@2762
  1527
    most likely cause subsequent chaos.
dvander@2762
  1528
dvander@2762
  1529
10. The debugging option of pcretest was not showing the NO_AUTO_CAPTURE flag.
dvander@2762
  1530
dvander@2762
  1531
11. The POSIX flag REG_NOSUB is now supported. When a pattern that was compiled
dvander@2762
  1532
    with this option is matched, the nmatch and pmatch options of regexec() are
dvander@2762
  1533
    ignored.
dvander@2762
  1534
dvander@2762
  1535
12. Added REG_UTF8 to the POSIX interface. This is not defined by POSIX, but is
dvander@2762
  1536
    provided in case anyone wants to the the POSIX interface with UTF-8
dvander@2762
  1537
    strings.
dvander@2762
  1538
dvander@2762
  1539
13. Added CXXLDFLAGS to the Makefile parameters to provide settings only on the
dvander@2762
  1540
    C++ linking (needed for some HP-UX environments).
dvander@2762
  1541
dvander@2762
  1542
14. Avoid compiler warnings in get_ucpname() when compiled without UCP support
dvander@2762
  1543
    (unused parameter) and in the pcre_printint() function (omitted "default"
dvander@2762
  1544
    switch label when the default is to do nothing).
dvander@2762
  1545
dvander@2762
  1546
15. Added some code to make it possible, when PCRE is compiled as a C++
dvander@2762
  1547
    library, to replace subject pointers for pcre_exec() with a smart pointer
dvander@2762
  1548
    class, thus making it possible to process discontinuous strings.
dvander@2762
  1549
dvander@2762
  1550
16. The two macros PCRE_EXPORT and PCRE_DATA_SCOPE are confusing, and perform
dvander@2762
  1551
    much the same function. They were added by different people who were trying
dvander@2762
  1552
    to make PCRE easy to compile on non-Unix systems. It has been suggested
dvander@2762
  1553
    that PCRE_EXPORT be abolished now that there is more automatic apparatus
dvander@2762
  1554
    for compiling on Windows systems. I have therefore replaced it with
dvander@2762
  1555
    PCRE_DATA_SCOPE. This is set automatically for Windows; if not set it
dvander@2762
  1556
    defaults to "extern" for C or "extern C" for C++, which works fine on
dvander@2762
  1557
    Unix-like systems. It is now possible to override the value of PCRE_DATA_
dvander@2762
  1558
    SCOPE with something explicit in config.h. In addition:
dvander@2762
  1559
dvander@2762
  1560
    (a) pcreposix.h still had just "extern" instead of either of these macros;
dvander@2762
  1561
        I have replaced it with PCRE_DATA_SCOPE.
dvander@2762
  1562
dvander@2762
  1563
    (b) Functions such as _pcre_xclass(), which are internal to the library,
dvander@2762
  1564
        but external in the C sense, all had PCRE_EXPORT in their definitions.
dvander@2762
  1565
        This is apparently wrong for the Windows case, so I have removed it.
dvander@2762
  1566
        (It makes no difference on Unix-like systems.)
dvander@2762
  1567
dvander@2762
  1568
17. Added a new limit, MATCH_LIMIT_RECURSION, which limits the depth of nesting
dvander@2762
  1569
    of recursive calls to match(). This is different to MATCH_LIMIT because
dvander@2762
  1570
    that limits the total number of calls to match(), not all of which increase
dvander@2762
  1571
    the depth of recursion. Limiting the recursion depth limits the amount of
dvander@2762
  1572
    stack (or heap if NO_RECURSE is set) that is used. The default can be set
dvander@2762
  1573
    when PCRE is compiled, and changed at run time. A patch from Google adds
dvander@2762
  1574
    this functionality to the C++ interface.
dvander@2762
  1575
dvander@2762
  1576
18. Changes to the handling of Unicode character properties:
dvander@2762
  1577
dvander@2762
  1578
    (a) Updated the table to Unicode 4.1.0.
dvander@2762
  1579
dvander@2762
  1580
    (b) Recognize characters that are not in the table as "Cn" (undefined).
dvander@2762
  1581
dvander@2762
  1582
    (c) I revised the way the table is implemented to a much improved format
dvander@2762
  1583
        which includes recognition of ranges. It now supports the ranges that
dvander@2762
  1584
        are defined in UnicodeData.txt, and it also amalgamates other
dvander@2762
  1585
        characters into ranges. This has reduced the number of entries in the
dvander@2762
  1586
        table from around 16,000 to around 3,000, thus reducing its size
dvander@2762
  1587
        considerably. I realized I did not need to use a tree structure after
dvander@2762
  1588
        all - a binary chop search is just as efficient. Having reduced the
dvander@2762
  1589
        number of entries, I extended their size from 6 bytes to 8 bytes to
dvander@2762
  1590
        allow for more data.
dvander@2762
  1591
dvander@2762
  1592
    (d) Added support for Unicode script names via properties such as \p{Han}.
dvander@2762
  1593
dvander@2762
  1594
19. In UTF-8 mode, a backslash followed by a non-Ascii character was not
dvander@2762
  1595
    matching that character.
dvander@2762
  1596
dvander@2762
  1597
20. When matching a repeated Unicode property with a minimum greater than zero,
dvander@2762
  1598
    (for example \pL{2,}), PCRE could look past the end of the subject if it
dvander@2762
  1599
    reached it while seeking the minimum number of characters. This could
dvander@2762
  1600
    happen only if some of the characters were more than one byte long, because
dvander@2762
  1601
    there is a check for at least the minimum number of bytes.
dvander@2762
  1602
dvander@2762
  1603
21. Refactored the implementation of \p and \P so as to be more general, to
dvander@2762
  1604
    allow for more different types of property in future. This has changed the
dvander@2762
  1605
    compiled form incompatibly. Anybody with saved compiled patterns that use
dvander@2762
  1606
    \p or \P will have to recompile them.
dvander@2762
  1607
dvander@2762
  1608
22. Added "Any" and "L&" to the supported property types.
dvander@2762
  1609
dvander@2762
  1610
23. Recognize \x{...} as a code point specifier, even when not in UTF-8 mode,
dvander@2762
  1611
    but give a compile time error if the value is greater than 0xff.
dvander@2762
  1612
dvander@2762
  1613
24. The man pages for pcrepartial, pcreprecompile, and pcre_compile2 were
dvander@2762
  1614
    accidentally not being installed or uninstalled.
dvander@2762
  1615
dvander@2762
  1616
25. The pcre.h file was built from pcre.h.in, but the only changes that were
dvander@2762
  1617
    made were to insert the current release number. This seemed silly, because
dvander@2762
  1618
    it made things harder for people building PCRE on systems that don't run
dvander@2762
  1619
    "configure". I have turned pcre.h into a distributed file, no longer built
dvander@2762
  1620
    by "configure", with the version identification directly included. There is
dvander@2762
  1621
    no longer a pcre.h.in file.
dvander@2762
  1622
dvander@2762
  1623
    However, this change necessitated a change to the pcre-config script as
dvander@2762
  1624
    well. It is built from pcre-config.in, and one of the substitutions was the
dvander@2762
  1625
    release number. I have updated configure.ac so that ./configure now finds
dvander@2762
  1626
    the release number by grepping pcre.h.
dvander@2762
  1627
dvander@2762
  1628
26. Added the ability to run the tests under valgrind.
dvander@2762
  1629
dvander@2762
  1630
dvander@2762
  1631
Version 6.4 05-Sep-05
dvander@2762
  1632
---------------------
dvander@2762
  1633
dvander@2762
  1634
 1. Change 6.0/10/(l) to pcregrep introduced a bug that caused separator lines
dvander@2762
  1635
    "--" to be printed when multiple files were scanned, even when none of the
dvander@2762
  1636
    -A, -B, or -C options were used. This is not compatible with Gnu grep, so I
dvander@2762
  1637
    consider it to be a bug, and have restored the previous behaviour.
dvander@2762
  1638
dvander@2762
  1639
 2. A couple of code tidies to get rid of compiler warnings.
dvander@2762
  1640
dvander@2762
  1641
 3. The pcretest program used to cheat by referring to symbols in the library
dvander@2762
  1642
    whose names begin with _pcre_. These are internal symbols that are not
dvander@2762
  1643
    really supposed to be visible externally, and in some environments it is
dvander@2762
  1644
    possible to suppress them. The cheating is now confined to including
dvander@2762
  1645
    certain files from the library's source, which is a bit cleaner.
dvander@2762
  1646
dvander@2762
  1647
 4. Renamed pcre.in as pcre.h.in to go with pcrecpp.h.in; it also makes the
dvander@2762
  1648
    file's purpose clearer.
dvander@2762
  1649
dvander@2762
  1650
 5. Reorganized pcre_ucp_findchar().
dvander@2762
  1651
dvander@2762
  1652
dvander@2762
  1653
Version 6.3 15-Aug-05
dvander@2762
  1654
---------------------
dvander@2762
  1655
dvander@2762
  1656
 1. The file libpcre.pc.in did not have general read permission in the tarball.
dvander@2762
  1657
dvander@2762
  1658
 2. There were some problems when building without C++ support:
dvander@2762
  1659
dvander@2762
  1660
    (a) If C++ support was not built, "make install" and "make test" still
dvander@2762
  1661
        tried to test it.
dvander@2762
  1662
dvander@2762
  1663
    (b) There were problems when the value of CXX was explicitly set. Some
dvander@2762
  1664
        changes have been made to try to fix these, and ...
dvander@2762
  1665
dvander@2762
  1666
    (c) --disable-cpp can now be used to explicitly disable C++ support.
dvander@2762
  1667
dvander@2762
  1668
    (d) The use of @CPP_OBJ@ directly caused a blank line preceded by a
dvander@2762
  1669
        backslash in a target when C++ was disabled. This confuses some
dvander@2762
  1670
        versions of "make", apparently. Using an intermediate variable solves
dvander@2762
  1671
        this. (Same for CPP_LOBJ.)
dvander@2762
  1672
dvander@2762
  1673
 3. $(LINK_FOR_BUILD) now includes $(CFLAGS_FOR_BUILD) and $(LINK)
dvander@2762
  1674
    (non-Windows) now includes $(CFLAGS) because these flags are sometimes
dvander@2762
  1675
    necessary on certain architectures.
dvander@2762
  1676
dvander@2762
  1677
 4. Added a setting of -export-symbols-regex to the link command to remove
dvander@2762
  1678
    those symbols that are exported in the C sense, but actually are local
dvander@2762
  1679
    within the library, and not documented. Their names all begin with
dvander@2762
  1680
    "_pcre_". This is not a perfect job, because (a) we have to except some
dvander@2762
  1681
    symbols that pcretest ("illegally") uses, and (b) the facility isn't always
dvander@2762
  1682
    available (and never for static libraries). I have made a note to try to
dvander@2762
  1683
    find a way round (a) in the future.
dvander@2762
  1684
dvander@2762
  1685
dvander@2762
  1686
Version 6.2 01-Aug-05
dvander@2762
  1687
---------------------
dvander@2762
  1688
dvander@2762
  1689
 1. There was no test for integer overflow of quantifier values. A construction
dvander@2762
  1690
    such as {1111111111111111} would give undefined results. What is worse, if
dvander@2762
  1691
    a minimum quantifier for a parenthesized subpattern overflowed and became
dvander@2762
  1692
    negative, the calculation of the memory size went wrong. This could have
dvander@2762
  1693
    led to memory overwriting.
dvander@2762
  1694
dvander@2762
  1695
 2. Building PCRE using VPATH was broken. Hopefully it is now fixed.
dvander@2762
  1696
dvander@2762
  1697
 3. Added "b" to the 2nd argument of fopen() in dftables.c, for non-Unix-like
dvander@2762
  1698
    operating environments where this matters.
dvander@2762
  1699
dvander@2762
  1700
 4. Applied Giuseppe Maxia's patch to add additional features for controlling
dvander@2762
  1701
    PCRE options from within the C++ wrapper.
dvander@2762
  1702
dvander@2762
  1703
 5. Named capturing subpatterns were not being correctly counted when a pattern
dvander@2762
  1704
    was compiled. This caused two problems: (a) If there were more than 100
dvander@2762
  1705
    such subpatterns, the calculation of the memory needed for the whole
dvander@2762
  1706
    compiled pattern went wrong, leading to an overflow error. (b) Numerical
dvander@2762
  1707
    back references of the form \12, where the number was greater than 9, were
dvander@2762
  1708
    not recognized as back references, even though there were sufficient
dvander@2762
  1709
    previous subpatterns.
dvander@2762
  1710
dvander@2762
  1711
 6. Two minor patches to pcrecpp.cc in order to allow it to compile on older
dvander@2762
  1712
    versions of gcc, e.g. 2.95.4.
dvander@2762
  1713
dvander@2762
  1714
dvander@2762
  1715
Version 6.1 21-Jun-05
dvander@2762
  1716
---------------------
dvander@2762
  1717
dvander@2762
  1718
 1. There was one reference to the variable "posix" in pcretest.c that was not
dvander@2762
  1719
    surrounded by "#if !defined NOPOSIX".
dvander@2762
  1720
dvander@2762
  1721
 2. Make it possible to compile pcretest without DFA support, UTF8 support, or
dvander@2762
  1722
    the cross-check on the old pcre_info() function, for the benefit of the
dvander@2762
  1723
    cut-down version of PCRE that is currently imported into Exim.
dvander@2762
  1724
dvander@2762
  1725
 3. A (silly) pattern starting with (?i)(?-i) caused an internal space
dvander@2762
  1726
    allocation error. I've done the easy fix, which wastes 2 bytes for sensible
dvander@2762
  1727
    patterns that start (?i) but I don't think that matters. The use of (?i) is
dvander@2762
  1728
    just an example; this all applies to the other options as well.
dvander@2762
  1729
dvander@2762
  1730
 4. Since libtool seems to echo the compile commands it is issuing, the output
dvander@2762
  1731
    from "make" can be reduced a bit by putting "@" in front of each libtool
dvander@2762
  1732
    compile command.
dvander@2762
  1733
dvander@2762
  1734
 5. Patch from the folks at Google for configure.in to be a bit more thorough
dvander@2762
  1735
    in checking for a suitable C++ installation before trying to compile the
dvander@2762
  1736
    C++ stuff. This should fix a reported problem when a compiler was present,
dvander@2762
  1737
    but no suitable headers.
dvander@2762
  1738
dvander@2762
  1739
 6. The man pages all had just "PCRE" as their title. I have changed them to
dvander@2762
  1740
    be the relevant file name. I have also arranged that these names are
dvander@2762
  1741
    retained in the file doc/pcre.txt, which is a concatenation in text format
dvander@2762
  1742
    of all the man pages except the little individual ones for each function.
dvander@2762
  1743
dvander@2762
  1744
 7. The NON-UNIX-USE file had not been updated for the different set of source
dvander@2762
  1745
    files that come with release 6. I also added a few comments about the C++
dvander@2762
  1746
    wrapper.
dvander@2762
  1747
dvander@2762
  1748
dvander@2762
  1749
Version 6.0 07-Jun-05
dvander@2762
  1750
---------------------
dvander@2762
  1751
dvander@2762
  1752
 1. Some minor internal re-organization to help with my DFA experiments.
dvander@2762
  1753
dvander@2762
  1754
 2. Some missing #ifdef SUPPORT_UCP conditionals in pcretest and printint that
dvander@2762
  1755
    didn't matter for the library itself when fully configured, but did matter
dvander@2762
  1756
    when compiling without UCP support, or within Exim, where the ucp files are
dvander@2762
  1757
    not imported.
dvander@2762
  1758
dvander@2762
  1759
 3. Refactoring of the library code to split up the various functions into
dvander@2762
  1760
    different source modules. The addition of the new DFA matching code (see
dvander@2762
  1761
    below) to a single monolithic source would have made it really too
dvander@2762
  1762
    unwieldy, quite apart from causing all the code to be include in a
dvander@2762
  1763
    statically linked application, when only some functions are used. This is
dvander@2762
  1764
    relevant even without the DFA addition now that patterns can be compiled in
dvander@2762
  1765
    one application and matched in another.
dvander@2762
  1766
dvander@2762
  1767
    The downside of splitting up is that there have to be some external
dvander@2762
  1768
    functions and data tables that are used internally in different modules of
dvander@2762
  1769
    the library but which are not part of the API. These have all had their
dvander@2762
  1770
    names changed to start with "_pcre_" so that they are unlikely to clash
dvander@2762
  1771
    with other external names.
dvander@2762
  1772
dvander@2762
  1773
 4. Added an alternate matching function, pcre_dfa_exec(), which matches using
dvander@2762
  1774
    a different (DFA) algorithm. Although it is slower than the original
dvander@2762
  1775
    function, it does have some advantages for certain types of matching
dvander@2762
  1776
    problem.
dvander@2762
  1777
dvander@2762
  1778
 5. Upgrades to pcretest in order to test the features of pcre_dfa_exec(),
dvander@2762
  1779
    including restarting after a partial match.
dvander@2762
  1780
dvander@2762
  1781
 6. A patch for pcregrep that defines INVALID_FILE_ATTRIBUTES if it is not
dvander@2762
  1782
    defined when compiling for Windows was sent to me. I have put it into the
dvander@2762
  1783
    code, though I have no means of testing or verifying it.
dvander@2762
  1784
dvander@2762
  1785
 7. Added the pcre_refcount() auxiliary function.
dvander@2762
  1786
dvander@2762
  1787
 8. Added the PCRE_FIRSTLINE option. This constrains an unanchored pattern to
dvander@2762
  1788
    match before or at the first newline in the subject string. In pcretest,
dvander@2762
  1789
    the /f option on a pattern can be used to set this.
dvander@2762
  1790
dvander@2762
  1791
 9. A repeated \w when used in UTF-8 mode with characters greater than 256
dvander@2762
  1792
    would behave wrongly. This has been present in PCRE since release 4.0.
dvander@2762
  1793
dvander@2762
  1794
10. A number of changes to the pcregrep command:
dvander@2762
  1795
dvander@2762
  1796
    (a) Refactored how -x works; insert ^(...)$ instead of setting
dvander@2762
  1797
        PCRE_ANCHORED and checking the length, in preparation for adding
dvander@2762
  1798
        something similar for -w.
dvander@2762
  1799
dvander@2762
  1800
    (b) Added the -w (match as a word) option.
dvander@2762
  1801
dvander@2762
  1802
    (c) Refactored the way lines are read and buffered so as to have more
dvander@2762
  1803
        than one at a time available.
dvander@2762
  1804
dvander@2762
  1805
    (d) Implemented a pcregrep test script.
dvander@2762
  1806
dvander@2762
  1807
    (e) Added the -M (multiline match) option. This allows patterns to match
dvander@2762
  1808
        over several lines of the subject. The buffering ensures that at least
dvander@2762
  1809
        8K, or the rest of the document (whichever is the shorter) is available
dvander@2762
  1810
        for matching (and similarly the previous 8K for lookbehind assertions).
dvander@2762
  1811
dvander@2762
  1812
    (f) Changed the --help output so that it now says
dvander@2762
  1813
dvander@2762
  1814
          -w, --word-regex(p)
dvander@2762
  1815
dvander@2762
  1816
        instead of two lines, one with "regex" and the other with "regexp"
dvander@2762
  1817
        because that confused at least one person since the short forms are the
dvander@2762
  1818
        same. (This required a bit of code, as the output is generated
dvander@2762
  1819
        automatically from a table. It wasn't just a text change.)
dvander@2762
  1820
dvander@2762
  1821
    (g) -- can be used to terminate pcregrep options if the next thing isn't an
dvander@2762
  1822
        option but starts with a hyphen. Could be a pattern or a path name
dvander@2762
  1823
        starting with a hyphen, for instance.
dvander@2762
  1824
dvander@2762
  1825
    (h) "-" can be given as a file name to represent stdin.
dvander@2762
  1826
dvander@2762
  1827
    (i) When file names are being printed, "(standard input)" is used for
dvander@2762
  1828
        the standard input, for compatibility with GNU grep. Previously
dvander@2762
  1829
        "<stdin>" was used.
dvander@2762
  1830
dvander@2762
  1831
    (j) The option --label=xxx can be used to supply a name to be used for
dvander@2762
  1832
        stdin when file names are being printed. There is no short form.
dvander@2762
  1833
dvander@2762
  1834
    (k) Re-factored the options decoding logic because we are going to add
dvander@2762
  1835
        two more options that take data. Such options can now be given in four
dvander@2762
  1836
        different ways, e.g. "-fname", "-f name", "--file=name", "--file name".
dvander@2762
  1837
dvander@2762
  1838
    (l) Added the -A, -B, and -C options for requesting that lines of context
dvander@2762
  1839
        around matches be printed.
dvander@2762
  1840
dvander@2762
  1841
    (m) Added the -L option to print the names of files that do not contain
dvander@2762
  1842
        any matching lines, that is, the complement of -l.
dvander@2762
  1843
dvander@2762
  1844
    (n) The return code is 2 if any file cannot be opened, but pcregrep does
dvander@2762
  1845
        continue to scan other files.
dvander@2762
  1846
dvander@2762
  1847
    (o) The -s option was incorrectly implemented. For compatibility with other
dvander@2762
  1848
        greps, it now suppresses the error message for a non-existent or non-
dvander@2762
  1849
        accessible file (but not the return code). There is a new option called
dvander@2762
  1850
        -q that suppresses the output of matching lines, which was what -s was
dvander@2762
  1851
        previously doing.
dvander@2762
  1852
dvander@2762
  1853
    (p) Added --include and --exclude options to specify files for inclusion
dvander@2762
  1854
        and exclusion when recursing.
dvander@2762
  1855
dvander@2762
  1856
11. The Makefile was not using the Autoconf-supported LDFLAGS macro properly.
dvander@2762
  1857
    Hopefully, it now does.
dvander@2762
  1858
dvander@2762
  1859
12. Missing cast in pcre_study().
dvander@2762
  1860
dvander@2762
  1861
13. Added an "uninstall" target to the makefile.
dvander@2762
  1862
dvander@2762
  1863
14. Replaced "extern" in the function prototypes in Makefile.in with
dvander@2762
  1864
    "PCRE_DATA_SCOPE", which defaults to 'extern' or 'extern "C"' in the Unix
dvander@2762
  1865
    world, but is set differently for Windows.
dvander@2762
  1866
dvander@2762
  1867
15. Added a second compiling function called pcre_compile2(). The only
dvander@2762
  1868
    difference is that it has an extra argument, which is a pointer to an
dvander@2762
  1869
    integer error code. When there is a compile-time failure, this is set
dvander@2762
  1870
    non-zero, in addition to the error test pointer being set to point to an
dvander@2762
  1871
    error message. The new argument may be NULL if no error number is required
dvander@2762
  1872
    (but then you may as well call pcre_compile(), which is now just a
dvander@2762
  1873
    wrapper). This facility is provided because some applications need a
dvander@2762
  1874
    numeric error indication, but it has also enabled me to tidy up the way
dvander@2762
  1875
    compile-time errors are handled in the POSIX wrapper.
dvander@2762
  1876
dvander@2762
  1877
16. Added VPATH=.libs to the makefile; this should help when building with one
dvander@2762
  1878
    prefix path and installing with another. (Or so I'm told by someone who
dvander@2762
  1879
    knows more about this stuff than I do.)
dvander@2762
  1880
dvander@2762
  1881
17. Added a new option, REG_DOTALL, to the POSIX function regcomp(). This
dvander@2762
  1882
    passes PCRE_DOTALL to the pcre_compile() function, making the "." character
dvander@2762
  1883
    match everything, including newlines. This is not POSIX-compatible, but
dvander@2762
  1884
    somebody wanted the feature. From pcretest it can be activated by using
dvander@2762
  1885
    both the P and the s flags.
dvander@2762
  1886
dvander@2762
  1887
18. AC_PROG_LIBTOOL appeared twice in Makefile.in. Removed one.
dvander@2762
  1888
dvander@2762
  1889
19. libpcre.pc was being incorrectly installed as executable.
dvander@2762
  1890
dvander@2762
  1891
20. A couple of places in pcretest check for end-of-line by looking for '\n';
dvander@2762
  1892
    it now also looks for '\r' so that it will work unmodified on Windows.
dvander@2762
  1893
dvander@2762
  1894
21. Added Google's contributed C++ wrapper to the distribution.
dvander@2762
  1895
dvander@2762
  1896
22. Added some untidy missing memory free() calls in pcretest, to keep
dvander@2762
  1897
    Electric Fence happy when testing.
dvander@2762
  1898
dvander@2762
  1899
dvander@2762
  1900
dvander@2762
  1901
Version 5.0 13-Sep-04
dvander@2762
  1902
---------------------
dvander@2762
  1903
dvander@2762
  1904
 1. Internal change: literal characters are no longer packed up into items
dvander@2762
  1905
    containing multiple characters in a single byte-string. Each character
dvander@2762
  1906
    is now matched using a separate opcode. However, there may be more than one
dvander@2762
  1907
    byte in the character in UTF-8 mode.
dvander@2762
  1908
dvander@2762
  1909
 2. The pcre_callout_block structure has two new fields: pattern_position and
dvander@2762
  1910
    next_item_length. These contain the offset in the pattern to the next match
dvander@2762
  1911
    item, and its length, respectively.
dvander@2762
  1912
dvander@2762
  1913
 3. The PCRE_AUTO_CALLOUT option for pcre_compile() requests the automatic
dvander@2762
  1914
    insertion of callouts before each pattern item. Added the /C option to
dvander@2762
  1915
    pcretest to make use of this.
dvander@2762
  1916
dvander@2762
  1917
 4. On the advice of a Windows user, the lines
dvander@2762
  1918
dvander@2762
  1919
      #if defined(_WIN32) || defined(WIN32)
dvander@2762
  1920
      _setmode( _fileno( stdout ), 0x8000 );
dvander@2762
  1921
      #endif  /* defined(_WIN32) || defined(WIN32) */
dvander@2762
  1922
dvander@2762
  1923
    have been added to the source of pcretest. This apparently does useful
dvander@2762
  1924
    magic in relation to line terminators.
dvander@2762
  1925
dvander@2762
  1926
 5. Changed "r" and "w" in the calls to fopen() in pcretest to "rb" and "wb"
dvander@2762
  1927
    for the benefit of those environments where the "b" makes a difference.
dvander@2762
  1928
dvander@2762
  1929
 6. The icc compiler has the same options as gcc, but "configure" doesn't seem
dvander@2762
  1930
    to know about it. I have put a hack into configure.in that adds in code
dvander@2762
  1931
    to set GCC=yes if CC=icc. This seems to end up at a point in the
dvander@2762
  1932
    generated configure script that is early enough to affect the setting of
dvander@2762
  1933
    compiler options, which is what is needed, but I have no means of testing
dvander@2762
  1934
    whether it really works. (The user who reported this had patched the
dvander@2762
  1935
    generated configure script, which of course I cannot do.)
dvander@2762
  1936
dvander@2762
  1937
    LATER: After change 22 below (new libtool files), the configure script
dvander@2762
  1938
    seems to know about icc (and also ecc). Therefore, I have commented out
dvander@2762
  1939
    this hack in configure.in.
dvander@2762
  1940
dvander@2762
  1941
 7. Added support for pkg-config (2 patches were sent in).
dvander@2762
  1942
dvander@2762
  1943
 8. Negated POSIX character classes that used a combination of internal tables
dvander@2762
  1944
    were completely broken. These were [[:^alpha:]], [[:^alnum:]], and
dvander@2762
  1945
    [[:^ascii]]. Typically, they would match almost any characters. The other
dvander@2762
  1946
    POSIX classes were not broken in this way.
dvander@2762
  1947
dvander@2762
  1948
 9. Matching the pattern "\b.*?" against "ab cd", starting at offset 1, failed
dvander@2762
  1949
    to find the match, as PCRE was deluded into thinking that the match had to
dvander@2762
  1950
    start at the start point or following a newline. The same bug applied to
dvander@2762
  1951
    patterns with negative forward assertions or any backward assertions
dvander@2762
  1952
    preceding ".*" at the start, unless the pattern required a fixed first
dvander@2762
  1953
    character. This was a failing pattern: "(?!.bcd).*". The bug is now fixed.
dvander@2762
  1954
dvander@2762
  1955
10. In UTF-8 mode, when moving forwards in the subject after a failed match
dvander@2762
  1956
    starting at the last subject character, bytes beyond the end of the subject
dvander@2762
  1957
    string were read.
dvander@2762
  1958
dvander@2762
  1959
11. Renamed the variable "class" as "classbits" to make life easier for C++
dvander@2762
  1960
    users. (Previously there was a macro definition, but it apparently wasn't
dvander@2762
  1961
    enough.)
dvander@2762
  1962
dvander@2762
  1963
12. Added the new field "tables" to the extra data so that tables can be passed
dvander@2762
  1964
    in at exec time, or the internal tables can be re-selected. This allows
dvander@2762
  1965
    a compiled regex to be saved and re-used at a later time by a different
dvander@2762
  1966
    program that might have everything at different addresses.
dvander@2762
  1967
dvander@2762
  1968
13. Modified the pcre-config script so that, when run on Solaris, it shows a
dvander@2762
  1969
    -R library as well as a -L library.
dvander@2762
  1970
dvander@2762
  1971
14. The debugging options of pcretest (-d on the command line or D on a
dvander@2762
  1972
    pattern) showed incorrect output for anything following an extended class
dvander@2762
  1973
    that contained multibyte characters and which was followed by a quantifier.
dvander@2762
  1974
dvander@2762
  1975
15. Added optional support for general category Unicode character properties
dvander@2762
  1976
    via the \p, \P, and \X escapes. Unicode property support implies UTF-8
dvander@2762
  1977
    support. It adds about 90K to the size of the library. The meanings of the
dvander@2762
  1978
    inbuilt class escapes such as \d and \s have NOT been changed.
dvander@2762
  1979
dvander@2762
  1980
16. Updated pcredemo.c to include calls to free() to release the memory for the
dvander@2762
  1981
    compiled pattern.
dvander@2762
  1982
dvander@2762
  1983
17. The generated file chartables.c was being created in the source directory
dvander@2762
  1984
    instead of in the building directory. This caused the build to fail if the
dvander@2762
  1985
    source directory was different from the building directory, and was
dvander@2762
  1986
    read-only.
dvander@2762
  1987
dvander@2762
  1988
18. Added some sample Win commands from Mark Tetrode into the NON-UNIX-USE
dvander@2762
  1989
    file. No doubt somebody will tell me if they don't make sense... Also added
dvander@2762
  1990
    Dan Mooney's comments about building on OpenVMS.
dvander@2762
  1991
dvander@2762
  1992
19. Added support for partial matching via the PCRE_PARTIAL option for
dvander@2762
  1993
    pcre_exec() and the \P data escape in pcretest.
dvander@2762
  1994
dvander@2762
  1995
20. Extended pcretest with 3 new pattern features:
dvander@2762
  1996
dvander@2762
  1997
    (i)   A pattern option of the form ">rest-of-line" causes pcretest to
dvander@2762
  1998
          write the compiled pattern to the file whose name is "rest-of-line".
dvander@2762
  1999
          This is a straight binary dump of the data, with the saved pointer to
dvander@2762
  2000
          the character tables forced to be NULL. The study data, if any, is
dvander@2762
  2001
          written too. After writing, pcretest reads a new pattern.
dvander@2762
  2002
dvander@2762
  2003
    (ii)  If, instead of a pattern, "<rest-of-line" is given, pcretest reads a
dvander@2762
  2004
          compiled pattern from the given file. There must not be any
dvander@2762
  2005
          occurrences of "<" in the file name (pretty unlikely); if there are,
dvander@2762
  2006
          pcretest will instead treat the initial "<" as a pattern delimiter.
dvander@2762
  2007
          After reading in the pattern, pcretest goes on to read data lines as
dvander@2762
  2008
          usual.
dvander@2762
  2009
dvander@2762
  2010
    (iii) The F pattern option causes pcretest to flip the bytes in the 32-bit
dvander@2762
  2011
          and 16-bit fields in a compiled pattern, to simulate a pattern that
dvander@2762
  2012
          was compiled on a host of opposite endianness.
dvander@2762
  2013
dvander@2762
  2014
21. The pcre-exec() function can now cope with patterns that were compiled on
dvander@2762
  2015
    hosts of opposite endianness, with this restriction:
dvander@2762
  2016
dvander@2762
  2017
      As for any compiled expression that is saved and used later, the tables
dvander@2762
  2018
      pointer field cannot be preserved; the extra_data field in the arguments
dvander@2762
  2019
      to pcre_exec() should be used to pass in a tables address if a value
dvander@2762
  2020
      other than the default internal tables were used at compile time.
dvander@2762
  2021
dvander@2762
  2022
22. Calling pcre_exec() with a negative value of the "ovecsize" parameter is
dvander@2762
  2023
    now diagnosed as an error. Previously, most of the time, a negative number
dvander@2762
  2024
    would have been treated as zero, but if in addition "ovector" was passed as
dvander@2762
  2025
    NULL, a crash could occur.
dvander@2762
  2026
dvander@2762
  2027
23. Updated the files ltmain.sh, config.sub, config.guess, and aclocal.m4 with
dvander@2762
  2028
    new versions from the libtool 1.5 distribution (the last one is a copy of
dvander@2762
  2029
    a file called libtool.m4). This seems to have fixed the need to patch
dvander@2762
  2030
    "configure" to support Darwin 1.3 (which I used to do). However, I still
dvander@2762
  2031
    had to patch ltmain.sh to ensure that ${SED} is set (it isn't on my
dvander@2762
  2032
    workstation).
dvander@2762
  2033
dvander@2762
  2034
24. Changed the PCRE licence to be the more standard "BSD" licence.
dvander@2762
  2035
dvander@2762
  2036
dvander@2762
  2037
Version 4.5 01-Dec-03
dvander@2762
  2038
---------------------
dvander@2762
  2039
dvander@2762
  2040
 1. There has been some re-arrangement of the code for the match() function so
dvander@2762
  2041
    that it can be compiled in a version that does not call itself recursively.
dvander@2762
  2042
    Instead, it keeps those local variables that need separate instances for
dvander@2762
  2043
    each "recursion" in a frame on the heap, and gets/frees frames whenever it
dvander@2762
  2044
    needs to "recurse". Keeping track of where control must go is done by means
dvander@2762
  2045
    of setjmp/longjmp. The whole thing is implemented by a set of macros that
dvander@2762
  2046
    hide most of the details from the main code, and operates only if
dvander@2762
  2047
    NO_RECURSE is defined while compiling pcre.c. If PCRE is built using the
dvander@2762
  2048
    "configure" mechanism, "--disable-stack-for-recursion" turns on this way of
dvander@2762
  2049
    operating.
dvander@2762
  2050
dvander@2762
  2051
    To make it easier for callers to provide specially tailored get/free
dvander@2762
  2052
    functions for this usage, two new functions, pcre_stack_malloc, and
dvander@2762
  2053
    pcre_stack_free, are used. They are always called in strict stacking order,
dvander@2762
  2054
    and the size of block requested is always the same.
dvander@2762
  2055
dvander@2762
  2056
    The PCRE_CONFIG_STACKRECURSE info parameter can be used to find out whether
dvander@2762
  2057
    PCRE has been compiled to use the stack or the heap for recursion. The
dvander@2762
  2058
    -C option of pcretest uses this to show which version is compiled.
dvander@2762
  2059
dvander@2762
  2060
    A new data escape \S, is added to pcretest; it causes the amounts of store
dvander@2762
  2061
    obtained and freed by both kinds of malloc/free at match time to be added
dvander@2762
  2062
    to the output.
dvander@2762
  2063
dvander@2762
  2064
 2. Changed the locale test to use "fr_FR" instead of "fr" because that's
dvander@2762
  2065
    what's available on my current Linux desktop machine.
dvander@2762
  2066
dvander@2762
  2067
 3. When matching a UTF-8 string, the test for a valid string at the start has
dvander@2762
  2068
    been extended. If start_offset is not zero, PCRE now checks that it points
dvander@2762
  2069
    to a byte that is the start of a UTF-8 character. If not, it returns
dvander@2762
  2070
    PCRE_ERROR_BADUTF8_OFFSET (-11). Note: the whole string is still checked;
dvander@2762
  2071
    this is necessary because there may be backward assertions in the pattern.
dvander@2762
  2072
    When matching the same subject several times, it may save resources to use
dvander@2762
  2073
    PCRE_NO_UTF8_CHECK on all but the first call if the string is long.
dvander@2762
  2074
dvander@2762
  2075
 4. The code for checking the validity of UTF-8 strings has been tightened so
dvander@2762
  2076
    that it rejects (a) strings containing 0xfe or 0xff bytes and (b) strings
dvander@2762
  2077
    containing "overlong sequences".
dvander@2762
  2078
dvander@2762
  2079
 5. Fixed a bug (appearing twice) that I could not find any way of exploiting!
dvander@2762
  2080
    I had written "if ((digitab[*p++] && chtab_digit) == 0)" where the "&&"
dvander@2762
  2081
    should have been "&", but it just so happened that all the cases this let
dvander@2762
  2082
    through by mistake were picked up later in the function.
dvander@2762
  2083
dvander@2762
  2084
 6. I had used a variable called "isblank" - this is a C99 function, causing
dvander@2762
  2085
    some compilers to warn. To avoid this, I renamed it (as "blankclass").
dvander@2762
  2086
dvander@2762
  2087
 7. Cosmetic: (a) only output another newline at the end of pcretest if it is
dvander@2762
  2088
    prompting; (b) run "./pcretest /dev/null" at the start of the test script
dvander@2762
  2089
    so the version is shown; (c) stop "make test" echoing "./RunTest".
dvander@2762
  2090
dvander@2762
  2091
 8. Added patches from David Burgess to enable PCRE to run on EBCDIC systems.
dvander@2762
  2092
dvander@2762
  2093
 9. The prototype for memmove() for systems that don't have it was using
dvander@2762
  2094
    size_t, but the inclusion of the header that defines size_t was later. I've
dvander@2762
  2095
    moved the #includes for the C headers earlier to avoid this.
dvander@2762
  2096
dvander@2762
  2097
10. Added some adjustments to the code to make it easier to compiler on certain
dvander@2762
  2098
    special systems:
dvander@2762
  2099
dvander@2762
  2100
      (a) Some "const" qualifiers were missing.
dvander@2762
  2101
      (b) Added the macro EXPORT before all exported functions; by default this
dvander@2762
  2102
          is defined to be empty.
dvander@2762
  2103
      (c) Changed the dftables auxiliary program (that builds chartables.c) so
dvander@2762
  2104
          that it reads its output file name as an argument instead of writing
dvander@2762
  2105
          to the standard output and assuming this can be redirected.
dvander@2762
  2106
dvander@2762
  2107
11. In UTF-8 mode, if a recursive reference (e.g. (?1)) followed a character
dvander@2762
  2108
    class containing characters with values greater than 255, PCRE compilation
dvander@2762
  2109
    went into a loop.
dvander@2762
  2110
dvander@2762
  2111
12. A recursive reference to a subpattern that was within another subpattern
dvander@2762
  2112
    that had a minimum quantifier of zero caused PCRE to crash. For example,
dvander@2762
  2113
    (x(y(?2))z)? provoked this bug with a subject that got as far as the
dvander@2762
  2114
    recursion. If the recursively-called subpattern itself had a zero repeat,
dvander@2762
  2115
    that was OK.
dvander@2762
  2116
dvander@2762
  2117
13. In pcretest, the buffer for reading a data line was set at 30K, but the
dvander@2762
  2118
    buffer into which it was copied (for escape processing) was still set at
dvander@2762
  2119
    1024, so long lines caused crashes.
dvander@2762
  2120
dvander@2762
  2121
14. A pattern such as /[ab]{1,3}+/ failed to compile, giving the error
dvander@2762
  2122
    "internal error: code overflow...". This applied to any character class
dvander@2762
  2123
    that was followed by a possessive quantifier.
dvander@2762
  2124
dvander@2762
  2125
15. Modified the Makefile to add libpcre.la as a prerequisite for
dvander@2762
  2126
    libpcreposix.la because I was told this is needed for a parallel build to
dvander@2762
  2127
    work.
dvander@2762
  2128
dvander@2762
  2129
16. If a pattern that contained .* following optional items at the start was
dvander@2762
  2130
    studied, the wrong optimizing data was generated, leading to matching
dvander@2762
  2131
    errors. For example, studying /[ab]*.*c/ concluded, erroneously, that any
dvander@2762
  2132
    matching string must start with a or b or c. The correct conclusion for
dvander@2762
  2133
    this pattern is that a match can start with any character.
dvander@2762
  2134
dvander@2762
  2135
dvander@2762
  2136
Version 4.4 13-Aug-03
dvander@2762
  2137
---------------------
dvander@2762
  2138
dvander@2762
  2139
 1. In UTF-8 mode, a character class containing characters with values between
dvander@2762
  2140
    127 and 255 was not handled correctly if the compiled pattern was studied.
dvander@2762
  2141
    In fixing this, I have also improved the studying algorithm for such
dvander@2762
  2142
    classes (slightly).
dvander@2762
  2143
dvander@2762
  2144
 2. Three internal functions had redundant arguments passed to them. Removal
dvander@2762
  2145
    might give a very teeny performance improvement.
dvander@2762
  2146
dvander@2762
  2147
 3. Documentation bug: the value of the capture_top field in a callout is *one
dvander@2762
  2148
    more than* the number of the hightest numbered captured substring.
dvander@2762
  2149
dvander@2762
  2150
 4. The Makefile linked pcretest and pcregrep with -lpcre, which could result
dvander@2762
  2151
    in incorrectly linking with a previously installed version. They now link
dvander@2762
  2152
    explicitly with libpcre.la.
dvander@2762
  2153
dvander@2762
  2154
 5. configure.in no longer needs to recognize Cygwin specially.
dvander@2762
  2155
dvander@2762
  2156
 6. A problem in pcre.in for Windows platforms is fixed.
dvander@2762
  2157
dvander@2762
  2158
 7. If a pattern was successfully studied, and the -d (or /D) flag was given to
dvander@2762
  2159
    pcretest, it used to include the size of the study block as part of its
dvander@2762
  2160
    output. Unfortunately, the structure contains a field that has a different
dvander@2762
  2161
    size on different hardware architectures. This meant that the tests that
dvander@2762
  2162
    showed this size failed. As the block is currently always of a fixed size,
dvander@2762
  2163
    this information isn't actually particularly useful in pcretest output, so
dvander@2762
  2164
    I have just removed it.
dvander@2762
  2165
dvander@2762
  2166
 8. Three pre-processor statements accidentally did not start in column 1.
dvander@2762
  2167
    Sadly, there are *still* compilers around that complain, even though
dvander@2762
  2168
    standard C has not required this for well over a decade. Sigh.
dvander@2762
  2169
dvander@2762
  2170
 9. In pcretest, the code for checking callouts passed small integers in the
dvander@2762
  2171
    callout_data field, which is a void * field. However, some picky compilers
dvander@2762
  2172
    complained about the casts involved for this on 64-bit systems. Now
dvander@2762
  2173
    pcretest passes the address of the small integer instead, which should get
dvander@2762
  2174
    rid of the warnings.
dvander@2762
  2175
dvander@2762
  2176
10. By default, when in UTF-8 mode, PCRE now checks for valid UTF-8 strings at
dvander@2762
  2177
    both compile and run time, and gives an error if an invalid UTF-8 sequence
dvander@2762
  2178
    is found. There is a option for disabling this check in cases where the
dvander@2762
  2179
    string is known to be correct and/or the maximum performance is wanted.
dvander@2762
  2180
dvander@2762
  2181
11. In response to a bug report, I changed one line in Makefile.in from
dvander@2762
  2182
dvander@2762
  2183
        -Wl,--out-implib,.libs/lib@[email protected] \
dvander@2762
  2184
    to
dvander@2762
  2185
        -Wl,--out-implib,.libs/@[email protected] \
dvander@2762
  2186
dvander@2762
  2187
    to look similar to other lines, but I have no way of telling whether this
dvander@2762
  2188
    is the right thing to do, as I do not use Windows. No doubt I'll get told
dvander@2762
  2189
    if it's wrong...
dvander@2762
  2190
dvander@2762
  2191
dvander@2762
  2192
Version 4.3 21-May-03
dvander@2762
  2193
---------------------
dvander@2762
  2194
dvander@2762
  2195
1. Two instances of @WIN_PREFIX@ omitted from the Windows targets in the
dvander@2762
  2196
   Makefile.
dvander@2762
  2197
dvander@2762
  2198
2. Some refactoring to improve the quality of the code:
dvander@2762
  2199
dvander@2762
  2200
   (i)   The utf8_table... variables are now declared "const".
dvander@2762
  2201
dvander@2762
  2202
   (ii)  The code for \cx, which used the "case flipping" table to upper case
dvander@2762
  2203
         lower case letters, now just substracts 32. This is ASCII-specific,
dvander@2762
  2204
         but the whole concept of \cx is ASCII-specific, so it seems
dvander@2762
  2205
         reasonable.
dvander@2762
  2206
dvander@2762
  2207
   (iii) PCRE was using its character types table to recognize decimal and
dvander@2762
  2208
         hexadecimal digits in the pattern. This is silly, because it handles
dvander@2762
  2209
         only 0-9, a-f, and A-F, but the character types table is locale-
dvander@2762
  2210
         specific, which means strange things might happen. A private
dvander@2762
  2211
         table is now used for this - though it costs 256 bytes, a table is
dvander@2762
  2212
         much faster than multiple explicit tests. Of course, the standard
dvander@2762
  2213
         character types table is still used for matching digits in subject
dvander@2762
  2214
         strings against \d.
dvander@2762
  2215
dvander@2762
  2216
   (iv)  Strictly, the identifier ESC_t is reserved by POSIX (all identifiers
dvander@2762
  2217
         ending in _t are). So I've renamed it as ESC_tee.
dvander@2762
  2218
dvander@2762
  2219
3. The first argument for regexec() in the POSIX wrapper should have been
dvander@2762
  2220
   defined as "const".
dvander@2762
  2221
dvander@2762
  2222
4. Changed pcretest to use malloc() for its buffers so that they can be
dvander@2762
  2223
   Electric Fenced for debugging.
dvander@2762
  2224
dvander@2762
  2225
5. There were several places in the code where, in UTF-8 mode, PCRE would try
dvander@2762
  2226
   to read one or more bytes before the start of the subject string. Often this
dvander@2762
  2227
   had no effect on PCRE's behaviour, but in some circumstances it could
dvander@2762
  2228
   provoke a segmentation fault.
dvander@2762
  2229
dvander@2762
  2230
6. A lookbehind at the start of a pattern in UTF-8 mode could also cause PCRE
dvander@2762
  2231
   to try to read one or more bytes before the start of the subject string.
dvander@2762
  2232
dvander@2762
  2233
7. A lookbehind in a pattern matched in non-UTF-8 mode on a PCRE compiled with
dvander@2762
  2234
   UTF-8 support could misbehave in various ways if the subject string
dvander@2762
  2235
   contained bytes with the 0x80 bit set and the 0x40 bit unset in a lookbehind
dvander@2762
  2236
   area. (PCRE was not checking for the UTF-8 mode flag, and trying to move
dvander@2762
  2237
   back over UTF-8 characters.)
dvander@2762
  2238
dvander@2762
  2239
dvander@2762
  2240
Version 4.2 14-Apr-03
dvander@2762
  2241
---------------------
dvander@2762
  2242
dvander@2762
  2243
1. Typo "#if SUPPORT_UTF8" instead of "#ifdef SUPPORT_UTF8" fixed.
dvander@2762
  2244
dvander@2762
  2245
2. Changes to the building process, supplied by Ronald Landheer-Cieslak
dvander@2762
  2246
     [ON_WINDOWS]: new variable, "#" on non-Windows platforms
dvander@2762
  2247
     [NOT_ON_WINDOWS]: new variable, "#" on Windows platforms
dvander@2762
  2248
     [WIN_PREFIX]: new variable, "cyg" for Cygwin
dvander@2762
  2249
     * Makefile.in: use autoconf substitution for OBJEXT, EXEEXT, BUILD_OBJEXT
dvander@2762
  2250
       and BUILD_EXEEXT
dvander@2762
  2251
     Note: automatic setting of the BUILD variables is not yet working
dvander@2762
  2252
     set CPPFLAGS and BUILD_CPPFLAGS (but don't use yet) - should be used at
dvander@2762
  2253
       compile-time but not at link-time
dvander@2762
  2254
     [LINK]: use for linking executables only
dvander@2762
  2255
     make different versions for Windows and non-Windows
dvander@2762
  2256
     [LINKLIB]: new variable, copy of UNIX-style LINK, used for linking
dvander@2762
  2257
       libraries
dvander@2762
  2258
     [LINK_FOR_BUILD]: new variable
dvander@2762
  2259
     [OBJEXT]: use throughout
dvander@2762
  2260
     [EXEEXT]: use throughout
dvander@2762
  2261
     <winshared>: new target
dvander@2762
  2262
     <wininstall>: new target
dvander@2762
  2263
     <dftables.o>: use native compiler
dvander@2762
  2264
     <dftables>: use native linker
dvander@2762
  2265
     <install>: handle Windows platform correctly
dvander@2762
  2266
     <clean>: ditto
dvander@2762
  2267
     <check>: ditto
dvander@2762
  2268
     copy DLL to top builddir before testing
dvander@2762
  2269
dvander@2762
  2270
   As part of these changes, -no-undefined was removed again. This was reported
dvander@2762
  2271
   to give trouble on HP-UX 11.0, so getting rid of it seems like a good idea
dvander@2762
  2272
   in any case.
dvander@2762
  2273
dvander@2762
  2274
3. Some tidies to get rid of compiler warnings:
dvander@2762
  2275
dvander@2762
  2276
   . In the match_data structure, match_limit was an unsigned long int, whereas
dvander@2762
  2277
     match_call_count was an int. I've made them both unsigned long ints.
dvander@2762
  2278
dvander@2762
  2279
   . In pcretest the fact that a const uschar * doesn't automatically cast to
dvander@2762
  2280
     a void * provoked a warning.
dvander@2762
  2281
dvander@2762
  2282
   . Turning on some more compiler warnings threw up some "shadow" variables
dvander@2762
  2283
     and a few more missing casts.
dvander@2762
  2284
dvander@2762
  2285
4. If PCRE was complied with UTF-8 support, but called without the PCRE_UTF8
dvander@2762
  2286
   option, a class that contained a single character with a value between 128
dvander@2762
  2287
   and 255 (e.g. /[\xFF]/) caused PCRE to crash.
dvander@2762
  2288
dvander@2762
  2289
5. If PCRE was compiled with UTF-8 support, but called without the PCRE_UTF8
dvander@2762
  2290
   option, a class that contained several characters, but with at least one
dvander@2762
  2291
   whose value was between 128 and 255 caused PCRE to crash.
dvander@2762
  2292
dvander@2762
  2293
dvander@2762
  2294
Version 4.1 12-Mar-03
dvander@2762
  2295
---------------------
dvander@2762
  2296
dvander@2762
  2297
1. Compiling with gcc -pedantic found a couple of places where casts were
dvander@2762
  2298
needed, and a string in dftables.c that was longer than standard compilers are
dvander@2762
  2299
required to support.
dvander@2762
  2300
dvander@2762
  2301
2. Compiling with Sun's compiler found a few more places where the code could
dvander@2762
  2302
be tidied up in order to avoid warnings.
dvander@2762
  2303
dvander@2762
  2304
3. The variables for cross-compiling were called HOST_CC and HOST_CFLAGS; the
dvander@2762
  2305
first of these names is deprecated in the latest Autoconf in favour of the name
dvander@2762
  2306
CC_FOR_BUILD, because "host" is typically used to mean the system on which the
dvander@2762
  2307
compiled code will be run. I can't find a reference for HOST_CFLAGS, but by
dvander@2762
  2308
analogy I have changed it to CFLAGS_FOR_BUILD.
dvander@2762
  2309
dvander@2762
  2310
4. Added -no-undefined to the linking command in the Makefile, because this is
dvander@2762
  2311
apparently helpful for Windows. To make it work, also added "-L. -lpcre" to the
dvander@2762
  2312
linking step for the pcreposix library.
dvander@2762
  2313
dvander@2762
  2314
5. PCRE was failing to diagnose the case of two named groups with the same
dvander@2762
  2315
name.
dvander@2762
  2316
dvander@2762
  2317
6. A problem with one of PCRE's optimizations was discovered. PCRE remembers a
dvander@2762
  2318
literal character that is needed in the subject for a match, and scans along to
dvander@2762
  2319
ensure that it is present before embarking on the full matching process. This
dvander@2762
  2320
saves time in cases of nested unlimited repeats that are never going to match.
dvander@2762
  2321
Problem: the scan can take a lot of time if the subject is very long (e.g.
dvander@2762
  2322
megabytes), thus penalizing straightforward matches. It is now done only if the
dvander@2762
  2323
amount of subject to be scanned is less than 1000 bytes.
dvander@2762
  2324
dvander@2762
  2325
7. A lesser problem with the same optimization is that it was recording the
dvander@2762
  2326
first character of an anchored pattern as "needed", thus provoking a search
dvander@2762
  2327
right along the subject, even when the first match of the pattern was going to
dvander@2762
  2328
fail. The "needed" character is now not set for anchored patterns, unless it
dvander@2762
  2329
follows something in the pattern that is of non-fixed length. Thus, it still
dvander@2762
  2330
fulfils its original purpose of finding quick non-matches in cases of nested
dvander@2762
  2331
unlimited repeats, but isn't used for simple anchored patterns such as /^abc/.
dvander@2762
  2332
dvander@2762
  2333
dvander@2762
  2334
Version 4.0 17-Feb-03
dvander@2762
  2335
---------------------
dvander@2762
  2336
dvander@2762
  2337
1. If a comment in an extended regex that started immediately after a meta-item
dvander@2762
  2338
extended to the end of string, PCRE compiled incorrect data. This could lead to
dvander@2762
  2339
all kinds of weird effects. Example: /#/ was bad; /()#/ was bad; /a#/ was not.
dvander@2762
  2340
dvander@2762
  2341
2. Moved to autoconf 2.53 and libtool 1.4.2.
dvander@2762
  2342
dvander@2762
  2343
3. Perl 5.8 no longer needs "use utf8" for doing UTF-8 things. Consequently,
dvander@2762
  2344
the special perltest8 script is no longer needed - all the tests can be run
dvander@2762
  2345
from a single perltest script.
dvander@2762
  2346
dvander@2762
  2347
4. From 5.004, Perl has not included the VT character (0x0b) in the set defined
dvander@2762
  2348
by \s. It has now been removed in PCRE. This means it isn't recognized as
dvander@2762
  2349
whitespace in /x regexes too, which is the same as Perl. Note that the POSIX
dvander@2762
  2350
class [:space:] *does* include VT, thereby creating a mess.
dvander@2762
  2351
dvander@2762
  2352
5. Added the class [:blank:] (a GNU extension from Perl 5.8) to match only
dvander@2762
  2353
space and tab.
dvander@2762
  2354
dvander@2762
  2355
6. Perl 5.005 was a long time ago. It's time to amalgamate the tests that use
dvander@2762
  2356
its new features into the main test script, reducing the number of scripts.
dvander@2762
  2357
dvander@2762
  2358
7. Perl 5.8 has changed the meaning of patterns like /a(?i)b/. Earlier versions
dvander@2762
  2359
were backward compatible, and made the (?i) apply to the whole pattern, as if
dvander@2762
  2360
/i were given. Now it behaves more logically, and applies the option setting
dvander@2762
  2361
only to what follows. PCRE has been changed to follow suit. However, if it
dvander@2762
  2362
finds options settings right at the start of the pattern, it extracts them into
dvander@2762
  2363
the global options, as before. Thus, they show up in the info data.
dvander@2762
  2364
dvander@2762
  2365
8. Added support for the \Q...\E escape sequence. Characters in between are
dvander@2762
  2366
treated as literals. This is slightly different from Perl in that $ and @ are
dvander@2762
  2367
also handled as literals inside the quotes. In Perl, they will cause variable
dvander@2762
  2368
interpolation. Note the following examples:
dvander@2762
  2369
dvander@2762
  2370
    Pattern            PCRE matches      Perl matches
dvander@2762
  2371
dvander@2762
  2372
    \Qabc$xyz\E        abc$xyz           abc followed by the contents of $xyz
dvander@2762
  2373
    \Qabc\$xyz\E       abc\$xyz          abc\$xyz
dvander@2762
  2374
    \Qabc\E\$\Qxyz\E   abc$xyz           abc$xyz
dvander@2762
  2375
dvander@2762
  2376
For compatibility with Perl, \Q...\E sequences are recognized inside character
dvander@2762
  2377
classes as well as outside them.
dvander@2762
  2378
dvander@2762
  2379
9. Re-organized 3 code statements in pcretest to avoid "overflow in
dvander@2762
  2380
floating-point constant arithmetic" warnings from a Microsoft compiler. Added a
dvander@2762
  2381
(size_t) cast to one statement in pcretest and one in pcreposix to avoid
dvander@2762
  2382
signed/unsigned warnings.
dvander@2762
  2383
dvander@2762
  2384
10. SunOS4 doesn't have strtoul(). This was used only for unpicking the -o
dvander@2762
  2385
option for pcretest, so I've replaced it by a simple function that does just
dvander@2762
  2386
that job.
dvander@2762
  2387
dvander@2762
  2388
11. pcregrep was ending with code 0 instead of 2 for the commands "pcregrep" or
dvander@2762
  2389
"pcregrep -".
dvander@2762
  2390
dvander@2762
  2391
12. Added "possessive quantifiers" ?+, *+, ++, and {,}+ which come from Sun's
dvander@2762
  2392
Java package. This provides some syntactic sugar for simple cases of what my
dvander@2762
  2393
documentation calls "once-only subpatterns". A pattern such as x*+ is the same
dvander@2762
  2394
as (?>x*). In other words, if what is inside (?>...) is just a single repeated
dvander@2762
  2395
item, you can use this simplified notation. Note that only makes sense with
dvander@2762
  2396
greedy quantifiers. Consequently, the use of the possessive quantifier forces
dvander@2762
  2397
greediness, whatever the setting of the PCRE_UNGREEDY option.
dvander@2762
  2398
dvander@2762
  2399
13. A change of greediness default within a pattern was not taking effect at
dvander@2762
  2400
the current level for patterns like /(b+(?U)a+)/. It did apply to parenthesized
dvander@2762
  2401
subpatterns that followed. Patterns like /b+(?U)a+/ worked because the option
dvander@2762
  2402
was abstracted outside.
dvander@2762
  2403
dvander@2762
  2404
14. PCRE now supports the \G assertion. It is true when the current matching
dvander@2762
  2405
position is at the start point of the match. This differs from \A when the
dvander@2762
  2406
starting offset is non-zero. Used with the /g option of pcretest (or similar
dvander@2762
  2407
code), it works in the same way as it does for Perl's /g option. If all
dvander@2762
  2408
alternatives of a regex begin with \G, the expression is anchored to the start
dvander@2762
  2409
match position, and the "anchored" flag is set in the compiled expression.
dvander@2762
  2410
dvander@2762
  2411
15. Some bugs concerning the handling of certain option changes within patterns
dvander@2762
  2412
have been fixed. These applied to options other than (?ims). For example,
dvander@2762
  2413
"a(?x: b c )d" did not match "XabcdY" but did match "Xa b c dY". It should have
dvander@2762
  2414
been the other way round. Some of this was related to change 7 above.
dvander@2762
  2415
dvander@2762
  2416
16. PCRE now gives errors for /[.x.]/ and /[=x=]/ as unsupported POSIX
dvander@2762
  2417
features, as Perl does. Previously, PCRE gave the warnings only for /[[.x.]]/
dvander@2762
  2418
and /[[=x=]]/. PCRE now also gives an error for /[:name:]/ because it supports
dvander@2762
  2419
POSIX classes only within a class (e.g. /[[:alpha:]]/).
dvander@2762
  2420
dvander@2762
  2421
17. Added support for Perl's \C escape. This matches one byte, even in UTF8
dvander@2762
  2422
mode. Unlike ".", it always matches newline, whatever the setting of
dvander@2762
  2423
PCRE_DOTALL. However, PCRE does not permit \C to appear in lookbehind
dvander@2762
  2424
assertions. Perl allows it, but it doesn't (in general) work because it can't
dvander@2762
  2425
calculate the length of the lookbehind. At least, that's the case for Perl
dvander@2762
  2426
5.8.0 - I've been told they are going to document that it doesn't work in
dvander@2762
  2427
future.
dvander@2762
  2428
dvander@2762
  2429
18. Added an error diagnosis for escapes that PCRE does not support: these are
dvander@2762
  2430
\L, \l, \N, \P, \p, \U, \u, and \X.
dvander@2762
  2431
dvander@2762
  2432
19. Although correctly diagnosing a missing ']' in a character class, PCRE was
dvander@2762
  2433
reading past the end of the pattern in cases such as /[abcd/.
dvander@2762
  2434
dvander@2762
  2435
20. PCRE was getting more memory than necessary for patterns with classes that
dvander@2762
  2436
contained both POSIX named classes and other characters, e.g. /[[:space:]abc/.
dvander@2762
  2437
dvander@2762
  2438
21. Added some code, conditional on #ifdef VPCOMPAT, to make life easier for
dvander@2762
  2439
compiling PCRE for use with Virtual Pascal.
dvander@2762
  2440
dvander@2762
  2441
22. Small fix to the Makefile to make it work properly if the build is done
dvander@2762
  2442
outside the source tree.
dvander@2762
  2443
dvander@2762
  2444
23. Added a new extension: a condition to go with recursion. If a conditional
dvander@2762
  2445
subpattern starts with (?(R) the "true" branch is used if recursion has
dvander@2762
  2446
happened, whereas the "false" branch is used only at the top level.
dvander@2762
  2447
dvander@2762
  2448
24. When there was a very long string of literal characters (over 255 bytes
dvander@2762
  2449
without UTF support, over 250 bytes with UTF support), the computation of how
dvander@2762
  2450
much memory was required could be incorrect, leading to segfaults or other
dvander@2762
  2451
strange effects.
dvander@2762
  2452
dvander@2762
  2453
25. PCRE was incorrectly assuming anchoring (either to start of subject or to
dvander@2762
  2454
start of line for a non-DOTALL pattern) when a pattern started with (.*) and
dvander@2762
  2455
there was a subsequent back reference to those brackets. This meant that, for
dvander@2762
  2456
example, /(.*)\d+\1/ failed to match "abc123bc". Unfortunately, it isn't
dvander@2762
  2457
possible to check for precisely this case. All we can do is abandon the
dvander@2762
  2458
optimization if .* occurs inside capturing brackets when there are any back
dvander@2762
  2459
references whatsoever. (See below for a better fix that came later.)
dvander@2762
  2460
dvander@2762
  2461
26. The handling of the optimization for finding the first character of a
dvander@2762
  2462
non-anchored pattern, and for finding a character that is required later in the
dvander@2762
  2463
match were failing in some cases. This didn't break the matching; it just
dvander@2762
  2464
failed to optimize when it could. The way this is done has been re-implemented.
dvander@2762
  2465
dvander@2762
  2466
27. Fixed typo in error message for invalid (?R item (it said "(?p").
dvander@2762
  2467
dvander@2762
  2468
28. Added a new feature that provides some of the functionality that Perl
dvander@2762
  2469
provides with (?{...}). The facility is termed a "callout". The way it is done
dvander@2762
  2470
in PCRE is for the caller to provide an optional function, by setting
dvander@2762
  2471
pcre_callout to its entry point. Like pcre_malloc and pcre_free, this is a
dvander@2762
  2472
global variable. By default it is unset, which disables all calling out. To get
dvander@2762
  2473
the function called, the regex must include (?C) at appropriate points. This
dvander@2762
  2474
is, in fact, equivalent to (?C0), and any number <= 255 may be given with (?C).
dvander@2762
  2475
This provides a means of identifying different callout points. When PCRE
dvander@2762
  2476
reaches such a point in the regex, if pcre_callout has been set, the external
dvander@2762
  2477
function is called. It is provided with data in a structure called
dvander@2762
  2478
pcre_callout_block, which is defined in pcre.h. If the function returns 0,
dvander@2762
  2479
matching continues; if it returns a non-zero value, the match at the current
dvander@2762
  2480
point fails. However, backtracking will occur if possible. [This was changed
dvander@2762
  2481
later and other features added - see item 49 below.]
dvander@2762
  2482
dvander@2762
  2483
29. pcretest is upgraded to test the callout functionality. It provides a
dvander@2762
  2484
callout function that displays information. By default, it shows the start of
dvander@2762
  2485
the match and the current position in the text. There are some new data escapes
dvander@2762
  2486
to vary what happens:
dvander@2762
  2487
dvander@2762
  2488
    \C+         in addition, show current contents of captured substrings
dvander@2762
  2489
    \C-         do not supply a callout function
dvander@2762
  2490
    \C!n        return 1 when callout number n is reached
dvander@2762
  2491
    \C!n!m      return 1 when callout number n is reached for the mth time
dvander@2762
  2492
dvander@2762
  2493
30. If pcregrep was called with the -l option and just a single file name, it
dvander@2762
  2494
output "<stdin>" if a match was found, instead of the file name.
dvander@2762
  2495
dvander@2762
  2496
31. Improve the efficiency of the POSIX API to PCRE. If the number of capturing
dvander@2762
  2497
slots is less than POSIX_MALLOC_THRESHOLD, use a block on the stack to pass to
dvander@2762
  2498
pcre_exec(). This saves a malloc/free per call. The default value of
dvander@2762
  2499
POSIX_MALLOC_THRESHOLD is 10; it can be changed by --with-posix-malloc-threshold
dvander@2762
  2500
when configuring.
dvander@2762
  2501
dvander@2762
  2502
32. The default maximum size of a compiled pattern is 64K. There have been a
dvander@2762
  2503
few cases of people hitting this limit. The code now uses macros to handle the
dvander@2762
  2504
storing of links as offsets within the compiled pattern. It defaults to 2-byte
dvander@2762
  2505
links, but this can be changed to 3 or 4 bytes by --with-link-size when
dvander@2762
  2506
configuring. Tests 2 and 5 work only with 2-byte links because they output
dvander@2762
  2507
debugging information about compiled patterns.
dvander@2762
  2508
dvander@2762
  2509
33. Internal code re-arrangements:
dvander@2762
  2510
dvander@2762
  2511
(a) Moved the debugging function for printing out a compiled regex into
dvander@2762
  2512
    its own source file (printint.c) and used #include to pull it into
dvander@2762
  2513
    pcretest.c and, when DEBUG is defined, into pcre.c, instead of having two
dvander@2762
  2514
    separate copies.
dvander@2762
  2515
dvander@2762
  2516
(b) Defined the list of op-code names for debugging as a macro in
dvander@2762
  2517
    internal.h so that it is next to the definition of the opcodes.
dvander@2762
  2518
dvander@2762
  2519
(c) Defined a table of op-code lengths for simpler skipping along compiled
dvander@2762
  2520
    code. This is again a macro in internal.h so that it is next to the
dvander@2762
  2521
    definition of the opcodes.
dvander@2762
  2522
dvander@2762
  2523
34. Added support for recursive calls to individual subpatterns, along the
dvander@2762
  2524
lines of Robin Houston's patch (but implemented somewhat differently).
dvander@2762
  2525
dvander@2762
  2526
35. Further mods to the Makefile to help Win32. Also, added code to pcregrep to
dvander@2762
  2527
allow it to read and process whole directories in Win32. This code was
dvander@2762
  2528
contributed by Lionel Fourquaux; it has not been tested by me.
dvander@2762
  2529
dvander@2762
  2530
36. Added support for named subpatterns. The Python syntax (?P<name>...) is
dvander@2762
  2531
used to name a group. Names consist of alphanumerics and underscores, and must
dvander@2762
  2532
be unique. Back references use the syntax (?P=name) and recursive calls use
dvander@2762
  2533
(?P>name) which is a PCRE extension to the Python extension. Groups still have
dvander@2762
  2534
numbers. The function pcre_fullinfo() can be used after compilation to extract
dvander@2762
  2535
a name/number map. There are three relevant calls:
dvander@2762
  2536
dvander@2762
  2537
  PCRE_INFO_NAMEENTRYSIZE        yields the size of each entry in the map
dvander@2762
  2538
  PCRE_INFO_NAMECOUNT            yields the number of entries
dvander@2762
  2539
  PCRE_INFO_NAMETABLE            yields a pointer to the map.
dvander@2762
  2540
dvander@2762
  2541
The map is a vector of fixed-size entries. The size of each entry depends on
dvander@2762
  2542
the length of the longest name used. The first two bytes of each entry are the
dvander@2762
  2543
group number, most significant byte first. There follows the corresponding
dvander@2762
  2544
name, zero terminated. The names are in alphabetical order.
dvander@2762
  2545
dvander@2762
  2546
37. Make the maximum literal string in the compiled code 250 for the non-UTF-8
dvander@2762
  2547
case instead of 255. Making it the same both with and without UTF-8 support
dvander@2762
  2548
means that the same test output works with both.
dvander@2762
  2549
dvander@2762
  2550
38. There was a case of malloc(0) in the POSIX testing code in pcretest. Avoid
dvander@2762
  2551
calling malloc() with a zero argument.
dvander@2762
  2552
dvander@2762
  2553
39. Change 25 above had to resort to a heavy-handed test for the .* anchoring
dvander@2762
  2554
optimization. I've improved things by keeping a bitmap of backreferences with
dvander@2762
  2555
numbers 1-31 so that if .* occurs inside capturing brackets that are not in
dvander@2762
  2556
fact referenced, the optimization can be applied. It is unlikely that a
dvander@2762
  2557
relevant occurrence of .* (i.e. one which might indicate anchoring or forcing
dvander@2762
  2558
the match to follow \n) will appear inside brackets with a number greater than
dvander@2762
  2559
31, but if it does, any back reference > 31 suppresses the optimization.
dvander@2762
  2560
dvander@2762
  2561
40. Added a new compile-time option PCRE_NO_AUTO_CAPTURE. This has the effect
dvander@2762
  2562
of disabling numbered capturing parentheses. Any opening parenthesis that is
dvander@2762
  2563
not followed by ? behaves as if it were followed by ?: but named parentheses
dvander@2762
  2564
can still be used for capturing (and they will acquire numbers in the usual
dvander@2762
  2565
way).
dvander@2762
  2566
dvander@2762
  2567
41. Redesigned the return codes from the match() function into yes/no/error so
dvander@2762
  2568
that errors can be passed back from deep inside the nested calls. A malloc
dvander@2762
  2569
failure while inside a recursive subpattern call now causes the
dvander@2762
  2570
PCRE_ERROR_NOMEMORY return instead of quietly going wrong.
dvander@2762
  2571
dvander@2762
  2572
42. It is now possible to set a limit on the number of times the match()
dvander@2762
  2573
function is called in a call to pcre_exec(). This facility makes it possible to
dvander@2762
  2574
limit the amount of recursion and backtracking, though not in a directly
dvander@2762
  2575
obvious way, because the match() function is used in a number of different
dvander@2762
  2576
circumstances. The count starts from zero for each position in the subject
dvander@2762
  2577
string (for non-anchored patterns). The default limit is, for compatibility, a
dvander@2762
  2578
large number, namely 10 000 000. You can change this in two ways:
dvander@2762
  2579
dvander@2762
  2580
(a) When configuring PCRE before making, you can use --with-match-limit=n
dvander@2762
  2581
    to set a default value for the compiled library.
dvander@2762
  2582
dvander@2762
  2583
(b) For each call to pcre_exec(), you can pass a pcre_extra block in which
dvander@2762
  2584
    a different value is set. See 45 below.
dvander@2762
  2585
dvander@2762
  2586
If the limit is exceeded, pcre_exec() returns PCRE_ERROR_MATCHLIMIT.
dvander@2762
  2587
dvander@2762
  2588
43. Added a new function pcre_config(int, void *) to enable run-time extraction
dvander@2762
  2589
of things that can be changed at compile time. The first argument specifies
dvander@2762
  2590
what is wanted and the second points to where the information is to be placed.
dvander@2762
  2591
The current list of available information is:
dvander@2762
  2592
dvander@2762
  2593
  PCRE_CONFIG_UTF8
dvander@2762
  2594
dvander@2762
  2595
The output is an integer that is set to one if UTF-8 support is available;
dvander@2762
  2596
otherwise it is set to zero.
dvander@2762
  2597
dvander@2762
  2598
  PCRE_CONFIG_NEWLINE
dvander@2762
  2599
dvander@2762
  2600
The output is an integer that it set to the value of the code that is used for
dvander@2762
  2601
newline. It is either LF (10) or CR (13).
dvander@2762
  2602
dvander@2762
  2603
  PCRE_CONFIG_LINK_SIZE
dvander@2762
  2604
dvander@2762
  2605
The output is an integer that contains the number of bytes used for internal
dvander@2762
  2606
linkage in compiled expressions. The value is 2, 3, or 4. See item 32 above.
dvander@2762
  2607
dvander@2762
  2608
  PCRE_CONFIG_POSIX_MALLOC_THRESHOLD
dvander@2762
  2609
dvander@2762
  2610
The output is an integer that contains the threshold above which the POSIX
dvander@2762
  2611
interface uses malloc() for output vectors. See item 31 above.
dvander@2762
  2612
dvander@2762
  2613
  PCRE_CONFIG_MATCH_LIMIT
dvander@2762
  2614
dvander@2762
  2615
The output is an unsigned integer that contains the default limit of the number
dvander@2762
  2616
of match() calls in a pcre_exec() execution. See 42 above.
dvander@2762
  2617
dvander@2762
  2618
44. pcretest has been upgraded by the addition of the -C option. This causes it
dvander@2762
  2619
to extract all the available output from the new pcre_config() function, and to
dvander@2762
  2620
output it. The program then exits immediately.
dvander@2762
  2621
dvander@2762
  2622
45. A need has arisen to pass over additional data with calls to pcre_exec() in
dvander@2762
  2623
order to support additional features. One way would have been to define
dvander@2762
  2624
pcre_exec2() (for example) with extra arguments, but this would not have been
dvander@2762
  2625
extensible, and would also have required all calls to the original function to
dvander@2762
  2626
be mapped to the new one. Instead, I have chosen to extend the mechanism that
dvander@2762
  2627
is used for passing in "extra" data from pcre_study().
dvander@2762
  2628
dvander@2762
  2629
The pcre_extra structure is now exposed and defined in pcre.h. It currently
dvander@2762
  2630
contains the following fields:
dvander@2762
  2631
dvander@2762
  2632
  flags         a bitmap indicating which of the following fields are set
dvander@2762
  2633
  study_data    opaque data from pcre_study()
dvander@2762
  2634
  match_limit   a way of specifying a limit on match() calls for a specific
dvander@2762
  2635
                  call to pcre_exec()
dvander@2762
  2636
  callout_data  data for callouts (see 49 below)
dvander@2762
  2637
dvander@2762
  2638
The flag bits are also defined in pcre.h, and are
dvander@2762
  2639
dvander@2762
  2640
  PCRE_EXTRA_STUDY_DATA
dvander@2762
  2641
  PCRE_EXTRA_MATCH_LIMIT
dvander@2762
  2642
  PCRE_EXTRA_CALLOUT_DATA
dvander@2762
  2643
dvander@2762
  2644
The pcre_study() function now returns one of these new pcre_extra blocks, with
dvander@2762
  2645
the actual study data pointed to by the study_data field, and the
dvander@2762
  2646
PCRE_EXTRA_STUDY_DATA flag set. This can be passed directly to pcre_exec() as
dvander@2762
  2647
before. That is, this change is entirely upwards-compatible and requires no
dvander@2762
  2648
change to existing code.
dvander@2762
  2649
dvander@2762
  2650
If you want to pass in additional data to pcre_exec(), you can either place it
dvander@2762
  2651
in a pcre_extra block provided by pcre_study(), or create your own pcre_extra
dvander@2762
  2652
block.
dvander@2762
  2653
dvander@2762
  2654
46. pcretest has been extended to test the PCRE_EXTRA_MATCH_LIMIT feature. If a
dvander@2762
  2655
data string contains the escape sequence \M, pcretest calls pcre_exec() several
dvander@2762
  2656
times with different match limits, until it finds the minimum value needed for
dvander@2762
  2657
pcre_exec() to complete. The value is then output. This can be instructive; for
dvander@2762
  2658
most simple matches the number is quite small, but for pathological cases it
dvander@2762
  2659
gets very large very quickly.
dvander@2762
  2660
dvander@2762
  2661
47. There's a new option for pcre_fullinfo() called PCRE_INFO_STUDYSIZE. It
dvander@2762
  2662
returns the size of the data block pointed to by the study_data field in a
dvander@2762
  2663
pcre_extra block, that is, the value that was passed as the argument to
dvander@2762
  2664
pcre_malloc() when PCRE was getting memory in which to place the information
dvander@2762
  2665
created by pcre_study(). The fourth argument should point to a size_t variable.
dvander@2762
  2666
pcretest has been extended so that this information is shown after a successful
dvander@2762
  2667
pcre_study() call when information about the compiled regex is being displayed.
dvander@2762
  2668
dvander@2762
  2669
48. Cosmetic change to Makefile: there's no need to have / after $(DESTDIR)
dvander@2762
  2670
because what follows is always an absolute path. (Later: it turns out that this
dvander@2762
  2671
is more than cosmetic for MinGW, because it doesn't like empty path
dvander@2762
  2672
components.)
dvander@2762
  2673
dvander@2762
  2674
49. Some changes have been made to the callout feature (see 28 above):
dvander@2762
  2675
dvander@2762
  2676
(i)  A callout function now has three choices for what it returns:
dvander@2762
  2677
dvander@2762
  2678
       0  =>  success, carry on matching
dvander@2762
  2679
     > 0  =>  failure at this point, but backtrack if possible
dvander@2762
  2680
     < 0  =>  serious error, return this value from pcre_exec()
dvander@2762
  2681
dvander@2762
  2682
     Negative values should normally be chosen from the set of PCRE_ERROR_xxx
dvander@2762
  2683
     values. In particular, returning PCRE_ERROR_NOMATCH forces a standard
dvander@2762
  2684
     "match failed" error. The error number PCRE_ERROR_CALLOUT is reserved for
dvander@2762
  2685
     use by callout functions. It will never be used by PCRE itself.
dvander@2762
  2686
dvander@2762
  2687
(ii) The pcre_extra structure (see 45 above) has a void * field called
dvander@2762
  2688
     callout_data, with corresponding flag bit PCRE_EXTRA_CALLOUT_DATA. The
dvander@2762
  2689
     pcre_callout_block structure has a field of the same name. The contents of
dvander@2762
  2690
     the field passed in the pcre_extra structure are passed to the callout
dvander@2762
  2691
     function in the corresponding field in the callout block. This makes it
dvander@2762
  2692
     easier to use the same callout-containing regex from multiple threads. For
dvander@2762
  2693
     testing, the pcretest program has a new data escape
dvander@2762
  2694
dvander@2762
  2695
       \C*n        pass the number n (may be negative) as callout_data
dvander@2762
  2696
dvander@2762
  2697
     If the callout function in pcretest receives a non-zero value as
dvander@2762
  2698
     callout_data, it returns that value.
dvander@2762
  2699
dvander@2762
  2700
50. Makefile wasn't handling CFLAGS properly when compiling dftables. Also,
dvander@2762
  2701
there were some redundant $(CFLAGS) in commands that are now specified as
dvander@2762
  2702
$(LINK), which already includes $(CFLAGS).
dvander@2762
  2703
dvander@2762
  2704
51. Extensions to UTF-8 support are listed below. These all apply when (a) PCRE
dvander@2762
  2705
has been compiled with UTF-8 support *and* pcre_compile() has been compiled
dvander@2762
  2706
with the PCRE_UTF8 flag. Patterns that are compiled without that flag assume
dvander@2762
  2707
one-byte characters throughout. Note that case-insensitive matching applies
dvander@2762
  2708
only to characters whose values are less than 256. PCRE doesn't support the
dvander@2762
  2709
notion of cases for higher-valued characters.
dvander@2762
  2710
dvander@2762
  2711
(i)   A character class whose characters are all within 0-255 is handled as
dvander@2762
  2712
      a bit map, and the map is inverted for negative classes. Previously, a
dvander@2762
  2713
      character > 255 always failed to match such a class; however it should
dvander@2762
  2714
      match if the class was a negative one (e.g. [^ab]). This has been fixed.
dvander@2762
  2715
dvander@2762
  2716
(ii)  A negated character class with a single character < 255 is coded as
dvander@2762
  2717
      "not this character" (OP_NOT). This wasn't working properly when the test
dvander@2762
  2718
      character was multibyte, either singly or repeated.
dvander@2762
  2719
dvander@2762
  2720
(iii) Repeats of multibyte characters are now handled correctly in UTF-8
dvander@2762
  2721
      mode, for example: \x{100}{2,3}.
dvander@2762
  2722
dvander@2762
  2723
(iv)  The character escapes \b, \B, \d, \D, \s, \S, \w, and \W (either
dvander@2762
  2724
      singly or repeated) now correctly test multibyte characters. However,
dvander@2762
  2725
      PCRE doesn't recognize any characters with values greater than 255 as
dvander@2762
  2726
      digits, spaces, or word characters. Such characters always match \D, \S,
dvander@2762
  2727
      and \W, and never match \d, \s, or \w.
dvander@2762
  2728
dvander@2762
  2729
(v)   Classes may now contain characters and character ranges with values
dvander@2762
  2730
      greater than 255. For example: [ab\x{100}-\x{400}].
dvander@2762
  2731
dvander@2762
  2732
(vi)  pcregrep now has a --utf-8 option (synonym -u) which makes it call
dvander@2762
  2733
      PCRE in UTF-8 mode.
dvander@2762
  2734
dvander@2762
  2735
52. The info request value PCRE_INFO_FIRSTCHAR has been renamed
dvander@2762
  2736
PCRE_INFO_FIRSTBYTE because it is a byte value. However, the old name is
dvander@2762
  2737
retained for backwards compatibility. (Note that LASTLITERAL is also a byte
dvander@2762
  2738
value.)
dvander@2762
  2739
dvander@2762
  2740
53. The single man page has become too large. I have therefore split it up into
dvander@2762
  2741
a number of separate man pages. These also give rise to individual HTML pages;
dvander@2762
  2742
these are now put in a separate directory, and there is an index.html page that
dvander@2762
  2743
lists them all. Some hyperlinking between the pages has been installed.
dvander@2762
  2744
dvander@2762
  2745
54. Added convenience functions for handling named capturing parentheses.
dvander@2762
  2746
dvander@2762
  2747
55. Unknown escapes inside character classes (e.g. [\M]) and escapes that
dvander@2762
  2748
aren't interpreted therein (e.g. [\C]) are literals in Perl. This is now also
dvander@2762
  2749
true in PCRE, except when the PCRE_EXTENDED option is set, in which case they
dvander@2762
  2750
are faulted.
dvander@2762
  2751
dvander@2762
  2752
56. Introduced HOST_CC and HOST_CFLAGS which can be set in the environment when
dvander@2762
  2753
calling configure. These values are used when compiling the dftables.c program
dvander@2762
  2754
which is run to generate the source of the default character tables. They
dvander@2762
  2755
default to the values of CC and CFLAGS. If you are cross-compiling PCRE,
dvander@2762
  2756
you will need to set these values.
dvander@2762
  2757
dvander@2762
  2758
57. Updated the building process for Windows DLL, as provided by Fred Cox.
dvander@2762
  2759
dvander@2762
  2760
dvander@2762
  2761
Version 3.9 02-Jan-02
dvander@2762
  2762
---------------------
dvander@2762
  2763
dvander@2762
  2764
1. A bit of extraneous text had somehow crept into the pcregrep documentation.
dvander@2762
  2765
dvander@2762
  2766
2. If --disable-static was given, the building process failed when trying to
dvander@2762
  2767
build pcretest and pcregrep. (For some reason it was using libtool to compile
dvander@2762
  2768
them, which is not right, as they aren't part of the library.)
dvander@2762
  2769
dvander@2762
  2770
dvander@2762
  2771
Version 3.8 18-Dec-01
dvander@2762
  2772
---------------------
dvander@2762
  2773
dvander@2762
  2774
1. The experimental UTF-8 code was completely screwed up. It was packing the
dvander@2762
  2775
bytes in the wrong order. How dumb can you get?
dvander@2762
  2776
dvander@2762
  2777
dvander@2762
  2778
Version 3.7 29-Oct-01
dvander@2762
  2779
---------------------
dvander@2762
  2780
dvander@2762
  2781
1. In updating pcretest to check change 1 of version 3.6, I screwed up.
dvander@2762
  2782
This caused pcretest, when used on the test data, to segfault. Unfortunately,
dvander@2762
  2783
this didn't happen under Solaris 8, where I normally test things.
dvander@2762
  2784
dvander@2762
  2785
2. The Makefile had to be changed to make it work on BSD systems, where 'make'
dvander@2762
  2786
doesn't seem to recognize that ./xxx and xxx are the same file. (This entry
dvander@2762
  2787
isn't in ChangeLog distributed with 3.7 because I forgot when I hastily made
dvander@2762
  2788
this fix an hour or so after the initial 3.7 release.)
dvander@2762
  2789
dvander@2762
  2790
dvander@2762
  2791
Version 3.6 23-Oct-01
dvander@2762
  2792
---------------------
dvander@2762
  2793
dvander@2762
  2794
1. Crashed with /(sens|respons)e and \1ibility/ and "sense and sensibility" if
dvander@2762
  2795
offsets passed as NULL with zero offset count.
dvander@2762
  2796
dvander@2762
  2797
2. The config.guess and config.sub files had not been updated when I moved to
dvander@2762
  2798
the latest autoconf.
dvander@2762
  2799
dvander@2762
  2800
dvander@2762
  2801
Version 3.5 15-Aug-01
dvander@2762
  2802
---------------------
dvander@2762
  2803
dvander@2762
  2804
1. Added some missing #if !defined NOPOSIX conditionals in pcretest.c that
dvander@2762
  2805
had been forgotten.
dvander@2762
  2806
dvander@2762
  2807
2. By using declared but undefined structures, we can avoid using "void"
dvander@2762
  2808
definitions in pcre.h while keeping the internal definitions of the structures
dvander@2762
  2809
private.
dvander@2762
  2810
dvander@2762
  2811
3. The distribution is now built using autoconf 2.50 and libtool 1.4. From a
dvander@2762
  2812
user point of view, this means that both static and shared libraries are built
dvander@2762
  2813
by default, but this can be individually controlled. More of the work of
dvander@2762
  2814
handling this static/shared cases is now inside libtool instead of PCRE's make
dvander@2762
  2815
file.
dvander@2762
  2816
dvander@2762
  2817
4. The pcretest utility is now installed along with pcregrep because it is
dvander@2762
  2818
useful for users (to test regexs) and by doing this, it automatically gets
dvander@2762
  2819
relinked by libtool. The documentation has been turned into a man page, so
dvander@2762
  2820
there are now .1, .txt, and .html versions in /doc.
dvander@2762
  2821
dvander@2762
  2822
5. Upgrades to pcregrep:
dvander@2762
  2823
   (i)   Added long-form option names like gnu grep.
dvander@2762
  2824
   (ii)  Added --help to list all options with an explanatory phrase.
dvander@2762
  2825
   (iii) Added -r, --recursive to recurse into sub-directories.
dvander@2762
  2826
   (iv)  Added -f, --file to read patterns from a file.
dvander@2762
  2827
dvander@2762
  2828
6. pcre_exec() was referring to its "code" argument before testing that
dvander@2762
  2829
argument for NULL (and giving an error if it was NULL).
dvander@2762
  2830
dvander@2762
  2831
7. Upgraded Makefile.in to allow for compiling in a different directory from
dvander@2762
  2832
the source directory.
dvander@2762
  2833
dvander@2762
  2834
8. Tiny buglet in pcretest: when pcre_fullinfo() was called to retrieve the
dvander@2762
  2835
options bits, the pointer it was passed was to an int instead of to an unsigned
dvander@2762
  2836
long int. This mattered only on 64-bit systems.
dvander@2762
  2837
dvander@2762
  2838
9. Fixed typo (3.4/1) in pcre.h again. Sigh. I had changed pcre.h (which is
dvander@2762
  2839
generated) instead of pcre.in, which it its source. Also made the same change
dvander@2762
  2840
in several of the .c files.
dvander@2762
  2841
dvander@2762
  2842
10. A new release of gcc defines printf() as a macro, which broke pcretest
dvander@2762
  2843
because it had an ifdef in the middle of a string argument for printf(). Fixed
dvander@2762
  2844
by using separate calls to printf().
dvander@2762
  2845
dvander@2762
  2846
11. Added --enable-newline-is-cr and --enable-newline-is-lf to the configure
dvander@2762
  2847
script, to force use of CR or LF instead of \n in the source. On non-Unix
dvander@2762
  2848
systems, the value can be set in config.h.
dvander@2762
  2849
dvander@2762
  2850
12. The limit of 200 on non-capturing parentheses is a _nesting_ limit, not an
dvander@2762
  2851
absolute limit. Changed the text of the error message to make this clear, and
dvander@2762
  2852
likewise updated the man page.
dvander@2762
  2853
dvander@2762
  2854
13. The limit of 99 on the number of capturing subpatterns has been removed.
dvander@2762
  2855
The new limit is 65535, which I hope will not be a "real" limit.
dvander@2762
  2856
dvander@2762
  2857
dvander@2762
  2858
Version 3.4 22-Aug-00
dvander@2762
  2859
---------------------
dvander@2762
  2860
dvander@2762
  2861
1. Fixed typo in pcre.h: unsigned const char * changed to const unsigned char *.
dvander@2762
  2862
dvander@2762
  2863
2. Diagnose condition (?(0) as an error instead of crashing on matching.
dvander@2762
  2864
dvander@2762
  2865
dvander@2762
  2866
Version 3.3 01-Aug-00
dvander@2762
  2867
---------------------
dvander@2762
  2868
dvander@2762
  2869
1. If an octal character was given, but the value was greater than \377, it
dvander@2762
  2870
was not getting masked to the least significant bits, as documented. This could
dvander@2762
  2871
lead to crashes in some systems.
dvander@2762
  2872
dvander@2762
  2873
2. Perl 5.6 (if not earlier versions) accepts classes like [a-\d] and treats
dvander@2762
  2874
the hyphen as a literal. PCRE used to give an error; it now behaves like Perl.
dvander@2762
  2875
dvander@2762
  2876
3. Added the functions pcre_free_substring() and pcre_free_substring_list().
dvander@2762
  2877
These just pass their arguments on to (pcre_free)(), but they are provided
dvander@2762
  2878
because some uses of PCRE bind it to non-C systems that can call its functions,
dvander@2762
  2879
but cannot call free() or pcre_free() directly.
dvander@2762
  2880
dvander@2762
  2881
4. Add "make test" as a synonym for "make check". Corrected some comments in
dvander@2762
  2882
the Makefile.
dvander@2762
  2883
dvander@2762
  2884
5. Add $(DESTDIR)/ in front of all the paths in the "install" target in the
dvander@2762
  2885
Makefile.
dvander@2762
  2886
dvander@2762
  2887
6. Changed the name of pgrep to pcregrep, because Solaris has introduced a
dvander@2762
  2888
command called pgrep for grepping around the active processes.
dvander@2762
  2889
dvander@2762
  2890
7. Added the beginnings of support for UTF-8 character strings.
dvander@2762
  2891
dvander@2762
  2892
8. Arranged for the Makefile to pass over the settings of CC, CFLAGS, and
dvander@2762
  2893
RANLIB to ./ltconfig so that they are used by libtool. I think these are all
dvander@2762
  2894
the relevant ones. (AR is not passed because ./ltconfig does its own figuring
dvander@2762
  2895
out for the ar command.)
dvander@2762
  2896
dvander@2762
  2897
dvander@2762
  2898
Version 3.2 12-May-00
dvander@2762
  2899
---------------------
dvander@2762
  2900
dvander@2762
  2901
This is purely a bug fixing release.
dvander@2762
  2902
dvander@2762
  2903
1. If the pattern /((Z)+|A)*/ was matched agained ZABCDEFG it matched Z instead
dvander@2762
  2904
of ZA. This was just one example of several cases that could provoke this bug,
dvander@2762
  2905
which was introduced by change 9 of version 2.00. The code for breaking
dvander@2762
  2906
infinite loops after an iteration that matches an empty string was't working
dvander@2762
  2907
correctly.
dvander@2762
  2908
dvander@2762
  2909
2. The pcretest program was not imitating Perl correctly for the pattern /a*/g
dvander@2762
  2910
when matched against abbab (for example). After matching an empty string, it
dvander@2762
  2911
wasn't forcing anchoring when setting PCRE_NOTEMPTY for the next attempt; this
dvander@2762
  2912
caused it to match further down the string than it should.
dvander@2762
  2913
dvander@2762
  2914
3. The code contained an inclusion of sys/types.h. It isn't clear why this
dvander@2762
  2915
was there because it doesn't seem to be needed, and it causes trouble on some
dvander@2762
  2916
systems, as it is not a Standard C header. It has been removed.
dvander@2762
  2917
dvander@2762
  2918
4. Made 4 silly changes to the source to avoid stupid compiler warnings that
dvander@2762
  2919
were reported on the Macintosh. The changes were from
dvander@2762
  2920
dvander@2762
  2921
  while ((c = *(++ptr)) != 0 && c != '\n');
dvander@2762
  2922
to
dvander@2762
  2923
  while ((c = *(++ptr)) != 0 && c != '\n') ;
dvander@2762
  2924
dvander@2762
  2925
Totally extraordinary, but if that's what it takes...
dvander@2762
  2926
dvander@2762
  2927
5. PCRE is being used in one environment where neither memmove() nor bcopy() is
dvander@2762
  2928
available. Added HAVE_BCOPY and an autoconf test for it; if neither
dvander@2762
  2929
HAVE_MEMMOVE nor HAVE_BCOPY is set, use a built-in emulation function which
dvander@2762
  2930
assumes the way PCRE uses memmove() (always moving upwards).
dvander@2762
  2931
dvander@2762
  2932
6. PCRE is being used in one environment where strchr() is not available. There
dvander@2762
  2933
was only one use in pcre.c, and writing it out to avoid strchr() probably gives
dvander@2762
  2934
faster code anyway.
dvander@2762
  2935
dvander@2762
  2936
dvander@2762
  2937
Version 3.1 09-Feb-00
dvander@2762
  2938
---------------------
dvander@2762
  2939
dvander@2762
  2940
The only change in this release is the fixing of some bugs in Makefile.in for
dvander@2762
  2941
the "install" target:
dvander@2762
  2942
dvander@2762
  2943
(1) It was failing to install pcreposix.h.
dvander@2762
  2944
dvander@2762
  2945
(2) It was overwriting the pcre.3 man page with the pcreposix.3 man page.
dvander@2762
  2946
dvander@2762
  2947
dvander@2762
  2948
Version 3.0 01-Feb-00
dvander@2762
  2949
---------------------
dvander@2762
  2950
dvander@2762
  2951
1. Add support for the /+ modifier to perltest (to output $` like it does in
dvander@2762
  2952
pcretest).
dvander@2762
  2953
dvander@2762
  2954
2. Add support for the /g modifier to perltest.
dvander@2762
  2955
dvander@2762
  2956
3. Fix pcretest so that it behaves even more like Perl for /g when the pattern
dvander@2762
  2957
matches null strings.
dvander@2762
  2958
dvander@2762
  2959
4. Fix perltest so that it doesn't do unwanted things when fed an empty
dvander@2762
  2960
pattern. Perl treats empty patterns specially - it reuses the most recent
dvander@2762
  2961
pattern, which is not what we want. Replace // by /(?#)/ in order to avoid this
dvander@2762
  2962
effect.
dvander@2762
  2963
dvander@2762
  2964
5. The POSIX interface was broken in that it was just handing over the POSIX
dvander@2762
  2965
captured string vector to pcre_exec(), but (since release 2.00) PCRE has
dvander@2762
  2966
required a bigger vector, with some working space on the end. This means that
dvander@2762
  2967
the POSIX wrapper now has to get and free some memory, and copy the results.
dvander@2762
  2968
dvander@2762
  2969
6. Added some simple autoconf support, placing the test data and the
dvander@2762
  2970
documentation in separate directories, re-organizing some of the
dvander@2762
  2971
information files, and making it build pcre-config (a GNU standard). Also added
dvander@2762
  2972
libtool support for building PCRE as a shared library, which is now the
dvander@2762
  2973
default.
dvander@2762
  2974
dvander@2762
  2975
7. Got rid of the leading zero in the definition of PCRE_MINOR because 08 and
dvander@2762
  2976
09 are not valid octal constants. Single digits will be used for minor values
dvander@2762
  2977
less than 10.
dvander@2762
  2978
dvander@2762
  2979
8. Defined REG_EXTENDED and REG_NOSUB as zero in the POSIX header, so that
dvander@2762
  2980
existing programs that set these in the POSIX interface can use PCRE without
dvander@2762
  2981
modification.
dvander@2762
  2982
dvander@2762
  2983
9. Added a new function, pcre_fullinfo() with an extensible interface. It can
dvander@2762
  2984
return all that pcre_info() returns, plus additional data. The pcre_info()
dvander@2762
  2985
function is retained for compatibility, but is considered to be obsolete.
dvander@2762
  2986
dvander@2762
  2987
10. Added experimental recursion feature (?R) to handle one common case that
dvander@2762
  2988
Perl 5.6 will be able to do with (?p{...}).
dvander@2762
  2989
dvander@2762
  2990
11. Added support for POSIX character classes like [:alpha:], which Perl is
dvander@2762
  2991
adopting.
dvander@2762
  2992
dvander@2762
  2993
dvander@2762
  2994
Version 2.08 31-Aug-99
dvander@2762
  2995
----------------------
dvander@2762
  2996
dvander@2762
  2997
1. When startoffset was not zero and the pattern began with ".*", PCRE was not
dvander@2762
  2998
trying to match at the startoffset position, but instead was moving forward to
dvander@2762
  2999
the next newline as if a previous match had failed.
dvander@2762
  3000
dvander@2762
  3001
2. pcretest was not making use of PCRE_NOTEMPTY when repeating for /g and /G,
dvander@2762
  3002
and could get into a loop if a null string was matched other than at the start
dvander@2762
  3003
of the subject.
dvander@2762
  3004
dvander@2762
  3005
3. Added definitions of PCRE_MAJOR and PCRE_MINOR to pcre.h so the version can
dvander@2762
  3006
be distinguished at compile time, and for completeness also added PCRE_DATE.
dvander@2762
  3007
dvander@2762
  3008
5. Added Paul Sokolovsky's minor changes to make it easy to compile a Win32 DLL
dvander@2762
  3009
in GnuWin32 environments.
dvander@2762
  3010
dvander@2762
  3011
dvander@2762
  3012
Version 2.07 29-Jul-99
dvander@2762
  3013
----------------------
dvander@2762
  3014
dvander@2762
  3015
1. The documentation is now supplied in plain text form and HTML as well as in
dvander@2762
  3016
the form of man page sources.
dvander@2762
  3017
dvander@2762
  3018
2. C++ compilers don't like assigning (void *) values to other pointer types.
dvander@2762
  3019
In particular this affects malloc(). Although there is no problem in Standard
dvander@2762
  3020
C, I've put in casts to keep C++ compilers happy.
dvander@2762
  3021
dvander@2762
  3022
3. Typo on pcretest.c; a cast of (unsigned char *) in the POSIX regexec() call
dvander@2762
  3023
should be (const char *).
dvander@2762
  3024
dvander@2762
  3025
4. If NOPOSIX is defined, pcretest.c compiles without POSIX support. This may
dvander@2762
  3026
be useful for non-Unix systems who don't want to bother with the POSIX stuff.
dvander@2762
  3027
However, I haven't made this a standard facility. The documentation doesn't
dvander@2762
  3028
mention it, and the Makefile doesn't support it.
dvander@2762
  3029
dvander@2762
  3030
5. The Makefile now contains an "install" target, with editable destinations at
dvander@2762
  3031
the top of the file. The pcretest program is not installed.
dvander@2762
  3032
dvander@2762
  3033
6. pgrep -V now gives the PCRE version number and date.
dvander@2762
  3034
dvander@2762
  3035
7. Fixed bug: a zero repetition after a literal string (e.g. /abcde{0}/) was
dvander@2762
  3036
causing the entire string to be ignored, instead of just the last character.
dvander@2762
  3037
dvander@2762
  3038
8. If a pattern like /"([^\\"]+|\\.)*"/ is applied in the normal way to a
dvander@2762
  3039
non-matching string, it can take a very, very long time, even for strings of
dvander@2762
  3040
quite modest length, because of the nested recursion. PCRE now does better in
dvander@2762
  3041
some of these cases. It does this by remembering the last required literal
dvander@2762
  3042
character in the pattern, and pre-searching the subject to ensure it is present
dvander@2762
  3043
before running the real match. In other words, it applies a heuristic to detect
dvander@2762
  3044
some types of certain failure quickly, and in the above example, if presented
dvander@2762
  3045
with a string that has no trailing " it gives "no match" very quickly.
dvander@2762
  3046
dvander@2762
  3047
9. A new runtime option PCRE_NOTEMPTY causes null string matches to be ignored;
dvander@2762
  3048
other alternatives are tried instead.
dvander@2762
  3049
dvander@2762
  3050
dvander@2762
  3051
Version 2.06 09-Jun-99
dvander@2762
  3052
----------------------
dvander@2762
  3053
dvander@2762
  3054
1. Change pcretest's output for amount of store used to show just the code
dvander@2762
  3055
space, because the remainder (the data block) varies in size between 32-bit and
dvander@2762
  3056
64-bit systems.
dvander@2762
  3057
dvander@2762
  3058
2. Added an extra argument to pcre_exec() to supply an offset in the subject to
dvander@2762
  3059
start matching at. This allows lookbehinds to work when searching for multiple
dvander@2762
  3060
occurrences in a string.
dvander@2762
  3061
dvander@2762
  3062
3. Added additional options to pcretest for testing multiple occurrences:
dvander@2762
  3063
dvander@2762
  3064
   /+   outputs the rest of the string that follows a match
dvander@2762
  3065
   /g   loops for multiple occurrences, using the new startoffset argument
dvander@2762
  3066
   /G   loops for multiple occurrences by passing an incremented pointer
dvander@2762
  3067
dvander@2762
  3068
4. PCRE wasn't doing the "first character" optimization for patterns starting
dvander@2762
  3069
with \b or \B, though it was doing it for other lookbehind assertions. That is,
dvander@2762
  3070
it wasn't noticing that a match for a pattern such as /\bxyz/ has to start with
dvander@2762
  3071
the letter 'x'. On long subject strings, this gives a significant speed-up.
dvander@2762
  3072
dvander@2762
  3073
dvander@2762
  3074
Version 2.05 21-Apr-99
dvander@2762
  3075
----------------------
dvander@2762
  3076
dvander@2762
  3077
1. Changed the type of magic_number from int to long int so that it works
dvander@2762
  3078
properly on 16-bit systems.
dvander@2762
  3079
dvander@2762
  3080
2. Fixed a bug which caused patterns starting with .* not to work correctly
dvander@2762
  3081
when the subject string contained newline characters. PCRE was assuming
dvander@2762
  3082
anchoring for such patterns in all cases, which is not correct because .* will
dvander@2762
  3083
not pass a newline unless PCRE_DOTALL is set. It now assumes anchoring only if
dvander@2762
  3084
DOTALL is set at top level; otherwise it knows that patterns starting with .*
dvander@2762
  3085
must be retried after every newline in the subject.
dvander@2762
  3086
dvander@2762
  3087
dvander@2762
  3088
Version 2.04 18-Feb-99
dvander@2762
  3089
----------------------
dvander@2762
  3090
dvander@2762
  3091
1. For parenthesized subpatterns with repeats whose minimum was zero, the
dvander@2762
  3092
computation of the store needed to hold the pattern was incorrect (too large).
dvander@2762
  3093
If such patterns were nested a few deep, this could multiply and become a real
dvander@2762
  3094
problem.
dvander@2762
  3095
dvander@2762
  3096
2. Added /M option to pcretest to show the memory requirement of a specific
dvander@2762
  3097
pattern. Made -m a synonym of -s (which does this globally) for compatibility.
dvander@2762
  3098
dvander@2762
  3099
3. Subpatterns of the form (regex){n,m} (i.e. limited maximum) were being
dvander@2762
  3100
compiled in such a way that the backtracking after subsequent failure was
dvander@2762
  3101
pessimal. Something like (a){0,3} was compiled as (a)?(a)?(a)? instead of
dvander@2762
  3102
((a)((a)(a)?)?)? with disastrous performance if the maximum was of any size.
dvander@2762
  3103
dvander@2762
  3104
dvander@2762
  3105
Version 2.03 02-Feb-99
dvander@2762
  3106
----------------------
dvander@2762
  3107
dvander@2762
  3108
1. Fixed typo and small mistake in man page.
dvander@2762
  3109
dvander@2762
  3110
2. Added 4th condition (GPL supersedes if conflict) and created separate
dvander@2762
  3111
LICENCE file containing the conditions.
dvander@2762
  3112
dvander@2762
  3113
3. Updated pcretest so that patterns such as /abc\/def/ work like they do in
dvander@2762
  3114
Perl, that is the internal \ allows the delimiter to be included in the
dvander@2762
  3115
pattern. Locked out the use of \ as a delimiter. If \ immediately follows
dvander@2762
  3116
the final delimiter, add \ to the end of the pattern (to test the error).
dvander@2762
  3117
dvander@2762
  3118
4. Added the convenience functions for extracting substrings after a successful
dvander@2762
  3119
match. Updated pcretest to make it able to test these functions.
dvander@2762
  3120
dvander@2762
  3121
dvander@2762
  3122
Version 2.02 14-Jan-99
dvander@2762
  3123
----------------------
dvander@2762
  3124
dvander@2762
  3125
1. Initialized the working variables associated with each extraction so that
dvander@2762
  3126
their saving and restoring doesn't refer to uninitialized store.
dvander@2762
  3127
dvander@2762
  3128
2. Put dummy code into study.c in order to trick the optimizer of the IBM C
dvander@2762
  3129
compiler for OS/2 into generating correct code. Apparently IBM isn't going to
dvander@2762
  3130
fix the problem.
dvander@2762
  3131
dvander@2762
  3132
3. Pcretest: the timing code wasn't using LOOPREPEAT for timing execution
dvander@2762
  3133
calls, and wasn't printing the correct value for compiling calls. Increased the
dvander@2762
  3134
default value of LOOPREPEAT, and the number of significant figures in the
dvander@2762
  3135
times.
dvander@2762
  3136
dvander@2762
  3137
4. Changed "/bin/rm" in the Makefile to "-rm" so it works on Windows NT.
dvander@2762
  3138
dvander@2762
  3139
5. Renamed "deftables" as "dftables" to get it down to 8 characters, to avoid
dvander@2762
  3140
a building problem on Windows NT with a FAT file system.
dvander@2762
  3141
dvander@2762
  3142
dvander@2762
  3143
Version 2.01 21-Oct-98
dvander@2762
  3144
----------------------
dvander@2762
  3145
dvander@2762
  3146
1. Changed the API for pcre_compile() to allow for the provision of a pointer
dvander@2762
  3147
to character tables built by pcre_maketables() in the current locale. If NULL
dvander@2762
  3148
is passed, the default tables are used.
dvander@2762
  3149
dvander@2762
  3150
dvander@2762
  3151
Version 2.00 24-Sep-98
dvander@2762
  3152
----------------------
dvander@2762
  3153
dvander@2762
  3154
1. Since the (>?) facility is in Perl 5.005, don't require PCRE_EXTRA to enable
dvander@2762
  3155
it any more.
dvander@2762
  3156
dvander@2762
  3157
2. Allow quantification of (?>) groups, and make it work correctly.
dvander@2762
  3158
dvander@2762
  3159
3. The first character computation wasn't working for (?>) groups.
dvander@2762
  3160
dvander@2762
  3161
4. Correct the implementation of \Z (it is permitted to match on the \n at the
dvander@2762
  3162
end of the subject) and add 5.005's \z, which really does match only at the
dvander@2762
  3163
very end of the subject.
dvander@2762
  3164
dvander@2762
  3165
5. Remove the \X "cut" facility; Perl doesn't have it, and (?> is neater.
dvander@2762
  3166
dvander@2762
  3167
6. Remove the ability to specify CASELESS, MULTILINE, DOTALL, and
dvander@2762
  3168
DOLLAR_END_ONLY at runtime, to make it possible to implement the Perl 5.005
dvander@2762
  3169
localized options. All options to pcre_study() were also removed.
dvander@2762
  3170
dvander@2762
  3171
7. Add other new features from 5.005:
dvander@2762
  3172
dvander@2762
  3173
   $(?<=           positive lookbehind
dvander@2762
  3174
   $(?<!           negative lookbehind
dvander@2762
  3175
   (?imsx-imsx)    added the unsetting capability
dvander@2762
  3176
                   such a setting is global if at outer level; local otherwise
dvander@2762
  3177
   (?imsx-imsx:)   non-capturing groups with option setting
dvander@2762
  3178
   (?(cond)re|re)  conditional pattern matching
dvander@2762
  3179
dvander@2762
  3180
   A backreference to itself in a repeated group matches the previous
dvander@2762
  3181
   captured string.
dvander@2762
  3182
dvander@2762
  3183
8. General tidying up of studying (both automatic and via "study")
dvander@2762
  3184
consequential on the addition of new assertions.
dvander@2762
  3185
dvander@2762
  3186
9. As in 5.005, unlimited repeated groups that could match an empty substring
dvander@2762
  3187
are no longer faulted at compile time. Instead, the loop is forcibly broken at
dvander@2762
  3188
runtime if any iteration does actually match an empty substring.
dvander@2762
  3189
dvander@2762
  3190
10. Include the RunTest script in the distribution.
dvander@2762
  3191
dvander@2762
  3192
11. Added tests from the Perl 5.005_02 distribution. This showed up a few
dvander@2762
  3193
discrepancies, some of which were old and were also with respect to 5.004. They
dvander@2762
  3194
have now been fixed.
dvander@2762
  3195
dvander@2762
  3196
dvander@2762
  3197
Version 1.09 28-Apr-98
dvander@2762
  3198
----------------------
dvander@2762
  3199
dvander@2762
  3200
1. A negated single character class followed by a quantifier with a minimum
dvander@2762
  3201
value of one (e.g.  [^x]{1,6}  ) was not compiled correctly. This could lead to
dvander@2762
  3202
program crashes, or just wrong answers. This did not apply to negated classes
dvander@2762
  3203
containing more than one character, or to minima other than one.
dvander@2762
  3204
dvander@2762
  3205
dvander@2762
  3206
Version 1.08 27-Mar-98
dvander@2762
  3207
----------------------
dvander@2762
  3208
dvander@2762
  3209
1. Add PCRE_UNGREEDY to invert the greediness of quantifiers.
dvander@2762
  3210
dvander@2762
  3211
2. Add (?U) and (?X) to set PCRE_UNGREEDY and PCRE_EXTRA respectively. The
dvander@2762
  3212
latter must appear before anything that relies on it in the pattern.
dvander@2762
  3213
dvander@2762
  3214
dvander@2762
  3215
Version 1.07 16-Feb-98
dvander@2762
  3216
----------------------
dvander@2762
  3217
dvander@2762
  3218
1. A pattern such as /((a)*)*/ was not being diagnosed as in error (unlimited
dvander@2762
  3219
repeat of a potentially empty string).
dvander@2762
  3220
dvander@2762
  3221
dvander@2762
  3222
Version 1.06 23-Jan-98
dvander@2762
  3223
----------------------
dvander@2762
  3224
dvander@2762
  3225
1. Added Markus Oberhumer's little patches for C++.
dvander@2762
  3226
dvander@2762
  3227
2. Literal strings longer than 255 characters were broken.
dvander@2762
  3228
dvander@2762
  3229
dvander@2762
  3230
Version 1.05 23-Dec-97
dvander@2762
  3231
----------------------
dvander@2762
  3232
dvander@2762
  3233
1. Negated character classes containing more than one character were failing if
dvander@2762
  3234
PCRE_CASELESS was set at run time.
dvander@2762
  3235
dvander@2762
  3236
dvander@2762
  3237
Version 1.04 19-Dec-97
dvander@2762
  3238
----------------------
dvander@2762
  3239
dvander@2762
  3240
1. Corrected the man page, where some "const" qualifiers had been omitted.
dvander@2762
  3241
dvander@2762
  3242
2. Made debugging output print "{0,xxx}" instead of just "{,xxx}" to agree with
dvander@2762
  3243
input syntax.
dvander@2762
  3244
dvander@2762
  3245
3. Fixed memory leak which occurred when a regex with back references was
dvander@2762
  3246
matched with an offsets vector that wasn't big enough. The temporary memory
dvander@2762
  3247
that is used in this case wasn't being freed if the match failed.
dvander@2762
  3248
dvander@2762
  3249
4. Tidied pcretest to ensure it frees memory that it gets.
dvander@2762
  3250
dvander@2762
  3251
5. Temporary memory was being obtained in the case where the passed offsets
dvander@2762
  3252
vector was exactly big enough.
dvander@2762
  3253
dvander@2762
  3254
6. Corrected definition of offsetof() from change 5 below.
dvander@2762
  3255
dvander@2762
  3256
7. I had screwed up change 6 below and broken the rules for the use of
dvander@2762
  3257
setjmp(). Now fixed.
dvander@2762
  3258
dvander@2762
  3259
dvander@2762
  3260
Version 1.03 18-Dec-97
dvander@2762
  3261
----------------------
dvander@2762
  3262
dvander@2762
  3263
1. A erroneous regex with a missing opening parenthesis was correctly
dvander@2762
  3264
diagnosed, but PCRE attempted to access brastack[-1], which could cause crashes
dvander@2762
  3265
on some systems.
dvander@2762
  3266
dvander@2762
  3267
2. Replaced offsetof(real_pcre, code) by offsetof(real_pcre, code[0]) because
dvander@2762
  3268
it was reported that one broken compiler failed on the former because "code" is
dvander@2762
  3269
also an independent variable.
dvander@2762
  3270
dvander@2762
  3271
3. The erroneous regex a[]b caused an array overrun reference.
dvander@2762
  3272
dvander@2762
  3273
4. A regex ending with a one-character negative class (e.g. /[^k]$/) did not
dvander@2762
  3274
fail on data ending with that character. (It was going on too far, and checking
dvander@2762
  3275
the next character, typically a binary zero.) This was specific to the
dvander@2762
  3276
optimized code for single-character negative classes.
dvander@2762
  3277
dvander@2762
  3278
5. Added a contributed patch from the TIN world which does the following:
dvander@2762
  3279
dvander@2762
  3280
  + Add an undef for memmove, in case the the system defines a macro for it.
dvander@2762
  3281
dvander@2762
  3282
  + Add a definition of offsetof(), in case there isn't one. (I don't know
dvander@2762
  3283
    the reason behind this - offsetof() is part of the ANSI standard - but
dvander@2762
  3284
    it does no harm).
dvander@2762
  3285
dvander@2762
  3286
  + Reduce the ifdef's in pcre.c using macro DPRINTF, thereby eliminating
dvander@2762
  3287
    most of the places where whitespace preceded '#'. I have given up and
dvander@2762
  3288
    allowed the remaining 2 cases to be at the margin.
dvander@2762
  3289
dvander@2762
  3290
  + Rename some variables in pcre to eliminate shadowing. This seems very
dvander@2762
  3291
    pedantic, but does no harm, of course.
dvander@2762
  3292
dvander@2762
  3293
6. Moved the call to setjmp() into its own function, to get rid of warnings
dvander@2762
  3294
from gcc -Wall, and avoided calling it at all unless PCRE_EXTRA is used.
dvander@2762
  3295
dvander@2762
  3296
7. Constructs such as \d{8,} were compiling into the equivalent of
dvander@2762
  3297
\d{8}\d{0,65527} instead of \d{8}\d* which didn't make much difference to the
dvander@2762
  3298
outcome, but in this particular case used more store than had been allocated,
dvander@2762
  3299
which caused the bug to be discovered because it threw up an internal error.
dvander@2762
  3300
dvander@2762
  3301
8. The debugging code in both pcre and pcretest for outputting the compiled
dvander@2762
  3302
form of a regex was going wrong in the case of back references followed by
dvander@2762
  3303
curly-bracketed repeats.
dvander@2762
  3304
dvander@2762
  3305
dvander@2762
  3306
Version 1.02 12-Dec-97
dvander@2762
  3307
----------------------
dvander@2762
  3308
dvander@2762
  3309
1. Typos in pcre.3 and comments in the source fixed.
dvander@2762
  3310
dvander@2762
  3311
2. Applied a contributed patch to get rid of places where it used to remove
dvander@2762
  3312
'const' from variables, and fixed some signed/unsigned and uninitialized
dvander@2762
  3313
variable warnings.
dvander@2762
  3314
dvander@2762
  3315
3. Added the "runtest" target to Makefile.
dvander@2762
  3316
dvander@2762
  3317
4. Set default compiler flag to -O2 rather than just -O.
dvander@2762
  3318
dvander@2762
  3319
dvander@2762
  3320
Version 1.01 19-Nov-97
dvander@2762
  3321
----------------------
dvander@2762
  3322
dvander@2762
  3323
1. PCRE was failing to diagnose unlimited repeat of empty string for patterns
dvander@2762
  3324
like /([ab]*)*/, that is, for classes with more than one character in them.
dvander@2762
  3325
dvander@2762
  3326
2. Likewise, it wasn't diagnosing patterns with "once-only" subpatterns, such
dvander@2762
  3327
as /((?>a*))*/ (a PCRE_EXTRA facility).
dvander@2762
  3328
dvander@2762
  3329
dvander@2762
  3330
Version 1.00 18-Nov-97
dvander@2762
  3331
----------------------
dvander@2762
  3332
dvander@2762
  3333
1. Added compile-time macros to support systems such as SunOS4 which don't have
dvander@2762
  3334
memmove() or strerror() but have other things that can be used instead.
dvander@2762
  3335
dvander@2762
  3336
2. Arranged that "make clean" removes the executables.
dvander@2762
  3337
dvander@2762
  3338
dvander@2762
  3339
Version 0.99 27-Oct-97
dvander@2762
  3340
----------------------
dvander@2762
  3341
dvander@2762
  3342
1. Fixed bug in code for optimizing classes with only one character. It was
dvander@2762
  3343
initializing a 32-byte map regardless, which could cause it to run off the end
dvander@2762
  3344
of the memory it had got.
dvander@2762
  3345
dvander@2762
  3346
2. Added, conditional on PCRE_EXTRA, the proposed (?>REGEX) construction.
dvander@2762
  3347
dvander@2762
  3348
dvander@2762
  3349
Version 0.98 22-Oct-97
dvander@2762
  3350
----------------------
dvander@2762
  3351
dvander@2762
  3352
1. Fixed bug in code for handling temporary memory usage when there are more
dvander@2762
  3353
back references than supplied space in the ovector. This could cause segfaults.
dvander@2762
  3354
dvander@2762
  3355
dvander@2762
  3356
Version 0.97 21-Oct-97
dvander@2762
  3357
----------------------
dvander@2762
  3358
dvander@2762
  3359
1. Added the \X "cut" facility, conditional on PCRE_EXTRA.
dvander@2762
  3360
dvander@2762
  3361
2. Optimized negated single characters not to use a bit map.
dvander@2762
  3362
dvander@2762
  3363
3. Brought error texts together as macro definitions; clarified some of them;
dvander@2762
  3364
fixed one that was wrong - it said "range out of order" when it meant "invalid
dvander@2762
  3365
escape sequence".
dvander@2762
  3366
dvander@2762
  3367
4. Changed some char * arguments to const char *.
dvander@2762
  3368
dvander@2762
  3369
5. Added PCRE_NOTBOL and PCRE_NOTEOL (from POSIX).
dvander@2762
  3370
dvander@2762
  3371
6. Added the POSIX-style API wrapper in pcreposix.a and testing facilities in
dvander@2762
  3372
pcretest.
dvander@2762
  3373
dvander@2762
  3374
dvander@2762
  3375
Version 0.96 16-Oct-97
dvander@2762
  3376
----------------------
dvander@2762
  3377
dvander@2762
  3378
1. Added a simple "pgrep" utility to the distribution.
dvander@2762
  3379
dvander@2762
  3380
2. Fixed an incompatibility with Perl: "{" is now treated as a normal character
dvander@2762
  3381
unless it appears in one of the precise forms "{ddd}", "{ddd,}", or "{ddd,ddd}"
dvander@2762
  3382
where "ddd" means "one or more decimal digits".
dvander@2762
  3383
dvander@2762
  3384
3. Fixed serious bug. If a pattern had a back reference, but the call to
dvander@2762
  3385
pcre_exec() didn't supply a large enough ovector to record the related
dvander@2762
  3386
identifying subpattern, the match always failed. PCRE now remembers the number
dvander@2762
  3387
of the largest back reference, and gets some temporary memory in which to save
dvander@2762
  3388
the offsets during matching if necessary, in order to ensure that
dvander@2762
  3389
backreferences always work.
dvander@2762
  3390
dvander@2762
  3391
4. Increased the compatibility with Perl in a number of ways:
dvander@2762
  3392
dvander@2762
  3393
  (a) . no longer matches \n by default; an option PCRE_DOTALL is provided
dvander@2762
  3394
      to request this handling. The option can be set at compile or exec time.
dvander@2762
  3395
dvander@2762
  3396
  (b) $ matches before a terminating newline by default; an option
dvander@2762
  3397
      PCRE_DOLLAR_ENDONLY is provided to override this (but not in multiline
dvander@2762
  3398
      mode). The option can be set at compile or exec time.
dvander@2762
  3399
dvander@2762
  3400
  (c) The handling of \ followed by a digit other than 0 is now supposed to be
dvander@2762
  3401
      the same as Perl's. If the decimal number it represents is less than 10
dvander@2762
  3402
      or there aren't that many previous left capturing parentheses, an octal
dvander@2762
  3403
      escape is read. Inside a character class, it's always an octal escape,
dvander@2762
  3404
      even if it is a single digit.
dvander@2762
  3405
dvander@2762
  3406
  (d) An escaped but undefined alphabetic character is taken as a literal,
dvander@2762
  3407
      unless PCRE_EXTRA is set. Currently this just reserves the remaining
dvander@2762
  3408
      escapes.
dvander@2762
  3409
dvander@2762
  3410
  (e) {0} is now permitted. (The previous item is removed from the compiled
dvander@2762
  3411
      pattern).
dvander@2762
  3412
dvander@2762
  3413
5. Changed all the names of code files so that the basic parts are no longer
dvander@2762
  3414
than 10 characters, and abolished the teeny "globals.c" file.
dvander@2762
  3415
dvander@2762
  3416
6. Changed the handling of character classes; they are now done with a 32-byte
dvander@2762
  3417
bit map always.
dvander@2762
  3418
dvander@2762
  3419
7. Added the -d and /D options to pcretest to make it possible to look at the
dvander@2762
  3420
internals of compilation without having to recompile pcre.
dvander@2762
  3421
dvander@2762
  3422
dvander@2762
  3423
Version 0.95 23-Sep-97
dvander@2762
  3424
----------------------
dvander@2762
  3425
dvander@2762
  3426
1. Fixed bug in pre-pass concerning escaped "normal" characters such as \x5c or
dvander@2762
  3427
\x20 at the start of a run of normal characters. These were being treated as
dvander@2762
  3428
real characters, instead of the source characters being re-checked.
dvander@2762
  3429
dvander@2762
  3430
dvander@2762
  3431
Version 0.94 18-Sep-97
dvander@2762
  3432
----------------------
dvander@2762
  3433
dvander@2762
  3434
1. The functions are now thread-safe, with the caveat that the global variables
dvander@2762
  3435
containing pointers to malloc() and free() or alternative functions are the
dvander@2762
  3436
same for all threads.
dvander@2762
  3437
dvander@2762
  3438
2. Get pcre_study() to generate a bitmap of initial characters for non-
dvander@2762
  3439
anchored patterns when this is possible, and use it if passed to pcre_exec().
dvander@2762
  3440
dvander@2762
  3441
dvander@2762
  3442
Version 0.93 15-Sep-97
dvander@2762
  3443
----------------------
dvander@2762
  3444
dvander@2762
  3445
1. /(b)|(:+)/ was computing an incorrect first character.
dvander@2762
  3446
dvander@2762
  3447
2. Add pcre_study() to the API and the passing of pcre_extra to pcre_exec(),
dvander@2762
  3448
but not actually doing anything yet.
dvander@2762
  3449
dvander@2762
  3450
3. Treat "-" characters in classes that cannot be part of ranges as literals,
dvander@2762
  3451
as Perl does (e.g. [-az] or [az-]).
dvander@2762
  3452
dvander@2762
  3453
4. Set the anchored flag if a branch starts with .* or .*? because that tests
dvander@2762
  3454
all possible positions.
dvander@2762
  3455
dvander@2762
  3456
5. Split up into different modules to avoid including unneeded functions in a
dvander@2762
  3457
compiled binary. However, compile and exec are still in one module. The "study"
dvander@2762
  3458
function is split off.
dvander@2762
  3459
dvander@2762
  3460
6. The character tables are now in a separate module whose source is generated
dvander@2762
  3461
by an auxiliary program - but can then be edited by hand if required. There are
dvander@2762
  3462
now no calls to isalnum(), isspace(), isdigit(), isxdigit(), tolower() or
dvander@2762
  3463
toupper() in the code.
dvander@2762
  3464
dvander@2762
  3465
7. Turn the malloc/free funtions variables into pcre_malloc and pcre_free and
dvander@2762
  3466
make them global. Abolish the function for setting them, as the caller can now
dvander@2762
  3467
set them directly.
dvander@2762
  3468
dvander@2762
  3469
dvander@2762
  3470
Version 0.92 11-Sep-97
dvander@2762
  3471
----------------------
dvander@2762
  3472
dvander@2762
  3473
1. A repeat with a fixed maximum and a minimum of 1 for an ordinary character
dvander@2762
  3474
(e.g. /a{1,3}/) was broken (I mis-optimized it).
dvander@2762
  3475
dvander@2762
  3476
2. Caseless matching was not working in character classes if the characters in
dvander@2762
  3477
the pattern were in upper case.
dvander@2762
  3478
dvander@2762
  3479
3. Make ranges like [W-c] work in the same way as Perl for caseless matching.
dvander@2762
  3480
dvander@2762
  3481
4. Make PCRE_ANCHORED public and accept as a compile option.
dvander@2762
  3482
dvander@2762
  3483
5. Add an options word to pcre_exec() and accept PCRE_ANCHORED and
dvander@2762
  3484
PCRE_CASELESS at run time. Add escapes \A and \I to pcretest to cause it to
dvander@2762
  3485
pass them.
dvander@2762
  3486
dvander@2762
  3487
6. Give an error if bad option bits passed at compile or run time.
dvander@2762
  3488
dvander@2762
  3489
7. Add PCRE_MULTILINE at compile and exec time, and (?m) as well. Add \M to
dvander@2762
  3490
pcretest to cause it to pass that flag.
dvander@2762
  3491
dvander@2762
  3492
8. Add pcre_info(), to get the number of identifying subpatterns, the stored
dvander@2762
  3493
options, and the first character, if set.
dvander@2762
  3494
dvander@2762
  3495
9. Recognize C+ or C{n,m} where n >= 1 as providing a fixed starting character.
dvander@2762
  3496
dvander@2762
  3497
dvander@2762
  3498
Version 0.91 10-Sep-97
dvander@2762
  3499
----------------------
dvander@2762
  3500
dvander@2762
  3501
1. PCRE was failing to diagnose unlimited repeats of subpatterns that could
dvander@2762
  3502
match the empty string as in /(a*)*/. It was looping and ultimately crashing.
dvander@2762
  3503
dvander@2762
  3504
2. PCRE was looping on encountering an indefinitely repeated back reference to
dvander@2762
  3505
a subpattern that had matched an empty string, e.g. /(a|)\1*/. It now does what
dvander@2762
  3506
Perl does - treats the match as successful.
dvander@2762
  3507
dvander@2762
  3508
****