Fixes so wmc compiled on non-windows platforms

svn path=/trunk/; revision=2482
This commit is contained in:
David Welch 2002-01-04 03:12:13 +00:00
parent e2bd4b9b87
commit f376a8013e
4 changed files with 94 additions and 9 deletions

View file

@ -7,35 +7,38 @@ TARGET=wmc$(EXE_POSTFIX)
all: $(TARGET) all: $(TARGET)
OBJECTS = getopt.o lang.o mcl.o utils.o wmc.o write.o y_tab.o OBJECTS = getopt.o lang.o mcl.o utils.o wmc.o write.o y_tab.o misc.o
CLEAN_FILES = *.o wmc$(EXE_POSTFIX) CLEAN_FILES = *.o wmc$(EXE_POSTFIX)
wmc$(EXE_POSTFIX): $(OBJECTS) wmc$(EXE_POSTFIX): $(OBJECTS)
$(HOST_CC) $(OBJECTS) -o wmc$(EXE_POSTFIX) $(HOST_CC) $(OBJECTS) -g -o wmc$(EXE_POSTFIX)
HOST_CFLAGS = -I. HOST_CFLAGS = -I.
getopt.o: getopt.c getopt.o: getopt.c
$(HOST_CC) $(HOST_CFLAGS) -c getopt.c -o getopt.o $(HOST_CC) $(HOST_CFLAGS) -g -c getopt.c -o getopt.o
lang.o: lang.c lang.o: lang.c
$(HOST_CC) $(HOST_CFLAGS) -c lang.c -o lang.o $(HOST_CC) $(HOST_CFLAGS) -g -c lang.c -o lang.o
misc.o: misc.c
$(HOST_CC) $(HOST_CFLAGS) -g -c misc.c -o misc.o
mcl.o: mcl.c mcl.o: mcl.c
$(HOST_CC) $(HOST_CFLAGS) -c mcl.c -o mcl.o $(HOST_CC) $(HOST_CFLAGS) -g -c mcl.c -o mcl.o
utils.o: utils.c utils.o: utils.c
$(HOST_CC) $(HOST_CFLAGS) -c utils.c -o utils.o $(HOST_CC) $(HOST_CFLAGS) -g -c utils.c -o utils.o
wmc.o: wmc.c wmc.o: wmc.c
$(HOST_CC) $(HOST_CFLAGS) -c wmc.c -o wmc.o $(HOST_CC) $(HOST_CFLAGS) -g -c wmc.c -o wmc.o
write.o: write.c write.o: write.c
$(HOST_CC) $(HOST_CFLAGS) -c write.c -o write.o $(HOST_CC) $(HOST_CFLAGS) -g -c write.c -o write.o
y_tab.o: y_tab.c y_tab.o: y_tab.c
$(HOST_CC) $(HOST_CFLAGS) -c y_tab.c -o y_tab.o $(HOST_CC) $(HOST_CFLAGS) -g -c y_tab.c -o y_tab.o
ifeq ($(HOST),mingw32-linux) ifeq ($(HOST),mingw32-linux)
clean: clean:

77
reactos/tools/wmc/misc.c Normal file
View file

@ -0,0 +1,77 @@
#ifdef __unix__
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
typedef unsigned short UINT;
typedef unsigned int DWORD;
typedef const unsigned char* LPCSTR;
typedef wchar_t* LPWSTR;
typedef unsigned char* LPSTR;
typedef const wchar_t* LPCWSTR;
typedef unsigned int* LPBOOL;
int
stricmp(const char* s1, const char* s2)
{
return(strcasecmp(s1, s2));
}
int
WideCharToMultiByte(
UINT CodePage,
DWORD dwFlags,
LPCWSTR lpWideCharStr,
int cchWideChar,
LPSTR lpMultiByteStr,
int cchMultiByte,
LPCSTR lpDefaultChar,
LPBOOL lpUsedDefaultChar)
{
unsigned int i = 0;
if (cchWideChar == -1)
{
while(*lpWideCharStr != 0)
{
wctomb(lpMultiByteStr, *lpWideCharStr);
lpMultiByteStr++;
lpWideCharStr++;
i++;
}
}
else
{
while(i < cchWideChar)
{
wctomb(lpMultiByteStr, *lpWideCharStr);
lpMultiByteStr++;
lpWideCharStr++;
i++;
}
}
return(i);
}
int
MultiByteToWideChar(
UINT CodePage,
DWORD dwFlags,
LPCSTR lpMultiByteStr,
int cchMultiByte,
LPWSTR lpWideCharStr,
int cchWideChar)
{
int i, j;
i = j = 0;
while (i < cchMultiByte && lpMultiByteStr[i] != 0)
{
i = i + mbtowc(&lpWideCharStr[j], &lpMultiByteStr[i],
cchMultiByte - i);
j++;
}
lpWideCharStr[j] = 0;
j++;
return(j);
}
#endif

View file

@ -0,0 +1,3 @@
#include <wchar.h>
typedef wchar_t WCHAR;
typedef unsigned short int WORD;

View file

@ -71,4 +71,6 @@ void add_token(tok_e type, const WCHAR *name, int tok, int cp, const WCHAR *alia
token_t *lookup_token(const WCHAR *s); token_t *lookup_token(const WCHAR *s);
void get_tokentable(token_t **tab, int *len); void get_tokentable(token_t **tab, int *len);
#define _alloca alloca
#endif #endif