From 1507d9cb0afeb1e14d088f0574753a50dd0e58c1 Mon Sep 17 00:00:00 2001 From: David Brown Date: Sat, 15 Oct 2016 19:05:08 +0100 Subject: [PATCH] Force git rename of VT100 in bootstrap, make SYSTEM.* mdel independent. --- bootstrap/SYSTEM.c | 22 ++++++++--- bootstrap/SYSTEM.h | 45 +++++++++++------------ bootstrap/unix-44/Compiler.c | 4 +- bootstrap/unix-44/Platform.c | 8 ++-- bootstrap/unix-44/Platform.h | 4 +- bootstrap/unix-44/{vt100.c => VT100.c} | 0 bootstrap/unix-44/{vt100.h => VT100.h} | 0 bootstrap/unix-48/Compiler.c | 4 +- bootstrap/unix-48/Platform.c | 8 ++-- bootstrap/unix-48/Platform.h | 4 +- bootstrap/unix-48/{vt100.c => VT100.c} | 0 bootstrap/unix-48/{vt100.h => VT100.h} | 0 bootstrap/unix-88/Compiler.c | 4 +- bootstrap/unix-88/Platform.c | 8 ++-- bootstrap/unix-88/Platform.h | 4 +- bootstrap/unix-88/{vt100.c => VT100.c} | 0 bootstrap/unix-88/{vt100.h => VT100.h} | 0 bootstrap/windows-48/Compiler.c | 4 +- bootstrap/windows-48/Platform.c | 8 ++-- bootstrap/windows-48/Platform.h | 4 +- bootstrap/windows-48/{vt100.c => VT100.c} | 0 bootstrap/windows-48/{vt100.h => VT100.h} | 0 bootstrap/windows-88/Compiler.c | 4 +- bootstrap/windows-88/Platform.c | 8 ++-- bootstrap/windows-88/Platform.h | 4 +- bootstrap/windows-88/{vt100.c => VT100.c} | 0 bootstrap/windows-88/{vt100.h => VT100.h} | 0 src/compiler/Compiler.Mod | 2 +- src/runtime/Platformunix.Mod | 12 +++--- src/runtime/Platformwindows.Mod | 8 ++-- src/runtime/SYSTEM.c | 22 ++++++++--- src/runtime/SYSTEM.h | 45 +++++++++++------------ src/test/confidence/signal/signal.mod | 4 +- src/tools/make/configure.c | 43 ++++++++++++---------- 34 files changed, 152 insertions(+), 131 deletions(-) rename bootstrap/unix-44/{vt100.c => VT100.c} (100%) rename bootstrap/unix-44/{vt100.h => VT100.h} (100%) rename bootstrap/unix-48/{vt100.c => VT100.c} (100%) rename bootstrap/unix-48/{vt100.h => VT100.h} (100%) rename bootstrap/unix-88/{vt100.c => VT100.c} (100%) rename bootstrap/unix-88/{vt100.h => VT100.h} (100%) rename bootstrap/windows-48/{vt100.c => VT100.c} (100%) rename bootstrap/windows-48/{vt100.h => VT100.h} (100%) rename bootstrap/windows-88/{vt100.c => VT100.c} (100%) rename bootstrap/windows-88/{vt100.h => VT100.h} (100%) diff --git a/bootstrap/SYSTEM.c b/bootstrap/SYSTEM.c index 6efc8321..b97144e7 100644 --- a/bootstrap/SYSTEM.c +++ b/bootstrap/SYSTEM.c @@ -46,20 +46,30 @@ int64 SYSTEM_MOD(int64 x, int64 y) else {return -((-x) % (-y));} } -LONGINT SYSTEM_ENTIER(double x) +// LONGINT SYSTEM_ENTIER(double x) +// { +// LONGINT y; +// if (x >= 0) +// return (LONGINT)x; +// else { +// y = (LONGINT)x; +// if (y <= x) return y; else return y - 1; +// } +// } + +int64 SYSTEM_ENTIER(double x) { - LONGINT y; + int64 y; if (x >= 0) - return (LONGINT)x; + return (int64)x; else { - y = (LONGINT)x; + y = (int64)x; if (y <= x) return y; else return y - 1; } } - void SYSTEM_INHERIT(address *t, address *t0) { t -= __TPROC0OFF; @@ -155,7 +165,7 @@ SYSTEM_PTR SYSTEM_NEWARR(address *typ, address elemsz, int elemalgn, int nofdim, -typedef void (*SystemSignalHandler)(INTEGER); // = Platform_SignalHandler +typedef void (*SystemSignalHandler)(int32); // = Platform_SignalHandler #ifndef _WIN32 diff --git a/bootstrap/SYSTEM.h b/bootstrap/SYSTEM.h index 4e1bfe18..7cba936e 100644 --- a/bootstrap/SYSTEM.h +++ b/bootstrap/SYSTEM.h @@ -8,20 +8,19 @@ #define __o_64 #endif -// Temporary while bootstrapping and clearing up SYSTEM.c. - - -#ifndef LONGINT - #if defined (__o_64) - #define INTEGER int32 - #define LONGINT int64 - #define SET uint64 - #else - #define INTEGER int16 - #define LONGINT int32 - #define SET uint32 - #endif -#endif +// // Temporary while bootstrapping and clearing up SYSTEM.c. +// +// #ifndef LONGINT +// #if defined (__o_64) +// #define INTEGER int32 +// #define LONGINT int64 +// #define SET uint64 +// #else +// #define INTEGER int16 +// #define LONGINT int32 +// #define SET uint32 +// #endif +// #endif @@ -119,11 +118,11 @@ extern void Platform_OSFree (address addr); // Assertions and Halts -extern void Platform_Halt(LONGINT x); -extern void Platform_AssertFail(LONGINT x); +extern void Platform_Halt(int32 x); +extern void Platform_AssertFail(int32 x); #define __HALT(x) Platform_Halt(x) -#define __ASSERT(cond, x) if (!(cond)) Platform_AssertFail((LONGINT)(x)) +#define __ASSERT(cond, x) if (!(cond)) Platform_AssertFail((int32)(x)) // Index checking @@ -136,7 +135,7 @@ static inline int64 __XF(uint64 i, uint64 ub) {if (i >= ub) {__HALT(-2);} return static inline int64 __RF(uint64 i, uint64 ub) {if (i >= ub) {__HALT(-8);} return i;} #define __R(i, ub) (((i)<(ub))?i:(__HALT(-8),0)) -#define __SHORT(x, ub) ((int)((uLONGINT)(x)+(ub)<(ub)+(ub)?(x):(__HALT(-8),0))) +#define __SHORT(x, ub) ((int)((uint64)(x)+(ub)<(ub)+(ub)?(x):(__HALT(-8),0))) #define __SHORTF(x, ub) ((int)(__RF((x)+(ub),(ub)+(ub))-(ub))) #define __CHR(x) ((CHAR)__R(x, 256)) #define __CHRF(x) ((CHAR)__RF(x, 256)) @@ -157,7 +156,7 @@ static inline int64 __RF(uint64 i, uint64 ub) {if (i >= ub) {__HALT(-8);} return // String comparison static inline int __str_cmp(CHAR *x, CHAR *y){ - LONGINT i = 0; + int64 i = 0; CHAR ch1, ch2; do {ch1 = x[i]; ch2 = y[i]; i++; if (!ch1) return -(int)ch2; @@ -212,7 +211,7 @@ extern int64 SYSTEM_MOD(int64 x, int64 y); #define __MOD(x, y) (((x)>0 && (y)>0) ? (x)%(y) : __MODF(x, y)) -extern LONGINT SYSTEM_ENTIER (double x); +extern int64 SYSTEM_ENTIER (double x); #define __ENTIER(x) SYSTEM_ENTIER(x) @@ -275,10 +274,10 @@ extern void Heap_INCREF(); // Main module initialisation, registration and finalisation -extern void Platform_Init(INTEGER argc, address argv); +extern void Platform_Init(int32 argc, address argv); extern void Heap_FINALL(); -#define __INIT(argc, argv) static void *m; Platform_Init((INTEGER)argc, (address)&argv); +#define __INIT(argc, argv) static void *m; Platform_Init(argc, (address)&argv); #define __REGMAIN(name, enum) m = Heap_REGMOD((CHAR*)name,enum) #define __FINI Heap_FINALL(); return 0 @@ -287,7 +286,7 @@ extern void Heap_FINALL(); extern SYSTEM_PTR Heap_NEWBLK (address size); extern SYSTEM_PTR Heap_NEWREC (address tag); -extern SYSTEM_PTR SYSTEM_NEWARR(LONGINT*, LONGINT, int, int, int, ...); +extern SYSTEM_PTR SYSTEM_NEWARR(address*, address, int, int, int, ...); #define __SYSNEW(p, len) p = Heap_NEWBLK((address)(len)) #define __NEW(p, t) p = Heap_NEWREC((address)t##__typ) diff --git a/bootstrap/unix-44/Compiler.c b/bootstrap/unix-44/Compiler.c index 82f1ab48..08a80f54 100644 --- a/bootstrap/unix-44/Compiler.c +++ b/bootstrap/unix-44/Compiler.c @@ -26,7 +26,7 @@ static CHAR Compiler_mname[256]; export void Compiler_Module (BOOLEAN *done); static void Compiler_PropagateElementaryTypeSizes (void); export void Compiler_Translate (void); -static void Compiler_Trap (int16 sig); +static void Compiler_Trap (int32 sig); void Compiler_Module (BOOLEAN *done) @@ -147,7 +147,7 @@ void Compiler_Translate (void) } } -static void Compiler_Trap (int16 sig) +static void Compiler_Trap (int32 sig) { Heap_FINALL(); if (sig == 3) { diff --git a/bootstrap/unix-44/Platform.c b/bootstrap/unix-44/Platform.c index ff57e9c4..0fe40111 100644 --- a/bootstrap/unix-44/Platform.c +++ b/bootstrap/unix-44/Platform.c @@ -28,7 +28,7 @@ typedef void (*Platform_HaltProcedure)(int32); typedef - void (*Platform_SignalHandler)(int16); + void (*Platform_SignalHandler)(int32); export BOOLEAN Platform_LittleEndian; @@ -65,7 +65,7 @@ export void Platform_Halt (int32 code); export int16 Platform_Identify (int32 h, Platform_FileIdentity *identity, address *identity__typ); export int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ); export BOOLEAN Platform_Inaccessible (int16 e); -export void Platform_Init (int16 argc, int32 argvadr); +export void Platform_Init (int32 argc, int32 argvadr); export BOOLEAN Platform_Interrupted (int16 e); export void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); export int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); @@ -240,11 +240,11 @@ void Platform_OSFree (int32 address) Platform_free(address); } -void Platform_Init (int16 argc, int32 argvadr) +void Platform_Init (int32 argc, int32 argvadr) { Platform_ArgVecPtr av = NIL; Platform_MainStackFrame = argvadr; - Platform_ArgCount = argc; + Platform_ArgCount = __VAL(int16, argc); av = (Platform_ArgVecPtr)(address)argvadr; Platform_ArgVector = (*av)[0]; Platform_HaltCode = -128; diff --git a/bootstrap/unix-44/Platform.h b/bootstrap/unix-44/Platform.h index 5e6af8ad..68411f33 100644 --- a/bootstrap/unix-44/Platform.h +++ b/bootstrap/unix-44/Platform.h @@ -15,7 +15,7 @@ typedef void (*Platform_HaltProcedure)(int32); typedef - void (*Platform_SignalHandler)(int16); + void (*Platform_SignalHandler)(int32); import BOOLEAN Platform_LittleEndian; @@ -49,7 +49,7 @@ import void Platform_Halt (int32 code); import int16 Platform_Identify (int32 h, Platform_FileIdentity *identity, address *identity__typ); import int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ); import BOOLEAN Platform_Inaccessible (int16 e); -import void Platform_Init (int16 argc, int32 argvadr); +import void Platform_Init (int32 argc, int32 argvadr); import BOOLEAN Platform_Interrupted (int16 e); import void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); import int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); diff --git a/bootstrap/unix-44/vt100.c b/bootstrap/unix-44/VT100.c similarity index 100% rename from bootstrap/unix-44/vt100.c rename to bootstrap/unix-44/VT100.c diff --git a/bootstrap/unix-44/vt100.h b/bootstrap/unix-44/VT100.h similarity index 100% rename from bootstrap/unix-44/vt100.h rename to bootstrap/unix-44/VT100.h diff --git a/bootstrap/unix-48/Compiler.c b/bootstrap/unix-48/Compiler.c index 82f1ab48..08a80f54 100644 --- a/bootstrap/unix-48/Compiler.c +++ b/bootstrap/unix-48/Compiler.c @@ -26,7 +26,7 @@ static CHAR Compiler_mname[256]; export void Compiler_Module (BOOLEAN *done); static void Compiler_PropagateElementaryTypeSizes (void); export void Compiler_Translate (void); -static void Compiler_Trap (int16 sig); +static void Compiler_Trap (int32 sig); void Compiler_Module (BOOLEAN *done) @@ -147,7 +147,7 @@ void Compiler_Translate (void) } } -static void Compiler_Trap (int16 sig) +static void Compiler_Trap (int32 sig) { Heap_FINALL(); if (sig == 3) { diff --git a/bootstrap/unix-48/Platform.c b/bootstrap/unix-48/Platform.c index ff57e9c4..0fe40111 100644 --- a/bootstrap/unix-48/Platform.c +++ b/bootstrap/unix-48/Platform.c @@ -28,7 +28,7 @@ typedef void (*Platform_HaltProcedure)(int32); typedef - void (*Platform_SignalHandler)(int16); + void (*Platform_SignalHandler)(int32); export BOOLEAN Platform_LittleEndian; @@ -65,7 +65,7 @@ export void Platform_Halt (int32 code); export int16 Platform_Identify (int32 h, Platform_FileIdentity *identity, address *identity__typ); export int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ); export BOOLEAN Platform_Inaccessible (int16 e); -export void Platform_Init (int16 argc, int32 argvadr); +export void Platform_Init (int32 argc, int32 argvadr); export BOOLEAN Platform_Interrupted (int16 e); export void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); export int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); @@ -240,11 +240,11 @@ void Platform_OSFree (int32 address) Platform_free(address); } -void Platform_Init (int16 argc, int32 argvadr) +void Platform_Init (int32 argc, int32 argvadr) { Platform_ArgVecPtr av = NIL; Platform_MainStackFrame = argvadr; - Platform_ArgCount = argc; + Platform_ArgCount = __VAL(int16, argc); av = (Platform_ArgVecPtr)(address)argvadr; Platform_ArgVector = (*av)[0]; Platform_HaltCode = -128; diff --git a/bootstrap/unix-48/Platform.h b/bootstrap/unix-48/Platform.h index 5e6af8ad..68411f33 100644 --- a/bootstrap/unix-48/Platform.h +++ b/bootstrap/unix-48/Platform.h @@ -15,7 +15,7 @@ typedef void (*Platform_HaltProcedure)(int32); typedef - void (*Platform_SignalHandler)(int16); + void (*Platform_SignalHandler)(int32); import BOOLEAN Platform_LittleEndian; @@ -49,7 +49,7 @@ import void Platform_Halt (int32 code); import int16 Platform_Identify (int32 h, Platform_FileIdentity *identity, address *identity__typ); import int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ); import BOOLEAN Platform_Inaccessible (int16 e); -import void Platform_Init (int16 argc, int32 argvadr); +import void Platform_Init (int32 argc, int32 argvadr); import BOOLEAN Platform_Interrupted (int16 e); import void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); import int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); diff --git a/bootstrap/unix-48/vt100.c b/bootstrap/unix-48/VT100.c similarity index 100% rename from bootstrap/unix-48/vt100.c rename to bootstrap/unix-48/VT100.c diff --git a/bootstrap/unix-48/vt100.h b/bootstrap/unix-48/VT100.h similarity index 100% rename from bootstrap/unix-48/vt100.h rename to bootstrap/unix-48/VT100.h diff --git a/bootstrap/unix-88/Compiler.c b/bootstrap/unix-88/Compiler.c index 82f1ab48..08a80f54 100644 --- a/bootstrap/unix-88/Compiler.c +++ b/bootstrap/unix-88/Compiler.c @@ -26,7 +26,7 @@ static CHAR Compiler_mname[256]; export void Compiler_Module (BOOLEAN *done); static void Compiler_PropagateElementaryTypeSizes (void); export void Compiler_Translate (void); -static void Compiler_Trap (int16 sig); +static void Compiler_Trap (int32 sig); void Compiler_Module (BOOLEAN *done) @@ -147,7 +147,7 @@ void Compiler_Translate (void) } } -static void Compiler_Trap (int16 sig) +static void Compiler_Trap (int32 sig) { Heap_FINALL(); if (sig == 3) { diff --git a/bootstrap/unix-88/Platform.c b/bootstrap/unix-88/Platform.c index d58fec88..39e05934 100644 --- a/bootstrap/unix-88/Platform.c +++ b/bootstrap/unix-88/Platform.c @@ -28,7 +28,7 @@ typedef void (*Platform_HaltProcedure)(int32); typedef - void (*Platform_SignalHandler)(int16); + void (*Platform_SignalHandler)(int32); export BOOLEAN Platform_LittleEndian; @@ -65,7 +65,7 @@ export void Platform_Halt (int32 code); export int16 Platform_Identify (int32 h, Platform_FileIdentity *identity, address *identity__typ); export int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ); export BOOLEAN Platform_Inaccessible (int16 e); -export void Platform_Init (int16 argc, int64 argvadr); +export void Platform_Init (int32 argc, int64 argvadr); export BOOLEAN Platform_Interrupted (int16 e); export void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); export int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); @@ -240,11 +240,11 @@ void Platform_OSFree (int64 address) Platform_free(address); } -void Platform_Init (int16 argc, int64 argvadr) +void Platform_Init (int32 argc, int64 argvadr) { Platform_ArgVecPtr av = NIL; Platform_MainStackFrame = argvadr; - Platform_ArgCount = argc; + Platform_ArgCount = __VAL(int16, argc); av = (Platform_ArgVecPtr)(address)argvadr; Platform_ArgVector = (*av)[0]; Platform_HaltCode = -128; diff --git a/bootstrap/unix-88/Platform.h b/bootstrap/unix-88/Platform.h index 9216622f..24d6dbe4 100644 --- a/bootstrap/unix-88/Platform.h +++ b/bootstrap/unix-88/Platform.h @@ -15,7 +15,7 @@ typedef void (*Platform_HaltProcedure)(int32); typedef - void (*Platform_SignalHandler)(int16); + void (*Platform_SignalHandler)(int32); import BOOLEAN Platform_LittleEndian; @@ -49,7 +49,7 @@ import void Platform_Halt (int32 code); import int16 Platform_Identify (int32 h, Platform_FileIdentity *identity, address *identity__typ); import int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ); import BOOLEAN Platform_Inaccessible (int16 e); -import void Platform_Init (int16 argc, int64 argvadr); +import void Platform_Init (int32 argc, int64 argvadr); import BOOLEAN Platform_Interrupted (int16 e); import void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); import int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); diff --git a/bootstrap/unix-88/vt100.c b/bootstrap/unix-88/VT100.c similarity index 100% rename from bootstrap/unix-88/vt100.c rename to bootstrap/unix-88/VT100.c diff --git a/bootstrap/unix-88/vt100.h b/bootstrap/unix-88/VT100.h similarity index 100% rename from bootstrap/unix-88/vt100.h rename to bootstrap/unix-88/VT100.h diff --git a/bootstrap/windows-48/Compiler.c b/bootstrap/windows-48/Compiler.c index 82f1ab48..08a80f54 100644 --- a/bootstrap/windows-48/Compiler.c +++ b/bootstrap/windows-48/Compiler.c @@ -26,7 +26,7 @@ static CHAR Compiler_mname[256]; export void Compiler_Module (BOOLEAN *done); static void Compiler_PropagateElementaryTypeSizes (void); export void Compiler_Translate (void); -static void Compiler_Trap (int16 sig); +static void Compiler_Trap (int32 sig); void Compiler_Module (BOOLEAN *done) @@ -147,7 +147,7 @@ void Compiler_Translate (void) } } -static void Compiler_Trap (int16 sig) +static void Compiler_Trap (int32 sig) { Heap_FINALL(); if (sig == 3) { diff --git a/bootstrap/windows-48/Platform.c b/bootstrap/windows-48/Platform.c index 6bc9bf9f..6092ac08 100644 --- a/bootstrap/windows-48/Platform.c +++ b/bootstrap/windows-48/Platform.c @@ -28,7 +28,7 @@ typedef void (*Platform_HaltProcedure)(int32); typedef - void (*Platform_SignalHandler)(int16); + void (*Platform_SignalHandler)(int32); export BOOLEAN Platform_LittleEndian; @@ -67,7 +67,7 @@ export void Platform_Halt (int32 code); export int16 Platform_Identify (int32 h, Platform_FileIdentity *identity, address *identity__typ); export int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ); export BOOLEAN Platform_Inaccessible (int16 e); -export void Platform_Init (int16 argc, int32 argvadr); +export void Platform_Init (int32 argc, int32 argvadr); export BOOLEAN Platform_Interrupted (int16 e); export void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); export int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); @@ -252,11 +252,11 @@ void Platform_OSFree (int32 address) Platform_free(address); } -void Platform_Init (int16 argc, int32 argvadr) +void Platform_Init (int32 argc, int32 argvadr) { Platform_ArgVecPtr av = NIL; Platform_MainStackFrame = argvadr; - Platform_ArgCount = argc; + Platform_ArgCount = __VAL(int16, argc); av = (Platform_ArgVecPtr)(address)argvadr; Platform_ArgVector = (*av)[0]; Platform_HaltCode = -128; diff --git a/bootstrap/windows-48/Platform.h b/bootstrap/windows-48/Platform.h index 79119240..c3fa315b 100644 --- a/bootstrap/windows-48/Platform.h +++ b/bootstrap/windows-48/Platform.h @@ -15,7 +15,7 @@ typedef void (*Platform_HaltProcedure)(int32); typedef - void (*Platform_SignalHandler)(int16); + void (*Platform_SignalHandler)(int32); import BOOLEAN Platform_LittleEndian; @@ -50,7 +50,7 @@ import void Platform_Halt (int32 code); import int16 Platform_Identify (int32 h, Platform_FileIdentity *identity, address *identity__typ); import int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ); import BOOLEAN Platform_Inaccessible (int16 e); -import void Platform_Init (int16 argc, int32 argvadr); +import void Platform_Init (int32 argc, int32 argvadr); import BOOLEAN Platform_Interrupted (int16 e); import void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); import int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); diff --git a/bootstrap/windows-48/vt100.c b/bootstrap/windows-48/VT100.c similarity index 100% rename from bootstrap/windows-48/vt100.c rename to bootstrap/windows-48/VT100.c diff --git a/bootstrap/windows-48/vt100.h b/bootstrap/windows-48/VT100.h similarity index 100% rename from bootstrap/windows-48/vt100.h rename to bootstrap/windows-48/VT100.h diff --git a/bootstrap/windows-88/Compiler.c b/bootstrap/windows-88/Compiler.c index 82f1ab48..08a80f54 100644 --- a/bootstrap/windows-88/Compiler.c +++ b/bootstrap/windows-88/Compiler.c @@ -26,7 +26,7 @@ static CHAR Compiler_mname[256]; export void Compiler_Module (BOOLEAN *done); static void Compiler_PropagateElementaryTypeSizes (void); export void Compiler_Translate (void); -static void Compiler_Trap (int16 sig); +static void Compiler_Trap (int32 sig); void Compiler_Module (BOOLEAN *done) @@ -147,7 +147,7 @@ void Compiler_Translate (void) } } -static void Compiler_Trap (int16 sig) +static void Compiler_Trap (int32 sig) { Heap_FINALL(); if (sig == 3) { diff --git a/bootstrap/windows-88/Platform.c b/bootstrap/windows-88/Platform.c index eed18d02..d3020826 100644 --- a/bootstrap/windows-88/Platform.c +++ b/bootstrap/windows-88/Platform.c @@ -28,7 +28,7 @@ typedef void (*Platform_HaltProcedure)(int32); typedef - void (*Platform_SignalHandler)(int16); + void (*Platform_SignalHandler)(int32); export BOOLEAN Platform_LittleEndian; @@ -67,7 +67,7 @@ export void Platform_Halt (int32 code); export int16 Platform_Identify (int32 h, Platform_FileIdentity *identity, address *identity__typ); export int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ); export BOOLEAN Platform_Inaccessible (int16 e); -export void Platform_Init (int16 argc, int64 argvadr); +export void Platform_Init (int32 argc, int64 argvadr); export BOOLEAN Platform_Interrupted (int16 e); export void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); export int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); @@ -252,11 +252,11 @@ void Platform_OSFree (int64 address) Platform_free(address); } -void Platform_Init (int16 argc, int64 argvadr) +void Platform_Init (int32 argc, int64 argvadr) { Platform_ArgVecPtr av = NIL; Platform_MainStackFrame = argvadr; - Platform_ArgCount = argc; + Platform_ArgCount = __VAL(int16, argc); av = (Platform_ArgVecPtr)(address)argvadr; Platform_ArgVector = (*av)[0]; Platform_HaltCode = -128; diff --git a/bootstrap/windows-88/Platform.h b/bootstrap/windows-88/Platform.h index aacc5cad..968219dd 100644 --- a/bootstrap/windows-88/Platform.h +++ b/bootstrap/windows-88/Platform.h @@ -15,7 +15,7 @@ typedef void (*Platform_HaltProcedure)(int32); typedef - void (*Platform_SignalHandler)(int16); + void (*Platform_SignalHandler)(int32); import BOOLEAN Platform_LittleEndian; @@ -50,7 +50,7 @@ import void Platform_Halt (int32 code); import int16 Platform_Identify (int32 h, Platform_FileIdentity *identity, address *identity__typ); import int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ); import BOOLEAN Platform_Inaccessible (int16 e); -import void Platform_Init (int16 argc, int64 argvadr); +import void Platform_Init (int32 argc, int64 argvadr); import BOOLEAN Platform_Interrupted (int16 e); import void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); import int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); diff --git a/bootstrap/windows-88/vt100.c b/bootstrap/windows-88/VT100.c similarity index 100% rename from bootstrap/windows-88/vt100.c rename to bootstrap/windows-88/VT100.c diff --git a/bootstrap/windows-88/vt100.h b/bootstrap/windows-88/VT100.h similarity index 100% rename from bootstrap/windows-88/vt100.h rename to bootstrap/windows-88/VT100.h diff --git a/src/compiler/Compiler.Mod b/src/compiler/Compiler.Mod index d8c688a7..c8e3c40f 100644 --- a/src/compiler/Compiler.Mod +++ b/src/compiler/Compiler.Mod @@ -129,7 +129,7 @@ MODULE Compiler; (* J. Templ 3.2.95 *) END END Translate; - PROCEDURE Trap(sig: INTEGER); + PROCEDURE Trap(sig: SYSTEM.INT32); BEGIN Heap.FINALL(); IF sig = 3 THEN diff --git a/src/runtime/Platformunix.Mod b/src/runtime/Platformunix.Mod index 3db3f2d7..5359a664 100644 --- a/src/runtime/Platformunix.Mod +++ b/src/runtime/Platformunix.Mod @@ -7,8 +7,8 @@ CONST StdErr- = 2; TYPE - HaltProcedure = PROCEDURE(n: LONGINT); - SignalHandler = PROCEDURE(signal: INTEGER); + HaltProcedure = PROCEDURE(n: SYSTEM.INT32); + SignalHandler = PROCEDURE(signal: SYSTEM.INT32); ErrorCode* = INTEGER; FileHandle* = LONGINT; @@ -124,11 +124,11 @@ PROCEDURE OSFree*(address: SYSTEM.ADDRESS); BEGIN free(address) END OSFree; PROCEDURE -ExternInitHeap "extern void Heap_InitHeap();"; PROCEDURE -HeapInitHeap() "Heap_InitHeap()"; -PROCEDURE Init*(argc: INTEGER; argvadr: SYSTEM.ADDRESS); +PROCEDURE Init*(argc: SYSTEM.INT32; argvadr: SYSTEM.ADDRESS); VAR av: ArgVecPtr; BEGIN MainStackFrame := argvadr; - ArgCount := argc; + ArgCount := SYSTEM.VAL(INTEGER, argc); av := SYSTEM.VAL(ArgVecPtr, argvadr); ArgVector := av[0]; HaltCode := -128; @@ -502,7 +502,7 @@ BEGIN END END DisplayHaltCode; -PROCEDURE Halt*(code: LONGINT); +PROCEDURE Halt*(code: SYSTEM.INT32); BEGIN HaltCode := code; IF HaltHandler # NIL THEN HaltHandler(code) END; @@ -512,7 +512,7 @@ BEGIN exit(SYSTEM.VAL(INTEGER,code)); END Halt; -PROCEDURE AssertFail*(code: LONGINT); +PROCEDURE AssertFail*(code: SYSTEM.INT32); BEGIN errstring("Assertion failure."); IF code # 0 THEN errstring(" ASSERT code "); errint(code); errstring("."); END; diff --git a/src/runtime/Platformwindows.Mod b/src/runtime/Platformwindows.Mod index 8471eabb..ad9574d1 100644 --- a/src/runtime/Platformwindows.Mod +++ b/src/runtime/Platformwindows.Mod @@ -8,8 +8,8 @@ IMPORT SYSTEM; TYPE - HaltProcedure = PROCEDURE(n: LONGINT); - SignalHandler = PROCEDURE(signal: INTEGER); + HaltProcedure = PROCEDURE(n: SYSTEM.INT32); + SignalHandler = PROCEDURE(signal: SYSTEM.INT32); ErrorCode* = INTEGER; FileHandle* = LONGINT; @@ -122,11 +122,11 @@ PROCEDURE OSFree*(address: SYSTEM.ADDRESS); BEGIN free(address) END OSFree; PROCEDURE -ExternInitHeap "extern void Heap_InitHeap();"; PROCEDURE -HeapInitHeap() "Heap_InitHeap()"; -PROCEDURE Init*(argc: INTEGER; argvadr: SYSTEM.ADDRESS); +PROCEDURE Init*(argc: SYSTEM.INT32; argvadr: SYSTEM.ADDRESS); VAR av: ArgVecPtr; BEGIN MainStackFrame := argvadr; - ArgCount := argc; + ArgCount := SYSTEM.VAL(INTEGER, argc); av := SYSTEM.VAL(ArgVecPtr, argvadr); ArgVector := av[0]; HaltCode := -128; diff --git a/src/runtime/SYSTEM.c b/src/runtime/SYSTEM.c index 6efc8321..b97144e7 100644 --- a/src/runtime/SYSTEM.c +++ b/src/runtime/SYSTEM.c @@ -46,20 +46,30 @@ int64 SYSTEM_MOD(int64 x, int64 y) else {return -((-x) % (-y));} } -LONGINT SYSTEM_ENTIER(double x) +// LONGINT SYSTEM_ENTIER(double x) +// { +// LONGINT y; +// if (x >= 0) +// return (LONGINT)x; +// else { +// y = (LONGINT)x; +// if (y <= x) return y; else return y - 1; +// } +// } + +int64 SYSTEM_ENTIER(double x) { - LONGINT y; + int64 y; if (x >= 0) - return (LONGINT)x; + return (int64)x; else { - y = (LONGINT)x; + y = (int64)x; if (y <= x) return y; else return y - 1; } } - void SYSTEM_INHERIT(address *t, address *t0) { t -= __TPROC0OFF; @@ -155,7 +165,7 @@ SYSTEM_PTR SYSTEM_NEWARR(address *typ, address elemsz, int elemalgn, int nofdim, -typedef void (*SystemSignalHandler)(INTEGER); // = Platform_SignalHandler +typedef void (*SystemSignalHandler)(int32); // = Platform_SignalHandler #ifndef _WIN32 diff --git a/src/runtime/SYSTEM.h b/src/runtime/SYSTEM.h index 4e1bfe18..7cba936e 100644 --- a/src/runtime/SYSTEM.h +++ b/src/runtime/SYSTEM.h @@ -8,20 +8,19 @@ #define __o_64 #endif -// Temporary while bootstrapping and clearing up SYSTEM.c. - - -#ifndef LONGINT - #if defined (__o_64) - #define INTEGER int32 - #define LONGINT int64 - #define SET uint64 - #else - #define INTEGER int16 - #define LONGINT int32 - #define SET uint32 - #endif -#endif +// // Temporary while bootstrapping and clearing up SYSTEM.c. +// +// #ifndef LONGINT +// #if defined (__o_64) +// #define INTEGER int32 +// #define LONGINT int64 +// #define SET uint64 +// #else +// #define INTEGER int16 +// #define LONGINT int32 +// #define SET uint32 +// #endif +// #endif @@ -119,11 +118,11 @@ extern void Platform_OSFree (address addr); // Assertions and Halts -extern void Platform_Halt(LONGINT x); -extern void Platform_AssertFail(LONGINT x); +extern void Platform_Halt(int32 x); +extern void Platform_AssertFail(int32 x); #define __HALT(x) Platform_Halt(x) -#define __ASSERT(cond, x) if (!(cond)) Platform_AssertFail((LONGINT)(x)) +#define __ASSERT(cond, x) if (!(cond)) Platform_AssertFail((int32)(x)) // Index checking @@ -136,7 +135,7 @@ static inline int64 __XF(uint64 i, uint64 ub) {if (i >= ub) {__HALT(-2);} return static inline int64 __RF(uint64 i, uint64 ub) {if (i >= ub) {__HALT(-8);} return i;} #define __R(i, ub) (((i)<(ub))?i:(__HALT(-8),0)) -#define __SHORT(x, ub) ((int)((uLONGINT)(x)+(ub)<(ub)+(ub)?(x):(__HALT(-8),0))) +#define __SHORT(x, ub) ((int)((uint64)(x)+(ub)<(ub)+(ub)?(x):(__HALT(-8),0))) #define __SHORTF(x, ub) ((int)(__RF((x)+(ub),(ub)+(ub))-(ub))) #define __CHR(x) ((CHAR)__R(x, 256)) #define __CHRF(x) ((CHAR)__RF(x, 256)) @@ -157,7 +156,7 @@ static inline int64 __RF(uint64 i, uint64 ub) {if (i >= ub) {__HALT(-8);} return // String comparison static inline int __str_cmp(CHAR *x, CHAR *y){ - LONGINT i = 0; + int64 i = 0; CHAR ch1, ch2; do {ch1 = x[i]; ch2 = y[i]; i++; if (!ch1) return -(int)ch2; @@ -212,7 +211,7 @@ extern int64 SYSTEM_MOD(int64 x, int64 y); #define __MOD(x, y) (((x)>0 && (y)>0) ? (x)%(y) : __MODF(x, y)) -extern LONGINT SYSTEM_ENTIER (double x); +extern int64 SYSTEM_ENTIER (double x); #define __ENTIER(x) SYSTEM_ENTIER(x) @@ -275,10 +274,10 @@ extern void Heap_INCREF(); // Main module initialisation, registration and finalisation -extern void Platform_Init(INTEGER argc, address argv); +extern void Platform_Init(int32 argc, address argv); extern void Heap_FINALL(); -#define __INIT(argc, argv) static void *m; Platform_Init((INTEGER)argc, (address)&argv); +#define __INIT(argc, argv) static void *m; Platform_Init(argc, (address)&argv); #define __REGMAIN(name, enum) m = Heap_REGMOD((CHAR*)name,enum) #define __FINI Heap_FINALL(); return 0 @@ -287,7 +286,7 @@ extern void Heap_FINALL(); extern SYSTEM_PTR Heap_NEWBLK (address size); extern SYSTEM_PTR Heap_NEWREC (address tag); -extern SYSTEM_PTR SYSTEM_NEWARR(LONGINT*, LONGINT, int, int, int, ...); +extern SYSTEM_PTR SYSTEM_NEWARR(address*, address, int, int, int, ...); #define __SYSNEW(p, len) p = Heap_NEWBLK((address)(len)) #define __NEW(p, t) p = Heap_NEWREC((address)t##__typ) diff --git a/src/test/confidence/signal/signal.mod b/src/test/confidence/signal/signal.mod index c7b58a48..3a897392 100644 --- a/src/test/confidence/signal/signal.mod +++ b/src/test/confidence/signal/signal.mod @@ -1,6 +1,6 @@ (* Test that interrupt and quit are handled correctly. *) MODULE SignalTest; -IMPORT Console, Platform, Files; +IMPORT Console, Platform, Files, SYSTEM; VAR result: Files.File; rider: Files.Rider; @@ -24,7 +24,7 @@ BEGIN END wi; -PROCEDURE handle(signal: INTEGER); +PROCEDURE handle(signal: SYSTEM.INT32); BEGIN Console.Ln; Console.String("Signal: "); Console.Int(signal,1); Console.Ln; ws("Signal "); wi(signal); wl; diff --git a/src/tools/make/configure.c b/src/tools/make/configure.c index d3ccc2d1..695fa0e2 100644 --- a/src/tools/make/configure.c +++ b/src/tools/make/configure.c @@ -220,9 +220,9 @@ void determineBuildDate() { struct {char ch; CHAR x;} c; struct {char ch; BOOLEAN x;} b; //struct {char ch; SHORTINT x;} si; -struct {char ch; INTEGER x;} i; -struct {char ch; LONGINT x;} li; -struct {char ch; SET x;} s; +//struct {char ch; INTEGER x;} i; +//struct {char ch; LONGINT x;} li; +//struct {char ch; SET x;} s; struct {char ch; REAL x;} r; struct {char ch; LONGREAL x;} lr; struct {char ch; void* x;} p; @@ -254,9 +254,9 @@ void ReportSizesAndAlignments() { printf("CHAR %4zd %4td\n", sizeof(CHAR), (char*)&c.x - (char*)&c); printf("BOOLEAN %4zd %4td\n", sizeof(BOOLEAN), (char*)&b.x - (char*)&b); //printf("SHORTINT %4zd %4td\n", sizeof(SHORTINT), (char*)&si.x - (char*)&si); - printf("INTEGER %4zd %4td\n", sizeof(INTEGER), (char*)&i.x - (char*)&i); - printf("LONGINT %4zd %4td\n", sizeof(LONGINT), (char*)&li.x - (char*)&li); - printf("SET %4zd %4td\n", sizeof(SET), (char*)&s.x - (char*)&s); +//printf("INTEGER %4zd %4td\n", sizeof(INTEGER), (char*)&i.x - (char*)&i); +//printf("LONGINT %4zd %4td\n", sizeof(LONGINT), (char*)&li.x - (char*)&li); +//printf("SET %4zd %4td\n", sizeof(SET), (char*)&s.x - (char*)&s); printf("REAL %4zd %4td\n", sizeof(REAL), (char*)&r.x - (char*)&r); printf("LONGREAL %4zd %4td\n", sizeof(LONGREAL), (char*)&lr.x - (char*)&lr); printf("void* %4zd %4td\n", sizeof(void*), (char*)&p.x - (char*)&p); @@ -318,11 +318,14 @@ void testSystemDotH() { /* test the __SETRNG macro */ long x = 0; - long y = sizeof(SET)*8 - 1; - if (sizeof(SET) == 4) - assert(__SETRNG(x, y, 32) == -1, "SETRNG(0, MAX(SET)) != -1."); - else - assert(__SETRNG(x, y, 64) == -1, "SETRNG(0, MAX(SET)) != -1."); + long y; + y=31; assert(__SETRNG(x, y, 32) == -1, "SETRNG(0, MAX(SET), 32) != -1."); + y=63; assert(__SETRNG(x, y, 64) == -1, "SETRNG(0, MAX(SET), 32) != -1."); +// long y = sizeof(SET)*8 - 1; +// if (sizeof(SET) == 4) +// assert(__SETRNG(x, y, 32) == -1, "SETRNG(0, MAX(SET)) != -1."); +// else +// assert(__SETRNG(x, y, 64) == -1, "SETRNG(0, MAX(SET)) != -1."); /* test string comparison for extended ascii */ {char a[10], b[10]; @@ -337,11 +340,11 @@ void testSystemDotH() { assert(sizeof(CHAR) == 1, "Size of CHAR not 1."); assert(sizeof(BOOLEAN) == 1, "Size of BOOLEAN not 1."); //assert(sizeof(SHORTINT) == 1, "Size of SHORTINT not 1."); - assert(sizeof(INTEGER) == 2 - || sizeof(INTEGER) == 4, "Size of INTEGER neither 2 nor 4 bytes."); - assert(sizeof(LONGINT) == 4 - || sizeof(LONGINT) == 8, "Size of LONGINT neither 4 nor 8 bytes."); - assert(sizeof(SET) == sizeof(LONGINT), "Size of SET differs from size of LONGINT."); +//assert(sizeof(INTEGER) == 2 +// || sizeof(INTEGER) == 4, "Size of INTEGER neither 2 nor 4 bytes."); +//assert(sizeof(LONGINT) == 4 +// || sizeof(LONGINT) == 8, "Size of LONGINT neither 4 nor 8 bytes."); +//assert(sizeof(SET) == sizeof(LONGINT), "Size of SET differs from size of LONGINT."); assert(sizeof(REAL) == 4, "Size of REAL not 4 bytes."); assert(sizeof(LONGREAL) == 8, "Size of LONGREAL not 8 bytes."); assert(sizeof(f.x) == sizeof(p.x), "Size of function pointer differs from size of data pointer."); @@ -351,10 +354,10 @@ void testSystemDotH() { assert(((char*)&c.x - (char*)&c) == 1, "Alignment of CHAR not 1."); assert(((char*)&b.x - (char*)&b) == 1, "Alignment of BOOLEAN not 1."); //assert(((char*)&si.x - (char*)&si) == 1, "Alignment of SHORTINT not 1."); - //assert(((char*)&i.x - (char*)&i) == 4, "Alignment of INTEGER not 4 bytes."); +//assert(((char*)&i.x - (char*)&i) == 4, "Alignment of INTEGER not 4 bytes."); assert(((char*)&r.x - (char*)&r) == 4, "Alignment of REAL not 4 bytes."); assert(((char*)&lr.x - (char*)&lr) >= 4, "Alignment of LONGREAL less than 4 bytes."); - assert(((char*)&s.x - (char*)&s) == MIN(alignment, sizeof(SET)), "Alignment of SET differs from alignmnet of LONGINT."); +//assert(((char*)&s.x - (char*)&s) == MIN(alignment, sizeof(SET)), "Alignment of SET differs from alignmnet of LONGINT."); assert(((char*)&p.x - (char*)&p) == addressSize, "Alignment of data pointer differs from address size."); assert(((char*)&f.x - (char*)&f) == addressSize, "Alignment of data pointer differs from address size."); assert(((char*)&lr.x - (char*)&lr) == ((char*)&ll.x - (char*)&ll), "Alignment of LONGREAL differs from alignment of long long."); @@ -362,8 +365,8 @@ void testSystemDotH() { assert(sizeof(rec0) == 1, "CHAR wrapped in record aligns differently to CHAR alone."); assert(sizeof(rec2) == 65, "CHAR array wrapped in record aligns differently to CHAR array alone."); - assert(sizeof(LONGINT) >= sizeof(p.x), "LONGINT should have at least the same size as data pointers."); - assert(sizeof(LONGINT) >= sizeof(f.x), "LONGINT should have at least the same size as function pointers."); +//assert(sizeof(LONGINT) >= sizeof(p.x), "LONGINT should have at least the same size as data pointers."); +//assert(sizeof(LONGINT) >= sizeof(f.x), "LONGINT should have at least the same size as function pointers."); if (((sizeof(rec2)==65) == (sizeof(rec0)==1)) && ((sizeof(rec2)-64) != sizeof(rec0))) printf("error: unsupported record layout sizeof(rec0) = %lu sizeof(rec2) = %lu\n", (long)sizeof(rec0), (long)sizeof(rec2));