/[pcre]/code/trunk/pcre_internal.h
ViewVC logotype

Diff of /code/trunk/pcre_internal.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 341 by ph10, Sat Apr 19 16:41:04 2008 UTC revision 371 by ph10, Mon Aug 25 18:28:05 2008 UTC
# Line 132  PCRE_EXP_DATA_DEFN only if they are not Line 132  PCRE_EXP_DATA_DEFN only if they are not
132  #  endif  #  endif
133  #endif  #endif
134    
135    /* When compiling with the MSVC compiler, it is sometimes necessary to include
136    a "calling convention" before exported function names. (This is secondhand
137    information; I know nothing about MSVC myself). For example, something like
138    
139      void __cdecl function(....)
140    
141    might be needed. In order so make this easy, all the exported functions have
142    PCRE_CALL_CONVENTION just before their names. It is rarely needed; if not
143    set, we ensure here that it has no effect. */
144    
145    #ifndef PCRE_CALL_CONVENTION
146    #define PCRE_CALL_CONVENTION
147    #endif
148    
149  /* We need to have types that specify unsigned 16-bit and 32-bit integers. We  /* We need to have types that specify unsigned 16-bit and 32-bit integers. We
150  cannot determine these outside the compilation (e.g. by running a program as  cannot determine these outside the compilation (e.g. by running a program as
151  part of "configure") because PCRE is often cross-compiled for use on other  part of "configure") because PCRE is often cross-compiled for use on other
# Line 140  preprocessor time in standard C environm Line 154  preprocessor time in standard C environm
154    
155  #if USHRT_MAX == 65535  #if USHRT_MAX == 65535
156    typedef unsigned short pcre_uint16;    typedef unsigned short pcre_uint16;
157      typedef short pcre_int16;
158  #elif UINT_MAX == 65535  #elif UINT_MAX == 65535
159    typedef unsigned int pcre_uint16;    typedef unsigned int pcre_uint16;
160      typedef int pcre_int16;
161  #else  #else
162    #error Cannot determine a type for 16-bit unsigned integers    #error Cannot determine a type for 16-bit unsigned integers
163  #endif  #endif
164    
165  #if UINT_MAX == 4294967295  #if UINT_MAX == 4294967295
166    typedef unsigned int pcre_uint32;    typedef unsigned int pcre_uint32;
167      typedef int pcre_int32;
168  #elif ULONG_MAX == 4294967295  #elif ULONG_MAX == 4294967295
169    typedef unsigned long int pcre_uint32;    typedef unsigned long int pcre_uint32;
170      typedef long int pcre_int32;
171  #else  #else
172    #error Cannot determine a type for 32-bit unsigned integers    #error Cannot determine a type for 32-bit unsigned integers
173  #endif  #endif
# Line 363  never be called in byte mode. To make su Line 381  never be called in byte mode. To make su
381  support is omitted, we don't even define it. */  support is omitted, we don't even define it. */
382    
383  #ifndef SUPPORT_UTF8  #ifndef SUPPORT_UTF8
 #define NEXTCHAR(p) p++;  
384  #define GETCHAR(c, eptr) c = *eptr;  #define GETCHAR(c, eptr) c = *eptr;
385  #define GETCHARTEST(c, eptr) c = *eptr;  #define GETCHARTEST(c, eptr) c = *eptr;
386  #define GETCHARINC(c, eptr) c = *eptr++;  #define GETCHARINC(c, eptr) c = *eptr++;
# Line 373  support is omitted, we don't even define Line 390  support is omitted, we don't even define
390    
391  #else   /* SUPPORT_UTF8 */  #else   /* SUPPORT_UTF8 */
392    
 /* Advance a character pointer one byte in non-UTF-8 mode and by one character  
 in UTF-8 mode. */  
   
 #define NEXTCHAR(p) \  
   p++; \  
   if (utf8) { while((*p & 0xc0) == 0x80) p++; }  
   
