Author: hyperion
Date: Sun May 25 16:00:08 2008
New Revision: 33703
URL:
http://svn.reactos.org/svn/reactos?rev=33703&view=rev
Log:
modified include/psdk/winnls.h
Added definitions for NormalizeString and IsNormalizedString (Vista and later)
Correct an embarassing bug (some macros were terminated with ";", shame
shame)
added nls
added nls/3rdparty
added nls/3rdparty/icu
We officially welcome IBM's excellent ICU4C library for Unicode support to our
humble source tree. May our marriage be long, happy and fertile.
added nls/3rdparty/icu4ros.rbuild
added nls/dll
added nls/dll/normaliz_redist
added nls/dll/normaliz_redist/normaliz.cpp
added nls/dll/normaliz_redist/normaliz.def
added nls/dll/normaliz_redist/normaliz_redist.rbuild
added nls/lib
added nls/lib/normalize
added nls/lib/normalize/normalize.cpp
added nls/lib/normalize/normalize.rbuild
added nls/nls.rbuild
modified ReactOS-generic.rbuild
Incomplete implementation of the redistributable normaliz.dll DLL for Unicode
normalization, as a technical preview of what's to come from the use of ICU4C -
namely, straightforward, painless implementation of complex algorithms and several
megabytes worth of data, with a Win32-compatible interface on top. Currently disabled in
the build until basic testing is over.
Watch this space for more of the same.
Added:
trunk/reactos/nls/
trunk/reactos/nls/3rdparty/
trunk/reactos/nls/3rdparty/icu/
- copied from r33686, vendor/icu4c/current/icu/
trunk/reactos/nls/3rdparty/icu4ros.rbuild (with props)
trunk/reactos/nls/dll/
trunk/reactos/nls/dll/normaliz_redist/
trunk/reactos/nls/dll/normaliz_redist/normaliz.cpp (with props)
trunk/reactos/nls/dll/normaliz_redist/normaliz.def (with props)
trunk/reactos/nls/dll/normaliz_redist/normaliz_redist.rbuild (with props)
trunk/reactos/nls/lib/
trunk/reactos/nls/lib/normalize/
trunk/reactos/nls/lib/normalize/normalize.cpp (with props)
trunk/reactos/nls/lib/normalize/normalize.rbuild (with props)
trunk/reactos/nls/nls.rbuild (with props)
Modified:
trunk/reactos/ReactOS-generic.rbuild
trunk/reactos/include/psdk/winnls.h
Modified: trunk/reactos/ReactOS-generic.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ReactOS-generic.rbuild?rev…
==============================================================================
--- trunk/reactos/ReactOS-generic.rbuild [iso-8859-1] (original)
+++ trunk/reactos/ReactOS-generic.rbuild [iso-8859-1] Sun May 25 16:00:08 2008
@@ -58,6 +58,9 @@
<directory name="modules">
<xi:include href="modules/directory.rbuild" />
</directory>
+ <!--<directory name="nls">
+ <xi:include href="nls/nls.rbuild" />
+ </directory>-->
<directory name="ntoskrnl">
<xi:include href="ntoskrnl/ntoskrnl.rbuild" />
<!-- <xi:include href="ntoskrnl/ntkrnlmp.rbuild" /> -->
Modified: trunk/reactos/include/psdk/winnls.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winnls.h?rev=…
==============================================================================
--- trunk/reactos/include/psdk/winnls.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/winnls.h [iso-8859-1] Sun May 25 16:00:08 2008
@@ -543,6 +543,15 @@
LPWSTR lpThousandSep;
UINT NegativeOrder;
} NUMBERFMTW,*LPNUMBERFMTW;
+#if (WINVER >= 0x0600)
+typedef enum _NORM_FORM {
+ NormalizationOther = 0,
+ NormalizationC = 0x1,
+ NormalizationD = 0x2,
+ NormalizationKC = 0x5,
+ NormalizationKD = 0x6
+} NORM_FORM;
+#endif /* (WINVER >= 0x0600) */
int WINAPI CompareStringA(LCID,DWORD,LPCSTR,int,LPCSTR,int);
int WINAPI CompareStringW(LCID,DWORD,LPCWSTR,int,LPCWSTR,int);
@@ -623,6 +632,10 @@
LANGID WINAPI GetUserDefaultUILanguage(void);
BOOL WINAPI IsValidLanguageGroup(LGRPID,DWORD);
#endif /* (WINVER >= 0x0500) */
+#if (WINVER >= 0x0600)
+int WINAPI NormalizeString(NORM_FORM,LPCWSTR,int,LPWSTR,int);
+BOOL WINAPI IsNormalizedString(NORM_FORM,LPCWSTR,int);
+#endif /* (WINVER >= 0x0600) */
#ifdef UNICODE
#define CALINFO_ENUMPROC CALINFO_ENUMPROCW
@@ -661,11 +674,11 @@
#define SetCalendarInfo SetCalendarInfoW
#define SetLocaleInfo SetLocaleInfoW
#if (WINVER >= 0x0500)
-#define EnumCalendarInfoEx EnumCalendarInfoExW;
-#define EnumDateFormatsEx EnumDateFormatsExW;
-#define EnumSystemLanguageGroups EnumSystemLanguageGroupsW;
-#define EnumLanguageGroupLocales EnumLanguageGroupLocalesW;
-#define EnumUILanguages EnumUILanguagesW;
+#define EnumCalendarInfoEx EnumCalendarInfoExW
+#define EnumDateFormatsEx EnumDateFormatsExW
+#define EnumSystemLanguageGroups EnumSystemLanguageGroupsW
+#define EnumLanguageGroupLocales EnumLanguageGroupLocalesW
+#define EnumUILanguages EnumUILanguagesW
#endif /* (WINVER >= 0x0500) */
#else
#define CALINFO_ENUMPROC CALINFO_ENUMPROCA
@@ -704,11 +717,11 @@
#define SetCalendarInfo SetCalendarInfoA
#define SetLocaleInfo SetLocaleInfoA
#if (WINVER >= 0x0500)
-#define EnumCalendarInfoEx EnumCalendarInfoExA;
-#define EnumDateFormatsEx EnumDateFormatsExA;
-#define EnumSystemLanguageGroups EnumSystemLanguageGroupsA;
-#define EnumLanguageGroupLocales EnumLanguageGroupLocalesA;
-#define EnumUILanguages EnumUILanguagesA;
+#define EnumCalendarInfoEx EnumCalendarInfoExA
+#define EnumDateFormatsEx EnumDateFormatsExA
+#define EnumSystemLanguageGroups EnumSystemLanguageGroupsA
+#define EnumLanguageGroupLocales EnumLanguageGroupLocalesA
+#define EnumUILanguages EnumUILanguagesA
#endif /* (WINVER >= 0x0500) */
#endif /* UNICODE */
#endif /* RC_INVOKED */
Added: trunk/reactos/nls/3rdparty/icu4ros.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/nls/3rdparty/icu4ros.rbuil…
==============================================================================
--- trunk/reactos/nls/3rdparty/icu4ros.rbuild (added)
+++ trunk/reactos/nls/3rdparty/icu4ros.rbuild [iso-8859-1] Sun May 25 16:00:08 2008
@@ -1,0 +1,41 @@
+<?xml version="1.0"?>
+<!DOCTYPE module SYSTEM "../../tools/rbuild/project.dtd">
+<module name="icu4ros" type="staticlibrary"
allowwarnings="true">
+ <define name="U_STATIC_IMPLEMENTATION" />
+ <define name="U_HAVE_INTTYPES_H" />
+ <compilerflag>-fno-exceptions</compilerflag>
+ <compilerflag>-fno-rtti</compilerflag>
+ <include base="icu4ros">icu/source/common</include>
+ <directory name="icu">
+ <directory name="source">
+ <directory name="common">
+ <file>bmpset.cpp</file>
+ <file>uhash_us.cpp</file>
+ <file>uiter.cpp</file>
+ <file>unifilt.cpp</file>
+ <file>unifunct.cpp</file>
+ <file>uniset.cpp</file>
+ <file>unisetspan.cpp</file>
+ <file>unistr.cpp</file>
+ <file>unorm.cpp</file>
+ <file>uobject.cpp</file>
+ <file>uset.cpp</file>
+ <file>util.cpp</file>
+ <file>uvector.cpp</file>
+ <file>cmemory.c</file>
+ <file>cstring.c</file>
+ <file>ucln_cmn.c</file>
+ <file>udata.c</file>
+ <file>udataswp.c</file>
+ <file>uhash.c</file>
+ <file>uinvchar.c</file>
+ <file>umath.c</file>
+ <file>umutex.c</file>
+ <file>ustring.c</file>
+ <file>ustrtrns.c</file>
+ <file>utf_impl.c</file>
+ <file>utrie.c</file>
+ </directory>
+ </directory>
+ </directory>
+</module>
Propchange: trunk/reactos/nls/3rdparty/icu4ros.rbuild
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/nls/dll/normaliz_redist/normaliz.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/nls/dll/normaliz_redist/no…
==============================================================================
--- trunk/reactos/nls/dll/normaliz_redist/normaliz.cpp (added)
+++ trunk/reactos/nls/dll/normaliz_redist/normaliz.cpp [iso-8859-1] Sun May 25 16:00:08
2008
@@ -1,0 +1,40 @@
+// FIXME: clean up this mess
+
+#ifndef _DEBUG
+#include <stdlib.h>
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+void free(void * memory)
+{
+ HeapFree(GetProcessHeap(), 0, memory);
+}
+
+void * malloc(size_t size)
+{
+ return HeapAlloc(GetProcessHeap(), 0, size);
+}
+
+void * realloc(void * memory, size_t size)
+{
+ return HeapReAlloc(GetProcessHeap(), 0, memory, size);
+}
+
+void operator delete(void * memory)
+{
+ free(memory);
+}
+
+extern "C" int __cdecl _purecall()
+{
+ FatalAppExitW(0, L"pure virtual call");
+ FatalExit(0);
+ return 0;
+}
+
+extern "C" void __cxa_pure_virtual() { _purecall(); }
+
+#endif
+
+// EOF
Propchange: trunk/reactos/nls/dll/normaliz_redist/normaliz.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/nls/dll/normaliz_redist/normaliz.def
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/nls/dll/normaliz_redist/no…
==============================================================================
--- trunk/reactos/nls/dll/normaliz_redist/normaliz.def (added)
+++ trunk/reactos/nls/dll/normaliz_redist/normaliz.def [iso-8859-1] Sun May 25 16:00:08
2008
@@ -1,0 +1,5 @@
+LIBRARY "normaliz"
+
+EXPORTS
+ NormalizeString=NormalizeString@20
+ IsNormalizedString=IsNormalizedString@12
Propchange: trunk/reactos/nls/dll/normaliz_redist/normaliz.def
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/nls/dll/normaliz_redist/normaliz_redist.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/nls/dll/normaliz_redist/no…
==============================================================================
--- trunk/reactos/nls/dll/normaliz_redist/normaliz_redist.rbuild (added)
+++ trunk/reactos/nls/dll/normaliz_redist/normaliz_redist.rbuild [iso-8859-1] Sun May 25
16:00:08 2008
@@ -1,0 +1,10 @@
+<?xml version="1.0"?>
+<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
+<module name="normaliz_redist" type="win32dll"
installname="normaliz.dll">
+ <library>normalize</library>
+ <library>icu4ros</library>
+ <compilerflag>-fno-exceptions</compilerflag>
+ <compilerflag>-fno-rtti</compilerflag>
+ <importlibrary definition="normaliz.def" />
+ <file>normaliz.cpp</file>
+</module>
Propchange: trunk/reactos/nls/dll/normaliz_redist/normaliz_redist.rbuild
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/nls/lib/normalize/normalize.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/nls/lib/normalize/normaliz…
==============================================================================
--- trunk/reactos/nls/lib/normalize/normalize.cpp (added)
+++ trunk/reactos/nls/lib/normalize/normalize.cpp [iso-8859-1] Sun May 25 16:00:08 2008
@@ -1,0 +1,89 @@
+#define WIN32_LEAN_AND_MEAN
+#define STRICT
+
+#define WINVER 0x0600
+
+#include <windows.h>
+#include <winnls.h>
+
+#include <unicode/unorm.h>
+
+static
+UNormalizationMode
+NORMALIZE_ModeToICU
+(
+ NORM_FORM NormForm
+)
+{
+ switch(NormForm)
+ {
+ case NormalizationC: return UNORM_NFC;
+ case NormalizationD: return UNORM_NFD;
+ case NormalizationKC: return UNORM_NFKC;
+ case NormalizationKD: return UNORM_NFKD;
+ case NormalizationOther: break;
+ }
+
+ return UNORM_NONE;
+}
+
+static
+DWORD
+NLS_ErrorFromICU
+(
+ UErrorCode ErrorCode
+)
+{
+ // TODO
+ return ERROR_GEN_FAILURE;
+}
+
+int
+WINAPI
+NormalizeString
+(
+ NORM_FORM NormForm,
+ LPCWSTR lpSrcString,
+ int cwSrcLength,
+ LPWSTR lpDstString,
+ int cwDstLength
+)
+{
+ UErrorCode ErrorCode = U_ZERO_ERROR;
+
+ int retval = unorm_normalize
+ (
+ lpSrcString,
+ cwSrcLength,
+ NORMALIZE_ModeToICU(NormForm),
+ 0,
+ lpDstString,
+ cwDstLength,
+ &ErrorCode
+ );
+
+ if(U_FAILURE(ErrorCode))
+ SetLastError(NLS_ErrorFromICU(ErrorCode));
+
+ return retval;
+}
+
+BOOL
+WINAPI
+IsNormalizedString
+(
+ NORM_FORM NormForm,
+ LPCWSTR lpString,
+ int cwLength
+)
+{
+ UErrorCode ErrorCode = U_ZERO_ERROR;
+ BOOL retval = !!unorm_isNormalized(lpString, cwLength, NORMALIZE_ModeToICU(NormForm),
&ErrorCode);
+
+ if(U_FAILURE(ErrorCode))
+ SetLastError(NLS_ErrorFromICU(ErrorCode));
+
+ return retval;
+}
+
+// EOF
Propchange: trunk/reactos/nls/lib/normalize/normalize.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/nls/lib/normalize/normalize.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/nls/lib/normalize/normaliz…
==============================================================================
--- trunk/reactos/nls/lib/normalize/normalize.rbuild (added)
+++ trunk/reactos/nls/lib/normalize/normalize.rbuild [iso-8859-1] Sun May 25 16:00:08
2008
@@ -1,0 +1,9 @@
+<?xml version="1.0"?>
+<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
+<module name="normalize" type="staticlibrary">
+ <library>icu4ros</library>
+ <compilerflag>-fno-exceptions</compilerflag>
+ <compilerflag>-fno-rtti</compilerflag>
+ <include base="icu4ros">icu/source/common</include>
+ <file>normalize.cpp</file>
+</module>
Propchange: trunk/reactos/nls/lib/normalize/normalize.rbuild
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/nls/nls.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/nls/nls.rbuild?rev=33703&a…
==============================================================================
--- trunk/reactos/nls/nls.rbuild (added)
+++ trunk/reactos/nls/nls.rbuild [iso-8859-1] Sun May 25 16:00:08 2008
@@ -1,0 +1,13 @@
+<?xml version="1.0"?>
+<!DOCTYPE group SYSTEM "../tools/rbuild/project.dtd">
+<group
xmlns:xi="http://www.w3.org/2001/XInclude">
+ <directory name="3rdparty"><xi:include
href="3rdparty/icu4ros.rbuild" /></directory>
+
+ <directory name="lib">
+ <directory name="normalize"><xi:include
href="lib/normalize/normalize.rbuild" /></directory>
+ </directory>
+
+ <directory name="dll">
+ <directory name="normaliz_redist"><xi:include
href="dll/normaliz_redist/normaliz_redist.rbuild" /></directory>
+ </directory>
+</group>
Propchange: trunk/reactos/nls/nls.rbuild
------------------------------------------------------------------------------
svn:eol-style = native