Changeset 10495 in webkit for trunk/JavaScriptCore/pcre/pcre.h
- Timestamp:
- Sep 8, 2005, 5:51:07 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.