mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 03:54:02 +00:00
[HOST]
Only use /include/host as include directory for host tools / libs. svn path=/trunk/; revision=52240
This commit is contained in:
parent
ca370b4954
commit
301a62db3a
36 changed files with 388 additions and 210 deletions
|
@ -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)
|
||||
|
|
|
@ -81,10 +81,7 @@
|
|||
<include root="intermediate">include/reactos/mc</include>
|
||||
<include>include/reactos/libs</include>
|
||||
|
||||
<include host="true">include</include>
|
||||
<include host="true" root="intermediate">include</include>
|
||||
<include host="true">include/reactos</include>
|
||||
<include host="true">include/reactos/wine</include>
|
||||
<include host="true">include/host</include>
|
||||
|
||||
<group compilerset="gcc">
|
||||
<compilerflag>-Wall</compilerflag>
|
||||
|
|
|
@ -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 "<undefined version>"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#ifndef _HOST_NLS_H
|
||||
#define _HOST_NLS_H
|
||||
|
||||
#include <host/typedefs.h>
|
||||
#include <typedefs.h>
|
||||
|
||||
typedef DWORD LCID;
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ typedef WORD LANGID;
|
|||
#define MAXUSHORT USHRT_MAX
|
||||
|
||||
/* Widely used structures */
|
||||
#include <host/pshpack4.h>
|
||||
#include <pshpack4.h>
|
||||
typedef struct _RTL_BITMAP
|
||||
{
|
||||
ULONG SizeOfBitMap;
|
||||
|
@ -112,7 +112,7 @@ typedef struct _UNICODE_STRING
|
|||
USHORT MaximumLength;
|
||||
PWSTR Buffer;
|
||||
} UNICODE_STRING, *PUNICODE_STRING;
|
||||
#include <host/poppack.h>
|
||||
#include <poppack.h>
|
||||
|
||||
/* 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;
|
||||
|
|
|
@ -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 <mail@colinfinck.de>
|
||||
*/
|
||||
|
||||
#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
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <host/typedefs.h>
|
||||
#include <typedefs.h>
|
||||
|
||||
// Definitions copied from <winnls.h>
|
||||
// We only want to include host headers, so we define them manually
|
|
@ -24,7 +24,6 @@ add_subdirectory(tdilib)
|
|||
|
||||
else()
|
||||
|
||||
add_subdirectory(host/wcsfuncs)
|
||||
add_subdirectory(3rdparty/zlib)
|
||||
|
||||
endif()
|
||||
|
|
|
@ -46,11 +46,7 @@
|
|||
//
|
||||
#define VALUE_COMP_NAME 0x0001
|
||||
|
||||
#ifdef CMLIB_HOST
|
||||
#include <host/pshpack1.h>
|
||||
#else
|
||||
#include <pshpack1.h>
|
||||
#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 <host/poppack.h>
|
||||
#else
|
||||
#include <poppack.h>
|
||||
#endif
|
||||
|
||||
//
|
||||
// Generic Index Entry
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#ifdef CMLIB_HOST
|
||||
#include <wine/unicode.h>
|
||||
#include <host/typedefs.h>
|
||||
#include <typedefs.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -92,9 +92,9 @@
|
|||
#undef DECLSPEC_IMPORT
|
||||
#define DECLSPEC_IMPORT
|
||||
#include <ntddk.h>
|
||||
#include <wcsfuncs.h>
|
||||
#endif
|
||||
|
||||
#include <host/wcsfuncs.h>
|
||||
|
||||
//
|
||||
// These define the Debug Masks Supported
|
||||
|
@ -311,8 +311,8 @@ CmCreateRootNode(
|
|||
VOID CMAPI
|
||||
CmPrepareHive(
|
||||
PHHIVE RegistryHive);
|
||||
|
||||
|
||||
|
||||
|
||||
BOOLEAN
|
||||
CMAPI
|
||||
HvTrackCellRef(
|
||||
|
|
|
@ -100,11 +100,7 @@ typedef enum
|
|||
Volatile = 1
|
||||
} HSTORAGE_TYPE;
|
||||
|
||||
#ifdef CMLIB_HOST
|
||||
#include <host/pshpack1.h>
|
||||
#else
|
||||
#include <pshpack1.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name HBASE_BLOCK
|
||||
|
@ -188,11 +184,7 @@ typedef struct _HCELL
|
|||
LONG Size;
|
||||
} HCELL, *PHCELL;
|
||||
|
||||
#ifdef CMLIB_HOST
|
||||
#include <host/poppack.h>
|
||||
#else
|
||||
#include <poppack.h>
|
||||
#endif
|
||||
|
||||
struct _HHIVE;
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE group SYSTEM "../../tools/rbuild/project.dtd">
|
||||
<group xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<directory name="wcsfuncs">
|
||||
<xi:include href="wcsfuncs/wcsfuncs.rbuild" />
|
||||
</directory>
|
||||
</group>
|
|
@ -1,2 +0,0 @@
|
|||
|
||||
add_library(host_wcsfuncs wcsfuncs.c)
|
|
@ -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 <mail@colinfinck.de>
|
||||
*/
|
||||
|
||||
#include <host/typedefs.h>
|
||||
|
||||
/* 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;
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
||||
<module name="host_wcsfuncs" type="hoststaticlibrary">
|
||||
<file>wcsfuncs.c</file>
|
||||
</module>
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
/* Definitions native to the host on which we're building */
|
||||
|
||||
#include <host/typedefs.h>
|
||||
#include <typedefs.h>
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<file>infrosput.c</file>
|
||||
</module>
|
||||
<module name="inflibhost" type="hoststaticlibrary" allowwarnings="true">
|
||||
<include base="ReactOS">include/host</include>
|
||||
<include base="inflibhost">.</include>
|
||||
<define name="__NO_CTYPE_INLINES" />
|
||||
<group compilerset="gcc">
|
||||
|
|
|
@ -31,9 +31,6 @@
|
|||
<directory name="fslib">
|
||||
<xi:include href="fslib/directory.rbuild" />
|
||||
</directory>
|
||||
<directory name="host">
|
||||
<xi:include href="host/directory.rbuild" />
|
||||
</directory>
|
||||
<directory name="inflib">
|
||||
<xi:include href="inflib/inflib.rbuild" />
|
||||
</directory>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
/* Definitions native to the host on which we're building */
|
||||
|
||||
#include <wine/unicode.h>
|
||||
#include <host/typedefs.h>
|
||||
#include <typedefs.h>
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
@ -63,6 +63,7 @@ BOOLEAN NTAPI RtlIsTextUnicode( PVOID buf, INT len, INT *pf );
|
|||
#include <windows.h>
|
||||
#define NTOS_MODE_USER
|
||||
#include <ndk/ntndk.h>
|
||||
#include <wcsfuncs.h>
|
||||
|
||||
extern PVOID InfpHeap;
|
||||
|
||||
|
@ -82,6 +83,4 @@ extern PVOID InfpHeap;
|
|||
|
||||
#endif /* INFLIB_HOST */
|
||||
|
||||
#include <host/wcsfuncs.h>
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include <time.h>
|
||||
#include <host/typedefs.h>
|
||||
#include <typedefs.h>
|
||||
|
||||
#define KEYWORD_COUNT 17
|
||||
|
||||
|
|
|
@ -29,10 +29,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <host/typedefs.h>
|
||||
|
||||
#define USE_HOST_WCSFUNCS
|
||||
#include <host/wcsfuncs.h>
|
||||
#include <typedefs.h>
|
||||
|
||||
// Definitions copied from <ntstatus.h>
|
||||
// We only want to include host headers, so we define them manually
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <host/typedefs.h>
|
||||
#include <typedefs.h>
|
||||
|
||||
/* NAND Image Sizes */
|
||||
#define NAND_PAGE_SIZE (2 * 1024) // 2 KB
|
||||
|
|
159
reactos/tools/rbuild_helper/argv_parser.h
Normal file
159
reactos/tools/rbuild_helper/argv_parser.h
Normal file
|
@ -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 <iterator>
|
||||
#include <null_output_iterator.h>
|
||||
|
||||
namespace kjk
|
||||
{
|
||||
namespace details
|
||||
{
|
||||
template<class Traits>
|
||||
bool is_separator(typename Traits::int_type c)
|
||||
{
|
||||
return Traits::eq_int_type(c, ' ') || Traits::eq_int_type(c, '\t');
|
||||
}
|
||||
}
|
||||
|
||||
template<class Elem, class Traits, class InIter, class OutIter>
|
||||
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<Traits>(c))
|
||||
break;
|
||||
|
||||
++ cur;
|
||||
}
|
||||
|
||||
while(cur != end)
|
||||
{
|
||||
typedef typename std::iterator_traits<InIter>::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<Traits>(c) && !quoting)
|
||||
break;
|
||||
else
|
||||
*arg ++ = Traits::to_char_type(c);
|
||||
}
|
||||
}
|
||||
|
||||
while(cur != end)
|
||||
{
|
||||
c = Traits::to_int_type(*cur);
|
||||
|
||||
if(!details::is_separator<Traits>(c))
|
||||
break;
|
||||
|
||||
++ cur;
|
||||
}
|
||||
|
||||
return cur;
|
||||
}
|
||||
|
||||
template<class InIter, class OutIter>
|
||||
InIter copy_argument(InIter cur, InIter end, OutIter arg)
|
||||
{
|
||||
return copy_argument
|
||||
<
|
||||
typename std::iterator_traits<InIter>::value_type,
|
||||
typename std::char_traits<typename std::iterator_traits<InIter>::value_type>,
|
||||
InIter,
|
||||
OutIter
|
||||
>
|
||||
(cur, end, arg);
|
||||
}
|
||||
|
||||
template<class Elem, class Traits, class InIter>
|
||||
InIter skip_argument(InIter cur, InIter end)
|
||||
{
|
||||
return copy_argument(cur, end, null_output_iterator<Elem>());
|
||||
}
|
||||
|
||||
template<class InIter>
|
||||
InIter skip_argument(InIter cur, InIter end)
|
||||
{
|
||||
return copy_argument
|
||||
<
|
||||
typename std::iterator_traits<InIter>::value_type,
|
||||
typename std::char_traits<typename std::iterator_traits<InIter>::value_type>,
|
||||
InIter
|
||||
>
|
||||
(cur, end, null_output_iterator<typename std::iterator_traits<InIter>::value_type>());
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// EOF
|
51
reactos/tools/rbuild_helper/null_output_iterator.h
Normal file
51
reactos/tools/rbuild_helper/null_output_iterator.h
Normal file
|
@ -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 <cstddef>
|
||||
#include <iterator>
|
||||
|
||||
namespace kjk
|
||||
{
|
||||
template<class Type>
|
||||
struct null_output_reference
|
||||
{
|
||||
const Type& operator=(const Type& x) { return x; }
|
||||
};
|
||||
|
||||
template<class Type, class Distance = std::ptrdiff_t, class Pointer = Type *>
|
||||
struct null_output_iterator: public std::iterator<std::output_iterator_tag, Type, Distance, Pointer, null_output_reference<Type> >
|
||||
{
|
||||
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<Type> operator*() { return null_output_reference<Type>(); }
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// EOF
|
|
@ -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 <kjk/argv_parser.h>
|
||||
#include <kjk/stringz_iterator.h>
|
||||
#include <argv_parser.h>
|
||||
#include <stringz_iterator.h>
|
||||
|
||||
using namespace kjk;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
<module name="rbuild_helper" type="buildtool">
|
||||
<include base="rbuild_helper">.</include>
|
||||
<define name="UNICODE" />
|
||||
<define name="_UNICODE" />
|
||||
<file>rbuild_helper.cpp</file>
|
||||
|
|
130
reactos/tools/rbuild_helper/stringz_iterator.h
Normal file
130
reactos/tools/rbuild_helper/stringz_iterator.h
Normal file
|
@ -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 <cstddef>
|
||||
#include <iterator>
|
||||
|
||||
namespace kjk
|
||||
{
|
||||
template<class Type, class Traits = std::char_traits<Type> > class stringz_iterator;
|
||||
|
||||
template<class CharT> stringz_iterator<CharT> stringz_begin(const CharT *);
|
||||
template<class Traits, class CharT> stringz_iterator<CharT, Traits> stringz_begin(const CharT *);
|
||||
|
||||
template<class CharT> stringz_iterator<CharT> stringz_end(const CharT *);
|
||||
template<class Traits, class CharT> stringz_iterator<CharT, Traits> stringz_end(const CharT *);
|
||||
|
||||
template<class Type, class Traits>
|
||||
class stringz_iterator: public std::iterator<std::forward_iterator_tag, Type, std::ptrdiff_t, const Type *, const Type&>
|
||||
{
|
||||
private:
|
||||
template<class CharT2> friend stringz_iterator<CharT2> stringz_begin(const CharT2 *);
|
||||
template<class Traits2, class CharT2> friend stringz_iterator<CharT2, Traits2> stringz_begin(const CharT2 *);
|
||||
|
||||
template<class CharT2> friend stringz_iterator<CharT2> stringz_end(const CharT2 *);
|
||||
template<class Traits2, class CharT2> friend stringz_iterator<CharT2, Traits2> 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<class CharT>
|
||||
stringz_iterator<CharT> stringz_begin(const CharT * p)
|
||||
{
|
||||
return stringz_iterator<CharT>(p);
|
||||
}
|
||||
|
||||
template<class Traits, class CharT>
|
||||
stringz_iterator<CharT> stringz_begin(const CharT * p)
|
||||
{
|
||||
return stringz_iterator<CharT, Traits>(p);
|
||||
}
|
||||
|
||||
template<class CharT>
|
||||
stringz_iterator<CharT> stringz_end(const CharT *)
|
||||
{
|
||||
return stringz_iterator<CharT>(0);
|
||||
}
|
||||
|
||||
template<class Traits, class CharT>
|
||||
stringz_iterator<CharT> stringz_end(const CharT *)
|
||||
{
|
||||
return stringz_iterator<CharT, Traits>(0);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// EOF
|
|
@ -21,7 +21,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <host/nls.h>
|
||||
#include <nls.h>
|
||||
|
||||
#include "widltypes.h"
|
||||
#include "hash.h"
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#define NONAMELESSUNION
|
||||
#define NONAMELESSSTRUCT
|
||||
|
||||
#include <host/typedefs.h>
|
||||
#include <typedefs.h>
|
||||
|
||||
#include "widl.h"
|
||||
#include "utils.h"
|
||||
|
|
|
@ -302,7 +302,7 @@ typedef struct {
|
|||
*
|
||||
*/
|
||||
|
||||
#include <host/pshpack1.h>
|
||||
#include <pshpack1.h>
|
||||
|
||||
typedef struct {
|
||||
/*00*/ DWORD SLTG_magic; /* 0x47544c53 == "SLTG" */
|
||||
|
@ -599,7 +599,7 @@ WORD offset from start of block to SAFEARRAY
|
|||
WORD typeofarray
|
||||
*/
|
||||
|
||||
#include <host/poppack.h>
|
||||
#include <poppack.h>
|
||||
|
||||
/*---------------------------END--------------------------------------------*/
|
||||
#endif
|
||||
|
|
|
@ -40,8 +40,8 @@
|
|||
#define NONAMELESSUNION
|
||||
#define NONAMELESSSTRUCT
|
||||
|
||||
#include <host/typedefs.h>
|
||||
#include <host/nls.h>
|
||||
#include <typedefs.h>
|
||||
#include <nls.h>
|
||||
|
||||
#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");
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <host/typedefs.h>
|
||||
#include <typedefs.h>
|
||||
|
||||
/* Byteordering defines */
|
||||
#define WMC_BO_NATIVE 0x00
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "utils.h"
|
||||
#include "parser.h"
|
||||
|
||||
#include <host/pshpack2.h>
|
||||
#include <pshpack2.h>
|
||||
typedef struct
|
||||
{
|
||||
DWORD biSize;
|
||||
|
@ -41,7 +41,7 @@ typedef struct
|
|||
WORD biPlanes;
|
||||
WORD biBitCount;
|
||||
} BITMAPOS2HEADER;
|
||||
#include <host/poppack.h>
|
||||
#include <poppack.h>
|
||||
|
||||
/* Generate new_* functions that have no parameters (NOTE: no ';') */
|
||||
__NEW_STRUCT_FUNC(dialog)
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
#ifndef _WRC_ROSTYPES_H
|
||||
#define _WRC_ROSTYPES_H
|
||||
|
||||
#include <host/typedefs.h>
|
||||
#include <host/nls.h>
|
||||
#include <typedefs.h>
|
||||
#include <nls.h>
|
||||
#include <string.h>
|
||||
|
||||
// Definitions copied from various <win....h> files
|
||||
|
@ -55,7 +55,7 @@
|
|||
#define WS_TABSTOP 0x10000
|
||||
#define WS_VISIBLE 0x10000000
|
||||
|
||||
#include <host/pshpack2.h>
|
||||
#include <pshpack2.h>
|
||||
typedef struct tagBITMAPFILEHEADER {
|
||||
WORD bfType;
|
||||
DWORD bfSize;
|
||||
|
@ -63,7 +63,7 @@ typedef struct tagBITMAPFILEHEADER {
|
|||
WORD bfReserved2;
|
||||
DWORD bfOffBits;
|
||||
} BITMAPFILEHEADER,*LPBITMAPFILEHEADER,*PBITMAPFILEHEADER;
|
||||
#include <host/poppack.h>
|
||||
#include <poppack.h>
|
||||
|
||||
typedef int FXPT2DOT30;
|
||||
typedef struct tagCIEXYZ {
|
||||
|
|
Loading…
Reference in a new issue