393  /* Get the next UTF-8 character, not advancing the pointer. This is called when  /* Get the next UTF-8 character, not advancing the pointer. This is called when
394  we know we are in UTF-8 mode. */  we know we are in UTF-8 mode. */
395    
# Line 549  variable-length repeat, or a anything ot Line 559  variable-length repeat, or a anything ot
559  #define REQ_CASELESS 0x0100    /* indicates caselessness */  #define REQ_CASELESS 0x0100    /* indicates caselessness */
560  #define REQ_VARY     0x0200    /* reqbyte followed non-literal item */  #define REQ_VARY     0x0200    /* reqbyte followed non-literal item */
561    
562  /* Miscellaneous definitions */  /* Miscellaneous definitions. The #ifndef is to pacify compiler warnings in
563    environments where these macros are defined elsewhere. */
564    
565    #ifndef FALSE
566  typedef int BOOL;  typedef int BOOL;
567    
568  #define FALSE   0  #define FALSE   0
569  #define TRUE    1  #define TRUE    1
570    #endif
571    
572  /* Escape items that are just an encoding of a particular data value. */  /* Escape items that are just an encoding of a particular data value. */
573    
# Line 605  contain UTF-8 characters with values gre Line 618  contain UTF-8 characters with values gre
618  value such as \n. They must have non-zero values, as check_escape() returns  value such as \n. They must have non-zero values, as check_escape() returns
619  their negation. Also, they must appear in the same order as in the opcode  their negation. Also, they must appear in the same order as in the opcode
620  definitions below, up to ESC_z. There's a dummy for OP_ANY because it  definitions below, up to ESC_z. There's a dummy for OP_ANY because it
621  corresponds to "." rather than an escape sequence, and another for OP_ALLANY  corresponds to "." rather than an escape sequence, and another for OP_ALLANY
622  (which is used for [^] in JavaScript compatibility mode).  (which is used for [^] in JavaScript compatibility mode).
623    
624  The final escape must be ESC_REF as subsequent values are used for  The final escape must be ESC_REF as subsequent values are used for
# Line 616  put in between that don't consume a char Line 629  put in between that don't consume a char
629  */  */
630    
631  enum { ESC_A = 1, ESC_G, ESC_K, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s,  enum { ESC_A = 1, ESC_G, ESC_K, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s,
632         ESC_W, ESC_w, ESC_dum1, ESC_dum2, ESC_C, ESC_P, ESC_p, ESC_R, ESC_H,         ESC_W, ESC_w, ESC_dum1, ESC_dum2, ESC_C, ESC_P, ESC_p, ESC_R, ESC_H,
633         ESC_h, ESC_V, ESC_v, ESC_X, ESC_Z, ESC_z, ESC_E, ESC_Q, ESC_g, ESC_k,         ESC_h, ESC_V, ESC_v, ESC_X, ESC_Z, ESC_z, ESC_E, ESC_Q, ESC_g, ESC_k,
634         ESC_REF };         ESC_REF };
635    
636    
# Line 780  enum { Line 793  enum {
793    
794    OP_FAIL,           /* 109 */    OP_FAIL,           /* 109 */
795    OP_ACCEPT,         /* 110 */    OP_ACCEPT,         /* 110 */
796    
797    /* This is used to skip a subpattern with a {0} quantifier */    /* This is used to skip a subpattern with a {0} quantifier */
798    
799    OP_SKIPZERO        /* 111 */    OP_SKIPZERO        /* 111 */
800  };  };
801    
# Line 809  for debugging. The macro is referenced o Line 822  for debugging. The macro is referenced o
822    "Once", "Bra", "CBra", "Cond", "SBra", "SCBra", "SCond",        \    "Once", "Bra", "CBra", "Cond", "SBra", "SCBra", "SCond",        \
823    "Cond ref", "Cond rec", "Cond def", "Brazero", "Braminzero",    \    "Cond ref", "Cond rec", "Cond def", "Brazero", "Braminzero",    \
824    "*PRUNE", "*SKIP", "*THEN", "*COMMIT", "*FAIL", "*ACCEPT",      \    "*PRUNE", "*SKIP", "*THEN", "*COMMIT", "*FAIL", "*ACCEPT",      \
825    "Skip zero"    "Skip zero"
826    
827    
828  /* This macro defines the length of fixed length operations in the compiled  /* This macro defines the length of fixed length operations in the compiled
# Line 1015  typedef struct match_data { Line 1028  typedef struct match_data {
1028    BOOL   notbol;                /* NOTBOL flag */    BOOL   notbol;                /* NOTBOL flag */
1029    BOOL   noteol;                /* NOTEOL flag */    BOOL   noteol;                /* NOTEOL flag */
1030    BOOL   utf8;                  /* UTF8 flag */    BOOL   utf8;                  /* UTF8 flag */
1031    BOOL   jscript_compat;        /* JAVASCRIPT_COMPAT flag */    BOOL   jscript_compat;        /* JAVASCRIPT_COMPAT flag */
1032    BOOL   endonly;               /* Dollar not before final \n */    BOOL   endonly;               /* Dollar not before final \n */
1033    BOOL   notempty;              /* Empty string match not wanted */    BOOL   notempty;              /* Empty string match not wanted */
1034    BOOL   partial;               /* PARTIAL flag */    BOOL   partial;               /* PARTIAL flag */
# Line 1126  extern BOOL _pcre_is_newline(con Line 1139  extern BOOL _pcre_is_newline(con
1139  extern int          _pcre_ord2utf8(int, uschar *);  extern int          _pcre_ord2utf8(int, uschar *);
1140  extern real_pcre   *_pcre_try_flipped(const real_pcre *, real_pcre *,  extern real_pcre   *_pcre_try_flipped(const real_pcre *, real_pcre *,
1141                        const pcre_study_data *, pcre_study_data *);                        const pcre_study_data *, pcre_study_data *);
 extern int          _pcre_ucp_findprop(const unsigned int, int *, int *);  
 extern unsigned int _pcre_ucp_othercase(const unsigned int);  
