From 47eb99dcf6907a3829bdf1d5e48d2c56df9ee232 Mon Sep 17 00:00:00 2001 From: Colin Finck Date: Sat, 8 Sep 2007 19:50:20 +0000 Subject: [PATCH] - Solve our wchar_t host problems the easy way by defining WCHAR to "unsigned short" (thx KJK for the hint) - Revert my changes to the "unicode" module in r28411 and r28423 - Include "typedefs_host.h" instead of the Windows headers in "wine/unicode.h", this component doesn't depend on target headers anymore. To get it to work completely without Windows headers, I also had to copy some definitions from to the "wine/unicode.h" file. svn path=/trunk/; revision=28957 --- reactos/include/reactos/typedefs_host.h | 4 ++-- reactos/tools/unicode/cptable.c | 3 ++- reactos/tools/unicode/mbtowc.c | 3 ++- reactos/tools/unicode/string.c | 4 +++- reactos/tools/unicode/unicode.mak | 2 +- reactos/tools/unicode/utf8.c | 3 ++- reactos/tools/unicode/wctomb.c | 3 ++- reactos/tools/unicode/wine/unicode.h | 21 ++++++++++++++++++--- 8 files changed, 32 insertions(+), 11 deletions(-) diff --git a/reactos/include/reactos/typedefs_host.h b/reactos/include/reactos/typedefs_host.h index 564890041cb..f8eb79c8a93 100644 --- a/reactos/include/reactos/typedefs_host.h +++ b/reactos/include/reactos/typedefs_host.h @@ -67,8 +67,8 @@ typedef int BOOL; typedef long int W64 LONG_PTR, *PLONG_PTR; typedef long unsigned int W64 ULONG_PTR, *PULONG_PTR; typedef ULONG_PTR SIZE_T, *PSIZE_T; -typedef wchar_t WCHAR, *PWCHAR, *PWSTR, *LPWSTR; -typedef const wchar_t *PCWSTR, *LPCWSTR; +typedef unsigned short WCHAR, *PWCHAR, *PWSTR, *LPWSTR; +typedef const unsigned short *PCWSTR, *LPCWSTR; typedef int NTSTATUS; typedef int POOL_TYPE; diff --git a/reactos/tools/unicode/cptable.c b/reactos/tools/unicode/cptable.c index a44a1a22d1b..7e45f15e03d 100644 --- a/reactos/tools/unicode/cptable.c +++ b/reactos/tools/unicode/cptable.c @@ -18,9 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "wine/unicode.h" #include +#include "wine/unicode.h" + /* Everything below this line is generated automatically by cpmap.pl */ /* ### cpmap begin ### */ extern union cptable cptable_037; diff --git a/reactos/tools/unicode/mbtowc.c b/reactos/tools/unicode/mbtowc.c index 41d2bab696e..c0e5791ccfb 100644 --- a/reactos/tools/unicode/mbtowc.c +++ b/reactos/tools/unicode/mbtowc.c @@ -18,9 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "wine/unicode.h" #include +#include "wine/unicode.h" + /* get the decomposition of a Unicode char */ static int get_decomposition( WCHAR src, WCHAR *dst, unsigned int dstlen ) { diff --git a/reactos/tools/unicode/string.c b/reactos/tools/unicode/string.c index 2767ad6af18..962115a6fc8 100644 --- a/reactos/tools/unicode/string.c +++ b/reactos/tools/unicode/string.c @@ -18,10 +18,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "wine/unicode.h" +#include #include #include +#include "wine/unicode.h" + extern const WCHAR wine_casemap_lower[]; extern const WCHAR wine_casemap_upper[]; extern const unsigned short wine_wctype_table[]; diff --git a/reactos/tools/unicode/unicode.mak b/reactos/tools/unicode/unicode.mak index d359d7f4f44..1741216ebea 100644 --- a/reactos/tools/unicode/unicode.mak +++ b/reactos/tools/unicode/unicode.mak @@ -96,7 +96,7 @@ UNICODE_OBJECTS = \ UNICODE_HOST_CFLAGS = \ -D__USE_W32API -DWINVER=0x501 -DWINE_UNICODE_API= \ - -I$(UNICODE_BASE) -Iinclude/reactos/wine -Iinclude -Iinclude/psdk \ + -I$(UNICODE_BASE) -Iinclude/reactos/wine -Iinclude -Iinclude/psdk -Iinclude/reactos \ $(TOOLS_CFLAGS) .PHONY: unicode diff --git a/reactos/tools/unicode/utf8.c b/reactos/tools/unicode/utf8.c index 484173c1f0f..334d7fc3b3e 100644 --- a/reactos/tools/unicode/utf8.c +++ b/reactos/tools/unicode/utf8.c @@ -18,9 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "wine/unicode.h" #include +#include "wine/unicode.h" + /* number of following bytes in sequence based on first byte value (for bytes above 0x7f) */ static const char utf8_length[128] = { diff --git a/reactos/tools/unicode/wctomb.c b/reactos/tools/unicode/wctomb.c index e171e0fac13..5ad027acd3c 100644 --- a/reactos/tools/unicode/wctomb.c +++ b/reactos/tools/unicode/wctomb.c @@ -18,9 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "wine/unicode.h" #include +#include "wine/unicode.h" + /* search for a character in the unicode_compose_table; helper for compose() */ static inline int binary_search( WCHAR ch, int low, int high ) { diff --git a/reactos/tools/unicode/wine/unicode.h b/reactos/tools/unicode/wine/unicode.h index 34ae52b9337..68c18dab998 100644 --- a/reactos/tools/unicode/wine/unicode.h +++ b/reactos/tools/unicode/wine/unicode.h @@ -22,10 +22,25 @@ #define __WINE_UNICODE_H #include +#include -#include -#include -#include +// Definitions copied from +// We only want to include host headers, so we define them manually +#define C1_UPPER 1 +#define C1_LOWER 2 +#define C1_DIGIT 4 +#define C1_SPACE 8 +#define C1_PUNCT 16 +#define C1_CNTRL 32 +#define C1_BLANK 64 +#define C1_XDIGIT 128 +#define C1_ALPHA 256 +#define MB_COMPOSITE 2 +#define MB_ERR_INVALID_CHARS 8 +#define WC_COMPOSITECHECK 512 +#define WC_DISCARDNS 16 +#define WC_DEFAULTCHAR 64 +#define WC_NO_BEST_FIT_CHARS 1024 #ifndef WINE_UNICODE_API #define WINE_UNICODE_API DECLSPEC_IMPORT