/[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 1044 by ph10, Thu Sep 20 16:23:57 2012 UTC revision 1045 by ph10, Sun Sep 23 16:50:00 2012 UTC
# Line 834  code. */ Line 834  code. */
834    
835  /* Tests for Unicode horizontal and vertical whitespace characters must check a  /* Tests for Unicode horizontal and vertical whitespace characters must check a
836  number of different values. Using a switch statement for this generates the  number of different values. Using a switch statement for this generates the
837  fastest code (no loop, no memory access), and there are several places where  fastest code (no loop, no memory access), and there are several places in the
838  this happens. In order to ensure that all the case lists remain in step, we use  interpreter code where this happens. In order to ensure that all the case lists
839  macros so that there is only one place where the lists are defined.  remain in step, we use macros so that there is only one place where the lists
840    are defined.
841  NOTE: These values are also used explicitly in pcre_compile.c when processing  
842  \h, \H, \v and \V in a character class, so any changes here should be  These values are also required as lists in pcre_compile.c when processing \h,
843  duplicated there as well. They also appear in pcre_jit_compile.c. */  \H, \v and \V in a character class. The lists are defined in pcre_tables.c, but
844    macros that define the values are here so that all the definitions are
845    together. The lists must be in ascending character order, terminated by
846    NOTACHAR (which is 0xffffffff).
847    
848    Any changes should ensure that the various macros are kept in step with each
849    other. NOTE: The values also appear in pcre_jit_compile.c. */
850    
851  /* ------ ASCII/Unicode environments ------ */  /* ------ ASCII/Unicode environments ------ */
852    
853  #ifndef EBCDIC  #ifndef EBCDIC
854    
855    #define HSPACE_LIST \
856      CHAR_HT, CHAR_SPACE, 0xa0, \
857      0x1680, 0x180e, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, \
858      0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202f, 0x205f, 0x3000, \
859      NOTACHAR
860    
861  #define HSPACE_MULTIBYTE_CASES \  #define HSPACE_MULTIBYTE_CASES \
862        case 0x1680:    /* OGHAM SPACE MARK */ \    case 0x1680:  /* OGHAM SPACE MARK */ \
863        case 0x180e:    /* MONGOLIAN VOWEL SEPARATOR */ \    case 0x180e:  /* MONGOLIAN VOWEL SEPARATOR */ \
864        case 0x2000:    /* EN QUAD */ \    case 0x2000:  /* EN QUAD */ \
865        case 0x2001:    /* EM QUAD */ \    case 0x2001:  /* EM QUAD */ \
866        case 0x2002:    /* EN SPACE */ \    case 0x2002:  /* EN SPACE */ \
867        case 0x2003:    /* EM SPACE */ \    case 0x2003:  /* EM SPACE */ \
868        case 0x2004:    /* THREE-PER-EM SPACE */ \    case 0x2004:  /* THREE-PER-EM SPACE */ \
869        case 0x2005:    /* FOUR-PER-EM SPACE */ \    case 0x2005:  /* FOUR-PER-EM SPACE */ \
870        case 0x2006:    /* SIX-PER-EM SPACE */ \    case 0x2006:  /* SIX-PER-EM SPACE */ \
871        case 0x2007:    /* FIGURE SPACE */ \    case 0x2007:  /* FIGURE SPACE */ \
872        case 0x2008:    /* PUNCTUATION SPACE */ \    case 0x2008:  /* PUNCTUATION SPACE */ \
873        case 0x2009:    /* THIN SPACE */ \    case 0x2009:  /* THIN SPACE */ \
874        case 0x200A:    /* HAIR SPACE */ \    case 0x200A:  /* HAIR SPACE */ \
875        case 0x202f:    /* NARROW NO-BREAK SPACE */ \    case 0x202f:  /* NARROW NO-BREAK SPACE */ \
876        case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */ \    case 0x205f:  /* MEDIUM MATHEMATICAL SPACE */ \
877        case 0x3000     /* IDEOGRAPHIC SPACE */    case 0x3000   /* IDEOGRAPHIC SPACE */
878    
879  #define HSPACE_BYTE_CASES \  #define HSPACE_BYTE_CASES \
880        case CHAR_HT: \    case CHAR_HT: \
881        case CHAR_SPACE: \    case CHAR_SPACE: \
882        case 0xa0       /* NBSP */    case 0xa0     /* NBSP */
883    
884    #define HSPACE_CASES \
885      HSPACE_BYTE_CASES: \
886      HSPACE_MULTIBYTE_CASES
887    
888    #define VSPACE_LIST \
889      CHAR_LF, CHAR_VT, CHAR_FF, CHAR_CR, CHAR_NEL, 0x2028, 0x2029, NOTACHAR
890    
891  #define VSPACE_MULTIBYTE_CASES \  #define VSPACE_MULTIBYTE_CASES \
892        case 0x2028:    /* LINE SEPARATOR */ \    case 0x2028:    /* LINE SEPARATOR */ \
893        case 0x2029     /* PARAGRAPH SEPARATOR */    case 0x2029     /* PARAGRAPH SEPARATOR */
894    
895  #define VSPACE_BYTE_CASES \  #define VSPACE_BYTE_CASES \
896        case CHAR_LF: \    case CHAR_LF: \
897        case CHAR_VT: \    case CHAR_VT: \
898        case CHAR_FF: \    case CHAR_FF: \
899        case CHAR_CR: \    case CHAR_CR: \
900        case CHAR_NEL    case CHAR_NEL
   
 #define HSPACE_CASES \  
         HSPACE_BYTE_CASES: \  
         HSPACE_MULTIBYTE_CASES  
901    
902  #define VSPACE_CASES \  #define VSPACE_CASES \
903          VSPACE_BYTE_CASES: \    VSPACE_BYTE_CASES: \
904          VSPACE_MULTIBYTE_CASES    VSPACE_MULTIBYTE_CASES
905    
906  /* ------ EBCDIC environments ------ */  /* ------ EBCDIC environments ------ */
907    
908  #else  #else
909    #define HSPACE_LIST CHAR_HT, CHAR_SPACE
910    
911  #define HSPACE_BYTE_CASES \  #define HSPACE_BYTE_CASES \
912        case CHAR_HT: \    case CHAR_HT: \
913        case CHAR_SPACE    case CHAR_SPACE
914    
 #define VSPACE_BYTE_CASES \  
       case CHAR_LF: \  
       case CHAR_VT: \  
       case CHAR_FF: \  
       case CHAR_CR: \  
       case CHAR_NEL  
   
915  #define HSPACE_CASES HSPACE_BYTE_CASES  #define HSPACE_CASES HSPACE_BYTE_CASES
916    
917    #ifdef EBCDIC_NL25
918    #define VSPACE_LIST \
919      CHAR_VT, CHAR_FF, CHAR_CR, CHAR_NEL, CHAR_LF, NOTACHAR
920    #else
921    #define VSPACE_LIST \
922      CHAR_VT, CHAR_FF, CHAR_CR, CHAR_LF, CHAR_NEL, NOTACHAR
923    #endif
924    
925    #define VSPACE_BYTE_CASES \
926      case CHAR_LF: \
927      case CHAR_VT: \
928      case CHAR_FF: \
929      case CHAR_CR: \
930      case CHAR_NEL
931    
932  #define VSPACE_CASES VSPACE_BYTE_CASES  #define VSPACE_CASES VSPACE_BYTE_CASES
933  #endif  /* EBCDIC */  #endif  /* EBCDIC */
934    
935  /* ------ End of whitespace case macros ------ */  /* ------ End of whitespace macros ------ */
936    
937    
938  /* In case there is no definition of offsetof() provided - though any proper  /* In case there is no definition of offsetof() provided - though any proper
# Line 2351  but are not part of the PCRE public API. Line 2378  but are not part of the PCRE public API.
2378  pcre_tables.c module. */  pcre_tables.c module. */
2379    
2380  #ifdef COMPILE_PCRE8  #ifdef COMPILE_PCRE8
   
2381  extern const int            PRIV(utf8_table1)[];  extern const int            PRIV(utf8_table1)[];
2382  extern const int            PRIV(utf8_table1_size);  extern const int            PRIV(utf8_table1_size);
2383  extern const int            PRIV(utf8_table2)[];  extern const int            PRIV(utf8_table2)[];
2384  extern const int            PRIV(utf8_table3)[];  extern const int            PRIV(utf8_table3)[];
2385  extern const pcre_uint8     PRIV(utf8_table4)[];  extern const pcre_uint8     PRIV(utf8_table4)[];
   
2386  #endif /* COMPILE_PCRE8 */  #endif /* COMPILE_PCRE8 */
2387    
2388  extern const char           PRIV(utt_names)[];  extern const char           PRIV(utt_names)[];
2389  extern const ucp_type_table PRIV(utt)[];  extern const ucp_type_table PRIV(utt)[];
2390  extern const int            PRIV(utt_size);  extern const int            PRIV(utt_size);
2391    
2392    extern const pcre_uint8     PRIV(OP_lengths)[];
2393  extern const pcre_uint8     PRIV(default_tables)[];  extern const pcre_uint8     PRIV(default_tables)[];
2394    
2395  extern const pcre_uint8     PRIV(OP_lengths)[];  extern const pcre_uint32    PRIV(hspace_list)[];
2396    extern const pcre_uint32    PRIV(vspace_list)[];
2397    
2398    
2399  /* Internal shared functions. These are functions that are used by more than  /* Internal shared functions. These are functions that are used by more than
# Line 2435  typedef struct { Line 2462  typedef struct {
2462    pcre_uint8 script;     /* ucp_Arabic, etc. */    pcre_uint8 script;     /* ucp_Arabic, etc. */
2463    pcre_uint8 chartype;   /* ucp_Cc, etc. (general categories) */    pcre_uint8 chartype;   /* ucp_Cc, etc. (general categories) */
2464    pcre_uint8 gbprop;     /* ucp_gbControl, etc. (grapheme break property) */    pcre_uint8 gbprop;     /* ucp_gbControl, etc. (grapheme break property) */
2465    pcre_uint8 caseset;    /* offset to multichar other cases or zero */    pcre_uint8 caseset;    /* offset to multichar other cases or zero */
2466    pcre_int32 other_case; /* offset to other case, or zero if none */    pcre_int32 other_case; /* offset to other case, or zero if none */
2467  } ucd_record;  } ucd_record;
2468    

Legend:
Removed from v.1044  
changed lines
  Added in v.1045

  ViewVC Help
Powered by ViewVC 1.1.5