From: Colin Finck Date: Wed, 15 Jun 2011 18:20:05 +0000 (+0000) Subject: [UNICODE] X-Git-Tag: backups/ros-amd64-bringup@60669^2~361 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=413867145e1069b72327ea42a4367fdc4d21540a [UNICODE] - Finally say goodbye to my "wcsfuncs" experiment started in 2008. We have (and always had) Wine's "unicode" library for this, which does the same and is more complete. Now that host tools only use include/host, we only need to include and it will choose the right file in either include/host or include/reactos. - Fix some include guards in PSDK headers to match the MS ones. - Always define WINE_UNICODE_API to an empty string instead of doing this separately for every module. - Cleanup some empty directories or non-existing include pathes. svn path=/trunk/; revision=52248 --- diff --git a/reactos/include/host/wine/unicode.h b/reactos/include/host/wine/unicode.h index b09f0f48f51..f553f64a444 100644 --- a/reactos/include/host/wine/unicode.h +++ b/reactos/include/host/wine/unicode.h @@ -54,11 +54,7 @@ extern "C" { #endif #ifndef WINE_UNICODE_API -# if defined(_MSC_VER) || defined(__MINGW32__) -# define WINE_UNICODE_API DECLSPEC_IMPORT -# else -# define WINE_UNICODE_API -# endif +#define WINE_UNICODE_API #endif #ifndef WINE_UNICODE_INLINE diff --git a/reactos/include/psdk/windows.h b/reactos/include/psdk/windows.h index 569b693abf8..323964cd918 100644 --- a/reactos/include/psdk/windows.h +++ b/reactos/include/psdk/windows.h @@ -52,21 +52,11 @@ #include #include #include -#ifndef _WINNLS_H #include -#endif -#ifndef _WINVER_H #include -#endif -#ifndef _WINNETWK_H #include -#endif -#ifndef _WINREG_H #include -#endif -#ifndef _WINSVC_H #include -#endif #ifndef WIN32_LEAN_AND_MEAN #include diff --git a/reactos/include/psdk/winnetwk.h b/reactos/include/psdk/winnetwk.h index c391472adce..d489da8b01a 100644 --- a/reactos/include/psdk/winnetwk.h +++ b/reactos/include/psdk/winnetwk.h @@ -1,5 +1,5 @@ -#ifndef _WINNETWK_H -#define _WINNETWK_H +#ifndef _WINNETWK_ +#define _WINNETWK_ #ifdef __cplusplus extern "C" { diff --git a/reactos/include/psdk/winnls.h b/reactos/include/psdk/winnls.h index 7677e3ad96b..42822203bd9 100644 --- a/reactos/include/psdk/winnls.h +++ b/reactos/include/psdk/winnls.h @@ -1,5 +1,5 @@ -#ifndef _WINNLS_H -#define _WINNLS_H +#ifndef _WINNLS_ +#define _WINNLS_ #ifdef __cplusplus extern "C" { diff --git a/reactos/include/psdk/winreg.h b/reactos/include/psdk/winreg.h index 32f9ceb101f..92999ca7e4c 100644 --- a/reactos/include/psdk/winreg.h +++ b/reactos/include/psdk/winreg.h @@ -1,5 +1,5 @@ -#ifndef _WINREG_H -#define _WINREG_H +#ifndef _WINREG_ +#define _WINREG_ #ifdef __cplusplus extern "C" { diff --git a/reactos/include/psdk/winsvc.h b/reactos/include/psdk/winsvc.h index 389f951f54c..8a66503beee 100644 --- a/reactos/include/psdk/winsvc.h +++ b/reactos/include/psdk/winsvc.h @@ -1,5 +1,5 @@ -#ifndef _WINSVC_H -#define _WINSVC_H +#ifndef _WINSVC_ +#define _WINSVC_ #ifdef __cplusplus extern "C" { diff --git a/reactos/include/psdk/winver.h b/reactos/include/psdk/winver.h index af93d6ebbb8..56b9fa8c8f3 100644 --- a/reactos/include/psdk/winver.h +++ b/reactos/include/psdk/winver.h @@ -1,5 +1,5 @@ -#ifndef _WINVER_H -#define _WINVER_H +#ifndef VER_H +#define VER_H #ifdef __cplusplus extern "C" { diff --git a/reactos/include/reactos/wcsfuncs.h b/reactos/include/reactos/wcsfuncs.h deleted file mode 100644 index 4357331f9f9..00000000000 --- a/reactos/include/reactos/wcsfuncs.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - PROJECT: ReactOS - LICENSE: GPL v2 or any later version - FILE: include/host/wcsfuncs.h - PURPOSE: Header for the "host_wcsfuncs" static library - COPYRIGHT: Copyright 2008 Colin Finck -*/ - -#ifndef _HOST_WCSFUNCS_H -#define _HOST_WCSFUNCS_H - -/* Map str*W functions to wcs* function */ - -#define isspaceW iswspace -#define strchrW wcschr -#define strcmpiW _wcsicmp -#define strcpyW wcscpy -#define strlenW wcslen -#define strncmpW wcsncmp -#define strtolW wcstol -#define strtoulW wcstoul - -#endif diff --git a/reactos/include/reactos/wine/unicode.h b/reactos/include/reactos/wine/unicode.h index 9e301888e41..1c742610d04 100644 --- a/reactos/include/reactos/wine/unicode.h +++ b/reactos/include/reactos/wine/unicode.h @@ -1,5 +1,12 @@ -#ifndef _WINE_UNICODE_H -#define _WINE_UNICODE_H +/* + * PROJECT: ReactOS + * LICENSE: LGPL v2.1 or any later version + * PURPOSE: Map Wine's Unicode functions to native wcs* functions wherever possible + * AUTHORS: ? + */ + +#ifndef __WINE_WINE_UNICODE_H +#define __WINE_WINE_UNICODE_H #include #include @@ -9,6 +16,14 @@ #include #include +#ifndef WINE_UNICODE_API +#define WINE_UNICODE_API +#endif + +#ifndef WINE_UNICODE_INLINE +#define WINE_UNICODE_INLINE static inline +#endif + #define memicmpW(s1,s2,n) _wcsnicmp((const wchar_t *)(s1),(const wchar_t *)(s2),(n)) #define strlenW(s) wcslen((const wchar_t *)(s)) #define strcpyW(d,s) wcscpy((wchar_t *)(d),(const wchar_t *)(s)) @@ -25,6 +40,7 @@ #define strncmpiW(s1,s2,n) _wcsnicmp((const wchar_t *)(s1),(const wchar_t *)(s2),(n)) #define strtoulW(s1,s2,b) wcstoul((const wchar_t *)(s1),(wchar_t **)(s2),(b)) #define strspnW(str, accept) wcsspn((const wchar_t *)(str), (const wchar_t *)(accept)) +#define strpbrkW(str, accept) wcspbrk((const wchar_t *)(str), (const wchar_t *)(accept)) #define tolowerW(n) towlower((n)) #define toupperW(n) towupper((n)) #define islowerW(n) iswlower((n)) @@ -45,28 +61,6 @@ #define vsnprintfW _vsnwprintf #define isprintW iswprint -#ifndef WINE_UNICODE_API -# if defined(_MSC_VER) -# define WINE_UNICODE_API __declspec(dllimport) -# else -# define WINE_UNICODE_API __attribute__((dllimport)) -# endif -#endif - -#ifndef __VALIST -#ifdef __GNUC__ -#define __VALIST __gnuc_va_list -#else -#define __VALIST char* -#endif -#endif /* defined __VALIST */ - -static __inline WCHAR *strpbrkW( const WCHAR *str, const WCHAR *accept ) -{ - for ( ; *str; str++) if (strchrW( accept, *str )) return (WCHAR *)str; - return NULL; -} - static __inline WCHAR *memchrW( const WCHAR *ptr, WCHAR ch, size_t n ) { const WCHAR *end; diff --git a/reactos/lib/cmlib/CMakeLists.txt b/reactos/lib/cmlib/CMakeLists.txt index 0de4e4de151..38c1b530a59 100644 --- a/reactos/lib/cmlib/CMakeLists.txt +++ b/reactos/lib/cmlib/CMakeLists.txt @@ -17,7 +17,6 @@ if(CMAKE_CROSSCOMPILING) add_dependencies(cmlib bugcodes) else() add_definitions( - -DWINE_UNICODE_API= -D__NO_CTYPE_INLINES -DCMLIB_HOST) add_library(cmlibhost ${SOURCE}) diff --git a/reactos/lib/cmlib/cmlib.h b/reactos/lib/cmlib/cmlib.h index ff5470c6d82..5fb85060130 100644 --- a/reactos/lib/cmlib/cmlib.h +++ b/reactos/lib/cmlib/cmlib.h @@ -13,7 +13,6 @@ #define _CMLIB_DEBUG_ 1 #ifdef CMLIB_HOST - #include #include #include #include @@ -69,9 +68,6 @@ #define PWORK_QUEUE_ITEM PVOID #define EX_PUSH_LOCK PULONG_PTR - /* For */ - #define USE_HOST_WCSFUNCS - #define CMLTRACE(x, ...) #else // @@ -89,10 +85,12 @@ #endif #include - #undef DECLSPEC_IMPORT - #define DECLSPEC_IMPORT #include - #include + + /* Prevent inclusion of Windows headers through */ + #define _WINDEF_ + #define _WINBASE_ + #define _WINNLS_ #endif @@ -121,6 +119,7 @@ #define CMAPI NTAPI +#include #include #include "hivedata.h" #include "cmdata.h" diff --git a/reactos/lib/cmlib/cmlib.rbuild b/reactos/lib/cmlib/cmlib.rbuild index ab81a0256a2..506eef92334 100644 --- a/reactos/lib/cmlib/cmlib.rbuild +++ b/reactos/lib/cmlib/cmlib.rbuild @@ -14,8 +14,6 @@ hivewrt.c - " " - . diff --git a/reactos/lib/inflib/inflib.rbuild b/reactos/lib/inflib/inflib.rbuild index aade527fcb7..1a8dad5eb6e 100644 --- a/reactos/lib/inflib/inflib.rbuild +++ b/reactos/lib/inflib/inflib.rbuild @@ -11,7 +11,6 @@ infrosput.c - include/host . diff --git a/reactos/lib/newinflib/CMakeLists.txt b/reactos/lib/newinflib/CMakeLists.txt index d59279038f5..bc57ae6b649 100644 --- a/reactos/lib/newinflib/CMakeLists.txt +++ b/reactos/lib/newinflib/CMakeLists.txt @@ -19,7 +19,7 @@ else() infhostput.c infhostrtl.c) - add_definitions(-DWINE_UNICODE_API= -D__NO_CTYPE_INLINES -DINFLIB_HOST -DUSE_HOST_WCSFUNCS) + add_definitions(-D__NO_CTYPE_INLINES -DINFLIB_HOST) if(NOT MSVC) add_compiler_flags(-Wpointer-arith -Wwrite-strings) endif() diff --git a/reactos/lib/newinflib/builddep.h b/reactos/lib/newinflib/builddep.h index c24a1eb75dd..398cb88e236 100644 --- a/reactos/lib/newinflib/builddep.h +++ b/reactos/lib/newinflib/builddep.h @@ -8,7 +8,6 @@ /* Definitions native to the host on which we're building */ -#include #include #include @@ -63,7 +62,6 @@ BOOLEAN NTAPI RtlIsTextUnicode( PVOID buf, INT len, INT *pf ); #include #define NTOS_MODE_USER #include -#include extern PVOID InfpHeap; @@ -83,4 +81,6 @@ extern PVOID InfpHeap; #endif /* INFLIB_HOST */ +#include + /* EOF */ diff --git a/reactos/lib/newinflib/inflib.rbuild b/reactos/lib/newinflib/inflib.rbuild index 7c758a7c332..d43e7ec424c 100644 --- a/reactos/lib/newinflib/inflib.rbuild +++ b/reactos/lib/newinflib/inflib.rbuild @@ -11,11 +11,8 @@ infrosput.c - " " - . - -Wwrite-strings -Wpointer-arith diff --git a/reactos/tools/mkhive/CMakeLists.txt b/reactos/tools/mkhive/CMakeLists.txt index 3629fb6f272..13e04297c1d 100644 --- a/reactos/tools/mkhive/CMakeLists.txt +++ b/reactos/tools/mkhive/CMakeLists.txt @@ -1,7 +1,5 @@ -add_definitions( - -DMKHIVE_HOST - -DWINE_UNICODE_API= ) +add_definitions(-DMKHIVE_HOST) include_directories( ${REACTOS_SOURCE_DIR}/lib/newinflib diff --git a/reactos/tools/mkhive/mkhive.rbuild b/reactos/tools/mkhive/mkhive.rbuild index 3b78e806f2c..26a95fa232c 100644 --- a/reactos/tools/mkhive/mkhive.rbuild +++ b/reactos/tools/mkhive/mkhive.rbuild @@ -1,8 +1,6 @@ - " " - . . . diff --git a/reactos/tools/unicode/CMakeLists.txt b/reactos/tools/unicode/CMakeLists.txt index 82fd36b0b6d..39868c1e786 100644 --- a/reactos/tools/unicode/CMakeLists.txt +++ b/reactos/tools/unicode/CMakeLists.txt @@ -1,6 +1,3 @@ - -add_definitions(-DWINE_UNICODE_API= ) - list(APPEND SOURCE casemap.c compose.c diff --git a/reactos/tools/unicode/unicode.rbuild b/reactos/tools/unicode/unicode.rbuild index cd2f6acaa03..17c11935b2e 100644 --- a/reactos/tools/unicode/unicode.rbuild +++ b/reactos/tools/unicode/unicode.rbuild @@ -1,7 +1,6 @@ - " " casemap.c compose.c cptable.c @@ -72,4 +71,4 @@ c_28604.c c_28605.c c_28606.c - \ No newline at end of file + diff --git a/reactos/tools/wmc/CMakeLists.txt b/reactos/tools/wmc/CMakeLists.txt index dd82e0f00cd..565a275b71e 100644 --- a/reactos/tools/wmc/CMakeLists.txt +++ b/reactos/tools/wmc/CMakeLists.txt @@ -9,6 +9,4 @@ list(APPEND SOURCE add_executable(wmc ${SOURCE}) -add_definitions(-DWINE_UNICODE_API= ) - target_link_libraries(wmc unicode) diff --git a/reactos/tools/wmc/wmc.rbuild b/reactos/tools/wmc/wmc.rbuild index 6822c8297c5..9dd4eade4ec 100644 --- a/reactos/tools/wmc/wmc.rbuild +++ b/reactos/tools/wmc/wmc.rbuild @@ -1,8 +1,6 @@ - " " - . unicode lang.c mcl.c diff --git a/reactos/tools/wrc/CMakeLists.txt b/reactos/tools/wrc/CMakeLists.txt index 5121cf9fb16..c94abad88e4 100644 --- a/reactos/tools/wrc/CMakeLists.txt +++ b/reactos/tools/wrc/CMakeLists.txt @@ -14,6 +14,4 @@ list(APPEND SOURCE add_executable(wrc ${SOURCE}) -add_definitions(-DWINE_UNICODE_API= ) - target_link_libraries(wrc wpp unicode) diff --git a/reactos/tools/wrc/wrc.rbuild b/reactos/tools/wrc/wrc.rbuild index 4ea83b37223..0bbfb1cfe82 100644 --- a/reactos/tools/wrc/wrc.rbuild +++ b/reactos/tools/wrc/wrc.rbuild @@ -1,9 +1,6 @@ - " " - - unicode wpp dumpres.c