From 682fa59e42b4953372ff297bb3ff5c4cdb7c94e1 Mon Sep 17 00:00:00 2001 From: David Brown Date: Sun, 4 Sep 2016 16:38:17 +0100 Subject: [PATCH] Fix mingw windows build. --- bootstrap/windows-48/Platform.c | 14 +++++++------- bootstrap/windows-48/Platform.h | 4 ++-- bootstrap/windows-88/Platform.c | 14 +++++++------- bootstrap/windows-88/Platform.h | 4 ++-- src/system/Platformwindows.Mod | 4 ++-- src/tools/make/configure.c | 1 + 6 files changed, 21 insertions(+), 20 deletions(-) diff --git a/bootstrap/windows-48/Platform.c b/bootstrap/windows-48/Platform.c index e3a21ae0..62a367e1 100644 --- a/bootstrap/windows-48/Platform.c +++ b/bootstrap/windows-48/Platform.c @@ -69,8 +69,8 @@ export address Platform_OSAllocate (address size); export void Platform_OSFree (address address); export int16 Platform_OldRO (CHAR *n, LONGINT n__len, int32 *h); export int16 Platform_OldRW (CHAR *n, LONGINT n__len, int32 *h); -export int16 Platform_Read (int32 h, int32 p, int32 l, int32 *n); -export int16 Platform_ReadBuf (int32 h, SYSTEM_BYTE *b, LONGINT b__len, int32 *n); +export int16 Platform_Read (int32 h, address p, address l, address *n); +export int16 Platform_ReadBuf (int32 h, SYSTEM_BYTE *b, LONGINT b__len, address *n); export int16 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len); export BOOLEAN Platform_SameFile (Platform_FileIdentity i1, Platform_FileIdentity i2); export BOOLEAN Platform_SameFileTime (Platform_FileIdentity i1, Platform_FileIdentity i2); @@ -130,7 +130,7 @@ extern void Heap_InitHeap(); #define Platform_errstring(s, s__len) WriteFile((HANDLE)(address)Platform_StdOut, s, s__len-1, 0,0) #define Platform_exit(code) ExitProcess((UINT)code) #define Platform_fileTimeToSysTime() SYSTEMTIME st; FileTimeToSystemTime(&ft, &st) -#define Platform_flushFileBuffers(h) (INTEGER)FlushFileBuffers((HANDLE)(address)h) +#define Platform_flushFileBuffers(h) (INTEGER)FlushFileBuffers((HANDLE)h) #define Platform_free(address) HeapFree(GetProcessHeap(), 0, (void*)address) #define Platform_ftToUli() ULARGE_INTEGER ul; ul.LowPart=ft.dwLowDateTime; ul.HighPart=ft.dwHighDateTime #define Platform_getCurrentDirectory(n, n__len) GetCurrentDirectory(n__len, (char*)n) @@ -153,7 +153,7 @@ extern void Heap_InitHeap(); #define Platform_openro(n, n__len) (LONGINT)(address)CreateFile((char*)n, GENERIC_READ , FILE_SHARE_READ|FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0) #define Platform_openrw(n, n__len) (LONGINT)(address)CreateFile((char*)n, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0) #define Platform_processInfo() PROCESS_INFORMATION pi = {0}; -#define Platform_readfile(fd, p, l, n) (INTEGER)ReadFile ((HANDLE)(address)fd, (void*)(address)(p), (DWORD)l, (DWORD*)n, 0) +#define Platform_readfile(fd, p, l, n) (INTEGER)ReadFile((HANDLE)fd, (void*)p, (DWORD)l, (DWORD*)n, 0) #define Platform_seekcur() FILE_CURRENT #define Platform_seekend() FILE_END #define Platform_seekset() FILE_BEGIN @@ -174,7 +174,7 @@ extern void Heap_InitHeap(); #define Platform_ulSec() (LONGINT)(ul.QuadPart / 1000000LL) #define Platform_uluSec() (LONGINT)(ul.QuadPart % 1000000LL) #define Platform_waitForProcess() (INTEGER)WaitForSingleObject(pi.hProcess, INFINITE) -#define Platform_writefile(fd, p, l) (INTEGER)WriteFile((HANDLE)(address)fd, (void*)(address)(p), (DWORD)l, 0,0) +#define Platform_writefile(fd, p, l) (INTEGER)WriteFile((HANDLE)fd, (void*)(p), (DWORD)l, 0,0) BOOLEAN Platform_TooManyFiles (int16 e) { @@ -538,7 +538,7 @@ int16 Platform_Size (int32 h, int32 *l) return _o_result; } -int16 Platform_Read (int32 h, int32 p, int32 l, int32 *n) +int16 Platform_Read (int32 h, address p, address l, address *n) { int16 _o_result; int16 result; @@ -555,7 +555,7 @@ int16 Platform_Read (int32 h, int32 p, int32 l, int32 *n) __RETCHK; } -int16 Platform_ReadBuf (int32 h, SYSTEM_BYTE *b, LONGINT b__len, int32 *n) +int16 Platform_ReadBuf (int32 h, SYSTEM_BYTE *b, LONGINT b__len, address *n) { int16 _o_result; int16 result; diff --git a/bootstrap/windows-48/Platform.h b/bootstrap/windows-48/Platform.h index 6d0de5b3..0b6a48d8 100644 --- a/bootstrap/windows-48/Platform.h +++ b/bootstrap/windows-48/Platform.h @@ -58,8 +58,8 @@ import address Platform_OSAllocate (address size); import void Platform_OSFree (address address); import int16 Platform_OldRO (CHAR *n, LONGINT n__len, int32 *h); import int16 Platform_OldRW (CHAR *n, LONGINT n__len, int32 *h); -import int16 Platform_Read (int32 h, int32 p, int32 l, int32 *n); -import int16 Platform_ReadBuf (int32 h, SYSTEM_BYTE *b, LONGINT b__len, int32 *n); +import int16 Platform_Read (int32 h, address p, address l, address *n); +import int16 Platform_ReadBuf (int32 h, SYSTEM_BYTE *b, LONGINT b__len, address *n); import int16 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len); import BOOLEAN Platform_SameFile (Platform_FileIdentity i1, Platform_FileIdentity i2); import BOOLEAN Platform_SameFileTime (Platform_FileIdentity i1, Platform_FileIdentity i2); diff --git a/bootstrap/windows-88/Platform.c b/bootstrap/windows-88/Platform.c index 128d21e0..0f3aae72 100644 --- a/bootstrap/windows-88/Platform.c +++ b/bootstrap/windows-88/Platform.c @@ -70,8 +70,8 @@ export address Platform_OSAllocate (address size); export void Platform_OSFree (address address); export int32 Platform_OldRO (CHAR *n, LONGINT n__len, int64 *h); export int32 Platform_OldRW (CHAR *n, LONGINT n__len, int64 *h); -export int32 Platform_Read (int64 h, int64 p, int64 l, int64 *n); -export int32 Platform_ReadBuf (int64 h, SYSTEM_BYTE *b, LONGINT b__len, int64 *n); +export int32 Platform_Read (int64 h, address p, address l, address *n); +export int32 Platform_ReadBuf (int64 h, SYSTEM_BYTE *b, LONGINT b__len, address *n); export int32 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len); export BOOLEAN Platform_SameFile (Platform_FileIdentity i1, Platform_FileIdentity i2); export BOOLEAN Platform_SameFileTime (Platform_FileIdentity i1, Platform_FileIdentity i2); @@ -131,7 +131,7 @@ extern void Heap_InitHeap(); #define Platform_errstring(s, s__len) WriteFile((HANDLE)(address)Platform_StdOut, s, s__len-1, 0,0) #define Platform_exit(code) ExitProcess((UINT)code) #define Platform_fileTimeToSysTime() SYSTEMTIME st; FileTimeToSystemTime(&ft, &st) -#define Platform_flushFileBuffers(h) (INTEGER)FlushFileBuffers((HANDLE)(address)h) +#define Platform_flushFileBuffers(h) (INTEGER)FlushFileBuffers((HANDLE)h) #define Platform_free(address) HeapFree(GetProcessHeap(), 0, (void*)address) #define Platform_ftToUli() ULARGE_INTEGER ul; ul.LowPart=ft.dwLowDateTime; ul.HighPart=ft.dwHighDateTime #define Platform_getCurrentDirectory(n, n__len) GetCurrentDirectory(n__len, (char*)n) @@ -154,7 +154,7 @@ extern void Heap_InitHeap(); #define Platform_openro(n, n__len) (LONGINT)(address)CreateFile((char*)n, GENERIC_READ , FILE_SHARE_READ|FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0) #define Platform_openrw(n, n__len) (LONGINT)(address)CreateFile((char*)n, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0) #define Platform_processInfo() PROCESS_INFORMATION pi = {0}; -#define Platform_readfile(fd, p, l, n) (INTEGER)ReadFile ((HANDLE)(address)fd, (void*)(address)(p), (DWORD)l, (DWORD*)n, 0) +#define Platform_readfile(fd, p, l, n) (INTEGER)ReadFile((HANDLE)fd, (void*)p, (DWORD)l, (DWORD*)n, 0) #define Platform_seekcur() FILE_CURRENT #define Platform_seekend() FILE_END #define Platform_seekset() FILE_BEGIN @@ -175,7 +175,7 @@ extern void Heap_InitHeap(); #define Platform_ulSec() (LONGINT)(ul.QuadPart / 1000000LL) #define Platform_uluSec() (LONGINT)(ul.QuadPart % 1000000LL) #define Platform_waitForProcess() (INTEGER)WaitForSingleObject(pi.hProcess, INFINITE) -#define Platform_writefile(fd, p, l) (INTEGER)WriteFile((HANDLE)(address)fd, (void*)(address)(p), (DWORD)l, 0,0) +#define Platform_writefile(fd, p, l) (INTEGER)WriteFile((HANDLE)fd, (void*)(p), (DWORD)l, 0,0) BOOLEAN Platform_TooManyFiles (int32 e) { @@ -539,7 +539,7 @@ int32 Platform_Size (int64 h, int64 *l) return _o_result; } -int32 Platform_Read (int64 h, int64 p, int64 l, int64 *n) +int32 Platform_Read (int64 h, address p, address l, address *n) { int32 _o_result; int32 result; @@ -556,7 +556,7 @@ int32 Platform_Read (int64 h, int64 p, int64 l, int64 *n) __RETCHK; } -int32 Platform_ReadBuf (int64 h, SYSTEM_BYTE *b, LONGINT b__len, int64 *n) +int32 Platform_ReadBuf (int64 h, SYSTEM_BYTE *b, LONGINT b__len, address *n) { int32 _o_result; int32 result; diff --git a/bootstrap/windows-88/Platform.h b/bootstrap/windows-88/Platform.h index 25f6197f..0d17921c 100644 --- a/bootstrap/windows-88/Platform.h +++ b/bootstrap/windows-88/Platform.h @@ -59,8 +59,8 @@ import address Platform_OSAllocate (address size); import void Platform_OSFree (address address); import int32 Platform_OldRO (CHAR *n, LONGINT n__len, int64 *h); import int32 Platform_OldRW (CHAR *n, LONGINT n__len, int64 *h); -import int32 Platform_Read (int64 h, int64 p, int64 l, int64 *n); -import int32 Platform_ReadBuf (int64 h, SYSTEM_BYTE *b, LONGINT b__len, int64 *n); +import int32 Platform_Read (int64 h, address p, address l, address *n); +import int32 Platform_ReadBuf (int64 h, SYSTEM_BYTE *b, LONGINT b__len, address *n); import int32 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len); import BOOLEAN Platform_SameFile (Platform_FileIdentity i1, Platform_FileIdentity i2); import BOOLEAN Platform_SameFileTime (Platform_FileIdentity i1, Platform_FileIdentity i2); diff --git a/src/system/Platformwindows.Mod b/src/system/Platformwindows.Mod index 272180b8..9ed6bc8c 100644 --- a/src/system/Platformwindows.Mod +++ b/src/system/Platformwindows.Mod @@ -412,8 +412,8 @@ BEGIN END Size; -PROCEDURE -readfile (fd: LONGINT; p: SYSTEM.ADDRESS; l: SYSTEM.ADDRESS; VAR n: SYSTEM.ADDRESS): SYSTEM.ADDRESS -"(address)ReadFile((HANDLE)fd, (void*)p, (DWORD)l, (DWORD*)n, 0)"; +PROCEDURE -readfile (fd: LONGINT; p: SYSTEM.ADDRESS; l: SYSTEM.ADDRESS; VAR n: SYSTEM.ADDRESS): INTEGER +"(INTEGER)ReadFile((HANDLE)fd, (void*)p, (DWORD)l, (DWORD*)n, 0)"; PROCEDURE Read*(h: FileHandle; p: SYSTEM.ADDRESS; l: SYSTEM.ADDRESS; VAR n: SYSTEM.ADDRESS): ErrorCode; VAR result: INTEGER; diff --git a/src/tools/make/configure.c b/src/tools/make/configure.c index 28530ece..767763bc 100644 --- a/src/tools/make/configure.c +++ b/src/tools/make/configure.c @@ -19,6 +19,7 @@ #ifdef _WIN32 #define strncasecmp _strnicmp + char* getcwd(char* buf, size_t size); #else #include #include