mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00:00
Fixes so wmc compiled on non-windows platforms
svn path=/trunk/; revision=2482
This commit is contained in:
parent
e2bd4b9b87
commit
f376a8013e
4 changed files with 94 additions and 9 deletions
|
@ -7,35 +7,38 @@ TARGET=wmc$(EXE_POSTFIX)
|
|||
|
||||
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)
|
||||
|
||||
wmc$(EXE_POSTFIX): $(OBJECTS)
|
||||
$(HOST_CC) $(OBJECTS) -o wmc$(EXE_POSTFIX)
|
||||
$(HOST_CC) $(OBJECTS) -g -o wmc$(EXE_POSTFIX)
|
||||
|
||||
HOST_CFLAGS = -I.
|
||||
|
||||
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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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)
|
||||
clean:
|
||||
|
|
77
reactos/tools/wmc/misc.c
Normal file
77
reactos/tools/wmc/misc.c
Normal 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
|
3
reactos/tools/wmc/windows.h
Normal file
3
reactos/tools/wmc/windows.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
#include <wchar.h>
|
||||
typedef wchar_t WCHAR;
|
||||
typedef unsigned short int WORD;
|
|
@ -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);
|
||||
void get_tokentable(token_t **tab, int *len);
|
||||
|
||||
#define _alloca alloca
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue