Force git rename of VT100 in bootstrap, make SYSTEM.* mdel independent.

This commit is contained in:
David Brown 2016-10-15 19:05:08 +01:00
parent 80de6dc216
commit 1507d9cb0a
34 changed files with 152 additions and 131 deletions

View file

@ -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

View file

@ -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)

View file

@ -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) {

View file

@ -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;

View file

@ -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);

View file

@ -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) {

View file

@ -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;

View file

@ -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);

View file

@ -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) {

View file

@ -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;

View file

@ -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);

View file

@ -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) {

View file

@ -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;

View file

@ -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);

View file

@ -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) {

View file

@ -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;

View file

@ -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);