/[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 1197 by chpe, Thu Nov 1 19:23:27 2012 UTC revision 1198 by chpe, Thu Nov 1 19:23:35 2012 UTC
# Line 934  into one pcre_uchar unit. */ Line 934  into one pcre_uchar unit. */
934    
935  #define UTF32_MASK (0x1fffffu)  #define UTF32_MASK (0x1fffffu)
936    
937    /* Base macro to pick up an UTF-32 character out of a uint32 */
938    
939    #define MASKHIGHBITS(c) ((c) & UTF32_MASK)
940    
941    /* Base macro to pick up an UTF-32 character, not advancing the pointer */
942    
943    #define GETUTF32(eptr) (MASKHIGHBITS(*(eptr)))
944    
945    /* Base macro to pick up an UTF-32 character, advancing the pointer */
946    
947    #define GETUTF32INC(eptr) (MASKHIGHBITS(*((eptr)++)))
948    
949  /* 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
950  we know we are in UTF-32 mode. */  we know we are in UTF-32 mode. */
951    
952  #define GETCHAR(c, eptr) \  #define GETCHAR(c, eptr) \
953    c = (*eptr) & UTF32_MASK;    c = GETUTF32(eptr);
954    
955  /* 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
956  pointer. */  pointer. */
957    
958  #define GETCHARTEST(c, eptr) \  #define GETCHARTEST(c, eptr) \
959    c = *eptr; \    c = (utf ? GETUTF32(eptr) : *(eptr));
   if (utf) c &= UTF32_MASK;  
960    
961  /* 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
962  know we are in UTF-32 mode. */  know we are in UTF-32 mode. */
963    
964  #define GETCHARINC(c, eptr) \  #define GETCHARINC(c, eptr) \
965    c = (*eptr++) & UTF32_MASK;    c = GETUTF32INC(eptr);
966    
967  /* 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.
968  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. */
969    
970  #define GETCHARINCTEST(c, eptr) \  #define GETCHARINCTEST(c, eptr) \
971    c = *eptr++; \    c = (utf ? GETUTF32INC(eptr) : *((eptr)++));
   if (utf) c &= UTF32_MASK;  
972    
973  /* Get the next UTF-32 character, not advancing the pointer, not incrementing  /* Get the next UTF-32 character, not advancing the pointer, not incrementing
974  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 978  This is called when we do not know if we Line 988  This is called when we do not know if we
988  we know we are in UTF mode. */  we know we are in UTF mode. */
989    
990  #define RAWUCHAR(eptr) \  #define RAWUCHAR(eptr) \
991    (*(eptr) & UTF32_MASK)    (MASKHIGHBITS(*(eptr)))
992    
993  /* Returns the next uchar, advancing the pointer. This is called when  /* Returns the next uchar, advancing the pointer. This is called when
994  we know we are in UTF mode. */  we know we are in UTF mode. */
995    
996  #define RAWUCHARINC(eptr) \  #define RAWUCHARINC(eptr) \
997    (*((eptr)++) & UTF32_MASK)    (MASKHIGHBITS(*((eptr)++)))
998    
999  /* Returns the next uchar, testing for UTF mode, and not advancing the  /* Returns the next uchar, testing for UTF mode, and not advancing the
1000  pointer. */  pointer. */
1001    
1002  #define RAWUCHARTEST(eptr) \  #define RAWUCHARTEST(eptr) \
1003    (utf ? (*(eptr) & UTF32_MASK) : *(eptr))    (utf ? (MASKHIGHBITS(*(eptr))) : *(eptr))
1004    
1005  /* Returns the next uchar, testing for UTF mode, advancing the  /* Returns the next uchar, testing for UTF mode, advancing the
1006  pointer. */  pointer. */
1007    
1008  #define RAWUCHARINCTEST(eptr) \  #define RAWUCHARINCTEST(eptr) \
1009    (utf ? (*((eptr)++) & UTF32_MASK) : *((eptr)++))    (utf ? (MASKHIGHBITS(*((eptr)++))) : *((eptr)++))
1010    
1011  /* 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
1012  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

Legend:
Removed from v.1197  
changed lines
  Added in v.1198

  ViewVC Help
Powered by ViewVC 1.1.5