1142  extern int          _pcre_valid_utf8(const uschar *, int);  extern int          _pcre_valid_utf8(const uschar *, int);
1143  extern BOOL         _pcre_was_newline(const uschar *, int, const uschar *,  extern BOOL         _pcre_was_newline(const uschar *, int, const uschar *,
1144                        int *, BOOL);                        int *, BOOL);
1145  extern BOOL         _pcre_xclass(int, const uschar *);  extern BOOL         _pcre_xclass(int, const uschar *);
1146    
1147    
1148    /* Unicode character database (UCD) */
1149    
1150    typedef struct {
1151      uschar script;
1152      uschar chartype;
1153      pcre_int32 other_case;
1154    } ucd_record;
1155    
1156    extern const ucd_record  _pcre_ucd_records[];
1157    extern const uschar      _pcre_ucd_stage1[];
1158    extern const pcre_uint16 _pcre_ucd_stage2[];
1159    extern const int         _pcre_ucp_gentype[];
1160    
1161    
1162    /* UCD access macros */
1163    
1164    #define UCD_BLOCK_SIZE 128
1165    #define GET_UCD(ch) (_pcre_ucd_records + \
1166            _pcre_ucd_stage2[_pcre_ucd_stage1[(ch) / UCD_BLOCK_SIZE] * \
1167            UCD_BLOCK_SIZE + ch % UCD_BLOCK_SIZE])
1168    
1169    #define UCD_CHARTYPE(ch)  GET_UCD(ch)->chartype
1170    #define UCD_SCRIPT(ch)    GET_UCD(ch)->script
1171    #define UCD_CATEGORY(ch)  _pcre_ucp_gentype[UCD_CHARTYPE(ch)]
1172    #define UCD_OTHERCASE(ch) (ch + GET_UCD(ch)->other_case)
1173    
1174  #endif  #endif
1175    
1176  /* End of pcre_internal.h */  /* End of pcre_internal.h */

Legend:
Removed from v.341  
changed lines
  Added in v.371

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12