Author: tkreuzer
Date: Mon Dec 27 21:48:25 2010
New Revision: 50174
URL:
http://svn.reactos.org/svn/reactos?rev=50174&view=rev
Log:
[CMAKE]
unix build fixes for host tools
Modified:
branches/cmake-bringup/tools/geninc/geninc.c
branches/cmake-bringup/tools/spec2def/spec2def.c
branches/cmake-bringup/tools/xml.cpp
Modified: branches/cmake-bringup/tools/geninc/geninc.c
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/tools/geninc/geni…
==============================================================================
--- branches/cmake-bringup/tools/geninc/geninc.c [iso-8859-1] (original)
+++ branches/cmake-bringup/tools/geninc/geninc.c [iso-8859-1] Mon Dec 27 21:48:25 2010
@@ -6,15 +6,20 @@
#ifdef _WIN32
#define PRIx64 "I64x"
+typedef unsigned __int16 uint16_t;
+typedef unsigned __int32 uint32_t;
+typedef unsigned __int64 uint64_t;
#else
+#include <stdint.h>
#define PRIx64 "llx"
+#define _stricmp strcasecmp
#endif
typedef struct
{
char Type;
char Name[55];
- unsigned __int64 Value;
+ uint64_t Value;
} ASMGENDATA;
#define TYPE_END 0
@@ -29,24 +34,24 @@
int i, result = -1;
int ms_format = 0;
char header[20];
- unsigned __int32 e_lfanew, signature;
- unsigned __int16 Machine, NumberOfSections, SizeOfOptionalHeader;
+ uint32_t e_lfanew, signature;
+ uint16_t Machine, NumberOfSections, SizeOfOptionalHeader;
typedef struct
{
char Name[8];
- unsigned __int32 VirtualSize;
- unsigned __int32 VirtualAddress;
- unsigned __int32 RawSize;
- unsigned __int32 RawAddress;
- unsigned __int32 RelocAddress;
- unsigned __int32 LineNumbers;
- unsigned __int16 RelocationsNumber;
- unsigned __int16 LineNumbersNumber;
- unsigned __int32 Characteristics;
+ uint32_t VirtualSize;
+ uint32_t VirtualAddress;
+ uint32_t RawSize;
+ uint32_t RawAddress;
+ uint32_t RelocAddress;
+ uint32_t LineNumbers;
+ uint16_t RelocationsNumber;
+ uint16_t LineNumbersNumber;
+ uint32_t Characteristics;
} SECTION;
SECTION section;
- if (argc >= 4 && stricmp(argv[3], "-ms") == 0) ms_format = 1;
+ if (argc >= 4 && _stricmp(argv[3], "-ms") == 0) ms_format = 1;
/* Open the input file */
input = fopen(argv[1], "rb");
@@ -143,7 +148,7 @@
break;
}
}
-
+
if (i == NumberOfSections)
{
fprintf(stderr, "Could not find section.\n");
@@ -171,7 +176,7 @@
fprintf(output, "%s\n", data.Name);
continue;
- case TYPE_CONSTANT:
+ case TYPE_CONSTANT:
if (ms_format)
{
fprintf(output, "%s equ 0%"PRIx64"h\n",
data.Name, data.Value);
@@ -182,7 +187,7 @@
}
continue;
- case TYPE_HEADER:
+ case TYPE_HEADER:
if (ms_format)
{
fprintf(output, "\n; %s\n", data.Name);
Modified: branches/cmake-bringup/tools/spec2def/spec2def.c
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/tools/spec2def/sp…
==============================================================================
--- branches/cmake-bringup/tools/spec2def/spec2def.c [iso-8859-1] (original)
+++ branches/cmake-bringup/tools/spec2def/spec2def.c [iso-8859-1] Mon Dec 27 21:48:25
2010
@@ -2,6 +2,10 @@
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
+
+#ifndef _WIN32
+#define _stricmp strcasecmp
+#endif
typedef struct
{
@@ -145,14 +149,14 @@
(pexp->uFlags & FL_STUB) == 0) return 0;
fprintf(file, "int ");
- if (strcmp(pszArchString, "i386") == 0 &&
+ if (strcmp(pszArchString, "i386") == 0 &&
pexp->nCallingConvention == CC_STDCALL)
{
fprintf(file, "__stdcall ");
}
fprintf(file, "%.*s(", pexp->nNameLength, pexp->pcName);
-
+
for (i = 0; i < pexp->nArgCount; i++)
{
if (i != 0) fprintf(file, ", ");
@@ -198,7 +202,7 @@
}
}
fprintf(file, ");\n");
-
+
if (pexp->nCallingConvention == CC_STUB)
{
fprintf(file, "\t__wine_spec_unimplemented_stub(\"%s\",
__FUNCTION__);\n", pszDllName);
@@ -257,7 +261,7 @@
void
OutputHeader_def(FILE *file, char *libname)
{
- fprintf(file,
+ fprintf(file,
"; File generated automatically, do not edit!\n\n"
"LIBRARY %s\n\n"
"EXPORTS\n",
@@ -283,7 +287,7 @@
fprintf(fileDest, "%.*s", pexp->nNameLength, pexp->pcName);
- if ((pexp->nCallingConvention == CC_STDCALL ||
+ if ((pexp->nCallingConvention == CC_STDCALL ||
pexp->nCallingConvention == CC_FASTCALL) && !no_decoration)
{
fprintf(fileDest, "@%d", pexp->nStackBytes);
@@ -295,19 +299,19 @@
int bAddDecorations = 1;
fprintf(fileDest, "=");
-
+
/* No decorations, if switch was passed or this is an external */
if (no_decoration || ScanToken(pexp->pcRedirection, '.'))
{
bAddDecorations = 0;
}
-
+
if (pexp->nCallingConvention == CC_FASTCALL && bAddDecorations)
{
fprintf(fileDest, "@");
}
fprintf(fileDest, "%.*s", pexp->nRedirectionLength,
pexp->pcRedirection);
- if ((pexp->nCallingConvention == CC_STDCALL ||
+ if ((pexp->nCallingConvention == CC_STDCALL ||
pexp->nCallingConvention == CC_FASTCALL) && bAddDecorations)
{
fprintf(fileDest, "@%d", pexp->nStackBytes);
@@ -348,7 +352,7 @@
int included;
//fprintf(stderr, "info: line %d, pcStart:'%.30s'\n", nLine,
pcStart);
-
+
/* Loop all lines */
nLine = 1;
for (pcLine = pcStart; *pcLine; pcLine = NextLine(pcLine), nLine++)
@@ -358,7 +362,7 @@
exp.nArgCount = 0;
exp.uFlags = 0;
- //fprintf(stderr, "info: line %d, token:'%d, %.20s'\n",
+ //fprintf(stderr, "info: line %d, token:'%d, %.20s'\n",
// nLine, TokenLength(pcLine), pcLine);
/* Skip white spaces */
@@ -368,7 +372,7 @@
if (*pc == ';' || *pc <= '#') continue;
if (*pc == 0) return 0;
- //fprintf(stderr, "info: line %d, token:'%.*s'\n",
+ //fprintf(stderr, "info: line %d, token:'%.*s'\n",
// nLine, TokenLength(pc), pc);
/* Now we should get either an ordinal or @ */
@@ -408,7 +412,7 @@
}
else
{
- fprintf(stderr, "error: line %d, expected type, got '%.*s'
%d\n",
+ fprintf(stderr, "error: line %d, expected type, got '%.*s'
%d\n",
nLine, TokenLength(pc), pc, *pc);
return -11;
}
@@ -441,7 +445,7 @@
{
included = 1;
}
-
+
/* Skip to next arch or end */
while (*pc > ',') pc++;
}
@@ -471,7 +475,7 @@
}
else
{
- fprintf(stderr, "info: ignored option: '%.*s'\n",
+ fprintf(stderr, "info: ignored option: '%.*s'\n",
TokenLength(pc), pc);
}
@@ -480,7 +484,7 @@
}
//fprintf(stderr, "info: Name:'%.10s'\n", pc);
-
+
/* If arch didn't match ours, skip this entry */
if (!included) continue;
@@ -507,7 +511,7 @@
fprintf(stderr, "error: line %d, expected '('\n",
nLine);
return -14;
}
-
+
/* Skip whitespaces */
while (*pc == ' ' || *pc == '\t') pc++;
Modified: branches/cmake-bringup/tools/xml.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/tools/xml.cpp?rev…
==============================================================================
--- branches/cmake-bringup/tools/xml.cpp [iso-8859-1] (original)
+++ branches/cmake-bringup/tools/xml.cpp [iso-8859-1] Mon Dec 27 21:48:25 2010
@@ -25,6 +25,7 @@
#include <direct.h>
#include <io.h>
#else
+ #include <stdio.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -101,7 +102,7 @@
void XMLException::SetExceptionV ( const std::string& location, const char* format,
va_list args )
{
char buffer[1024];
- _vsnprintf(buffer, sizeof(buffer)-1, format, args);
+ vsnprintf(buffer, sizeof(buffer)-1, format, args);
_e = location + ": " + buffer;
}
@@ -426,14 +427,15 @@
XMLFile::Location() const
{
int line = 1;
- char line_str[10];
+ char line_str[13];
const char* p = strchr ( _buf.c_str(), '\n' );
while ( p && p < _p )
{
++line;
p = strchr ( p+1, '\n' );
}
- return _filename + "(" + itoa(line, line_str, 10) + ")";
+ sprintf(line_str, "(%i)", line);
+ return _filename + line_str;
}
XMLAttribute::XMLAttribute()