/[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 1145 by ph10, Fri Oct 19 16:25:32 2012 UTC revision 1216 by zherczeg, Fri Nov 9 13:05:29 2012 UTC
# Line 112  setjmp and stdarg are used is when NO_RE Line 112  setjmp and stdarg are used is when NO_RE
112  #include <stdlib.h>  #include <stdlib.h>
113  #include <string.h>  #include <string.h>
114    
115    /* Valgrind (memcheck) support */
116    
117    #ifdef SUPPORT_VALGRIND
118    #include <valgrind/memcheck.h>
119    #endif
120    
121  /* When compiling a DLL for Windows, the exported symbols have to be declared  /* When compiling a DLL for Windows, the exported symbols have to be declared
122  using some MS magic. I found some useful information on this web page:  using some MS magic. I found some useful information on this web page:
123  http://msdn2.microsoft.com/en-us/library/y4h7bcy6(VS.80).aspx. According to the  http://msdn2.microsoft.com/en-us/library/y4h7bcy6(VS.80).aspx. According to the
# Line 194  typedef unsigned char pcre_uint8; Line 200  typedef unsigned char pcre_uint8;
200    typedef unsigned int pcre_uint16;    typedef unsigned int pcre_uint16;
201    typedef int pcre_int16;    typedef int pcre_int16;
202  #else  #else
203    #error Cannot determine a type for 16-bit unsigned integers  # error Cannot determine a type for 16-bit unsigned integers
204  #endif  #endif
205    
206  #if UINT_MAX == 4294967295  #if UINT_MAX == 4294967295
# Line 204  typedef unsigned char pcre_uint8; Line 210  typedef unsigned char pcre_uint8;
210    typedef unsigned long int pcre_uint32;    typedef unsigned long int pcre_uint32;
211    typedef long int pcre_int32;    typedef long int pcre_int32;
212  #else  #else
213    #error Cannot determine a type for 32-bit unsigned integers  # error Cannot determine a type for 32-bit unsigned integers
214  #endif  #endif
215    
216  /* When checking for integer overflow in pcre_compile(), we need to handle  /* When checking for integer overflow in pcre_compile(), we need to handle
# Line 215  stdint.h is available, include it; it ma Line 221  stdint.h is available, include it; it ma
221  have stdint.h (e.g. Solaris) may have inttypes.h. The macro int64_t may be set  have stdint.h (e.g. Solaris) may have inttypes.h. The macro int64_t may be set
222  by "configure". */  by "configure". */
223    
224  #if HAVE_STDINT_H  #if defined HAVE_STDINT_H
225  #include <stdint.h>  #include <stdint.h>
226  #elif HAVE_INTTYPES_H  #elif defined HAVE_INTTYPES_H
227  #include <inttypes.h>  #include <inttypes.h>
228  #endif  #endif
229    
# Line 273  typedef pcre_uint32 pcre_uchar; Line 279  typedef pcre_uint32 pcre_uchar;
279  #define MAX_255(c) ((c) <= 255u)  #define MAX_255(c) ((c) <= 255u)
280  #define TABLE_GET(c, table, default) (MAX_255(c)? ((table)[c]):(default))  #define TABLE_GET(c, table, default) (MAX_255(c)? ((table)[c]):(default))
281    
 /* Assert that pcre_uchar32 is a 32-bit type */  
 typedef int __assert_pcre_uchar32_size[sizeof(pcre_uchar) == 4 ? 1 : -1];  
   
282  #else  #else
283  #error Unsupported compiling mode  #error Unsupported compiling mode
284  #endif /* COMPILE_PCRE[8|16|32] */  #endif /* COMPILE_PCRE[8|16|32] */
# Line 345  values. */ Line 348  values. */
348  #include "pcre.h"  #include "pcre.h"
349  #include "ucp.h"  #include "ucp.h"
350    
351    #ifdef COMPILE_PCRE32
352    /* Assert that the public PCRE_UCHAR32 is a 32-bit type */
353    typedef int __assert_pcre_uchar32_size[sizeof(PCRE_UCHAR32) == 4 ? 1 : -1];
354    #endif
355    
356  /* When compiling for use with the Virtual Pascal compiler, these functions  /* When compiling for use with the Virtual Pascal compiler, these functions
357  need to have their names changed. PCRE must be compiled with the -DVPCOMPAT  need to have their names changed. PCRE must be compiled with the -DVPCOMPAT
358  option on the command line. */  option on the command line. */
# Line 770  we know we are in UTF mode. */ Line 778  we know we are in UTF mode. */
778  we know we are in UTF mode. */  we know we are in UTF mode. */
779    
780  #define RAWUCHARINC(eptr) \  #define RAWUCHARINC(eptr) \
781    (*(eptr)++)    (*((eptr)++))
782    
783  /* Returns the next uchar, testing for UTF mode, and not advancing the  /* Returns the next uchar, testing for UTF mode, and not advancing the
784  pointer. */  pointer. */
# Line 782  pointer. */ Line 790  pointer. */
790  pointer. */  pointer. */
791    
792  #define RAWUCHARINCTEST(eptr) \  #define RAWUCHARINCTEST(eptr) \
793    (*(eptr)++)    (*((eptr)++))
794    
795  /* If the pointer is not at the start of a character, move it back until  /* If the pointer is not at the start of a character, move it back until
796  it is. This is called only in UTF-8 mode - we don't put a test within the macro  it is. This is called only in UTF-8 mode - we don't put a test within the macro
# Line 889  we know we are in UTF mode. */ Line 897  we know we are in UTF mode. */
897  we know we are in UTF mode. */  we know we are in UTF mode. */
898    
899  #define RAWUCHARINC(eptr) \  #define RAWUCHARINC(eptr) \
900    (*(eptr)++)    (*((eptr)++))
901    
902  /* Returns the next uchar, testing for UTF mode, and not advancing the  /* Returns the next uchar, testing for UTF mode, and not advancing the
903  pointer. */  pointer. */
# Line 901  pointer. */ Line 909  pointer. */
909  pointer. */  pointer. */
910    
911  #define RAWUCHARINCTEST(eptr) \  #define RAWUCHARINCTEST(eptr) \
912    (*(eptr)++)    (*((eptr)++))
913    
914  /* If the pointer is not at the start of a character, move it back until  /* If the pointer is not at the start of a character, move it back until
915  it is. This is called only in UTF-16 mode - we don't put a test within the  it is. This is called only in UTF-16 mode - we don't put a test within the
# Line 926  into one pcre_uchar unit. */ Line 934  into one pcre_uchar unit. */
934  #define GET_EXTRALEN(c) (0)  #define GET_EXTRALEN(c) (0)
935  #define NOT_FIRSTCHAR(c) (0)  #define NOT_FIRSTCHAR(c) (0)
936    
 #define UTF32_MASK (0x1fffffu)  
   
937  /* Get the next UTF-32 character, not advancing the pointer. This is called when  /* Get the next UTF-32 character, not advancing the pointer. This is called when
938  we know we are in UTF-32 mode. */  we know we are in UTF-32 mode. */
939    
940  #define GETCHAR(c, eptr) \  #define GETCHAR(c, eptr) \
941    c = (*eptr) & UTF32_MASK;    c = *(eptr);
942    
943  /* Get the next UTF-32 character, testing for UTF-32 mode, and not advancing the  /* Get the next UTF-32 character, testing for UTF-32 mode, and not advancing the
944  pointer. */  pointer. */
945    
946  #define GETCHARTEST(c, eptr) \  #define GETCHARTEST(c, eptr) \
947    c = *eptr; \    c = *(eptr);
   if (utf) c &= UTF32_MASK;  
948    
949  /* Get the next UTF-32 character, advancing the pointer. This is called when we  /* Get the next UTF-32 character, advancing the pointer. This is called when we
950  know we are in UTF-32 mode. */  know we are in UTF-32 mode. */
951    
952  #define GETCHARINC(c, eptr) \  #define GETCHARINC(c, eptr) \
953    c = (*eptr++) & UTF32_MASK;    c = *((eptr)++);
954    
955  /* Get the next character, testing for UTF-32 mode, and advancing the pointer.  /* Get the next character, testing for UTF-32 mode, and advancing the pointer.
956  This is called when we don't know if we are in UTF-32 mode. */  This is called when we don't know if we are in UTF-32 mode. */
957    
958  #define GETCHARINCTEST(c, eptr) \  #define GETCHARINCTEST(c, eptr) \
959    c = *eptr++; \    c = *((eptr)++);
   if (utf) c &= UTF32_MASK;  
960    
961  /* Get the next UTF-32 character, not advancing the pointer, not incrementing  /* Get the next UTF-32 character, not advancing the pointer, not incrementing
962  length (since all UTF-32 is of length 1). This is called when we know we are in  length (since all UTF-32 is of length 1). This is called when we know we are in
# Line 972  This is called when we do not know if we Line 976  This is called when we do not know if we
976  we know we are in UTF mode. */  we know we are in UTF mode. */
977    
978  #define RAWUCHAR(eptr) \  #define RAWUCHAR(eptr) \
979    (*(eptr) & UTF32_MASK)    (*(eptr))
980    
981  /* Returns the next uchar, advancing the pointer. This is called when  /* Returns the next uchar, advancing the pointer. This is called when
982  we know we are in UTF mode. */  we know we are in UTF mode. */
983    
984  #define RAWUCHARINC(eptr) \  #define RAWUCHARINC(eptr) \
985    (*(eptr)++ & UTF32_MASK)    (*((eptr)++))
986    
987  /* Returns the next uchar, testing for UTF mode, and not advancing the  /* Returns the next uchar, testing for UTF mode, and not advancing the
988  pointer. */  pointer. */
989    
990  #define RAWUCHARTEST(eptr) \  #define RAWUCHARTEST(eptr) \
991    (utf ? (*(eptr) & UTF32_MASK) : *(eptr))    (*(eptr))
992    
993  /* Returns the next uchar, testing for UTF mode, advancing the  /* Returns the next uchar, testing for UTF mode, advancing the
994  pointer. */  pointer. */
995    
996  #define RAWUCHARINCTEST(eptr) \  #define RAWUCHARINCTEST(eptr) \
997    (utf ? (*(eptr)++ & UTF32_MASK) : *(eptr)++)    (*((eptr)++))
998    
999  /* If the pointer is not at the start of a character, move it back until  /* If the pointer is not at the start of a character, move it back until
1000  it is. This is called only in UTF-32 mode - we don't put a test within the  it is. This is called only in UTF-32 mode - we don't put a test within the
# Line 1177  time, run time, or study time, respectiv Line 1181  time, run time, or study time, respectiv
1181     (PCRE_STUDY_JIT_COMPILE|PCRE_STUDY_JIT_PARTIAL_SOFT_COMPILE| \     (PCRE_STUDY_JIT_COMPILE|PCRE_STUDY_JIT_PARTIAL_SOFT_COMPILE| \
1182      PCRE_STUDY_JIT_PARTIAL_HARD_COMPILE|PCRE_STUDY_EXTRA_NEEDED)      PCRE_STUDY_JIT_PARTIAL_HARD_COMPILE|PCRE_STUDY_EXTRA_NEEDED)
1183    
1184    #define PUBLIC_JIT_EXEC_OPTIONS \
1185       (PCRE_NO_UTF8_CHECK|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|\
1186        PCRE_NOTEMPTY_ATSTART|PCRE_PARTIAL_SOFT|PCRE_PARTIAL_HARD)
1187    
1188  /* Magic number to provide a small check against being handed junk. */  /* Magic number to provide a small check against being handed junk. */
1189    
1190  #define MAGIC_NUMBER  0x50435245UL   /* 'PCRE' */  #define MAGIC_NUMBER  0x50435245UL   /* 'PCRE' */
# Line 1280  a positive value. */ Line 1288  a positive value. */
1288    
1289  /* The remaining definitions work in both environments. */  /* The remaining definitions work in both environments. */
1290    
1291    #define CHAR_NULL                   '\0'
1292  #define CHAR_HT                     '\t'  #define CHAR_HT                     '\t'
1293  #define CHAR_VT                     '\v'  #define CHAR_VT                     '\v'
1294  #define CHAR_FF                     '\f'  #define CHAR_FF                     '\f'
# Line 1549  only. */ Line 1558  only. */
1558  #define CHAR_ESC                    '\033'  #define CHAR_ESC                    '\033'
1559  #define CHAR_DEL                    '\177'  #define CHAR_DEL                    '\177'
1560    
1561    #define CHAR_NULL                   '\0'
1562  #define CHAR_SPACE                  '\040'  #define CHAR_SPACE                  '\040'
1563  #define CHAR_EXCLAMATION_MARK       '\041'  #define CHAR_EXCLAMATION_MARK       '\041'
1564  #define CHAR_QUOTATION_MARK         '\042'  #define CHAR_QUOTATION_MARK         '\042'
# Line 2695  extern BOOL              PRIV(xclass)(pc Line 2705  extern BOOL              PRIV(xclass)(pc
2705  #ifdef SUPPORT_JIT  #ifdef SUPPORT_JIT
2706  extern void              PRIV(jit_compile)(const REAL_PCRE *,  extern void              PRIV(jit_compile)(const REAL_PCRE *,
2707                             PUBL(extra) *, int);                             PUBL(extra) *, int);
2708  extern int               PRIV(jit_exec)(const REAL_PCRE *, const PUBL(extra) *,  extern int               PRIV(jit_exec)(const PUBL(extra) *,
2709                             const pcre_uchar *, int, int, int, int *, int);                             const pcre_uchar *, int, int, int, int *, int);
2710  extern void              PRIV(jit_free)(void *);  extern void              PRIV(jit_free)(void *);
2711  extern int               PRIV(jit_get_size)(void *);  extern int               PRIV(jit_get_size)(void *);

Legend:
Removed from v.1145  
changed lines
  Added in v.1216

  ViewVC Help
Powered by ViewVC 1.1.5