Changeset 67475 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Sep 14, 2010, 9:49:55 AM (15 years ago)
Author:
[email protected]
Message:

2010-09-14 Kwang Yul Seo <[email protected]>

Reviewed by Darin Adler.

Share UnicodeMacrosFromICU.h
https://bugs.webkit.org/show_bug.cgi?id=45710

glib, qt4 and wince use the same macros from ICU.
Remove the code duplication and use the same header file.

  • wtf/unicode/UnicodeMacrosFromICU.h: Copied from JavaScriptCore/wtf/unicode/glib/UnicodeMacrosFromICU.h.
  • wtf/unicode/glib/UnicodeMacrosFromICU.h: Removed.
  • wtf/unicode/qt4/UnicodeQt4.h:
  • wtf/unicode/wince/UnicodeWince.h:
Location:
trunk/JavaScriptCore
Files:
3 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r67423 r67475  
     12010-09-14  Kwang Yul Seo  <[email protected]>
     2
     3        Reviewed by Darin Adler.
     4
     5        Share UnicodeMacrosFromICU.h
     6        https://bugs.webkit.org/show_bug.cgi?id=45710
     7
     8        glib, qt4 and wince use the same macros from ICU.
     9        Remove the code duplication and use the same header file.
     10
     11        * wtf/unicode/UnicodeMacrosFromICU.h: Copied from JavaScriptCore/wtf/unicode/glib/UnicodeMacrosFromICU.h.
     12        * wtf/unicode/glib/UnicodeMacrosFromICU.h: Removed.
     13        * wtf/unicode/qt4/UnicodeQt4.h:
     14        * wtf/unicode/wince/UnicodeWince.h:
     15
    1162010-09-13  Darin Adler  <[email protected]>
    217
  • trunk/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h

    r66363 r67475  
    2323#ifndef WTF_UNICODE_QT4_H
    2424#define WTF_UNICODE_QT4_H
     25
     26#include "UnicodeMacrosFromICU.h"
    2527
    2628#include <QChar>
     
    6365#endif
    6466typedef uint32_t UChar32;
    65 
    66 // some defines from ICU
    67 // FIXME: This should use UnicodeMacrosFromICU.h instead!
    68 
    69 #define U_IS_BMP(c) ((UChar32)(c)<=0xffff)
    70 #define U16_IS_LEAD(c) (((c)&0xfffffc00)==0xd800)
    71 #define U16_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00)
    72 #define U16_SURROGATE_OFFSET ((0xd800<<10UL)+0xdc00-0x10000)
    73 #define U16_GET_SUPPLEMENTARY(lead, trail) \
    74     (((UChar32)(lead)<<10UL)+(UChar32)(trail)-U16_SURROGATE_OFFSET)
    75 
    76 #define U16_LEAD(supplementary) (UChar)(((supplementary)>>10)+0xd7c0)
    77 #define U16_TRAIL(supplementary) (UChar)(((supplementary)&0x3ff)|0xdc00)
    78 #define U16_LENGTH(c) ((uint32_t)(c) <= 0xffff ? 1 : 2)
    79 
    80 #define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800)
    81 #define U16_IS_SINGLE(c) !U_IS_SURROGATE(c)
    82 #define U16_IS_SURROGATE(c) U_IS_SURROGATE(c)
    83 #define U16_IS_SURROGATE_LEAD(c) (((c)&0x400)==0)
    84 
    85 #define U16_NEXT(s, i, length, c) { \
    86     (c)=(s)[(i)++]; \
    87     if(U16_IS_LEAD(c)) { \
    88         uint16_t __c2; \
    89         if((i)<(length) && U16_IS_TRAIL(__c2=(s)[(i)])) { \
    90             ++(i); \
    91             (c)=U16_GET_SUPPLEMENTARY((c), __c2); \
    92         } \
    93     } \
    94 }
    95 
    96 #define U16_PREV(s, start, i, c) { \
    97     (c)=(s)[--(i)]; \
    98     if(U16_IS_TRAIL(c)) { \
    99         uint16_t __c2; \
    100         if((i)>(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
    101             --(i); \
    102             (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
    103         } \
    104     } \
    105 }
    106 
    107 #define U_MASK(x) ((uint32_t)1<<(x))
    10867
    10968namespace WTF {
  • trunk/JavaScriptCore/wtf/unicode/wince/UnicodeWince.h

    r66363 r67475  
    2525#define UNICODE_WINCE_H
    2626
     27#include "UnicodeMacrosFromICU.h"
     28
    2729#include "ce_unicode.h"
    2830
    2931#define TO_MASK(x) (1 << (x))
    30 
    31 // some defines from ICU needed one or two places
    32 // FIXME: This should use UnicodeMacrosFromICU.h instead!
    33 
    34 #define U_IS_BMP(c) ((UChar32)(c)<=0xffff)
    35 #define U16_IS_LEAD(c) (((c) & 0xfffffc00) == 0xd800)
    36 #define U16_IS_TRAIL(c) (((c) & 0xfffffc00) == 0xdc00)
    37 #define U16_SURROGATE_OFFSET ((0xd800 << 10UL) + 0xdc00 - 0x10000)
    38 #define U16_GET_SUPPLEMENTARY(lead, trail) \
    39     (((UChar32)(lead) << 10UL) + (UChar32)(trail) - U16_SURROGATE_OFFSET)
    40 
    41 #define U16_LEAD(supplementary) (UChar)(((supplementary) >> 10) + 0xd7c0)
    42 #define U16_TRAIL(supplementary) (UChar)(((supplementary) & 0x3ff) | 0xdc00)
    43 #define U16_LENGTH(c) ((uint32_t)(c) <= 0xffff ? 1 : 2)
    44 
    45 #define U_IS_SURROGATE(c) (((c) & 0xfffff800) == 0xd800)
    46 #define U16_IS_SURROGATE(c) U_IS_SURROGATE(c)
    47 #define U16_IS_SURROGATE_LEAD(c) (((c) & 0x400) == 0)
    48 
    49 #define U16_NEXT(s, i, length, c) { \
    50     (c)=(s)[(i)++]; \
    51     if (U16_IS_LEAD(c)) { \
    52         uint16_t __c2; \
    53         if ((i) < (length) && U16_IS_TRAIL(__c2 = (s)[(i)])) { \
    54             ++(i); \
    55             (c) = U16_GET_SUPPLEMENTARY((c), __c2); \
    56         } \
    57     } \
    58 }
    59 
    60 #define U16_PREV(s, start, i, c) { \
    61     (c)=(s)[--(i)]; \
    62     if (U16_IS_TRAIL(c)) { \
    63         uint16_t __c2; \
    64         if ((i) > (start) && U16_IS_LEAD(__c2 = (s)[(i) - 1])) { \
    65             --(i); \
    66             (c) = U16_GET_SUPPLEMENTARY(__c2, (c)); \
    67         } \
    68     } \
    69 }
    70 
    71 #define U16_IS_SINGLE(c) !U_IS_SURROGATE(c)
    7232
    7333namespace WTF {
Note: See TracChangeset for help on using the changeset viewer.