Changeset 10495 in webkit for trunk/JavaScriptCore/pcre


Ignore:
Timestamp:
Sep 8, 2005, 5:51:07 PM (20 years ago)
Author:
darin
Message:

Reviewed by Geoff.

  • updated to PCRE 6.1

The original PCRE 6.1 sources are checked into the tree with the tag
"pcre-6-1" for reference. What we're checking in right now is the original
plus our changes to make it support UTF-16 and at least one other tweak
(vertical tab considered whitespace). Our work to get our changes was
done on "pcre-6-1-branch", with an anchor at "pcre-6-1-anchor" so you can
see the evolution of the UTF-16 changes.

Note also that there was one small change made here that's not on the branch
in pcre_compile.c.

  • Info.plist: Updated the part of the copyright message that's about PCRE.
  • JavaScriptCore.xcodeproj/project.pbxproj: Added new PCRE source files, removed obsolete ones.
  • pcre/AUTHORS: Updated to PCRE 6.1. Includes credits for Apple's UTF-16 changes, but not the credits for Google's C++ wrapper, since we don't include that.
  • pcre/COPYING: Updated to PCRE 6.1.
  • pcre/LICENCE: Ditto.
  • pcre/dftables.c: Ditto.
  • pcre/pcre-config.h: Ditto.
  • pcre/pcre.h: Ditto.
  • pcre/pcre_compile.c: Added for PCRE 6.1.
  • pcre/pcre_config.c: Ditto.
  • pcre/pcre_exec.c: Ditto.
  • pcre/pcre_fullinfo.c: Ditto.
  • pcre/pcre_get.c: Ditto.
  • pcre/pcre_globals.c: Ditto.
  • pcre/pcre_info.c: Ditto.
  • pcre/pcre_internal.h: Ditto.
  • pcre/pcre_maketables.c: Ditto.
  • pcre/pcre_ord2utf8.c: Ditto.
  • pcre/pcre_printint.c: Ditto.
  • pcre/pcre_refcount.c: Ditto.
  • pcre/pcre_study.c: Ditto.
  • pcre/pcre_tables.c: Ditto.
  • pcre/pcre_try_flipped.c: Ditto.
  • pcre/pcre_ucp_findchar.c: Ditto.
  • pcre/pcre_version.c: Ditto.
  • pcre/pcre_xclass.c: Ditto.
  • pcre/ucp.h: Ditto.
  • pcre/ucp_findchar.c: Ditto.
  • pcre/ucpinternal.h: Ditto.
  • pcre/ucptable.c: Ditto.
  • pcre/get.c: Removed.
  • pcre/internal.h: Removed.
  • pcre/maketables.c: Removed.
  • pcre/pcre.c: Removed.
  • pcre/study.c: Removed.
