Replace UnicodeWinCE with UnicodeWchar https://bugs.webkit.org/show_bug.cgi?id=92539
authorparoga@webkit.org <paroga@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Jul 2012 10:25:41 +0000 (10:25 +0000)
committerparoga@webkit.org <paroga@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Jul 2012 10:25:41 +0000 (10:25 +0000)
Reviewed by Ryosuke Niwa.

UnicodeWinCE never contained WinCE specific code. UnicodeWchar
is a replacement for it, which is mainly based on the functions
from <wchar.h>. It is ment as a minimal Unicode backend, which
can be used very easy and has no external dependencies.

.:

* Source/cmake/OptionsWinCE.cmake:

Source/WebCore:

* platform/text/TextEncoding.cpp:
(WebCore::TextEncoding::encode):
* platform/text/TextEncodingRegistry.cpp:
(WebCore::extendTextCodecMaps):

Source/WebKit/blackberry:

* WebCoreSupport/AboutDataUseFeatures.in:

Source/WTF:

* WTF.gyp/WTF.gyp:
* WTF.gypi:
* wtf/Platform.h:
* wtf/PlatformWinCE.cmake:
* wtf/unicode/Unicode.h:
* wtf/unicode/wchar/UnicodeWchar.cpp: Added.
(Unicode):
(WTF::Unicode::category):
(WTF::Unicode::combiningClass):
(WTF::Unicode::direction):
(WTF::Unicode::decompositionType):
(WTF::Unicode::hasLineBreakingPropertyComplexContext):
(WTF::Unicode::mirroredChar):
(WTF::Unicode::convertWithFunction):
(WTF::Unicode::foldCase):
(WTF::Unicode::toLower):
(WTF::Unicode::toUpper):
* wtf/unicode/wchar/UnicodeWchar.h: Added.
(Unicode):
(WTF::Unicode::isAlphanumeric):
(WTF::Unicode::isDigit):
(WTF::Unicode::isLetter):
(WTF::Unicode::isLower):
(WTF::Unicode::isPrintableChar):
(WTF::Unicode::isPunct):
(WTF::Unicode::isSpace):
(WTF::Unicode::isUpper):
(WTF::Unicode::isArabicChar):
(WTF::Unicode::isSeparatorSpace):
(WTF::Unicode::foldCase):
(WTF::Unicode::toLower):
(WTF::Unicode::toUpper):
(WTF::Unicode::toTitleCase):
(WTF::Unicode::umemcasecmp):
* wtf/unicode/wince/UnicodeWinCE.cpp: Removed.
* wtf/unicode/wince/UnicodeWinCE.h: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@124010 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 files changed:
ChangeLog
Source/WTF/ChangeLog
Source/WTF/WTF.gyp/WTF.gyp
Source/WTF/WTF.gypi
Source/WTF/wtf/Platform.h
Source/WTF/wtf/PlatformWinCE.cmake
Source/WTF/wtf/unicode/Unicode.h
Source/WTF/wtf/unicode/wchar/UnicodeWchar.cpp [new file with mode: 0644]
Source/WTF/wtf/unicode/wchar/UnicodeWchar.h [new file with mode: 0644]
Source/WTF/wtf/unicode/wince/UnicodeWinCE.cpp [deleted file]
Source/WTF/wtf/unicode/wince/UnicodeWinCE.h [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/platform/text/TextEncoding.cpp
Source/WebCore/platform/text/TextEncodingRegistry.cpp
Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebCoreSupport/AboutDataUseFeatures.in
Source/cmake/OptionsWinCE.cmake

index 2d76152..cbe1627 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2012-07-30  Patrick Gansterer  <paroga@webkit.org>
+
+        Replace UnicodeWinCE with UnicodeWchar
+        https://bugs.webkit.org/show_bug.cgi?id=92539
+
+        Reviewed by Ryosuke Niwa.
+
+        UnicodeWinCE never contained WinCE specific code. UnicodeWchar
+        is a replacement for it, which is mainly based on the functions
+        from <wchar.h>. It is ment as a minimal Unicode backend, which
+        can be used very easy and has no external dependencies.
+
+        * Source/cmake/OptionsWinCE.cmake:
+
 2012-07-29  Vsevolod Vlasov  <vsevik@chromium.org>
 
         Web Inspector: Resource agent's reference to cached resources should be weak.
index da25357..179c660 100644 (file)
@@ -1,3 +1,52 @@
+2012-07-30  Patrick Gansterer  <paroga@webkit.org>
+
+        Replace UnicodeWinCE with UnicodeWchar
+        https://bugs.webkit.org/show_bug.cgi?id=92539
+
+        Reviewed by Ryosuke Niwa.
+
+        UnicodeWinCE never contained WinCE specific code. UnicodeWchar
+        is a replacement for it, which is mainly based on the functions
+        from <wchar.h>. It is ment as a minimal Unicode backend, which
+        can be used very easy and has no external dependencies.
+
+        * WTF.gyp/WTF.gyp:
+        * WTF.gypi:
+        * wtf/Platform.h:
+        * wtf/PlatformWinCE.cmake:
+        * wtf/unicode/Unicode.h:
+        * wtf/unicode/wchar/UnicodeWchar.cpp: Added.
+        (Unicode):
+        (WTF::Unicode::category):
+        (WTF::Unicode::combiningClass):
+        (WTF::Unicode::direction):
+        (WTF::Unicode::decompositionType):
+        (WTF::Unicode::hasLineBreakingPropertyComplexContext):
+        (WTF::Unicode::mirroredChar):
+        (WTF::Unicode::convertWithFunction):
+        (WTF::Unicode::foldCase):
+        (WTF::Unicode::toLower):
+        (WTF::Unicode::toUpper):
+        * wtf/unicode/wchar/UnicodeWchar.h: Added.
+        (Unicode):
+        (WTF::Unicode::isAlphanumeric):
+        (WTF::Unicode::isDigit):
+        (WTF::Unicode::isLetter):
+        (WTF::Unicode::isLower):
+        (WTF::Unicode::isPrintableChar):
+        (WTF::Unicode::isPunct):
+        (WTF::Unicode::isSpace):
+        (WTF::Unicode::isUpper):
+        (WTF::Unicode::isArabicChar):
+        (WTF::Unicode::isSeparatorSpace):
+        (WTF::Unicode::foldCase):
+        (WTF::Unicode::toLower):
+        (WTF::Unicode::toUpper):
+        (WTF::Unicode::toTitleCase):
+        (WTF::Unicode::umemcasecmp):
+        * wtf/unicode/wince/UnicodeWinCE.cpp: Removed.
+        * wtf/unicode/wince/UnicodeWinCE.h: Removed.
+
 2012-07-26  Yury Semikhatsky  <yurys@chromium.org>
 
         Web Inspector: move StringImpl size calculation to StringImpl
index db82dd2..50b1327 100644 (file)
         ['exclude', '../wtf/url'],
         ['exclude', '../wtf/wince'],
         ['exclude', '../wtf/wx'],
-        ['exclude', '../wtf/unicode/wince'],
         ['exclude', '../wtf/unicode/glib'],
         ['exclude', '../wtf/unicode/qt4'],
+        ['exclude', '../wtf/unicode/wchar'],
         # GLib/GTK, even though its name doesn't really indicate.
         ['exclude', '/(gtk|glib|gobject)/.*\\.(cpp|h)$'],
         ['exclude', '(Default|Gtk|Mac|None|Qt|Win|Wx|Efl|Symbian)\\.(cpp|mm)$'],
index 59c74b3..664b40d 100644 (file)
             'wtf/unicode/glib/UnicodeGLib.h',
             'wtf/unicode/icu/CollatorICU.cpp',
             'wtf/unicode/qt4/UnicodeQt4.h',
-            'wtf/unicode/wince/UnicodeWinCE.cpp',
-            'wtf/unicode/wince/UnicodeWinCE.h',
+            'wtf/unicode/wchar/UnicodeWchar.cpp',
+            'wtf/unicode/wchar/UnicodeWchar.h',
             'wtf/win/MainThreadWin.cpp',
             'wtf/win/OwnPtrWin.cpp',
             'wtf/wince/FastMallocWinCE.h',
index f99c4c8..50710b1 100644 (file)
 #define WTF_USE_QT4_UNICODE 1
 #endif
 #elif OS(WINCE)
-#define WTF_USE_WINCE_UNICODE 1
+#define WTF_USE_WCHAR_UNICODE 1
 #elif PLATFORM(GTK)
 /* The GTK+ Unicode backend is configurable */
 #else
index d30282f..6146e64 100644 (file)
@@ -1,8 +1,7 @@
 LIST(APPEND WTF_HEADERS
-    unicode/wince/UnicodeWinCE.h
+    unicode/wchar/UnicodeWchar.h
 
     ${3RDPARTY_DIR}/ce-compat/ce_time.h
-    ${3RDPARTY_DIR}/ce-compat/ce_unicode.h
 )
 
 LIST(APPEND WTF_SOURCES
@@ -14,13 +13,12 @@ LIST(APPEND WTF_SOURCES
     threads/win/BinarySemaphoreWin.cpp
 
     unicode/CollatorDefault.cpp
-    unicode/wince/UnicodeWinCE.cpp
+    unicode/wchar/UnicodeWchar.cpp
 
     win/MainThreadWin.cpp
     win/OwnPtrWin.cpp
 
     ${3RDPARTY_DIR}/ce-compat/ce_time.c
-    ${3RDPARTY_DIR}/ce-compat/ce_unicode.cpp
 )
 
 LIST(APPEND WTF_LIBRARIES
index cc44476..9260211 100644 (file)
@@ -34,8 +34,8 @@ typedef unsigned char LChar;
 #include <wtf/unicode/icu/UnicodeIcu.h>
 #elif USE(GLIB_UNICODE)
 #include <wtf/unicode/glib/UnicodeGLib.h>
-#elif USE(WINCE_UNICODE)
-#include <wtf/unicode/wince/UnicodeWinCE.h>
+#elif USE(WCHAR_UNICODE)
+#include <wtf/unicode/wchar/UnicodeWchar.h>
 #else
 #error "Unknown Unicode implementation"
 #endif
diff --git a/Source/WTF/wtf/unicode/wchar/UnicodeWchar.cpp b/Source/WTF/wtf/unicode/wchar/UnicodeWchar.cpp
new file mode 100644 (file)
index 0000000..e975c3b
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2012 Patrick Gansterer <paroga@paroga.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "UnicodeWchar.h"
+
+#include <algorithm>
+
+namespace WTF {
+namespace Unicode {
+
+CharCategory category(UChar32)
+{
+    return NoCategory; // FIXME: implement!
+}
+
+unsigned char combiningClass(UChar32)
+{
+    return 0; // FIXME: implement!
+}
+
+Direction direction(UChar32)
+{
+    return LeftToRight; // FIXME: implement!
+}
+
+DecompositionType decompositionType(UChar32)
+{
+    return DecompositionNone; // FIXME: implement!
+}
+
+bool hasLineBreakingPropertyComplexContext(UChar32)
+{
+    return false; // FIXME: implement!
+}
+
+UChar32 mirroredChar(UChar32 c)
+{
+    return c; // FIXME: implement!
+}
+
+template<UChar Function(UChar)>
+static inline int convertWithFunction(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError)
+{
+    UChar* resultIterator = result;
+    UChar* resultEnd = result + std::min(resultLength, sourceLength);
+    while (resultIterator < resultEnd)
+        *resultIterator++ = Function(*source++);
+
+    if (sourceLength < resultLength)
+        *resultIterator = '\0';
+
+    *isError = sourceLength > resultLength;
+    return sourceLength;
+}
+
+int foldCase(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError)
+{
+    return convertWithFunction<foldCase>(result, resultLength, source, sourceLength, isError);
+}
+
+int toLower(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError)
+{
+    return convertWithFunction<toLower>(result, resultLength, source, sourceLength, isError);
+}
+
+int toUpper(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError)
+{
+    return convertWithFunction<toUpper>(result, resultLength, source, sourceLength, isError);
+}
+
+} // namespace Unicode
+} // namespace WTF
diff --git a/Source/WTF/wtf/unicode/wchar/UnicodeWchar.h b/Source/WTF/wtf/unicode/wchar/UnicodeWchar.h
new file mode 100644 (file)
index 0000000..10c2026
--- /dev/null
@@ -0,0 +1,167 @@
+/*
+ * Copyright (C) 2012 Patrick Gansterer <paroga@paroga.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WTF_UnicodeWchar_h
+#define WTF_UnicodeWchar_h
+
+#include <stdint.h>
+#include <wchar.h>
+#include <wtf/unicode/ScriptCodesFromICU.h>
+#include <wtf/unicode/UnicodeMacrosFromICU.h>
+
+typedef wchar_t UChar;
+typedef uint32_t UChar32;
+
+namespace WTF {
+namespace Unicode {
+
+enum Direction {
+    LeftToRight,
+    RightToLeft,
+    EuropeanNumber,
+    EuropeanNumberSeparator,
+    EuropeanNumberTerminator,
+    ArabicNumber,
+    CommonNumberSeparator,
+    BlockSeparator,
+    SegmentSeparator,
+    WhiteSpaceNeutral,
+    OtherNeutral,
+    LeftToRightEmbedding,
+    LeftToRightOverride,
+    RightToLeftArabic,
+    RightToLeftEmbedding,
+    RightToLeftOverride,
+    PopDirectionalFormat,
+    NonSpacingMark,
+    BoundaryNeutral
+};
+
+enum DecompositionType {
+    DecompositionNone,
+    DecompositionCanonical,
+    DecompositionCompat,
+    DecompositionCircle,
+    DecompositionFinal,
+    DecompositionFont,
+    DecompositionFraction,
+    DecompositionInitial,
+    DecompositionIsolated,
+    DecompositionMedial,
+    DecompositionNarrow,
+    DecompositionNoBreak,
+    DecompositionSmall,
+    DecompositionSquare,
+    DecompositionSub,
+    DecompositionSuper,
+    DecompositionVertical,
+    DecompositionWide
+};
+
+enum CharCategory {
+    NoCategory = 0,
+    Other_NotAssigned = U_MASK(0),
+    Letter_Uppercase = U_MASK(1),
+    Letter_Lowercase = U_MASK(2),
+    Letter_Titlecase = U_MASK(3),
+    Letter_Modifier = U_MASK(4),
+    Letter_Other = U_MASK(5),
+
+    Mark_NonSpacing = U_MASK(6),
+    Mark_Enclosing = U_MASK(7),
+    Mark_SpacingCombining = U_MASK(8),
+
+    Number_DecimalDigit = U_MASK(9),
+    Number_Letter = U_MASK(10),
+    Number_Other = U_MASK(11),
+
+    Separator_Space = U_MASK(12),
+    Separator_Line = U_MASK(13),
+    Separator_Paragraph = U_MASK(14),
+
+    Other_Control = U_MASK(15),
+    Other_Format = U_MASK(16),
+    Other_PrivateUse = U_MASK(17),
+    Other_Surrogate = U_MASK(18),
+
+    Punctuation_Dash = U_MASK(19),
+    Punctuation_Open = U_MASK(20),
+    Punctuation_Close = U_MASK(21),
+    Punctuation_Connector = U_MASK(22),
+    Punctuation_Other = U_MASK(23),
+
+    Symbol_Math = U_MASK(24),
+    Symbol_Currency = U_MASK(25),
+    Symbol_Modifier = U_MASK(26),
+    Symbol_Other = U_MASK(27),
+
+    Punctuation_InitialQuote = U_MASK(28),
+    Punctuation_FinalQuote = U_MASK(29)
+};
+
+
+WTF_EXPORT_PRIVATE CharCategory category(UChar32);
+WTF_EXPORT_PRIVATE unsigned char combiningClass(UChar32);
+WTF_EXPORT_PRIVATE Direction direction(UChar32);
+WTF_EXPORT_PRIVATE DecompositionType decompositionType(UChar32);
+WTF_EXPORT_PRIVATE bool hasLineBreakingPropertyComplexContext(UChar32);
+WTF_EXPORT_PRIVATE UChar32 mirroredChar(UChar32);
+
+inline bool isAlphanumeric(UChar c) { return !!iswalnum(c); }
+inline bool isDigit(UChar c) { return !!iswdigit(c); }
+inline bool isLetter(UChar c) { return !!iswalpha(c); }
+inline bool isLower(UChar c) { return !!iswlower(c); }
+inline bool isPrintableChar(UChar c) { return !!iswprint(c); }
+inline bool isPunct(UChar c) { return !!iswpunct(c); }
+inline bool isSpace(UChar c) { return !!iswspace(c); }
+inline bool isUpper(UChar c) { return !!iswupper(c); }
+
+inline bool isArabicChar(UChar32 c) { return c >= 0x0600 && c <= 0x06ff; }
+inline bool isSeparatorSpace(UChar32 c) { return category(c) == Separator_Space; }
+
+inline UChar foldCase(UChar c) { return towlower(c); }
+inline UChar toLower(UChar c) { return towlower(c); }
+inline UChar toUpper(UChar c) { return towupper(c); }
+inline UChar toTitleCase(UChar c) { return towupper(c); }
+
+WTF_EXPORT_PRIVATE int foldCase(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
+WTF_EXPORT_PRIVATE int toLower(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
+WTF_EXPORT_PRIVATE int toUpper(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
+
+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;
+}
+
+} // namespace Unicode
+} // namespace WTF
+
+#endif // WTF_UnicodeWchar_h
diff --git a/Source/WTF/wtf/unicode/wince/UnicodeWinCE.cpp b/Source/WTF/wtf/unicode/wince/UnicodeWinCE.cpp
deleted file mode 100644 (file)
index 96dac7d..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- *  Copyright (C) 2006 George Staikos <staikos@kde.org>
- *  Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com>
- *  Copyright (C) 2007-2009 Torch Mobile, 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 "UnicodeWinCE.h"
-
-#include <wchar.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 isSpace(UChar c)
-{
-    return !!iswspace(c);
-}
-
-bool isLetter(UChar c)
-{
-    return !!iswalpha(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;
-
-    int remainingCharacters = 0;
-    if (sourceLength <= resultLength)
-        while (sourceIterator < sourceEnd)
-            *resultIterator++ = towlower(*sourceIterator++);
-    else
-        while (resultIterator < resultEnd)
-            *resultIterator++ = towlower(*sourceIterator++);
-
-    if (sourceIterator < sourceEnd)
-        remainingCharacters += sourceEnd - sourceIterator;
-    *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;
-
-    int remainingCharacters = 0;
-    if (sourceLength <= resultLength)
-        while (sourceIterator < sourceEnd)
-            *resultIterator++ = towupper(*sourceIterator++);
-    else
-        while (resultIterator < resultEnd)
-            *resultIterator++ = towupper(*sourceIterator++);
-
-    if (sourceIterator < sourceEnd)
-        remainingCharacters += sourceEnd - sourceIterator;
-    *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>(UnicodeCE::direction(c));
-}
-
-CharCategory category(unsigned int c)
-{
-    return static_cast<CharCategory>(TO_MASK((__int8) UnicodeCE::category(c)));
-}
-
-DecompositionType decompositionType(UChar32 c)
-{
-    return static_cast<DecompositionType>(UnicodeCE::decompositionType(c));
-}
-
-unsigned char combiningClass(UChar32 c)
-{
-    return UnicodeCE::combiningClass(c);
-}
-
-UChar mirroredChar(UChar32 c)
-{
-    return UnicodeCE::mirroredChar(c);
-}
-
-int digitValue(UChar c)
-{
-    return UnicodeCE::digitValue(c);
-}
-
-} // namespace Unicode
-} // namespace WTF
diff --git a/Source/WTF/wtf/unicode/wince/UnicodeWinCE.h b/Source/WTF/wtf/unicode/wince/UnicodeWinCE.h
deleted file mode 100644 (file)
index d61bb46..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- *  Copyright (C) 2006 George Staikos <staikos@kde.org>
- *  Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com>
- *  Copyright (C) 2007 Apple Computer, Inc. All rights reserved.
- *  Copyright (C) 2007-2009 Torch Mobile, 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 WTF_UnicodeWinCE_h
-#define WTF_UnicodeWinCE_h
-
-#include <wtf/unicode/ScriptCodesFromICU.h>
-#include <wtf/unicode/UnicodeMacrosFromICU.h>
-
-#include "ce_unicode.h"
-
-#define TO_MASK(x) (1 << (x))
-
-namespace WTF {
-namespace Unicode {
-
-enum Direction {
-    LeftToRight = UnicodeCE::U_LEFT_TO_RIGHT,
-    RightToLeft = UnicodeCE::U_RIGHT_TO_LEFT,
-    EuropeanNumber = UnicodeCE::U_EUROPEAN_NUMBER,
-    EuropeanNumberSeparator = UnicodeCE::U_EUROPEAN_NUMBER_SEPARATOR,
-    EuropeanNumberTerminator = UnicodeCE::U_EUROPEAN_NUMBER_TERMINATOR,
-    ArabicNumber = UnicodeCE::U_ARABIC_NUMBER,
-    CommonNumberSeparator = UnicodeCE::U_COMMON_NUMBER_SEPARATOR,
-    BlockSeparator = UnicodeCE::U_BLOCK_SEPARATOR,
-    SegmentSeparator = UnicodeCE::U_SEGMENT_SEPARATOR,
-    WhiteSpaceNeutral = UnicodeCE::U_WHITE_SPACE_NEUTRAL,
-    OtherNeutral = UnicodeCE::U_OTHER_NEUTRAL,
-    LeftToRightEmbedding = UnicodeCE::U_LEFT_TO_RIGHT_EMBEDDING,
-    LeftToRightOverride = UnicodeCE::U_LEFT_TO_RIGHT_OVERRIDE,
-    RightToLeftArabic = UnicodeCE::U_RIGHT_TO_LEFT_ARABIC,
-    RightToLeftEmbedding = UnicodeCE::U_RIGHT_TO_LEFT_EMBEDDING,
-    RightToLeftOverride = UnicodeCE::U_RIGHT_TO_LEFT_OVERRIDE,
-    PopDirectionalFormat = UnicodeCE::U_POP_DIRECTIONAL_FORMAT,
-    NonSpacingMark = UnicodeCE::U_DIR_NON_SPACING_MARK,
-    BoundaryNeutral = UnicodeCE::U_BOUNDARY_NEUTRAL
-};
-
-enum DecompositionType {
-    DecompositionNone = UnicodeCE::U_DT_NONE,
-    DecompositionCanonical = UnicodeCE::U_DT_CANONICAL,
-    DecompositionCompat = UnicodeCE::U_DT_COMPAT,
-    DecompositionCircle = UnicodeCE::U_DT_CIRCLE,
-    DecompositionFinal = UnicodeCE::U_DT_FINAL,
-    DecompositionFont = UnicodeCE::U_DT_FONT,
-    DecompositionFraction = UnicodeCE::U_DT_FRACTION,
-    DecompositionInitial = UnicodeCE::U_DT_INITIAL,
-    DecompositionIsolated = UnicodeCE::U_DT_ISOLATED,
-    DecompositionMedial = UnicodeCE::U_DT_MEDIAL,
-    DecompositionNarrow = UnicodeCE::U_DT_NARROW,
-    DecompositionNoBreak = UnicodeCE::U_DT_NOBREAK,
-    DecompositionSmall = UnicodeCE::U_DT_SMALL,
-    DecompositionSquare = UnicodeCE::U_DT_SQUARE,
-    DecompositionSub = UnicodeCE::U_DT_SUB,
-    DecompositionSuper = UnicodeCE::U_DT_SUPER,
-    DecompositionVertical = UnicodeCE::U_DT_VERTICAL,
-    DecompositionWide = UnicodeCE::U_DT_WIDE
-};
-
-enum CharCategory {
-    NoCategory =  0,
-    Other_NotAssigned = TO_MASK(UnicodeCE::U_GENERAL_OTHER_TYPES),
-    Letter_Uppercase = TO_MASK(UnicodeCE::U_UPPERCASE_LETTER),
-    Letter_Lowercase = TO_MASK(UnicodeCE::U_LOWERCASE_LETTER),
-    Letter_Titlecase = TO_MASK(UnicodeCE::U_TITLECASE_LETTER),
-    Letter_Modifier = TO_MASK(UnicodeCE::U_MODIFIER_LETTER),
-    Letter_Other = TO_MASK(UnicodeCE::U_OTHER_LETTER),
-
-    Mark_NonSpacing = TO_MASK(UnicodeCE::U_NON_SPACING_MARK),
-    Mark_Enclosing = TO_MASK(UnicodeCE::U_ENCLOSING_MARK),
-    Mark_SpacingCombining = TO_MASK(UnicodeCE::U_COMBINING_SPACING_MARK),
-
-    Number_DecimalDigit = TO_MASK(UnicodeCE::U_DECIMAL_DIGIT_NUMBER),
-    Number_Letter = TO_MASK(UnicodeCE::U_LETTER_NUMBER),
-    Number_Other = TO_MASK(UnicodeCE::U_OTHER_NUMBER),
-
-    Separator_Space = TO_MASK(UnicodeCE::U_SPACE_SEPARATOR),
-    Separator_Line = TO_MASK(UnicodeCE::U_LINE_SEPARATOR),
-    Separator_Paragraph = TO_MASK(UnicodeCE::U_PARAGRAPH_SEPARATOR),
-
-    Other_Control = TO_MASK(UnicodeCE::U_CONTROL_CHAR),
-    Other_Format = TO_MASK(UnicodeCE::U_FORMAT_CHAR),
-    Other_PrivateUse = TO_MASK(UnicodeCE::U_PRIVATE_USE_CHAR),
-    Other_Surrogate = TO_MASK(UnicodeCE::U_SURROGATE),
-
-    Punctuation_Dash = TO_MASK(UnicodeCE::U_DASH_PUNCTUATION),
-    Punctuation_Open = TO_MASK(UnicodeCE::U_START_PUNCTUATION),
-    Punctuation_Close = TO_MASK(UnicodeCE::U_END_PUNCTUATION),
-    Punctuation_Connector = TO_MASK(UnicodeCE::U_CONNECTOR_PUNCTUATION),
-    Punctuation_Other = TO_MASK(UnicodeCE::U_OTHER_PUNCTUATION),
-
-    Symbol_Math = TO_MASK(UnicodeCE::U_MATH_SYMBOL),
-    Symbol_Currency = TO_MASK(UnicodeCE::U_CURRENCY_SYMBOL),
-    Symbol_Modifier = TO_MASK(UnicodeCE::U_MODIFIER_SYMBOL),
-    Symbol_Other = TO_MASK(UnicodeCE::U_OTHER_SYMBOL),
-
-    Punctuation_InitialQuote = TO_MASK(UnicodeCE::U_INITIAL_PUNCTUATION),
-    Punctuation_FinalQuote = TO_MASK(UnicodeCE::U_FINAL_PUNCTUATION)
-};
-
-CharCategory category(unsigned int);
-
-bool isSpace(UChar);
-bool isLetter(UChar);
-bool isPrintableChar(UChar);
-bool isUpper(UChar);
-bool isLower(UChar);
-bool isPunct(UChar);
-bool isDigit(UChar);
-bool isAlphanumeric(UChar);
-inline bool isSeparatorSpace(UChar c) { return category(c) == Separator_Space; }
-
-UChar toLower(UChar);
-UChar toUpper(UChar);
-UChar foldCase(UChar);
-UChar toTitleCase(UChar);
-int toLower(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
-int toUpper(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
-int foldCase(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
-
-int digitValue(UChar);
-
-UChar mirroredChar(UChar32);
-unsigned char combiningClass(UChar32);
-DecompositionType decompositionType(UChar32);
-Direction direction(UChar32);
-inline bool isArabicChar(UChar32 c)
-{
-    return c >= 0x0600 && c <= 0x06FF;
-}
-
-inline bool hasLineBreakingPropertyComplexContext(UChar32)
-{
-    return false; // FIXME: implement!
-}
-
-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;
-}
-
-} // namespace Unicode
-} // namespace WTF
-
-#endif // WTF_UnicodeWinCE_h
index 6cf700e..0d06bc3 100644 (file)
@@ -1,3 +1,20 @@
+2012-07-30  Patrick Gansterer  <paroga@webkit.org>
+
+        Replace UnicodeWinCE with UnicodeWchar
+        https://bugs.webkit.org/show_bug.cgi?id=92539
+
+        Reviewed by Ryosuke Niwa.
+
+        UnicodeWinCE never contained WinCE specific code. UnicodeWchar
+        is a replacement for it, which is mainly based on the functions
+        from <wchar.h>. It is ment as a minimal Unicode backend, which
+        can be used very easy and has no external dependencies.
+
+        * platform/text/TextEncoding.cpp:
+        (WebCore::TextEncoding::encode):
+        * platform/text/TextEncodingRegistry.cpp:
+        (WebCore::extendTextCodecMaps):
+
 2012-07-30  Hayato Ito  <hayato@chromium.org>
 
         Remove unnecessary code which set event's target from EventDispatcher::dispatchEvent.
index e3d372a..2e9079b 100644 (file)
@@ -125,7 +125,7 @@ CString TextEncoding::encode(const UChar* characters, size_t length, Unencodable
     UTF16Normalized.set(g_utf8_to_utf16(UTF8Normalized.get(), -1, 0, &UTF16Length, 0));
 
     return newTextCodec(*this)->encode(UTF16Normalized.get(), UTF16Length, handling);
-#elif USE(WINCE_UNICODE)
+#elif OS(WINDOWS) && USE(WCHAR_UNICODE)
     // normalization will be done by Windows CE API
     OwnPtr<TextCodec> textCodec = newTextCodec(*this);
     return textCodec.get() ? textCodec->encode(characters, length, handling) : CString();
index bd8b7a5..4763bf8 100644 (file)
@@ -51,7 +51,7 @@
 #if USE(GLIB_UNICODE)
 #include "gtk/TextCodecGtk.h"
 #endif
-#if USE(WINCE_UNICODE)
+#if OS(WINDOWS) && USE(WCHAR_UNICODE)
 #include "win/TextCodecWin.h"
 #endif
 
@@ -311,7 +311,7 @@ static void extendTextCodecMaps()
     TextCodecGtk::registerExtendedCodecs(addToTextCodecMap);
 #endif
 
-#if USE(WINCE_UNICODE)
+#if OS(WINDOWS) && USE(WCHAR_UNICODE)
     TextCodecWin::registerExtendedEncodingNames(addToTextEncodingNameMap);
     TextCodecWin::registerExtendedCodecs(addToTextCodecMap);
 #endif
index ffaee6d..ad712fd 100644 (file)
@@ -1,3 +1,17 @@
+2012-07-30  Patrick Gansterer  <paroga@webkit.org>
+
+        Replace UnicodeWinCE with UnicodeWchar
+        https://bugs.webkit.org/show_bug.cgi?id=92539
+
+        Reviewed by Ryosuke Niwa.
+
+        UnicodeWinCE never contained WinCE specific code. UnicodeWchar
+        is a replacement for it, which is mainly based on the functions
+        from <wchar.h>. It is ment as a minimal Unicode backend, which
+        can be used very easy and has no external dependencies.
+
+        * WebCoreSupport/AboutDataUseFeatures.in:
+
 2012-07-27  Eli Fidler  <efidler@rim.com>
 
         [BlackBerry] Adapt to change in the FontInfo platform API.
index 66f9575..ee6a3df 100644 (file)
@@ -111,7 +111,7 @@ WEBAUDIO_IPP
 WEBAUDIO_MKL
 WEBKIT_IMAGE_DECODERS
 WEBP
-WINCE_UNICODE
+WCHAR_UNICODE
 WININET
 WK_SCROLLBAR_PAINTER
 WTFURL
index 270f003..c8ff8ac 100644 (file)
@@ -1,7 +1,7 @@
 INCLUDE(OptionsWindows)
 
 ADD_DEFINITIONS(-D_CE_CRT_ALLOW_WIN_MINMAX)
-ADD_DEFINITIONS(-DWTF_USE_WINCE_UNICODE=1)
+ADD_DEFINITIONS(-DWTF_USE_WCHAR_UNICODE=1)
 ADD_DEFINITIONS(-DWTF_USE_WININET=1)
 ADD_DEFINITIONS(-DWTF_CPU_ARM_TRADITIONAL -DWINCEBASIC)
 ADD_DEFINITIONS(-DJS_NO_EXPORT)