Changeset 10495 in webkit for trunk/JavaScriptCore/pcre
- Timestamp:
- Sep 8, 2005, 5:51:07 PM (20 years ago)
- 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]> 1 THE MAIN PCRE LIBRARY 2 --------------------- 3 4 Written by: Philip Hazel 5 Email local part: ph10 6 Email domain: cam.ac.uk 2 7 3 8 University of Cambridge Computing Service, 4 9 Cambridge, England. Phone: +44 1223 334714. 5 10 6 Copyright (c) 1997-2001 University of Cambridge 11 Copyright (c) 1997-2005 University of Cambridge 12 All rights reserved 13 14 UTF-16 changes by Darin Adler and Geoff Garen 15 Copyright (c) 2005 Apple Computer, Inc. 16 All rights reserved -
trunk/JavaScriptCore/pcre/COPYING
r10160 r10495 5 5 and semantics are as close as possible to those of the Perl 5 language. 6 6 7 Written by: Philip Hazel <[email protected]> 7 Release 6 of PCRE is distributed under the terms of the "BSD" licence, as 8 specified below. The documentation for PCRE, supplied in the "doc" 9 directory, is distributed under the same terms as the software itself. 10 11 The basic library functions are written in C and are freestanding. Also 12 included in the distribution is a set of C++ wrapper functions. 13 14 15 THE BASIC LIBRARY FUNCTIONS 16 --------------------------- 17 18 Written by: Philip Hazel 19 Email local part: ph10 20 Email domain: cam.ac.uk 8 21 9 22 University of Cambridge Computing Service, 10 23 Cambridge, England. Phone: +44 1223 334714. 11 24 12 Copyright (c) 1997-2001 University of Cambridge 25 Copyright (c) 1997-2005 University of Cambridge 26 All rights reserved. 13 27 14 Permission is granted to anyone to use this software for any purpose on any15 computer system, and to redistribute it freely, subject to the following16 restrictions:17 28 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. 29 THE C++ WRAPPER FUNCTIONS 30 ------------------------- 21 31 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 32 Contributed by: Google Inc. 26 33 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. 34 Copyright (c) 2005, Google Inc. 35 All rights reserved. 30 36 31 somewhere reasonably visible in your documentation and in any relevant32 files or online help data or similar. A reference to the ftp site for33 the source, that is, to34 37 35 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ 38 THE "BSD" LICENCE 39 ----------------- 36 40 37 should also be given in the documentation. 41 Redistribution and use in source and binary forms, with or without 42 modification, are permitted provided that the following conditions are met: 38 43 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. 41 46 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. 46 50 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 56 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 57 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 58 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 59 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 60 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 61 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 62 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 63 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 64 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 65 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 66 POSSIBILITY OF SUCH DAMAGE. 49 67 50 68 End -
trunk/JavaScriptCore/pcre/LICENCE
r10160 r10495 5 5 and semantics are as close as possible to those of the Perl 5 language. 6 6 7 Written by: Philip Hazel <[email protected]> 7 Release 6 of PCRE is distributed under the terms of the "BSD" licence, as 8 specified below. The documentation for PCRE, supplied in the "doc" 9 directory, is distributed under the same terms as the software itself. 10 11 The basic library functions are written in C and are freestanding. Also 12 included in the distribution is a set of C++ wrapper functions. 13 14 15 THE BASIC LIBRARY FUNCTIONS 16 --------------------------- 17 18 Written by: Philip Hazel 19 Email local part: ph10 20 Email domain: cam.ac.uk 8 21 9 22 University of Cambridge Computing Service, 10 23 Cambridge, England. Phone: +44 1223 334714. 11 24 12 Copyright (c) 1997-2001 University of Cambridge 25 Copyright (c) 1997-2005 University of Cambridge 26 All rights reserved. 13 27 14 Permission is granted to anyone to use this software for any purpose on any15 computer system, and to redistribute it freely, subject to the following16 restrictions:17 28 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. 29 THE C++ WRAPPER FUNCTIONS 30 ------------------------- 21 31 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 32 Contributed by: Google Inc. 26 33 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. 34 Copyright (c) 2005, Google Inc. 35 All rights reserved. 30 36 31 somewhere reasonably visible in your documentation and in any relevant32 files or online help data or similar. A reference to the ftp site for33 the source, that is, to34 37 35 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ 38 THE "BSD" LICENCE 39 ----------------- 36 40 37 should also be given in the documentation. 41 Redistribution and use in source and binary forms, with or without 42 modification, are permitted provided that the following conditions are met: 38 43 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. 41 46 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. 46 50 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 56 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 57 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 58 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 59 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 60 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 61 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 62 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 63 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 64 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 65 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 66 POSSIBILITY OF SUCH DAMAGE. 49 67 50 68 End -
trunk/JavaScriptCore/pcre/dftables.c
r10160 r10495 1 1 /************************************************* 2 2 * Perl-Compatible Regular Expressions * 3 * extended to UTF-16 for use in JavaScriptCore *4 3 *************************************************/ 5 4 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 8 6 and semantics are as close as possible to those of the Perl 5 language. 9 7 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 14 10 15 11 ----------------------------------------------------------------------------- 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: 12 Redistribution and use in source and binary forms, with or without 13 modification, are permitted provided that the following conditions are met: 19 14 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. 23 17 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. 26 21 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. 29 25 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. 26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 POSSIBILITY OF SUCH DAMAGE. 33 37 ----------------------------------------------------------------------------- 34 35 See the file Tech.Notes for some information on the internals.36 38 */ 37 39 38 40 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 42 character tables for PCRE. The tables are built according to the default C 43 locale. Now that pcre_maketables is a function visible to the outside world, we 44 make use of its code from here in order to be consistent. */ 44 45 45 46 #include <ctype.h> … … 47 48 #include <string.h> 48 49 49 #include " internal.h"50 #include "pcre_internal.h" 50 51 51 #define DFTABLES /* maketables.c notices this */52 #include " maketables.c"52 #define DFTABLES /* pcre_maketables.c notices this */ 53 #include "pcre_maketables.c" 53 54 54 55 55 int main( void)56 int main(int argc, char **argv) 56 57 { 57 58 int i; 59 FILE *f; 58 60 const unsigned char *tables = pcre_maketables(); 61 const unsigned char *base_of_tables = tables; 59 62 60 printf( 63 if (argc != 2) 64 { 65 fprintf(stderr, "dftables: one filename argument is required\n"); 66 return 1; 67 } 68 69 f = fopen(argv[1], "w"); 70 if (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 77 about the very long string otherwise. */ 78 79 fprintf(f, 61 80 "/*************************************************\n" 62 81 "* Perl-Compatible Regular Expressions *\n" … … 64 83 "/* This file is automatically written by the dftables auxiliary \n" 65 84 "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"); 86 fprintf(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" 71 91 "/* This table is a lower casing table. */\n\n"); 72 92 73 printf(" ");74 for (i = 0; i < (int)ICHAR_MAP_SIZE; i++)93 fprintf(f, " "); 94 for (i = 0; i < 256; i++) 75 95 { 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, ","); 79 99 } 80 printf(",\n\n");100 fprintf(f, ",\n\n"); 81 101 82 printf("/* This table is a case flipping table. */\n\n");102 fprintf(f, "/* This table is a case flipping table. */\n\n"); 83 103 84 printf(" ");85 for (i = 0; i < (int)ICHAR_MAP_SIZE; i++)104 fprintf(f, " "); 105 for (i = 0; i < 256; i++) 86 106 { 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, ","); 90 110 } 91 printf(",\n\n");111 fprintf(f, ",\n\n"); 92 112 93 printf( 113 fprintf(f, 94 114 "/* This table contains bit maps for various character classes.\n" 95 115 "Each map is 32 bytes long and the bits run from the least\n" … … 98 118 "print, punct, and cntrl. Other classes are built from combinations. */\n\n"); 99 119 100 printf(" ");120 fprintf(f, " "); 101 121 for (i = 0; i < cbit_length; i++) 102 122 { 103 123 if ((i & 7) == 0 && i != 0) 104 124 { 105 if ((i & 31) == 0) printf("\n");106 printf("\n ");125 if ((i & 31) == 0) fprintf(f, "\n"); 126 fprintf(f, "\n "); 107 127 } 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, ","); 110 130 } 111 printf(",\n\n");131 fprintf(f, ",\n\n"); 112 132 113 printf( 133 fprintf(f, 114 134 "/* This table identifies various classes of character by individual bits:\n" 115 135 " 0x%02x white space character\n" … … 122 142 ctype_meta); 123 143 124 printf(" ");125 for (i = 0; i < ICHAR_COUNT; i++)144 fprintf(f, " "); 145 for (i = 0; i < 256; i++) 126 146 { 127 147 if ((i & 7) == 0 && i != 0) 128 148 { 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 "); 135 155 } 136 printf("0x%02x", *tables++);137 if (i != ICHAR_COUNT - 1) printf(",");156 fprintf(f, "0x%02x", *tables++); 157 if (i != 255) fprintf(f, ","); 138 158 } 139 159 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");160 fprintf(f, "};/* "); 161 if (isprint(i-8)) fprintf(f, " %c -", i-8); 162 else fprintf(f, "%3d-", i-8); 163 if (isprint(i-1)) fprintf(f, " %c ", i-1); 164 else fprintf(f, "%3d", i-1); 165 fprintf(f, " */\n\n/* End of chartables.c */\n"); 146 166 167 fclose(f); 168 free((void *)base_of_tables); 147 169 return 0; 148 170 } -
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 2 written in Standard C, but there are a few non-standard things it can cope 3 with, allowing it to run on SunOS4 and other "close to standard" systems. 4 5 On a non-Unix system you should just copy this file into config.h, and set up 6 the macros the way you need them. You should normally change the definitions of 7 HAVE_STRERROR and HAVE_MEMMOVE to 1. Unfortunately, because of the way autoconf 8 works, these cannot be made the defaults. If your system has bcopy() and not 9 memmove(), change the definition of HAVE_BCOPY instead of HAVE_MEMMOVE. If your 10 system has neither bcopy() nor memmove(), leave them both as 0; an emulation 11 function will be used. */ 12 13 /* If you are compiling for a system that uses EBCDIC instead of ASCII 14 character codes, define this macro as 1. On systems that can use "configure", 15 this 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 20 before the definition of an exported function, define this macro to contain the 21 relevant 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 34 doesn't have the strerror() or memmove() functions that should be present in 35 all Standard C libraries. The macros HAVE_STRERROR and HAVE_MEMMOVE should 36 normally be defined with the value 1 for other systems, but unfortunately we 37 can't make this the default because "configure" files generated by autoconf 38 will only change 0 to 1; they won't change 1 to 0 if the functions are not 39 found. */ 40 3 41 #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 45 is false, an emulation is used. If HAVE_MEMMOVE is set to 1, the value of 46 HAVE_BCOPY is not relevant. */ 47 48 #define HAVE_BCOPY 1 49 50 /* The value of NEWLINE determines the newline character. The default is to 51 leave it up to the compiler, but some sites want to force a particular value. 52 On 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 57 links as offsets within the compiled regex. The default is 2, which allows for 58 compiled patterns up to 64K long. This covers the vast majority of cases. 59 However, PCRE can also be compiled to use 3 or 4 bytes instead. This allows for 60 longer patterns in extreme cases. On Unix systems, "configure" can be used to 61 override this default. */ 62 63 #define LINK_SIZE 2 64 65 /* The value of MATCH_LIMIT determines the default number of times the match() 66 function can be called during a single execution of pcre_exec(). (There is a 67 runtime method of setting a different limit.) The limit exists in order to 68 catch runaway regular expressions that take for ever to determine that they do 69 not match. The default is set very large so that it does not accidentally catch 70 legitimate cases. On Unix systems, "configure" can be used to override this 71 default default. */ 72 73 #define MATCH_LIMIT 10000000 74 75 /* When calling PCRE via the POSIX interface, additional working storage is 76 required for holding the pointers to capturing substrings because PCRE requires 77 three integers per substring, whereas the POSIX interface provides only two. If 78 the number of expected substrings is small, the wrapper function uses space on 79 the stack, because this is faster than using malloc() for each call. The 80 threshold above which the stack is no longer use is defined by POSIX_MALLOC_ 81 THRESHOLD. 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. 87 This can sometimes be a problem on systems that have stacks of limited size. 88 Define NO_RECURSE to get a version that doesn't use recursion in the match() 89 function; instead it creates its own stack by steam using pcre_recurse_malloc 90 to get memory. For more detail, see comments and other stuff just above the 91 match() function. On Unix systems, "configure" can be used to set this in the 92 Makefile (use --disable-stack-for-recursion). */ 93 94 /* #define NO_RECURSE */ 95 96 /* End */ 97 98 #define SUPPORT_UCP 1 5 99 #define SUPPORT_UTF8 1 -
trunk/JavaScriptCore/pcre/pcre.h
r10160 r10495 1 1 /************************************************* 2 2 * Perl-Compatible Regular Expressions * 3 * extended to UTF-16 for use in JavaScriptCore *4 3 *************************************************/ 5 4 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 ----------------------------------------------------------------------------- 12 Redistribution and use in source and binary forms, with or without 13 modification, 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 26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 POSSIBILITY OF SUCH DAMAGE. 37 ----------------------------------------------------------------------------- 38 */ 8 39 9 40 #ifndef _PCRE_H 10 41 #define _PCRE_H 11 42 43 #define pcre_callout kjs_pcre_callout 12 44 #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 13 48 #define pcre_copy_substring kjs_pcre_copy_substring 49 #define pcre_dfa_exec kjs_pcre_dfa_exec 14 50 #define pcre_exec kjs_pcre_exec 15 51 #define pcre_free kjs_pcre_free … … 17 53 #define pcre_free_substring_list kjs_pcre_free_substring_list 18 54 #define pcre_fullinfo kjs_pcre_fullinfo 55 #define pcre_get_named_substring kjs_pcre_get_named_substring 19 56 #define pcre_get_substring kjs_pcre_get_substring 20 57 #define pcre_get_substring_list kjs_pcre_get_substring_list … … 22 59 #define pcre_maketables kjs_pcre_maketables 23 60 #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 24 64 #define pcre_study kjs_pcre_study 25 65 #define pcre_version kjs_pcre_version 26 66 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 32 96 33 97 /* Have to include stdlib.h in order to ensure that size_t is defined; … … 44 108 /* Options */ 45 109 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) 68 152 69 153 /* Request types for pcre_fullinfo() */ 70 154 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 78 185 79 186 /* Types */ 80 187 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 87 188 #if PCRE_UTF16 88 #include <stdint.h> 89 typedef uint16_t pcre_char; 189 typedef unsigned short pcre_char; 90 190 #else 91 191 typedef char pcre_char; 92 192 #endif 93 193 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); 194 struct real_pcre; /* declaration; the definition is private */ 195 typedef struct real_pcre pcre; 196 197 /* The structure for passing additional data to pcre_exec(). This is defined in 198 such as way as to be extensible. Always add new fields at the end, in order to 199 remain compatible. */ 200 201 typedef 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 210 structure so that new fields can be added on the end in future versions, 211 without changing the API of the function, thereby allowing old clients to work 212 without modification. */ 213 214 typedef 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 233 alternative malloc/free functions if required. Special ones are used in the 234 non-recursive case for "frames". There is also an optional callout function 235 that is triggered by the (?) regex item. For Virtual Pascal, these definitions 236 have to take another form. */ 237 238 #ifndef VPCOMPAT 239 PCRE_DATA_SCOPE void *(*pcre_malloc)(size_t); 240 PCRE_DATA_SCOPE void (*pcre_free)(void *); 241 PCRE_DATA_SCOPE void *(*pcre_stack_malloc)(size_t); 242 PCRE_DATA_SCOPE void (*pcre_stack_free)(void *); 243 PCRE_DATA_SCOPE int (*pcre_callout)(pcre_callout_block *); 244 #else /* VPCOMPAT */ 245 PCRE_DATA_SCOPE void *pcre_malloc(size_t); 246 PCRE_DATA_SCOPE void pcre_free(void *); 247 PCRE_DATA_SCOPE void *pcre_stack_malloc(size_t); 248 PCRE_DATA_SCOPE void pcre_stack_free(void *); 249 PCRE_DATA_SCOPE int pcre_callout(pcre_callout_block *); 250 #endif /* VPCOMPAT */ 251 252 /* Exported PCRE functions */ 253 254 PCRE_DATA_SCOPE pcre *pcre_compile(const pcre_char *, int, const char **, int *, 255 const unsigned char *); 256 PCRE_DATA_SCOPE pcre *pcre_compile2(const pcre_char *, int, int *, const char **, 257 int *, const unsigned char *); 258 PCRE_DATA_SCOPE int pcre_config(int, void *); 259 PCRE_DATA_SCOPE int pcre_copy_named_substring(const pcre *, const pcre_char *, 260 int *, int, const pcre_char *, pcre_char *, int); 261 PCRE_DATA_SCOPE int pcre_copy_substring(const pcre_char *, int *, int, int, pcre_char *, 262 int); 263 PCRE_DATA_SCOPE int pcre_dfa_exec(const pcre *, const pcre_extra *, 264 const pcre_char *, int, int, int, int *, int , int *, int); 265 PCRE_DATA_SCOPE int pcre_exec(const pcre *, const pcre_extra *, const pcre_char *, 266 int, int, int, int *, int); 267 PCRE_DATA_SCOPE void pcre_free_substring(const pcre_char *); 268 PCRE_DATA_SCOPE void pcre_free_substring_list(const pcre_char **); 269 PCRE_DATA_SCOPE int pcre_fullinfo(const pcre *, const pcre_extra *, int, 270 void *); 271 PCRE_DATA_SCOPE int pcre_get_named_substring(const pcre *, const pcre_char *, 272 int *, int, const pcre_char *, const pcre_char **); 273 PCRE_DATA_SCOPE int pcre_get_stringnumber(const pcre *, const pcre_char *); 274 PCRE_DATA_SCOPE int pcre_get_substring(const pcre_char *, int *, int, int, 275 const pcre_char **); 276 PCRE_DATA_SCOPE int pcre_get_substring_list(const pcre_char *, int *, int, 277 const pcre_char ***); 278 PCRE_DATA_SCOPE int pcre_info(const pcre *, int *, int *); 279 PCRE_DATA_SCOPE const unsigned char *pcre_maketables(void); 280 PCRE_DATA_SCOPE int pcre_refcount(pcre *, int); 281 PCRE_DATA_SCOPE pcre_extra *pcre_study(const pcre *, int, const char **); 282 PCRE_DATA_SCOPE const char *pcre_version(void); 119 283 120 284 #ifdef __cplusplus
Note:
See TracChangeset
for help on using the changeset viewer.