Changeset 26697 in webkit for trunk/JavaScriptCore/pcre/pcre_internal.h
- Timestamp:
- Oct 16, 2007, 10:38:39 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/pcre/pcre_internal.h
r24453 r26697 8 8 9 9 Written by Philip Hazel 10 Copyright (c) 1997-200 5University of Cambridge10 Copyright (c) 1997-2006 University of Cambridge 11 11 Copyright (c) 2004, 2005 Apple Computer, Inc. 12 12 … … 48 48 49 49 #include "Assertions.h" 50 51 /* Added to prevent 64-to-32 shortening warnings when compiling for 64-bit52 <rdar://problem/4712064> PCRE generates many warnings with -Wshorten-64-to-32 */53 #if defined(__GNUC__) && defined(__LP64__)54 #define INT_CAST(i) (int)(i); ASSERT((i) <= INT_MAX)55 #else56 #define INT_CAST(i) (i)57 #endif58 50 59 51 #if COMPILER(MSVC) … … 138 130 #endif 139 131 140 /* Include the public PCRE header and the definitions of UCP character property141 values. */142 143 #include "pcre.h"144 #include "ucp.h"145 146 132 /* All character handling must be done as unsigned characters. Otherwise there 147 133 are problems with top-bit-set characters and functions such as isspace(). … … 153 139 typedef unsigned char uschar; 154 140 155 /* Use pcre_uchar for always-unsigned version of pcre_char. */ 141 /* When PCRE is compiled as a C++ library, the subject pointer can be replaced 142 with a custom type. This makes it possible, for example, to allow pcre_exec() 143 to process subject strings that are discontinuous by using a smart pointer 144 class. It must always be possible to inspect all of the subject string in 145 pcre_exec() because of the way it backtracks. Two macros are required in the 146 normal case, for sign-unspecified and unsigned char pointers. The former is 147 used for the external interface and appears in pcre.h, which is why its name 148 must begin with PCRE_. */ 149 150 #ifdef CUSTOM_SUBJECT_PTR 151 #define PCRE_SPTR CUSTOM_SUBJECT_PTR 152 #define USPTR CUSTOM_SUBJECT_PTR 153 #else 154 #define USPTR const pcre_uchar * 155 #endif 156 157 /* Include the public PCRE header and the definitions of UCP character property 158 values. */ 159 160 #include "pcre.h" 161 #include "ucp.h" 162 163 /* Unsigned version of pcre_char. */ 156 164 #if PCRE_UTF16 157 165 typedef pcre_char pcre_uchar; … … 186 194 pcre_memmove(unsigned char *dest, const unsigned char *src, size_t n) 187 195 { 188 int i;196 size_t i; 189 197 dest += n; 190 198 src += n; 191 199 for (i = 0; i < n; ++i) *(--dest) = *(--src); 200 return dest; 192 201 } 193 202 #define memmove(a, b, c) pcre_memmove(a, b, c) … … 408 417 know we are in UTF-8 mode. */ 409 418 410 #define GETCHARINC GETUTF8CHARINC419 #define GETCHARINC(c, eptr) GETUTF8CHARINC(c, eptr) 411 420 412 421 /* Get the next character, testing for UTF-8 mode, and advancing the pointer */ … … 546 555 #endif 547 556 557 /* Codes for different types of Unicode property */ 558 559 #define PT_ANY 0 /* Any property - matches all chars */ 560 #define PT_LAMP 1 /* L& - the union of Lu, Ll, Lt */ 561 #define PT_GC 2 /* General characteristic (e.g. L) */ 562 #define PT_PC 3 /* Particular characteristic (e.g. Lu) */ 563 #define PT_SC 4 /* Script (e.g. Han) */ 564 565 /* Flag bits and data types for the extended class (OP_XCLASS) for classes that 566 contain UTF-8 characters with values greater than 255. */ 567 568 #define XCL_NOT 0x01 /* Flag: this is a negative class */ 569 #define XCL_MAP 0x02 /* Flag: a 32-byte map is present */ 570 571 #define XCL_END 0 /* Marks end of individual items */ 572 #define XCL_SINGLE 1 /* Single item (one multibyte char) follows */ 573 #define XCL_RANGE 2 /* A range (two multibyte chars) follows */ 574 #define XCL_PROP 3 /* Unicode property (2-byte property code follows) */ 575 #define XCL_NOTPROP 4 /* Unicode inverted property (ditto) */ 576 548 577 /* These are escaped items that aren't just an encoding of a particular data 549 578 value such as \n. They must have non-zero values, as check_escape() returns … … 560 589 ESC_w, ESC_dum1, ESC_C, ESC_P, ESC_p, ESC_X, ESC_Z, ESC_z, ESC_E, 561 590 ESC_Q, ESC_REF }; 562 563 /* Flag bits and data types for the extended class (OP_XCLASS) for classes that564 contain UTF-8 characters with values greater than 255. */565 566 #define XCL_NOT 0x01 /* Flag: this is a negative class */567 #define XCL_MAP 0x02 /* Flag: a 32-byte map is present */568 569 #define XCL_END 0 /* Marks end of individual items */570 #define XCL_SINGLE 1 /* Single item (one multibyte char) follows */571 #define XCL_RANGE 2 /* A range (two multibyte chars) follows */572 #define XCL_PROP 3 /* Unicode property (one property code) follows */573 #define XCL_NOTPROP 4 /* Unicode inverted property (ditto) */574 575 591 576 592 /* Opcode table: OP_BRA must be last, as all values >= it are used for brackets … … 737 753 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* \A, \G, \B, \B, \D, \d, \S, \s, \W, \w */ \ 738 754 1, 1, /* Any, Anybyte */ \ 739 2, 2, 1, /* NOTPROP, PROP, EXTUNI */ \755 3, 3, 1, /* NOTPROP, PROP, EXTUNI */ \ 740 756 1, 1, 2, 1, 1, /* \Z, \z, Opt, ^, $ */ \ 741 757 2, /* Char - the minimum length */ \ … … 869 885 int group_num; /* Number of group that was called */ 870 886 const uschar *after_call; /* "Return value": points after the call in the expr */ 871 const pcre_uchar *save_start;/* Old value of md->start_match */887 USPTR save_start; /* Old value of md->start_match */ 872 888 int *offset_save; /* Pointer to start of saved offsets */ 873 889 int saved_max; /* Number of saved offsets */ … … 888 904 889 905 typedef struct match_data { 890 unsigned long int match_call_count; /* As it says */ 891 unsigned long int match_limit;/* As it says */ 906 unsigned long int match_call_count; /* As it says */ 907 unsigned long int match_limit; /* As it says */ 908 unsigned long int match_limit_recursion; /* As it says */ 892 909 int *offset_vector; /* Offset vector */ 893 910 int offset_end; /* One past the end */ … … 904 921 BOOL hitend; /* Hit the end of the subject at some point */ 905 922 const uschar *start_code; /* For use when recursing */ 906 const pcre_uchar *start_subject;/* Start of the subject string */907 const pcre_uchar *end_subject;/* End of the subject string */908 const pcre_uchar *start_match;/* Start of this match attempt */909 const pcre_uchar *end_match_ptr;/* Subject position at end match */923 USPTR start_subject; /* Start of the subject string */ 924 USPTR end_subject; /* End of the subject string */ 925 USPTR start_match; /* Start of this match attempt */ 926 USPTR end_match_ptr; /* Subject position at end match */ 910 927 int end_offset_top; /* Highwater mark at end of match */ 911 928 int capture_last; /* Most recent capture number */ … … 962 979 #define tables_length (ctypes_offset + 256) 963 980 964 /* Layout of the UCP type table that translates property names into codes for965 _pcre_ucp_findchar(). */981 /* Layout of the UCP type table that translates property names into types and 982 codes. */ 966 983 967 984 typedef struct { 968 985 const char *name; 969 int value; 986 pcre_uint16 type; 987 pcre_uint16 value; 970 988 } ucp_type_table; 971 989 … … 990 1008 extern const uschar _pcre_OP_lengths[]; 991 1009 1010 992 1011 /* Internal shared functions. These are functions that are used by more than 993 1012 one of the exported public functions. They have to be "external" in the C … … 997 1016 extern real_pcre * _pcre_try_flipped(const real_pcre *, real_pcre *, 998 1017 const pcre_study_data *, pcre_study_data *); 999 extern int _pcre_ucp_findchar(const int, int *, int *); 1018 extern int _pcre_ucp_findprop(const int, int *, int *); 1019 extern int _pcre_ucp_othercase(const int); 1000 1020 extern int _pcre_valid_utf8(const uschar *, int); 1001 1021 extern BOOL _pcre_xclass(int, const uschar *);
Note:
See TracChangeset
for help on using the changeset viewer.