From 3744c3d0ae14e0c57771837bf5d413199e687a97 Mon Sep 17 00:00:00 2001 From: David Brown Date: Tue, 23 Aug 2016 16:44:51 +0100 Subject: [PATCH] Replace uses of uintptr_t and size_t with SYSTEM_ADDRESS. --- bootstrap/unix-44/Configuration.c | 4 +-- bootstrap/unix-44/Configuration.h | 2 +- bootstrap/unix-44/Console.c | 4 +-- bootstrap/unix-44/Console.h | 2 +- bootstrap/unix-44/Files.c | 18 +++++----- bootstrap/unix-44/Files.h | 2 +- bootstrap/unix-44/Heap.c | 32 ++++++++--------- bootstrap/unix-44/Heap.h | 2 +- bootstrap/unix-44/Modules.c | 2 +- bootstrap/unix-44/Modules.h | 2 +- bootstrap/unix-44/OPB.c | 2 +- bootstrap/unix-44/OPB.h | 2 +- bootstrap/unix-44/OPC.c | 2 +- bootstrap/unix-44/OPC.h | 2 +- bootstrap/unix-44/OPM.c | 8 ++--- bootstrap/unix-44/OPM.h | 2 +- bootstrap/unix-44/OPP.c | 2 +- bootstrap/unix-44/OPP.h | 2 +- bootstrap/unix-44/OPS.c | 2 +- bootstrap/unix-44/OPS.h | 2 +- bootstrap/unix-44/OPT.c | 2 +- bootstrap/unix-44/OPT.h | 2 +- bootstrap/unix-44/OPV.c | 6 ++-- bootstrap/unix-44/OPV.h | 2 +- bootstrap/unix-44/Platform.c | 20 +++++------ bootstrap/unix-44/Platform.h | 2 +- bootstrap/unix-44/Reals.c | 14 ++++---- bootstrap/unix-44/Reals.h | 2 +- bootstrap/unix-44/SYSTEM.c | 12 +++---- bootstrap/unix-44/SYSTEM.h | 49 +++++++++++-------------- bootstrap/unix-44/Strings.c | 2 +- bootstrap/unix-44/Strings.h | 2 +- bootstrap/unix-44/Texts.c | 2 +- bootstrap/unix-44/Texts.h | 2 +- bootstrap/unix-44/Vishap.c | 2 +- bootstrap/unix-44/errors.c | 2 +- bootstrap/unix-44/errors.h | 2 +- bootstrap/unix-44/extTools.c | 2 +- bootstrap/unix-44/extTools.h | 2 +- bootstrap/unix-44/vt100.c | 2 +- bootstrap/unix-44/vt100.h | 2 +- bootstrap/unix-48/Configuration.c | 4 +-- bootstrap/unix-48/Configuration.h | 2 +- bootstrap/unix-48/Console.c | 4 +-- bootstrap/unix-48/Console.h | 2 +- bootstrap/unix-48/Files.c | 18 +++++----- bootstrap/unix-48/Files.h | 2 +- bootstrap/unix-48/Heap.c | 32 ++++++++--------- bootstrap/unix-48/Heap.h | 2 +- bootstrap/unix-48/Modules.c | 2 +- bootstrap/unix-48/Modules.h | 2 +- bootstrap/unix-48/OPB.c | 2 +- bootstrap/unix-48/OPB.h | 2 +- bootstrap/unix-48/OPC.c | 2 +- bootstrap/unix-48/OPC.h | 2 +- bootstrap/unix-48/OPM.c | 8 ++--- bootstrap/unix-48/OPM.h | 2 +- bootstrap/unix-48/OPP.c | 2 +- bootstrap/unix-48/OPP.h | 2 +- bootstrap/unix-48/OPS.c | 2 +- bootstrap/unix-48/OPS.h | 2 +- bootstrap/unix-48/OPT.c | 2 +- bootstrap/unix-48/OPT.h | 2 +- bootstrap/unix-48/OPV.c | 6 ++-- bootstrap/unix-48/OPV.h | 2 +- bootstrap/unix-48/Platform.c | 20 +++++------ bootstrap/unix-48/Platform.h | 2 +- bootstrap/unix-48/Reals.c | 14 ++++---- bootstrap/unix-48/Reals.h | 2 +- bootstrap/unix-48/SYSTEM.c | 12 +++---- bootstrap/unix-48/SYSTEM.h | 49 +++++++++++-------------- bootstrap/unix-48/Strings.c | 2 +- bootstrap/unix-48/Strings.h | 2 +- bootstrap/unix-48/Texts.c | 2 +- bootstrap/unix-48/Texts.h | 2 +- bootstrap/unix-48/Vishap.c | 2 +- bootstrap/unix-48/errors.c | 2 +- bootstrap/unix-48/errors.h | 2 +- bootstrap/unix-48/extTools.c | 2 +- bootstrap/unix-48/extTools.h | 2 +- bootstrap/unix-48/vt100.c | 2 +- bootstrap/unix-48/vt100.h | 2 +- bootstrap/unix-88/Configuration.c | 4 +-- bootstrap/unix-88/Configuration.h | 2 +- bootstrap/unix-88/Console.c | 4 +-- bootstrap/unix-88/Console.h | 2 +- bootstrap/unix-88/Files.c | 18 +++++----- bootstrap/unix-88/Files.h | 2 +- bootstrap/unix-88/Heap.c | 32 ++++++++--------- bootstrap/unix-88/Heap.h | 2 +- bootstrap/unix-88/Modules.c | 2 +- bootstrap/unix-88/Modules.h | 2 +- bootstrap/unix-88/OPB.c | 2 +- bootstrap/unix-88/OPB.h | 2 +- bootstrap/unix-88/OPC.c | 2 +- bootstrap/unix-88/OPC.h | 2 +- bootstrap/unix-88/OPM.c | 4 +-- bootstrap/unix-88/OPM.h | 2 +- bootstrap/unix-88/OPP.c | 2 +- bootstrap/unix-88/OPP.h | 2 +- bootstrap/unix-88/OPS.c | 2 +- bootstrap/unix-88/OPS.h | 2 +- bootstrap/unix-88/OPT.c | 2 +- bootstrap/unix-88/OPT.h | 2 +- bootstrap/unix-88/OPV.c | 6 ++-- bootstrap/unix-88/OPV.h | 2 +- bootstrap/unix-88/Platform.c | 20 +++++------ bootstrap/unix-88/Platform.h | 2 +- bootstrap/unix-88/Reals.c | 14 ++++---- bootstrap/unix-88/Reals.h | 2 +- bootstrap/unix-88/SYSTEM.c | 12 +++---- bootstrap/unix-88/SYSTEM.h | 49 +++++++++++-------------- bootstrap/unix-88/Strings.c | 2 +- bootstrap/unix-88/Strings.h | 2 +- bootstrap/unix-88/Texts.c | 2 +- bootstrap/unix-88/Texts.h | 2 +- bootstrap/unix-88/Vishap.c | 2 +- bootstrap/unix-88/errors.c | 2 +- bootstrap/unix-88/errors.h | 2 +- bootstrap/unix-88/extTools.c | 2 +- bootstrap/unix-88/extTools.h | 2 +- bootstrap/unix-88/vt100.c | 2 +- bootstrap/unix-88/vt100.h | 2 +- bootstrap/windows-48/Configuration.c | 4 +-- bootstrap/windows-48/Configuration.h | 2 +- bootstrap/windows-48/Console.c | 4 +-- bootstrap/windows-48/Console.h | 2 +- bootstrap/windows-48/Files.c | 18 +++++----- bootstrap/windows-48/Files.h | 2 +- bootstrap/windows-48/Heap.c | 32 ++++++++--------- bootstrap/windows-48/Heap.h | 2 +- bootstrap/windows-48/Modules.c | 2 +- bootstrap/windows-48/Modules.h | 2 +- bootstrap/windows-48/OPB.c | 2 +- bootstrap/windows-48/OPB.h | 2 +- bootstrap/windows-48/OPC.c | 2 +- bootstrap/windows-48/OPC.h | 2 +- bootstrap/windows-48/OPM.c | 8 ++--- bootstrap/windows-48/OPM.h | 2 +- bootstrap/windows-48/OPP.c | 2 +- bootstrap/windows-48/OPP.h | 2 +- bootstrap/windows-48/OPS.c | 2 +- bootstrap/windows-48/OPS.h | 2 +- bootstrap/windows-48/OPT.c | 2 +- bootstrap/windows-48/OPT.h | 2 +- bootstrap/windows-48/OPV.c | 6 ++-- bootstrap/windows-48/OPV.h | 2 +- bootstrap/windows-48/Platform.c | 54 ++++++++++++++-------------- bootstrap/windows-48/Platform.h | 6 ++-- bootstrap/windows-48/Reals.c | 14 ++++---- bootstrap/windows-48/Reals.h | 2 +- bootstrap/windows-48/SYSTEM.c | 12 +++---- bootstrap/windows-48/SYSTEM.h | 49 +++++++++++-------------- bootstrap/windows-48/Strings.c | 2 +- bootstrap/windows-48/Strings.h | 2 +- bootstrap/windows-48/Texts.c | 2 +- bootstrap/windows-48/Texts.h | 2 +- bootstrap/windows-48/Vishap.c | 2 +- bootstrap/windows-48/errors.c | 2 +- bootstrap/windows-48/errors.h | 2 +- bootstrap/windows-48/extTools.c | 2 +- bootstrap/windows-48/extTools.h | 2 +- bootstrap/windows-48/vt100.c | 2 +- bootstrap/windows-48/vt100.h | 2 +- bootstrap/windows-88/Configuration.c | 4 +-- bootstrap/windows-88/Configuration.h | 2 +- bootstrap/windows-88/Console.c | 4 +-- bootstrap/windows-88/Console.h | 2 +- bootstrap/windows-88/Files.c | 18 +++++----- bootstrap/windows-88/Files.h | 2 +- bootstrap/windows-88/Heap.c | 32 ++++++++--------- bootstrap/windows-88/Heap.h | 2 +- bootstrap/windows-88/Modules.c | 2 +- bootstrap/windows-88/Modules.h | 2 +- bootstrap/windows-88/OPB.c | 2 +- bootstrap/windows-88/OPB.h | 2 +- bootstrap/windows-88/OPC.c | 2 +- bootstrap/windows-88/OPC.h | 2 +- bootstrap/windows-88/OPM.c | 4 +-- bootstrap/windows-88/OPM.h | 2 +- bootstrap/windows-88/OPP.c | 2 +- bootstrap/windows-88/OPP.h | 2 +- bootstrap/windows-88/OPS.c | 2 +- bootstrap/windows-88/OPS.h | 2 +- bootstrap/windows-88/OPT.c | 2 +- bootstrap/windows-88/OPT.h | 2 +- bootstrap/windows-88/OPV.c | 6 ++-- bootstrap/windows-88/OPV.h | 2 +- bootstrap/windows-88/Platform.c | 54 ++++++++++++++-------------- bootstrap/windows-88/Platform.h | 6 ++-- bootstrap/windows-88/Reals.c | 14 ++++---- bootstrap/windows-88/Reals.h | 2 +- bootstrap/windows-88/SYSTEM.c | 12 +++---- bootstrap/windows-88/SYSTEM.h | 49 +++++++++++-------------- bootstrap/windows-88/Strings.c | 2 +- bootstrap/windows-88/Strings.h | 2 +- bootstrap/windows-88/Texts.c | 2 +- bootstrap/windows-88/Texts.h | 2 +- bootstrap/windows-88/Vishap.c | 2 +- bootstrap/windows-88/errors.c | 2 +- bootstrap/windows-88/errors.h | 2 +- bootstrap/windows-88/extTools.c | 2 +- bootstrap/windows-88/extTools.h | 2 +- bootstrap/windows-88/vt100.c | 2 +- bootstrap/windows-88/vt100.h | 2 +- src/compiler/OPV.Mod | 4 +-- src/system/Heap.Mod | 2 +- src/system/Platformunix.Mod | 10 +++--- src/system/Platformwindows.Mod | 44 +++++++++++------------ src/system/SYSTEM.c | 12 +++---- src/system/SYSTEM.h | 49 +++++++++++-------------- 211 files changed, 646 insertions(+), 688 deletions(-) diff --git a/bootstrap/unix-44/Configuration.c b/bootstrap/unix-44/Configuration.c index 922a8909..821dff97 100644 --- a/bootstrap/unix-44/Configuration.c +++ b/bootstrap/unix-44/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" @@ -13,6 +13,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("1.95 [2016/08/22] for gcc LP64 on cygwin", Configuration_versionLong, 41); + __MOVE("1.95 [2016/08/23] for gcc LP64 on cygwin", Configuration_versionLong, 41); __ENDMOD; } diff --git a/bootstrap/unix-44/Configuration.h b/bootstrap/unix-44/Configuration.h index 0f37ea7b..ec5e865a 100644 --- a/bootstrap/unix-44/Configuration.h +++ b/bootstrap/unix-44/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/unix-44/Console.c b/bootstrap/unix-44/Console.c index f6d10226..f9161937 100644 --- a/bootstrap/unix-44/Console.c +++ b/bootstrap/unix-44/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Platform.h" @@ -21,7 +21,7 @@ export void Console_String (CHAR *s, LONGINT s__len); void Console_Flush (void) { INTEGER error; - error = Platform_Write(((LONGINT)(1)), (LONGINT)(uintptr_t)Console_line, Console_pos); + error = Platform_Write(((LONGINT)(1)), (LONGINT)(SYSTEM_ADDRESS)Console_line, Console_pos); Console_pos = 0; } diff --git a/bootstrap/unix-44/Console.h b/bootstrap/unix-44/Console.h index 710d1451..5fdd4e4d 100644 --- a/bootstrap/unix-44/Console.h +++ b/bootstrap/unix-44/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/unix-44/Files.c b/bootstrap/unix-44/Files.c index e83999fd..5a1dd875 100644 --- a/bootstrap/unix-44/Files.c +++ b/bootstrap/unix-44/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "Console.h" @@ -257,7 +257,7 @@ static void Files_Flush (Files_Buffer buf) if (buf->org != f->pos) { error = Platform_Seek(f->fd, buf->org, Platform_SeekSet); } - error = Platform_Write(f->fd, (LONGINT)(uintptr_t)buf->data, buf->size); + error = Platform_Write(f->fd, (LONGINT)(SYSTEM_ADDRESS)buf->data, buf->size); if (error != 0) { Files_Err((CHAR*)"error writing file", (LONGINT)19, f, error); } @@ -656,7 +656,7 @@ void Files_ReadBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT x } else { min = n; } - __MOVE((LONGINT)(uintptr_t)buf->data + offset, (LONGINT)(uintptr_t)x + xpos, min); + __MOVE((LONGINT)(SYSTEM_ADDRESS)buf->data + offset, (LONGINT)(SYSTEM_ADDRESS)x + xpos, min); offset += min; (*r).offset = offset; xpos += min; @@ -721,7 +721,7 @@ void Files_WriteBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT } else { min = n; } - __MOVE((LONGINT)(uintptr_t)x + xpos, (LONGINT)(uintptr_t)buf->data + offset, min); + __MOVE((LONGINT)(SYSTEM_ADDRESS)x + xpos, (LONGINT)(SYSTEM_ADDRESS)buf->data + offset, min); offset += min; (*r).offset = offset; if (offset > buf->size) { @@ -772,15 +772,15 @@ void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, INT *res = 3; return; } - error = Platform_Read(fdold, (LONGINT)(uintptr_t)buf, ((LONGINT)(4096)), &n); + error = Platform_Read(fdold, (LONGINT)(SYSTEM_ADDRESS)buf, ((LONGINT)(4096)), &n); while (n > 0) { - error = Platform_Write(fdnew, (LONGINT)(uintptr_t)buf, n); + error = Platform_Write(fdnew, (LONGINT)(SYSTEM_ADDRESS)buf, n); if (error != 0) { ignore = Platform_Close(fdold); ignore = Platform_Close(fdnew); Files_Err((CHAR*)"cannot move file", (LONGINT)17, NIL, error); } - error = Platform_Read(fdold, (LONGINT)(uintptr_t)buf, ((LONGINT)(4096)), &n); + error = Platform_Read(fdold, (LONGINT)(SYSTEM_ADDRESS)buf, ((LONGINT)(4096)), &n); } ignore = Platform_Close(fdold); ignore = Platform_Close(fdnew); @@ -838,7 +838,7 @@ static void Files_FlipBytes (SYSTEM_BYTE *src, LONGINT src__len, SYSTEM_BYTE *de j += 1; } } else { - __MOVE((LONGINT)(uintptr_t)src, (LONGINT)(uintptr_t)dest, src__len); + __MOVE((LONGINT)(SYSTEM_ADDRESS)src, (LONGINT)(SYSTEM_ADDRESS)dest, src__len); } } @@ -1008,7 +1008,7 @@ static void Files_Finalize (SYSTEM_PTR o) { Files_File f = NIL; LONGINT res; - f = (Files_File)(uintptr_t)o; + f = (Files_File)(SYSTEM_ADDRESS)o; if (f->fd >= 0) { Files_CloseOSFile(f); if (f->tempFile) { diff --git a/bootstrap/unix-44/Files.h b/bootstrap/unix-44/Files.h index 7fe886a0..a4a4ea8c 100644 --- a/bootstrap/unix-44/Files.h +++ b/bootstrap/unix-44/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/unix-44/Heap.c b/bootstrap/unix-44/Heap.c index 55f46a85..30ec687a 100644 --- a/bootstrap/unix-44/Heap.c +++ b/bootstrap/unix-44/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tskSfF */ #include "SYSTEM.h" struct Heap__1 { @@ -101,7 +101,7 @@ export void Heap_Unlock (void); extern void *Heap__init(); extern LONGINT Platform_MainStackFrame; extern LONGINT Platform_OSAllocate(LONGINT size); -#define Heap_FetchAddress(pointer) (LONGINT)(uintptr_t)(*((void**)((uintptr_t)pointer))) +#define Heap_FetchAddress(pointer) (LONGINT)(SYSTEM_ADDRESS)(*((void**)((SYSTEM_ADDRESS)pointer))) #define Heap_HeapModuleInit() Heap__init() #define Heap_OSAllocate(size) Platform_OSAllocate(size) #define Heap_PlatformHalt(code) Platform_Halt(code) @@ -134,7 +134,7 @@ SYSTEM_PTR Heap_REGMOD (Heap_ModuleName name, Heap_EnumProc enumPtrs) __COPY(name, m->name, ((LONGINT)(20))); m->refcnt = 0; m->enumPtrs = enumPtrs; - m->next = (Heap_Module)(uintptr_t)Heap_modules; + m->next = (Heap_Module)(SYSTEM_ADDRESS)Heap_modules; Heap_modules = (SYSTEM_PTR)m; _o_result = (void*)m; return _o_result; @@ -315,7 +315,7 @@ SYSTEM_PTR Heap_NEWREC (LONGINT tag) __PUT(adr + 8, 0, LONGINT); Heap_allocated += blksz; Heap_Unlock(); - _o_result = (SYSTEM_PTR)(uintptr_t)(adr + 4); + _o_result = (SYSTEM_PTR)(SYSTEM_ADDRESS)(adr + 4); return _o_result; } @@ -326,12 +326,12 @@ SYSTEM_PTR Heap_NEWBLK (LONGINT size) SYSTEM_PTR new; Heap_Lock(); blksz = __ASHL(__ASHR(size + 31, 4), 4); - new = Heap_NEWREC((LONGINT)(uintptr_t)&blksz); - tag = ((LONGINT)(uintptr_t)new + blksz) - 12; + new = Heap_NEWREC((LONGINT)(SYSTEM_ADDRESS)&blksz); + tag = ((LONGINT)(SYSTEM_ADDRESS)new + blksz) - 12; __PUT(tag - 4, 0, LONGINT); __PUT(tag, blksz, LONGINT); __PUT(tag + 4, -4, LONGINT); - __PUT((LONGINT)(uintptr_t)new - 4, tag, LONGINT); + __PUT((LONGINT)(SYSTEM_ADDRESS)new - 4, tag, LONGINT); Heap_Unlock(); _o_result = new; return _o_result; @@ -360,7 +360,7 @@ static void Heap_Mark (LONGINT q) __GET(tag, offset, LONGINT); fld = q + offset; p = Heap_FetchAddress(fld); - __PUT(fld, (SYSTEM_PTR)(uintptr_t)n, SYSTEM_PTR); + __PUT(fld, (SYSTEM_PTR)(SYSTEM_ADDRESS)n, SYSTEM_PTR); } else { fld = q + offset; n = Heap_FetchAddress(fld); @@ -369,7 +369,7 @@ static void Heap_Mark (LONGINT q) if (!__ODD(tagbits)) { __PUT(n - 4, tagbits + 1, LONGINT); __PUT(q - 4, tag + 1, LONGINT); - __PUT(fld, (SYSTEM_PTR)(uintptr_t)p, SYSTEM_PTR); + __PUT(fld, (SYSTEM_PTR)(SYSTEM_ADDRESS)p, SYSTEM_PTR); p = q; q = n; tag = tagbits; @@ -384,7 +384,7 @@ static void Heap_Mark (LONGINT q) static void Heap_MarkP (SYSTEM_PTR p) { - Heap_Mark((LONGINT)(uintptr_t)p); + Heap_Mark((LONGINT)(SYSTEM_ADDRESS)p); } static void Heap_Scan (void) @@ -553,7 +553,7 @@ static void Heap_Finalize (void) } else { prev->next = n->next; } - (*n->finalize)((SYSTEM_PTR)(uintptr_t)n->obj); + (*n->finalize)((SYSTEM_PTR)(SYSTEM_ADDRESS)n->obj); if (prev == NIL) { n = Heap_fin; } else { @@ -572,7 +572,7 @@ void Heap_FINALL (void) while (Heap_fin != NIL) { n = Heap_fin; Heap_fin = Heap_fin->next; - (*n->finalize)((SYSTEM_PTR)(uintptr_t)n->obj); + (*n->finalize)((SYSTEM_PTR)(SYSTEM_ADDRESS)n->obj); } } @@ -589,9 +589,9 @@ static void Heap_MarkStack (LONGINT n, LONGINT *cand, LONGINT cand__len) } if (n == 0) { nofcand = 0; - sp = (LONGINT)(uintptr_t)&frame; + sp = (LONGINT)(SYSTEM_ADDRESS)&frame; stack0 = Heap_PlatformMainStackFrame(); - inc = (LONGINT)(uintptr_t)&align.p - (LONGINT)(uintptr_t)&align; + inc = (LONGINT)(SYSTEM_ADDRESS)&align.p - (LONGINT)(SYSTEM_ADDRESS)&align; if (sp > stack0) { inc = -inc; } @@ -622,7 +622,7 @@ void Heap_GC (BOOLEAN markStack) LONGINT cand[10000]; if (Heap_lockdepth == 0 || (Heap_lockdepth == 1 && !markStack)) { Heap_Lock(); - m = (Heap_Module)(uintptr_t)Heap_modules; + m = (Heap_Module)(SYSTEM_ADDRESS)Heap_modules; while (m != NIL) { if (m->enumPtrs != NIL) { (*m->enumPtrs)(Heap_MarkP); @@ -699,7 +699,7 @@ void Heap_RegisterFinalizer (SYSTEM_PTR obj, Heap_Finalizer finalize) { Heap_FinNode f; __NEW(f, Heap_FinDesc); - f->obj = (LONGINT)(uintptr_t)obj; + f->obj = (LONGINT)(SYSTEM_ADDRESS)obj; f->finalize = finalize; f->marked = 1; f->next = Heap_fin; diff --git a/bootstrap/unix-44/Heap.h b/bootstrap/unix-44/Heap.h index ef7348cf..a2cab30c 100644 --- a/bootstrap/unix-44/Heap.h +++ b/bootstrap/unix-44/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tskSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/unix-44/Modules.c b/bootstrap/unix-44/Modules.c index f69edc96..330b7506 100644 --- a/bootstrap/unix-44/Modules.c +++ b/bootstrap/unix-44/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Console.h" #include "Heap.h" diff --git a/bootstrap/unix-44/Modules.h b/bootstrap/unix-44/Modules.h index 3c0af484..ac8ac89e 100644 --- a/bootstrap/unix-44/Modules.h +++ b/bootstrap/unix-44/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/unix-44/OPB.c b/bootstrap/unix-44/OPB.c index be093f93..0f614e6a 100644 --- a/bootstrap/unix-44/OPB.c +++ b/bootstrap/unix-44/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPM.h" #include "OPS.h" diff --git a/bootstrap/unix-44/OPB.h b/bootstrap/unix-44/OPB.h index cd52fbdd..d1c88266 100644 --- a/bootstrap/unix-44/OPB.h +++ b/bootstrap/unix-44/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/unix-44/OPC.c b/bootstrap/unix-44/OPC.c index 617bf8e8..3abccc9a 100644 --- a/bootstrap/unix-44/OPC.c +++ b/bootstrap/unix-44/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "OPM.h" diff --git a/bootstrap/unix-44/OPC.h b/bootstrap/unix-44/OPC.h index 6d5f3632..b7d34a07 100644 --- a/bootstrap/unix-44/OPC.h +++ b/bootstrap/unix-44/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/unix-44/OPM.c b/bootstrap/unix-44/OPM.c index db989d91..bf683e41 100644 --- a/bootstrap/unix-44/OPM.c +++ b/bootstrap/unix-44/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "Console.h" @@ -544,15 +544,15 @@ void OPM_FPrintReal (LONGINT *fp, REAL real) { INTEGER i; LONGINT l; - __GET((LONGINT)(uintptr_t)&real, l, LONGINT); + __GET((LONGINT)(SYSTEM_ADDRESS)&real, l, LONGINT); OPM_FPrint(&*fp, l); } void OPM_FPrintLReal (LONGINT *fp, LONGREAL lr) { LONGINT l, h; - __GET((LONGINT)(uintptr_t)&lr, l, LONGINT); - __GET((LONGINT)(uintptr_t)&lr + 4, h, LONGINT); + __GET((LONGINT)(SYSTEM_ADDRESS)&lr, l, LONGINT); + __GET((LONGINT)(SYSTEM_ADDRESS)&lr + 4, h, LONGINT); OPM_FPrint(&*fp, l); OPM_FPrint(&*fp, h); } diff --git a/bootstrap/unix-44/OPM.h b/bootstrap/unix-44/OPM.h index 1daa7dac..ed914bff 100644 --- a/bootstrap/unix-44/OPM.h +++ b/bootstrap/unix-44/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPM__h #define OPM__h diff --git a/bootstrap/unix-44/OPP.c b/bootstrap/unix-44/OPP.c index 447f956e..d9698b7e 100644 --- a/bootstrap/unix-44/OPP.c +++ b/bootstrap/unix-44/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPB.h" #include "OPM.h" diff --git a/bootstrap/unix-44/OPP.h b/bootstrap/unix-44/OPP.h index 6e6eb0af..bf56b7d7 100644 --- a/bootstrap/unix-44/OPP.h +++ b/bootstrap/unix-44/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/unix-44/OPS.c b/bootstrap/unix-44/OPS.c index 474724c8..cacf9256 100644 --- a/bootstrap/unix-44/OPS.c +++ b/bootstrap/unix-44/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */ #include "SYSTEM.h" #include "OPM.h" diff --git a/bootstrap/unix-44/OPS.h b/bootstrap/unix-44/OPS.h index 367bfc1b..e901bcfc 100644 --- a/bootstrap/unix-44/OPS.h +++ b/bootstrap/unix-44/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/unix-44/OPT.c b/bootstrap/unix-44/OPT.c index 3e2611b8..b32d0ebd 100644 --- a/bootstrap/unix-44/OPT.c +++ b/bootstrap/unix-44/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPM.h" #include "OPS.h" diff --git a/bootstrap/unix-44/OPT.h b/bootstrap/unix-44/OPT.h index 3c3bb75b..41b3e7ec 100644 --- a/bootstrap/unix-44/OPT.h +++ b/bootstrap/unix-44/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/unix-44/OPV.c b/bootstrap/unix-44/OPV.c index 85aca692..cf646f5e 100644 --- a/bootstrap/unix-44/OPV.c +++ b/bootstrap/unix-44/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPC.h" #include "OPM.h" @@ -931,7 +931,7 @@ static void OPV_expr (OPT_Node n, INTEGER prec) OPM_Write(')'); break; case 24: - OPM_WriteString((CHAR*)"(LONGINT)(uintptr_t)", (LONGINT)21); + OPM_WriteString((CHAR*)"(LONGINT)(SYSTEM_ADDRESS)", (LONGINT)26); if (l->class == 1) { OPC_CompleteIdent(l->obj); } else { @@ -947,7 +947,7 @@ static void OPV_expr (OPT_Node n, INTEGER prec) OPC_Ident(n->typ->strobj); OPM_Write(')'); if (__IN(n->typ->form, 0x6000) || __IN(l->typ->form, 0x6000)) { - OPM_WriteString((CHAR*)"(uintptr_t)", (LONGINT)12); + OPM_WriteString((CHAR*)"(SYSTEM_ADDRESS)", (LONGINT)17); } OPV_expr(l, exprPrec); } else { diff --git a/bootstrap/unix-44/OPV.h b/bootstrap/unix-44/OPV.h index c0e4b80e..04828b2f 100644 --- a/bootstrap/unix-44/OPV.h +++ b/bootstrap/unix-44/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/unix-44/Platform.c b/bootstrap/unix-44/Platform.c index 96fa36a1..74c43788 100644 --- a/bootstrap/unix-44/Platform.c +++ b/bootstrap/unix-44/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" typedef @@ -118,14 +118,14 @@ 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) (LONGINT)(uintptr_t)((void*)malloc((size_t)size)) +#define Platform_allocate(size) (LONGINT)(SYSTEM_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 #define Platform_errc(c) write(1, &c, 1) #define Platform_errstring(s, s__len) write(1, s, s__len-1) #define Platform_exit(code) exit(code) -#define Platform_free(address) free((void*)(uintptr_t)address) +#define Platform_free(address) free((void*)(SYSTEM_ADDRESS)address) #define Platform_fstat(fd) fstat(fd, &s) #define Platform_fsync(fd) fsync(fd) #define Platform_ftruncate(fd, l) ftruncate(fd, l) @@ -138,13 +138,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_t)(p), l) +#define Platform_readfile(fd, p, l) read(fd, (void*)(SYSTEM_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_t)h) +#define Platform_sethandler(s, h) SystemSetHandler(s, (SYSTEM_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 @@ -161,7 +161,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_t)(p), l) +#define Platform_writefile(fd, p, l) write(fd, (void*)(SYSTEM_ADDRESS)(p), l) BOOLEAN Platform_TooManyFiles (INTEGER e) { @@ -229,7 +229,7 @@ void Platform_Init (INTEGER argc, LONGINT argvadr) Platform_ArgVecPtr av = NIL; Platform_MainStackFrame = argvadr; Platform_ArgCount = argc; - av = (Platform_ArgVecPtr)(uintptr_t)argvadr; + av = (Platform_ArgVecPtr)(SYSTEM_ADDRESS)argvadr; Platform_ArgVector = (*av)[0]; Platform_HaltCode = -128; Platform_HeapInitHeap(); @@ -262,7 +262,7 @@ void Platform_GetArg (INTEGER n, CHAR *val, LONGINT val__len) { Platform_ArgVec av = NIL; if (n < Platform_ArgCount) { - av = (Platform_ArgVec)(uintptr_t)Platform_ArgVector; + av = (Platform_ArgVec)(SYSTEM_ADDRESS)Platform_ArgVector; __COPY(*(*av)[__X(n, ((LONGINT)(1024)))], val, val__len); } } @@ -529,7 +529,7 @@ INTEGER Platform_Read (LONGINT h, LONGINT p, LONGINT l, LONGINT *n) INTEGER Platform_ReadBuf (LONGINT h, SYSTEM_BYTE *b, LONGINT b__len, LONGINT *n) { INTEGER _o_result; - *n = Platform_readfile(h, (LONGINT)(uintptr_t)b, b__len); + *n = Platform_readfile(h, (LONGINT)(SYSTEM_ADDRESS)b, b__len); if (*n < 0) { *n = 0; _o_result = Platform_err(); @@ -765,7 +765,7 @@ static void Platform_TestLittleEndian (void) { INTEGER i; i = 1; - __GET((LONGINT)(uintptr_t)&i, Platform_LittleEndian, BOOLEAN); + __GET((LONGINT)(SYSTEM_ADDRESS)&i, Platform_LittleEndian, BOOLEAN); } __TDESC(Platform_FileIdentity, 1, 0) = {__TDFLDS("FileIdentity", 12), {-4}}; diff --git a/bootstrap/unix-44/Platform.h b/bootstrap/unix-44/Platform.h index 7cd729b9..dd5ce434 100644 --- a/bootstrap/unix-44/Platform.h +++ b/bootstrap/unix-44/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/unix-44/Reals.c b/bootstrap/unix-44/Reals.c index 43583aa9..2323e34d 100644 --- a/bootstrap/unix-44/Reals.c +++ b/bootstrap/unix-44/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" @@ -58,7 +58,7 @@ INTEGER Reals_Expo (REAL x) { INTEGER _o_result; INTEGER i; - __GET((LONGINT)(uintptr_t)&x + 2, i, INTEGER); + __GET((LONGINT)(SYSTEM_ADDRESS)&x + 2, i, INTEGER); _o_result = __MASK(__ASHR(i, 7), -256); return _o_result; } @@ -66,17 +66,17 @@ INTEGER Reals_Expo (REAL x) void Reals_SetExpo (REAL *x, INTEGER ex) { CHAR c; - __GET((LONGINT)(uintptr_t)x + 3, c, CHAR); - __PUT((LONGINT)(uintptr_t)x + 3, (CHAR)(__ASHL(__ASHR((int)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR); - __GET((LONGINT)(uintptr_t)x + 2, c, CHAR); - __PUT((LONGINT)(uintptr_t)x + 2, (CHAR)(__MASK((int)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR); + __GET((LONGINT)(SYSTEM_ADDRESS)x + 3, c, CHAR); + __PUT((LONGINT)(SYSTEM_ADDRESS)x + 3, (CHAR)(__ASHL(__ASHR((int)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR); + __GET((LONGINT)(SYSTEM_ADDRESS)x + 2, c, CHAR); + __PUT((LONGINT)(SYSTEM_ADDRESS)x + 2, (CHAR)(__MASK((int)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR); } INTEGER Reals_ExpoL (LONGREAL x) { INTEGER _o_result; INTEGER i; - __GET((LONGINT)(uintptr_t)&x + 6, i, INTEGER); + __GET((LONGINT)(SYSTEM_ADDRESS)&x + 6, i, INTEGER); _o_result = __MASK(__ASHR(i, 4), -2048); return _o_result; } diff --git a/bootstrap/unix-44/Reals.h b/bootstrap/unix-44/Reals.h index fdae5f89..7e6b534c 100644 --- a/bootstrap/unix-44/Reals.h +++ b/bootstrap/unix-44/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/unix-44/SYSTEM.c b/bootstrap/unix-44/SYSTEM.c index 50e91c6d..33511a70 100644 --- a/bootstrap/unix-44/SYSTEM.c +++ b/bootstrap/unix-44/SYSTEM.c @@ -35,7 +35,7 @@ void SYSTEM_INHERIT(LONGINT *t, LONGINT *t0) void SYSTEM_ENUMP(void *adr, LONGINT n, void (*P)()) { while (n > 0) { - P((LONGINT)(uintptr_t)(*((void**)(adr)))); + P((LONGINT)(SYSTEM_ADDRESS)(*((void**)(adr)))); adr = ((void**)adr) + 1; n--; } @@ -106,7 +106,7 @@ SYSTEM_PTR SYSTEM_NEWARR(LONGINT *typ, LONGINT elemsz, int elemalgn, int nofdim, else if (typ == (LONGINT*)POINTER__typ) { /* element type is a pointer */ x = Heap_NEWBLK(size + nofelems * sizeof(LONGINT)); - p = (LONGINT*)(uintptr_t)x[-1]; + p = (LONGINT*)(SYSTEM_ADDRESS)x[-1]; p[-nofelems] = *p; /* build new type desc in situ: 1. copy block size; 2. setup ptr tab; 3. set sentinel; 4. patch tag */ p -= nofelems - 1; n = 1; /* n =1 for skipping the size field */ while (n <= nofelems) {*p = n*sizeof(LONGINT); p++; n++;} @@ -119,7 +119,7 @@ SYSTEM_PTR SYSTEM_NEWARR(LONGINT *typ, LONGINT elemsz, int elemalgn, int nofdim, while (ptab[nofptrs] >= 0) {nofptrs++;} /* number of pointers per element */ nptr = nofelems * nofptrs; /* total number of pointers */ x = Heap_NEWBLK(size + nptr * sizeof(LONGINT)); - p = (LONGINT*)(uintptr_t)x[- 1]; + p = (LONGINT*)(SYSTEM_ADDRESS)x[- 1]; p[-nptr] = *p; /* build new type desc in situ; 1. copy block size; 2. setup ptr tab; 3. set sentinel; 4. patch tag */ p -= nptr - 1; n = 0; off = dataoff; while (n < nofelems) {i = 0; @@ -155,7 +155,7 @@ typedef void (*SystemSignalHandler)(INTEGER); // = Platform_SignalHandler // (Ignore other signals) } - void SystemSetHandler(int s, uintptr_t h) { + void SystemSetHandler(int s, SYSTEM_ADDRESS h) { if (s >= 2 && s <= 4) { int needtosetsystemhandler = handler[s-2] == 0; handler[s-2] = (SystemSignalHandler)h; @@ -194,12 +194,12 @@ typedef void (*SystemSignalHandler)(INTEGER); // = Platform_SignalHandler } } - void SystemSetInterruptHandler(uintptr_t h) { + void SystemSetInterruptHandler(SYSTEM_ADDRESS h) { EnsureConsoleCtrlHandler(); SystemInterruptHandler = (SystemSignalHandler)h; } - void SystemSetQuitHandler(uintptr_t h) { + void SystemSetQuitHandler(SYSTEM_ADDRESS h) { EnsureConsoleCtrlHandler(); SystemQuitHandler = (SystemSignalHandler)h; } diff --git a/bootstrap/unix-44/SYSTEM.h b/bootstrap/unix-44/SYSTEM.h index 1c0b07fd..75a0aa52 100644 --- a/bootstrap/unix-44/SYSTEM.h +++ b/bootstrap/unix-44/SYSTEM.h @@ -18,23 +18,16 @@ typedef unsigned char SYSTEM_CARD8; #if (__SIZEOF_POINTER__ == 8) #if defined(_WIN64) - typedef unsigned long long SYSTEM_PTRINT; - typedef unsigned long long uintptr_t; - typedef unsigned long long size_t; + typedef unsigned long long SYSTEM_ADDRESS; #else - typedef unsigned long SYSTEM_PTRINT; - typedef unsigned long uintptr_t; - typedef unsigned long size_t; + typedef unsigned long SYSTEM_ADDRESS; #endif #else - typedef unsigned int SYSTEM_PTRINT; - typedef unsigned int uintptr_t; - typedef unsigned int size_t; + typedef unsigned int SYSTEM_ADDRESS; #endif -#define _SIZE_T_DEFINED_ // For OpenBSD -void *memcpy(void *dest, const void *source, size_t size); +void *memcpy(void *dest, const void *source, SYSTEM_ADDRESS size); @@ -111,10 +104,10 @@ extern LONGINT SYSTEM_ENTIER (double x); // Signal handling in SYSTEM.c #ifndef _WIN32 - extern void SystemSetHandler(int s, uintptr_t h); + extern void SystemSetHandler(int s, SYSTEM_ADDRESS h); #else - extern void SystemSetInterruptHandler(uintptr_t h); - extern void SystemSetQuitHandler (uintptr_t h); + extern void SystemSetInterruptHandler(SYSTEM_ADDRESS h); + extern void SystemSetQuitHandler (SYSTEM_ADDRESS h); #endif @@ -137,9 +130,9 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __COPY(s, d, n) {char*_a=(void*)s,*_b=(void*)d; LONGINT _i=0,_t=n-1; \ while(_i<_t&&((_b[_i]=_a[_i])!=0)){_i++;};_b[_i]=0;} -#define __DUP(x, l, t) x=(void*)memcpy((void*)(uintptr_t)Platform_OSAllocate(l*sizeof(t)),x,l*sizeof(t)) +#define __DUP(x, l, t) x=(void*)memcpy((void*)(SYSTEM_ADDRESS)Platform_OSAllocate(l*sizeof(t)),x,l*sizeof(t)) #define __DUPARR(v, t) v=(void*)memcpy(v##__copy,v,sizeof(t)) -#define __DEL(x) Platform_OSFree((LONGINT)(uintptr_t)x) +#define __DEL(x) Platform_OSFree((LONGINT)(SYSTEM_ADDRESS)x) @@ -149,8 +142,8 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __VAL(t, x) (*(t*)&(x)) -#define __GET(a, x, t) x= *(t*)(uintptr_t)(a) -#define __PUT(a, x, t) *(t*)(uintptr_t)(a)=x +#define __GET(a, x, t) x= *(t*)(SYSTEM_ADDRESS)(a) +#define __PUT(a, x, t) *(t*)(SYSTEM_ADDRESS)(a)=x #define __LSHL(x, n, t) ((t)((U_##t)(x)<<(n))) #define __LSHR(x, n, t) ((t)((U_##t)(x)>>(n))) @@ -165,7 +158,7 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __ROT(x, n, t) ((n)>=0? __ROTL(x, n, t): __ROTR(x, -(n), t)) #define __BIT(x, n) (*(U_LONGINT*)(x)>>(n)&1) -#define __MOVE(s, d, n) memcpy((char*)(uintptr_t)(d),(char*)(uintptr_t)(s),n) +#define __MOVE(s, d, n) memcpy((char*)(SYSTEM_ADDRESS)(d),(char*)(SYSTEM_ADDRESS)(s),n) #define __ASHF(x, n) SYSTEM_ASH((LONGINT)(x), (LONGINT)(n)) #define __SHORT(x, y) ((int)((U_LONGINT)(x)+(y)<(y)+(y)?(x):(__HALT(-8),0))) #define __SHORTF(x, y) ((int)(__RF((x)+(y),(y)+(y))-(y))) @@ -226,7 +219,7 @@ extern void Heap_INCREF(); extern void Platform_Init(INTEGER argc, LONGINT argv); extern void Heap_FINALL(); -#define __INIT(argc, argv) static void *m; Platform_Init((INTEGER)argc, (LONGINT)(uintptr_t)&argv); +#define __INIT(argc, argv) static void *m; Platform_Init((INTEGER)argc, (LONGINT)(SYSTEM_ADDRESS)&argv); #define __REGMAIN(name, enum) m = Heap_REGMOD((CHAR*)name,enum) #define __FINI Heap_FINALL(); return 0 @@ -247,7 +240,7 @@ extern SYSTEM_PTR Heap_NEWREC (LONGINT tag); extern SYSTEM_PTR SYSTEM_NEWARR(LONGINT*, LONGINT, int, int, int, ...); #define __SYSNEW(p, len) p = Heap_NEWBLK((LONGINT)(len)) -#define __NEW(p, t) p = Heap_NEWREC((LONGINT)(uintptr_t)t##__typ) +#define __NEW(p, t) p = Heap_NEWREC((LONGINT)(SYSTEM_ADDRESS)t##__typ) #define __NEWARR SYSTEM_NEWARR @@ -278,20 +271,20 @@ extern SYSTEM_PTR SYSTEM_NEWARR(LONGINT*, LONGINT, int, int, int, ...); #define __INITYP(t, t0, level) \ t##__typ = (LONGINT*)&t##__desc.blksz; \ memcpy(t##__desc.basep, t0##__typ - __BASEOFF, level*sizeof(LONGINT)); \ - t##__desc.basep[level] = (LONGINT)(uintptr_t)t##__typ; \ - t##__desc.module = (LONGINT)(uintptr_t)m; \ + t##__desc.basep[level] = (LONGINT)(SYSTEM_ADDRESS)t##__typ; \ + t##__desc.module = (LONGINT)(SYSTEM_ADDRESS)m; \ if(t##__desc.blksz!=sizeof(struct t)) __HALT(-15); \ t##__desc.blksz = (t##__desc.blksz+5*sizeof(LONGINT)-1)/(4*sizeof(LONGINT))*(4*sizeof(LONGINT)); \ - Heap_REGTYP(m, (LONGINT)(uintptr_t)&t##__desc.next); \ + Heap_REGTYP(m, (LONGINT)(SYSTEM_ADDRESS)&t##__desc.next); \ SYSTEM_INHERIT(t##__typ, t0##__typ) -#define __IS(tag, typ, level) (*(tag-(__BASEOFF-level))==(LONGINT)(uintptr_t)typ##__typ) -#define __TYPEOF(p) ((LONGINT*)(uintptr_t)(*(((LONGINT*)(p))-1))) +#define __IS(tag, typ, level) (*(tag-(__BASEOFF-level))==(LONGINT)(SYSTEM_ADDRESS)typ##__typ) +#define __TYPEOF(p) ((LONGINT*)(SYSTEM_ADDRESS)(*(((LONGINT*)(p))-1))) #define __ISP(p, typ, level) __IS(__TYPEOF(p),typ,level) // Oberon-2 type bound procedures support -#define __INITBP(t, proc, num) *(t##__typ-(__TPROC0OFF+num))=(LONGINT)(uintptr_t)proc -#define __SEND(typ, num, funtyp, parlist) ((funtyp)((uintptr_t)*(typ-(__TPROC0OFF+num))))parlist +#define __INITBP(t, proc, num) *(t##__typ-(__TPROC0OFF+num))=(LONGINT)(SYSTEM_ADDRESS)proc +#define __SEND(typ, num, funtyp, parlist) ((funtyp)((SYSTEM_ADDRESS)*(typ-(__TPROC0OFF+num))))parlist diff --git a/bootstrap/unix-44/Strings.c b/bootstrap/unix-44/Strings.c index 51468a69..115456ea 100644 --- a/bootstrap/unix-44/Strings.c +++ b/bootstrap/unix-44/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" diff --git a/bootstrap/unix-44/Strings.h b/bootstrap/unix-44/Strings.h index 4245a515..96dbb01d 100644 --- a/bootstrap/unix-44/Strings.h +++ b/bootstrap/unix-44/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/unix-44/Texts.c b/bootstrap/unix-44/Texts.c index 24941032..9ab3b430 100644 --- a/bootstrap/unix-44/Texts.c +++ b/bootstrap/unix-44/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Files.h" #include "Modules.h" diff --git a/bootstrap/unix-44/Texts.h b/bootstrap/unix-44/Texts.h index 56de11ac..777a6c22 100644 --- a/bootstrap/unix-44/Texts.h +++ b/bootstrap/unix-44/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/unix-44/Vishap.c b/bootstrap/unix-44/Vishap.c index 97c8c849..4c9e3b45 100644 --- a/bootstrap/unix-44/Vishap.c +++ b/bootstrap/unix-44/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkamSf */ #include "SYSTEM.h" #include "Configuration.h" #include "Heap.h" diff --git a/bootstrap/unix-44/errors.c b/bootstrap/unix-44/errors.c index 3facbaa9..68e433df 100644 --- a/bootstrap/unix-44/errors.c +++ b/bootstrap/unix-44/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" typedef diff --git a/bootstrap/unix-44/errors.h b/bootstrap/unix-44/errors.h index 719043cb..41d399ad 100644 --- a/bootstrap/unix-44/errors.h +++ b/bootstrap/unix-44/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/unix-44/extTools.c b/bootstrap/unix-44/extTools.c index 7785adc7..4efd107a 100644 --- a/bootstrap/unix-44/extTools.c +++ b/bootstrap/unix-44/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "Console.h" diff --git a/bootstrap/unix-44/extTools.h b/bootstrap/unix-44/extTools.h index b189ebeb..fc4f0da1 100644 --- a/bootstrap/unix-44/extTools.h +++ b/bootstrap/unix-44/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/unix-44/vt100.c b/bootstrap/unix-44/vt100.c index 891d7e43..d77b0b84 100644 --- a/bootstrap/unix-44/vt100.c +++ b/bootstrap/unix-44/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Console.h" #include "Strings.h" diff --git a/bootstrap/unix-44/vt100.h b/bootstrap/unix-44/vt100.h index 9a9a6144..4af04d6e 100644 --- a/bootstrap/unix-44/vt100.h +++ b/bootstrap/unix-44/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef vt100__h #define vt100__h diff --git a/bootstrap/unix-48/Configuration.c b/bootstrap/unix-48/Configuration.c index 922a8909..821dff97 100644 --- a/bootstrap/unix-48/Configuration.c +++ b/bootstrap/unix-48/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" @@ -13,6 +13,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("1.95 [2016/08/22] for gcc LP64 on cygwin", Configuration_versionLong, 41); + __MOVE("1.95 [2016/08/23] for gcc LP64 on cygwin", Configuration_versionLong, 41); __ENDMOD; } diff --git a/bootstrap/unix-48/Configuration.h b/bootstrap/unix-48/Configuration.h index 0f37ea7b..ec5e865a 100644 --- a/bootstrap/unix-48/Configuration.h +++ b/bootstrap/unix-48/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/unix-48/Console.c b/bootstrap/unix-48/Console.c index f6d10226..f9161937 100644 --- a/bootstrap/unix-48/Console.c +++ b/bootstrap/unix-48/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Platform.h" @@ -21,7 +21,7 @@ export void Console_String (CHAR *s, LONGINT s__len); void Console_Flush (void) { INTEGER error; - error = Platform_Write(((LONGINT)(1)), (LONGINT)(uintptr_t)Console_line, Console_pos); + error = Platform_Write(((LONGINT)(1)), (LONGINT)(SYSTEM_ADDRESS)Console_line, Console_pos); Console_pos = 0; } diff --git a/bootstrap/unix-48/Console.h b/bootstrap/unix-48/Console.h index 710d1451..5fdd4e4d 100644 --- a/bootstrap/unix-48/Console.h +++ b/bootstrap/unix-48/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/unix-48/Files.c b/bootstrap/unix-48/Files.c index e83999fd..5a1dd875 100644 --- a/bootstrap/unix-48/Files.c +++ b/bootstrap/unix-48/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "Console.h" @@ -257,7 +257,7 @@ static void Files_Flush (Files_Buffer buf) if (buf->org != f->pos) { error = Platform_Seek(f->fd, buf->org, Platform_SeekSet); } - error = Platform_Write(f->fd, (LONGINT)(uintptr_t)buf->data, buf->size); + error = Platform_Write(f->fd, (LONGINT)(SYSTEM_ADDRESS)buf->data, buf->size); if (error != 0) { Files_Err((CHAR*)"error writing file", (LONGINT)19, f, error); } @@ -656,7 +656,7 @@ void Files_ReadBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT x } else { min = n; } - __MOVE((LONGINT)(uintptr_t)buf->data + offset, (LONGINT)(uintptr_t)x + xpos, min); + __MOVE((LONGINT)(SYSTEM_ADDRESS)buf->data + offset, (LONGINT)(SYSTEM_ADDRESS)x + xpos, min); offset += min; (*r).offset = offset; xpos += min; @@ -721,7 +721,7 @@ void Files_WriteBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT } else { min = n; } - __MOVE((LONGINT)(uintptr_t)x + xpos, (LONGINT)(uintptr_t)buf->data + offset, min); + __MOVE((LONGINT)(SYSTEM_ADDRESS)x + xpos, (LONGINT)(SYSTEM_ADDRESS)buf->data + offset, min); offset += min; (*r).offset = offset; if (offset > buf->size) { @@ -772,15 +772,15 @@ void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, INT *res = 3; return; } - error = Platform_Read(fdold, (LONGINT)(uintptr_t)buf, ((LONGINT)(4096)), &n); + error = Platform_Read(fdold, (LONGINT)(SYSTEM_ADDRESS)buf, ((LONGINT)(4096)), &n); while (n > 0) { - error = Platform_Write(fdnew, (LONGINT)(uintptr_t)buf, n); + error = Platform_Write(fdnew, (LONGINT)(SYSTEM_ADDRESS)buf, n); if (error != 0) { ignore = Platform_Close(fdold); ignore = Platform_Close(fdnew); Files_Err((CHAR*)"cannot move file", (LONGINT)17, NIL, error); } - error = Platform_Read(fdold, (LONGINT)(uintptr_t)buf, ((LONGINT)(4096)), &n); + error = Platform_Read(fdold, (LONGINT)(SYSTEM_ADDRESS)buf, ((LONGINT)(4096)), &n); } ignore = Platform_Close(fdold); ignore = Platform_Close(fdnew); @@ -838,7 +838,7 @@ static void Files_FlipBytes (SYSTEM_BYTE *src, LONGINT src__len, SYSTEM_BYTE *de j += 1; } } else { - __MOVE((LONGINT)(uintptr_t)src, (LONGINT)(uintptr_t)dest, src__len); + __MOVE((LONGINT)(SYSTEM_ADDRESS)src, (LONGINT)(SYSTEM_ADDRESS)dest, src__len); } } @@ -1008,7 +1008,7 @@ static void Files_Finalize (SYSTEM_PTR o) { Files_File f = NIL; LONGINT res; - f = (Files_File)(uintptr_t)o; + f = (Files_File)(SYSTEM_ADDRESS)o; if (f->fd >= 0) { Files_CloseOSFile(f); if (f->tempFile) { diff --git a/bootstrap/unix-48/Files.h b/bootstrap/unix-48/Files.h index 7fe886a0..a4a4ea8c 100644 --- a/bootstrap/unix-48/Files.h +++ b/bootstrap/unix-48/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/unix-48/Heap.c b/bootstrap/unix-48/Heap.c index 55f46a85..30ec687a 100644 --- a/bootstrap/unix-48/Heap.c +++ b/bootstrap/unix-48/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tskSfF */ #include "SYSTEM.h" struct Heap__1 { @@ -101,7 +101,7 @@ export void Heap_Unlock (void); extern void *Heap__init(); extern LONGINT Platform_MainStackFrame; extern LONGINT Platform_OSAllocate(LONGINT size); -#define Heap_FetchAddress(pointer) (LONGINT)(uintptr_t)(*((void**)((uintptr_t)pointer))) +#define Heap_FetchAddress(pointer) (LONGINT)(SYSTEM_ADDRESS)(*((void**)((SYSTEM_ADDRESS)pointer))) #define Heap_HeapModuleInit() Heap__init() #define Heap_OSAllocate(size) Platform_OSAllocate(size) #define Heap_PlatformHalt(code) Platform_Halt(code) @@ -134,7 +134,7 @@ SYSTEM_PTR Heap_REGMOD (Heap_ModuleName name, Heap_EnumProc enumPtrs) __COPY(name, m->name, ((LONGINT)(20))); m->refcnt = 0; m->enumPtrs = enumPtrs; - m->next = (Heap_Module)(uintptr_t)Heap_modules; + m->next = (Heap_Module)(SYSTEM_ADDRESS)Heap_modules; Heap_modules = (SYSTEM_PTR)m; _o_result = (void*)m; return _o_result; @@ -315,7 +315,7 @@ SYSTEM_PTR Heap_NEWREC (LONGINT tag) __PUT(adr + 8, 0, LONGINT); Heap_allocated += blksz; Heap_Unlock(); - _o_result = (SYSTEM_PTR)(uintptr_t)(adr + 4); + _o_result = (SYSTEM_PTR)(SYSTEM_ADDRESS)(adr + 4); return _o_result; } @@ -326,12 +326,12 @@ SYSTEM_PTR Heap_NEWBLK (LONGINT size) SYSTEM_PTR new; Heap_Lock(); blksz = __ASHL(__ASHR(size + 31, 4), 4); - new = Heap_NEWREC((LONGINT)(uintptr_t)&blksz); - tag = ((LONGINT)(uintptr_t)new + blksz) - 12; + new = Heap_NEWREC((LONGINT)(SYSTEM_ADDRESS)&blksz); + tag = ((LONGINT)(SYSTEM_ADDRESS)new + blksz) - 12; __PUT(tag - 4, 0, LONGINT); __PUT(tag, blksz, LONGINT); __PUT(tag + 4, -4, LONGINT); - __PUT((LONGINT)(uintptr_t)new - 4, tag, LONGINT); + __PUT((LONGINT)(SYSTEM_ADDRESS)new - 4, tag, LONGINT); Heap_Unlock(); _o_result = new; return _o_result; @@ -360,7 +360,7 @@ static void Heap_Mark (LONGINT q) __GET(tag, offset, LONGINT); fld = q + offset; p = Heap_FetchAddress(fld); - __PUT(fld, (SYSTEM_PTR)(uintptr_t)n, SYSTEM_PTR); + __PUT(fld, (SYSTEM_PTR)(SYSTEM_ADDRESS)n, SYSTEM_PTR); } else { fld = q + offset; n = Heap_FetchAddress(fld); @@ -369,7 +369,7 @@ static void Heap_Mark (LONGINT q) if (!__ODD(tagbits)) { __PUT(n - 4, tagbits + 1, LONGINT); __PUT(q - 4, tag + 1, LONGINT); - __PUT(fld, (SYSTEM_PTR)(uintptr_t)p, SYSTEM_PTR); + __PUT(fld, (SYSTEM_PTR)(SYSTEM_ADDRESS)p, SYSTEM_PTR); p = q; q = n; tag = tagbits; @@ -384,7 +384,7 @@ static void Heap_Mark (LONGINT q) static void Heap_MarkP (SYSTEM_PTR p) { - Heap_Mark((LONGINT)(uintptr_t)p); + Heap_Mark((LONGINT)(SYSTEM_ADDRESS)p); } static void Heap_Scan (void) @@ -553,7 +553,7 @@ static void Heap_Finalize (void) } else { prev->next = n->next; } - (*n->finalize)((SYSTEM_PTR)(uintptr_t)n->obj); + (*n->finalize)((SYSTEM_PTR)(SYSTEM_ADDRESS)n->obj); if (prev == NIL) { n = Heap_fin; } else { @@ -572,7 +572,7 @@ void Heap_FINALL (void) while (Heap_fin != NIL) { n = Heap_fin; Heap_fin = Heap_fin->next; - (*n->finalize)((SYSTEM_PTR)(uintptr_t)n->obj); + (*n->finalize)((SYSTEM_PTR)(SYSTEM_ADDRESS)n->obj); } } @@ -589,9 +589,9 @@ static void Heap_MarkStack (LONGINT n, LONGINT *cand, LONGINT cand__len) } if (n == 0) { nofcand = 0; - sp = (LONGINT)(uintptr_t)&frame; + sp = (LONGINT)(SYSTEM_ADDRESS)&frame; stack0 = Heap_PlatformMainStackFrame(); - inc = (LONGINT)(uintptr_t)&align.p - (LONGINT)(uintptr_t)&align; + inc = (LONGINT)(SYSTEM_ADDRESS)&align.p - (LONGINT)(SYSTEM_ADDRESS)&align; if (sp > stack0) { inc = -inc; } @@ -622,7 +622,7 @@ void Heap_GC (BOOLEAN markStack) LONGINT cand[10000]; if (Heap_lockdepth == 0 || (Heap_lockdepth == 1 && !markStack)) { Heap_Lock(); - m = (Heap_Module)(uintptr_t)Heap_modules; + m = (Heap_Module)(SYSTEM_ADDRESS)Heap_modules; while (m != NIL) { if (m->enumPtrs != NIL) { (*m->enumPtrs)(Heap_MarkP); @@ -699,7 +699,7 @@ void Heap_RegisterFinalizer (SYSTEM_PTR obj, Heap_Finalizer finalize) { Heap_FinNode f; __NEW(f, Heap_FinDesc); - f->obj = (LONGINT)(uintptr_t)obj; + f->obj = (LONGINT)(SYSTEM_ADDRESS)obj; f->finalize = finalize; f->marked = 1; f->next = Heap_fin; diff --git a/bootstrap/unix-48/Heap.h b/bootstrap/unix-48/Heap.h index ef7348cf..a2cab30c 100644 --- a/bootstrap/unix-48/Heap.h +++ b/bootstrap/unix-48/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tskSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/unix-48/Modules.c b/bootstrap/unix-48/Modules.c index f69edc96..330b7506 100644 --- a/bootstrap/unix-48/Modules.c +++ b/bootstrap/unix-48/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Console.h" #include "Heap.h" diff --git a/bootstrap/unix-48/Modules.h b/bootstrap/unix-48/Modules.h index 3c0af484..ac8ac89e 100644 --- a/bootstrap/unix-48/Modules.h +++ b/bootstrap/unix-48/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/unix-48/OPB.c b/bootstrap/unix-48/OPB.c index be093f93..0f614e6a 100644 --- a/bootstrap/unix-48/OPB.c +++ b/bootstrap/unix-48/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPM.h" #include "OPS.h" diff --git a/bootstrap/unix-48/OPB.h b/bootstrap/unix-48/OPB.h index cd52fbdd..d1c88266 100644 --- a/bootstrap/unix-48/OPB.h +++ b/bootstrap/unix-48/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/unix-48/OPC.c b/bootstrap/unix-48/OPC.c index 617bf8e8..3abccc9a 100644 --- a/bootstrap/unix-48/OPC.c +++ b/bootstrap/unix-48/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "OPM.h" diff --git a/bootstrap/unix-48/OPC.h b/bootstrap/unix-48/OPC.h index 6d5f3632..b7d34a07 100644 --- a/bootstrap/unix-48/OPC.h +++ b/bootstrap/unix-48/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/unix-48/OPM.c b/bootstrap/unix-48/OPM.c index db989d91..bf683e41 100644 --- a/bootstrap/unix-48/OPM.c +++ b/bootstrap/unix-48/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "Console.h" @@ -544,15 +544,15 @@ void OPM_FPrintReal (LONGINT *fp, REAL real) { INTEGER i; LONGINT l; - __GET((LONGINT)(uintptr_t)&real, l, LONGINT); + __GET((LONGINT)(SYSTEM_ADDRESS)&real, l, LONGINT); OPM_FPrint(&*fp, l); } void OPM_FPrintLReal (LONGINT *fp, LONGREAL lr) { LONGINT l, h; - __GET((LONGINT)(uintptr_t)&lr, l, LONGINT); - __GET((LONGINT)(uintptr_t)&lr + 4, h, LONGINT); + __GET((LONGINT)(SYSTEM_ADDRESS)&lr, l, LONGINT); + __GET((LONGINT)(SYSTEM_ADDRESS)&lr + 4, h, LONGINT); OPM_FPrint(&*fp, l); OPM_FPrint(&*fp, h); } diff --git a/bootstrap/unix-48/OPM.h b/bootstrap/unix-48/OPM.h index 1daa7dac..ed914bff 100644 --- a/bootstrap/unix-48/OPM.h +++ b/bootstrap/unix-48/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPM__h #define OPM__h diff --git a/bootstrap/unix-48/OPP.c b/bootstrap/unix-48/OPP.c index 447f956e..d9698b7e 100644 --- a/bootstrap/unix-48/OPP.c +++ b/bootstrap/unix-48/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPB.h" #include "OPM.h" diff --git a/bootstrap/unix-48/OPP.h b/bootstrap/unix-48/OPP.h index 6e6eb0af..bf56b7d7 100644 --- a/bootstrap/unix-48/OPP.h +++ b/bootstrap/unix-48/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/unix-48/OPS.c b/bootstrap/unix-48/OPS.c index 474724c8..cacf9256 100644 --- a/bootstrap/unix-48/OPS.c +++ b/bootstrap/unix-48/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */ #include "SYSTEM.h" #include "OPM.h" diff --git a/bootstrap/unix-48/OPS.h b/bootstrap/unix-48/OPS.h index 367bfc1b..e901bcfc 100644 --- a/bootstrap/unix-48/OPS.h +++ b/bootstrap/unix-48/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/unix-48/OPT.c b/bootstrap/unix-48/OPT.c index 3e2611b8..b32d0ebd 100644 --- a/bootstrap/unix-48/OPT.c +++ b/bootstrap/unix-48/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPM.h" #include "OPS.h" diff --git a/bootstrap/unix-48/OPT.h b/bootstrap/unix-48/OPT.h index 3c3bb75b..41b3e7ec 100644 --- a/bootstrap/unix-48/OPT.h +++ b/bootstrap/unix-48/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/unix-48/OPV.c b/bootstrap/unix-48/OPV.c index 85aca692..cf646f5e 100644 --- a/bootstrap/unix-48/OPV.c +++ b/bootstrap/unix-48/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPC.h" #include "OPM.h" @@ -931,7 +931,7 @@ static void OPV_expr (OPT_Node n, INTEGER prec) OPM_Write(')'); break; case 24: - OPM_WriteString((CHAR*)"(LONGINT)(uintptr_t)", (LONGINT)21); + OPM_WriteString((CHAR*)"(LONGINT)(SYSTEM_ADDRESS)", (LONGINT)26); if (l->class == 1) { OPC_CompleteIdent(l->obj); } else { @@ -947,7 +947,7 @@ static void OPV_expr (OPT_Node n, INTEGER prec) OPC_Ident(n->typ->strobj); OPM_Write(')'); if (__IN(n->typ->form, 0x6000) || __IN(l->typ->form, 0x6000)) { - OPM_WriteString((CHAR*)"(uintptr_t)", (LONGINT)12); + OPM_WriteString((CHAR*)"(SYSTEM_ADDRESS)", (LONGINT)17); } OPV_expr(l, exprPrec); } else { diff --git a/bootstrap/unix-48/OPV.h b/bootstrap/unix-48/OPV.h index c0e4b80e..04828b2f 100644 --- a/bootstrap/unix-48/OPV.h +++ b/bootstrap/unix-48/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/unix-48/Platform.c b/bootstrap/unix-48/Platform.c index 96fa36a1..74c43788 100644 --- a/bootstrap/unix-48/Platform.c +++ b/bootstrap/unix-48/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" typedef @@ -118,14 +118,14 @@ 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) (LONGINT)(uintptr_t)((void*)malloc((size_t)size)) +#define Platform_allocate(size) (LONGINT)(SYSTEM_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 #define Platform_errc(c) write(1, &c, 1) #define Platform_errstring(s, s__len) write(1, s, s__len-1) #define Platform_exit(code) exit(code) -#define Platform_free(address) free((void*)(uintptr_t)address) +#define Platform_free(address) free((void*)(SYSTEM_ADDRESS)address) #define Platform_fstat(fd) fstat(fd, &s) #define Platform_fsync(fd) fsync(fd) #define Platform_ftruncate(fd, l) ftruncate(fd, l) @@ -138,13 +138,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_t)(p), l) +#define Platform_readfile(fd, p, l) read(fd, (void*)(SYSTEM_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_t)h) +#define Platform_sethandler(s, h) SystemSetHandler(s, (SYSTEM_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 @@ -161,7 +161,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_t)(p), l) +#define Platform_writefile(fd, p, l) write(fd, (void*)(SYSTEM_ADDRESS)(p), l) BOOLEAN Platform_TooManyFiles (INTEGER e) { @@ -229,7 +229,7 @@ void Platform_Init (INTEGER argc, LONGINT argvadr) Platform_ArgVecPtr av = NIL; Platform_MainStackFrame = argvadr; Platform_ArgCount = argc; - av = (Platform_ArgVecPtr)(uintptr_t)argvadr; + av = (Platform_ArgVecPtr)(SYSTEM_ADDRESS)argvadr; Platform_ArgVector = (*av)[0]; Platform_HaltCode = -128; Platform_HeapInitHeap(); @@ -262,7 +262,7 @@ void Platform_GetArg (INTEGER n, CHAR *val, LONGINT val__len) { Platform_ArgVec av = NIL; if (n < Platform_ArgCount) { - av = (Platform_ArgVec)(uintptr_t)Platform_ArgVector; + av = (Platform_ArgVec)(SYSTEM_ADDRESS)Platform_ArgVector; __COPY(*(*av)[__X(n, ((LONGINT)(1024)))], val, val__len); } } @@ -529,7 +529,7 @@ INTEGER Platform_Read (LONGINT h, LONGINT p, LONGINT l, LONGINT *n) INTEGER Platform_ReadBuf (LONGINT h, SYSTEM_BYTE *b, LONGINT b__len, LONGINT *n) { INTEGER _o_result; - *n = Platform_readfile(h, (LONGINT)(uintptr_t)b, b__len); + *n = Platform_readfile(h, (LONGINT)(SYSTEM_ADDRESS)b, b__len); if (*n < 0) { *n = 0; _o_result = Platform_err(); @@ -765,7 +765,7 @@ static void Platform_TestLittleEndian (void) { INTEGER i; i = 1; - __GET((LONGINT)(uintptr_t)&i, Platform_LittleEndian, BOOLEAN); + __GET((LONGINT)(SYSTEM_ADDRESS)&i, Platform_LittleEndian, BOOLEAN); } __TDESC(Platform_FileIdentity, 1, 0) = {__TDFLDS("FileIdentity", 12), {-4}}; diff --git a/bootstrap/unix-48/Platform.h b/bootstrap/unix-48/Platform.h index 7cd729b9..dd5ce434 100644 --- a/bootstrap/unix-48/Platform.h +++ b/bootstrap/unix-48/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/unix-48/Reals.c b/bootstrap/unix-48/Reals.c index 43583aa9..2323e34d 100644 --- a/bootstrap/unix-48/Reals.c +++ b/bootstrap/unix-48/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" @@ -58,7 +58,7 @@ INTEGER Reals_Expo (REAL x) { INTEGER _o_result; INTEGER i; - __GET((LONGINT)(uintptr_t)&x + 2, i, INTEGER); + __GET((LONGINT)(SYSTEM_ADDRESS)&x + 2, i, INTEGER); _o_result = __MASK(__ASHR(i, 7), -256); return _o_result; } @@ -66,17 +66,17 @@ INTEGER Reals_Expo (REAL x) void Reals_SetExpo (REAL *x, INTEGER ex) { CHAR c; - __GET((LONGINT)(uintptr_t)x + 3, c, CHAR); - __PUT((LONGINT)(uintptr_t)x + 3, (CHAR)(__ASHL(__ASHR((int)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR); - __GET((LONGINT)(uintptr_t)x + 2, c, CHAR); - __PUT((LONGINT)(uintptr_t)x + 2, (CHAR)(__MASK((int)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR); + __GET((LONGINT)(SYSTEM_ADDRESS)x + 3, c, CHAR); + __PUT((LONGINT)(SYSTEM_ADDRESS)x + 3, (CHAR)(__ASHL(__ASHR((int)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR); + __GET((LONGINT)(SYSTEM_ADDRESS)x + 2, c, CHAR); + __PUT((LONGINT)(SYSTEM_ADDRESS)x + 2, (CHAR)(__MASK((int)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR); } INTEGER Reals_ExpoL (LONGREAL x) { INTEGER _o_result; INTEGER i; - __GET((LONGINT)(uintptr_t)&x + 6, i, INTEGER); + __GET((LONGINT)(SYSTEM_ADDRESS)&x + 6, i, INTEGER); _o_result = __MASK(__ASHR(i, 4), -2048); return _o_result; } diff --git a/bootstrap/unix-48/Reals.h b/bootstrap/unix-48/Reals.h index fdae5f89..7e6b534c 100644 --- a/bootstrap/unix-48/Reals.h +++ b/bootstrap/unix-48/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/unix-48/SYSTEM.c b/bootstrap/unix-48/SYSTEM.c index 50e91c6d..33511a70 100644 --- a/bootstrap/unix-48/SYSTEM.c +++ b/bootstrap/unix-48/SYSTEM.c @@ -35,7 +35,7 @@ void SYSTEM_INHERIT(LONGINT *t, LONGINT *t0) void SYSTEM_ENUMP(void *adr, LONGINT n, void (*P)()) { while (n > 0) { - P((LONGINT)(uintptr_t)(*((void**)(adr)))); + P((LONGINT)(SYSTEM_ADDRESS)(*((void**)(adr)))); adr = ((void**)adr) + 1; n--; } @@ -106,7 +106,7 @@ SYSTEM_PTR SYSTEM_NEWARR(LONGINT *typ, LONGINT elemsz, int elemalgn, int nofdim, else if (typ == (LONGINT*)POINTER__typ) { /* element type is a pointer */ x = Heap_NEWBLK(size + nofelems * sizeof(LONGINT)); - p = (LONGINT*)(uintptr_t)x[-1]; + p = (LONGINT*)(SYSTEM_ADDRESS)x[-1]; p[-nofelems] = *p; /* build new type desc in situ: 1. copy block size; 2. setup ptr tab; 3. set sentinel; 4. patch tag */ p -= nofelems - 1; n = 1; /* n =1 for skipping the size field */ while (n <= nofelems) {*p = n*sizeof(LONGINT); p++; n++;} @@ -119,7 +119,7 @@ SYSTEM_PTR SYSTEM_NEWARR(LONGINT *typ, LONGINT elemsz, int elemalgn, int nofdim, while (ptab[nofptrs] >= 0) {nofptrs++;} /* number of pointers per element */ nptr = nofelems * nofptrs; /* total number of pointers */ x = Heap_NEWBLK(size + nptr * sizeof(LONGINT)); - p = (LONGINT*)(uintptr_t)x[- 1]; + p = (LONGINT*)(SYSTEM_ADDRESS)x[- 1]; p[-nptr] = *p; /* build new type desc in situ; 1. copy block size; 2. setup ptr tab; 3. set sentinel; 4. patch tag */ p -= nptr - 1; n = 0; off = dataoff; while (n < nofelems) {i = 0; @@ -155,7 +155,7 @@ typedef void (*SystemSignalHandler)(INTEGER); // = Platform_SignalHandler // (Ignore other signals) } - void SystemSetHandler(int s, uintptr_t h) { + void SystemSetHandler(int s, SYSTEM_ADDRESS h) { if (s >= 2 && s <= 4) { int needtosetsystemhandler = handler[s-2] == 0; handler[s-2] = (SystemSignalHandler)h; @@ -194,12 +194,12 @@ typedef void (*SystemSignalHandler)(INTEGER); // = Platform_SignalHandler } } - void SystemSetInterruptHandler(uintptr_t h) { + void SystemSetInterruptHandler(SYSTEM_ADDRESS h) { EnsureConsoleCtrlHandler(); SystemInterruptHandler = (SystemSignalHandler)h; } - void SystemSetQuitHandler(uintptr_t h) { + void SystemSetQuitHandler(SYSTEM_ADDRESS h) { EnsureConsoleCtrlHandler(); SystemQuitHandler = (SystemSignalHandler)h; } diff --git a/bootstrap/unix-48/SYSTEM.h b/bootstrap/unix-48/SYSTEM.h index 1c0b07fd..75a0aa52 100644 --- a/bootstrap/unix-48/SYSTEM.h +++ b/bootstrap/unix-48/SYSTEM.h @@ -18,23 +18,16 @@ typedef unsigned char SYSTEM_CARD8; #if (__SIZEOF_POINTER__ == 8) #if defined(_WIN64) - typedef unsigned long long SYSTEM_PTRINT; - typedef unsigned long long uintptr_t; - typedef unsigned long long size_t; + typedef unsigned long long SYSTEM_ADDRESS; #else - typedef unsigned long SYSTEM_PTRINT; - typedef unsigned long uintptr_t; - typedef unsigned long size_t; + typedef unsigned long SYSTEM_ADDRESS; #endif #else - typedef unsigned int SYSTEM_PTRINT; - typedef unsigned int uintptr_t; - typedef unsigned int size_t; + typedef unsigned int SYSTEM_ADDRESS; #endif -#define _SIZE_T_DEFINED_ // For OpenBSD -void *memcpy(void *dest, const void *source, size_t size); +void *memcpy(void *dest, const void *source, SYSTEM_ADDRESS size); @@ -111,10 +104,10 @@ extern LONGINT SYSTEM_ENTIER (double x); // Signal handling in SYSTEM.c #ifndef _WIN32 - extern void SystemSetHandler(int s, uintptr_t h); + extern void SystemSetHandler(int s, SYSTEM_ADDRESS h); #else - extern void SystemSetInterruptHandler(uintptr_t h); - extern void SystemSetQuitHandler (uintptr_t h); + extern void SystemSetInterruptHandler(SYSTEM_ADDRESS h); + extern void SystemSetQuitHandler (SYSTEM_ADDRESS h); #endif @@ -137,9 +130,9 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __COPY(s, d, n) {char*_a=(void*)s,*_b=(void*)d; LONGINT _i=0,_t=n-1; \ while(_i<_t&&((_b[_i]=_a[_i])!=0)){_i++;};_b[_i]=0;} -#define __DUP(x, l, t) x=(void*)memcpy((void*)(uintptr_t)Platform_OSAllocate(l*sizeof(t)),x,l*sizeof(t)) +#define __DUP(x, l, t) x=(void*)memcpy((void*)(SYSTEM_ADDRESS)Platform_OSAllocate(l*sizeof(t)),x,l*sizeof(t)) #define __DUPARR(v, t) v=(void*)memcpy(v##__copy,v,sizeof(t)) -#define __DEL(x) Platform_OSFree((LONGINT)(uintptr_t)x) +#define __DEL(x) Platform_OSFree((LONGINT)(SYSTEM_ADDRESS)x) @@ -149,8 +142,8 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __VAL(t, x) (*(t*)&(x)) -#define __GET(a, x, t) x= *(t*)(uintptr_t)(a) -#define __PUT(a, x, t) *(t*)(uintptr_t)(a)=x +#define __GET(a, x, t) x= *(t*)(SYSTEM_ADDRESS)(a) +#define __PUT(a, x, t) *(t*)(SYSTEM_ADDRESS)(a)=x #define __LSHL(x, n, t) ((t)((U_##t)(x)<<(n))) #define __LSHR(x, n, t) ((t)((U_##t)(x)>>(n))) @@ -165,7 +158,7 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __ROT(x, n, t) ((n)>=0? __ROTL(x, n, t): __ROTR(x, -(n), t)) #define __BIT(x, n) (*(U_LONGINT*)(x)>>(n)&1) -#define __MOVE(s, d, n) memcpy((char*)(uintptr_t)(d),(char*)(uintptr_t)(s),n) +#define __MOVE(s, d, n) memcpy((char*)(SYSTEM_ADDRESS)(d),(char*)(SYSTEM_ADDRESS)(s),n) #define __ASHF(x, n) SYSTEM_ASH((LONGINT)(x), (LONGINT)(n)) #define __SHORT(x, y) ((int)((U_LONGINT)(x)+(y)<(y)+(y)?(x):(__HALT(-8),0))) #define __SHORTF(x, y) ((int)(__RF((x)+(y),(y)+(y))-(y))) @@ -226,7 +219,7 @@ extern void Heap_INCREF(); extern void Platform_Init(INTEGER argc, LONGINT argv); extern void Heap_FINALL(); -#define __INIT(argc, argv) static void *m; Platform_Init((INTEGER)argc, (LONGINT)(uintptr_t)&argv); +#define __INIT(argc, argv) static void *m; Platform_Init((INTEGER)argc, (LONGINT)(SYSTEM_ADDRESS)&argv); #define __REGMAIN(name, enum) m = Heap_REGMOD((CHAR*)name,enum) #define __FINI Heap_FINALL(); return 0 @@ -247,7 +240,7 @@ extern SYSTEM_PTR Heap_NEWREC (LONGINT tag); extern SYSTEM_PTR SYSTEM_NEWARR(LONGINT*, LONGINT, int, int, int, ...); #define __SYSNEW(p, len) p = Heap_NEWBLK((LONGINT)(len)) -#define __NEW(p, t) p = Heap_NEWREC((LONGINT)(uintptr_t)t##__typ) +#define __NEW(p, t) p = Heap_NEWREC((LONGINT)(SYSTEM_ADDRESS)t##__typ) #define __NEWARR SYSTEM_NEWARR @@ -278,20 +271,20 @@ extern SYSTEM_PTR SYSTEM_NEWARR(LONGINT*, LONGINT, int, int, int, ...); #define __INITYP(t, t0, level) \ t##__typ = (LONGINT*)&t##__desc.blksz; \ memcpy(t##__desc.basep, t0##__typ - __BASEOFF, level*sizeof(LONGINT)); \ - t##__desc.basep[level] = (LONGINT)(uintptr_t)t##__typ; \ - t##__desc.module = (LONGINT)(uintptr_t)m; \ + t##__desc.basep[level] = (LONGINT)(SYSTEM_ADDRESS)t##__typ; \ + t##__desc.module = (LONGINT)(SYSTEM_ADDRESS)m; \ if(t##__desc.blksz!=sizeof(struct t)) __HALT(-15); \ t##__desc.blksz = (t##__desc.blksz+5*sizeof(LONGINT)-1)/(4*sizeof(LONGINT))*(4*sizeof(LONGINT)); \ - Heap_REGTYP(m, (LONGINT)(uintptr_t)&t##__desc.next); \ + Heap_REGTYP(m, (LONGINT)(SYSTEM_ADDRESS)&t##__desc.next); \ SYSTEM_INHERIT(t##__typ, t0##__typ) -#define __IS(tag, typ, level) (*(tag-(__BASEOFF-level))==(LONGINT)(uintptr_t)typ##__typ) -#define __TYPEOF(p) ((LONGINT*)(uintptr_t)(*(((LONGINT*)(p))-1))) +#define __IS(tag, typ, level) (*(tag-(__BASEOFF-level))==(LONGINT)(SYSTEM_ADDRESS)typ##__typ) +#define __TYPEOF(p) ((LONGINT*)(SYSTEM_ADDRESS)(*(((LONGINT*)(p))-1))) #define __ISP(p, typ, level) __IS(__TYPEOF(p),typ,level) // Oberon-2 type bound procedures support -#define __INITBP(t, proc, num) *(t##__typ-(__TPROC0OFF+num))=(LONGINT)(uintptr_t)proc -#define __SEND(typ, num, funtyp, parlist) ((funtyp)((uintptr_t)*(typ-(__TPROC0OFF+num))))parlist +#define __INITBP(t, proc, num) *(t##__typ-(__TPROC0OFF+num))=(LONGINT)(SYSTEM_ADDRESS)proc +#define __SEND(typ, num, funtyp, parlist) ((funtyp)((SYSTEM_ADDRESS)*(typ-(__TPROC0OFF+num))))parlist diff --git a/bootstrap/unix-48/Strings.c b/bootstrap/unix-48/Strings.c index 51468a69..115456ea 100644 --- a/bootstrap/unix-48/Strings.c +++ b/bootstrap/unix-48/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" diff --git a/bootstrap/unix-48/Strings.h b/bootstrap/unix-48/Strings.h index 4245a515..96dbb01d 100644 --- a/bootstrap/unix-48/Strings.h +++ b/bootstrap/unix-48/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/unix-48/Texts.c b/bootstrap/unix-48/Texts.c index 627370de..cfe34ca7 100644 --- a/bootstrap/unix-48/Texts.c +++ b/bootstrap/unix-48/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Files.h" #include "Modules.h" diff --git a/bootstrap/unix-48/Texts.h b/bootstrap/unix-48/Texts.h index 7214a16b..632b644a 100644 --- a/bootstrap/unix-48/Texts.h +++ b/bootstrap/unix-48/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/unix-48/Vishap.c b/bootstrap/unix-48/Vishap.c index 97c8c849..4c9e3b45 100644 --- a/bootstrap/unix-48/Vishap.c +++ b/bootstrap/unix-48/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkamSf */ #include "SYSTEM.h" #include "Configuration.h" #include "Heap.h" diff --git a/bootstrap/unix-48/errors.c b/bootstrap/unix-48/errors.c index 3facbaa9..68e433df 100644 --- a/bootstrap/unix-48/errors.c +++ b/bootstrap/unix-48/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" typedef diff --git a/bootstrap/unix-48/errors.h b/bootstrap/unix-48/errors.h index 719043cb..41d399ad 100644 --- a/bootstrap/unix-48/errors.h +++ b/bootstrap/unix-48/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/unix-48/extTools.c b/bootstrap/unix-48/extTools.c index 7785adc7..4efd107a 100644 --- a/bootstrap/unix-48/extTools.c +++ b/bootstrap/unix-48/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "Console.h" diff --git a/bootstrap/unix-48/extTools.h b/bootstrap/unix-48/extTools.h index b189ebeb..fc4f0da1 100644 --- a/bootstrap/unix-48/extTools.h +++ b/bootstrap/unix-48/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/unix-48/vt100.c b/bootstrap/unix-48/vt100.c index 891d7e43..d77b0b84 100644 --- a/bootstrap/unix-48/vt100.c +++ b/bootstrap/unix-48/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Console.h" #include "Strings.h" diff --git a/bootstrap/unix-48/vt100.h b/bootstrap/unix-48/vt100.h index 9a9a6144..4af04d6e 100644 --- a/bootstrap/unix-48/vt100.h +++ b/bootstrap/unix-48/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef vt100__h #define vt100__h diff --git a/bootstrap/unix-88/Configuration.c b/bootstrap/unix-88/Configuration.c index 018926c5..47f1ffc7 100644 --- a/bootstrap/unix-88/Configuration.c +++ b/bootstrap/unix-88/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" @@ -14,6 +14,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("1.95 [2016/08/22] for gcc LP64 on cygwin", Configuration_versionLong, 41); + __MOVE("1.95 [2016/08/23] for gcc LP64 on cygwin", Configuration_versionLong, 41); __ENDMOD; } diff --git a/bootstrap/unix-88/Configuration.h b/bootstrap/unix-88/Configuration.h index 333cefa8..ba0bbd99 100644 --- a/bootstrap/unix-88/Configuration.h +++ b/bootstrap/unix-88/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/unix-88/Console.c b/bootstrap/unix-88/Console.c index 5ddcf982..b39e6cf3 100644 --- a/bootstrap/unix-88/Console.c +++ b/bootstrap/unix-88/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Platform.h" @@ -22,7 +22,7 @@ export void Console_String (CHAR *s, LONGINT s__len); void Console_Flush (void) { INTEGER error; - error = Platform_Write(((LONGINT)(1)), (LONGINT)(uintptr_t)Console_line, Console_pos); + error = Platform_Write(((LONGINT)(1)), (LONGINT)(SYSTEM_ADDRESS)Console_line, Console_pos); Console_pos = 0; } diff --git a/bootstrap/unix-88/Console.h b/bootstrap/unix-88/Console.h index 23eb9888..4606384c 100644 --- a/bootstrap/unix-88/Console.h +++ b/bootstrap/unix-88/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/unix-88/Files.c b/bootstrap/unix-88/Files.c index c6b41705..1b144711 100644 --- a/bootstrap/unix-88/Files.c +++ b/bootstrap/unix-88/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Configuration.h" @@ -258,7 +258,7 @@ static void Files_Flush (Files_Buffer buf) if (buf->org != f->pos) { error = Platform_Seek(f->fd, buf->org, Platform_SeekSet); } - error = Platform_Write(f->fd, (LONGINT)(uintptr_t)buf->data, buf->size); + error = Platform_Write(f->fd, (LONGINT)(SYSTEM_ADDRESS)buf->data, buf->size); if (error != 0) { Files_Err((CHAR*)"error writing file", (LONGINT)19, f, error); } @@ -657,7 +657,7 @@ void Files_ReadBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT x } else { min = n; } - __MOVE((LONGINT)(uintptr_t)buf->data + offset, (LONGINT)(uintptr_t)x + xpos, min); + __MOVE((LONGINT)(SYSTEM_ADDRESS)buf->data + offset, (LONGINT)(SYSTEM_ADDRESS)x + xpos, min); offset += min; (*r).offset = offset; xpos += min; @@ -722,7 +722,7 @@ void Files_WriteBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT } else { min = n; } - __MOVE((LONGINT)(uintptr_t)x + xpos, (LONGINT)(uintptr_t)buf->data + offset, min); + __MOVE((LONGINT)(SYSTEM_ADDRESS)x + xpos, (LONGINT)(SYSTEM_ADDRESS)buf->data + offset, min); offset += min; (*r).offset = offset; if (offset > buf->size) { @@ -773,15 +773,15 @@ void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, INT *res = 3; return; } - error = Platform_Read(fdold, (LONGINT)(uintptr_t)buf, ((LONGINT)(4096)), &n); + error = Platform_Read(fdold, (LONGINT)(SYSTEM_ADDRESS)buf, ((LONGINT)(4096)), &n); while (n > 0) { - error = Platform_Write(fdnew, (LONGINT)(uintptr_t)buf, n); + error = Platform_Write(fdnew, (LONGINT)(SYSTEM_ADDRESS)buf, n); if (error != 0) { ignore = Platform_Close(fdold); ignore = Platform_Close(fdnew); Files_Err((CHAR*)"cannot move file", (LONGINT)17, NIL, error); } - error = Platform_Read(fdold, (LONGINT)(uintptr_t)buf, ((LONGINT)(4096)), &n); + error = Platform_Read(fdold, (LONGINT)(SYSTEM_ADDRESS)buf, ((LONGINT)(4096)), &n); } ignore = Platform_Close(fdold); ignore = Platform_Close(fdnew); @@ -839,7 +839,7 @@ static void Files_FlipBytes (SYSTEM_BYTE *src, LONGINT src__len, SYSTEM_BYTE *de j += 1; } } else { - __MOVE((LONGINT)(uintptr_t)src, (LONGINT)(uintptr_t)dest, src__len); + __MOVE((LONGINT)(SYSTEM_ADDRESS)src, (LONGINT)(SYSTEM_ADDRESS)dest, src__len); } } @@ -1009,7 +1009,7 @@ static void Files_Finalize (SYSTEM_PTR o) { Files_File f = NIL; LONGINT res; - f = (Files_File)(uintptr_t)o; + f = (Files_File)(SYSTEM_ADDRESS)o; if (f->fd >= 0) { Files_CloseOSFile(f); if (f->tempFile) { diff --git a/bootstrap/unix-88/Files.h b/bootstrap/unix-88/Files.h index 208b9f66..62487a35 100644 --- a/bootstrap/unix-88/Files.h +++ b/bootstrap/unix-88/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/unix-88/Heap.c b/bootstrap/unix-88/Heap.c index d51ad5c2..9873a734 100644 --- a/bootstrap/unix-88/Heap.c +++ b/bootstrap/unix-88/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tskSfF */ #define LARGE #include "SYSTEM.h" @@ -102,7 +102,7 @@ export void Heap_Unlock (void); extern void *Heap__init(); extern LONGINT Platform_MainStackFrame; extern LONGINT Platform_OSAllocate(LONGINT size); -#define Heap_FetchAddress(pointer) (LONGINT)(uintptr_t)(*((void**)((uintptr_t)pointer))) +#define Heap_FetchAddress(pointer) (LONGINT)(SYSTEM_ADDRESS)(*((void**)((SYSTEM_ADDRESS)pointer))) #define Heap_HeapModuleInit() Heap__init() #define Heap_OSAllocate(size) Platform_OSAllocate(size) #define Heap_PlatformHalt(code) Platform_Halt(code) @@ -135,7 +135,7 @@ SYSTEM_PTR Heap_REGMOD (Heap_ModuleName name, Heap_EnumProc enumPtrs) __COPY(name, m->name, ((LONGINT)(20))); m->refcnt = 0; m->enumPtrs = enumPtrs; - m->next = (Heap_Module)(uintptr_t)Heap_modules; + m->next = (Heap_Module)(SYSTEM_ADDRESS)Heap_modules; Heap_modules = (SYSTEM_PTR)m; _o_result = (void*)m; return _o_result; @@ -316,7 +316,7 @@ SYSTEM_PTR Heap_NEWREC (LONGINT tag) __PUT(adr + 16, 0, LONGINT); Heap_allocated += blksz; Heap_Unlock(); - _o_result = (SYSTEM_PTR)(uintptr_t)(adr + 8); + _o_result = (SYSTEM_PTR)(SYSTEM_ADDRESS)(adr + 8); return _o_result; } @@ -327,12 +327,12 @@ SYSTEM_PTR Heap_NEWBLK (LONGINT size) SYSTEM_PTR new; Heap_Lock(); blksz = __ASHL(__ASHR(size + 63, 5), 5); - new = Heap_NEWREC((LONGINT)(uintptr_t)&blksz); - tag = ((LONGINT)(uintptr_t)new + blksz) - 24; + new = Heap_NEWREC((LONGINT)(SYSTEM_ADDRESS)&blksz); + tag = ((LONGINT)(SYSTEM_ADDRESS)new + blksz) - 24; __PUT(tag - 8, 0, LONGINT); __PUT(tag, blksz, LONGINT); __PUT(tag + 8, -8, LONGINT); - __PUT((LONGINT)(uintptr_t)new - 8, tag, LONGINT); + __PUT((LONGINT)(SYSTEM_ADDRESS)new - 8, tag, LONGINT); Heap_Unlock(); _o_result = new; return _o_result; @@ -361,7 +361,7 @@ static void Heap_Mark (LONGINT q) __GET(tag, offset, LONGINT); fld = q + offset; p = Heap_FetchAddress(fld); - __PUT(fld, (SYSTEM_PTR)(uintptr_t)n, SYSTEM_PTR); + __PUT(fld, (SYSTEM_PTR)(SYSTEM_ADDRESS)n, SYSTEM_PTR); } else { fld = q + offset; n = Heap_FetchAddress(fld); @@ -370,7 +370,7 @@ static void Heap_Mark (LONGINT q) if (!__ODD(tagbits)) { __PUT(n - 8, tagbits + 1, LONGINT); __PUT(q - 8, tag + 1, LONGINT); - __PUT(fld, (SYSTEM_PTR)(uintptr_t)p, SYSTEM_PTR); + __PUT(fld, (SYSTEM_PTR)(SYSTEM_ADDRESS)p, SYSTEM_PTR); p = q; q = n; tag = tagbits; @@ -385,7 +385,7 @@ static void Heap_Mark (LONGINT q) static void Heap_MarkP (SYSTEM_PTR p) { - Heap_Mark((LONGINT)(uintptr_t)p); + Heap_Mark((LONGINT)(SYSTEM_ADDRESS)p); } static void Heap_Scan (void) @@ -554,7 +554,7 @@ static void Heap_Finalize (void) } else { prev->next = n->next; } - (*n->finalize)((SYSTEM_PTR)(uintptr_t)n->obj); + (*n->finalize)((SYSTEM_PTR)(SYSTEM_ADDRESS)n->obj); if (prev == NIL) { n = Heap_fin; } else { @@ -573,7 +573,7 @@ void Heap_FINALL (void) while (Heap_fin != NIL) { n = Heap_fin; Heap_fin = Heap_fin->next; - (*n->finalize)((SYSTEM_PTR)(uintptr_t)n->obj); + (*n->finalize)((SYSTEM_PTR)(SYSTEM_ADDRESS)n->obj); } } @@ -590,9 +590,9 @@ static void Heap_MarkStack (LONGINT n, LONGINT *cand, LONGINT cand__len) } if (n == 0) { nofcand = 0; - sp = (LONGINT)(uintptr_t)&frame; + sp = (LONGINT)(SYSTEM_ADDRESS)&frame; stack0 = Heap_PlatformMainStackFrame(); - inc = (LONGINT)(uintptr_t)&align.p - (LONGINT)(uintptr_t)&align; + inc = (LONGINT)(SYSTEM_ADDRESS)&align.p - (LONGINT)(SYSTEM_ADDRESS)&align; if (sp > stack0) { inc = -inc; } @@ -623,7 +623,7 @@ void Heap_GC (BOOLEAN markStack) LONGINT cand[10000]; if (Heap_lockdepth == 0 || (Heap_lockdepth == 1 && !markStack)) { Heap_Lock(); - m = (Heap_Module)(uintptr_t)Heap_modules; + m = (Heap_Module)(SYSTEM_ADDRESS)Heap_modules; while (m != NIL) { if (m->enumPtrs != NIL) { (*m->enumPtrs)(Heap_MarkP); @@ -700,7 +700,7 @@ void Heap_RegisterFinalizer (SYSTEM_PTR obj, Heap_Finalizer finalize) { Heap_FinNode f; __NEW(f, Heap_FinDesc); - f->obj = (LONGINT)(uintptr_t)obj; + f->obj = (LONGINT)(SYSTEM_ADDRESS)obj; f->finalize = finalize; f->marked = 1; f->next = Heap_fin; diff --git a/bootstrap/unix-88/Heap.h b/bootstrap/unix-88/Heap.h index a3ce3755..b1ff5968 100644 --- a/bootstrap/unix-88/Heap.h +++ b/bootstrap/unix-88/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tskSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/unix-88/Modules.c b/bootstrap/unix-88/Modules.c index ca308b4d..0c836ead 100644 --- a/bootstrap/unix-88/Modules.c +++ b/bootstrap/unix-88/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Console.h" diff --git a/bootstrap/unix-88/Modules.h b/bootstrap/unix-88/Modules.h index 88670bb0..6e6ded2e 100644 --- a/bootstrap/unix-88/Modules.h +++ b/bootstrap/unix-88/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/unix-88/OPB.c b/bootstrap/unix-88/OPB.c index 654fd595..f4bdb1a8 100644 --- a/bootstrap/unix-88/OPB.c +++ b/bootstrap/unix-88/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPM.h" diff --git a/bootstrap/unix-88/OPB.h b/bootstrap/unix-88/OPB.h index de004d95..af419f75 100644 --- a/bootstrap/unix-88/OPB.h +++ b/bootstrap/unix-88/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/unix-88/OPC.c b/bootstrap/unix-88/OPC.c index f23a7c6f..bb9b75e6 100644 --- a/bootstrap/unix-88/OPC.c +++ b/bootstrap/unix-88/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Configuration.h" diff --git a/bootstrap/unix-88/OPC.h b/bootstrap/unix-88/OPC.h index c9ded67c..37a86252 100644 --- a/bootstrap/unix-88/OPC.h +++ b/bootstrap/unix-88/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/unix-88/OPM.c b/bootstrap/unix-88/OPM.c index 94b641b5..50047c9e 100644 --- a/bootstrap/unix-88/OPM.c +++ b/bootstrap/unix-88/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Configuration.h" @@ -545,7 +545,7 @@ void OPM_FPrintReal (LONGINT *fp, REAL real) { INTEGER i; LONGINT l; - __GET((LONGINT)(uintptr_t)&real, i, INTEGER); + __GET((LONGINT)(SYSTEM_ADDRESS)&real, i, INTEGER); l = i; OPM_FPrint(&*fp, l); } diff --git a/bootstrap/unix-88/OPM.h b/bootstrap/unix-88/OPM.h index bec0e1f3..1706f8f1 100644 --- a/bootstrap/unix-88/OPM.h +++ b/bootstrap/unix-88/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPM__h #define OPM__h diff --git a/bootstrap/unix-88/OPP.c b/bootstrap/unix-88/OPP.c index 113735f2..5f515091 100644 --- a/bootstrap/unix-88/OPP.c +++ b/bootstrap/unix-88/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPB.h" diff --git a/bootstrap/unix-88/OPP.h b/bootstrap/unix-88/OPP.h index fce96f16..0b3b1b2c 100644 --- a/bootstrap/unix-88/OPP.h +++ b/bootstrap/unix-88/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/unix-88/OPS.c b/bootstrap/unix-88/OPS.c index 03b478b2..cc04e014 100644 --- a/bootstrap/unix-88/OPS.c +++ b/bootstrap/unix-88/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPM.h" diff --git a/bootstrap/unix-88/OPS.h b/bootstrap/unix-88/OPS.h index b0c44127..32148c49 100644 --- a/bootstrap/unix-88/OPS.h +++ b/bootstrap/unix-88/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/unix-88/OPT.c b/bootstrap/unix-88/OPT.c index 75e51d9d..a0d41c71 100644 --- a/bootstrap/unix-88/OPT.c +++ b/bootstrap/unix-88/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPM.h" diff --git a/bootstrap/unix-88/OPT.h b/bootstrap/unix-88/OPT.h index e8667945..ab2c4684 100644 --- a/bootstrap/unix-88/OPT.h +++ b/bootstrap/unix-88/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/unix-88/OPV.c b/bootstrap/unix-88/OPV.c index 88cb137f..ae14f629 100644 --- a/bootstrap/unix-88/OPV.c +++ b/bootstrap/unix-88/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPC.h" @@ -932,7 +932,7 @@ static void OPV_expr (OPT_Node n, INTEGER prec) OPM_Write(')'); break; case 24: - OPM_WriteString((CHAR*)"(LONGINT)(uintptr_t)", (LONGINT)21); + OPM_WriteString((CHAR*)"(LONGINT)(SYSTEM_ADDRESS)", (LONGINT)26); if (l->class == 1) { OPC_CompleteIdent(l->obj); } else { @@ -948,7 +948,7 @@ static void OPV_expr (OPT_Node n, INTEGER prec) OPC_Ident(n->typ->strobj); OPM_Write(')'); if (__IN(n->typ->form, 0x6000) || __IN(l->typ->form, 0x6000)) { - OPM_WriteString((CHAR*)"(uintptr_t)", (LONGINT)12); + OPM_WriteString((CHAR*)"(SYSTEM_ADDRESS)", (LONGINT)17); } OPV_expr(l, exprPrec); } else { diff --git a/bootstrap/unix-88/OPV.h b/bootstrap/unix-88/OPV.h index 839f5fbb..4eba5b89 100644 --- a/bootstrap/unix-88/OPV.h +++ b/bootstrap/unix-88/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/unix-88/Platform.c b/bootstrap/unix-88/Platform.c index d1c0a2b2..c1a0ea9e 100644 --- a/bootstrap/unix-88/Platform.c +++ b/bootstrap/unix-88/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" @@ -119,14 +119,14 @@ 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) (LONGINT)(uintptr_t)((void*)malloc((size_t)size)) +#define Platform_allocate(size) (LONGINT)(SYSTEM_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 #define Platform_errc(c) write(1, &c, 1) #define Platform_errstring(s, s__len) write(1, s, s__len-1) #define Platform_exit(code) exit(code) -#define Platform_free(address) free((void*)(uintptr_t)address) +#define Platform_free(address) free((void*)(SYSTEM_ADDRESS)address) #define Platform_fstat(fd) fstat(fd, &s) #define Platform_fsync(fd) fsync(fd) #define Platform_ftruncate(fd, l) ftruncate(fd, l) @@ -139,13 +139,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_t)(p), l) +#define Platform_readfile(fd, p, l) read(fd, (void*)(SYSTEM_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_t)h) +#define Platform_sethandler(s, h) SystemSetHandler(s, (SYSTEM_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 @@ -162,7 +162,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_t)(p), l) +#define Platform_writefile(fd, p, l) write(fd, (void*)(SYSTEM_ADDRESS)(p), l) BOOLEAN Platform_TooManyFiles (INTEGER e) { @@ -230,7 +230,7 @@ void Platform_Init (INTEGER argc, LONGINT argvadr) Platform_ArgVecPtr av = NIL; Platform_MainStackFrame = argvadr; Platform_ArgCount = argc; - av = (Platform_ArgVecPtr)(uintptr_t)argvadr; + av = (Platform_ArgVecPtr)(SYSTEM_ADDRESS)argvadr; Platform_ArgVector = (*av)[0]; Platform_HaltCode = -128; Platform_HeapInitHeap(); @@ -263,7 +263,7 @@ void Platform_GetArg (INTEGER n, CHAR *val, LONGINT val__len) { Platform_ArgVec av = NIL; if (n < Platform_ArgCount) { - av = (Platform_ArgVec)(uintptr_t)Platform_ArgVector; + av = (Platform_ArgVec)(SYSTEM_ADDRESS)Platform_ArgVector; __COPY(*(*av)[__X(n, ((LONGINT)(1024)))], val, val__len); } } @@ -530,7 +530,7 @@ INTEGER Platform_Read (LONGINT h, LONGINT p, LONGINT l, LONGINT *n) INTEGER Platform_ReadBuf (LONGINT h, SYSTEM_BYTE *b, LONGINT b__len, LONGINT *n) { INTEGER _o_result; - *n = Platform_readfile(h, (LONGINT)(uintptr_t)b, b__len); + *n = Platform_readfile(h, (LONGINT)(SYSTEM_ADDRESS)b, b__len); if (*n < 0) { *n = 0; _o_result = Platform_err(); @@ -766,7 +766,7 @@ static void Platform_TestLittleEndian (void) { INTEGER i; i = 1; - __GET((LONGINT)(uintptr_t)&i, Platform_LittleEndian, BOOLEAN); + __GET((LONGINT)(SYSTEM_ADDRESS)&i, Platform_LittleEndian, BOOLEAN); } __TDESC(Platform_FileIdentity, 1, 0) = {__TDFLDS("FileIdentity", 24), {-8}}; diff --git a/bootstrap/unix-88/Platform.h b/bootstrap/unix-88/Platform.h index d4a27fab..49702e6d 100644 --- a/bootstrap/unix-88/Platform.h +++ b/bootstrap/unix-88/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/unix-88/Reals.c b/bootstrap/unix-88/Reals.c index 5dbc72b6..8b61d8cd 100644 --- a/bootstrap/unix-88/Reals.c +++ b/bootstrap/unix-88/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" @@ -59,7 +59,7 @@ INTEGER Reals_Expo (REAL x) { INTEGER _o_result; INTEGER i; - __GET((LONGINT)(uintptr_t)&x + 2, i, INTEGER); + __GET((LONGINT)(SYSTEM_ADDRESS)&x + 2, i, INTEGER); _o_result = __MASK(__ASHR(i, 7), -256); return _o_result; } @@ -67,17 +67,17 @@ INTEGER Reals_Expo (REAL x) void Reals_SetExpo (REAL *x, INTEGER ex) { CHAR c; - __GET((LONGINT)(uintptr_t)x + 3, c, CHAR); - __PUT((LONGINT)(uintptr_t)x + 3, (CHAR)(__ASHL(__ASHR((int)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR); - __GET((LONGINT)(uintptr_t)x + 2, c, CHAR); - __PUT((LONGINT)(uintptr_t)x + 2, (CHAR)(__MASK((int)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR); + __GET((LONGINT)(SYSTEM_ADDRESS)x + 3, c, CHAR); + __PUT((LONGINT)(SYSTEM_ADDRESS)x + 3, (CHAR)(__ASHL(__ASHR((int)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR); + __GET((LONGINT)(SYSTEM_ADDRESS)x + 2, c, CHAR); + __PUT((LONGINT)(SYSTEM_ADDRESS)x + 2, (CHAR)(__MASK((int)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR); } INTEGER Reals_ExpoL (LONGREAL x) { INTEGER _o_result; INTEGER i; - __GET((LONGINT)(uintptr_t)&x + 6, i, INTEGER); + __GET((LONGINT)(SYSTEM_ADDRESS)&x + 6, i, INTEGER); _o_result = __MASK(__ASHR(i, 4), -2048); return _o_result; } diff --git a/bootstrap/unix-88/Reals.h b/bootstrap/unix-88/Reals.h index dc1a2544..ff21c192 100644 --- a/bootstrap/unix-88/Reals.h +++ b/bootstrap/unix-88/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/unix-88/SYSTEM.c b/bootstrap/unix-88/SYSTEM.c index 50e91c6d..33511a70 100644 --- a/bootstrap/unix-88/SYSTEM.c +++ b/bootstrap/unix-88/SYSTEM.c @@ -35,7 +35,7 @@ void SYSTEM_INHERIT(LONGINT *t, LONGINT *t0) void SYSTEM_ENUMP(void *adr, LONGINT n, void (*P)()) { while (n > 0) { - P((LONGINT)(uintptr_t)(*((void**)(adr)))); + P((LONGINT)(SYSTEM_ADDRESS)(*((void**)(adr)))); adr = ((void**)adr) + 1; n--; } @@ -106,7 +106,7 @@ SYSTEM_PTR SYSTEM_NEWARR(LONGINT *typ, LONGINT elemsz, int elemalgn, int nofdim, else if (typ == (LONGINT*)POINTER__typ) { /* element type is a pointer */ x = Heap_NEWBLK(size + nofelems * sizeof(LONGINT)); - p = (LONGINT*)(uintptr_t)x[-1]; + p = (LONGINT*)(SYSTEM_ADDRESS)x[-1]; p[-nofelems] = *p; /* build new type desc in situ: 1. copy block size; 2. setup ptr tab; 3. set sentinel; 4. patch tag */ p -= nofelems - 1; n = 1; /* n =1 for skipping the size field */ while (n <= nofelems) {*p = n*sizeof(LONGINT); p++; n++;} @@ -119,7 +119,7 @@ SYSTEM_PTR SYSTEM_NEWARR(LONGINT *typ, LONGINT elemsz, int elemalgn, int nofdim, while (ptab[nofptrs] >= 0) {nofptrs++;} /* number of pointers per element */ nptr = nofelems * nofptrs; /* total number of pointers */ x = Heap_NEWBLK(size + nptr * sizeof(LONGINT)); - p = (LONGINT*)(uintptr_t)x[- 1]; + p = (LONGINT*)(SYSTEM_ADDRESS)x[- 1]; p[-nptr] = *p; /* build new type desc in situ; 1. copy block size; 2. setup ptr tab; 3. set sentinel; 4. patch tag */ p -= nptr - 1; n = 0; off = dataoff; while (n < nofelems) {i = 0; @@ -155,7 +155,7 @@ typedef void (*SystemSignalHandler)(INTEGER); // = Platform_SignalHandler // (Ignore other signals) } - void SystemSetHandler(int s, uintptr_t h) { + void SystemSetHandler(int s, SYSTEM_ADDRESS h) { if (s >= 2 && s <= 4) { int needtosetsystemhandler = handler[s-2] == 0; handler[s-2] = (SystemSignalHandler)h; @@ -194,12 +194,12 @@ typedef void (*SystemSignalHandler)(INTEGER); // = Platform_SignalHandler } } - void SystemSetInterruptHandler(uintptr_t h) { + void SystemSetInterruptHandler(SYSTEM_ADDRESS h) { EnsureConsoleCtrlHandler(); SystemInterruptHandler = (SystemSignalHandler)h; } - void SystemSetQuitHandler(uintptr_t h) { + void SystemSetQuitHandler(SYSTEM_ADDRESS h) { EnsureConsoleCtrlHandler(); SystemQuitHandler = (SystemSignalHandler)h; } diff --git a/bootstrap/unix-88/SYSTEM.h b/bootstrap/unix-88/SYSTEM.h index 1c0b07fd..75a0aa52 100644 --- a/bootstrap/unix-88/SYSTEM.h +++ b/bootstrap/unix-88/SYSTEM.h @@ -18,23 +18,16 @@ typedef unsigned char SYSTEM_CARD8; #if (__SIZEOF_POINTER__ == 8) #if defined(_WIN64) - typedef unsigned long long SYSTEM_PTRINT; - typedef unsigned long long uintptr_t; - typedef unsigned long long size_t; + typedef unsigned long long SYSTEM_ADDRESS; #else - typedef unsigned long SYSTEM_PTRINT; - typedef unsigned long uintptr_t; - typedef unsigned long size_t; + typedef unsigned long SYSTEM_ADDRESS; #endif #else - typedef unsigned int SYSTEM_PTRINT; - typedef unsigned int uintptr_t; - typedef unsigned int size_t; + typedef unsigned int SYSTEM_ADDRESS; #endif -#define _SIZE_T_DEFINED_ // For OpenBSD -void *memcpy(void *dest, const void *source, size_t size); +void *memcpy(void *dest, const void *source, SYSTEM_ADDRESS size); @@ -111,10 +104,10 @@ extern LONGINT SYSTEM_ENTIER (double x); // Signal handling in SYSTEM.c #ifndef _WIN32 - extern void SystemSetHandler(int s, uintptr_t h); + extern void SystemSetHandler(int s, SYSTEM_ADDRESS h); #else - extern void SystemSetInterruptHandler(uintptr_t h); - extern void SystemSetQuitHandler (uintptr_t h); + extern void SystemSetInterruptHandler(SYSTEM_ADDRESS h); + extern void SystemSetQuitHandler (SYSTEM_ADDRESS h); #endif @@ -137,9 +130,9 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __COPY(s, d, n) {char*_a=(void*)s,*_b=(void*)d; LONGINT _i=0,_t=n-1; \ while(_i<_t&&((_b[_i]=_a[_i])!=0)){_i++;};_b[_i]=0;} -#define __DUP(x, l, t) x=(void*)memcpy((void*)(uintptr_t)Platform_OSAllocate(l*sizeof(t)),x,l*sizeof(t)) +#define __DUP(x, l, t) x=(void*)memcpy((void*)(SYSTEM_ADDRESS)Platform_OSAllocate(l*sizeof(t)),x,l*sizeof(t)) #define __DUPARR(v, t) v=(void*)memcpy(v##__copy,v,sizeof(t)) -#define __DEL(x) Platform_OSFree((LONGINT)(uintptr_t)x) +#define __DEL(x) Platform_OSFree((LONGINT)(SYSTEM_ADDRESS)x) @@ -149,8 +142,8 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __VAL(t, x) (*(t*)&(x)) -#define __GET(a, x, t) x= *(t*)(uintptr_t)(a) -#define __PUT(a, x, t) *(t*)(uintptr_t)(a)=x +#define __GET(a, x, t) x= *(t*)(SYSTEM_ADDRESS)(a) +#define __PUT(a, x, t) *(t*)(SYSTEM_ADDRESS)(a)=x #define __LSHL(x, n, t) ((t)((U_##t)(x)<<(n))) #define __LSHR(x, n, t) ((t)((U_##t)(x)>>(n))) @@ -165,7 +158,7 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __ROT(x, n, t) ((n)>=0? __ROTL(x, n, t): __ROTR(x, -(n), t)) #define __BIT(x, n) (*(U_LONGINT*)(x)>>(n)&1) -#define __MOVE(s, d, n) memcpy((char*)(uintptr_t)(d),(char*)(uintptr_t)(s),n) +#define __MOVE(s, d, n) memcpy((char*)(SYSTEM_ADDRESS)(d),(char*)(SYSTEM_ADDRESS)(s),n) #define __ASHF(x, n) SYSTEM_ASH((LONGINT)(x), (LONGINT)(n)) #define __SHORT(x, y) ((int)((U_LONGINT)(x)+(y)<(y)+(y)?(x):(__HALT(-8),0))) #define __SHORTF(x, y) ((int)(__RF((x)+(y),(y)+(y))-(y))) @@ -226,7 +219,7 @@ extern void Heap_INCREF(); extern void Platform_Init(INTEGER argc, LONGINT argv); extern void Heap_FINALL(); -#define __INIT(argc, argv) static void *m; Platform_Init((INTEGER)argc, (LONGINT)(uintptr_t)&argv); +#define __INIT(argc, argv) static void *m; Platform_Init((INTEGER)argc, (LONGINT)(SYSTEM_ADDRESS)&argv); #define __REGMAIN(name, enum) m = Heap_REGMOD((CHAR*)name,enum) #define __FINI Heap_FINALL(); return 0 @@ -247,7 +240,7 @@ extern SYSTEM_PTR Heap_NEWREC (LONGINT tag); extern SYSTEM_PTR SYSTEM_NEWARR(LONGINT*, LONGINT, int, int, int, ...); #define __SYSNEW(p, len) p = Heap_NEWBLK((LONGINT)(len)) -#define __NEW(p, t) p = Heap_NEWREC((LONGINT)(uintptr_t)t##__typ) +#define __NEW(p, t) p = Heap_NEWREC((LONGINT)(SYSTEM_ADDRESS)t##__typ) #define __NEWARR SYSTEM_NEWARR @@ -278,20 +271,20 @@ extern SYSTEM_PTR SYSTEM_NEWARR(LONGINT*, LONGINT, int, int, int, ...); #define __INITYP(t, t0, level) \ t##__typ = (LONGINT*)&t##__desc.blksz; \ memcpy(t##__desc.basep, t0##__typ - __BASEOFF, level*sizeof(LONGINT)); \ - t##__desc.basep[level] = (LONGINT)(uintptr_t)t##__typ; \ - t##__desc.module = (LONGINT)(uintptr_t)m; \ + t##__desc.basep[level] = (LONGINT)(SYSTEM_ADDRESS)t##__typ; \ + t##__desc.module = (LONGINT)(SYSTEM_ADDRESS)m; \ if(t##__desc.blksz!=sizeof(struct t)) __HALT(-15); \ t##__desc.blksz = (t##__desc.blksz+5*sizeof(LONGINT)-1)/(4*sizeof(LONGINT))*(4*sizeof(LONGINT)); \ - Heap_REGTYP(m, (LONGINT)(uintptr_t)&t##__desc.next); \ + Heap_REGTYP(m, (LONGINT)(SYSTEM_ADDRESS)&t##__desc.next); \ SYSTEM_INHERIT(t##__typ, t0##__typ) -#define __IS(tag, typ, level) (*(tag-(__BASEOFF-level))==(LONGINT)(uintptr_t)typ##__typ) -#define __TYPEOF(p) ((LONGINT*)(uintptr_t)(*(((LONGINT*)(p))-1))) +#define __IS(tag, typ, level) (*(tag-(__BASEOFF-level))==(LONGINT)(SYSTEM_ADDRESS)typ##__typ) +#define __TYPEOF(p) ((LONGINT*)(SYSTEM_ADDRESS)(*(((LONGINT*)(p))-1))) #define __ISP(p, typ, level) __IS(__TYPEOF(p),typ,level) // Oberon-2 type bound procedures support -#define __INITBP(t, proc, num) *(t##__typ-(__TPROC0OFF+num))=(LONGINT)(uintptr_t)proc -#define __SEND(typ, num, funtyp, parlist) ((funtyp)((uintptr_t)*(typ-(__TPROC0OFF+num))))parlist +#define __INITBP(t, proc, num) *(t##__typ-(__TPROC0OFF+num))=(LONGINT)(SYSTEM_ADDRESS)proc +#define __SEND(typ, num, funtyp, parlist) ((funtyp)((SYSTEM_ADDRESS)*(typ-(__TPROC0OFF+num))))parlist diff --git a/bootstrap/unix-88/Strings.c b/bootstrap/unix-88/Strings.c index 0932a656..20a14540 100644 --- a/bootstrap/unix-88/Strings.c +++ b/bootstrap/unix-88/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" diff --git a/bootstrap/unix-88/Strings.h b/bootstrap/unix-88/Strings.h index 0f4e30dd..d64d3478 100644 --- a/bootstrap/unix-88/Strings.h +++ b/bootstrap/unix-88/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/unix-88/Texts.c b/bootstrap/unix-88/Texts.c index 21a4804c..a1fb81c0 100644 --- a/bootstrap/unix-88/Texts.c +++ b/bootstrap/unix-88/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Files.h" diff --git a/bootstrap/unix-88/Texts.h b/bootstrap/unix-88/Texts.h index e4314cfb..bca5665d 100644 --- a/bootstrap/unix-88/Texts.h +++ b/bootstrap/unix-88/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/unix-88/Vishap.c b/bootstrap/unix-88/Vishap.c index ba77bb85..6eda4f2c 100644 --- a/bootstrap/unix-88/Vishap.c +++ b/bootstrap/unix-88/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkamSf */ #define LARGE #include "SYSTEM.h" #include "Configuration.h" diff --git a/bootstrap/unix-88/errors.c b/bootstrap/unix-88/errors.c index 2ab076d8..48246ffa 100644 --- a/bootstrap/unix-88/errors.c +++ b/bootstrap/unix-88/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" diff --git a/bootstrap/unix-88/errors.h b/bootstrap/unix-88/errors.h index 2ebe7512..9081238a 100644 --- a/bootstrap/unix-88/errors.h +++ b/bootstrap/unix-88/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/unix-88/extTools.c b/bootstrap/unix-88/extTools.c index 2c26582b..4005b0a6 100644 --- a/bootstrap/unix-88/extTools.c +++ b/bootstrap/unix-88/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Configuration.h" diff --git a/bootstrap/unix-88/extTools.h b/bootstrap/unix-88/extTools.h index e844a8a5..6ac1ab91 100644 --- a/bootstrap/unix-88/extTools.h +++ b/bootstrap/unix-88/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/unix-88/vt100.c b/bootstrap/unix-88/vt100.c index 056577f3..a9110e8a 100644 --- a/bootstrap/unix-88/vt100.c +++ b/bootstrap/unix-88/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Console.h" diff --git a/bootstrap/unix-88/vt100.h b/bootstrap/unix-88/vt100.h index 783646f9..801bc8f9 100644 --- a/bootstrap/unix-88/vt100.h +++ b/bootstrap/unix-88/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef vt100__h #define vt100__h diff --git a/bootstrap/windows-48/Configuration.c b/bootstrap/windows-48/Configuration.c index 922a8909..821dff97 100644 --- a/bootstrap/windows-48/Configuration.c +++ b/bootstrap/windows-48/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" @@ -13,6 +13,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("1.95 [2016/08/22] for gcc LP64 on cygwin", Configuration_versionLong, 41); + __MOVE("1.95 [2016/08/23] for gcc LP64 on cygwin", Configuration_versionLong, 41); __ENDMOD; } diff --git a/bootstrap/windows-48/Configuration.h b/bootstrap/windows-48/Configuration.h index 0f37ea7b..ec5e865a 100644 --- a/bootstrap/windows-48/Configuration.h +++ b/bootstrap/windows-48/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/windows-48/Console.c b/bootstrap/windows-48/Console.c index 4c351b99..ebd86b8d 100644 --- a/bootstrap/windows-48/Console.c +++ b/bootstrap/windows-48/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Platform.h" @@ -21,7 +21,7 @@ export void Console_String (CHAR *s, LONGINT s__len); void Console_Flush (void) { INTEGER error; - error = Platform_Write(Platform_StdOut, (LONGINT)(uintptr_t)Console_line, Console_pos); + error = Platform_Write(Platform_StdOut, (LONGINT)(SYSTEM_ADDRESS)Console_line, Console_pos); Console_pos = 0; } diff --git a/bootstrap/windows-48/Console.h b/bootstrap/windows-48/Console.h index 710d1451..5fdd4e4d 100644 --- a/bootstrap/windows-48/Console.h +++ b/bootstrap/windows-48/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/windows-48/Files.c b/bootstrap/windows-48/Files.c index f8f34677..1f3a8e9c 100644 --- a/bootstrap/windows-48/Files.c +++ b/bootstrap/windows-48/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "Console.h" @@ -257,7 +257,7 @@ static void Files_Flush (Files_Buffer buf) if (buf->org != f->pos) { error = Platform_Seek(f->fd, buf->org, Platform_SeekSet); } - error = Platform_Write(f->fd, (LONGINT)(uintptr_t)buf->data, buf->size); + error = Platform_Write(f->fd, (LONGINT)(SYSTEM_ADDRESS)buf->data, buf->size); if (error != 0) { Files_Err((CHAR*)"error writing file", (LONGINT)19, f, error); } @@ -656,7 +656,7 @@ void Files_ReadBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT x } else { min = n; } - __MOVE((LONGINT)(uintptr_t)buf->data + offset, (LONGINT)(uintptr_t)x + xpos, min); + __MOVE((LONGINT)(SYSTEM_ADDRESS)buf->data + offset, (LONGINT)(SYSTEM_ADDRESS)x + xpos, min); offset += min; (*r).offset = offset; xpos += min; @@ -721,7 +721,7 @@ void Files_WriteBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT } else { min = n; } - __MOVE((LONGINT)(uintptr_t)x + xpos, (LONGINT)(uintptr_t)buf->data + offset, min); + __MOVE((LONGINT)(SYSTEM_ADDRESS)x + xpos, (LONGINT)(SYSTEM_ADDRESS)buf->data + offset, min); offset += min; (*r).offset = offset; if (offset > buf->size) { @@ -772,15 +772,15 @@ void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, INT *res = 3; return; } - error = Platform_Read(fdold, (LONGINT)(uintptr_t)buf, ((LONGINT)(4096)), &n); + error = Platform_Read(fdold, (LONGINT)(SYSTEM_ADDRESS)buf, ((LONGINT)(4096)), &n); while (n > 0) { - error = Platform_Write(fdnew, (LONGINT)(uintptr_t)buf, n); + error = Platform_Write(fdnew, (LONGINT)(SYSTEM_ADDRESS)buf, n); if (error != 0) { ignore = Platform_Close(fdold); ignore = Platform_Close(fdnew); Files_Err((CHAR*)"cannot move file", (LONGINT)17, NIL, error); } - error = Platform_Read(fdold, (LONGINT)(uintptr_t)buf, ((LONGINT)(4096)), &n); + error = Platform_Read(fdold, (LONGINT)(SYSTEM_ADDRESS)buf, ((LONGINT)(4096)), &n); } ignore = Platform_Close(fdold); ignore = Platform_Close(fdnew); @@ -838,7 +838,7 @@ static void Files_FlipBytes (SYSTEM_BYTE *src, LONGINT src__len, SYSTEM_BYTE *de j += 1; } } else { - __MOVE((LONGINT)(uintptr_t)src, (LONGINT)(uintptr_t)dest, src__len); + __MOVE((LONGINT)(SYSTEM_ADDRESS)src, (LONGINT)(SYSTEM_ADDRESS)dest, src__len); } } @@ -1008,7 +1008,7 @@ static void Files_Finalize (SYSTEM_PTR o) { Files_File f = NIL; LONGINT res; - f = (Files_File)(uintptr_t)o; + f = (Files_File)(SYSTEM_ADDRESS)o; if (f->fd >= 0) { Files_CloseOSFile(f); if (f->tempFile) { diff --git a/bootstrap/windows-48/Files.h b/bootstrap/windows-48/Files.h index ecab7ec5..868f24df 100644 --- a/bootstrap/windows-48/Files.h +++ b/bootstrap/windows-48/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/windows-48/Heap.c b/bootstrap/windows-48/Heap.c index 55f46a85..30ec687a 100644 --- a/bootstrap/windows-48/Heap.c +++ b/bootstrap/windows-48/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tskSfF */ #include "SYSTEM.h" struct Heap__1 { @@ -101,7 +101,7 @@ export void Heap_Unlock (void); extern void *Heap__init(); extern LONGINT Platform_MainStackFrame; extern LONGINT Platform_OSAllocate(LONGINT size); -#define Heap_FetchAddress(pointer) (LONGINT)(uintptr_t)(*((void**)((uintptr_t)pointer))) +#define Heap_FetchAddress(pointer) (LONGINT)(SYSTEM_ADDRESS)(*((void**)((SYSTEM_ADDRESS)pointer))) #define Heap_HeapModuleInit() Heap__init() #define Heap_OSAllocate(size) Platform_OSAllocate(size) #define Heap_PlatformHalt(code) Platform_Halt(code) @@ -134,7 +134,7 @@ SYSTEM_PTR Heap_REGMOD (Heap_ModuleName name, Heap_EnumProc enumPtrs) __COPY(name, m->name, ((LONGINT)(20))); m->refcnt = 0; m->enumPtrs = enumPtrs; - m->next = (Heap_Module)(uintptr_t)Heap_modules; + m->next = (Heap_Module)(SYSTEM_ADDRESS)Heap_modules; Heap_modules = (SYSTEM_PTR)m; _o_result = (void*)m; return _o_result; @@ -315,7 +315,7 @@ SYSTEM_PTR Heap_NEWREC (LONGINT tag) __PUT(adr + 8, 0, LONGINT); Heap_allocated += blksz; Heap_Unlock(); - _o_result = (SYSTEM_PTR)(uintptr_t)(adr + 4); + _o_result = (SYSTEM_PTR)(SYSTEM_ADDRESS)(adr + 4); return _o_result; } @@ -326,12 +326,12 @@ SYSTEM_PTR Heap_NEWBLK (LONGINT size) SYSTEM_PTR new; Heap_Lock(); blksz = __ASHL(__ASHR(size + 31, 4), 4); - new = Heap_NEWREC((LONGINT)(uintptr_t)&blksz); - tag = ((LONGINT)(uintptr_t)new + blksz) - 12; + new = Heap_NEWREC((LONGINT)(SYSTEM_ADDRESS)&blksz); + tag = ((LONGINT)(SYSTEM_ADDRESS)new + blksz) - 12; __PUT(tag - 4, 0, LONGINT); __PUT(tag, blksz, LONGINT); __PUT(tag + 4, -4, LONGINT); - __PUT((LONGINT)(uintptr_t)new - 4, tag, LONGINT); + __PUT((LONGINT)(SYSTEM_ADDRESS)new - 4, tag, LONGINT); Heap_Unlock(); _o_result = new; return _o_result; @@ -360,7 +360,7 @@ static void Heap_Mark (LONGINT q) __GET(tag, offset, LONGINT); fld = q + offset; p = Heap_FetchAddress(fld); - __PUT(fld, (SYSTEM_PTR)(uintptr_t)n, SYSTEM_PTR); + __PUT(fld, (SYSTEM_PTR)(SYSTEM_ADDRESS)n, SYSTEM_PTR); } else { fld = q + offset; n = Heap_FetchAddress(fld); @@ -369,7 +369,7 @@ static void Heap_Mark (LONGINT q) if (!__ODD(tagbits)) { __PUT(n - 4, tagbits + 1, LONGINT); __PUT(q - 4, tag + 1, LONGINT); - __PUT(fld, (SYSTEM_PTR)(uintptr_t)p, SYSTEM_PTR); + __PUT(fld, (SYSTEM_PTR)(SYSTEM_ADDRESS)p, SYSTEM_PTR); p = q; q = n; tag = tagbits; @@ -384,7 +384,7 @@ static void Heap_Mark (LONGINT q) static void Heap_MarkP (SYSTEM_PTR p) { - Heap_Mark((LONGINT)(uintptr_t)p); + Heap_Mark((LONGINT)(SYSTEM_ADDRESS)p); } static void Heap_Scan (void) @@ -553,7 +553,7 @@ static void Heap_Finalize (void) } else { prev->next = n->next; } - (*n->finalize)((SYSTEM_PTR)(uintptr_t)n->obj); + (*n->finalize)((SYSTEM_PTR)(SYSTEM_ADDRESS)n->obj); if (prev == NIL) { n = Heap_fin; } else { @@ -572,7 +572,7 @@ void Heap_FINALL (void) while (Heap_fin != NIL) { n = Heap_fin; Heap_fin = Heap_fin->next; - (*n->finalize)((SYSTEM_PTR)(uintptr_t)n->obj); + (*n->finalize)((SYSTEM_PTR)(SYSTEM_ADDRESS)n->obj); } } @@ -589,9 +589,9 @@ static void Heap_MarkStack (LONGINT n, LONGINT *cand, LONGINT cand__len) } if (n == 0) { nofcand = 0; - sp = (LONGINT)(uintptr_t)&frame; + sp = (LONGINT)(SYSTEM_ADDRESS)&frame; stack0 = Heap_PlatformMainStackFrame(); - inc = (LONGINT)(uintptr_t)&align.p - (LONGINT)(uintptr_t)&align; + inc = (LONGINT)(SYSTEM_ADDRESS)&align.p - (LONGINT)(SYSTEM_ADDRESS)&align; if (sp > stack0) { inc = -inc; } @@ -622,7 +622,7 @@ void Heap_GC (BOOLEAN markStack) LONGINT cand[10000]; if (Heap_lockdepth == 0 || (Heap_lockdepth == 1 && !markStack)) { Heap_Lock(); - m = (Heap_Module)(uintptr_t)Heap_modules; + m = (Heap_Module)(SYSTEM_ADDRESS)Heap_modules; while (m != NIL) { if (m->enumPtrs != NIL) { (*m->enumPtrs)(Heap_MarkP); @@ -699,7 +699,7 @@ void Heap_RegisterFinalizer (SYSTEM_PTR obj, Heap_Finalizer finalize) { Heap_FinNode f; __NEW(f, Heap_FinDesc); - f->obj = (LONGINT)(uintptr_t)obj; + f->obj = (LONGINT)(SYSTEM_ADDRESS)obj; f->finalize = finalize; f->marked = 1; f->next = Heap_fin; diff --git a/bootstrap/windows-48/Heap.h b/bootstrap/windows-48/Heap.h index ef7348cf..a2cab30c 100644 --- a/bootstrap/windows-48/Heap.h +++ b/bootstrap/windows-48/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tskSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/windows-48/Modules.c b/bootstrap/windows-48/Modules.c index f69edc96..330b7506 100644 --- a/bootstrap/windows-48/Modules.c +++ b/bootstrap/windows-48/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Console.h" #include "Heap.h" diff --git a/bootstrap/windows-48/Modules.h b/bootstrap/windows-48/Modules.h index 3c0af484..ac8ac89e 100644 --- a/bootstrap/windows-48/Modules.h +++ b/bootstrap/windows-48/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/windows-48/OPB.c b/bootstrap/windows-48/OPB.c index be093f93..0f614e6a 100644 --- a/bootstrap/windows-48/OPB.c +++ b/bootstrap/windows-48/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPM.h" #include "OPS.h" diff --git a/bootstrap/windows-48/OPB.h b/bootstrap/windows-48/OPB.h index cd52fbdd..d1c88266 100644 --- a/bootstrap/windows-48/OPB.h +++ b/bootstrap/windows-48/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/windows-48/OPC.c b/bootstrap/windows-48/OPC.c index 617bf8e8..3abccc9a 100644 --- a/bootstrap/windows-48/OPC.c +++ b/bootstrap/windows-48/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "OPM.h" diff --git a/bootstrap/windows-48/OPC.h b/bootstrap/windows-48/OPC.h index 6d5f3632..b7d34a07 100644 --- a/bootstrap/windows-48/OPC.h +++ b/bootstrap/windows-48/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/windows-48/OPM.c b/bootstrap/windows-48/OPM.c index db989d91..bf683e41 100644 --- a/bootstrap/windows-48/OPM.c +++ b/bootstrap/windows-48/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "Console.h" @@ -544,15 +544,15 @@ void OPM_FPrintReal (LONGINT *fp, REAL real) { INTEGER i; LONGINT l; - __GET((LONGINT)(uintptr_t)&real, l, LONGINT); + __GET((LONGINT)(SYSTEM_ADDRESS)&real, l, LONGINT); OPM_FPrint(&*fp, l); } void OPM_FPrintLReal (LONGINT *fp, LONGREAL lr) { LONGINT l, h; - __GET((LONGINT)(uintptr_t)&lr, l, LONGINT); - __GET((LONGINT)(uintptr_t)&lr + 4, h, LONGINT); + __GET((LONGINT)(SYSTEM_ADDRESS)&lr, l, LONGINT); + __GET((LONGINT)(SYSTEM_ADDRESS)&lr + 4, h, LONGINT); OPM_FPrint(&*fp, l); OPM_FPrint(&*fp, h); } diff --git a/bootstrap/windows-48/OPM.h b/bootstrap/windows-48/OPM.h index 1daa7dac..ed914bff 100644 --- a/bootstrap/windows-48/OPM.h +++ b/bootstrap/windows-48/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPM__h #define OPM__h diff --git a/bootstrap/windows-48/OPP.c b/bootstrap/windows-48/OPP.c index 447f956e..d9698b7e 100644 --- a/bootstrap/windows-48/OPP.c +++ b/bootstrap/windows-48/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPB.h" #include "OPM.h" diff --git a/bootstrap/windows-48/OPP.h b/bootstrap/windows-48/OPP.h index 6e6eb0af..bf56b7d7 100644 --- a/bootstrap/windows-48/OPP.h +++ b/bootstrap/windows-48/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/windows-48/OPS.c b/bootstrap/windows-48/OPS.c index 474724c8..cacf9256 100644 --- a/bootstrap/windows-48/OPS.c +++ b/bootstrap/windows-48/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */ #include "SYSTEM.h" #include "OPM.h" diff --git a/bootstrap/windows-48/OPS.h b/bootstrap/windows-48/OPS.h index 367bfc1b..e901bcfc 100644 --- a/bootstrap/windows-48/OPS.h +++ b/bootstrap/windows-48/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/windows-48/OPT.c b/bootstrap/windows-48/OPT.c index 3e2611b8..b32d0ebd 100644 --- a/bootstrap/windows-48/OPT.c +++ b/bootstrap/windows-48/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPM.h" #include "OPS.h" diff --git a/bootstrap/windows-48/OPT.h b/bootstrap/windows-48/OPT.h index 3c3bb75b..41b3e7ec 100644 --- a/bootstrap/windows-48/OPT.h +++ b/bootstrap/windows-48/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/windows-48/OPV.c b/bootstrap/windows-48/OPV.c index 85aca692..cf646f5e 100644 --- a/bootstrap/windows-48/OPV.c +++ b/bootstrap/windows-48/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPC.h" #include "OPM.h" @@ -931,7 +931,7 @@ static void OPV_expr (OPT_Node n, INTEGER prec) OPM_Write(')'); break; case 24: - OPM_WriteString((CHAR*)"(LONGINT)(uintptr_t)", (LONGINT)21); + OPM_WriteString((CHAR*)"(LONGINT)(SYSTEM_ADDRESS)", (LONGINT)26); if (l->class == 1) { OPC_CompleteIdent(l->obj); } else { @@ -947,7 +947,7 @@ static void OPV_expr (OPT_Node n, INTEGER prec) OPC_Ident(n->typ->strobj); OPM_Write(')'); if (__IN(n->typ->form, 0x6000) || __IN(l->typ->form, 0x6000)) { - OPM_WriteString((CHAR*)"(uintptr_t)", (LONGINT)12); + OPM_WriteString((CHAR*)"(SYSTEM_ADDRESS)", (LONGINT)17); } OPV_expr(l, exprPrec); } else { diff --git a/bootstrap/windows-48/OPV.h b/bootstrap/windows-48/OPV.h index c0e4b80e..04828b2f 100644 --- a/bootstrap/windows-48/OPV.h +++ b/bootstrap/windows-48/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/windows-48/Platform.c b/bootstrap/windows-48/Platform.c index 75b51a60..4e8b44c8 100644 --- a/bootstrap/windows-48/Platform.c +++ b/bootstrap/windows-48/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" typedef @@ -111,9 +111,9 @@ export BOOLEAN Platform_getEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT extern void Heap_InitHeap(); #define Platform_GetTickCount() (LONGINT)(SYSTEM_CARD32)GetTickCount() #define Platform_HeapInitHeap() Heap_InitHeap() -#define Platform_SetInterruptHandler(h) SystemSetInterruptHandler((uintptr_t)h) -#define Platform_SetQuitHandler(h) SystemSetQuitHandler((uintptr_t)h) -#define Platform_allocate(size) (LONGINT)(uintptr_t)((void*)HeapAlloc(GetProcessHeap(), 0, (size_t)size)) +#define Platform_SetInterruptHandler(h) SystemSetInterruptHandler((SYSTEM_ADDRESS)h) +#define Platform_SetQuitHandler(h) SystemSetQuitHandler((SYSTEM_ADDRESS)h) +#define Platform_allocate(size) (LONGINT)(SYSTEM_ADDRESS)((void*)HeapAlloc(GetProcessHeap(), 0, (size_t)size)) #define Platform_bhfiIndexHigh() (LONGINT)bhfi.nFileIndexHigh #define Platform_bhfiIndexLow() (LONGINT)bhfi.nFileIndexLow #define Platform_bhfiMtimeHigh() (LONGINT)bhfi.ftLastWriteTime.dwHighDateTime @@ -121,44 +121,44 @@ extern void Heap_InitHeap(); #define Platform_bhfiVsn() (LONGINT)bhfi.dwVolumeSerialNumber #define Platform_byHandleFileInformation() BY_HANDLE_FILE_INFORMATION bhfi #define Platform_cleanupProcess() CloseHandle(pi.hProcess); CloseHandle(pi.hThread); -#define Platform_closeHandle(h) (INTEGER)CloseHandle((HANDLE)(uintptr_t)h) +#define Platform_closeHandle(h) (INTEGER)CloseHandle((HANDLE)(SYSTEM_ADDRESS)h) #define Platform_createProcess(str, str__len) (INTEGER)CreateProcess(0, (char*)str, 0,0,0,0,0,0,&si,&pi) #define Platform_deleteFile(n, n__len) (INTEGER)DeleteFile((char*)n) #define Platform_err() (INTEGER)GetLastError() -#define Platform_errc(c) WriteFile((HANDLE)(uintptr_t)Platform_StdOut, &c, 1, 0,0) -#define Platform_errstring(s, s__len) WriteFile((HANDLE)(uintptr_t)Platform_StdOut, s, s__len-1, 0,0) +#define Platform_errc(c) WriteFile((HANDLE)(SYSTEM_ADDRESS)Platform_StdOut, &c, 1, 0,0) +#define Platform_errstring(s, s__len) WriteFile((HANDLE)(SYSTEM_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)(uintptr_t)h) -#define Platform_free(address) HeapFree(GetProcessHeap(), 0, (void*)(uintptr_t)address) +#define Platform_flushFileBuffers(h) (INTEGER)FlushFileBuffers((HANDLE)(SYSTEM_ADDRESS)h) +#define Platform_free(address) HeapFree(GetProcessHeap(), 0, (void*)(SYSTEM_ADDRESS)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) #define Platform_getExitCodeProcess(exitcode) GetExitCodeProcess(pi.hProcess, (DWORD*)exitcode); -#define Platform_getFileInformationByHandle(h) (INTEGER)GetFileInformationByHandle((HANDLE)(uintptr_t)h, &bhfi) -#define Platform_getFilePos(h, r, rc) LARGE_INTEGER liz = {0}; *rc = (INTEGER)SetFilePointerEx((HANDLE)(uintptr_t)h, liz, &li, FILE_CURRENT); *r = (LONGINT)li.QuadPart -#define Platform_getFileSize(h) (INTEGER)GetFileSizeEx((HANDLE)(uintptr_t)h, &li) +#define Platform_getFileInformationByHandle(h) (INTEGER)GetFileInformationByHandle((HANDLE)(SYSTEM_ADDRESS)h, &bhfi) +#define Platform_getFilePos(h, r, rc) LARGE_INTEGER liz = {0}; *rc = (INTEGER)SetFilePointerEx((HANDLE)(SYSTEM_ADDRESS)h, liz, &li, FILE_CURRENT); *r = (LONGINT)li.QuadPart +#define Platform_getFileSize(h) (INTEGER)GetFileSizeEx((HANDLE)(SYSTEM_ADDRESS)h, &li) #define Platform_getLocalTime() SYSTEMTIME st; GetLocalTime(&st) #define Platform_getenv(name, name__len, buf, buf__len) (INTEGER)GetEnvironmentVariable((char*)name, (char*)buf, buf__len) #define Platform_getpid() (INTEGER)GetCurrentProcessId() -#define Platform_getstderrhandle() (uintptr_t)GetStdHandle(STD_ERROR_HANDLE) -#define Platform_getstdinhandle() (uintptr_t)GetStdHandle(STD_INPUT_HANDLE) -#define Platform_getstdouthandle() (uintptr_t)GetStdHandle(STD_OUTPUT_HANDLE) +#define Platform_getstderrhandle() (SYSTEM_ADDRESS)GetStdHandle(STD_ERROR_HANDLE) +#define Platform_getstdinhandle() (SYSTEM_ADDRESS)GetStdHandle(STD_INPUT_HANDLE) +#define Platform_getstdouthandle() (SYSTEM_ADDRESS)GetStdHandle(STD_OUTPUT_HANDLE) #define Platform_identityToFileTime(i) FILETIME ft; ft.dwHighDateTime = i.mtimehigh; ft.dwLowDateTime = i.mtimelow -#define Platform_invalidHandleValue() ((LONGINT)(uintptr_t)INVALID_HANDLE_VALUE) +#define Platform_invalidHandleValue() ((LONGINT)(SYSTEM_ADDRESS)INVALID_HANDLE_VALUE) #define Platform_largeInteger() LARGE_INTEGER li #define Platform_liLongint() (LONGINT)li.QuadPart #define Platform_moveFile(o, o__len, n, n__len) (INTEGER)MoveFileEx((char*)o, (char*)n, MOVEFILE_REPLACE_EXISTING) -#define Platform_opennew(n, n__len) (LONGINT)(uintptr_t)CreateFile((char*)n, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0) -#define Platform_openro(n, n__len) (LONGINT)(uintptr_t)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)(uintptr_t)CreateFile((char*)n, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0) +#define Platform_opennew(n, n__len) (LONGINT)(SYSTEM_ADDRESS)CreateFile((char*)n, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0) +#define Platform_openro(n, n__len) (LONGINT)(SYSTEM_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)(SYSTEM_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)(uintptr_t)fd, (void*)(uintptr_t)(p), (DWORD)l, (DWORD*)n, 0) +#define Platform_readfile(fd, p, l, n) (INTEGER)ReadFile ((HANDLE)(SYSTEM_ADDRESS)fd, (void*)(SYSTEM_ADDRESS)(p), (DWORD)l, (DWORD*)n, 0) #define Platform_seekcur() FILE_CURRENT #define Platform_seekend() FILE_END #define Platform_seekset() FILE_BEGIN #define Platform_setCurrentDirectory(n, n__len) (INTEGER)SetCurrentDirectory((char*)n) -#define Platform_setEndOfFile(h) (INTEGER)SetEndOfFile((HANDLE)(uintptr_t)h) -#define Platform_setFilePointerEx(h, o, r, rc) li.QuadPart=o; *rc = (INTEGER)SetFilePointerEx((HANDLE)(uintptr_t)h, li, 0, (DWORD)r) +#define Platform_setEndOfFile(h) (INTEGER)SetEndOfFile((HANDLE)(SYSTEM_ADDRESS)h) +#define Platform_setFilePointerEx(h, o, r, rc) li.QuadPart=o; *rc = (INTEGER)SetFilePointerEx((HANDLE)(SYSTEM_ADDRESS)h, li, 0, (DWORD)r) #define Platform_sleep(ms) Sleep((DWORD)ms) #define Platform_stToFt() FILETIME ft; SystemTimeToFileTime(&st, &ft) #define Platform_startupInfo() STARTUPINFO si = {0}; si.cb = sizeof(si); @@ -173,7 +173,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)(uintptr_t)fd, (void*)(uintptr_t)(p), (DWORD)l, 0,0) +#define Platform_writefile(fd, p, l) (INTEGER)WriteFile((HANDLE)(SYSTEM_ADDRESS)fd, (void*)(SYSTEM_ADDRESS)(p), (DWORD)l, 0,0) BOOLEAN Platform_TooManyFiles (INTEGER e) { @@ -241,7 +241,7 @@ void Platform_Init (INTEGER argc, LONGINT argvadr) Platform_ArgVecPtr av = NIL; Platform_MainStackFrame = argvadr; Platform_ArgCount = argc; - av = (Platform_ArgVecPtr)(uintptr_t)argvadr; + av = (Platform_ArgVecPtr)(SYSTEM_ADDRESS)argvadr; Platform_ArgVector = (*av)[0]; Platform_HaltCode = -128; Platform_HeapInitHeap(); @@ -280,7 +280,7 @@ void Platform_GetArg (INTEGER n, CHAR *val, LONGINT val__len) { Platform_ArgVec av = NIL; if (n < Platform_ArgCount) { - av = (Platform_ArgVec)(uintptr_t)Platform_ArgVector; + av = (Platform_ArgVec)(SYSTEM_ADDRESS)Platform_ArgVector; __COPY(*(*av)[__X(n, ((LONGINT)(1024)))], val, val__len); } } @@ -559,7 +559,7 @@ INTEGER Platform_ReadBuf (LONGINT h, SYSTEM_BYTE *b, LONGINT b__len, LONGINT *n) INTEGER _o_result; INTEGER result; *n = 0; - result = Platform_readfile(h, (LONGINT)(uintptr_t)b, b__len, &*n); + result = Platform_readfile(h, (LONGINT)(SYSTEM_ADDRESS)b, b__len, &*n); if (result == 0) { *n = 0; _o_result = Platform_err(); @@ -795,7 +795,7 @@ static void Platform_TestLittleEndian (void) { INTEGER i; i = 1; - __GET((LONGINT)(uintptr_t)&i, Platform_LittleEndian, BOOLEAN); + __GET((LONGINT)(SYSTEM_ADDRESS)&i, Platform_LittleEndian, BOOLEAN); } __TDESC(Platform_FileIdentity, 1, 0) = {__TDFLDS("FileIdentity", 20), {-4}}; diff --git a/bootstrap/windows-48/Platform.h b/bootstrap/windows-48/Platform.h index dece75aa..673b2b0b 100644 --- a/bootstrap/windows-48/Platform.h +++ b/bootstrap/windows-48/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Platform__h #define Platform__h @@ -78,7 +78,7 @@ import INTEGER Platform_Write (LONGINT h, LONGINT p, LONGINT l); import BOOLEAN Platform_getEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT val__len); import void *Platform__init(void); -#define Platform_SetInterruptHandler(h) SystemSetInterruptHandler((uintptr_t)h) -#define Platform_SetQuitHandler(h) SystemSetQuitHandler((uintptr_t)h) +#define Platform_SetInterruptHandler(h) SystemSetInterruptHandler((SYSTEM_ADDRESS)h) +#define Platform_SetQuitHandler(h) SystemSetQuitHandler((SYSTEM_ADDRESS)h) #endif diff --git a/bootstrap/windows-48/Reals.c b/bootstrap/windows-48/Reals.c index 43583aa9..2323e34d 100644 --- a/bootstrap/windows-48/Reals.c +++ b/bootstrap/windows-48/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" @@ -58,7 +58,7 @@ INTEGER Reals_Expo (REAL x) { INTEGER _o_result; INTEGER i; - __GET((LONGINT)(uintptr_t)&x + 2, i, INTEGER); + __GET((LONGINT)(SYSTEM_ADDRESS)&x + 2, i, INTEGER); _o_result = __MASK(__ASHR(i, 7), -256); return _o_result; } @@ -66,17 +66,17 @@ INTEGER Reals_Expo (REAL x) void Reals_SetExpo (REAL *x, INTEGER ex) { CHAR c; - __GET((LONGINT)(uintptr_t)x + 3, c, CHAR); - __PUT((LONGINT)(uintptr_t)x + 3, (CHAR)(__ASHL(__ASHR((int)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR); - __GET((LONGINT)(uintptr_t)x + 2, c, CHAR); - __PUT((LONGINT)(uintptr_t)x + 2, (CHAR)(__MASK((int)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR); + __GET((LONGINT)(SYSTEM_ADDRESS)x + 3, c, CHAR); + __PUT((LONGINT)(SYSTEM_ADDRESS)x + 3, (CHAR)(__ASHL(__ASHR((int)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR); + __GET((LONGINT)(SYSTEM_ADDRESS)x + 2, c, CHAR); + __PUT((LONGINT)(SYSTEM_ADDRESS)x + 2, (CHAR)(__MASK((int)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR); } INTEGER Reals_ExpoL (LONGREAL x) { INTEGER _o_result; INTEGER i; - __GET((LONGINT)(uintptr_t)&x + 6, i, INTEGER); + __GET((LONGINT)(SYSTEM_ADDRESS)&x + 6, i, INTEGER); _o_result = __MASK(__ASHR(i, 4), -2048); return _o_result; } diff --git a/bootstrap/windows-48/Reals.h b/bootstrap/windows-48/Reals.h index fdae5f89..7e6b534c 100644 --- a/bootstrap/windows-48/Reals.h +++ b/bootstrap/windows-48/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/windows-48/SYSTEM.c b/bootstrap/windows-48/SYSTEM.c index 50e91c6d..33511a70 100644 --- a/bootstrap/windows-48/SYSTEM.c +++ b/bootstrap/windows-48/SYSTEM.c @@ -35,7 +35,7 @@ void SYSTEM_INHERIT(LONGINT *t, LONGINT *t0) void SYSTEM_ENUMP(void *adr, LONGINT n, void (*P)()) { while (n > 0) { - P((LONGINT)(uintptr_t)(*((void**)(adr)))); + P((LONGINT)(SYSTEM_ADDRESS)(*((void**)(adr)))); adr = ((void**)adr) + 1; n--; } @@ -106,7 +106,7 @@ SYSTEM_PTR SYSTEM_NEWARR(LONGINT *typ, LONGINT elemsz, int elemalgn, int nofdim, else if (typ == (LONGINT*)POINTER__typ) { /* element type is a pointer */ x = Heap_NEWBLK(size + nofelems * sizeof(LONGINT)); - p = (LONGINT*)(uintptr_t)x[-1]; + p = (LONGINT*)(SYSTEM_ADDRESS)x[-1]; p[-nofelems] = *p; /* build new type desc in situ: 1. copy block size; 2. setup ptr tab; 3. set sentinel; 4. patch tag */ p -= nofelems - 1; n = 1; /* n =1 for skipping the size field */ while (n <= nofelems) {*p = n*sizeof(LONGINT); p++; n++;} @@ -119,7 +119,7 @@ SYSTEM_PTR SYSTEM_NEWARR(LONGINT *typ, LONGINT elemsz, int elemalgn, int nofdim, while (ptab[nofptrs] >= 0) {nofptrs++;} /* number of pointers per element */ nptr = nofelems * nofptrs; /* total number of pointers */ x = Heap_NEWBLK(size + nptr * sizeof(LONGINT)); - p = (LONGINT*)(uintptr_t)x[- 1]; + p = (LONGINT*)(SYSTEM_ADDRESS)x[- 1]; p[-nptr] = *p; /* build new type desc in situ; 1. copy block size; 2. setup ptr tab; 3. set sentinel; 4. patch tag */ p -= nptr - 1; n = 0; off = dataoff; while (n < nofelems) {i = 0; @@ -155,7 +155,7 @@ typedef void (*SystemSignalHandler)(INTEGER); // = Platform_SignalHandler // (Ignore other signals) } - void SystemSetHandler(int s, uintptr_t h) { + void SystemSetHandler(int s, SYSTEM_ADDRESS h) { if (s >= 2 && s <= 4) { int needtosetsystemhandler = handler[s-2] == 0; handler[s-2] = (SystemSignalHandler)h; @@ -194,12 +194,12 @@ typedef void (*SystemSignalHandler)(INTEGER); // = Platform_SignalHandler } } - void SystemSetInterruptHandler(uintptr_t h) { + void SystemSetInterruptHandler(SYSTEM_ADDRESS h) { EnsureConsoleCtrlHandler(); SystemInterruptHandler = (SystemSignalHandler)h; } - void SystemSetQuitHandler(uintptr_t h) { + void SystemSetQuitHandler(SYSTEM_ADDRESS h) { EnsureConsoleCtrlHandler(); SystemQuitHandler = (SystemSignalHandler)h; } diff --git a/bootstrap/windows-48/SYSTEM.h b/bootstrap/windows-48/SYSTEM.h index 1c0b07fd..75a0aa52 100644 --- a/bootstrap/windows-48/SYSTEM.h +++ b/bootstrap/windows-48/SYSTEM.h @@ -18,23 +18,16 @@ typedef unsigned char SYSTEM_CARD8; #if (__SIZEOF_POINTER__ == 8) #if defined(_WIN64) - typedef unsigned long long SYSTEM_PTRINT; - typedef unsigned long long uintptr_t; - typedef unsigned long long size_t; + typedef unsigned long long SYSTEM_ADDRESS; #else - typedef unsigned long SYSTEM_PTRINT; - typedef unsigned long uintptr_t; - typedef unsigned long size_t; + typedef unsigned long SYSTEM_ADDRESS; #endif #else - typedef unsigned int SYSTEM_PTRINT; - typedef unsigned int uintptr_t; - typedef unsigned int size_t; + typedef unsigned int SYSTEM_ADDRESS; #endif -#define _SIZE_T_DEFINED_ // For OpenBSD -void *memcpy(void *dest, const void *source, size_t size); +void *memcpy(void *dest, const void *source, SYSTEM_ADDRESS size); @@ -111,10 +104,10 @@ extern LONGINT SYSTEM_ENTIER (double x); // Signal handling in SYSTEM.c #ifndef _WIN32 - extern void SystemSetHandler(int s, uintptr_t h); + extern void SystemSetHandler(int s, SYSTEM_ADDRESS h); #else - extern void SystemSetInterruptHandler(uintptr_t h); - extern void SystemSetQuitHandler (uintptr_t h); + extern void SystemSetInterruptHandler(SYSTEM_ADDRESS h); + extern void SystemSetQuitHandler (SYSTEM_ADDRESS h); #endif @@ -137,9 +130,9 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __COPY(s, d, n) {char*_a=(void*)s,*_b=(void*)d; LONGINT _i=0,_t=n-1; \ while(_i<_t&&((_b[_i]=_a[_i])!=0)){_i++;};_b[_i]=0;} -#define __DUP(x, l, t) x=(void*)memcpy((void*)(uintptr_t)Platform_OSAllocate(l*sizeof(t)),x,l*sizeof(t)) +#define __DUP(x, l, t) x=(void*)memcpy((void*)(SYSTEM_ADDRESS)Platform_OSAllocate(l*sizeof(t)),x,l*sizeof(t)) #define __DUPARR(v, t) v=(void*)memcpy(v##__copy,v,sizeof(t)) -#define __DEL(x) Platform_OSFree((LONGINT)(uintptr_t)x) +#define __DEL(x) Platform_OSFree((LONGINT)(SYSTEM_ADDRESS)x) @@ -149,8 +142,8 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __VAL(t, x) (*(t*)&(x)) -#define __GET(a, x, t) x= *(t*)(uintptr_t)(a) -#define __PUT(a, x, t) *(t*)(uintptr_t)(a)=x +#define __GET(a, x, t) x= *(t*)(SYSTEM_ADDRESS)(a) +#define __PUT(a, x, t) *(t*)(SYSTEM_ADDRESS)(a)=x #define __LSHL(x, n, t) ((t)((U_##t)(x)<<(n))) #define __LSHR(x, n, t) ((t)((U_##t)(x)>>(n))) @@ -165,7 +158,7 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __ROT(x, n, t) ((n)>=0? __ROTL(x, n, t): __ROTR(x, -(n), t)) #define __BIT(x, n) (*(U_LONGINT*)(x)>>(n)&1) -#define __MOVE(s, d, n) memcpy((char*)(uintptr_t)(d),(char*)(uintptr_t)(s),n) +#define __MOVE(s, d, n) memcpy((char*)(SYSTEM_ADDRESS)(d),(char*)(SYSTEM_ADDRESS)(s),n) #define __ASHF(x, n) SYSTEM_ASH((LONGINT)(x), (LONGINT)(n)) #define __SHORT(x, y) ((int)((U_LONGINT)(x)+(y)<(y)+(y)?(x):(__HALT(-8),0))) #define __SHORTF(x, y) ((int)(__RF((x)+(y),(y)+(y))-(y))) @@ -226,7 +219,7 @@ extern void Heap_INCREF(); extern void Platform_Init(INTEGER argc, LONGINT argv); extern void Heap_FINALL(); -#define __INIT(argc, argv) static void *m; Platform_Init((INTEGER)argc, (LONGINT)(uintptr_t)&argv); +#define __INIT(argc, argv) static void *m; Platform_Init((INTEGER)argc, (LONGINT)(SYSTEM_ADDRESS)&argv); #define __REGMAIN(name, enum) m = Heap_REGMOD((CHAR*)name,enum) #define __FINI Heap_FINALL(); return 0 @@ -247,7 +240,7 @@ extern SYSTEM_PTR Heap_NEWREC (LONGINT tag); extern SYSTEM_PTR SYSTEM_NEWARR(LONGINT*, LONGINT, int, int, int, ...); #define __SYSNEW(p, len) p = Heap_NEWBLK((LONGINT)(len)) -#define __NEW(p, t) p = Heap_NEWREC((LONGINT)(uintptr_t)t##__typ) +#define __NEW(p, t) p = Heap_NEWREC((LONGINT)(SYSTEM_ADDRESS)t##__typ) #define __NEWARR SYSTEM_NEWARR @@ -278,20 +271,20 @@ extern SYSTEM_PTR SYSTEM_NEWARR(LONGINT*, LONGINT, int, int, int, ...); #define __INITYP(t, t0, level) \ t##__typ = (LONGINT*)&t##__desc.blksz; \ memcpy(t##__desc.basep, t0##__typ - __BASEOFF, level*sizeof(LONGINT)); \ - t##__desc.basep[level] = (LONGINT)(uintptr_t)t##__typ; \ - t##__desc.module = (LONGINT)(uintptr_t)m; \ + t##__desc.basep[level] = (LONGINT)(SYSTEM_ADDRESS)t##__typ; \ + t##__desc.module = (LONGINT)(SYSTEM_ADDRESS)m; \ if(t##__desc.blksz!=sizeof(struct t)) __HALT(-15); \ t##__desc.blksz = (t##__desc.blksz+5*sizeof(LONGINT)-1)/(4*sizeof(LONGINT))*(4*sizeof(LONGINT)); \ - Heap_REGTYP(m, (LONGINT)(uintptr_t)&t##__desc.next); \ + Heap_REGTYP(m, (LONGINT)(SYSTEM_ADDRESS)&t##__desc.next); \ SYSTEM_INHERIT(t##__typ, t0##__typ) -#define __IS(tag, typ, level) (*(tag-(__BASEOFF-level))==(LONGINT)(uintptr_t)typ##__typ) -#define __TYPEOF(p) ((LONGINT*)(uintptr_t)(*(((LONGINT*)(p))-1))) +#define __IS(tag, typ, level) (*(tag-(__BASEOFF-level))==(LONGINT)(SYSTEM_ADDRESS)typ##__typ) +#define __TYPEOF(p) ((LONGINT*)(SYSTEM_ADDRESS)(*(((LONGINT*)(p))-1))) #define __ISP(p, typ, level) __IS(__TYPEOF(p),typ,level) // Oberon-2 type bound procedures support -#define __INITBP(t, proc, num) *(t##__typ-(__TPROC0OFF+num))=(LONGINT)(uintptr_t)proc -#define __SEND(typ, num, funtyp, parlist) ((funtyp)((uintptr_t)*(typ-(__TPROC0OFF+num))))parlist +#define __INITBP(t, proc, num) *(t##__typ-(__TPROC0OFF+num))=(LONGINT)(SYSTEM_ADDRESS)proc +#define __SEND(typ, num, funtyp, parlist) ((funtyp)((SYSTEM_ADDRESS)*(typ-(__TPROC0OFF+num))))parlist diff --git a/bootstrap/windows-48/Strings.c b/bootstrap/windows-48/Strings.c index 51468a69..115456ea 100644 --- a/bootstrap/windows-48/Strings.c +++ b/bootstrap/windows-48/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" diff --git a/bootstrap/windows-48/Strings.h b/bootstrap/windows-48/Strings.h index 4245a515..96dbb01d 100644 --- a/bootstrap/windows-48/Strings.h +++ b/bootstrap/windows-48/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/windows-48/Texts.c b/bootstrap/windows-48/Texts.c index 627370de..cfe34ca7 100644 --- a/bootstrap/windows-48/Texts.c +++ b/bootstrap/windows-48/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Files.h" #include "Modules.h" diff --git a/bootstrap/windows-48/Texts.h b/bootstrap/windows-48/Texts.h index 7214a16b..632b644a 100644 --- a/bootstrap/windows-48/Texts.h +++ b/bootstrap/windows-48/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/windows-48/Vishap.c b/bootstrap/windows-48/Vishap.c index 97c8c849..4c9e3b45 100644 --- a/bootstrap/windows-48/Vishap.c +++ b/bootstrap/windows-48/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkamSf */ #include "SYSTEM.h" #include "Configuration.h" #include "Heap.h" diff --git a/bootstrap/windows-48/errors.c b/bootstrap/windows-48/errors.c index 3facbaa9..68e433df 100644 --- a/bootstrap/windows-48/errors.c +++ b/bootstrap/windows-48/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" typedef diff --git a/bootstrap/windows-48/errors.h b/bootstrap/windows-48/errors.h index 719043cb..41d399ad 100644 --- a/bootstrap/windows-48/errors.h +++ b/bootstrap/windows-48/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/windows-48/extTools.c b/bootstrap/windows-48/extTools.c index 7785adc7..4efd107a 100644 --- a/bootstrap/windows-48/extTools.c +++ b/bootstrap/windows-48/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "Console.h" diff --git a/bootstrap/windows-48/extTools.h b/bootstrap/windows-48/extTools.h index b189ebeb..fc4f0da1 100644 --- a/bootstrap/windows-48/extTools.h +++ b/bootstrap/windows-48/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/windows-48/vt100.c b/bootstrap/windows-48/vt100.c index 891d7e43..d77b0b84 100644 --- a/bootstrap/windows-48/vt100.c +++ b/bootstrap/windows-48/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Console.h" #include "Strings.h" diff --git a/bootstrap/windows-48/vt100.h b/bootstrap/windows-48/vt100.h index 9a9a6144..4af04d6e 100644 --- a/bootstrap/windows-48/vt100.h +++ b/bootstrap/windows-48/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef vt100__h #define vt100__h diff --git a/bootstrap/windows-88/Configuration.c b/bootstrap/windows-88/Configuration.c index 018926c5..47f1ffc7 100644 --- a/bootstrap/windows-88/Configuration.c +++ b/bootstrap/windows-88/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" @@ -14,6 +14,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("1.95 [2016/08/22] for gcc LP64 on cygwin", Configuration_versionLong, 41); + __MOVE("1.95 [2016/08/23] for gcc LP64 on cygwin", Configuration_versionLong, 41); __ENDMOD; } diff --git a/bootstrap/windows-88/Configuration.h b/bootstrap/windows-88/Configuration.h index 333cefa8..ba0bbd99 100644 --- a/bootstrap/windows-88/Configuration.h +++ b/bootstrap/windows-88/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/windows-88/Console.c b/bootstrap/windows-88/Console.c index a5636056..5a9998a9 100644 --- a/bootstrap/windows-88/Console.c +++ b/bootstrap/windows-88/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Platform.h" @@ -22,7 +22,7 @@ export void Console_String (CHAR *s, LONGINT s__len); void Console_Flush (void) { INTEGER error; - error = Platform_Write(Platform_StdOut, (LONGINT)(uintptr_t)Console_line, Console_pos); + error = Platform_Write(Platform_StdOut, (LONGINT)(SYSTEM_ADDRESS)Console_line, Console_pos); Console_pos = 0; } diff --git a/bootstrap/windows-88/Console.h b/bootstrap/windows-88/Console.h index 23eb9888..4606384c 100644 --- a/bootstrap/windows-88/Console.h +++ b/bootstrap/windows-88/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/windows-88/Files.c b/bootstrap/windows-88/Files.c index 6a346319..c46ffdd2 100644 --- a/bootstrap/windows-88/Files.c +++ b/bootstrap/windows-88/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Configuration.h" @@ -258,7 +258,7 @@ static void Files_Flush (Files_Buffer buf) if (buf->org != f->pos) { error = Platform_Seek(f->fd, buf->org, Platform_SeekSet); } - error = Platform_Write(f->fd, (LONGINT)(uintptr_t)buf->data, buf->size); + error = Platform_Write(f->fd, (LONGINT)(SYSTEM_ADDRESS)buf->data, buf->size); if (error != 0) { Files_Err((CHAR*)"error writing file", (LONGINT)19, f, error); } @@ -657,7 +657,7 @@ void Files_ReadBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT x } else { min = n; } - __MOVE((LONGINT)(uintptr_t)buf->data + offset, (LONGINT)(uintptr_t)x + xpos, min); + __MOVE((LONGINT)(SYSTEM_ADDRESS)buf->data + offset, (LONGINT)(SYSTEM_ADDRESS)x + xpos, min); offset += min; (*r).offset = offset; xpos += min; @@ -722,7 +722,7 @@ void Files_WriteBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT } else { min = n; } - __MOVE((LONGINT)(uintptr_t)x + xpos, (LONGINT)(uintptr_t)buf->data + offset, min); + __MOVE((LONGINT)(SYSTEM_ADDRESS)x + xpos, (LONGINT)(SYSTEM_ADDRESS)buf->data + offset, min); offset += min; (*r).offset = offset; if (offset > buf->size) { @@ -773,15 +773,15 @@ void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, INT *res = 3; return; } - error = Platform_Read(fdold, (LONGINT)(uintptr_t)buf, ((LONGINT)(4096)), &n); + error = Platform_Read(fdold, (LONGINT)(SYSTEM_ADDRESS)buf, ((LONGINT)(4096)), &n); while (n > 0) { - error = Platform_Write(fdnew, (LONGINT)(uintptr_t)buf, n); + error = Platform_Write(fdnew, (LONGINT)(SYSTEM_ADDRESS)buf, n); if (error != 0) { ignore = Platform_Close(fdold); ignore = Platform_Close(fdnew); Files_Err((CHAR*)"cannot move file", (LONGINT)17, NIL, error); } - error = Platform_Read(fdold, (LONGINT)(uintptr_t)buf, ((LONGINT)(4096)), &n); + error = Platform_Read(fdold, (LONGINT)(SYSTEM_ADDRESS)buf, ((LONGINT)(4096)), &n); } ignore = Platform_Close(fdold); ignore = Platform_Close(fdnew); @@ -839,7 +839,7 @@ static void Files_FlipBytes (SYSTEM_BYTE *src, LONGINT src__len, SYSTEM_BYTE *de j += 1; } } else { - __MOVE((LONGINT)(uintptr_t)src, (LONGINT)(uintptr_t)dest, src__len); + __MOVE((LONGINT)(SYSTEM_ADDRESS)src, (LONGINT)(SYSTEM_ADDRESS)dest, src__len); } } @@ -1009,7 +1009,7 @@ static void Files_Finalize (SYSTEM_PTR o) { Files_File f = NIL; LONGINT res; - f = (Files_File)(uintptr_t)o; + f = (Files_File)(SYSTEM_ADDRESS)o; if (f->fd >= 0) { Files_CloseOSFile(f); if (f->tempFile) { diff --git a/bootstrap/windows-88/Files.h b/bootstrap/windows-88/Files.h index 3777880a..eb946544 100644 --- a/bootstrap/windows-88/Files.h +++ b/bootstrap/windows-88/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/windows-88/Heap.c b/bootstrap/windows-88/Heap.c index d51ad5c2..9873a734 100644 --- a/bootstrap/windows-88/Heap.c +++ b/bootstrap/windows-88/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tskSfF */ #define LARGE #include "SYSTEM.h" @@ -102,7 +102,7 @@ export void Heap_Unlock (void); extern void *Heap__init(); extern LONGINT Platform_MainStackFrame; extern LONGINT Platform_OSAllocate(LONGINT size); -#define Heap_FetchAddress(pointer) (LONGINT)(uintptr_t)(*((void**)((uintptr_t)pointer))) +#define Heap_FetchAddress(pointer) (LONGINT)(SYSTEM_ADDRESS)(*((void**)((SYSTEM_ADDRESS)pointer))) #define Heap_HeapModuleInit() Heap__init() #define Heap_OSAllocate(size) Platform_OSAllocate(size) #define Heap_PlatformHalt(code) Platform_Halt(code) @@ -135,7 +135,7 @@ SYSTEM_PTR Heap_REGMOD (Heap_ModuleName name, Heap_EnumProc enumPtrs) __COPY(name, m->name, ((LONGINT)(20))); m->refcnt = 0; m->enumPtrs = enumPtrs; - m->next = (Heap_Module)(uintptr_t)Heap_modules; + m->next = (Heap_Module)(SYSTEM_ADDRESS)Heap_modules; Heap_modules = (SYSTEM_PTR)m; _o_result = (void*)m; return _o_result; @@ -316,7 +316,7 @@ SYSTEM_PTR Heap_NEWREC (LONGINT tag) __PUT(adr + 16, 0, LONGINT); Heap_allocated += blksz; Heap_Unlock(); - _o_result = (SYSTEM_PTR)(uintptr_t)(adr + 8); + _o_result = (SYSTEM_PTR)(SYSTEM_ADDRESS)(adr + 8); return _o_result; } @@ -327,12 +327,12 @@ SYSTEM_PTR Heap_NEWBLK (LONGINT size) SYSTEM_PTR new; Heap_Lock(); blksz = __ASHL(__ASHR(size + 63, 5), 5); - new = Heap_NEWREC((LONGINT)(uintptr_t)&blksz); - tag = ((LONGINT)(uintptr_t)new + blksz) - 24; + new = Heap_NEWREC((LONGINT)(SYSTEM_ADDRESS)&blksz); + tag = ((LONGINT)(SYSTEM_ADDRESS)new + blksz) - 24; __PUT(tag - 8, 0, LONGINT); __PUT(tag, blksz, LONGINT); __PUT(tag + 8, -8, LONGINT); - __PUT((LONGINT)(uintptr_t)new - 8, tag, LONGINT); + __PUT((LONGINT)(SYSTEM_ADDRESS)new - 8, tag, LONGINT); Heap_Unlock(); _o_result = new; return _o_result; @@ -361,7 +361,7 @@ static void Heap_Mark (LONGINT q) __GET(tag, offset, LONGINT); fld = q + offset; p = Heap_FetchAddress(fld); - __PUT(fld, (SYSTEM_PTR)(uintptr_t)n, SYSTEM_PTR); + __PUT(fld, (SYSTEM_PTR)(SYSTEM_ADDRESS)n, SYSTEM_PTR); } else { fld = q + offset; n = Heap_FetchAddress(fld); @@ -370,7 +370,7 @@ static void Heap_Mark (LONGINT q) if (!__ODD(tagbits)) { __PUT(n - 8, tagbits + 1, LONGINT); __PUT(q - 8, tag + 1, LONGINT); - __PUT(fld, (SYSTEM_PTR)(uintptr_t)p, SYSTEM_PTR); + __PUT(fld, (SYSTEM_PTR)(SYSTEM_ADDRESS)p, SYSTEM_PTR); p = q; q = n; tag = tagbits; @@ -385,7 +385,7 @@ static void Heap_Mark (LONGINT q) static void Heap_MarkP (SYSTEM_PTR p) { - Heap_Mark((LONGINT)(uintptr_t)p); + Heap_Mark((LONGINT)(SYSTEM_ADDRESS)p); } static void Heap_Scan (void) @@ -554,7 +554,7 @@ static void Heap_Finalize (void) } else { prev->next = n->next; } - (*n->finalize)((SYSTEM_PTR)(uintptr_t)n->obj); + (*n->finalize)((SYSTEM_PTR)(SYSTEM_ADDRESS)n->obj); if (prev == NIL) { n = Heap_fin; } else { @@ -573,7 +573,7 @@ void Heap_FINALL (void) while (Heap_fin != NIL) { n = Heap_fin; Heap_fin = Heap_fin->next; - (*n->finalize)((SYSTEM_PTR)(uintptr_t)n->obj); + (*n->finalize)((SYSTEM_PTR)(SYSTEM_ADDRESS)n->obj); } } @@ -590,9 +590,9 @@ static void Heap_MarkStack (LONGINT n, LONGINT *cand, LONGINT cand__len) } if (n == 0) { nofcand = 0; - sp = (LONGINT)(uintptr_t)&frame; + sp = (LONGINT)(SYSTEM_ADDRESS)&frame; stack0 = Heap_PlatformMainStackFrame(); - inc = (LONGINT)(uintptr_t)&align.p - (LONGINT)(uintptr_t)&align; + inc = (LONGINT)(SYSTEM_ADDRESS)&align.p - (LONGINT)(SYSTEM_ADDRESS)&align; if (sp > stack0) { inc = -inc; } @@ -623,7 +623,7 @@ void Heap_GC (BOOLEAN markStack) LONGINT cand[10000]; if (Heap_lockdepth == 0 || (Heap_lockdepth == 1 && !markStack)) { Heap_Lock(); - m = (Heap_Module)(uintptr_t)Heap_modules; + m = (Heap_Module)(SYSTEM_ADDRESS)Heap_modules; while (m != NIL) { if (m->enumPtrs != NIL) { (*m->enumPtrs)(Heap_MarkP); @@ -700,7 +700,7 @@ void Heap_RegisterFinalizer (SYSTEM_PTR obj, Heap_Finalizer finalize) { Heap_FinNode f; __NEW(f, Heap_FinDesc); - f->obj = (LONGINT)(uintptr_t)obj; + f->obj = (LONGINT)(SYSTEM_ADDRESS)obj; f->finalize = finalize; f->marked = 1; f->next = Heap_fin; diff --git a/bootstrap/windows-88/Heap.h b/bootstrap/windows-88/Heap.h index a3ce3755..b1ff5968 100644 --- a/bootstrap/windows-88/Heap.h +++ b/bootstrap/windows-88/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tskSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/windows-88/Modules.c b/bootstrap/windows-88/Modules.c index ca308b4d..0c836ead 100644 --- a/bootstrap/windows-88/Modules.c +++ b/bootstrap/windows-88/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Console.h" diff --git a/bootstrap/windows-88/Modules.h b/bootstrap/windows-88/Modules.h index 88670bb0..6e6ded2e 100644 --- a/bootstrap/windows-88/Modules.h +++ b/bootstrap/windows-88/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/windows-88/OPB.c b/bootstrap/windows-88/OPB.c index 654fd595..f4bdb1a8 100644 --- a/bootstrap/windows-88/OPB.c +++ b/bootstrap/windows-88/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPM.h" diff --git a/bootstrap/windows-88/OPB.h b/bootstrap/windows-88/OPB.h index de004d95..af419f75 100644 --- a/bootstrap/windows-88/OPB.h +++ b/bootstrap/windows-88/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/windows-88/OPC.c b/bootstrap/windows-88/OPC.c index f23a7c6f..bb9b75e6 100644 --- a/bootstrap/windows-88/OPC.c +++ b/bootstrap/windows-88/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Configuration.h" diff --git a/bootstrap/windows-88/OPC.h b/bootstrap/windows-88/OPC.h index c9ded67c..37a86252 100644 --- a/bootstrap/windows-88/OPC.h +++ b/bootstrap/windows-88/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/windows-88/OPM.c b/bootstrap/windows-88/OPM.c index 94b641b5..50047c9e 100644 --- a/bootstrap/windows-88/OPM.c +++ b/bootstrap/windows-88/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Configuration.h" @@ -545,7 +545,7 @@ void OPM_FPrintReal (LONGINT *fp, REAL real) { INTEGER i; LONGINT l; - __GET((LONGINT)(uintptr_t)&real, i, INTEGER); + __GET((LONGINT)(SYSTEM_ADDRESS)&real, i, INTEGER); l = i; OPM_FPrint(&*fp, l); } diff --git a/bootstrap/windows-88/OPM.h b/bootstrap/windows-88/OPM.h index bec0e1f3..1706f8f1 100644 --- a/bootstrap/windows-88/OPM.h +++ b/bootstrap/windows-88/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPM__h #define OPM__h diff --git a/bootstrap/windows-88/OPP.c b/bootstrap/windows-88/OPP.c index 113735f2..5f515091 100644 --- a/bootstrap/windows-88/OPP.c +++ b/bootstrap/windows-88/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPB.h" diff --git a/bootstrap/windows-88/OPP.h b/bootstrap/windows-88/OPP.h index fce96f16..0b3b1b2c 100644 --- a/bootstrap/windows-88/OPP.h +++ b/bootstrap/windows-88/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/windows-88/OPS.c b/bootstrap/windows-88/OPS.c index 03b478b2..cc04e014 100644 --- a/bootstrap/windows-88/OPS.c +++ b/bootstrap/windows-88/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPM.h" diff --git a/bootstrap/windows-88/OPS.h b/bootstrap/windows-88/OPS.h index b0c44127..32148c49 100644 --- a/bootstrap/windows-88/OPS.h +++ b/bootstrap/windows-88/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/windows-88/OPT.c b/bootstrap/windows-88/OPT.c index 75e51d9d..a0d41c71 100644 --- a/bootstrap/windows-88/OPT.c +++ b/bootstrap/windows-88/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPM.h" diff --git a/bootstrap/windows-88/OPT.h b/bootstrap/windows-88/OPT.h index e8667945..ab2c4684 100644 --- a/bootstrap/windows-88/OPT.h +++ b/bootstrap/windows-88/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/windows-88/OPV.c b/bootstrap/windows-88/OPV.c index 88cb137f..ae14f629 100644 --- a/bootstrap/windows-88/OPV.c +++ b/bootstrap/windows-88/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPC.h" @@ -932,7 +932,7 @@ static void OPV_expr (OPT_Node n, INTEGER prec) OPM_Write(')'); break; case 24: - OPM_WriteString((CHAR*)"(LONGINT)(uintptr_t)", (LONGINT)21); + OPM_WriteString((CHAR*)"(LONGINT)(SYSTEM_ADDRESS)", (LONGINT)26); if (l->class == 1) { OPC_CompleteIdent(l->obj); } else { @@ -948,7 +948,7 @@ static void OPV_expr (OPT_Node n, INTEGER prec) OPC_Ident(n->typ->strobj); OPM_Write(')'); if (__IN(n->typ->form, 0x6000) || __IN(l->typ->form, 0x6000)) { - OPM_WriteString((CHAR*)"(uintptr_t)", (LONGINT)12); + OPM_WriteString((CHAR*)"(SYSTEM_ADDRESS)", (LONGINT)17); } OPV_expr(l, exprPrec); } else { diff --git a/bootstrap/windows-88/OPV.h b/bootstrap/windows-88/OPV.h index 839f5fbb..4eba5b89 100644 --- a/bootstrap/windows-88/OPV.h +++ b/bootstrap/windows-88/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/windows-88/Platform.c b/bootstrap/windows-88/Platform.c index c8530dd0..4281164c 100644 --- a/bootstrap/windows-88/Platform.c +++ b/bootstrap/windows-88/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" @@ -112,9 +112,9 @@ export BOOLEAN Platform_getEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT extern void Heap_InitHeap(); #define Platform_GetTickCount() (LONGINT)(SYSTEM_CARD32)GetTickCount() #define Platform_HeapInitHeap() Heap_InitHeap() -#define Platform_SetInterruptHandler(h) SystemSetInterruptHandler((uintptr_t)h) -#define Platform_SetQuitHandler(h) SystemSetQuitHandler((uintptr_t)h) -#define Platform_allocate(size) (LONGINT)(uintptr_t)((void*)HeapAlloc(GetProcessHeap(), 0, (size_t)size)) +#define Platform_SetInterruptHandler(h) SystemSetInterruptHandler((SYSTEM_ADDRESS)h) +#define Platform_SetQuitHandler(h) SystemSetQuitHandler((SYSTEM_ADDRESS)h) +#define Platform_allocate(size) (LONGINT)(SYSTEM_ADDRESS)((void*)HeapAlloc(GetProcessHeap(), 0, (size_t)size)) #define Platform_bhfiIndexHigh() (LONGINT)bhfi.nFileIndexHigh #define Platform_bhfiIndexLow() (LONGINT)bhfi.nFileIndexLow #define Platform_bhfiMtimeHigh() (LONGINT)bhfi.ftLastWriteTime.dwHighDateTime @@ -122,44 +122,44 @@ extern void Heap_InitHeap(); #define Platform_bhfiVsn() (LONGINT)bhfi.dwVolumeSerialNumber #define Platform_byHandleFileInformation() BY_HANDLE_FILE_INFORMATION bhfi #define Platform_cleanupProcess() CloseHandle(pi.hProcess); CloseHandle(pi.hThread); -#define Platform_closeHandle(h) (INTEGER)CloseHandle((HANDLE)(uintptr_t)h) +#define Platform_closeHandle(h) (INTEGER)CloseHandle((HANDLE)(SYSTEM_ADDRESS)h) #define Platform_createProcess(str, str__len) (INTEGER)CreateProcess(0, (char*)str, 0,0,0,0,0,0,&si,&pi) #define Platform_deleteFile(n, n__len) (INTEGER)DeleteFile((char*)n) #define Platform_err() (INTEGER)GetLastError() -#define Platform_errc(c) WriteFile((HANDLE)(uintptr_t)Platform_StdOut, &c, 1, 0,0) -#define Platform_errstring(s, s__len) WriteFile((HANDLE)(uintptr_t)Platform_StdOut, s, s__len-1, 0,0) +#define Platform_errc(c) WriteFile((HANDLE)(SYSTEM_ADDRESS)Platform_StdOut, &c, 1, 0,0) +#define Platform_errstring(s, s__len) WriteFile((HANDLE)(SYSTEM_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)(uintptr_t)h) -#define Platform_free(address) HeapFree(GetProcessHeap(), 0, (void*)(uintptr_t)address) +#define Platform_flushFileBuffers(h) (INTEGER)FlushFileBuffers((HANDLE)(SYSTEM_ADDRESS)h) +#define Platform_free(address) HeapFree(GetProcessHeap(), 0, (void*)(SYSTEM_ADDRESS)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) #define Platform_getExitCodeProcess(exitcode) GetExitCodeProcess(pi.hProcess, (DWORD*)exitcode); -#define Platform_getFileInformationByHandle(h) (INTEGER)GetFileInformationByHandle((HANDLE)(uintptr_t)h, &bhfi) -#define Platform_getFilePos(h, r, rc) LARGE_INTEGER liz = {0}; *rc = (INTEGER)SetFilePointerEx((HANDLE)(uintptr_t)h, liz, &li, FILE_CURRENT); *r = (LONGINT)li.QuadPart -#define Platform_getFileSize(h) (INTEGER)GetFileSizeEx((HANDLE)(uintptr_t)h, &li) +#define Platform_getFileInformationByHandle(h) (INTEGER)GetFileInformationByHandle((HANDLE)(SYSTEM_ADDRESS)h, &bhfi) +#define Platform_getFilePos(h, r, rc) LARGE_INTEGER liz = {0}; *rc = (INTEGER)SetFilePointerEx((HANDLE)(SYSTEM_ADDRESS)h, liz, &li, FILE_CURRENT); *r = (LONGINT)li.QuadPart +#define Platform_getFileSize(h) (INTEGER)GetFileSizeEx((HANDLE)(SYSTEM_ADDRESS)h, &li) #define Platform_getLocalTime() SYSTEMTIME st; GetLocalTime(&st) #define Platform_getenv(name, name__len, buf, buf__len) (INTEGER)GetEnvironmentVariable((char*)name, (char*)buf, buf__len) #define Platform_getpid() (INTEGER)GetCurrentProcessId() -#define Platform_getstderrhandle() (uintptr_t)GetStdHandle(STD_ERROR_HANDLE) -#define Platform_getstdinhandle() (uintptr_t)GetStdHandle(STD_INPUT_HANDLE) -#define Platform_getstdouthandle() (uintptr_t)GetStdHandle(STD_OUTPUT_HANDLE) +#define Platform_getstderrhandle() (SYSTEM_ADDRESS)GetStdHandle(STD_ERROR_HANDLE) +#define Platform_getstdinhandle() (SYSTEM_ADDRESS)GetStdHandle(STD_INPUT_HANDLE) +#define Platform_getstdouthandle() (SYSTEM_ADDRESS)GetStdHandle(STD_OUTPUT_HANDLE) #define Platform_identityToFileTime(i) FILETIME ft; ft.dwHighDateTime = i.mtimehigh; ft.dwLowDateTime = i.mtimelow -#define Platform_invalidHandleValue() ((LONGINT)(uintptr_t)INVALID_HANDLE_VALUE) +#define Platform_invalidHandleValue() ((LONGINT)(SYSTEM_ADDRESS)INVALID_HANDLE_VALUE) #define Platform_largeInteger() LARGE_INTEGER li #define Platform_liLongint() (LONGINT)li.QuadPart #define Platform_moveFile(o, o__len, n, n__len) (INTEGER)MoveFileEx((char*)o, (char*)n, MOVEFILE_REPLACE_EXISTING) -#define Platform_opennew(n, n__len) (LONGINT)(uintptr_t)CreateFile((char*)n, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0) -#define Platform_openro(n, n__len) (LONGINT)(uintptr_t)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)(uintptr_t)CreateFile((char*)n, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0) +#define Platform_opennew(n, n__len) (LONGINT)(SYSTEM_ADDRESS)CreateFile((char*)n, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0) +#define Platform_openro(n, n__len) (LONGINT)(SYSTEM_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)(SYSTEM_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)(uintptr_t)fd, (void*)(uintptr_t)(p), (DWORD)l, (DWORD*)n, 0) +#define Platform_readfile(fd, p, l, n) (INTEGER)ReadFile ((HANDLE)(SYSTEM_ADDRESS)fd, (void*)(SYSTEM_ADDRESS)(p), (DWORD)l, (DWORD*)n, 0) #define Platform_seekcur() FILE_CURRENT #define Platform_seekend() FILE_END #define Platform_seekset() FILE_BEGIN #define Platform_setCurrentDirectory(n, n__len) (INTEGER)SetCurrentDirectory((char*)n) -#define Platform_setEndOfFile(h) (INTEGER)SetEndOfFile((HANDLE)(uintptr_t)h) -#define Platform_setFilePointerEx(h, o, r, rc) li.QuadPart=o; *rc = (INTEGER)SetFilePointerEx((HANDLE)(uintptr_t)h, li, 0, (DWORD)r) +#define Platform_setEndOfFile(h) (INTEGER)SetEndOfFile((HANDLE)(SYSTEM_ADDRESS)h) +#define Platform_setFilePointerEx(h, o, r, rc) li.QuadPart=o; *rc = (INTEGER)SetFilePointerEx((HANDLE)(SYSTEM_ADDRESS)h, li, 0, (DWORD)r) #define Platform_sleep(ms) Sleep((DWORD)ms) #define Platform_stToFt() FILETIME ft; SystemTimeToFileTime(&st, &ft) #define Platform_startupInfo() STARTUPINFO si = {0}; si.cb = sizeof(si); @@ -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)(uintptr_t)fd, (void*)(uintptr_t)(p), (DWORD)l, 0,0) +#define Platform_writefile(fd, p, l) (INTEGER)WriteFile((HANDLE)(SYSTEM_ADDRESS)fd, (void*)(SYSTEM_ADDRESS)(p), (DWORD)l, 0,0) BOOLEAN Platform_TooManyFiles (INTEGER e) { @@ -242,7 +242,7 @@ void Platform_Init (INTEGER argc, LONGINT argvadr) Platform_ArgVecPtr av = NIL; Platform_MainStackFrame = argvadr; Platform_ArgCount = argc; - av = (Platform_ArgVecPtr)(uintptr_t)argvadr; + av = (Platform_ArgVecPtr)(SYSTEM_ADDRESS)argvadr; Platform_ArgVector = (*av)[0]; Platform_HaltCode = -128; Platform_HeapInitHeap(); @@ -281,7 +281,7 @@ void Platform_GetArg (INTEGER n, CHAR *val, LONGINT val__len) { Platform_ArgVec av = NIL; if (n < Platform_ArgCount) { - av = (Platform_ArgVec)(uintptr_t)Platform_ArgVector; + av = (Platform_ArgVec)(SYSTEM_ADDRESS)Platform_ArgVector; __COPY(*(*av)[__X(n, ((LONGINT)(1024)))], val, val__len); } } @@ -560,7 +560,7 @@ INTEGER Platform_ReadBuf (LONGINT h, SYSTEM_BYTE *b, LONGINT b__len, LONGINT *n) INTEGER _o_result; INTEGER result; *n = 0; - result = Platform_readfile(h, (LONGINT)(uintptr_t)b, b__len, &*n); + result = Platform_readfile(h, (LONGINT)(SYSTEM_ADDRESS)b, b__len, &*n); if (result == 0) { *n = 0; _o_result = Platform_err(); @@ -796,7 +796,7 @@ static void Platform_TestLittleEndian (void) { INTEGER i; i = 1; - __GET((LONGINT)(uintptr_t)&i, Platform_LittleEndian, BOOLEAN); + __GET((LONGINT)(SYSTEM_ADDRESS)&i, Platform_LittleEndian, BOOLEAN); } __TDESC(Platform_FileIdentity, 1, 0) = {__TDFLDS("FileIdentity", 40), {-8}}; diff --git a/bootstrap/windows-88/Platform.h b/bootstrap/windows-88/Platform.h index cf905cb2..374b6842 100644 --- a/bootstrap/windows-88/Platform.h +++ b/bootstrap/windows-88/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Platform__h #define Platform__h @@ -79,7 +79,7 @@ import INTEGER Platform_Write (LONGINT h, LONGINT p, LONGINT l); import BOOLEAN Platform_getEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT val__len); import void *Platform__init(void); -#define Platform_SetInterruptHandler(h) SystemSetInterruptHandler((uintptr_t)h) -#define Platform_SetQuitHandler(h) SystemSetQuitHandler((uintptr_t)h) +#define Platform_SetInterruptHandler(h) SystemSetInterruptHandler((SYSTEM_ADDRESS)h) +#define Platform_SetQuitHandler(h) SystemSetQuitHandler((SYSTEM_ADDRESS)h) #endif diff --git a/bootstrap/windows-88/Reals.c b/bootstrap/windows-88/Reals.c index 5dbc72b6..8b61d8cd 100644 --- a/bootstrap/windows-88/Reals.c +++ b/bootstrap/windows-88/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" @@ -59,7 +59,7 @@ INTEGER Reals_Expo (REAL x) { INTEGER _o_result; INTEGER i; - __GET((LONGINT)(uintptr_t)&x + 2, i, INTEGER); + __GET((LONGINT)(SYSTEM_ADDRESS)&x + 2, i, INTEGER); _o_result = __MASK(__ASHR(i, 7), -256); return _o_result; } @@ -67,17 +67,17 @@ INTEGER Reals_Expo (REAL x) void Reals_SetExpo (REAL *x, INTEGER ex) { CHAR c; - __GET((LONGINT)(uintptr_t)x + 3, c, CHAR); - __PUT((LONGINT)(uintptr_t)x + 3, (CHAR)(__ASHL(__ASHR((int)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR); - __GET((LONGINT)(uintptr_t)x + 2, c, CHAR); - __PUT((LONGINT)(uintptr_t)x + 2, (CHAR)(__MASK((int)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR); + __GET((LONGINT)(SYSTEM_ADDRESS)x + 3, c, CHAR); + __PUT((LONGINT)(SYSTEM_ADDRESS)x + 3, (CHAR)(__ASHL(__ASHR((int)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR); + __GET((LONGINT)(SYSTEM_ADDRESS)x + 2, c, CHAR); + __PUT((LONGINT)(SYSTEM_ADDRESS)x + 2, (CHAR)(__MASK((int)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR); } INTEGER Reals_ExpoL (LONGREAL x) { INTEGER _o_result; INTEGER i; - __GET((LONGINT)(uintptr_t)&x + 6, i, INTEGER); + __GET((LONGINT)(SYSTEM_ADDRESS)&x + 6, i, INTEGER); _o_result = __MASK(__ASHR(i, 4), -2048); return _o_result; } diff --git a/bootstrap/windows-88/Reals.h b/bootstrap/windows-88/Reals.h index dc1a2544..ff21c192 100644 --- a/bootstrap/windows-88/Reals.h +++ b/bootstrap/windows-88/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/windows-88/SYSTEM.c b/bootstrap/windows-88/SYSTEM.c index 50e91c6d..33511a70 100644 --- a/bootstrap/windows-88/SYSTEM.c +++ b/bootstrap/windows-88/SYSTEM.c @@ -35,7 +35,7 @@ void SYSTEM_INHERIT(LONGINT *t, LONGINT *t0) void SYSTEM_ENUMP(void *adr, LONGINT n, void (*P)()) { while (n > 0) { - P((LONGINT)(uintptr_t)(*((void**)(adr)))); + P((LONGINT)(SYSTEM_ADDRESS)(*((void**)(adr)))); adr = ((void**)adr) + 1; n--; } @@ -106,7 +106,7 @@ SYSTEM_PTR SYSTEM_NEWARR(LONGINT *typ, LONGINT elemsz, int elemalgn, int nofdim, else if (typ == (LONGINT*)POINTER__typ) { /* element type is a pointer */ x = Heap_NEWBLK(size + nofelems * sizeof(LONGINT)); - p = (LONGINT*)(uintptr_t)x[-1]; + p = (LONGINT*)(SYSTEM_ADDRESS)x[-1]; p[-nofelems] = *p; /* build new type desc in situ: 1. copy block size; 2. setup ptr tab; 3. set sentinel; 4. patch tag */ p -= nofelems - 1; n = 1; /* n =1 for skipping the size field */ while (n <= nofelems) {*p = n*sizeof(LONGINT); p++; n++;} @@ -119,7 +119,7 @@ SYSTEM_PTR SYSTEM_NEWARR(LONGINT *typ, LONGINT elemsz, int elemalgn, int nofdim, while (ptab[nofptrs] >= 0) {nofptrs++;} /* number of pointers per element */ nptr = nofelems * nofptrs; /* total number of pointers */ x = Heap_NEWBLK(size + nptr * sizeof(LONGINT)); - p = (LONGINT*)(uintptr_t)x[- 1]; + p = (LONGINT*)(SYSTEM_ADDRESS)x[- 1]; p[-nptr] = *p; /* build new type desc in situ; 1. copy block size; 2. setup ptr tab; 3. set sentinel; 4. patch tag */ p -= nptr - 1; n = 0; off = dataoff; while (n < nofelems) {i = 0; @@ -155,7 +155,7 @@ typedef void (*SystemSignalHandler)(INTEGER); // = Platform_SignalHandler // (Ignore other signals) } - void SystemSetHandler(int s, uintptr_t h) { + void SystemSetHandler(int s, SYSTEM_ADDRESS h) { if (s >= 2 && s <= 4) { int needtosetsystemhandler = handler[s-2] == 0; handler[s-2] = (SystemSignalHandler)h; @@ -194,12 +194,12 @@ typedef void (*SystemSignalHandler)(INTEGER); // = Platform_SignalHandler } } - void SystemSetInterruptHandler(uintptr_t h) { + void SystemSetInterruptHandler(SYSTEM_ADDRESS h) { EnsureConsoleCtrlHandler(); SystemInterruptHandler = (SystemSignalHandler)h; } - void SystemSetQuitHandler(uintptr_t h) { + void SystemSetQuitHandler(SYSTEM_ADDRESS h) { EnsureConsoleCtrlHandler(); SystemQuitHandler = (SystemSignalHandler)h; } diff --git a/bootstrap/windows-88/SYSTEM.h b/bootstrap/windows-88/SYSTEM.h index 1c0b07fd..75a0aa52 100644 --- a/bootstrap/windows-88/SYSTEM.h +++ b/bootstrap/windows-88/SYSTEM.h @@ -18,23 +18,16 @@ typedef unsigned char SYSTEM_CARD8; #if (__SIZEOF_POINTER__ == 8) #if defined(_WIN64) - typedef unsigned long long SYSTEM_PTRINT; - typedef unsigned long long uintptr_t; - typedef unsigned long long size_t; + typedef unsigned long long SYSTEM_ADDRESS; #else - typedef unsigned long SYSTEM_PTRINT; - typedef unsigned long uintptr_t; - typedef unsigned long size_t; + typedef unsigned long SYSTEM_ADDRESS; #endif #else - typedef unsigned int SYSTEM_PTRINT; - typedef unsigned int uintptr_t; - typedef unsigned int size_t; + typedef unsigned int SYSTEM_ADDRESS; #endif -#define _SIZE_T_DEFINED_ // For OpenBSD -void *memcpy(void *dest, const void *source, size_t size); +void *memcpy(void *dest, const void *source, SYSTEM_ADDRESS size); @@ -111,10 +104,10 @@ extern LONGINT SYSTEM_ENTIER (double x); // Signal handling in SYSTEM.c #ifndef _WIN32 - extern void SystemSetHandler(int s, uintptr_t h); + extern void SystemSetHandler(int s, SYSTEM_ADDRESS h); #else - extern void SystemSetInterruptHandler(uintptr_t h); - extern void SystemSetQuitHandler (uintptr_t h); + extern void SystemSetInterruptHandler(SYSTEM_ADDRESS h); + extern void SystemSetQuitHandler (SYSTEM_ADDRESS h); #endif @@ -137,9 +130,9 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __COPY(s, d, n) {char*_a=(void*)s,*_b=(void*)d; LONGINT _i=0,_t=n-1; \ while(_i<_t&&((_b[_i]=_a[_i])!=0)){_i++;};_b[_i]=0;} -#define __DUP(x, l, t) x=(void*)memcpy((void*)(uintptr_t)Platform_OSAllocate(l*sizeof(t)),x,l*sizeof(t)) +#define __DUP(x, l, t) x=(void*)memcpy((void*)(SYSTEM_ADDRESS)Platform_OSAllocate(l*sizeof(t)),x,l*sizeof(t)) #define __DUPARR(v, t) v=(void*)memcpy(v##__copy,v,sizeof(t)) -#define __DEL(x) Platform_OSFree((LONGINT)(uintptr_t)x) +#define __DEL(x) Platform_OSFree((LONGINT)(SYSTEM_ADDRESS)x) @@ -149,8 +142,8 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __VAL(t, x) (*(t*)&(x)) -#define __GET(a, x, t) x= *(t*)(uintptr_t)(a) -#define __PUT(a, x, t) *(t*)(uintptr_t)(a)=x +#define __GET(a, x, t) x= *(t*)(SYSTEM_ADDRESS)(a) +#define __PUT(a, x, t) *(t*)(SYSTEM_ADDRESS)(a)=x #define __LSHL(x, n, t) ((t)((U_##t)(x)<<(n))) #define __LSHR(x, n, t) ((t)((U_##t)(x)>>(n))) @@ -165,7 +158,7 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __ROT(x, n, t) ((n)>=0? __ROTL(x, n, t): __ROTR(x, -(n), t)) #define __BIT(x, n) (*(U_LONGINT*)(x)>>(n)&1) -#define __MOVE(s, d, n) memcpy((char*)(uintptr_t)(d),(char*)(uintptr_t)(s),n) +#define __MOVE(s, d, n) memcpy((char*)(SYSTEM_ADDRESS)(d),(char*)(SYSTEM_ADDRESS)(s),n) #define __ASHF(x, n) SYSTEM_ASH((LONGINT)(x), (LONGINT)(n)) #define __SHORT(x, y) ((int)((U_LONGINT)(x)+(y)<(y)+(y)?(x):(__HALT(-8),0))) #define __SHORTF(x, y) ((int)(__RF((x)+(y),(y)+(y))-(y))) @@ -226,7 +219,7 @@ extern void Heap_INCREF(); extern void Platform_Init(INTEGER argc, LONGINT argv); extern void Heap_FINALL(); -#define __INIT(argc, argv) static void *m; Platform_Init((INTEGER)argc, (LONGINT)(uintptr_t)&argv); +#define __INIT(argc, argv) static void *m; Platform_Init((INTEGER)argc, (LONGINT)(SYSTEM_ADDRESS)&argv); #define __REGMAIN(name, enum) m = Heap_REGMOD((CHAR*)name,enum) #define __FINI Heap_FINALL(); return 0 @@ -247,7 +240,7 @@ extern SYSTEM_PTR Heap_NEWREC (LONGINT tag); extern SYSTEM_PTR SYSTEM_NEWARR(LONGINT*, LONGINT, int, int, int, ...); #define __SYSNEW(p, len) p = Heap_NEWBLK((LONGINT)(len)) -#define __NEW(p, t) p = Heap_NEWREC((LONGINT)(uintptr_t)t##__typ) +#define __NEW(p, t) p = Heap_NEWREC((LONGINT)(SYSTEM_ADDRESS)t##__typ) #define __NEWARR SYSTEM_NEWARR @@ -278,20 +271,20 @@ extern SYSTEM_PTR SYSTEM_NEWARR(LONGINT*, LONGINT, int, int, int, ...); #define __INITYP(t, t0, level) \ t##__typ = (LONGINT*)&t##__desc.blksz; \ memcpy(t##__desc.basep, t0##__typ - __BASEOFF, level*sizeof(LONGINT)); \ - t##__desc.basep[level] = (LONGINT)(uintptr_t)t##__typ; \ - t##__desc.module = (LONGINT)(uintptr_t)m; \ + t##__desc.basep[level] = (LONGINT)(SYSTEM_ADDRESS)t##__typ; \ + t##__desc.module = (LONGINT)(SYSTEM_ADDRESS)m; \ if(t##__desc.blksz!=sizeof(struct t)) __HALT(-15); \ t##__desc.blksz = (t##__desc.blksz+5*sizeof(LONGINT)-1)/(4*sizeof(LONGINT))*(4*sizeof(LONGINT)); \ - Heap_REGTYP(m, (LONGINT)(uintptr_t)&t##__desc.next); \ + Heap_REGTYP(m, (LONGINT)(SYSTEM_ADDRESS)&t##__desc.next); \ SYSTEM_INHERIT(t##__typ, t0##__typ) -#define __IS(tag, typ, level) (*(tag-(__BASEOFF-level))==(LONGINT)(uintptr_t)typ##__typ) -#define __TYPEOF(p) ((LONGINT*)(uintptr_t)(*(((LONGINT*)(p))-1))) +#define __IS(tag, typ, level) (*(tag-(__BASEOFF-level))==(LONGINT)(SYSTEM_ADDRESS)typ##__typ) +#define __TYPEOF(p) ((LONGINT*)(SYSTEM_ADDRESS)(*(((LONGINT*)(p))-1))) #define __ISP(p, typ, level) __IS(__TYPEOF(p),typ,level) // Oberon-2 type bound procedures support -#define __INITBP(t, proc, num) *(t##__typ-(__TPROC0OFF+num))=(LONGINT)(uintptr_t)proc -#define __SEND(typ, num, funtyp, parlist) ((funtyp)((uintptr_t)*(typ-(__TPROC0OFF+num))))parlist +#define __INITBP(t, proc, num) *(t##__typ-(__TPROC0OFF+num))=(LONGINT)(SYSTEM_ADDRESS)proc +#define __SEND(typ, num, funtyp, parlist) ((funtyp)((SYSTEM_ADDRESS)*(typ-(__TPROC0OFF+num))))parlist diff --git a/bootstrap/windows-88/Strings.c b/bootstrap/windows-88/Strings.c index 0932a656..20a14540 100644 --- a/bootstrap/windows-88/Strings.c +++ b/bootstrap/windows-88/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" diff --git a/bootstrap/windows-88/Strings.h b/bootstrap/windows-88/Strings.h index 0f4e30dd..d64d3478 100644 --- a/bootstrap/windows-88/Strings.h +++ b/bootstrap/windows-88/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/windows-88/Texts.c b/bootstrap/windows-88/Texts.c index 21a4804c..a1fb81c0 100644 --- a/bootstrap/windows-88/Texts.c +++ b/bootstrap/windows-88/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Files.h" diff --git a/bootstrap/windows-88/Texts.h b/bootstrap/windows-88/Texts.h index e4314cfb..bca5665d 100644 --- a/bootstrap/windows-88/Texts.h +++ b/bootstrap/windows-88/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/windows-88/Vishap.c b/bootstrap/windows-88/Vishap.c index ba77bb85..6eda4f2c 100644 --- a/bootstrap/windows-88/Vishap.c +++ b/bootstrap/windows-88/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkamSf */ #define LARGE #include "SYSTEM.h" #include "Configuration.h" diff --git a/bootstrap/windows-88/errors.c b/bootstrap/windows-88/errors.c index 2ab076d8..48246ffa 100644 --- a/bootstrap/windows-88/errors.c +++ b/bootstrap/windows-88/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" diff --git a/bootstrap/windows-88/errors.h b/bootstrap/windows-88/errors.h index 2ebe7512..9081238a 100644 --- a/bootstrap/windows-88/errors.h +++ b/bootstrap/windows-88/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/windows-88/extTools.c b/bootstrap/windows-88/extTools.c index 2c26582b..4005b0a6 100644 --- a/bootstrap/windows-88/extTools.c +++ b/bootstrap/windows-88/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Configuration.h" diff --git a/bootstrap/windows-88/extTools.h b/bootstrap/windows-88/extTools.h index e844a8a5..6ac1ab91 100644 --- a/bootstrap/windows-88/extTools.h +++ b/bootstrap/windows-88/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/windows-88/vt100.c b/bootstrap/windows-88/vt100.c index 056577f3..a9110e8a 100644 --- a/bootstrap/windows-88/vt100.c +++ b/bootstrap/windows-88/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Console.h" diff --git a/bootstrap/windows-88/vt100.h b/bootstrap/windows-88/vt100.h index 783646f9..801bc8f9 100644 --- a/bootstrap/windows-88/vt100.h +++ b/bootstrap/windows-88/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/22] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */ #ifndef vt100__h #define vt100__h diff --git a/src/compiler/OPV.Mod b/src/compiler/OPV.Mod index 5eda54ff..7a59c1d3 100644 --- a/src/compiler/OPV.Mod +++ b/src/compiler/OPV.Mod @@ -555,7 +555,7 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96 expr(l, MinPrec); OPM.Write(CloseParen) | OPT.cap: OPM.WriteString("__CAP("); expr(l, MinPrec); OPM.Write(CloseParen) | OPT.odd: OPM.WriteString("__ODD("); expr(l, MinPrec); OPM.Write(CloseParen) - | OPT.adr: OPM.WriteString("(LONGINT)(uintptr_t)"); (*SYSTEM*) + | OPT.adr: OPM.WriteString("(LONGINT)(SYSTEM_ADDRESS)"); (*SYSTEM*) IF l^.class = OPT.Nvarpar THEN OPC.CompleteIdent(l^.obj) ELSE IF (l^.typ^.form # OPT.String) & ~(l^.typ^.comp IN {OPT.Array, OPT.DynArr}) THEN OPM.Write("&") END ; @@ -568,7 +568,7 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96 THEN OPM.Write(OpenParen); OPC.Ident(n^.typ^.strobj); OPM.Write(CloseParen); IF (n^.typ^.form IN {OPT.Pointer, OPT.ProcTyp}) OR (l^.typ^.form IN {OPT.Pointer, OPT.ProcTyp}) THEN - OPM.WriteString("(uintptr_t)") + OPM.WriteString("(SYSTEM_ADDRESS)") END; expr(l, exprPrec) ELSE diff --git a/src/system/Heap.Mod b/src/system/Heap.Mod index 73534c46..6395c0a7 100644 --- a/src/system/Heap.Mod +++ b/src/system/Heap.Mod @@ -186,7 +186,7 @@ MODULE Heap; correctly regardless of the size of an address. Specifically on 32 bit address architectures with 64 bit LONGINT, it loads 32 bits and extends it to LONGINT rather than loading 64 bits. *) - PROCEDURE -FetchAddress(pointer: LONGINT): LONGINT "(LONGINT)(uintptr_t)(*((void**)((uintptr_t)pointer)))"; + PROCEDURE -FetchAddress(pointer: LONGINT): LONGINT "(LONGINT)(SYSTEM_ADDRESS)(*((void**)((SYSTEM_ADDRESS)pointer)))"; PROCEDURE ExtendHeap(blksz: LONGINT); VAR size, chnk, j, next: LONGINT; diff --git a/src/system/Platformunix.Mod b/src/system/Platformunix.Mod index 6da2b7d7..1c2da65d 100644 --- a/src/system/Platformunix.Mod +++ b/src/system/Platformunix.Mod @@ -106,10 +106,10 @@ BEGIN RETURN (e = ECONNREFUSED()) OR (e = ECONNABORTED()) (* OS memory allocaton *) -PROCEDURE -allocate(size: LONGINT): LONGINT "(LONGINT)(uintptr_t)((void*)malloc((size_t)size))"; +PROCEDURE -allocate(size: LONGINT): LONGINT "(LONGINT)(SYSTEM_ADDRESS)((void*)malloc((size_t)size))"; PROCEDURE OSAllocate*(size: LONGINT): LONGINT; BEGIN RETURN allocate(size) END OSAllocate; -PROCEDURE -free(address: LONGINT) "free((void*)(uintptr_t)address)"; +PROCEDURE -free(address: LONGINT) "free((void*)(SYSTEM_ADDRESS)address)"; PROCEDURE OSFree*(address: LONGINT); BEGIN free(address) END OSFree; @@ -189,7 +189,7 @@ END ArgPos; (* Signals and traps *) -PROCEDURE -sethandler(s: INTEGER; h: SignalHandler) "SystemSetHandler(s, (uintptr_t)h)"; +PROCEDURE -sethandler(s: INTEGER; h: SignalHandler) "SystemSetHandler(s, (SYSTEM_ADDRESS)h)"; PROCEDURE SetInterruptHandler*(handler: SignalHandler); BEGIN sethandler(2, handler); END SetInterruptHandler; @@ -369,7 +369,7 @@ END Size; PROCEDURE -readfile (fd: LONGINT; p: LONGINT; l: LONGINT): LONGINT -"read(fd, (void*)(uintptr_t)(p), l)"; +"read(fd, (void*)(SYSTEM_ADDRESS)(p), l)"; PROCEDURE Read*(h: FileHandle; p: LONGINT; l: LONGINT; VAR n: LONGINT): ErrorCode; BEGIN @@ -386,7 +386,7 @@ END ReadBuf; PROCEDURE -writefile(fd: LONGINT; p: LONGINT; l: LONGINT): LONGINT -"write(fd, (void*)(uintptr_t)(p), l)"; +"write(fd, (void*)(SYSTEM_ADDRESS)(p), l)"; PROCEDURE Write*(h: FileHandle; p: LONGINT; l: LONGINT): ErrorCode; VAR written: LONGINT; diff --git a/src/system/Platformwindows.Mod b/src/system/Platformwindows.Mod index 3395e57b..a97d7da9 100644 --- a/src/system/Platformwindows.Mod +++ b/src/system/Platformwindows.Mod @@ -104,10 +104,10 @@ BEGIN RETURN (e = ECONNREFUSED()) OR (e = ECONNABORTED()) (* OS memory allocaton *) -PROCEDURE -allocate(size: LONGINT): LONGINT "(LONGINT)(uintptr_t)((void*)HeapAlloc(GetProcessHeap(), 0, (size_t)size))"; +PROCEDURE -allocate(size: LONGINT): LONGINT "(LONGINT)(SYSTEM_ADDRESS)((void*)HeapAlloc(GetProcessHeap(), 0, (size_t)size))"; PROCEDURE OSAllocate*(size: LONGINT): LONGINT; BEGIN RETURN allocate(size) END OSAllocate; -PROCEDURE -free(address: LONGINT) "HeapFree(GetProcessHeap(), 0, (void*)(uintptr_t)address)"; +PROCEDURE -free(address: LONGINT) "HeapFree(GetProcessHeap(), 0, (void*)(SYSTEM_ADDRESS)address)"; PROCEDURE OSFree*(address: LONGINT); BEGIN free(address) END OSFree; @@ -200,8 +200,8 @@ END ArgPos; (* Ctrl/c handling *) -PROCEDURE -SetInterruptHandler*(h: SignalHandler) "SystemSetInterruptHandler((uintptr_t)h)"; -PROCEDURE -SetQuitHandler* (h: SignalHandler) "SystemSetQuitHandler((uintptr_t)h)"; +PROCEDURE -SetInterruptHandler*(h: SignalHandler) "SystemSetInterruptHandler((SYSTEM_ADDRESS)h)"; +PROCEDURE -SetQuitHandler* (h: SignalHandler) "SystemSetQuitHandler((SYSTEM_ADDRESS)h)"; PROCEDURE SetBadInstructionHandler*(handler: SignalHandler); BEGIN (* TODO *) END SetBadInstructionHandler; @@ -293,16 +293,16 @@ PROCEDURE Error*(): ErrorCode; BEGIN RETURN err() END Error; (* File system *) -PROCEDURE -invalidHandleValue(): LONGINT "((LONGINT)(uintptr_t)INVALID_HANDLE_VALUE)"; +PROCEDURE -invalidHandleValue(): LONGINT "((LONGINT)(SYSTEM_ADDRESS)INVALID_HANDLE_VALUE)"; PROCEDURE -openrw (n: ARRAY OF CHAR): LONGINT -"(LONGINT)(uintptr_t)CreateFile((char*)n, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)"; +"(LONGINT)(SYSTEM_ADDRESS)CreateFile((char*)n, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)"; PROCEDURE -openro (n: ARRAY OF CHAR): LONGINT -"(LONGINT)(uintptr_t)CreateFile((char*)n, GENERIC_READ , FILE_SHARE_READ|FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)"; +"(LONGINT)(SYSTEM_ADDRESS)CreateFile((char*)n, GENERIC_READ , FILE_SHARE_READ|FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)"; PROCEDURE -opennew(n: ARRAY OF CHAR): LONGINT -"(LONGINT)(uintptr_t)CreateFile((char*)n, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0)"; +"(LONGINT)(SYSTEM_ADDRESS)CreateFile((char*)n, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0)"; @@ -332,7 +332,7 @@ END New; -PROCEDURE -closeHandle(h: FileHandle): INTEGER "(INTEGER)CloseHandle((HANDLE)(uintptr_t)h)"; +PROCEDURE -closeHandle(h: FileHandle): INTEGER "(INTEGER)CloseHandle((HANDLE)(SYSTEM_ADDRESS)h)"; PROCEDURE Close*(h: FileHandle): ErrorCode; BEGIN @@ -342,7 +342,7 @@ END Close; PROCEDURE -byHandleFileInformation "BY_HANDLE_FILE_INFORMATION bhfi"; -PROCEDURE -getFileInformationByHandle(h: FileHandle): INTEGER "(INTEGER)GetFileInformationByHandle((HANDLE)(uintptr_t)h, &bhfi)"; +PROCEDURE -getFileInformationByHandle(h: FileHandle): INTEGER "(INTEGER)GetFileInformationByHandle((HANDLE)(SYSTEM_ADDRESS)h, &bhfi)"; PROCEDURE -bhfiMtimeHigh(): LONGINT "(LONGINT)bhfi.ftLastWriteTime.dwHighDateTime"; PROCEDURE -bhfiMtimeLow(): LONGINT "(LONGINT)bhfi.ftLastWriteTime.dwLowDateTime"; PROCEDURE -bhfiVsn(): LONGINT "(LONGINT)bhfi.dwVolumeSerialNumber"; @@ -401,7 +401,7 @@ END MTimeAsClock; PROCEDURE -largeInteger "LARGE_INTEGER li"; PROCEDURE -liLongint(): LONGINT "(LONGINT)li.QuadPart"; -PROCEDURE -getFileSize(h: FileHandle): INTEGER "(INTEGER)GetFileSizeEx((HANDLE)(uintptr_t)h, &li)"; +PROCEDURE -getFileSize(h: FileHandle): INTEGER "(INTEGER)GetFileSizeEx((HANDLE)(SYSTEM_ADDRESS)h, &li)"; PROCEDURE Size*(h: FileHandle; VAR l: LONGINT): ErrorCode; BEGIN @@ -413,7 +413,7 @@ END Size; PROCEDURE -readfile (fd: LONGINT; p: LONGINT; l: LONGINT; VAR n: LONGINT): INTEGER -"(INTEGER)ReadFile ((HANDLE)(uintptr_t)fd, (void*)(uintptr_t)(p), (DWORD)l, (DWORD*)n, 0)"; +"(INTEGER)ReadFile ((HANDLE)(SYSTEM_ADDRESS)fd, (void*)(SYSTEM_ADDRESS)(p), (DWORD)l, (DWORD*)n, 0)"; PROCEDURE Read*(h: FileHandle; p: LONGINT; l: LONGINT; VAR n: LONGINT): ErrorCode; VAR result: INTEGER; @@ -434,7 +434,7 @@ END ReadBuf; PROCEDURE -writefile(fd: LONGINT; p: LONGINT; l: LONGINT): INTEGER -"(INTEGER)WriteFile((HANDLE)(uintptr_t)fd, (void*)(uintptr_t)(p), (DWORD)l, 0,0)"; +"(INTEGER)WriteFile((HANDLE)(SYSTEM_ADDRESS)fd, (void*)(SYSTEM_ADDRESS)(p), (DWORD)l, 0,0)"; PROCEDURE Write*(h: FileHandle; p: LONGINT; l: LONGINT): ErrorCode; BEGIN @@ -443,7 +443,7 @@ END Write; -PROCEDURE -flushFileBuffers(h: FileHandle): INTEGER "(INTEGER)FlushFileBuffers((HANDLE)(uintptr_t)h)"; +PROCEDURE -flushFileBuffers(h: FileHandle): INTEGER "(INTEGER)FlushFileBuffers((HANDLE)(SYSTEM_ADDRESS)h)"; PROCEDURE Sync*(h: FileHandle): ErrorCode; BEGIN @@ -453,7 +453,7 @@ END Sync; PROCEDURE -setFilePointerEx(h: FileHandle; o: LONGINT; r: INTEGER; VAR rc: INTEGER) -"li.QuadPart=o; *rc = (INTEGER)SetFilePointerEx((HANDLE)(uintptr_t)h, li, 0, (DWORD)r)"; +"li.QuadPart=o; *rc = (INTEGER)SetFilePointerEx((HANDLE)(SYSTEM_ADDRESS)h, li, 0, (DWORD)r)"; PROCEDURE -seekset(): INTEGER "FILE_BEGIN"; PROCEDURE -seekcur(): INTEGER "FILE_CURRENT"; @@ -469,9 +469,9 @@ END Seek; -PROCEDURE -setEndOfFile(h: FileHandle): INTEGER "(INTEGER)SetEndOfFile((HANDLE)(uintptr_t)h)"; +PROCEDURE -setEndOfFile(h: FileHandle): INTEGER "(INTEGER)SetEndOfFile((HANDLE)(SYSTEM_ADDRESS)h)"; PROCEDURE -getFilePos(h: FileHandle; VAR r: LONGINT; VAR rc: INTEGER) -"LARGE_INTEGER liz = {0}; *rc = (INTEGER)SetFilePointerEx((HANDLE)(uintptr_t)h, liz, &li, FILE_CURRENT); *r = (LONGINT)li.QuadPart"; +"LARGE_INTEGER liz = {0}; *rc = (INTEGER)SetFilePointerEx((HANDLE)(SYSTEM_ADDRESS)h, liz, &li, FILE_CURRENT); *r = (LONGINT)li.QuadPart"; PROCEDURE Truncate*(h: FileHandle; limit: LONGINT): ErrorCode; VAR rc: INTEGER; oldpos: LONGINT; @@ -529,8 +529,8 @@ PROCEDURE Exit*(code: INTEGER); BEGIN exit(code) END Exit; -PROCEDURE -errstring(s: ARRAY OF CHAR) 'WriteFile((HANDLE)(uintptr_t)Platform_StdOut, s, s__len-1, 0,0)'; -PROCEDURE -errc (c: CHAR) 'WriteFile((HANDLE)(uintptr_t)Platform_StdOut, &c, 1, 0,0)'; +PROCEDURE -errstring(s: ARRAY OF CHAR) 'WriteFile((HANDLE)(SYSTEM_ADDRESS)Platform_StdOut, s, s__len-1, 0,0)'; +PROCEDURE -errc (c: CHAR) 'WriteFile((HANDLE)(SYSTEM_ADDRESS)Platform_StdOut, &c, 1, 0,0)'; PROCEDURE errch(c: CHAR); BEGIN errc(c) END errch; PROCEDURE errln; BEGIN errch(0DX); errch(0AX) END errln; @@ -589,9 +589,9 @@ PROCEDURE TestLittleEndian; BEGIN i := 1; SYSTEM.GET(SYSTEM.ADR(i), LittleEndian); END TestLittleEndian; -PROCEDURE -getstdinhandle(): FileHandle "(uintptr_t)GetStdHandle(STD_INPUT_HANDLE)"; -PROCEDURE -getstdouthandle(): FileHandle "(uintptr_t)GetStdHandle(STD_OUTPUT_HANDLE)"; -PROCEDURE -getstderrhandle(): FileHandle "(uintptr_t)GetStdHandle(STD_ERROR_HANDLE)"; +PROCEDURE -getstdinhandle(): FileHandle "(SYSTEM_ADDRESS)GetStdHandle(STD_INPUT_HANDLE)"; +PROCEDURE -getstdouthandle(): FileHandle "(SYSTEM_ADDRESS)GetStdHandle(STD_OUTPUT_HANDLE)"; +PROCEDURE -getstderrhandle(): FileHandle "(SYSTEM_ADDRESS)GetStdHandle(STD_ERROR_HANDLE)"; PROCEDURE -getpid(): INTEGER "(INTEGER)GetCurrentProcessId()"; BEGIN diff --git a/src/system/SYSTEM.c b/src/system/SYSTEM.c index 50e91c6d..33511a70 100644 --- a/src/system/SYSTEM.c +++ b/src/system/SYSTEM.c @@ -35,7 +35,7 @@ void SYSTEM_INHERIT(LONGINT *t, LONGINT *t0) void SYSTEM_ENUMP(void *adr, LONGINT n, void (*P)()) { while (n > 0) { - P((LONGINT)(uintptr_t)(*((void**)(adr)))); + P((LONGINT)(SYSTEM_ADDRESS)(*((void**)(adr)))); adr = ((void**)adr) + 1; n--; } @@ -106,7 +106,7 @@ SYSTEM_PTR SYSTEM_NEWARR(LONGINT *typ, LONGINT elemsz, int elemalgn, int nofdim, else if (typ == (LONGINT*)POINTER__typ) { /* element type is a pointer */ x = Heap_NEWBLK(size + nofelems * sizeof(LONGINT)); - p = (LONGINT*)(uintptr_t)x[-1]; + p = (LONGINT*)(SYSTEM_ADDRESS)x[-1]; p[-nofelems] = *p; /* build new type desc in situ: 1. copy block size; 2. setup ptr tab; 3. set sentinel; 4. patch tag */ p -= nofelems - 1; n = 1; /* n =1 for skipping the size field */ while (n <= nofelems) {*p = n*sizeof(LONGINT); p++; n++;} @@ -119,7 +119,7 @@ SYSTEM_PTR SYSTEM_NEWARR(LONGINT *typ, LONGINT elemsz, int elemalgn, int nofdim, while (ptab[nofptrs] >= 0) {nofptrs++;} /* number of pointers per element */ nptr = nofelems * nofptrs; /* total number of pointers */ x = Heap_NEWBLK(size + nptr * sizeof(LONGINT)); - p = (LONGINT*)(uintptr_t)x[- 1]; + p = (LONGINT*)(SYSTEM_ADDRESS)x[- 1]; p[-nptr] = *p; /* build new type desc in situ; 1. copy block size; 2. setup ptr tab; 3. set sentinel; 4. patch tag */ p -= nptr - 1; n = 0; off = dataoff; while (n < nofelems) {i = 0; @@ -155,7 +155,7 @@ typedef void (*SystemSignalHandler)(INTEGER); // = Platform_SignalHandler // (Ignore other signals) } - void SystemSetHandler(int s, uintptr_t h) { + void SystemSetHandler(int s, SYSTEM_ADDRESS h) { if (s >= 2 && s <= 4) { int needtosetsystemhandler = handler[s-2] == 0; handler[s-2] = (SystemSignalHandler)h; @@ -194,12 +194,12 @@ typedef void (*SystemSignalHandler)(INTEGER); // = Platform_SignalHandler } } - void SystemSetInterruptHandler(uintptr_t h) { + void SystemSetInterruptHandler(SYSTEM_ADDRESS h) { EnsureConsoleCtrlHandler(); SystemInterruptHandler = (SystemSignalHandler)h; } - void SystemSetQuitHandler(uintptr_t h) { + void SystemSetQuitHandler(SYSTEM_ADDRESS h) { EnsureConsoleCtrlHandler(); SystemQuitHandler = (SystemSignalHandler)h; } diff --git a/src/system/SYSTEM.h b/src/system/SYSTEM.h index 1c0b07fd..75a0aa52 100644 --- a/src/system/SYSTEM.h +++ b/src/system/SYSTEM.h @@ -18,23 +18,16 @@ typedef unsigned char SYSTEM_CARD8; #if (__SIZEOF_POINTER__ == 8) #if defined(_WIN64) - typedef unsigned long long SYSTEM_PTRINT; - typedef unsigned long long uintptr_t; - typedef unsigned long long size_t; + typedef unsigned long long SYSTEM_ADDRESS; #else - typedef unsigned long SYSTEM_PTRINT; - typedef unsigned long uintptr_t; - typedef unsigned long size_t; + typedef unsigned long SYSTEM_ADDRESS; #endif #else - typedef unsigned int SYSTEM_PTRINT; - typedef unsigned int uintptr_t; - typedef unsigned int size_t; + typedef unsigned int SYSTEM_ADDRESS; #endif -#define _SIZE_T_DEFINED_ // For OpenBSD -void *memcpy(void *dest, const void *source, size_t size); +void *memcpy(void *dest, const void *source, SYSTEM_ADDRESS size); @@ -111,10 +104,10 @@ extern LONGINT SYSTEM_ENTIER (double x); // Signal handling in SYSTEM.c #ifndef _WIN32 - extern void SystemSetHandler(int s, uintptr_t h); + extern void SystemSetHandler(int s, SYSTEM_ADDRESS h); #else - extern void SystemSetInterruptHandler(uintptr_t h); - extern void SystemSetQuitHandler (uintptr_t h); + extern void SystemSetInterruptHandler(SYSTEM_ADDRESS h); + extern void SystemSetQuitHandler (SYSTEM_ADDRESS h); #endif @@ -137,9 +130,9 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __COPY(s, d, n) {char*_a=(void*)s,*_b=(void*)d; LONGINT _i=0,_t=n-1; \ while(_i<_t&&((_b[_i]=_a[_i])!=0)){_i++;};_b[_i]=0;} -#define __DUP(x, l, t) x=(void*)memcpy((void*)(uintptr_t)Platform_OSAllocate(l*sizeof(t)),x,l*sizeof(t)) +#define __DUP(x, l, t) x=(void*)memcpy((void*)(SYSTEM_ADDRESS)Platform_OSAllocate(l*sizeof(t)),x,l*sizeof(t)) #define __DUPARR(v, t) v=(void*)memcpy(v##__copy,v,sizeof(t)) -#define __DEL(x) Platform_OSFree((LONGINT)(uintptr_t)x) +#define __DEL(x) Platform_OSFree((LONGINT)(SYSTEM_ADDRESS)x) @@ -149,8 +142,8 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __VAL(t, x) (*(t*)&(x)) -#define __GET(a, x, t) x= *(t*)(uintptr_t)(a) -#define __PUT(a, x, t) *(t*)(uintptr_t)(a)=x +#define __GET(a, x, t) x= *(t*)(SYSTEM_ADDRESS)(a) +#define __PUT(a, x, t) *(t*)(SYSTEM_ADDRESS)(a)=x #define __LSHL(x, n, t) ((t)((U_##t)(x)<<(n))) #define __LSHR(x, n, t) ((t)((U_##t)(x)>>(n))) @@ -165,7 +158,7 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __ROT(x, n, t) ((n)>=0? __ROTL(x, n, t): __ROTR(x, -(n), t)) #define __BIT(x, n) (*(U_LONGINT*)(x)>>(n)&1) -#define __MOVE(s, d, n) memcpy((char*)(uintptr_t)(d),(char*)(uintptr_t)(s),n) +#define __MOVE(s, d, n) memcpy((char*)(SYSTEM_ADDRESS)(d),(char*)(SYSTEM_ADDRESS)(s),n) #define __ASHF(x, n) SYSTEM_ASH((LONGINT)(x), (LONGINT)(n)) #define __SHORT(x, y) ((int)((U_LONGINT)(x)+(y)<(y)+(y)?(x):(__HALT(-8),0))) #define __SHORTF(x, y) ((int)(__RF((x)+(y),(y)+(y))-(y))) @@ -226,7 +219,7 @@ extern void Heap_INCREF(); extern void Platform_Init(INTEGER argc, LONGINT argv); extern void Heap_FINALL(); -#define __INIT(argc, argv) static void *m; Platform_Init((INTEGER)argc, (LONGINT)(uintptr_t)&argv); +#define __INIT(argc, argv) static void *m; Platform_Init((INTEGER)argc, (LONGINT)(SYSTEM_ADDRESS)&argv); #define __REGMAIN(name, enum) m = Heap_REGMOD((CHAR*)name,enum) #define __FINI Heap_FINALL(); return 0 @@ -247,7 +240,7 @@ extern SYSTEM_PTR Heap_NEWREC (LONGINT tag); extern SYSTEM_PTR SYSTEM_NEWARR(LONGINT*, LONGINT, int, int, int, ...); #define __SYSNEW(p, len) p = Heap_NEWBLK((LONGINT)(len)) -#define __NEW(p, t) p = Heap_NEWREC((LONGINT)(uintptr_t)t##__typ) +#define __NEW(p, t) p = Heap_NEWREC((LONGINT)(SYSTEM_ADDRESS)t##__typ) #define __NEWARR SYSTEM_NEWARR @@ -278,20 +271,20 @@ extern SYSTEM_PTR SYSTEM_NEWARR(LONGINT*, LONGINT, int, int, int, ...); #define __INITYP(t, t0, level) \ t##__typ = (LONGINT*)&t##__desc.blksz; \ memcpy(t##__desc.basep, t0##__typ - __BASEOFF, level*sizeof(LONGINT)); \ - t##__desc.basep[level] = (LONGINT)(uintptr_t)t##__typ; \ - t##__desc.module = (LONGINT)(uintptr_t)m; \ + t##__desc.basep[level] = (LONGINT)(SYSTEM_ADDRESS)t##__typ; \ + t##__desc.module = (LONGINT)(SYSTEM_ADDRESS)m; \ if(t##__desc.blksz!=sizeof(struct t)) __HALT(-15); \ t##__desc.blksz = (t##__desc.blksz+5*sizeof(LONGINT)-1)/(4*sizeof(LONGINT))*(4*sizeof(LONGINT)); \ - Heap_REGTYP(m, (LONGINT)(uintptr_t)&t##__desc.next); \ + Heap_REGTYP(m, (LONGINT)(SYSTEM_ADDRESS)&t##__desc.next); \ SYSTEM_INHERIT(t##__typ, t0##__typ) -#define __IS(tag, typ, level) (*(tag-(__BASEOFF-level))==(LONGINT)(uintptr_t)typ##__typ) -#define __TYPEOF(p) ((LONGINT*)(uintptr_t)(*(((LONGINT*)(p))-1))) +#define __IS(tag, typ, level) (*(tag-(__BASEOFF-level))==(LONGINT)(SYSTEM_ADDRESS)typ##__typ) +#define __TYPEOF(p) ((LONGINT*)(SYSTEM_ADDRESS)(*(((LONGINT*)(p))-1))) #define __ISP(p, typ, level) __IS(__TYPEOF(p),typ,level) // Oberon-2 type bound procedures support -#define __INITBP(t, proc, num) *(t##__typ-(__TPROC0OFF+num))=(LONGINT)(uintptr_t)proc -#define __SEND(typ, num, funtyp, parlist) ((funtyp)((uintptr_t)*(typ-(__TPROC0OFF+num))))parlist +#define __INITBP(t, proc, num) *(t##__typ-(__TPROC0OFF+num))=(LONGINT)(SYSTEM_ADDRESS)proc +#define __SEND(typ, num, funtyp, parlist) ((funtyp)((SYSTEM_ADDRESS)*(typ-(__TPROC0OFF+num))))parlist