Changeset 10160 in webkit for trunk/JavaScriptCore/pcre
- Timestamp:
- Aug 12, 2005, 3:18:08 PM (20 years ago)
- Location:
- trunk/JavaScriptCore/pcre
- Files:
-
- 5 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/pcre/AUTHORS
r10159 r10160 1 THE MAIN PCRE LIBRARY 2 --------------------- 3 4 Written by: Philip Hazel 5 Email local part: ph10 6 Email domain: cam.ac.uk 1 Written by: Philip Hazel <[email protected]> 7 2 8 3 University of Cambridge Computing Service, 9 4 Cambridge, England. Phone: +44 1223 334714. 10 5 11 Copyright (c) 1997-2005 University of Cambridge 12 All rights reserved 13 14 15 THE C++ WRAPPER LIBRARY 16 ----------------------- 17 18 Written by: Google Inc. 19 20 Copyright (c) 2005 Google Inc 21 All rights reserved 22 23 #### 6 Copyright (c) 1997-2001 University of Cambridge -
trunk/JavaScriptCore/pcre/COPYING
r10159 r10160 5 5 and semantics are as close as possible to those of the Perl 5 language. 6 6 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 7 Written by: Philip Hazel <[email protected]> 21 8 22 9 University of Cambridge Computing Service, 23 10 Cambridge, England. Phone: +44 1223 334714. 24 11 25 Copyright (c) 1997-2005 University of Cambridge 26 All rights reserved. 12 Copyright (c) 1997-2001 University of Cambridge 27 13 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: 28 17 29 THE C++ WRAPPER FUNCTIONS 30 ------------------------- 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. 31 21 32 Contributed by: Google Inc. 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 33 26 34 Copyright (c) 2005, Google Inc. 35 All rights reserved. 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. 36 30 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 37 34 38 THE "BSD" LICENCE 39 ----------------- 35 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ 40 36 41 Redistribution and use in source and binary forms, with or without 42 modification, are permitted provided that the following conditions are met: 37 should also be given in the documentation. 43 38 44 * Redistributions of source code must retain the above copyright notice, 45 this list of conditions and the following disclaimer.39 3. Altered versions must be plainly marked as such, and must not be 40 misrepresented as being the original software. 46 41 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. 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. 50 46 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. 47 The documentation for PCRE, supplied in the "doc" directory, is distributed 48 under the same terms as the software itself. 67 49 68 50 End -
trunk/JavaScriptCore/pcre/LICENCE
r10159 r10160 5 5 and semantics are as close as possible to those of the Perl 5 language. 6 6 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 7 Written by: Philip Hazel <[email protected]> 21 8 22 9 University of Cambridge Computing Service, 23 10 Cambridge, England. Phone: +44 1223 334714. 24 11 25 Copyright (c) 1997-2005 University of Cambridge 26 All rights reserved. 12 Copyright (c) 1997-2001 University of Cambridge 27 13 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: 28 17 29 THE C++ WRAPPER FUNCTIONS 30 ------------------------- 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. 31 21 32 Contributed by: Google Inc. 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 33 26 34 Copyright (c) 2005, Google Inc. 35 All rights reserved. 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. 36 30 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 37 34 38 THE "BSD" LICENCE 39 ----------------- 35 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ 40 36 41 Redistribution and use in source and binary forms, with or without 42 modification, are permitted provided that the following conditions are met: 37 should also be given in the documentation. 43 38 44 * Redistributions of source code must retain the above copyright notice, 45 this list of conditions and the following disclaimer.39 3. Altered versions must be plainly marked as such, and must not be 40 misrepresented as being the original software. 46 41 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. 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. 50 46 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. 47 The documentation for PCRE, supplied in the "doc" directory, is distributed 48 under the same terms as the software itself. 67 49 68 50 End -
trunk/JavaScriptCore/pcre/dftables.c
r10159 r10160 1 1 /************************************************* 2 2 * Perl-Compatible Regular Expressions * 3 * extended to UTF-16 for use in JavaScriptCore * 3 4 *************************************************/ 4 5 5 /* PCRE is a library of functions to support regular expressions whose syntax 6 /* 7 PCRE is a library of functions to support regular expressions whose syntax 6 8 and semantics are as close as possible to those of the Perl 5 language. 7 9 8 Written by Philip Hazel 9 Copyright (c) 1997-2005 University of Cambridge 10 Written by: Philip Hazel <[email protected]> 11 12 Copyright (c) 1997-2001 University of Cambridge 13 Copyright (C) 2004 Apple Computer, Inc. 10 14 11 15 ----------------------------------------------------------------------------- 12 Redistribution and use in source and binary forms, with or without 13 modification, are permitted provided that the following conditions are met: 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: 14 19 15 * Redistributions of source code must retain the above copyright notice, 16 this list of conditions and the following disclaimer. 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. 17 23 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. 24 2. The origin of this software must not be misrepresented, either by 25 explicit claim or by omission. 21 26 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. 27 3. Altered versions must be plainly marked as such, and must not be 28 misrepresented as being the original software. 25 29 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. 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. 37 33 ----------------------------------------------------------------------------- 34 35 See the file Tech.Notes for some information on the internals. 38 36 */ 39 37 40 38 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. */ 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. */ 45 44 46 45 #include <ctype.h> … … 48 47 #include <string.h> 49 48 50 #include " pcre_internal.h"49 #include "internal.h" 51 50 52 #define DFTABLES /* pcre_maketables.c notices this */53 #include " pcre_maketables.c"51 #define DFTABLES /* maketables.c notices this */ 52 #include "maketables.c" 54 53 55 54 56 int main( int argc, char **argv)55 int main(void) 57 56 { 58 57 int i; 59 FILE *f;60 58 const unsigned char *tables = pcre_maketables(); 61 const unsigned char *base_of_tables = tables;62 59 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, 60 printf( 80 61 "/*************************************************\n" 81 62 "* Perl-Compatible Regular Expressions *\n" … … 83 64 "/* This file is automatically written by the dftables auxiliary \n" 84 65 "program. If you edit it by hand, you might like to edit the Makefile to \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" 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" 91 71 "/* This table is a lower casing table. */\n\n"); 92 72 93 fprintf(f," ");94 for (i = 0; i < 256; i++)73 printf(" "); 74 for (i = 0; i < (int)ICHAR_MAP_SIZE; i++) 95 75 { 96 if ((i & 7) == 0 && i != 0) fprintf(f,"\n ");97 fprintf(f,"%3d", *tables++);98 if (i != 255) fprintf(f,",");76 if ((i & 7) == 0 && i != 0) printf("\n "); 77 printf("%3d", *tables++); 78 if (i != ICHAR_MAP_SIZE - 1) printf(","); 99 79 } 100 fprintf(f,",\n\n");80 printf(",\n\n"); 101 81 102 fprintf(f,"/* This table is a case flipping table. */\n\n");82 printf("/* This table is a case flipping table. */\n\n"); 103 83 104 fprintf(f," ");105 for (i = 0; i < 256; i++)84 printf(" "); 85 for (i = 0; i < (int)ICHAR_MAP_SIZE; i++) 106 86 { 107 if ((i & 7) == 0 && i != 0) fprintf(f,"\n ");108 fprintf(f,"%3d", *tables++);109 if (i != 255) fprintf(f,",");87 if ((i & 7) == 0 && i != 0) printf("\n "); 88 printf("%3d", *tables++); 89 if (i != ICHAR_MAP_SIZE - 1) printf(","); 110 90 } 111 fprintf(f,",\n\n");91 printf(",\n\n"); 112 92 113 fprintf(f, 93 printf( 114 94 "/* This table contains bit maps for various character classes.\n" 115 95 "Each map is 32 bytes long and the bits run from the least\n" … … 118 98 "print, punct, and cntrl. Other classes are built from combinations. */\n\n"); 119 99 120 fprintf(f," ");100 printf(" "); 121 101 for (i = 0; i < cbit_length; i++) 122 102 { 123 103 if ((i & 7) == 0 && i != 0) 124 104 { 125 if ((i & 31) == 0) fprintf(f,"\n");126 fprintf(f,"\n ");105 if ((i & 31) == 0) printf("\n"); 106 printf("\n "); 127 107 } 128 fprintf(f,"0x%02x", *tables++);129 if (i != cbit_length - 1) fprintf(f,",");108 printf("0x%02x", *tables++); 109 if (i != cbit_length - 1) printf(","); 130 110 } 131 fprintf(f,",\n\n");111 printf(",\n\n"); 132 112 133 fprintf(f, 113 printf( 134 114 "/* This table identifies various classes of character by individual bits:\n" 135 115 " 0x%02x white space character\n" … … 142 122 ctype_meta); 143 123 144 fprintf(f," ");145 for (i = 0; i < 256; i++)124 printf(" "); 125 for (i = 0; i < ICHAR_COUNT; i++) 146 126 { 147 127 if ((i & 7) == 0 && i != 0) 148 128 { 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 ");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 "); 155 135 } 156 fprintf(f,"0x%02x", *tables++);157 if (i != 255) fprintf(f,",");136 printf("0x%02x", *tables++); 137 if (i != ICHAR_COUNT - 1) printf(","); 158 138 } 159 139 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");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"); 166 146 167 fclose(f);168 free((void *)base_of_tables);169 147 return 0; 170 148 } -
trunk/JavaScriptCore/pcre/pcre.h
r10159 r10160 1 1 /************************************************* 2 2 * Perl-Compatible Regular Expressions * 3 * extended to UTF-16 for use in JavaScriptCore * 3 4 *************************************************/ 4 5 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 10 ----------------------------------------------------------------------------- 11 Redistribution and use in source and binary forms, with or without 12 modification, are permitted provided that the following conditions are met: 13 14 * Redistributions of source code must retain the above copyright notice, 15 this list of conditions and the following disclaimer. 16 17 * Redistributions in binary form must reproduce the above copyright 18 notice, this list of conditions and the following disclaimer in the 19 documentation and/or other materials provided with the distribution. 20 21 * Neither the name of the University of Cambridge nor the names of its 22 contributors may be used to endorse or promote products derived from 23 this software without specific prior written permission. 24 25 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 POSSIBILITY OF SUCH DAMAGE. 36 ----------------------------------------------------------------------------- 37 */ 6 /* Copyright (c) 1997-2001 University of Cambridge */ 7 /* Copyright (C) 2004 Apple Computer, Inc. */ 38 8 39 9 #ifndef _PCRE_H 40 10 #define _PCRE_H 41 11 42 /* The file pcre.h is build by "configure". Do not edit it; instead 43 make changes to pcre.in. */ 12 #define pcre_compile kjs_pcre_compile 13 #define pcre_copy_substring kjs_pcre_copy_substring 14 #define pcre_exec kjs_pcre_exec 15 #define pcre_free kjs_pcre_free 16 #define pcre_free_substring kjs_pcre_free_substring 17 #define pcre_free_substring_list kjs_pcre_free_substring_list 18 #define pcre_fullinfo kjs_pcre_fullinfo 19 #define pcre_get_substring kjs_pcre_get_substring 20 #define pcre_get_substring_list kjs_pcre_get_substring_list 21 #define pcre_info kjs_pcre_info 22 #define pcre_maketables kjs_pcre_maketables 23 #define pcre_malloc kjs_pcre_malloc 24 #define pcre_study kjs_pcre_study 25 #define pcre_version kjs_pcre_version 44 26 45 #define PCRE_MAJOR @PCRE_MAJOR@ 46 #define PCRE_MINOR @PCRE_MINOR@ 47 #define PCRE_DATE @PCRE_DATE@ 48 49 /* Win32 uses DLL by default; it needs special stuff for exported functions. */ 50 51 #ifdef _WIN32 52 # ifdef PCRE_DEFINITION 53 # ifdef DLL_EXPORT 54 # define PCRE_DATA_SCOPE __declspec(dllexport) 55 # endif 56 # else 57 # ifndef PCRE_STATIC 58 # define PCRE_DATA_SCOPE extern __declspec(dllimport) 59 # endif 60 # endif 61 #endif 62 63 /* For other operating systems, we use the standard "extern". */ 64 65 #ifndef PCRE_DATA_SCOPE 66 # ifdef __cplusplus 67 # define PCRE_DATA_SCOPE extern "C" 68 # else 69 # define PCRE_DATA_SCOPE extern 70 # endif 71 #endif 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 72 32 73 33 /* Have to include stdlib.h in order to ensure that size_t is defined; … … 84 44 /* Options */ 85 45 86 #define PCRE_CASELESS 0x00000001 87 #define PCRE_MULTILINE 0x00000002 88 #define PCRE_DOTALL 0x00000004 89 #define PCRE_EXTENDED 0x00000008 90 #define PCRE_ANCHORED 0x00000010 91 #define PCRE_DOLLAR_ENDONLY 0x00000020 92 #define PCRE_EXTRA 0x00000040 93 #define PCRE_NOTBOL 0x00000080 94 #define PCRE_NOTEOL 0x00000100 95 #define PCRE_UNGREEDY 0x00000200 96 #define PCRE_NOTEMPTY 0x00000400 97 #define PCRE_UTF8 0x00000800 98 #define PCRE_NO_AUTO_CAPTURE 0x00001000 99 #define PCRE_NO_UTF8_CHECK 0x00002000 100 #define PCRE_AUTO_CALLOUT 0x00004000 101 #define PCRE_PARTIAL 0x00008000 102 #define PCRE_DFA_SHORTEST 0x00010000 103 #define PCRE_DFA_RESTART 0x00020000 104 #define PCRE_FIRSTLINE 0x00040000 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 105 58 106 /* Exec-time and get /set-time error codes */59 /* Exec-time and get-time error codes */ 107 60 108 #define PCRE_ERROR_NOMATCH (-1) 109 #define PCRE_ERROR_NULL (-2) 110 #define PCRE_ERROR_BADOPTION (-3) 111 #define PCRE_ERROR_BADMAGIC (-4) 112 #define PCRE_ERROR_UNKNOWN_NODE (-5) 113 #define PCRE_ERROR_NOMEMORY (-6) 114 #define PCRE_ERROR_NOSUBSTRING (-7) 115 #define PCRE_ERROR_MATCHLIMIT (-8) 116 #define PCRE_ERROR_CALLOUT (-9) /* Never used by PCRE itself */ 117 #define PCRE_ERROR_BADUTF8 (-10) 118 #define PCRE_ERROR_BADUTF8_OFFSET (-11) 119 #define PCRE_ERROR_PARTIAL (-12) 120 #define PCRE_ERROR_BADPARTIAL (-13) 121 #define PCRE_ERROR_INTERNAL (-14) 122 #define PCRE_ERROR_BADCOUNT (-15) 123 #define PCRE_ERROR_DFA_UITEM (-16) 124 #define PCRE_ERROR_DFA_UCOND (-17) 125 #define PCRE_ERROR_DFA_UMLIMIT (-18) 126 #define PCRE_ERROR_DFA_WSSIZE (-19) 127 #define PCRE_ERROR_DFA_RECURSE (-20) 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) 128 68 129 69 /* Request types for pcre_fullinfo() */ 130 70 131 #define PCRE_INFO_OPTIONS 0 132 #define PCRE_INFO_SIZE 1 133 #define PCRE_INFO_CAPTURECOUNT 2 134 #define PCRE_INFO_BACKREFMAX 3 135 #define PCRE_INFO_FIRSTBYTE 4 136 #define PCRE_INFO_FIRSTCHAR 4 /* For backwards compatibility */ 137 #define PCRE_INFO_FIRSTTABLE 5 138 #define PCRE_INFO_LASTLITERAL 6 139 #define PCRE_INFO_NAMEENTRYSIZE 7 140 #define PCRE_INFO_NAMECOUNT 8 141 #define PCRE_INFO_NAMETABLE 9 142 #define PCRE_INFO_STUDYSIZE 10 143 #define PCRE_INFO_DEFAULT_TABLES 11 144 145 /* Request types for pcre_config() */ 146 147 #define PCRE_CONFIG_UTF8 0 148 #define PCRE_CONFIG_NEWLINE 1 149 #define PCRE_CONFIG_LINK_SIZE 2 150 #define PCRE_CONFIG_POSIX_MALLOC_THRESHOLD 3 151 #define PCRE_CONFIG_MATCH_LIMIT 4 152 #define PCRE_CONFIG_STACKRECURSE 5 153 #define PCRE_CONFIG_UNICODE_PROPERTIES 6 154 155 /* Bit flags for the pcre_extra structure */ 156 157 #define PCRE_EXTRA_STUDY_DATA 0x0001 158 #define PCRE_EXTRA_MATCH_LIMIT 0x0002 159 #define PCRE_EXTRA_CALLOUT_DATA 0x0004 160 #define PCRE_EXTRA_TABLES 0x0008 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 161 78 162 79 /* Types */ 163 80 164 struct real_pcre; /* declaration; the definition is private */ 81 struct real_pcre; /* declaration; the definition is private */ 82 struct real_pcre_extra; /* declaration; the definition is private */ 83 165 84 typedef struct real_pcre pcre; 85 typedef struct real_pcre_extra pcre_extra; 166 86 167 /* The structure for passing additional data to pcre_exec(). This is defined in 168 such as way as to be extensible. Always add new fields at the end, in order to 169 remain compatible. */ 87 #if PCRE_UTF16 88 #include <stdint.h> 89 typedef uint16_t pcre_char; 90 #else 91 typedef char pcre_char; 92 #endif 170 93 171 typedef struct pcre_extra { 172 unsigned long int flags; /* Bits for which fields are set */ 173 void *study_data; /* Opaque data from pcre_study() */ 174 unsigned long int match_limit; /* Maximum number of calls to match() */ 175 void *callout_data; /* Data passed back in callouts */ 176 const unsigned char *tables; /* Pointer to character tables */ 177 } pcre_extra; 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. */ 178 97 179 /* The structure for passing out data via the pcre_callout_function. We use a 180 structure so that new fields can be added on the end in future versions, 181 without changing the API of the function, thereby allowing old clients to work 182 without modification. */ 98 PCRE_DL_IMPORT extern void *(*pcre_malloc)(size_t); 99 PCRE_DL_IMPORT extern void (*pcre_free)(void *); 183 100 184 typedef struct pcre_callout_block { 185 int version; /* Identifies version of block */ 186 /* ------------------------ Version 0 ------------------------------- */ 187 int callout_number; /* Number compiled into pattern */ 188 int *offset_vector; /* The offset vector */ 189 const char *subject; /* The subject being matched */ 190 int subject_length; /* The length of the subject */ 191 int start_match; /* Offset to start of this match attempt */ 192 int current_position; /* Where we currently are in the subject */ 193 int capture_top; /* Max current capture */ 194 int capture_last; /* Most recently closed capture */ 195 void *callout_data; /* Data passed in with the call */ 196 /* ------------------- Added for Version 1 -------------------------- */ 197 int pattern_position; /* Offset to next item in the pattern */ 198 int next_item_length; /* Length of next item in the pattern */ 199 /* ------------------------------------------------------------------ */ 200 } pcre_callout_block; 101 #undef PCRE_DL_IMPORT 201 102 202 /* Indirection for store get and free functions. These can be set to 203 alternative malloc/free functions if required. Special ones are used in the 204 non-recursive case for "frames". There is also an optional callout function 205 that is triggered by the (?) regex item. For Virtual Pascal, these definitions 206 have to take another form. */ 103 /* Functions */ 207 104 208 #ifndef VPCOMPAT 209 PCRE_DATA_SCOPE void *(*pcre_malloc)(size_t); 210 PCRE_DATA_SCOPE void (*pcre_free)(void *); 211 PCRE_DATA_SCOPE void *(*pcre_stack_malloc)(size_t); 212 PCRE_DATA_SCOPE void (*pcre_stack_free)(void *); 213 PCRE_DATA_SCOPE int (*pcre_callout)(pcre_callout_block *); 214 #else /* VPCOMPAT */ 215 PCRE_DATA_SCOPE void *pcre_malloc(size_t); 216 PCRE_DATA_SCOPE void pcre_free(void *); 217 PCRE_DATA_SCOPE void *pcre_stack_malloc(size_t); 218 PCRE_DATA_SCOPE void pcre_stack_free(void *); 219 PCRE_DATA_SCOPE int pcre_callout(pcre_callout_block *); 220 #endif /* VPCOMPAT */ 221 222 /* Exported PCRE functions */ 223 224 PCRE_DATA_SCOPE pcre *pcre_compile(const char *, int, const char **, int *, 225 const unsigned char *); 226 PCRE_DATA_SCOPE pcre *pcre_compile2(const char *, int, int *, const char **, 227 int *, const unsigned char *); 228 PCRE_DATA_SCOPE int pcre_config(int, void *); 229 PCRE_DATA_SCOPE int pcre_copy_named_substring(const pcre *, const char *, 230 int *, int, const char *, char *, int); 231 PCRE_DATA_SCOPE int pcre_copy_substring(const char *, int *, int, int, char *, 232 int); 233 PCRE_DATA_SCOPE int pcre_dfa_exec(const pcre *, const pcre_extra *, 234 const char *, int, int, int, int *, int , int *, int); 235 PCRE_DATA_SCOPE int pcre_exec(const pcre *, const pcre_extra *, const char *, 236 int, int, int, int *, int); 237 PCRE_DATA_SCOPE void pcre_free_substring(const char *); 238 PCRE_DATA_SCOPE void pcre_free_substring_list(const char **); 239 PCRE_DATA_SCOPE int pcre_fullinfo(const pcre *, const pcre_extra *, int, 240 void *); 241 PCRE_DATA_SCOPE int pcre_get_named_substring(const pcre *, const char *, 242 int *, int, const char *, const char **); 243 PCRE_DATA_SCOPE int pcre_get_stringnumber(const pcre *, const char *); 244 PCRE_DATA_SCOPE int pcre_get_substring(const char *, int *, int, int, 245 const char **); 246 PCRE_DATA_SCOPE int pcre_get_substring_list(const char *, int *, int, 247 const char ***); 248 PCRE_DATA_SCOPE int pcre_info(const pcre *, int *, int *); 249 PCRE_DATA_SCOPE const unsigned char *pcre_maketables(void); 250 PCRE_DATA_SCOPE int pcre_refcount(pcre *, int); 251 PCRE_DATA_SCOPE pcre_extra *pcre_study(const pcre *, int, const char **); 252 PCRE_DATA_SCOPE const char *pcre_version(void); 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); 253 119 254 120 #ifdef __cplusplus
Note:
See TracChangeset
for help on using the changeset viewer.