[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

kseo at webkit.org kseo at webkit.org
Wed Dec 22 14:36:28 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 09f7d9f639826530e8794f5464312b4154f44ab3
Author: kseo at webkit.org <kseo at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Oct 14 01:01:52 2010 +0000

    [BREWMP] Port unicode
    https://bugs.webkit.org/show_bug.cgi?id=45716
    
    Reviewed by Kent Tamura.
    
    Brew MP port uses only the subset of ICU library to reduce the binary size.
    Follow the WinCE's implementation.
    
    * wtf/Platform.h:
    * wtf/unicode/Unicode.h:
    * wtf/unicode/brew/UnicodeBrew.cpp: Added.
    (WTF::Unicode::toLower):
    (WTF::Unicode::toUpper):
    (WTF::Unicode::foldCase):
    (WTF::Unicode::isPrintableChar):
    (WTF::Unicode::isUpper):
    (WTF::Unicode::isLower):
    (WTF::Unicode::isDigit):
    (WTF::Unicode::isPunct):
    (WTF::Unicode::isAlphanumeric):
    (WTF::Unicode::toTitleCase):
    (WTF::Unicode::direction):
    (WTF::Unicode::category):
    (WTF::Unicode::decompositionType):
    (WTF::Unicode::combiningClass):
    (WTF::Unicode::mirroredChar):
    (WTF::Unicode::digitValue):
    (WTF::Unicode::isSpace):
    (WTF::Unicode::isLetter):
    * wtf/unicode/brew/UnicodeBrew.h: Added.
    (WTF::Unicode::isArabicChar):
    (WTF::Unicode::isSeparatorSpace):
    (WTF::Unicode::hasLineBreakingPropertyComplexContext):
    (WTF::Unicode::hasLineBreakingPropertyComplexContextOrIdeographic):
    (WTF::Unicode::umemcasecmp):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69723 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index d0fb463..13886f4 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,41 @@
+2010-10-13  Kwang Yul Seo  <skyul at company100.net>
+
+        Reviewed by Kent Tamura.
+
+        [BREWMP] Port unicode
+        https://bugs.webkit.org/show_bug.cgi?id=45716
+
+        Brew MP port uses only the subset of ICU library to reduce the binary size.
+        Follow the WinCE's implementation.
+
+        * wtf/Platform.h:
+        * wtf/unicode/Unicode.h:
+        * wtf/unicode/brew/UnicodeBrew.cpp: Added.
+        (WTF::Unicode::toLower):
+        (WTF::Unicode::toUpper):
+        (WTF::Unicode::foldCase):
+        (WTF::Unicode::isPrintableChar):
+        (WTF::Unicode::isUpper):
+        (WTF::Unicode::isLower):
+        (WTF::Unicode::isDigit):
+        (WTF::Unicode::isPunct):
+        (WTF::Unicode::isAlphanumeric):
+        (WTF::Unicode::toTitleCase):
+        (WTF::Unicode::direction):
+        (WTF::Unicode::category):
+        (WTF::Unicode::decompositionType):
+        (WTF::Unicode::combiningClass):
+        (WTF::Unicode::mirroredChar):
+        (WTF::Unicode::digitValue):
+        (WTF::Unicode::isSpace):
+        (WTF::Unicode::isLetter):
+        * wtf/unicode/brew/UnicodeBrew.h: Added.
+        (WTF::Unicode::isArabicChar):
+        (WTF::Unicode::isSeparatorSpace):
+        (WTF::Unicode::hasLineBreakingPropertyComplexContext):
+        (WTF::Unicode::hasLineBreakingPropertyComplexContextOrIdeographic):
+        (WTF::Unicode::umemcasecmp):
+
 2010-10-13  Gavin Barraclough  <barraclough at apple.com>
 
         Windows build fix.
diff --git a/JavaScriptCore/wtf/Platform.h b/JavaScriptCore/wtf/Platform.h
index 2a42eef..63efbb1 100644
--- a/JavaScriptCore/wtf/Platform.h
+++ b/JavaScriptCore/wtf/Platform.h
@@ -574,6 +574,8 @@
 #define WTF_USE_QT4_UNICODE 1
 #elif OS(WINCE)
 #define WTF_USE_WINCE_UNICODE 1
+#elif PLATFORM(BREWMP)
+#define WTF_USE_BREWMP_UNICODE 1
 #elif PLATFORM(GTK)
 /* The GTK+ Unicode backend is configurable */
 #else
diff --git a/JavaScriptCore/wtf/unicode/Unicode.h b/JavaScriptCore/wtf/unicode/Unicode.h
index c755c6c..50524b1 100644
--- a/JavaScriptCore/wtf/unicode/Unicode.h
+++ b/JavaScriptCore/wtf/unicode/Unicode.h
@@ -33,6 +33,8 @@
 #include <wtf/unicode/glib/UnicodeGLib.h>
 #elif USE(WINCE_UNICODE)
 #include <wtf/unicode/wince/UnicodeWinCE.h>
+#elif USE(BREWMP_UNICODE)
+#include <wtf/unicode/brew/UnicodeBrew.h>
 #else
 #error "Unknown Unicode implementation"
 #endif
diff --git a/JavaScriptCore/wtf/unicode/brew/UnicodeBrew.cpp b/JavaScriptCore/wtf/unicode/brew/UnicodeBrew.cpp
new file mode 100644
index 0000000..8367f17
--- /dev/null
+++ b/JavaScriptCore/wtf/unicode/brew/UnicodeBrew.cpp
@@ -0,0 +1,181 @@
+/*
+ *  Copyright (C) 2006 George Staikos <staikos at kde.org>
+ *  Copyright (C) 2006 Alexey Proskuryakov <ap at nypop.com>
+ *  Copyright (C) 2007-2009 Torch Mobile, Inc.
+ *  Copyright (C) 2010 Company 100, Inc.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "UnicodeBrew.h"
+
+#include <wchar.h>
+#include <wctype.h>
+
+namespace WTF {
+namespace Unicode {
+
+UChar toLower(UChar c)
+{
+    return towlower(c);
+}
+
+UChar toUpper(UChar c)
+{
+    return towupper(c);
+}
+
+UChar foldCase(UChar c)
+{
+    return towlower(c);
+}
+
+bool isPrintableChar(UChar c)
+{
+    return !!iswprint(c);
+}
+
+bool isUpper(UChar c)
+{
+    return !!iswupper(c);
+}
+
+bool isLower(UChar c)
+{
+    return !!iswlower(c);
+}
+
+bool isDigit(UChar c)
+{
+    return !!iswdigit(c);
+}
+
+bool isPunct(UChar c)
+{
+    return !!iswpunct(c);
+}
+
+bool isAlphanumeric(UChar c)
+{
+    return !!iswalnum(c);
+}
+
+int toLower(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError)
+{
+    const UChar* sourceIterator = source;
+    const UChar* sourceEnd = source + sourceLength;
+    UChar* resultIterator = result;
+    UChar* resultEnd = result + resultLength;
+
+    if (sourceLength <= resultLength) {
+        while (sourceIterator < sourceEnd)
+            *resultIterator++ = towlower(*sourceIterator++);
+    } else {
+        while (resultIterator < resultEnd)
+            *resultIterator++ = towlower(*sourceIterator++);
+    }
+
+    int remainingCharacters = sourceIterator < sourceEnd ? sourceEnd - sourceIterator : 0;
+    *isError = !!remainingCharacters;
+    if (resultIterator < resultEnd)
+        *resultIterator = 0;
+
+    return (resultIterator - result) + remainingCharacters;
+}
+
+int toUpper(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError)
+{
+    const UChar* sourceIterator = source;
+    const UChar* sourceEnd = source + sourceLength;
+    UChar* resultIterator = result;
+    UChar* resultEnd = result + resultLength;
+
+    if (sourceLength <= resultLength) {
+        while (sourceIterator < sourceEnd)
+            *resultIterator++ = towupper(*sourceIterator++);
+    } else {
+        while (resultIterator < resultEnd)
+            *resultIterator++ = towupper(*sourceIterator++);
+    }
+
+    int remainingCharacters = sourceIterator < sourceEnd ? sourceEnd - sourceIterator : 0;
+    *isError = !!remainingCharacters;
+    if (resultIterator < resultEnd)
+        *resultIterator = 0;
+
+    return (resultIterator - result) + remainingCharacters;
+}
+
+int foldCase(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError)
+{
+    *isError = false;
+    if (resultLength < sourceLength) {
+        *isError = true;
+        return sourceLength;
+    }
+    for (int i = 0; i < sourceLength; ++i)
+        result[i] = foldCase(source[i]);
+    return sourceLength;
+}
+
+UChar toTitleCase(UChar c)
+{
+    return towupper(c);
+}
+
+Direction direction(UChar32 c)
+{
+    return static_cast<Direction>(ICU::direction(c));
+}
+
+CharCategory category(unsigned int c)
+{
+    return static_cast<CharCategory>(TO_MASK((int8_t) ICU::category(c)));
+}
+
+DecompositionType decompositionType(UChar32 c)
+{
+    return static_cast<DecompositionType>(ICU::decompositionType(c));
+}
+
+unsigned char combiningClass(UChar32 c)
+{
+    return ICU::combiningClass(c);
+}
+
+UChar mirroredChar(UChar32 c)
+{
+    return ICU::mirroredChar(c);
+}
+
+int digitValue(UChar c)
+{
+    return ICU::digitValue(c);
+}
+
+bool isSpace(UChar c)
+{
+    return !!iswspace(c);
+}
+
+bool isLetter(UChar c)
+{
+    return !!iswalpha(c);
+}
+
+} // namespace Unicode
+} // namespace WTF
diff --git a/JavaScriptCore/wtf/unicode/brew/UnicodeBrew.h b/JavaScriptCore/wtf/unicode/brew/UnicodeBrew.h
new file mode 100644
index 0000000..1d7576f
--- /dev/null
+++ b/JavaScriptCore/wtf/unicode/brew/UnicodeBrew.h
@@ -0,0 +1,194 @@
+/*
+ *  Copyright (C) 2006 George Staikos <staikos at kde.org>
+ *  Copyright (C) 2006 Alexey Proskuryakov <ap at nypop.com>
+ *  Copyright (C) 2007 Apple Computer, Inc. All rights reserved.
+ *  Copyright (C) 2007-2009 Torch Mobile, Inc.
+ *  Copyright (C) 2010 Company 100, Inc.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef UnicodeBrew_h
+#define UnicodeBrew_h
+
+#include "UnicodeFromICU.h"
+#include "UnicodeMacrosFromICU.h"
+
+namespace WTF {
+namespace Unicode {
+
+enum Direction {
+    LeftToRight = ICU::U_LEFT_TO_RIGHT,
+    RightToLeft = ICU::U_RIGHT_TO_LEFT,
+    EuropeanNumber = ICU::U_EUROPEAN_NUMBER,
+    EuropeanNumberSeparator = ICU::U_EUROPEAN_NUMBER_SEPARATOR,
+    EuropeanNumberTerminator = ICU::U_EUROPEAN_NUMBER_TERMINATOR,
+    ArabicNumber = ICU::U_ARABIC_NUMBER,
+    CommonNumberSeparator = ICU::U_COMMON_NUMBER_SEPARATOR,
+    BlockSeparator = ICU::U_BLOCK_SEPARATOR,
+    SegmentSeparator = ICU::U_SEGMENT_SEPARATOR,
+    WhiteSpaceNeutral = ICU::U_WHITE_SPACE_NEUTRAL,
+    OtherNeutral = ICU::U_OTHER_NEUTRAL,
+    LeftToRightEmbedding = ICU::U_LEFT_TO_RIGHT_EMBEDDING,
+    LeftToRightOverride = ICU::U_LEFT_TO_RIGHT_OVERRIDE,
+    RightToLeftArabic = ICU::U_RIGHT_TO_LEFT_ARABIC,
+    RightToLeftEmbedding = ICU::U_RIGHT_TO_LEFT_EMBEDDING,
+    RightToLeftOverride = ICU::U_RIGHT_TO_LEFT_OVERRIDE,
+    PopDirectionalFormat = ICU::U_POP_DIRECTIONAL_FORMAT,
+    NonSpacingMark = ICU::U_DIR_NON_SPACING_MARK,
+    BoundaryNeutral = ICU::U_BOUNDARY_NEUTRAL
+};
+
+enum DecompositionType {
+    DecompositionNone = ICU::U_DT_NONE,
+    DecompositionCanonical = ICU::U_DT_CANONICAL,
+    DecompositionCompat = ICU::U_DT_COMPAT,
+    DecompositionCircle = ICU::U_DT_CIRCLE,
+    DecompositionFinal = ICU::U_DT_FINAL,
+    DecompositionFont = ICU::U_DT_FONT,
+    DecompositionFraction = ICU::U_DT_FRACTION,
+    DecompositionInitial = ICU::U_DT_INITIAL,
+    DecompositionIsolated = ICU::U_DT_ISOLATED,
+    DecompositionMedial = ICU::U_DT_MEDIAL,
+    DecompositionNarrow = ICU::U_DT_NARROW,
+    DecompositionNoBreak = ICU::U_DT_NOBREAK,
+    DecompositionSmall = ICU::U_DT_SMALL,
+    DecompositionSquare = ICU::U_DT_SQUARE,
+    DecompositionSub = ICU::U_DT_SUB,
+    DecompositionSuper = ICU::U_DT_SUPER,
+    DecompositionVertical = ICU::U_DT_VERTICAL,
+    DecompositionWide = ICU::U_DT_WIDE,
+};
+
+enum CharCategory {
+    NoCategory =  0,
+    Other_NotAssigned = TO_MASK(ICU::U_GENERAL_OTHER_TYPES),
+    Letter_Uppercase = TO_MASK(ICU::U_UPPERCASE_LETTER),
+    Letter_Lowercase = TO_MASK(ICU::U_LOWERCASE_LETTER),
+    Letter_Titlecase = TO_MASK(ICU::U_TITLECASE_LETTER),
+    Letter_Modifier = TO_MASK(ICU::U_MODIFIER_LETTER),
+    Letter_Other = TO_MASK(ICU::U_OTHER_LETTER),
+
+    Mark_NonSpacing = TO_MASK(ICU::U_NON_SPACING_MARK),
+    Mark_Enclosing = TO_MASK(ICU::U_ENCLOSING_MARK),
+    Mark_SpacingCombining = TO_MASK(ICU::U_COMBINING_SPACING_MARK),
+
+    Number_DecimalDigit = TO_MASK(ICU::U_DECIMAL_DIGIT_NUMBER),
+    Number_Letter = TO_MASK(ICU::U_LETTER_NUMBER),
+    Number_Other = TO_MASK(ICU::U_OTHER_NUMBER),
+
+    Separator_Space = TO_MASK(ICU::U_SPACE_SEPARATOR),
+    Separator_Line = TO_MASK(ICU::U_LINE_SEPARATOR),
+    Separator_Paragraph = TO_MASK(ICU::U_PARAGRAPH_SEPARATOR),
+
+    Other_Control = TO_MASK(ICU::U_CONTROL_CHAR),
+    Other_Format = TO_MASK(ICU::U_FORMAT_CHAR),
+    Other_PrivateUse = TO_MASK(ICU::U_PRIVATE_USE_CHAR),
+    Other_Surrogate = TO_MASK(ICU::U_SURROGATE),
+
+    Punctuation_Dash = TO_MASK(ICU::U_DASH_PUNCTUATION),
+    Punctuation_Open = TO_MASK(ICU::U_START_PUNCTUATION),
+    Punctuation_Close = TO_MASK(ICU::U_END_PUNCTUATION),
+    Punctuation_Connector = TO_MASK(ICU::U_CONNECTOR_PUNCTUATION),
+    Punctuation_Other = TO_MASK(ICU::U_OTHER_PUNCTUATION),
+
+    Symbol_Math = TO_MASK(ICU::U_MATH_SYMBOL),
+    Symbol_Currency = TO_MASK(ICU::U_CURRENCY_SYMBOL),
+    Symbol_Modifier = TO_MASK(ICU::U_MODIFIER_SYMBOL),
+    Symbol_Other = TO_MASK(ICU::U_OTHER_SYMBOL),
+
+    Punctuation_InitialQuote = TO_MASK(ICU::U_INITIAL_PUNCTUATION),
+    Punctuation_FinalQuote = TO_MASK(ICU::U_FINAL_PUNCTUATION)
+};
+
+UChar foldCase(UChar);
+
+int foldCase(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
+
+int toLower(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
+
+UChar toUpper(UChar);
+UChar toLower(UChar);
+
+bool isUpper(UChar);
+
+int toUpper(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
+
+UChar toTitleCase(UChar);
+
+inline bool isArabicChar(UChar32 c)
+{
+    return c >= 0x0600 && c <= 0x06FF;
+}
+
+bool isAlphanumeric(UChar);
+
+CharCategory category(unsigned int);
+
+inline bool isSeparatorSpace(UChar c)
+{
+    return category(c) == Separator_Space;
+}
+
+bool isPrintableChar(UChar);
+
+bool isDigit(UChar);
+
+bool isPunct(UChar);
+
+inline bool hasLineBreakingPropertyComplexContext(UChar32)
+{
+    // FIXME: implement!
+    return false;
+}
+
+inline bool hasLineBreakingPropertyComplexContextOrIdeographic(UChar32 c)
+{
+    // FIXME
+    return false;
+}
+
+UChar mirroredChar(UChar32);
+
+Direction direction(UChar32);
+
+bool isLower(UChar);
+
+int digitValue(UChar);
+
+unsigned char combiningClass(UChar32);
+
+DecompositionType decompositionType(UChar32);
+
+inline int umemcasecmp(const UChar* a, const UChar* b, int len)
+{
+    for (int i = 0; i < len; ++i) {
+        UChar c1 = foldCase(a[i]);
+        UChar c2 = foldCase(b[i]);
+        if (c1 != c2)
+            return c1 - c2;
+    }
+    return 0;
+}
+
+bool isSpace(UChar);
+bool isLetter(UChar);
+
+} // namespace Unicode
+} // namespace WTF
+
+#endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list