Location:
trunk/JavaScriptCore/pcre
Files:
22 added
5 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/pcre/AUTHORS

    r10160 r10495  
    1 Written by: Philip Hazel <[email protected]>
     1THE MAIN PCRE LIBRARY
     2---------------------
     3
     4Written by:       Philip Hazel
     5Email local part: ph10
     6Email domain:     cam.ac.uk
    27
    38University of Cambridge Computing Service,
    49Cambridge, England. Phone: +44 1223 334714.
    510
    6 Copyright (c) 1997-2001 University of Cambridge
     11Copyright (c) 1997-2005 University of Cambridge
     12All rights reserved
     13
     14UTF-16 changes by Darin Adler and Geoff Garen
     15Copyright (c) 2005 Apple Computer, Inc.
     16All rights reserved
  • trunk/JavaScriptCore/pcre/COPYING

    r10160 r10495  
    55and semantics are as close as possible to those of the Perl 5 language.
    66
    7 Written by: Philip Hazel <[email protected]>
     7Release 6 of PCRE is distributed under the terms of the "BSD" licence, as
     8specified below. The documentation for PCRE, supplied in the "doc"
     9directory, is distributed under the same terms as the software itself.
     10
     11The basic library functions are written in C and are freestanding. Also
     12included in the distribution is a set of C++ wrapper functions.
     13
     14
     15THE BASIC LIBRARY FUNCTIONS
     16---------------------------
     17
     18Written by:       Philip Hazel
     19Email local part: ph10
     20Email domain:     cam.ac.uk
    821
    922University of Cambridge Computing Service,
    1023Cambridge, England. Phone: +44 1223 334714.
    1124
    12 Copyright (c) 1997-2001 University of Cambridge
     25Copyright (c) 1997-2005 University of Cambridge
     26All rights reserved.
    1327
    14 Permission is granted to anyone to use this software for any purpose on any
    15 computer system, and to redistribute it freely, subject to the following
    16 restrictions:
    1728
    18 1. This software is distributed in the hope that it will be useful,
    19    but WITHOUT ANY WARRANTY; without even the implied warranty of
    20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     29THE C++ WRAPPER FUNCTIONS
     30-------------------------
    2131
    22 2. The origin of this software must not be misrepresented, either by
    23    explicit claim or by omission. In practice, this means that if you use
    24    PCRE in software which you distribute to others, commercially or
    25    otherwise, you must put a sentence like this
     32Contributed by:   Google Inc.
    2633
    27      Regular expression support is provided by the PCRE library package,
    28      which is open source software, written by Philip Hazel, and copyright
    29      by the University of Cambridge, England.
     34Copyright (c) 2005, Google Inc.
     35All rights reserved.
    3036
    31    somewhere reasonably visible in your documentation and in any relevant
    32    files or online help data or similar. A reference to the ftp site for
    33    the source, that is, to
    3437
    35      ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
     38THE "BSD" LICENCE
     39-----------------
    3640
    37    should also be given in the documentation.
     41Redistribution and use in source and binary forms, with or without
     42modification, are permitted provided that the following conditions are met:
    3843
    39 3. Altered versions must be plainly marked as such, and must not be
    40    misrepresented as being the original software.
     44    * Redistributions of source code must retain the above copyright notice,
     45      this list of conditions and the following disclaimer.
    4146
    42 4. If PCRE is embedded in any software that is released under the GNU
    43    General Purpose Licence (GPL), or Lesser General Purpose Licence (LGPL),
    44    then the terms of that licence shall supersede any condition above with
    45    which it is incompatible.
     47    * Redistributions in binary form must reproduce the above copyright
     48      notice, this list of conditions and the following disclaimer in the
     49      documentation and/or other materials provided with the distribution.
    4650
    47 The documentation for PCRE, supplied in the "doc" directory, is distributed
    48 under the same terms as the software itself.
     51    * Neither the name of the University of Cambridge nor the name of Google
     52      Inc. nor the names of their contributors may be used to endorse or
     53      promote products derived from this software without specific prior
     54      written permission.
     55
     56THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     57AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     58IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     59ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
     60LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     61CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     62SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     63INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     64CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     65ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     66POSSIBILITY OF SUCH DAMAGE.
    4967
    5068End
  • trunk/JavaScriptCore/pcre/LICENCE

    r10160 r10495  
    55and semantics are as close as possible to those of the Perl 5 language.
    66
    7 Written by: Philip Hazel <[email protected]>
     7Release 6 of PCRE is distributed under the terms of the "BSD" licence, as
     8specified below. The documentation for PCRE, supplied in the "doc"
     9directory, is distributed under the same terms as the software itself.
     10
     11The basic library functions are written in C and are freestanding. Also
     12included in the distribution is a set of C++ wrapper functions.
     13
     14
     15THE BASIC LIBRARY FUNCTIONS
     16---------------------------
     17
     18Written by:       Philip Hazel
     19Email local part: ph10
     20Email domain:     cam.ac.uk
    821
    922University of Cambridge Computing Service,
    1023Cambridge, England. Phone: +44 1223 334714.
    1124
    12 Copyright (c) 1997-2001 University of Cambridge
     25Copyright (c) 1997-2005 University of Cambridge
     26All rights reserved.
    1327
    14 Permission is granted to anyone to use this software for any purpose on any
    15 computer system, and to redistribute it freely, subject to the following
    16 restrictions:
    1728
    18 1. This software is distributed in the hope that it will be useful,
    19    but WITHOUT ANY WARRANTY; without even the implied warranty of
    20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     29THE C++ WRAPPER FUNCTIONS
     30-------------------------
    2131
    22 2. The origin of this software must not be misrepresented, either by
    23    explicit claim or by omission. In practice, this means that if you use
    24    PCRE in software which you distribute to others, commercially or
    25    otherwise, you must put a sentence like this
     32Contributed by:   Google Inc.
    2633
    27      Regular expression support is provided by the PCRE library package,
    28      which is open source software, written by Philip Hazel, and copyright
    29      by the University of Cambridge, England.
     34Copyright (c) 2005, Google Inc.
     35All rights reserved.
    3036
    31    somewhere reasonably visible in your documentation and in any relevant
    32    files or online help data or similar. A reference to the ftp site for
    33    the source, that is, to
    3437
    35      ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
     38THE "BSD" LICENCE
     39-----------------
    3640
    37    should also be given in the documentation.
     41Redistribution and use in source and binary forms, with or without
     42modification, are permitted provided that the following conditions are met:
    3843
    39 3. Altered versions must be plainly marked as such, and must not be
    40    misrepresented as being the original software.
     44    * Redistributions of source code must retain the above copyright notice,
     45      this list of conditions and the following disclaimer.
    4146
    42 4. If PCRE is embedded in any software that is released under the GNU
    43    General Purpose Licence (GPL), or Lesser General Purpose Licence (LGPL),
    44    then the terms of that licence shall supersede any condition above with
    45    which it is incompatible.
     47    * Redistributions in binary form must reproduce the above copyright
     48      notice, this list of conditions and the following disclaimer in the
     49      documentation and/or other materials provided with the distribution.
    4650
    47 The documentation for PCRE, supplied in the "doc" directory, is distributed
    48 under the same terms as the software itself.
     51    * Neither the name of the University of Cambridge nor the name of Google
     52      Inc. nor the names of their contributors may be used to endorse or
     53      promote products derived from this software without specific prior
     54      written permission.
     55
     56THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     57AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     58IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     59ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
     60LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     61CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     62SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     63INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     64CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     65ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     66POSSIBILITY OF SUCH DAMAGE.
    4967
    5068End
  • trunk/JavaScriptCore/pcre/dftables.c

    r10160 r10495  
    11/*************************************************
    22*      Perl-Compatible Regular Expressions       *
    3 *  extended to UTF-16 for use in JavaScriptCore  *
    43*************************************************/
    54
    6 /*
    7 PCRE is a library of functions to support regular expressions whose syntax
     5/* PCRE is a library of functions to support regular expressions whose syntax
    86and semantics are as close as possible to those of the Perl 5 language.
    97
    10 Written by: Philip Hazel <[email protected]>
    11 
    12            Copyright (c) 1997-2001 University of Cambridge
    13            Copyright (C) 2004 Apple Computer, Inc.
     8                       Written by Philip Hazel
     9           Copyright (c) 1997-2005 University of Cambridge
    1410
    1511-----------------------------------------------------------------------------
    16 Permission is granted to anyone to use this software for any purpose on any
    17 computer system, and to redistribute it freely, subject to the following
    18 restrictions:
     12Redistribution and use in source and binary forms, with or without
     13modification, are permitted provided that the following conditions are met:
    1914
    20 1. This software is distributed in the hope that it will be useful,
    21    but WITHOUT ANY WARRANTY; without even the implied warranty of
    22    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     15    * Redistributions of source code must retain the above copyright notice,
     16      this list of conditions and the following disclaimer.
    2317
    24 2. The origin of this software must not be misrepresented, either by
    25    explicit claim or by omission.
     18    * Redistributions in binary form must reproduce the above copyright
     19      notice, this list of conditions and the following disclaimer in the
     20      documentation and/or other materials provided with the distribution.
    2621
    27 3. Altered versions must be plainly marked as such, and must not be
    28    misrepresented as being the original software.
     22    * Neither the name of the University of Cambridge nor the names of its
     23      contributors may be used to endorse or promote products derived from
     24      this software without specific prior written permission.
    2925
    30 4. If PCRE is embedded in any software that is released under the GNU
    31    General Purpose Licence (GPL), then the terms of that licence shall
    32    supersede any condition above with which it is incompatible.
     26THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     27AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     28IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     29ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
     30LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36POSSIBILITY OF SUCH DAMAGE.
    3337-----------------------------------------------------------------------------
    34 
    35 See the file Tech.Notes for some information on the internals.
    3638*/
    3739
    3840
    39 /* This is a support program to generate the file chartables.c, containing
    40 character tables of various kinds. They are built according to the default C
    41 locale and used as the default tables by PCRE. Now that pcre_maketables is
    42 a function visible to the outside world, we make use of its code from here in
    43 order to be consistent. */
     41/* This is a freestanding support program to generate a file containing default
     42character tables for PCRE. The tables are built according to the default C
     43locale. Now that pcre_maketables is a function visible to the outside world, we
     44make use of its code from here in order to be consistent. */
    4445
    4546#include <ctype.h>
     
    4748#include <string.h>
    4849
    49 #include "internal.h"
     50#include "pcre_internal.h"
    5051
    51 #define DFTABLES          /* maketables.c notices this */
    52 #include "maketables.c"
     52#define DFTABLES          /* pcre_maketables.c notices this */
     53#include "pcre_maketables.c"
    5354
    5455
    55 int main(void)
     56int main(int argc, char **argv)
    5657{
    5758int i;
     59FILE *f;
    5860const unsigned char *tables = pcre_maketables();
     61const unsigned char *base_of_tables = tables;
    5962
    60 printf(
     63if (argc != 2)
     64  {
     65  fprintf(stderr, "dftables: one filename argument is required\n");
     66  return 1;
     67  }
     68
     69f = fopen(argv[1], "w");
     70if (f == NULL)
     71  {
     72  fprintf(stderr, "dftables: failed to open %s for writing\n", argv[1]);
     73  return 1;
     74  }
     75
     76/* There are two fprintf() calls here, because gcc in pedantic mode complains
     77about the very long string otherwise. */
     78
     79fprintf(f,
    6180  "/*************************************************\n"
    6281  "*      Perl-Compatible Regular Expressions       *\n"
     
    6483  "/* This file is automatically written by the dftables auxiliary \n"
    6584  "program. If you edit it by hand, you might like to edit the Makefile to \n"
    66   "prevent its ever being regenerated.\n\n"
    67   "This file is #included in the compilation of pcre.c to build the default\n"
    68   "character tables which are used when no tables are passed to the compile\n"
    69   "function. */\n\n"
    70   "static const unsigned char pcre_default_tables[] = {\n\n"
     85  "prevent its ever being regenerated.\n\n");
     86fprintf(f,
     87  "This file contains the default tables for characters with codes less than\n"
     88  "128 (ASCII characters). These tables are used when no external tables are\n"
     89  "passed to PCRE. */\n\n"
     90  "const unsigned char _pcre_default_tables[] = {\n\n"
    7191  "/* This table is a lower casing table. */\n\n");
    7292
    73 printf("  ");
    74 for (i = 0; i < (int)ICHAR_MAP_SIZE; i++)
     93fprintf(f, "  ");
     94for (i = 0; i < 256; i++)
    7595  {
    76   if ((i & 7) == 0 && i != 0) printf("\n  ");
    77   printf("%3d", *tables++);
    78   if (i != ICHAR_MAP_SIZE - 1) printf(",");
     96  if ((i & 7) == 0 && i != 0) fprintf(f, "\n  ");
     97  fprintf(f, "%3d", *tables++);
     98  if (i != 255) fprintf(f, ",");
    7999  }
    80 printf(",\n\n");
     100fprintf(f, ",\n\n");
    81101
    82 printf("/* This table is a case flipping table. */\n\n");
     102fprintf(f, "/* This table is a case flipping table. */\n\n");
    83103
    84 printf("  ");
    85 for (i = 0; i < (int)ICHAR_MAP_SIZE; i++)
     104fprintf(f, "  ");
     105for (i = 0; i < 256; i++)
    86106  {
    87   if ((i & 7) == 0 && i != 0) printf("\n  ");
    88   printf("%3d", *tables++);
    89   if (i != ICHAR_MAP_SIZE - 1) printf(",");
     107  if ((i & 7) == 0 && i != 0) fprintf(f, "\n  ");
     108  fprintf(f, "%3d", *tables++);
     109  if (i != 255) fprintf(f, ",");
    90110  }
    91 printf(",\n\n");
     111fprintf(f, ",\n\n");
    92112
    93 printf(
     113fprintf(f,
    94114  "/* This table contains bit maps for various character classes.\n"
    95115  "Each map is 32 bytes long and the bits run from the least\n"
     
    98118  "print, punct, and cntrl. Other classes are built from combinations. */\n\n");
    99119
    100 printf("  ");
     120fprintf(f, "  ");
    101121for (i = 0; i < cbit_length; i++)
    102122  {
    103123  if ((i & 7) == 0 && i != 0)
    104124    {
    105     if ((i & 31) == 0) printf("\n");
    106     printf("\n  ");
     125    if ((i & 31) == 0) fprintf(f, "\n");
     126    fprintf(f, "\n  ");
    107127    }
    108   printf("0x%02x", *tables++);
    109   if (i != cbit_length - 1) printf(",");
     128  fprintf(f, "0x%02x", *tables++);
     129  if (i != cbit_length - 1) fprintf(f, ",");
    110130  }
    111 printf(",\n\n");
     131fprintf(f, ",\n\n");
    112132
    113 printf(
     133fprintf(f,
    114134  "/* This table identifies various classes of character by individual bits:\n"
    115135  "  0x%02x   white space character\n"
     
    122142  ctype_meta);
    123143
    124 printf("  ");
    125 for (i = 0; i < ICHAR_COUNT; i++)
     144fprintf(f, "  ");
     145for (i = 0; i < 256; i++)
    126146  {
    127147  if ((i & 7) == 0 && i != 0)
    128148    {
    129     printf(" /* ");
    130     if (isprint(i-8)) printf(" %c -", i-8);
    131       else printf("%3d-", i-8);
    132     if (isprint(i-1)) printf(" %c ", i-1);
    133       else printf("%3d", i-1);
    134     printf(" */\n  ");
     149    fprintf(f, " /* ");
     150    if (isprint(i-8)) fprintf(f, " %c -", i-8);
     151      else fprintf(f, "%3d-", i-8);
     152    if (isprint(i-1)) fprintf(f, " %c ", i-1);
     153      else fprintf(f, "%3d", i-1);
     154    fprintf(f, " */\n  ");
    135155    }
    136   printf("0x%02x", *tables++);
    137   if (i != ICHAR_COUNT - 1) printf(",");
     156  fprintf(f, "0x%02x", *tables++);
     157  if (i != 255) fprintf(f, ",");
    138158  }
    139159
    140 printf("};/* ");
    141 if (isprint(i-8)) printf(" %c -", i-8);
    142   else printf("%3d-", i-8);
    143 if (isprint(i-1)) printf(" %c ", i-1);
    144   else printf("%3d", i-1);
    145 printf(" */\n\n/* End of chartables.c */\n");
     160fprintf(f, "};/* ");
     161if (isprint(i-8)) fprintf(f, " %c -", i-8);
     162  else fprintf(f, "%3d-", i-8);
     163if (isprint(i-1)) fprintf(f, " %c ", i-1);
     164  else fprintf(f, "%3d", i-1);
     165fprintf(f, " */\n\n/* End of chartables.c */\n");
    146166
     167fclose(f);
     168free((void *)base_of_tables);
    147169return 0;
    148170}
  • trunk/JavaScriptCore/pcre/pcre-config.h

    r2933 r10495  
    1 #define HAVE_MEMMOVE 1
    2 #define HAVE_BCOPY 1
     1/* On Unix systems config.in is converted by configure into config.h. PCRE is
     2written in Standard C, but there are a few non-standard things it can cope
     3with, allowing it to run on SunOS4 and other "close to standard" systems.
     4
     5On a non-Unix system you should just copy this file into config.h, and set up
     6the macros the way you need them. You should normally change the definitions of
     7HAVE_STRERROR and HAVE_MEMMOVE to 1. Unfortunately, because of the way autoconf
     8works, these cannot be made the defaults. If your system has bcopy() and not
     9memmove(), change the definition of HAVE_BCOPY instead of HAVE_MEMMOVE. If your
     10system has neither bcopy() nor memmove(), leave them both as 0; an emulation
     11function will be used. */
     12
     13/* If you are compiling for a system that uses EBCDIC instead of ASCII
     14character codes, define this macro as 1. On systems that can use "configure",
     15this can be done via --enable-ebcdic. */
     16
     17#define EBCDIC 0
     18
     19/* If you are compiling for a system that needs some magic to be inserted
     20before the definition of an exported function, define this macro to contain the
     21relevant magic. It apears at the start of every exported function. */
     22
     23#define EXPORT
     24
     25/* Define to empty if the "const" keyword does not work. */
     26
     27#undef const
     28
     29/* Define to "unsigned" if <stddef.h> doesn't define size_t. */
     30
     31#undef size_t
     32
     33/* The following two definitions are mainly for the benefit of SunOS4, which
     34doesn't have the strerror() or memmove() functions that should be present in
     35all Standard C libraries. The macros HAVE_STRERROR and HAVE_MEMMOVE should
     36normally be defined with the value 1 for other systems, but unfortunately we
     37can't make this the default because "configure" files generated by autoconf
     38will only change 0 to 1; they won't change 1 to 0 if the functions are not
     39found. */
     40
    341#define HAVE_STRERROR 1
    4 #define NEWLINE 10
     42#define HAVE_MEMMOVE  1
     43
     44/* There are some non-Unix systems that don't even have bcopy(). If this macro
     45is false, an emulation is used. If HAVE_MEMMOVE is set to 1, the value of
     46HAVE_BCOPY is not relevant. */
     47
     48#define HAVE_BCOPY    1
     49
     50/* The value of NEWLINE determines the newline character. The default is to
     51leave it up to the compiler, but some sites want to force a particular value.
     52On Unix systems, "configure" can be used to override this default. */
     53
     54#define NEWLINE '\n'
     55
     56/* The value of LINK_SIZE determines the number of bytes used to store
     57links as offsets within the compiled regex. The default is 2, which allows for
     58compiled patterns up to 64K long. This covers the vast majority of cases.
     59However, PCRE can also be compiled to use 3 or 4 bytes instead. This allows for
     60longer patterns in extreme cases. On Unix systems, "configure" can be used to
     61override this default. */
     62
     63#define LINK_SIZE   2
     64
     65/* The value of MATCH_LIMIT determines the default number of times the match()
     66function can be called during a single execution of pcre_exec(). (There is a
     67runtime method of setting a different limit.) The limit exists in order to
     68catch runaway regular expressions that take for ever to determine that they do
     69not match. The default is set very large so that it does not accidentally catch
     70legitimate cases. On Unix systems, "configure" can be used to override this
     71default default. */
     72
     73#define MATCH_LIMIT 10000000
     74
     75/* When calling PCRE via the POSIX interface, additional working storage is
     76required for holding the pointers to capturing substrings because PCRE requires
     77three integers per substring, whereas the POSIX interface provides only two. If
     78the number of expected substrings is small, the wrapper function uses space on
     79the stack, because this is faster than using malloc() for each call. The
     80threshold above which the stack is no longer use is defined by POSIX_MALLOC_
     81THRESHOLD. On Unix systems, "configure" can be used to override this default.
     82*/
     83
     84#define POSIX_MALLOC_THRESHOLD 10
     85
     86/* PCRE uses recursive function calls to handle backtracking while matching.
     87This can sometimes be a problem on systems that have stacks of limited size.
     88Define NO_RECURSE to get a version that doesn't use recursion in the match()
     89function; instead it creates its own stack by steam using pcre_recurse_malloc
     90to get memory. For more detail, see comments and other stuff just above the
     91match() function. On Unix systems, "configure" can be used to set this in the
     92Makefile (use --disable-stack-for-recursion). */
     93
     94/* #define NO_RECURSE */
     95
     96/* End */
     97
     98#define SUPPORT_UCP 1
    599#define SUPPORT_UTF8 1
  • trunk/JavaScriptCore/pcre/pcre.h

    r10160 r10495  
    11/*************************************************
    22*       Perl-Compatible Regular Expressions      *
    3 *  extended to UTF-16 for use in JavaScriptCore  *
    43*************************************************/
    54
    6 /* Copyright (c) 1997-2001 University of Cambridge */
    7 /* Copyright (C) 2004 Apple Computer, Inc. */
     5/* In its original form, this is the .in file that is transformed by
     6"configure" into pcre.h.
     7
     8           Copyright (c) 1997-2005 University of Cambridge
     9           Copyright (c) 2004, 2005 Apple Computer, Inc.
     10
     11-----------------------------------------------------------------------------
     12Redistribution and use in source and binary forms, with or without
     13modification, are permitted provided that the following conditions are met:
     14
     15    * Redistributions of source code must retain the above copyright notice,
     16      this list of conditions and the following disclaimer.
     17
     18    * Redistributions in binary form must reproduce the above copyright
     19      notice, this list of conditions and the following disclaimer in the
     20      documentation and/or other materials provided with the distribution.
     21
     22    * Neither the name of the University of Cambridge nor the names of its
     23      contributors may be used to endorse or promote products derived from
     24      this software without specific prior written permission.
     25
     26THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     27AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     28IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     29ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
     30LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36POSSIBILITY OF SUCH DAMAGE.
     37-----------------------------------------------------------------------------
     38*/
    839
    940#ifndef _PCRE_H
    1041#define _PCRE_H
    1142
     43#define pcre_callout kjs_pcre_callout
    1244#define pcre_compile kjs_pcre_compile
     45#define pcre_compile2 kjs_pcre_compile2
     46#define pcre_config kjs_pcre_config
     47#define pcre_copy_named_substring kjs_pcre_copy_named_substring
    1348#define pcre_copy_substring kjs_pcre_copy_substring
     49#define pcre_dfa_exec kjs_pcre_dfa_exec
    1450#define pcre_exec kjs_pcre_exec
    1551#define pcre_free kjs_pcre_free
     
    1753#define pcre_free_substring_list kjs_pcre_free_substring_list
    1854#define pcre_fullinfo kjs_pcre_fullinfo
     55#define pcre_get_named_substring kjs_pcre_get_named_substring
    1956#define pcre_get_substring kjs_pcre_get_substring
    2057#define pcre_get_substring_list kjs_pcre_get_substring_list
     
    2259#define pcre_maketables kjs_pcre_maketables
    2360#define pcre_malloc kjs_pcre_malloc
     61#define pcre_refcount kjs_pcre_refcount
     62#define pcre_stack_free kjs_pcre_stack_free
     63#define pcre_stack_malloc kjs_pcre_stack_malloc
    2464#define pcre_study kjs_pcre_study
    2565#define pcre_version kjs_pcre_version
    2666
    27 #define PCRE_MAJOR 3
    28 #define PCRE_MINOR 9
    29 #define PCRE_DATE 02-Jan-2002
    30 #define PCRE_DL_IMPORT
    31 #define PCRE_UTF16 1
     67#define PCRE_MAJOR          6
     68#define PCRE_MINOR          1
     69#define PCRE_DATE           21-Jun-2005
     70
     71#define PCRE_UTF16          1
     72
     73/* Win32 uses DLL by default; it needs special stuff for exported functions. */
     74
     75#ifdef _WIN32
     76#  ifdef PCRE_DEFINITION
     77#    ifdef DLL_EXPORT
     78#      define PCRE_DATA_SCOPE __declspec(dllexport)
     79#    endif
     80#  else
     81#    ifndef PCRE_STATIC
     82#      define PCRE_DATA_SCOPE extern __declspec(dllimport)
     83#    endif
     84#  endif
     85#endif
     86
     87/* For other operating systems, we use the standard "extern". */
     88
     89#ifndef PCRE_DATA_SCOPE
     90#  ifdef __cplusplus
     91#    define PCRE_DATA_SCOPE     extern "C"
     92#  else
     93#    define PCRE_DATA_SCOPE     extern
     94#  endif
     95#endif
    3296
    3397/* Have to include stdlib.h in order to ensure that size_t is defined;
     
    44108/* Options */
    45109
    46 #define PCRE_CASELESS        0x0001
    47 #define PCRE_MULTILINE       0x0002
    48 #define PCRE_DOTALL          0x0004
    49 #define PCRE_EXTENDED        0x0008
    50 #define PCRE_ANCHORED        0x0010
    51 #define PCRE_DOLLAR_ENDONLY  0x0020
    52 #define PCRE_EXTRA           0x0040
    53 #define PCRE_NOTBOL          0x0080
    54 #define PCRE_NOTEOL          0x0100
    55 #define PCRE_UNGREEDY        0x0200
    56 #define PCRE_NOTEMPTY        0x0400
    57 #define PCRE_UTF8            0x0800
    58 
    59 /* Exec-time and get-time error codes */
    60 
    61 #define PCRE_ERROR_NOMATCH        (-1)
    62 #define PCRE_ERROR_NULL           (-2)
    63 #define PCRE_ERROR_BADOPTION      (-3)
    64 #define PCRE_ERROR_BADMAGIC       (-4)
    65 #define PCRE_ERROR_UNKNOWN_NODE   (-5)
    66 #define PCRE_ERROR_NOMEMORY       (-6)
    67 #define PCRE_ERROR_NOSUBSTRING    (-7)
     110#define PCRE_CASELESS           0x00000001
     111#define PCRE_MULTILINE          0x00000002
     112#define PCRE_DOTALL             0x00000004
     113#define PCRE_EXTENDED           0x00000008
     114#define PCRE_ANCHORED           0x00000010
     115#define PCRE_DOLLAR_ENDONLY     0x00000020
     116#define PCRE_EXTRA              0x00000040
     117#define PCRE_NOTBOL             0x00000080
     118#define PCRE_NOTEOL             0x00000100
     119#define PCRE_UNGREEDY           0x00000200
     120#define PCRE_NOTEMPTY           0x00000400
     121#define PCRE_UTF8               0x00000800
     122#define PCRE_NO_AUTO_CAPTURE    0x00001000
     123#define PCRE_NO_UTF8_CHECK      0x00002000
     124#define PCRE_AUTO_CALLOUT       0x00004000
     125#define PCRE_PARTIAL            0x00008000
     126#define PCRE_DFA_SHORTEST       0x00010000
     127#define PCRE_DFA_RESTART        0x00020000
     128#define PCRE_FIRSTLINE          0x00040000
     129
     130/* Exec-time and get/set-time error codes */
     131
     132#define PCRE_ERROR_NOMATCH         (-1)
     133#define PCRE_ERROR_NULL            (-2)
     134#define PCRE_ERROR_BADOPTION       (-3)
     135#define PCRE_ERROR_BADMAGIC        (-4)
     136#define PCRE_ERROR_UNKNOWN_NODE    (-5)
     137#define PCRE_ERROR_NOMEMORY        (-6)
     138#define PCRE_ERROR_NOSUBSTRING     (-7)
     139#define PCRE_ERROR_MATCHLIMIT      (-8)
     140#define PCRE_ERROR_CALLOUT         (-9)  /* Never used by PCRE itself */
     141#define PCRE_ERROR_BADUTF8        (-10)
     142#define PCRE_ERROR_BADUTF8_OFFSET (-11)
     143#define PCRE_ERROR_PARTIAL        (-12)
     144#define PCRE_ERROR_BADPARTIAL     (-13)
     145#define PCRE_ERROR_INTERNAL       (-14)
     146#define PCRE_ERROR_BADCOUNT       (-15)
     147#define PCRE_ERROR_DFA_UITEM      (-16)
     148#define PCRE_ERROR_DFA_UCOND      (-17)
     149#define PCRE_ERROR_DFA_UMLIMIT    (-18)
     150#define PCRE_ERROR_DFA_WSSIZE     (-19)
     151#define PCRE_ERROR_DFA_RECURSE    (-20)
    68152
    69153/* Request types for pcre_fullinfo() */
    70154
    71 #define PCRE_INFO_OPTIONS         0
    72 #define PCRE_INFO_SIZE            1
    73 #define PCRE_INFO_CAPTURECOUNT    2
    74 #define PCRE_INFO_BACKREFMAX      3
    75 #define PCRE_INFO_FIRSTCHAR       4
    76 #define PCRE_INFO_FIRSTTABLE      5
    77 #define PCRE_INFO_LASTLITERAL     6
     155#define PCRE_INFO_OPTIONS            0
     156#define PCRE_INFO_SIZE               1
     157#define PCRE_INFO_CAPTURECOUNT       2
     158#define PCRE_INFO_BACKREFMAX         3
     159#define PCRE_INFO_FIRSTBYTE          4
     160#define PCRE_INFO_FIRSTCHAR          4  /* For backwards compatibility */
     161#define PCRE_INFO_FIRSTTABLE         5
     162#define PCRE_INFO_LASTLITERAL        6
     163#define PCRE_INFO_NAMEENTRYSIZE      7
     164#define PCRE_INFO_NAMECOUNT          8
     165#define PCRE_INFO_NAMETABLE          9
     166#define PCRE_INFO_STUDYSIZE         10
     167#define PCRE_INFO_DEFAULT_TABLES    11
     168
     169/* Request types for pcre_config() */
     170
     171#define PCRE_CONFIG_UTF8                    0
     172#define PCRE_CONFIG_NEWLINE                 1
     173#define PCRE_CONFIG_LINK_SIZE               2
     174#define PCRE_CONFIG_POSIX_MALLOC_THRESHOLD  3
     175#define PCRE_CONFIG_MATCH_LIMIT             4
     176#define PCRE_CONFIG_STACKRECURSE            5
     177#define PCRE_CONFIG_UNICODE_PROPERTIES      6
     178
     179/* Bit flags for the pcre_extra structure */
     180
     181#define PCRE_EXTRA_STUDY_DATA          0x0001
     182#define PCRE_EXTRA_MATCH_LIMIT         0x0002
     183#define PCRE_EXTRA_CALLOUT_DATA        0x0004
     184#define PCRE_EXTRA_TABLES              0x0008
    78185
    79186/* Types */
    80187
    81 struct real_pcre;        /* declaration; the definition is private  */
    82 struct real_pcre_extra;  /* declaration; the definition is private */
    83 
    84 typedef struct real_pcre pcre;
    85 typedef struct real_pcre_extra pcre_extra;
    86 
    87188#if PCRE_UTF16
    88 #include <stdint.h>
    89 typedef uint16_t pcre_char;
     189typedef unsigned short pcre_char;
    90190#else
    91191typedef char pcre_char;
    92192#endif
    93193
    94 /* Store get and free functions. These can be set to alternative malloc/free
    95 functions if required. Some magic is required for Win32 DLL; it is null on
    96 other OS. */
    97 
    98 PCRE_DL_IMPORT extern void *(*pcre_malloc)(size_t);
    99 PCRE_DL_IMPORT extern void  (*pcre_free)(void *);
    100 
    101 #undef PCRE_DL_IMPORT
    102 
    103 /* Functions */
    104 
    105 extern pcre *pcre_compile(const pcre_char *, int, const char **, int *,
    106               const unsigned char *);
    107 extern int  pcre_copy_substring(const pcre_char *, int *, int, int, pcre_char *, int);
    108 extern int  pcre_exec(const pcre *, const pcre_extra *, const pcre_char *,
    109               int, int, int, int *, int);
    110 extern void pcre_free_substring(const pcre_char *);
    111 extern void pcre_free_substring_list(const pcre_char **);
    112 extern int  pcre_get_substring(const pcre_char *, int *, int, int, const pcre_char **);
    113 extern int  pcre_get_substring_list(const pcre_char *, int *, int, const pcre_char ***);
    114 extern int  pcre_info(const pcre *, int *, int *);
    115 extern int  pcre_fullinfo(const pcre *, const pcre_extra *, int, void *);
    116 extern const unsigned char *pcre_maketables(void);
    117 extern pcre_extra *pcre_study(const pcre *, int, const char **);
    118 extern const char *pcre_version(void);
     194struct real_pcre;                 /* declaration; the definition is private  */
     195typedef struct real_pcre pcre;
     196
     197/* The structure for passing additional data to pcre_exec(). This is defined in
     198such as way as to be extensible. Always add new fields at the end, in order to
     199remain compatible. */
     200
     201typedef struct pcre_extra {
     202  unsigned long int flags;        /* Bits for which fields are set */
     203  void *study_data;               /* Opaque data from pcre_study() */
     204  unsigned long int match_limit;  /* Maximum number of calls to match() */
     205  void *callout_data;             /* Data passed back in callouts */
     206  const unsigned char *tables;    /* Pointer to character tables */
     207} pcre_extra;
     208
     209/* The structure for passing out data via the pcre_callout_function. We use a
     210structure so that new fields can be added on the end in future versions,
     211without changing the API of the function, thereby allowing old clients to work
     212without modification. */
     213
     214typedef struct pcre_callout_block {
     215  int          version;           /* Identifies version of block */
     216  /* ------------------------ Version 0 ------------------------------- */
     217  int          callout_number;    /* Number compiled into pattern */
     218  int         *offset_vector;     /* The offset vector */
     219  const pcre_char  *subject;      /* The subject being matched */
     220  int          subject_length;    /* The length of the subject */
     221  int          start_match;       /* Offset to start of this match attempt */
     222  int          current_position;  /* Where we currently are in the subject */
     223  int          capture_top;       /* Max current capture */
     224  int          capture_last;      /* Most recently closed capture */
     225  void        *callout_data;      /* Data passed in with the call */
     226  /* ------------------- Added for Version 1 -------------------------- */
     227  int          pattern_position;  /* Offset to next item in the pattern */
     228  int          next_item_length;  /* Length of next item in the pattern */
     229  /* ------------------------------------------------------------------ */
     230} pcre_callout_block;
     231
     232/* Indirection for store get and free functions. These can be set to
     233alternative malloc/free functions if required. Special ones are used in the
     234non-recursive case for "frames". There is also an optional callout function
     235that is triggered by the (?) regex item. For Virtual Pascal, these definitions
     236have to take another form. */
     237
     238#ifndef VPCOMPAT
     239PCRE_DATA_SCOPE void *(*pcre_malloc)(size_t);
     240PCRE_DATA_SCOPE void  (*pcre_free)(void *);
     241PCRE_DATA_SCOPE void *(*pcre_stack_malloc)(size_t);
     242PCRE_DATA_SCOPE void  (*pcre_stack_free)(void *);
     243PCRE_DATA_SCOPE int   (*pcre_callout)(pcre_callout_block *);
     244#else   /* VPCOMPAT */
     245PCRE_DATA_SCOPE void *pcre_malloc(size_t);
     246PCRE_DATA_SCOPE void  pcre_free(void *);
     247PCRE_DATA_SCOPE void *pcre_stack_malloc(size_t);
     248PCRE_DATA_SCOPE void  pcre_stack_free(void *);
     249PCRE_DATA_SCOPE int   pcre_callout(pcre_callout_block *);
     250#endif  /* VPCOMPAT */
     251
     252/* Exported PCRE functions */
     253
     254PCRE_DATA_SCOPE pcre *pcre_compile(const pcre_char *, int, const char **, int *,
     255                  const unsigned char *);
     256PCRE_DATA_SCOPE pcre *pcre_compile2(const pcre_char *, int, int *, const char **,
     257                  int *, const unsigned char *);
     258PCRE_DATA_SCOPE int  pcre_config(int, void *);
     259PCRE_DATA_SCOPE int  pcre_copy_named_substring(const pcre *, const pcre_char *,
     260                  int *, int, const pcre_char *, pcre_char *, int);
     261PCRE_DATA_SCOPE int  pcre_copy_substring(const pcre_char *, int *, int, int, pcre_char *,
     262                  int);
     263PCRE_DATA_SCOPE int  pcre_dfa_exec(const pcre *, const pcre_extra *,
     264                  const pcre_char *, int, int, int, int *, int , int *, int);
     265PCRE_DATA_SCOPE int  pcre_exec(const pcre *, const pcre_extra *, const pcre_char *,
     266                   int, int, int, int *, int);
     267PCRE_DATA_SCOPE void pcre_free_substring(const pcre_char *);
     268PCRE_DATA_SCOPE void pcre_free_substring_list(const pcre_char **);
     269PCRE_DATA_SCOPE int  pcre_fullinfo(const pcre *, const pcre_extra *, int,
     270                  void *);
     271PCRE_DATA_SCOPE int  pcre_get_named_substring(const pcre *, const pcre_char *,
     272                  int *, int, const pcre_char *, const pcre_char **);
     273PCRE_DATA_SCOPE int  pcre_get_stringnumber(const pcre *, const pcre_char *);
     274PCRE_DATA_SCOPE int  pcre_get_substring(const pcre_char *, int *, int, int,
     275                  const pcre_char **);
     276PCRE_DATA_SCOPE int  pcre_get_substring_list(const pcre_char *, int *, int,
     277                  const pcre_char ***);
     278PCRE_DATA_SCOPE int  pcre_info(const pcre *, int *, int *);
     279PCRE_DATA_SCOPE const unsigned char *pcre_maketables(void);
     280PCRE_DATA_SCOPE int  pcre_refcount(pcre *, int);
     281PCRE_DATA_SCOPE pcre_extra *pcre_study(const pcre *, int, const char **);
     282PCRE_DATA_SCOPE const char *pcre_version(void);
    119283
    120284#ifdef __cplusplus
Note: See TracChangeset for help on using the changeset viewer.