Changeset 70041 in webkit
- Timestamp:
- Oct 19, 2010 2:05:49 AM (14 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r70026 r70041 1 2010-10-19 Patrick Gansterer <paroga@webkit.org> 2 3 Reviewed by Andreas Kling. 4 5 Fix style of UnicodeWinCE 6 https://bugs.webkit.org/show_bug.cgi?id=47818 7 8 * wtf/unicode/wince/UnicodeWinCE.cpp: 9 (WTF::Unicode::toLower): 10 (WTF::Unicode::toUpper): 11 * wtf/unicode/wince/UnicodeWinCE.h: 12 1 13 2010-10-18 Xan Lopez <xlopez@igalia.com> 2 14 -
trunk/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.cpp
r67788 r70041 100 100 if (sourceIterator < sourceEnd) 101 101 remainingCharacters += sourceEnd - sourceIterator; 102 *isError = (remainingCharacters != 0);102 *isError = !!remainingCharacters; 103 103 if (resultIterator < resultEnd) 104 104 *resultIterator = 0; … … 124 124 if (sourceIterator < sourceEnd) 125 125 remainingCharacters += sourceEnd - sourceIterator; 126 *isError = (remainingCharacters != 0);126 *isError = !!remainingCharacters; 127 127 if (resultIterator < resultEnd) 128 128 *resultIterator = 0; -
trunk/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.h
r67788 r70041 32 32 33 33 namespace WTF { 34 namespace Unicode { 34 35 35 namespace Unicode { 36 enum Direction { 37 LeftToRight = UnicodeCE::U_LEFT_TO_RIGHT, 38 RightToLeft = UnicodeCE::U_RIGHT_TO_LEFT, 39 EuropeanNumber = UnicodeCE::U_EUROPEAN_NUMBER, 40 EuropeanNumberSeparator = UnicodeCE::U_EUROPEAN_NUMBER_SEPARATOR, 41 EuropeanNumberTerminator = UnicodeCE::U_EUROPEAN_NUMBER_TERMINATOR, 42 ArabicNumber = UnicodeCE::U_ARABIC_NUMBER, 43 CommonNumberSeparator = UnicodeCE::U_COMMON_NUMBER_SEPARATOR, 44 BlockSeparator = UnicodeCE::U_BLOCK_SEPARATOR, 45 SegmentSeparator = UnicodeCE::U_SEGMENT_SEPARATOR, 46 WhiteSpaceNeutral = UnicodeCE::U_WHITE_SPACE_NEUTRAL, 47 OtherNeutral = UnicodeCE::U_OTHER_NEUTRAL, 48 LeftToRightEmbedding = UnicodeCE::U_LEFT_TO_RIGHT_EMBEDDING, 49 LeftToRightOverride = UnicodeCE::U_LEFT_TO_RIGHT_OVERRIDE, 50 RightToLeftArabic = UnicodeCE::U_RIGHT_TO_LEFT_ARABIC, 51 RightToLeftEmbedding = UnicodeCE::U_RIGHT_TO_LEFT_EMBEDDING, 52 RightToLeftOverride = UnicodeCE::U_RIGHT_TO_LEFT_OVERRIDE, 53 PopDirectionalFormat = UnicodeCE::U_POP_DIRECTIONAL_FORMAT, 54 NonSpacingMark = UnicodeCE::U_DIR_NON_SPACING_MARK, 55 BoundaryNeutral = UnicodeCE::U_BOUNDARY_NEUTRAL 56 }; 36 57 37 enum Direction { 38 LeftToRight = UnicodeCE::U_LEFT_TO_RIGHT, 39 RightToLeft = UnicodeCE::U_RIGHT_TO_LEFT, 40 EuropeanNumber = UnicodeCE::U_EUROPEAN_NUMBER, 41 EuropeanNumberSeparator = UnicodeCE::U_EUROPEAN_NUMBER_SEPARATOR, 42 EuropeanNumberTerminator = UnicodeCE::U_EUROPEAN_NUMBER_TERMINATOR, 43 ArabicNumber = UnicodeCE::U_ARABIC_NUMBER, 44 CommonNumberSeparator = UnicodeCE::U_COMMON_NUMBER_SEPARATOR, 45 BlockSeparator = UnicodeCE::U_BLOCK_SEPARATOR, 46 SegmentSeparator = UnicodeCE::U_SEGMENT_SEPARATOR, 47 WhiteSpaceNeutral = UnicodeCE::U_WHITE_SPACE_NEUTRAL, 48 OtherNeutral = UnicodeCE::U_OTHER_NEUTRAL, 49 LeftToRightEmbedding = UnicodeCE::U_LEFT_TO_RIGHT_EMBEDDING, 50 LeftToRightOverride = UnicodeCE::U_LEFT_TO_RIGHT_OVERRIDE, 51 RightToLeftArabic = UnicodeCE::U_RIGHT_TO_LEFT_ARABIC, 52 RightToLeftEmbedding = UnicodeCE::U_RIGHT_TO_LEFT_EMBEDDING, 53 RightToLeftOverride = UnicodeCE::U_RIGHT_TO_LEFT_OVERRIDE, 54 PopDirectionalFormat = UnicodeCE::U_POP_DIRECTIONAL_FORMAT, 55 NonSpacingMark = UnicodeCE::U_DIR_NON_SPACING_MARK, 56 BoundaryNeutral = UnicodeCE::U_BOUNDARY_NEUTRAL 57 }; 58 enum DecompositionType { 59 DecompositionNone = UnicodeCE::U_DT_NONE, 60 DecompositionCanonical = UnicodeCE::U_DT_CANONICAL, 61 DecompositionCompat = UnicodeCE::U_DT_COMPAT, 62 DecompositionCircle = UnicodeCE::U_DT_CIRCLE, 63 DecompositionFinal = UnicodeCE::U_DT_FINAL, 64 DecompositionFont = UnicodeCE::U_DT_FONT, 65 DecompositionFraction = UnicodeCE::U_DT_FRACTION, 66 DecompositionInitial = UnicodeCE::U_DT_INITIAL, 67 DecompositionIsolated = UnicodeCE::U_DT_ISOLATED, 68 DecompositionMedial = UnicodeCE::U_DT_MEDIAL, 69 DecompositionNarrow = UnicodeCE::U_DT_NARROW, 70 DecompositionNoBreak = UnicodeCE::U_DT_NOBREAK, 71 DecompositionSmall = UnicodeCE::U_DT_SMALL, 72 DecompositionSquare = UnicodeCE::U_DT_SQUARE, 73 DecompositionSub = UnicodeCE::U_DT_SUB, 74 DecompositionSuper = UnicodeCE::U_DT_SUPER, 75 DecompositionVertical = UnicodeCE::U_DT_VERTICAL, 76 DecompositionWide = UnicodeCE::U_DT_WIDE 77 }; 58 78 59 enum DecompositionType { 60 DecompositionNone = UnicodeCE::U_DT_NONE, 61 DecompositionCanonical = UnicodeCE::U_DT_CANONICAL, 62 DecompositionCompat = UnicodeCE::U_DT_COMPAT, 63 DecompositionCircle = UnicodeCE::U_DT_CIRCLE, 64 DecompositionFinal = UnicodeCE::U_DT_FINAL, 65 DecompositionFont = UnicodeCE::U_DT_FONT, 66 DecompositionFraction = UnicodeCE::U_DT_FRACTION, 67 DecompositionInitial = UnicodeCE::U_DT_INITIAL, 68 DecompositionIsolated = UnicodeCE::U_DT_ISOLATED, 69 DecompositionMedial = UnicodeCE::U_DT_MEDIAL, 70 DecompositionNarrow = UnicodeCE::U_DT_NARROW, 71 DecompositionNoBreak = UnicodeCE::U_DT_NOBREAK, 72 DecompositionSmall = UnicodeCE::U_DT_SMALL, 73 DecompositionSquare = UnicodeCE::U_DT_SQUARE, 74 DecompositionSub = UnicodeCE::U_DT_SUB, 75 DecompositionSuper = UnicodeCE::U_DT_SUPER, 76 DecompositionVertical = UnicodeCE::U_DT_VERTICAL, 77 DecompositionWide = UnicodeCE::U_DT_WIDE, 78 }; 79 enum CharCategory { 80 NoCategory = 0, 81 Other_NotAssigned = TO_MASK(UnicodeCE::U_GENERAL_OTHER_TYPES), 82 Letter_Uppercase = TO_MASK(UnicodeCE::U_UPPERCASE_LETTER), 83 Letter_Lowercase = TO_MASK(UnicodeCE::U_LOWERCASE_LETTER), 84 Letter_Titlecase = TO_MASK(UnicodeCE::U_TITLECASE_LETTER), 85 Letter_Modifier = TO_MASK(UnicodeCE::U_MODIFIER_LETTER), 86 Letter_Other = TO_MASK(UnicodeCE::U_OTHER_LETTER), 79 87 80 enum CharCategory { 81 NoCategory = 0, 82 Other_NotAssigned = TO_MASK(UnicodeCE::U_GENERAL_OTHER_TYPES), 83 Letter_Uppercase = TO_MASK(UnicodeCE::U_UPPERCASE_LETTER), 84 Letter_Lowercase = TO_MASK(UnicodeCE::U_LOWERCASE_LETTER), 85 Letter_Titlecase = TO_MASK(UnicodeCE::U_TITLECASE_LETTER), 86 Letter_Modifier = TO_MASK(UnicodeCE::U_MODIFIER_LETTER), 87 Letter_Other = TO_MASK(UnicodeCE::U_OTHER_LETTER), 88 Mark_NonSpacing = TO_MASK(UnicodeCE::U_NON_SPACING_MARK), 89 Mark_Enclosing = TO_MASK(UnicodeCE::U_ENCLOSING_MARK), 90 Mark_SpacingCombining = TO_MASK(UnicodeCE::U_COMBINING_SPACING_MARK), 88 91 89 Mark_NonSpacing = TO_MASK(UnicodeCE::U_NON_SPACING_MARK),90 Mark_Enclosing = TO_MASK(UnicodeCE::U_ENCLOSING_MARK),91 Mark_SpacingCombining = TO_MASK(UnicodeCE::U_COMBINING_SPACING_MARK),92 Number_DecimalDigit = TO_MASK(UnicodeCE::U_DECIMAL_DIGIT_NUMBER), 93 Number_Letter = TO_MASK(UnicodeCE::U_LETTER_NUMBER), 94 Number_Other = TO_MASK(UnicodeCE::U_OTHER_NUMBER), 92 95 93 Number_DecimalDigit = TO_MASK(UnicodeCE::U_DECIMAL_DIGIT_NUMBER),94 Number_Letter = TO_MASK(UnicodeCE::U_LETTER_NUMBER),95 Number_Other = TO_MASK(UnicodeCE::U_OTHER_NUMBER),96 Separator_Space = TO_MASK(UnicodeCE::U_SPACE_SEPARATOR), 97 Separator_Line = TO_MASK(UnicodeCE::U_LINE_SEPARATOR), 98 Separator_Paragraph = TO_MASK(UnicodeCE::U_PARAGRAPH_SEPARATOR), 96 99 97 Separator_Space = TO_MASK(UnicodeCE::U_SPACE_SEPARATOR), 98 Separator_Line = TO_MASK(UnicodeCE::U_LINE_SEPARATOR), 99 Separator_Paragraph = TO_MASK(UnicodeCE::U_PARAGRAPH_SEPARATOR), 100 Other_Control = TO_MASK(UnicodeCE::U_CONTROL_CHAR), 101 Other_Format = TO_MASK(UnicodeCE::U_FORMAT_CHAR), 102 Other_PrivateUse = TO_MASK(UnicodeCE::U_PRIVATE_USE_CHAR), 103 Other_Surrogate = TO_MASK(UnicodeCE::U_SURROGATE), 100 104 101 Other_Control = TO_MASK(UnicodeCE::U_CONTROL_CHAR), 102 Other_Format = TO_MASK(UnicodeCE::U_FORMAT_CHAR), 103 Other_PrivateUse = TO_MASK(UnicodeCE::U_PRIVATE_USE_CHAR), 104 Other_Surrogate = TO_MASK(UnicodeCE::U_SURROGATE), 105 Punctuation_Dash = TO_MASK(UnicodeCE::U_DASH_PUNCTUATION), 106 Punctuation_Open = TO_MASK(UnicodeCE::U_START_PUNCTUATION), 107 Punctuation_Close = TO_MASK(UnicodeCE::U_END_PUNCTUATION), 108 Punctuation_Connector = TO_MASK(UnicodeCE::U_CONNECTOR_PUNCTUATION), 109 Punctuation_Other = TO_MASK(UnicodeCE::U_OTHER_PUNCTUATION), 105 110 106 Punctuation_Dash = TO_MASK(UnicodeCE::U_DASH_PUNCTUATION), 107 Punctuation_Open = TO_MASK(UnicodeCE::U_START_PUNCTUATION), 108 Punctuation_Close = TO_MASK(UnicodeCE::U_END_PUNCTUATION), 109 Punctuation_Connector = TO_MASK(UnicodeCE::U_CONNECTOR_PUNCTUATION), 110 Punctuation_Other = TO_MASK(UnicodeCE::U_OTHER_PUNCTUATION), 111 Symbol_Math = TO_MASK(UnicodeCE::U_MATH_SYMBOL), 112 Symbol_Currency = TO_MASK(UnicodeCE::U_CURRENCY_SYMBOL), 113 Symbol_Modifier = TO_MASK(UnicodeCE::U_MODIFIER_SYMBOL), 114 Symbol_Other = TO_MASK(UnicodeCE::U_OTHER_SYMBOL), 111 115 112 Symbol_Math = TO_MASK(UnicodeCE::U_MATH_SYMBOL), 113 Symbol_Currency = TO_MASK(UnicodeCE::U_CURRENCY_SYMBOL), 114 Symbol_Modifier = TO_MASK(UnicodeCE::U_MODIFIER_SYMBOL), 115 Symbol_Other = TO_MASK(UnicodeCE::U_OTHER_SYMBOL), 116 Punctuation_InitialQuote = TO_MASK(UnicodeCE::U_INITIAL_PUNCTUATION), 117 Punctuation_FinalQuote = TO_MASK(UnicodeCE::U_FINAL_PUNCTUATION) 118 }; 116 119 117 Punctuation_InitialQuote = TO_MASK(UnicodeCE::U_INITIAL_PUNCTUATION), 118 Punctuation_FinalQuote = TO_MASK(UnicodeCE::U_FINAL_PUNCTUATION) 119 }; 120 CharCategory category(unsigned int); 120 121 121 CharCategory category(unsigned int); 122 bool isSpace(wchar_t); 123 bool isLetter(wchar_t); 124 bool isPrintableChar(wchar_t); 125 bool isUpper(wchar_t); 126 bool isLower(wchar_t); 127 bool isPunct(wchar_t); 128 bool isDigit(wchar_t); 129 bool isAlphanumeric(wchar_t); 130 inline bool isSeparatorSpace(wchar_t c) { return category(c) == Separator_Space; } 131 inline bool isHighSurrogate(wchar_t c) { return (c & 0xfc00) == 0xd800; } 132 inline bool isLowSurrogate(wchar_t c) { return (c & 0xfc00) == 0xdc00; } 122 133 123 bool isSpace(wchar_t); 124 bool isLetter(wchar_t); 125 bool isPrintableChar(wchar_t); 126 bool isUpper(wchar_t); 127 bool isLower(wchar_t); 128 bool isPunct(wchar_t); 129 bool isDigit(wchar_t); 130 bool isAlphanumeric(wchar_t); 131 inline bool isSeparatorSpace(wchar_t c) { return category(c) == Separator_Space; } 132 inline bool isHighSurrogate(wchar_t c) { return (c & 0xfc00) == 0xd800; } 133 inline bool isLowSurrogate(wchar_t c) { return (c & 0xfc00) == 0xdc00; } 134 wchar_t toLower(wchar_t); 135 wchar_t toUpper(wchar_t); 136 wchar_t foldCase(wchar_t); 137 wchar_t toTitleCase(wchar_t); 138 int toLower(wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError); 139 int toUpper(wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError); 140 int foldCase(UChar* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError); 134 141 135 wchar_t toLower(wchar_t); 136 wchar_t toUpper(wchar_t); 137 wchar_t foldCase(wchar_t); 138 wchar_t toTitleCase(wchar_t); 139 int toLower(wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError); 140 int toUpper(wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError); 141 int foldCase(UChar* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError); 142 int digitValue(wchar_t); 142 143 143 int digitValue(wchar_t); 144 wchar_t mirroredChar(UChar32); 145 unsigned char combiningClass(UChar32); 146 DecompositionType decompositionType(UChar32); 147 Direction direction(UChar32); 148 inline bool isArabicChar(UChar32 c) 149 { 150 return c >= 0x0600 && c <= 0x06FF; 151 } 144 152 145 wchar_t mirroredChar(UChar32); 146 unsigned char combiningClass(UChar32); 147 DecompositionType decompositionType(UChar32); 148 Direction direction(UChar32); 149 inline bool isArabicChar(UChar32 c) 150 { 151 return c >= 0x0600 && c <= 0x06FF; 152 } 153 inline bool hasLineBreakingPropertyComplexContext(UChar32) 154 { 155 return false; // FIXME: implement! 156 } 153 157 154 inline bool hasLineBreakingPropertyComplexContext(UChar32) 155 { 156 return false; // FIXME: implement! 157 } 158 inline int umemcasecmp(const wchar_t* a, const wchar_t* b, int len) 159 { 160 for (int i = 0; i < len; ++i) { 161 wchar_t c1 = foldCase(a[i]); 162 wchar_t c2 = foldCase(b[i]); 163 if (c1 != c2) 164 return c1 - c2; 165 } 166 return 0; 167 } 158 168 159 inline int umemcasecmp(const wchar_t* a, const wchar_t* b, int len) 160 { 161 for (int i = 0; i < len; ++i) { 162 wchar_t c1 = foldCase(a[i]); 163 wchar_t c2 = foldCase(b[i]); 164 if (c1 != c2) 165 return c1 - c2; 166 } 167 return 0; 168 } 169 inline UChar32 surrogateToUcs4(wchar_t high, wchar_t low) 170 { 171 return (UChar32(high) << 10) + low - 0x35fdc00; 172 } 169 173 170 inline UChar32 surrogateToUcs4(wchar_t high, wchar_t low) 171 { 172 return (UChar32(high) << 10) + low - 0x35fdc00; 173 } 174 175 } // namespace Unicode 176 177 } // namespace WTF 174 } // namespace Unicode 175 } // namespace WTF 178 176 179 177 #endif // WTF_UnicodeWinCE_h
Note: See TracChangeset
for help on using the changeset viewer.