mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 15:42:25 +00:00
Fix mingw windows build.
This commit is contained in:
parent
a865643d6c
commit
682fa59e42
6 changed files with 21 additions and 20 deletions
|
|
@ -69,8 +69,8 @@ export address Platform_OSAllocate (address size);
|
||||||
export void Platform_OSFree (address address);
|
export void Platform_OSFree (address address);
|
||||||
export int16 Platform_OldRO (CHAR *n, LONGINT n__len, int32 *h);
|
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_OldRW (CHAR *n, LONGINT n__len, int32 *h);
|
||||||
export int16 Platform_Read (int32 h, int32 p, int32 l, 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, int32 *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 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_SameFile (Platform_FileIdentity i1, Platform_FileIdentity i2);
|
||||||
export BOOLEAN Platform_SameFileTime (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_errstring(s, s__len) WriteFile((HANDLE)(address)Platform_StdOut, s, s__len-1, 0,0)
|
||||||
#define Platform_exit(code) ExitProcess((UINT)code)
|
#define Platform_exit(code) ExitProcess((UINT)code)
|
||||||
#define Platform_fileTimeToSysTime() SYSTEMTIME st; FileTimeToSystemTime(&ft, &st)
|
#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_free(address) HeapFree(GetProcessHeap(), 0, (void*)address)
|
||||||
#define Platform_ftToUli() ULARGE_INTEGER ul; ul.LowPart=ft.dwLowDateTime; ul.HighPart=ft.dwHighDateTime
|
#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)
|
#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_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_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_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_seekcur() FILE_CURRENT
|
||||||
#define Platform_seekend() FILE_END
|
#define Platform_seekend() FILE_END
|
||||||
#define Platform_seekset() FILE_BEGIN
|
#define Platform_seekset() FILE_BEGIN
|
||||||
|
|
@ -174,7 +174,7 @@ extern void Heap_InitHeap();
|
||||||
#define Platform_ulSec() (LONGINT)(ul.QuadPart / 1000000LL)
|
#define Platform_ulSec() (LONGINT)(ul.QuadPart / 1000000LL)
|
||||||
#define Platform_uluSec() (LONGINT)(ul.QuadPart % 1000000LL)
|
#define Platform_uluSec() (LONGINT)(ul.QuadPart % 1000000LL)
|
||||||
#define Platform_waitForProcess() (INTEGER)WaitForSingleObject(pi.hProcess, INFINITE)
|
#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)
|
BOOLEAN Platform_TooManyFiles (int16 e)
|
||||||
{
|
{
|
||||||
|
|
@ -538,7 +538,7 @@ int16 Platform_Size (int32 h, int32 *l)
|
||||||
return _o_result;
|
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 _o_result;
|
||||||
int16 result;
|
int16 result;
|
||||||
|
|
@ -555,7 +555,7 @@ int16 Platform_Read (int32 h, int32 p, int32 l, int32 *n)
|
||||||
__RETCHK;
|
__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 _o_result;
|
||||||
int16 result;
|
int16 result;
|
||||||
|
|
|
||||||
|
|
@ -58,8 +58,8 @@ import address Platform_OSAllocate (address size);
|
||||||
import void Platform_OSFree (address address);
|
import void Platform_OSFree (address address);
|
||||||
import int16 Platform_OldRO (CHAR *n, LONGINT n__len, int32 *h);
|
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_OldRW (CHAR *n, LONGINT n__len, int32 *h);
|
||||||
import int16 Platform_Read (int32 h, int32 p, int32 l, 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, int32 *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 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_SameFile (Platform_FileIdentity i1, Platform_FileIdentity i2);
|
||||||
import BOOLEAN Platform_SameFileTime (Platform_FileIdentity i1, Platform_FileIdentity i2);
|
import BOOLEAN Platform_SameFileTime (Platform_FileIdentity i1, Platform_FileIdentity i2);
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,8 @@ export address Platform_OSAllocate (address size);
|
||||||
export void Platform_OSFree (address address);
|
export void Platform_OSFree (address address);
|
||||||
export int32 Platform_OldRO (CHAR *n, LONGINT n__len, int64 *h);
|
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_OldRW (CHAR *n, LONGINT n__len, int64 *h);
|
||||||
export int32 Platform_Read (int64 h, int64 p, int64 l, 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, int64 *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 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_SameFile (Platform_FileIdentity i1, Platform_FileIdentity i2);
|
||||||
export BOOLEAN Platform_SameFileTime (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_errstring(s, s__len) WriteFile((HANDLE)(address)Platform_StdOut, s, s__len-1, 0,0)
|
||||||
#define Platform_exit(code) ExitProcess((UINT)code)
|
#define Platform_exit(code) ExitProcess((UINT)code)
|
||||||
#define Platform_fileTimeToSysTime() SYSTEMTIME st; FileTimeToSystemTime(&ft, &st)
|
#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_free(address) HeapFree(GetProcessHeap(), 0, (void*)address)
|
||||||
#define Platform_ftToUli() ULARGE_INTEGER ul; ul.LowPart=ft.dwLowDateTime; ul.HighPart=ft.dwHighDateTime
|
#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)
|
#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_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_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_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_seekcur() FILE_CURRENT
|
||||||
#define Platform_seekend() FILE_END
|
#define Platform_seekend() FILE_END
|
||||||
#define Platform_seekset() FILE_BEGIN
|
#define Platform_seekset() FILE_BEGIN
|
||||||
|
|
@ -175,7 +175,7 @@ extern void Heap_InitHeap();
|
||||||
#define Platform_ulSec() (LONGINT)(ul.QuadPart / 1000000LL)
|
#define Platform_ulSec() (LONGINT)(ul.QuadPart / 1000000LL)
|
||||||
#define Platform_uluSec() (LONGINT)(ul.QuadPart % 1000000LL)
|
#define Platform_uluSec() (LONGINT)(ul.QuadPart % 1000000LL)
|
||||||
#define Platform_waitForProcess() (INTEGER)WaitForSingleObject(pi.hProcess, INFINITE)
|
#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)
|
BOOLEAN Platform_TooManyFiles (int32 e)
|
||||||
{
|
{
|
||||||
|
|
@ -539,7 +539,7 @@ int32 Platform_Size (int64 h, int64 *l)
|
||||||
return _o_result;
|
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 _o_result;
|
||||||
int32 result;
|
int32 result;
|
||||||
|
|
@ -556,7 +556,7 @@ int32 Platform_Read (int64 h, int64 p, int64 l, int64 *n)
|
||||||
__RETCHK;
|
__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 _o_result;
|
||||||
int32 result;
|
int32 result;
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,8 @@ import address Platform_OSAllocate (address size);
|
||||||
import void Platform_OSFree (address address);
|
import void Platform_OSFree (address address);
|
||||||
import int32 Platform_OldRO (CHAR *n, LONGINT n__len, int64 *h);
|
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_OldRW (CHAR *n, LONGINT n__len, int64 *h);
|
||||||
import int32 Platform_Read (int64 h, int64 p, int64 l, 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, int64 *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 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_SameFile (Platform_FileIdentity i1, Platform_FileIdentity i2);
|
||||||
import BOOLEAN Platform_SameFileTime (Platform_FileIdentity i1, Platform_FileIdentity i2);
|
import BOOLEAN Platform_SameFileTime (Platform_FileIdentity i1, Platform_FileIdentity i2);
|
||||||
|
|
|
||||||
|
|
@ -412,8 +412,8 @@ BEGIN
|
||||||
END Size;
|
END Size;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE -readfile (fd: LONGINT; p: SYSTEM.ADDRESS; l: SYSTEM.ADDRESS; VAR n: SYSTEM.ADDRESS): SYSTEM.ADDRESS
|
PROCEDURE -readfile (fd: LONGINT; p: SYSTEM.ADDRESS; l: SYSTEM.ADDRESS; VAR n: SYSTEM.ADDRESS): INTEGER
|
||||||
"(address)ReadFile((HANDLE)fd, (void*)p, (DWORD)l, (DWORD*)n, 0)";
|
"(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;
|
PROCEDURE Read*(h: FileHandle; p: SYSTEM.ADDRESS; l: SYSTEM.ADDRESS; VAR n: SYSTEM.ADDRESS): ErrorCode;
|
||||||
VAR result: INTEGER;
|
VAR result: INTEGER;
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define strncasecmp _strnicmp
|
#define strncasecmp _strnicmp
|
||||||
|
char* getcwd(char* buf, size_t size);
|
||||||
#else
|
#else
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue