From 301a62db3ae68122ef71c64d6ca48925cb4ca374 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 15 Jun 2011 10:30:03 +0000 Subject: [PATCH] [HOST] Only use /include/host as include directory for host tools / libs. svn path=/trunk/; revision=52240 --- reactos/CMakeLists.txt | 6 +- reactos/ReactOS-generic.rbuild | 5 +- reactos/include/host/config.h | 4 +- reactos/include/host/nls.h | 2 +- reactos/include/host/typedefs.h | 10 +- reactos/include/host/wcsfuncs.h | 29 ---- .../unicode => include/host}/wine/unicode.h | 2 +- reactos/lib/CMakeLists.txt | 1 - reactos/lib/cmlib/cmdata.h | 8 - reactos/lib/cmlib/cmlib.h | 8 +- reactos/lib/cmlib/hivedata.h | 8 - reactos/lib/host/directory.rbuild | 7 - reactos/lib/host/wcsfuncs/CMakeLists.txt | 2 - reactos/lib/host/wcsfuncs/wcsfuncs.c | 88 ---------- reactos/lib/host/wcsfuncs/wcsfuncs.rbuild | 5 - reactos/lib/inflib/builddep.h | 2 +- reactos/lib/inflib/inflib.mak | 2 +- reactos/lib/inflib/inflib.rbuild | 1 + reactos/lib/lib.rbuild | 3 - reactos/lib/newinflib/CMakeLists.txt | 4 +- reactos/lib/newinflib/builddep.h | 5 +- reactos/tools/kbdtool/kbdtool.h | 2 +- reactos/tools/mkhive/mkhive.h | 5 +- reactos/tools/nandflash/nandflash.h | 2 +- reactos/tools/rbuild_helper/argv_parser.h | 159 ++++++++++++++++++ .../rbuild_helper/null_output_iterator.h | 51 ++++++ reactos/tools/rbuild_helper/rbuild_helper.cpp | 4 +- .../tools/rbuild_helper/rbuild_helper.rbuild | 1 + .../tools/rbuild_helper/stringz_iterator.h | 130 ++++++++++++++ reactos/tools/widl/hash.c | 2 +- reactos/tools/widl/typelib.c | 2 +- reactos/tools/widl/typelib_struct.h | 4 +- reactos/tools/widl/write_msft.c | 20 +-- reactos/tools/wmc/wmctypes.h | 2 +- reactos/tools/wrc/newstruc.c | 4 +- reactos/tools/wrc/wrcrostypes.h | 8 +- 36 files changed, 388 insertions(+), 210 deletions(-) delete mode 100644 reactos/include/host/wcsfuncs.h rename reactos/{tools/unicode => include/host}/wine/unicode.h (99%) delete mode 100644 reactos/lib/host/directory.rbuild delete mode 100644 reactos/lib/host/wcsfuncs/CMakeLists.txt delete mode 100644 reactos/lib/host/wcsfuncs/wcsfuncs.c delete mode 100644 reactos/lib/host/wcsfuncs/wcsfuncs.rbuild create mode 100644 reactos/tools/rbuild_helper/argv_parser.h create mode 100644 reactos/tools/rbuild_helper/null_output_iterator.h create mode 100644 reactos/tools/rbuild_helper/stringz_iterator.h diff --git a/reactos/CMakeLists.txt b/reactos/CMakeLists.txt index 7842453b9d4..5d97b672b21 100644 --- a/reactos/CMakeLists.txt +++ b/reactos/CMakeLists.txt @@ -52,11 +52,7 @@ if(NOT CMAKE_CROSSCOMPILING) add_compiler_flags(-fshort-wchar) endif() - include_directories( - ${REACTOS_SOURCE_DIR}/tools/unicode - include - include/host - ${REACTOS_BINARY_DIR}/include) + include_directories(include/host) add_subdirectory(tools) add_subdirectory(lib) diff --git a/reactos/ReactOS-generic.rbuild b/reactos/ReactOS-generic.rbuild index 9258f28d842..7b6d23a19a2 100644 --- a/reactos/ReactOS-generic.rbuild +++ b/reactos/ReactOS-generic.rbuild @@ -81,10 +81,7 @@ include/reactos/mc include/reactos/libs - include - include - include/reactos - include/reactos/wine + include/host -Wall diff --git a/reactos/include/host/config.h b/reactos/include/host/config.h index 0a30629b42c..6c4180fdede 100644 --- a/reactos/include/host/config.h +++ b/reactos/include/host/config.h @@ -1,8 +1,6 @@ /* include/config.h. Generated by configure. */ /* include/config.h.in. Generated from configure.ac by autoheader. */ -#include "reactos/buildno.h" - #define __WINE_CONFIG_H #define HAVE_SPAWNVP 1 @@ -125,7 +123,7 @@ #define PACKAGE_TARNAME "ReactOS" /* Define to the version of this package. */ -#define PACKAGE_VERSION KERNEL_VERSION_STR +#define PACKAGE_VERSION "" /* Define to the full name and version of this package. */ #define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION diff --git a/reactos/include/host/nls.h b/reactos/include/host/nls.h index d9f79136c74..46ccd23cccc 100644 --- a/reactos/include/host/nls.h +++ b/reactos/include/host/nls.h @@ -9,7 +9,7 @@ #ifndef _HOST_NLS_H #define _HOST_NLS_H -#include +#include typedef DWORD LCID; diff --git a/reactos/include/host/typedefs.h b/reactos/include/host/typedefs.h index 07146c48220..6bbe25f8633 100644 --- a/reactos/include/host/typedefs.h +++ b/reactos/include/host/typedefs.h @@ -70,7 +70,7 @@ typedef WORD LANGID; #define MAXUSHORT USHRT_MAX /* Widely used structures */ -#include +#include typedef struct _RTL_BITMAP { ULONG SizeOfBitMap; @@ -112,7 +112,7 @@ typedef struct _UNICODE_STRING USHORT MaximumLength; PWSTR Buffer; } UNICODE_STRING, *PUNICODE_STRING; -#include +#include /* List Functions */ static __inline @@ -170,7 +170,7 @@ RemoveEntryList( { PLIST_ENTRY OldFlink; PLIST_ENTRY OldBlink; - + OldFlink = Entry->Flink; OldBlink = Entry->Blink; OldFlink->Blink = OldBlink; @@ -185,7 +185,7 @@ RemoveHeadList( { PLIST_ENTRY Flink; PLIST_ENTRY Entry; - + Entry = ListHead->Flink; Flink = Entry->Flink; ListHead->Flink = Flink; @@ -200,7 +200,7 @@ RemoveTailList( { PLIST_ENTRY Blink; PLIST_ENTRY Entry; - + Entry = ListHead->Blink; Blink = Entry->Blink; ListHead->Blink = Blink; diff --git a/reactos/include/host/wcsfuncs.h b/reactos/include/host/wcsfuncs.h deleted file mode 100644 index c07679aa34a..00000000000 --- a/reactos/include/host/wcsfuncs.h +++ /dev/null @@ -1,29 +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 - -#ifdef USE_HOST_WCSFUNCS - /* Function prototypes */ - -#else - /* 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 - -#endif diff --git a/reactos/tools/unicode/wine/unicode.h b/reactos/include/host/wine/unicode.h similarity index 99% rename from reactos/tools/unicode/wine/unicode.h rename to reactos/include/host/wine/unicode.h index 3bd09a8995b..b09f0f48f51 100644 --- a/reactos/tools/unicode/wine/unicode.h +++ b/reactos/include/host/wine/unicode.h @@ -23,7 +23,7 @@ #include #include -#include +#include // Definitions copied from // We only want to include host headers, so we define them manually diff --git a/reactos/lib/CMakeLists.txt b/reactos/lib/CMakeLists.txt index 6cfd4567c4a..e0064c0b596 100644 --- a/reactos/lib/CMakeLists.txt +++ b/reactos/lib/CMakeLists.txt @@ -24,7 +24,6 @@ add_subdirectory(tdilib) else() -add_subdirectory(host/wcsfuncs) add_subdirectory(3rdparty/zlib) endif() diff --git a/reactos/lib/cmlib/cmdata.h b/reactos/lib/cmlib/cmdata.h index 61629c6398a..bce6e2aa80f 100644 --- a/reactos/lib/cmlib/cmdata.h +++ b/reactos/lib/cmlib/cmdata.h @@ -46,11 +46,7 @@ // #define VALUE_COMP_NAME 0x0001 -#ifdef CMLIB_HOST -#include -#else #include -#endif // // For memory-mapped Hives @@ -154,11 +150,7 @@ typedef struct _CM_KEY_SECURITY UCHAR Data[ANYSIZE_ARRAY]; } CM_KEY_SECURITY, *PCM_KEY_SECURITY; -#ifdef CMLIB_HOST -#include -#else #include -#endif // // Generic Index Entry diff --git a/reactos/lib/cmlib/cmlib.h b/reactos/lib/cmlib/cmlib.h index e472fd35c4f..ff5470c6d82 100644 --- a/reactos/lib/cmlib/cmlib.h +++ b/reactos/lib/cmlib/cmlib.h @@ -14,7 +14,7 @@ #ifdef CMLIB_HOST #include - #include + #include #include #include @@ -92,9 +92,9 @@ #undef DECLSPEC_IMPORT #define DECLSPEC_IMPORT #include + #include #endif -#include // // These define the Debug Masks Supported @@ -311,8 +311,8 @@ CmCreateRootNode( VOID CMAPI CmPrepareHive( PHHIVE RegistryHive); - - + + BOOLEAN CMAPI HvTrackCellRef( diff --git a/reactos/lib/cmlib/hivedata.h b/reactos/lib/cmlib/hivedata.h index 7bd8845048d..b15c92636cf 100644 --- a/reactos/lib/cmlib/hivedata.h +++ b/reactos/lib/cmlib/hivedata.h @@ -100,11 +100,7 @@ typedef enum Volatile = 1 } HSTORAGE_TYPE; -#ifdef CMLIB_HOST -#include -#else #include -#endif /** * @name HBASE_BLOCK @@ -188,11 +184,7 @@ typedef struct _HCELL LONG Size; } HCELL, *PHCELL; -#ifdef CMLIB_HOST -#include -#else #include -#endif struct _HHIVE; diff --git a/reactos/lib/host/directory.rbuild b/reactos/lib/host/directory.rbuild deleted file mode 100644 index d39ecfa981f..00000000000 --- a/reactos/lib/host/directory.rbuild +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/reactos/lib/host/wcsfuncs/CMakeLists.txt b/reactos/lib/host/wcsfuncs/CMakeLists.txt deleted file mode 100644 index 5f16bcbfbbd..00000000000 --- a/reactos/lib/host/wcsfuncs/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ - -add_library(host_wcsfuncs wcsfuncs.c) diff --git a/reactos/lib/host/wcsfuncs/wcsfuncs.c b/reactos/lib/host/wcsfuncs/wcsfuncs.c deleted file mode 100644 index 58dafe13cd3..00000000000 --- a/reactos/lib/host/wcsfuncs/wcsfuncs.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - PROJECT: ReactOS - LICENSE: GPL v2 or any later version - FILE: lib/host/wcsfuncs/wcsfuncs.c - PURPOSE: Reimplemented wide-character string functions for host tools (to be independent of the host wchar_t size) - COPYRIGHT: Copyright 2008 Colin Finck -*/ - -#include - -/* Function implementations */ -SIZE_T utf16_wcslen(PCWSTR str) -{ - SIZE_T i; - - for(i = 0; str[i]; i++); - - return i; -} - - -SIZE_T strlenW(PCWSTR str) -{ - SIZE_T i; - - for(i = 0; str[i]; i++); - - return i; -} - - -PWSTR utf16_wcschr(PWSTR str, WCHAR c) -{ - SIZE_T i; - - for(i = 0; str[i] && str[i] != c; i++); - - if(str[i]) - return &str[i]; - else - return NULL; -} - -PWSTR strchrW(PWSTR str, WCHAR c) -{ - SIZE_T i; - - for(i = 0; str[i] && str[i] != c; i++); - - if(str[i]) - return &str[i]; - else - return NULL; -} - -INT utf16_wcsncmp(PCWSTR string1, PCWSTR string2, size_t count) -{ - while(count--) - { - if(*string1 != *string2) - return 1; - - if(*string1 == 0) - return 0; - - string1++; - string2++; - } - - return 0; -} - -INT strncmpW(PCWSTR string1, PCWSTR string2, size_t count) -{ - while(count--) - { - if(*string1 != *string2) - return 1; - - if(*string1 == 0) - return 0; - - string1++; - string2++; - } - - return 0; -} diff --git a/reactos/lib/host/wcsfuncs/wcsfuncs.rbuild b/reactos/lib/host/wcsfuncs/wcsfuncs.rbuild deleted file mode 100644 index 15025ed2ad5..00000000000 --- a/reactos/lib/host/wcsfuncs/wcsfuncs.rbuild +++ /dev/null @@ -1,5 +0,0 @@ - - - - wcsfuncs.c - diff --git a/reactos/lib/inflib/builddep.h b/reactos/lib/inflib/builddep.h index 8c38864be9c..d123ab313b6 100644 --- a/reactos/lib/inflib/builddep.h +++ b/reactos/lib/inflib/builddep.h @@ -8,7 +8,7 @@ /* Definitions native to the host on which we're building */ -#include +#include #include #include diff --git a/reactos/lib/inflib/inflib.mak b/reactos/lib/inflib/inflib.mak index fa23df27d8f..8a4bf38d274 100644 --- a/reactos/lib/inflib/inflib.mak +++ b/reactos/lib/inflib/inflib.mak @@ -32,7 +32,7 @@ INFLIB_HOST_OBJECTS = \ INFLIB_HOST_CFLAGS = -O3 -Wall -Wpointer-arith -Wconversion \ -Wstrict-prototypes -Wmissing-prototypes -DINFLIB_HOST \ - -Iinclude/reactos -Iinclude $(HOST_CFLAGS) + -Iinclude/host -Iinclude $(HOST_CFLAGS) $(INFLIB_HOST_TARGET): $(INFLIB_HOST_OBJECTS) | $(INFLIB_OUT) $(ECHO_HOSTAR) diff --git a/reactos/lib/inflib/inflib.rbuild b/reactos/lib/inflib/inflib.rbuild index 1a8dad5eb6e..aade527fcb7 100644 --- a/reactos/lib/inflib/inflib.rbuild +++ b/reactos/lib/inflib/inflib.rbuild @@ -11,6 +11,7 @@ infrosput.c + include/host . diff --git a/reactos/lib/lib.rbuild b/reactos/lib/lib.rbuild index 90f4ba6050c..15d0b7fb0de 100644 --- a/reactos/lib/lib.rbuild +++ b/reactos/lib/lib.rbuild @@ -31,9 +31,6 @@ - - - diff --git a/reactos/lib/newinflib/CMakeLists.txt b/reactos/lib/newinflib/CMakeLists.txt index c33821f335a..d59279038f5 100644 --- a/reactos/lib/newinflib/CMakeLists.txt +++ b/reactos/lib/newinflib/CMakeLists.txt @@ -5,7 +5,7 @@ list(APPEND GLOBAL_FILES infput.c) if(CMAKE_CROSSCOMPILING) - list(APPEND SOURCE + list(APPEND SOURCE infrosgen.c infrosget.c infrosput.c) @@ -13,7 +13,7 @@ if(CMAKE_CROSSCOMPILING) add_library(inflib ${GLOBAL_FILES} ${SOURCE}) add_dependencies(inflib psdk) else() - list(APPEND SOURCE + list(APPEND SOURCE infhostgen.c infhostget.c infhostput.c diff --git a/reactos/lib/newinflib/builddep.h b/reactos/lib/newinflib/builddep.h index 51b4d4850d7..c24a1eb75dd 100644 --- a/reactos/lib/newinflib/builddep.h +++ b/reactos/lib/newinflib/builddep.h @@ -9,7 +9,7 @@ /* Definitions native to the host on which we're building */ #include -#include +#include #include #include @@ -63,6 +63,7 @@ BOOLEAN NTAPI RtlIsTextUnicode( PVOID buf, INT len, INT *pf ); #include #define NTOS_MODE_USER #include +#include extern PVOID InfpHeap; @@ -82,6 +83,4 @@ extern PVOID InfpHeap; #endif /* INFLIB_HOST */ -#include - /* EOF */ diff --git a/reactos/tools/kbdtool/kbdtool.h b/reactos/tools/kbdtool/kbdtool.h index 406a83337ce..7ccac685927 100644 --- a/reactos/tools/kbdtool/kbdtool.h +++ b/reactos/tools/kbdtool/kbdtool.h @@ -14,7 +14,7 @@ #include #include #include -#include +#include #define KEYWORD_COUNT 17 diff --git a/reactos/tools/mkhive/mkhive.h b/reactos/tools/mkhive/mkhive.h index bfb7b8f9414..eb45beee6c4 100644 --- a/reactos/tools/mkhive/mkhive.h +++ b/reactos/tools/mkhive/mkhive.h @@ -29,10 +29,7 @@ #include #include -#include - -#define USE_HOST_WCSFUNCS -#include +#include // Definitions copied from // We only want to include host headers, so we define them manually diff --git a/reactos/tools/nandflash/nandflash.h b/reactos/tools/nandflash/nandflash.h index 1b0dd46d246..59f68448a75 100644 --- a/reactos/tools/nandflash/nandflash.h +++ b/reactos/tools/nandflash/nandflash.h @@ -11,7 +11,7 @@ #include #include #include -#include +#include /* NAND Image Sizes */ #define NAND_PAGE_SIZE (2 * 1024) // 2 KB diff --git a/reactos/tools/rbuild_helper/argv_parser.h b/reactos/tools/rbuild_helper/argv_parser.h new file mode 100644 index 00000000000..97c506d12a9 --- /dev/null +++ b/reactos/tools/rbuild_helper/argv_parser.h @@ -0,0 +1,159 @@ +/* + Copyright (c) 2009 KJK::Hyperion + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#ifndef KJK_ARGV_PARSER_H_ +#define KJK_ARGV_PARSER_H_ + +#include +#include + +namespace kjk +{ + namespace details + { + template + bool is_separator(typename Traits::int_type c) + { + return Traits::eq_int_type(c, ' ') || Traits::eq_int_type(c, '\t'); + } + } + + template + InIter copy_argument(InIter cur, InIter end, OutIter arg) + { + typename Traits::int_type c; + bool quoting = false; + + while(cur != end) + { + c = Traits::to_int_type(*cur); + + if(!details::is_separator(c)) + break; + + ++ cur; + } + + while(cur != end) + { + typedef typename std::iterator_traits::difference_type difference_type; + difference_type backslashes(0); + + do + { + c = Traits::to_int_type(*cur); + ++ cur; + + if(Traits::eq_int_type(c, '\\')) + ++ backslashes; + else + break; + } + while(cur != end); + + if(Traits::eq_int_type(c, '"')) + { + // c == '"' + + if((backslashes % 2) == 0) + { + // 2N backslashes + "" in quote = N backslashes, literal " + if(quoting && cur != end && Traits::eq_int_type(Traits::to_int_type(*cur), '"')) + { + c = '"'; + ++ cur; + } + // 2N backslashes + " = N backslashes, toggle quoting + else + { + quoting = !quoting; + c = Traits::eof(); + } + + } + // 2N+1 backslashes + " = N backslashes, literal " + + backslashes /= 2; + } + + // Flush backslashes + for(difference_type i = 0; i < backslashes; ++ i) + *arg ++ = Traits::to_char_type('\\'); + + // Handle current character, unless it was a special quote + if(c != Traits::eof()) + { + if(details::is_separator(c) && !quoting) + break; + else + *arg ++ = Traits::to_char_type(c); + } + } + + while(cur != end) + { + c = Traits::to_int_type(*cur); + + if(!details::is_separator(c)) + break; + + ++ cur; + } + + return cur; + } + + template + InIter copy_argument(InIter cur, InIter end, OutIter arg) + { + return copy_argument + < + typename std::iterator_traits::value_type, + typename std::char_traits::value_type>, + InIter, + OutIter + > + (cur, end, arg); + } + + template + InIter skip_argument(InIter cur, InIter end) + { + return copy_argument(cur, end, null_output_iterator()); + } + + template + InIter skip_argument(InIter cur, InIter end) + { + return copy_argument + < + typename std::iterator_traits::value_type, + typename std::char_traits::value_type>, + InIter + > + (cur, end, null_output_iterator::value_type>()); + } +} + +#endif + +// EOF diff --git a/reactos/tools/rbuild_helper/null_output_iterator.h b/reactos/tools/rbuild_helper/null_output_iterator.h new file mode 100644 index 00000000000..43b960f6ed5 --- /dev/null +++ b/reactos/tools/rbuild_helper/null_output_iterator.h @@ -0,0 +1,51 @@ +/* + Copyright (c) 2009 KJK::Hyperion + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#ifndef KJK_NULL_OUTPUT_ITERATOR_H_ +#define KJK_NULL_OUTPUT_ITERATOR_H_ + +#include +#include + +namespace kjk +{ + template + struct null_output_reference + { + const Type& operator=(const Type& x) { return x; } + }; + + template + struct null_output_iterator: public std::iterator > + { + null_output_iterator() {} + null_output_iterator(const null_output_iterator&) {} + const null_output_iterator& operator=(const null_output_iterator&) { return *this; } + const null_output_iterator& operator++() { return *this; } + null_output_iterator operator++(int) { return null_output_iterator(); } + null_output_reference operator*() { return null_output_reference(); } + }; +} + +#endif + +// EOF diff --git a/reactos/tools/rbuild_helper/rbuild_helper.cpp b/reactos/tools/rbuild_helper/rbuild_helper.cpp index acf71f51986..2d374b6dfac 100644 --- a/reactos/tools/rbuild_helper/rbuild_helper.cpp +++ b/reactos/tools/rbuild_helper/rbuild_helper.cpp @@ -47,8 +47,8 @@ extern "C" DECLSPEC_IMPORT void NTAPI RtlMoveMemory(void UNALIGNED *, const void #define ARRAYSIZE(X_) (sizeof(X_) / sizeof((X_)[0])) #endif -#include -#include +#include +#include using namespace kjk; diff --git a/reactos/tools/rbuild_helper/rbuild_helper.rbuild b/reactos/tools/rbuild_helper/rbuild_helper.rbuild index 4af6145e89a..fa9af2680e4 100644 --- a/reactos/tools/rbuild_helper/rbuild_helper.rbuild +++ b/reactos/tools/rbuild_helper/rbuild_helper.rbuild @@ -1,5 +1,6 @@ + . rbuild_helper.cpp diff --git a/reactos/tools/rbuild_helper/stringz_iterator.h b/reactos/tools/rbuild_helper/stringz_iterator.h new file mode 100644 index 00000000000..d84fae12087 --- /dev/null +++ b/reactos/tools/rbuild_helper/stringz_iterator.h @@ -0,0 +1,130 @@ +/* + Copyright (c) 2009 KJK::Hyperion + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#ifndef KJK_STRINGZ_ITERATOR_H_ +#define KJK_STRINGZ_ITERATOR_H_ + +#include +#include + +namespace kjk +{ + template > class stringz_iterator; + + template stringz_iterator stringz_begin(const CharT *); + template stringz_iterator stringz_begin(const CharT *); + + template stringz_iterator stringz_end(const CharT *); + template stringz_iterator stringz_end(const CharT *); + + template + class stringz_iterator: public std::iterator + { + private: + template friend stringz_iterator stringz_begin(const CharT2 *); + template friend stringz_iterator stringz_begin(const CharT2 *); + + template friend stringz_iterator stringz_end(const CharT2 *); + template friend stringz_iterator stringz_end(const CharT2 *); + + // FIXME: this sucks because GCC sucks + typedef const Type * pointer_; + typedef const Type& reference_; + + pointer_ m_p; + + static pointer_ set_pointer(pointer_ p) + { + if(p != 0 && Traits::eq_int_type(Traits::to_int_type(*p), 0)) + return 0; + else + return p; + } + + explicit stringz_iterator(pointer_ p): m_p(set_pointer(p)) { } + + public: + stringz_iterator(): m_p() {} + stringz_iterator(const stringz_iterator& That): m_p(set_pointer(That.m_p)) { } + + const stringz_iterator& operator=(const stringz_iterator& That) + { + m_p = set_pointer(That.m_p); + return *this; + } + + bool operator==(const stringz_iterator& That) const + { + return m_p == That.m_p; + } + + bool operator!=(const stringz_iterator& That) const + { + return m_p != That.m_p; + } + + reference_ operator*() const { return *m_p; } + + const stringz_iterator& operator++() + { + m_p = set_pointer(m_p + 1); + return *this; + } + + stringz_iterator operator++(int) + { + stringz_iterator oldValue(*this); + ++ (*this); + return oldValue; + } + + pointer_ base() const { return m_p; } + }; + + template + stringz_iterator stringz_begin(const CharT * p) + { + return stringz_iterator(p); + } + + template + stringz_iterator stringz_begin(const CharT * p) + { + return stringz_iterator(p); + } + + template + stringz_iterator stringz_end(const CharT *) + { + return stringz_iterator(0); + } + + template + stringz_iterator stringz_end(const CharT *) + { + return stringz_iterator(0); + } +} + +#endif + +// EOF diff --git a/reactos/tools/widl/hash.c b/reactos/tools/widl/hash.c index 551039c2cfa..508d17131e2 100644 --- a/reactos/tools/widl/hash.c +++ b/reactos/tools/widl/hash.c @@ -21,7 +21,7 @@ #include #include -#include +#include #include "widltypes.h" #include "hash.h" diff --git a/reactos/tools/widl/typelib.c b/reactos/tools/widl/typelib.c index ce099c8d0f2..c9f9355ecb0 100644 --- a/reactos/tools/widl/typelib.c +++ b/reactos/tools/widl/typelib.c @@ -35,7 +35,7 @@ #define NONAMELESSUNION #define NONAMELESSSTRUCT -#include +#include #include "widl.h" #include "utils.h" diff --git a/reactos/tools/widl/typelib_struct.h b/reactos/tools/widl/typelib_struct.h index 01c2c642a81..95d174e6e1f 100644 --- a/reactos/tools/widl/typelib_struct.h +++ b/reactos/tools/widl/typelib_struct.h @@ -302,7 +302,7 @@ typedef struct { * */ -#include +#include typedef struct { /*00*/ DWORD SLTG_magic; /* 0x47544c53 == "SLTG" */ @@ -599,7 +599,7 @@ WORD offset from start of block to SAFEARRAY WORD typeofarray */ -#include +#include /*---------------------------END--------------------------------------------*/ #endif diff --git a/reactos/tools/widl/write_msft.c b/reactos/tools/widl/write_msft.c index aa111b0f867..6e7098a0415 100644 --- a/reactos/tools/widl/write_msft.c +++ b/reactos/tools/widl/write_msft.c @@ -40,8 +40,8 @@ #define NONAMELESSUNION #define NONAMELESSSTRUCT -#include -#include +#include +#include #include "widl.h" #include "typelib.h" @@ -909,7 +909,7 @@ static int encode_type( if (typeoffset == typelib->typelib_segdir[MSFT_SEG_TYPEDESC].length) { int mix_field; - + if (target_type & 0x80000000) { mix_field = ((target_type >> 16) & 0x3fff) | VT_BYREF; } else { @@ -947,7 +947,7 @@ static int encode_type( if (typeoffset == typelib->typelib_segdir[MSFT_SEG_TYPEDESC].length) { int mix_field; - + if (target_type & 0x80000000) { mix_field = ((target_type >> 16) & VT_TYPEMASK) | VT_ARRAY; } else { @@ -1129,7 +1129,7 @@ static int encode_var( if (typeoffset == typelib->typelib_segdir[MSFT_SEG_TYPEDESC].length) { int mix_field; - + if (target_type & 0x80000000) { mix_field = ((target_type >> 16) & 0x3fff) | VT_BYREF; } else { @@ -1548,7 +1548,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index) } /* update the index data */ - typeinfo->func_indices[typeinfo->typeinfo->cElement & 0xffff] = id; + typeinfo->func_indices[typeinfo->typeinfo->cElement & 0xffff] = id; typeinfo->func_offsets[typeinfo->typeinfo->cElement & 0xffff] = offset; typeinfo->func_names[typeinfo->typeinfo->cElement & 0xffff] = name_offset; @@ -1605,7 +1605,7 @@ static HRESULT add_var_desc(msft_typeinfo_t *typeinfo, UINT index, var_t* var) INT *typedata; int var_datawidth; int var_alignment; - int var_type_size, var_kind = 0 /* VAR_PERINSTANCE */; + int var_type_size, var_kind = 0 /* VAR_PERINSTANCE */; int alignment; int varflags = 0; const attr_t *attr; @@ -2551,8 +2551,8 @@ int create_msft_typelib(typelib_t *typelib) time_t cur_time; char *time_override; unsigned int version = 5 << 24 | 1 << 16 | 164; /* 5.01.0164 */ - GUID midl_time_guid = {0xde77ba63,0x517c,0x11d1,{0xa2,0xda,0x00,0x00,0xf8,0x77,0x3c,0xe9}}; - GUID midl_version_guid = {0xde77ba64,0x517c,0x11d1,{0xa2,0xda,0x00,0x00,0xf8,0x77,0x3c,0xe9}}; + GUID midl_time_guid = {0xde77ba63,0x517c,0x11d1,{0xa2,0xda,0x00,0x00,0xf8,0x77,0x3c,0xe9}}; + GUID midl_version_guid = {0xde77ba64,0x517c,0x11d1,{0xa2,0xda,0x00,0x00,0xf8,0x77,0x3c,0xe9}}; pointer_size = (typelib_kind == SYS_WIN64) ? 8 : 4; @@ -2594,7 +2594,7 @@ int create_msft_typelib(typelib_t *typelib) set_help_context(msft); set_help_string_dll(msft); set_help_string_context(msft); - + /* midl adds two sets of custom data to the library: the current unix time and midl's version number */ time_override = getenv( "WIDL_TIME_OVERRIDE"); diff --git a/reactos/tools/wmc/wmctypes.h b/reactos/tools/wmc/wmctypes.h index 884200375b0..097a15ca4aa 100644 --- a/reactos/tools/wmc/wmctypes.h +++ b/reactos/tools/wmc/wmctypes.h @@ -23,7 +23,7 @@ #include #include -#include +#include /* Byteordering defines */ #define WMC_BO_NATIVE 0x00 diff --git a/reactos/tools/wrc/newstruc.c b/reactos/tools/wrc/newstruc.c index 310771442da..da8fead55a1 100644 --- a/reactos/tools/wrc/newstruc.c +++ b/reactos/tools/wrc/newstruc.c @@ -32,7 +32,7 @@ #include "utils.h" #include "parser.h" -#include +#include typedef struct { DWORD biSize; @@ -41,7 +41,7 @@ typedef struct WORD biPlanes; WORD biBitCount; } BITMAPOS2HEADER; -#include +#include /* Generate new_* functions that have no parameters (NOTE: no ';') */ __NEW_STRUCT_FUNC(dialog) diff --git a/reactos/tools/wrc/wrcrostypes.h b/reactos/tools/wrc/wrcrostypes.h index 8cfbfdf5b71..87802ff18af 100644 --- a/reactos/tools/wrc/wrcrostypes.h +++ b/reactos/tools/wrc/wrcrostypes.h @@ -9,8 +9,8 @@ #ifndef _WRC_ROSTYPES_H #define _WRC_ROSTYPES_H -#include -#include +#include +#include #include // Definitions copied from various files @@ -55,7 +55,7 @@ #define WS_TABSTOP 0x10000 #define WS_VISIBLE 0x10000000 -#include +#include typedef struct tagBITMAPFILEHEADER { WORD bfType; DWORD bfSize; @@ -63,7 +63,7 @@ typedef struct tagBITMAPFILEHEADER { WORD bfReserved2; DWORD bfOffBits; } BITMAPFILEHEADER,*LPBITMAPFILEHEADER,*PBITMAPFILEHEADER; -#include +#include typedef int FXPT2DOT30; typedef struct tagCIEXYZ {