/[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 1090 by chpe, Tue Oct 16 15:55:48 2012 UTC revision 1145 by ph10, Fri Oct 19 16:25:32 2012 UTC
# Line 53  depending on the PRIV macro. */ Line 53  depending on the PRIV macro. */
53  #endif  #endif
54    
55  /* PCRE is compiled as an 8 bit library if it is not requested otherwise. */  /* PCRE is compiled as an 8 bit library if it is not requested otherwise. */
56  #if !defined COMPILE_PCRE16 && ! defined COMPILE_PCRE32  
57    #if !defined COMPILE_PCRE16 && !defined COMPILE_PCRE32
58  #define COMPILE_PCRE8  #define COMPILE_PCRE8
59  #endif  #endif
60    
# Line 304  start/end of string field names are. */ Line 305  start/end of string field names are. */
305         &(NLBLOCK->nllen), utf)) \         &(NLBLOCK->nllen), utf)) \
306      : \      : \
307      ((p) <= NLBLOCK->PSEND - NLBLOCK->nllen && \      ((p) <= NLBLOCK->PSEND - NLBLOCK->nllen && \
308       (p)[0] == NLBLOCK->nl[0] && \       RAWUCHARTEST(p) == NLBLOCK->nl[0] && \
309       (NLBLOCK->nllen == 1 || (p)[1] == NLBLOCK->nl[1]) \       (NLBLOCK->nllen == 1 || RAWUCHARTEST(p+1) == NLBLOCK->nl[1])       \
310      ) \      ) \
311    )    )
312    
# Line 318  start/end of string field names are. */ Line 319  start/end of string field names are. */
319         &(NLBLOCK->nllen), utf)) \         &(NLBLOCK->nllen), utf)) \
320      : \      : \
321      ((p) >= NLBLOCK->PSSTART + NLBLOCK->nllen && \      ((p) >= NLBLOCK->PSSTART + NLBLOCK->nllen && \
322       (p)[-NLBLOCK->nllen] == NLBLOCK->nl[0] && \       RAWUCHARTEST(p - NLBLOCK->nllen) == NLBLOCK->nl[0] &&              \
323       (NLBLOCK->nllen == 1 || (p)[-NLBLOCK->nllen+1] == NLBLOCK->nl[1]) \       (NLBLOCK->nllen == 1 || RAWUCHARTEST(p - NLBLOCK->nllen + 1) == NLBLOCK->nl[1]) \
324      ) \      ) \
325    )    )
326    
# Line 522  capturing parenthesis numbers in back re Line 523  capturing parenthesis numbers in back re
523  #define PUT2(a,n,d)   \  #define PUT2(a,n,d)   \
524    a[n] = (d) >> 8; \    a[n] = (d) >> 8; \
525    a[(n)+1] = (d) & 255    a[(n)+1] = (d) & 255
526    
527    /* For reasons that I do not understand, the expression in this GET2 macro is
528    treated by gcc as a signed expression, even when a is declared as unsigned. It
529    seems that any kind of arithmetic results in a signed value. */
530    
531  #define GET2(a,n) \  #define GET2(a,n) \
532    (((a)[n] << 8) | (a)[(n)+1])    (unsigned int)(((a)[n] << 8) | (a)[(n)+1])
533    
534  #elif defined COMPILE_PCRE16  #elif defined COMPILE_PCRE16
535    
# Line 579  we don't even define them. */ Line 584  we don't even define them. */
584  #define GETCHARINC(c, eptr) c = *eptr++;  #define GETCHARINC(c, eptr) c = *eptr++;
585  #define GETCHARINCTEST(c, eptr) c = *eptr++;  #define GETCHARINCTEST(c, eptr) c = *eptr++;
586  #define GETCHARLEN(c, eptr, len) c = *eptr;  #define GETCHARLEN(c, eptr, len) c = *eptr;
587    #define RAWUCHAR(eptr) (*(eptr))
588    #define RAWUCHARINC(eptr) (*(eptr)++)
589    #define RAWUCHARTEST(eptr) (*(eptr))
590    #define RAWUCHARINCTEST(eptr) (*(eptr)++)
591  /* #define GETCHARLENTEST(c, eptr, len) */  /* #define GETCHARLENTEST(c, eptr, len) */
592  /* #define BACKCHAR(eptr) */  /* #define BACKCHAR(eptr) */
593  /* #define FORWARDCHAR(eptr) */  /* #define FORWARDCHAR(eptr) */
# Line 751  do not know if we are in UTF-8 mode. */ Line 760  do not know if we are in UTF-8 mode. */
760    c = *eptr; \    c = *eptr; \
761    if (utf && c >= 0xc0) GETUTF8LEN(c, eptr, len);    if (utf && c >= 0xc0) GETUTF8LEN(c, eptr, len);
762    
763    /* Returns the next uchar, not advancing the pointer. This is called when
764    we know we are in UTF mode. */
765    
766    #define RAWUCHAR(eptr) \
767      (*(eptr))
768    
769    /* Returns the next uchar, advancing the pointer. This is called when
770    we know we are in UTF mode. */
771    
772    #define RAWUCHARINC(eptr) \
773      (*(eptr)++)
774    
775    /* Returns the next uchar, testing for UTF mode, and not advancing the
776    pointer. */
777    
778    #define RAWUCHARTEST(eptr) \
779      (*(eptr))
780    
781    /* Returns the next uchar, testing for UTF mode, advancing the
782    pointer. */
783    
784    #define RAWUCHARINCTEST(eptr) \
785      (*(eptr)++)
786    
787  /* 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
788  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
789  because almost all calls are already within a block of UTF-8 only code. */  because almost all calls are already within a block of UTF-8 only code. */
# Line 846  we do not know if we are in UTF-16 mode. Line 879  we do not know if we are in UTF-16 mode.
879    c = *eptr; \    c = *eptr; \
880    if (utf && (c & 0xfc00) == 0xd800) GETUTF16LEN(c, eptr, len);    if (utf && (c & 0xfc00) == 0xd800) GETUTF16LEN(c, eptr, len);
881    
882    /* Returns the next uchar, not advancing the pointer. This is called when
883    we know we are in UTF mode. */
884    
885    #define RAWUCHAR(eptr) \
886      (*(eptr))
887    
888    /* Returns the next uchar, advancing the pointer. This is called when
889    we know we are in UTF mode. */
890    
891    #define RAWUCHARINC(eptr) \
892      (*(eptr)++)
893    
894    /* Returns the next uchar, testing for UTF mode, and not advancing the
895    pointer. */
896    
897    #define RAWUCHARTEST(eptr) \
898      (*(eptr))
899    
900    /* Returns the next uchar, testing for UTF mode, advancing the
901    pointer. */
902    
903    #define RAWUCHARINCTEST(eptr) \
904      (*(eptr)++)
905    
906  /* 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
907  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
908  macro because almost all calls are already within a block of UTF-16 only  macro because almost all calls are already within a block of UTF-16 only
# Line 862  code. */ Line 919  code. */
919    
920  #elif defined COMPILE_PCRE32  #elif defined COMPILE_PCRE32
921    
922  /* These are unnecessary for the 32-bit library */  /* These are trivial for the 32-bit library, since all UTF-32 characters fit
923  #undef MAX_VALUE_FOR_SINGLE_CHAR  into one pcre_uchar unit. */
924  #undef HAS_EXTRALEN  #define MAX_VALUE_FOR_SINGLE_CHAR (0x10ffffu)
925  #undef GET_EXTRALEN  #define HAS_EXTRALEN(c) (0)
926  #undef NOT_FIRSTCHAR  #define GET_EXTRALEN(c) (0)
927    #define NOT_FIRSTCHAR(c) (0)
928    
929  #define UTF32_MASK (0x1ffffful)  #define UTF32_MASK (0x1fffffu)
930    
931  /* 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
932  we know we are in UTF-32 mode. */  we know we are in UTF-32 mode. */
# Line 910  This is called when we do not know if we Line 968  This is called when we do not know if we
968  #define GETCHARLENTEST(c, eptr, len) \  #define GETCHARLENTEST(c, eptr, len) \
969    GETCHARTEST(c, eptr)    GETCHARTEST(c, eptr)
970    
971    /* Returns the next uchar, not advancing the pointer. This is called when
972    we know we are in UTF mode. */
973    
974    #define RAWUCHAR(eptr) \
975      (*(eptr) & UTF32_MASK)
976    
977    /* Returns the next uchar, advancing the pointer. This is called when
978    we know we are in UTF mode. */
979    
980    #define RAWUCHARINC(eptr) \
981      (*(eptr)++ & UTF32_MASK)
982    
983    /* Returns the next uchar, testing for UTF mode, and not advancing the
984    pointer. */
985    
986    #define RAWUCHARTEST(eptr) \
987      (utf ? (*(eptr) & UTF32_MASK) : *(eptr))
988    
989    /* Returns the next uchar, testing for UTF mode, advancing the
990    pointer. */
991    
992    #define RAWUCHARINCTEST(eptr) \
993      (utf ? (*(eptr)++ & UTF32_MASK) : *(eptr)++)
994    
995  /* 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
996  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
997  macro because almost all calls are already within a block of UTF-32 only  macro because almost all calls are already within a block of UTF-32 only
998  code. */  code.
999    These are all no-ops since all UTF-32 characters fit into one pcre_uchar. */
1000    
1001  #define BACKCHAR(eptr) do { } while (0)  #define BACKCHAR(eptr) do { } while (0)
1002    
# Line 2315  typedef struct compile_data { Line 2398  typedef struct compile_data {
2398    int  names_found;                 /* Number of entries so far */    int  names_found;                 /* Number of entries so far */
2399    int  name_entry_size;             /* Size of each entry */    int  name_entry_size;             /* Size of each entry */
2400    int  workspace_size;              /* Size of workspace */    int  workspace_size;              /* Size of workspace */
2401    int  bracount;                    /* Count of capturing parens as we compile */    unsigned int  bracount;           /* Count of capturing parens as we compile */
2402    int  final_bracount;              /* Saved value after first pass */    int  final_bracount;              /* Saved value after first pass */
2403    int  max_lookbehind;              /* Maximum lookbehind (characters) */    int  max_lookbehind;              /* Maximum lookbehind (characters) */
2404    int  top_backref;                 /* Maximum back reference */    int  top_backref;                 /* Maximum back reference */
# Line 2345  call within the pattern; used by pcre_ex Line 2428  call within the pattern; used by pcre_ex
2428    
2429  typedef struct recursion_info {  typedef struct recursion_info {
2430    struct recursion_info *prevrec; /* Previous recursion record (or NULL) */    struct recursion_info *prevrec; /* Previous recursion record (or NULL) */
2431    int group_num;                  /* Number of group that was called */    unsigned int group_num;         /* Number of group that was called */
2432    int *offset_save;               /* Pointer to start of saved offsets */    int *offset_save;               /* Pointer to start of saved offsets */
2433    int saved_max;                  /* Number of saved offsets */    int saved_max;                  /* Number of saved offsets */
2434    PCRE_PUCHAR subject_position;   /* Position at start of recursion */    PCRE_PUCHAR subject_position;   /* Position at start of recursion */
# Line 2581  extern unsigned int      PRIV(strlen_uc) Line 2664  extern unsigned int      PRIV(strlen_uc)
2664    
2665  #endif /* COMPILE_PCRE[8|16|32] */  #endif /* COMPILE_PCRE[8|16|32] */
2666    
2667    #if defined COMPILE_PCRE8 || defined COMPILE_PCRE16
2668    
2669    #define STRCMP_UC_UC_TEST(str1, str2) STRCMP_UC_UC(str1, str2)
2670    #define STRCMP_UC_C8_TEST(str1, str2) STRCMP_UC_C8(str1, str2)
2671    
2672    #elif defined COMPILE_PCRE32
2673    
2674    extern int               PRIV(strcmp_uc_uc_utf)(const pcre_uchar *,
2675                               const pcre_uchar *);
2676    extern int               PRIV(strcmp_uc_c8_utf)(const pcre_uchar *,
2677                               const char *);
2678    
2679    #define STRCMP_UC_UC_TEST(str1, str2) \
2680      (utf ? PRIV(strcmp_uc_uc_utf)((str1), (str2)) : PRIV(strcmp_uc_uc)((str1), (str2)))
2681    #define STRCMP_UC_C8_TEST(str1, str2) \
2682      (utf ? PRIV(strcmp_uc_c8_utf)((str1), (str2)) : PRIV(strcmp_uc_c8)((str1), (str2)))
2683    
2684    #endif /* COMPILE_PCRE[8|16|32] */
2685    
2686  extern const pcre_uchar *PRIV(find_bracket)(const pcre_uchar *, BOOL, int);  extern const pcre_uchar *PRIV(find_bracket)(const pcre_uchar *, BOOL, int);
2687  extern BOOL              PRIV(is_newline)(PCRE_PUCHAR, int, PCRE_PUCHAR,  extern BOOL              PRIV(is_newline)(PCRE_PUCHAR, int, PCRE_PUCHAR,
2688                             int *, BOOL);                             int *, BOOL);
2689  extern int               PRIV(ord2utf)(pcre_uint32, pcre_uchar *);  extern unsigned int      PRIV(ord2utf)(pcre_uint32, pcre_uchar *);
2690  extern int               PRIV(valid_utf)(PCRE_PUCHAR, int, int *);  extern int               PRIV(valid_utf)(PCRE_PUCHAR, int, int *);
2691  extern BOOL              PRIV(was_newline)(PCRE_PUCHAR, int, PCRE_PUCHAR,  extern BOOL              PRIV(was_newline)(PCRE_PUCHAR, int, PCRE_PUCHAR,
2692                             int *, BOOL);                             int *, BOOL);
# Line 2614  extern const pcre_uint32 PRIV(ucd_casele Line 2716  extern const pcre_uint32 PRIV(ucd_casele
2716  extern const ucd_record  PRIV(ucd_records)[];  extern const ucd_record  PRIV(ucd_records)[];
2717  extern const pcre_uint8  PRIV(ucd_stage1)[];  extern const pcre_uint8  PRIV(ucd_stage1)[];
2718  extern const pcre_uint16 PRIV(ucd_stage2)[];  extern const pcre_uint16 PRIV(ucd_stage2)[];
2719  extern const int         PRIV(ucp_gentype)[];  extern const pcre_uint32 PRIV(ucp_gentype)[];
2720  extern const pcre_uint32 PRIV(ucp_gbtable)[];  extern const pcre_uint32 PRIV(ucp_gbtable)[];
2721  #ifdef SUPPORT_JIT  #ifdef SUPPORT_JIT
2722  extern const int         PRIV(ucp_typerange)[];  extern const int         PRIV(ucp_typerange)[];

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

  ViewVC Help
Powered by ViewVC 1.1.5