Change of mind: s/uintptr/address/. Replace LONGINT with ADDRESS in Platform*.

This commit is contained in:
David Brown 2016-09-04 14:34:24 +01:00
parent 90737e5677
commit a865643d6c
215 changed files with 1441 additions and 1410 deletions

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/03] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/09/04] for gcc LP64 on cygwin xtspkaSfF */
#define LARGE
#include "SYSTEM.h"
@ -27,12 +27,12 @@ typedef
export BOOLEAN Platform_LittleEndian;
export uintptr Platform_MainStackFrame;
export address Platform_MainStackFrame;
export int64 Platform_HaltCode;
export int32 Platform_PID;
export CHAR Platform_CWD[256];
export int32 Platform_ArgCount;
export uintptr Platform_ArgVector;
export address Platform_ArgVector;
static Platform_HaltProcedure Platform_HaltHandler;
static int64 Platform_TimeStart;
export int32 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd;
@ -60,16 +60,16 @@ export void Platform_Halt (int64 code);
export int32 Platform_Identify (int64 h, Platform_FileIdentity *identity, LONGINT *identity__typ);
export int32 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, LONGINT *identity__typ);
export BOOLEAN Platform_Inaccessible (int32 e);
export void Platform_Init (int32 argc, int64 argvadr);
export void Platform_Init (int32 argc, address argvadr);
export void Platform_MTimeAsClock (Platform_FileIdentity i, int64 *t, int64 *d);
export int32 Platform_New (CHAR *n, LONGINT n__len, int64 *h);
export BOOLEAN Platform_NoSuchDirectory (int32 e);
export uintptr Platform_OSAllocate (uintptr size);
export void Platform_OSFree (uintptr address);
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);
@ -88,7 +88,7 @@ export BOOLEAN Platform_TimedOut (int32 e);
export BOOLEAN Platform_TooManyFiles (int32 e);
export int32 Platform_Truncate (int64 h, int64 l);
export int32 Platform_Unlink (CHAR *n, LONGINT n__len);
export int32 Platform_Write (int64 h, int64 p, int64 l);
export int32 Platform_Write (int64 h, address p, address l);
static void Platform_YMDHMStoClock (int64 ye, int64 mo, int64 da, int64 ho, int64 mi, int64 se, int64 *t, int64 *d);
static void Platform_errch (CHAR c);
static void Platform_errint (int64 l);
@ -120,7 +120,7 @@ export BOOLEAN Platform_getEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT
#define Platform_EXDEV() EXDEV
extern void Heap_InitHeap();
#define Platform_HeapInitHeap() Heap_InitHeap()
#define Platform_allocate(size) (uintptr)((void*)malloc((size_t)size))
#define Platform_allocate(size) (address)((void*)malloc((size_t)size))
#define Platform_chdir(n, n__len) chdir((char*)n)
#define Platform_closefile(fd) close(fd)
#define Platform_err() errno
@ -140,13 +140,13 @@ extern void Heap_InitHeap();
#define Platform_opennew(n, n__len) open((char*)n, O_CREAT | O_TRUNC | O_RDWR, 0664)
#define Platform_openro(n, n__len) open((char*)n, O_RDONLY)
#define Platform_openrw(n, n__len) open((char*)n, O_RDWR)
#define Platform_readfile(fd, p, l) read(fd, (void*)(uintptr)(p), l)
#define Platform_readfile(fd, p, l) read(fd, (void*)(address)(p), l)
#define Platform_rename(o, o__len, n, n__len) rename((char*)o, (char*)n)
#define Platform_sectotm(s) struct tm *time = localtime((time_t*)&s)
#define Platform_seekcur() SEEK_CUR
#define Platform_seekend() SEEK_END
#define Platform_seekset() SEEK_SET
#define Platform_sethandler(s, h) SystemSetHandler(s, (uintptr)h)
#define Platform_sethandler(s, h) SystemSetHandler(s, (address)h)
#define Platform_stat(n, n__len) stat((char*)n, &s)
#define Platform_statdev() (LONGINT)s.st_dev
#define Platform_statino() (LONGINT)s.st_ino
@ -163,7 +163,7 @@ extern void Heap_InitHeap();
#define Platform_tvsec() tv.tv_sec
#define Platform_tvusec() tv.tv_usec
#define Platform_unlink(n, n__len) unlink((char*)n)
#define Platform_writefile(fd, p, l) write(fd, (void*)(uintptr)(p), l)
#define Platform_writefile(fd, p, l) write(fd, (void*)(address)(p), l)
BOOLEAN Platform_TooManyFiles (int32 e)
{
@ -214,24 +214,24 @@ BOOLEAN Platform_ConnectionFailed (int32 e)
return _o_result;
}
uintptr Platform_OSAllocate (uintptr size)
address Platform_OSAllocate (address size)
{
uintptr _o_result;
address _o_result;
_o_result = Platform_allocate(size);
return _o_result;
}
void Platform_OSFree (uintptr address)
void Platform_OSFree (address address)
{
Platform_free(address);
}
void Platform_Init (int32 argc, int64 argvadr)
void Platform_Init (int32 argc, address argvadr)
{
Platform_ArgVecPtr av = NIL;
Platform_MainStackFrame = argvadr;
Platform_ArgCount = argc;
av = (Platform_ArgVecPtr)(uintptr)argvadr;
av = (Platform_ArgVecPtr)(address)argvadr;
Platform_ArgVector = (*av)[0];
Platform_HaltCode = -128;
Platform_HeapInitHeap();
@ -264,7 +264,7 @@ void Platform_GetArg (int32 n, CHAR *val, LONGINT val__len)
{
Platform_ArgVec av = NIL;
if (n < Platform_ArgCount) {
av = (Platform_ArgVec)(uintptr)Platform_ArgVector;
av = (Platform_ArgVec)(address)Platform_ArgVector;
__COPY(*(*av)[__X(n, 1024)], val, val__len);
}
}
@ -513,7 +513,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;
*n = Platform_readfile(h, p, l);
@ -528,10 +528,10 @@ 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;
*n = Platform_readfile(h, (uintptr)b, b__len);
*n = Platform_readfile(h, (address)b, b__len);
if (*n < 0) {
*n = 0;
_o_result = Platform_err();
@ -543,10 +543,10 @@ int32 Platform_ReadBuf (int64 h, SYSTEM_BYTE *b, LONGINT b__len, int64 *n)
__RETCHK;
}
int32 Platform_Write (int64 h, int64 p, int64 l)
int32 Platform_Write (int64 h, address p, address l)
{
int32 _o_result;
int64 written;
address written;
written = Platform_writefile(h, p, l);
if (written < 0) {
_o_result = Platform_err();
@ -651,7 +651,6 @@ static void Platform_errch (CHAR c)
static void Platform_errln (void)
{
Platform_errch(0x0d);
Platform_errch(0x0a);
}
@ -767,7 +766,7 @@ static void Platform_TestLittleEndian (void)
{
int32 i;
i = 1;
__GET((uintptr)&i, Platform_LittleEndian, BOOLEAN);
__GET((address)&i, Platform_LittleEndian, BOOLEAN);
}
__TDESC(Platform_FileIdentity, 1, 0) = {__TDFLDS("FileIdentity", 24), {-8}};