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));} 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) if (x >= 0)
return (LONGINT)x; return (int64)x;
else { else {
y = (LONGINT)x; y = (int64)x;
if (y <= x) return y; else return y - 1; if (y <= x) return y; else return y - 1;
} }
} }
void SYSTEM_INHERIT(address *t, address *t0) void SYSTEM_INHERIT(address *t, address *t0)
{ {
t -= __TPROC0OFF; 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 #ifndef _WIN32

View file

@ -8,20 +8,19 @@
#define __o_64 #define __o_64
#endif #endif
// Temporary while bootstrapping and clearing up SYSTEM.c. // // Temporary while bootstrapping and clearing up SYSTEM.c.
//
// #ifndef LONGINT
#ifndef LONGINT // #if defined (__o_64)
#if defined (__o_64) // #define INTEGER int32
#define INTEGER int32 // #define LONGINT int64
#define LONGINT int64 // #define SET uint64
#define SET uint64 // #else
#else // #define INTEGER int16
#define INTEGER int16 // #define LONGINT int32
#define LONGINT int32 // #define SET uint32
#define SET uint32 // #endif
#endif // #endif
#endif
@ -119,11 +118,11 @@ extern void Platform_OSFree (address addr);
// Assertions and Halts // Assertions and Halts
extern void Platform_Halt(LONGINT x); extern void Platform_Halt(int32 x);
extern void Platform_AssertFail(LONGINT x); extern void Platform_AssertFail(int32 x);
#define __HALT(x) Platform_Halt(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 // 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;} 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 __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 __SHORTF(x, ub) ((int)(__RF((x)+(ub),(ub)+(ub))-(ub)))
#define __CHR(x) ((CHAR)__R(x, 256)) #define __CHR(x) ((CHAR)__R(x, 256))
#define __CHRF(x) ((CHAR)__RF(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 // String comparison
static inline int __str_cmp(CHAR *x, CHAR *y){ static inline int __str_cmp(CHAR *x, CHAR *y){
LONGINT i = 0; int64 i = 0;
CHAR ch1, ch2; CHAR ch1, ch2;
do {ch1 = x[i]; ch2 = y[i]; i++; do {ch1 = x[i]; ch2 = y[i]; i++;
if (!ch1) return -(int)ch2; 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)) #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) #define __ENTIER(x) SYSTEM_ENTIER(x)
@ -275,10 +274,10 @@ extern void Heap_INCREF();
// Main module initialisation, registration and finalisation // 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(); 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 __REGMAIN(name, enum) m = Heap_REGMOD((CHAR*)name,enum)
#define __FINI Heap_FINALL(); return 0 #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_NEWBLK (address size);
extern SYSTEM_PTR Heap_NEWREC (address tag); 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 __SYSNEW(p, len) p = Heap_NEWBLK((address)(len))
#define __NEW(p, t) p = Heap_NEWREC((address)t##__typ) #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); export void Compiler_Module (BOOLEAN *done);
static void Compiler_PropagateElementaryTypeSizes (void); static void Compiler_PropagateElementaryTypeSizes (void);
export void Compiler_Translate (void); export void Compiler_Translate (void);
static void Compiler_Trap (int16 sig); static void Compiler_Trap (int32 sig);
void Compiler_Module (BOOLEAN *done) 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(); Heap_FINALL();
if (sig == 3) { if (sig == 3) {

View file

@ -28,7 +28,7 @@ typedef
void (*Platform_HaltProcedure)(int32); void (*Platform_HaltProcedure)(int32);
typedef typedef
void (*Platform_SignalHandler)(int16); void (*Platform_SignalHandler)(int32);
export BOOLEAN Platform_LittleEndian; 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_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 int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ);
export BOOLEAN Platform_Inaccessible (int16 e); 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 BOOLEAN Platform_Interrupted (int16 e);
export void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); export void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d);
export int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); export int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h);
@ -240,11 +240,11 @@ void Platform_OSFree (int32 address)
Platform_free(address); Platform_free(address);
} }
void Platform_Init (int16 argc, int32 argvadr) void Platform_Init (int32 argc, int32 argvadr)
{ {
Platform_ArgVecPtr av = NIL; Platform_ArgVecPtr av = NIL;
Platform_MainStackFrame = argvadr; Platform_MainStackFrame = argvadr;
Platform_ArgCount = argc; Platform_ArgCount = __VAL(int16, argc);
av = (Platform_ArgVecPtr)(address)argvadr; av = (Platform_ArgVecPtr)(address)argvadr;
Platform_ArgVector = (*av)[0]; Platform_ArgVector = (*av)[0];
Platform_HaltCode = -128; Platform_HaltCode = -128;

View file

@ -15,7 +15,7 @@ typedef
void (*Platform_HaltProcedure)(int32); void (*Platform_HaltProcedure)(int32);
typedef typedef
void (*Platform_SignalHandler)(int16); void (*Platform_SignalHandler)(int32);
import BOOLEAN Platform_LittleEndian; 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_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 int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ);
import BOOLEAN Platform_Inaccessible (int16 e); 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 BOOLEAN Platform_Interrupted (int16 e);
import void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); import void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d);
import int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); 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); export void Compiler_Module (BOOLEAN *done);
static void Compiler_PropagateElementaryTypeSizes (void); static void Compiler_PropagateElementaryTypeSizes (void);
export void Compiler_Translate (void); export void Compiler_Translate (void);
static void Compiler_Trap (int16 sig); static void Compiler_Trap (int32 sig);
void Compiler_Module (BOOLEAN *done) 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(); Heap_FINALL();
if (sig == 3) { if (sig == 3) {

View file

@ -28,7 +28,7 @@ typedef
void (*Platform_HaltProcedure)(int32); void (*Platform_HaltProcedure)(int32);
typedef typedef
void (*Platform_SignalHandler)(int16); void (*Platform_SignalHandler)(int32);
export BOOLEAN Platform_LittleEndian; 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_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 int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ);
export BOOLEAN Platform_Inaccessible (int16 e); 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 BOOLEAN Platform_Interrupted (int16 e);
export void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); export void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d);
export int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); export int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h);
@ -240,11 +240,11 @@ void Platform_OSFree (int32 address)
Platform_free(address); Platform_free(address);
} }
void Platform_Init (int16 argc, int32 argvadr) void Platform_Init (int32 argc, int32 argvadr)
{ {
Platform_ArgVecPtr av = NIL; Platform_ArgVecPtr av = NIL;
Platform_MainStackFrame = argvadr; Platform_MainStackFrame = argvadr;
Platform_ArgCount = argc; Platform_ArgCount = __VAL(int16, argc);
av = (Platform_ArgVecPtr)(address)argvadr; av = (Platform_ArgVecPtr)(address)argvadr;
Platform_ArgVector = (*av)[0]; Platform_ArgVector = (*av)[0];
Platform_HaltCode = -128; Platform_HaltCode = -128;

View file

@ -15,7 +15,7 @@ typedef
void (*Platform_HaltProcedure)(int32); void (*Platform_HaltProcedure)(int32);
typedef typedef
void (*Platform_SignalHandler)(int16); void (*Platform_SignalHandler)(int32);
import BOOLEAN Platform_LittleEndian; 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_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 int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ);
import BOOLEAN Platform_Inaccessible (int16 e); 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 BOOLEAN Platform_Interrupted (int16 e);
import void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); import void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d);
import int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); 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); export void Compiler_Module (BOOLEAN *done);
static void Compiler_PropagateElementaryTypeSizes (void); static void Compiler_PropagateElementaryTypeSizes (void);
export void Compiler_Translate (void); export void Compiler_Translate (void);
static void Compiler_Trap (int16 sig); static void Compiler_Trap (int32 sig);
void Compiler_Module (BOOLEAN *done) 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(); Heap_FINALL();
if (sig == 3) { if (sig == 3) {

View file

@ -28,7 +28,7 @@ typedef
void (*Platform_HaltProcedure)(int32); void (*Platform_HaltProcedure)(int32);
typedef typedef
void (*Platform_SignalHandler)(int16); void (*Platform_SignalHandler)(int32);
export BOOLEAN Platform_LittleEndian; 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_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 int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ);
export BOOLEAN Platform_Inaccessible (int16 e); 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 BOOLEAN Platform_Interrupted (int16 e);
export void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); export void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d);
export int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); export int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h);
@ -240,11 +240,11 @@ void Platform_OSFree (int64 address)
Platform_free(address); Platform_free(address);
} }
void Platform_Init (int16 argc, int64 argvadr) void Platform_Init (int32 argc, int64 argvadr)
{ {
Platform_ArgVecPtr av = NIL; Platform_ArgVecPtr av = NIL;
Platform_MainStackFrame = argvadr; Platform_MainStackFrame = argvadr;
Platform_ArgCount = argc; Platform_ArgCount = __VAL(int16, argc);
av = (Platform_ArgVecPtr)(address)argvadr; av = (Platform_ArgVecPtr)(address)argvadr;
Platform_ArgVector = (*av)[0]; Platform_ArgVector = (*av)[0];
Platform_HaltCode = -128; Platform_HaltCode = -128;

View file

@ -15,7 +15,7 @@ typedef
void (*Platform_HaltProcedure)(int32); void (*Platform_HaltProcedure)(int32);
typedef typedef
void (*Platform_SignalHandler)(int16); void (*Platform_SignalHandler)(int32);
import BOOLEAN Platform_LittleEndian; 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_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 int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ);
import BOOLEAN Platform_Inaccessible (int16 e); 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 BOOLEAN Platform_Interrupted (int16 e);
import void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); import void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d);
import int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); 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); export void Compiler_Module (BOOLEAN *done);
static void Compiler_PropagateElementaryTypeSizes (void); static void Compiler_PropagateElementaryTypeSizes (void);
export void Compiler_Translate (void); export void Compiler_Translate (void);
static void Compiler_Trap (int16 sig); static void Compiler_Trap (int32 sig);
void Compiler_Module (BOOLEAN *done) 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(); Heap_FINALL();
if (sig == 3) { if (sig == 3) {

View file

@ -28,7 +28,7 @@ typedef
void (*Platform_HaltProcedure)(int32); void (*Platform_HaltProcedure)(int32);
typedef typedef
void (*Platform_SignalHandler)(int16); void (*Platform_SignalHandler)(int32);
export BOOLEAN Platform_LittleEndian; 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_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 int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ);
export BOOLEAN Platform_Inaccessible (int16 e); 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 BOOLEAN Platform_Interrupted (int16 e);
export void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); export void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d);
export int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); export int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h);
@ -252,11 +252,11 @@ void Platform_OSFree (int32 address)
Platform_free(address); Platform_free(address);
} }
void Platform_Init (int16 argc, int32 argvadr) void Platform_Init (int32 argc, int32 argvadr)
{ {
Platform_ArgVecPtr av = NIL; Platform_ArgVecPtr av = NIL;
Platform_MainStackFrame = argvadr; Platform_MainStackFrame = argvadr;
Platform_ArgCount = argc; Platform_ArgCount = __VAL(int16, argc);
av = (Platform_ArgVecPtr)(address)argvadr; av = (Platform_ArgVecPtr)(address)argvadr;
Platform_ArgVector = (*av)[0]; Platform_ArgVector = (*av)[0];
Platform_HaltCode = -128; Platform_HaltCode = -128;

View file

@ -15,7 +15,7 @@ typedef
void (*Platform_HaltProcedure)(int32); void (*Platform_HaltProcedure)(int32);
typedef typedef
void (*Platform_SignalHandler)(int16); void (*Platform_SignalHandler)(int32);
import BOOLEAN Platform_LittleEndian; 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_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 int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ);
import BOOLEAN Platform_Inaccessible (int16 e); 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 BOOLEAN Platform_Interrupted (int16 e);
import void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); import void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d);
import int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); 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); export void Compiler_Module (BOOLEAN *done);
static void Compiler_PropagateElementaryTypeSizes (void); static void Compiler_PropagateElementaryTypeSizes (void);
export void Compiler_Translate (void); export void Compiler_Translate (void);
static void Compiler_Trap (int16 sig); static void Compiler_Trap (int32 sig);
void Compiler_Module (BOOLEAN *done) 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(); Heap_FINALL();
if (sig == 3) { if (sig == 3) {

View file

@ -28,7 +28,7 @@ typedef
void (*Platform_HaltProcedure)(int32); void (*Platform_HaltProcedure)(int32);
typedef typedef
void (*Platform_SignalHandler)(int16); void (*Platform_SignalHandler)(int32);
export BOOLEAN Platform_LittleEndian; 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_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 int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ);
export BOOLEAN Platform_Inaccessible (int16 e); 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 BOOLEAN Platform_Interrupted (int16 e);
export void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); export void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d);
export int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); export int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h);
@ -252,11 +252,11 @@ void Platform_OSFree (int64 address)
Platform_free(address); Platform_free(address);
} }
void Platform_Init (int16 argc, int64 argvadr) void Platform_Init (int32 argc, int64 argvadr)
{ {
Platform_ArgVecPtr av = NIL; Platform_ArgVecPtr av = NIL;
Platform_MainStackFrame = argvadr; Platform_MainStackFrame = argvadr;
Platform_ArgCount = argc; Platform_ArgCount = __VAL(int16, argc);
av = (Platform_ArgVecPtr)(address)argvadr; av = (Platform_ArgVecPtr)(address)argvadr;
Platform_ArgVector = (*av)[0]; Platform_ArgVector = (*av)[0];
Platform_HaltCode = -128; Platform_HaltCode = -128;

View file

@ -15,7 +15,7 @@ typedef
void (*Platform_HaltProcedure)(int32); void (*Platform_HaltProcedure)(int32);
typedef typedef
void (*Platform_SignalHandler)(int16); void (*Platform_SignalHandler)(int32);
import BOOLEAN Platform_LittleEndian; 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_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 int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ);
import BOOLEAN Platform_Inaccessible (int16 e); 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 BOOLEAN Platform_Interrupted (int16 e);
import void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); import void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d);
import int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); import int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h);

View file

@ -129,7 +129,7 @@ MODULE Compiler; (* J. Templ 3.2.95 *)
END END
END Translate; END Translate;
PROCEDURE Trap(sig: INTEGER); PROCEDURE Trap(sig: SYSTEM.INT32);
BEGIN BEGIN
Heap.FINALL(); Heap.FINALL();
IF sig = 3 THEN IF sig = 3 THEN

View file

@ -7,8 +7,8 @@ CONST
StdErr- = 2; StdErr- = 2;
TYPE TYPE
HaltProcedure = PROCEDURE(n: LONGINT); HaltProcedure = PROCEDURE(n: SYSTEM.INT32);
SignalHandler = PROCEDURE(signal: INTEGER); SignalHandler = PROCEDURE(signal: SYSTEM.INT32);
ErrorCode* = INTEGER; ErrorCode* = INTEGER;
FileHandle* = LONGINT; FileHandle* = LONGINT;
@ -124,11 +124,11 @@ PROCEDURE OSFree*(address: SYSTEM.ADDRESS); BEGIN free(address) END OSFree;
PROCEDURE -ExternInitHeap "extern void Heap_InitHeap();"; PROCEDURE -ExternInitHeap "extern void Heap_InitHeap();";
PROCEDURE -HeapInitHeap() "Heap_InitHeap()"; PROCEDURE -HeapInitHeap() "Heap_InitHeap()";
PROCEDURE Init*(argc: INTEGER; argvadr: SYSTEM.ADDRESS); PROCEDURE Init*(argc: SYSTEM.INT32; argvadr: SYSTEM.ADDRESS);
VAR av: ArgVecPtr; VAR av: ArgVecPtr;
BEGIN BEGIN
MainStackFrame := argvadr; MainStackFrame := argvadr;
ArgCount := argc; ArgCount := SYSTEM.VAL(INTEGER, argc);
av := SYSTEM.VAL(ArgVecPtr, argvadr); av := SYSTEM.VAL(ArgVecPtr, argvadr);
ArgVector := av[0]; ArgVector := av[0];
HaltCode := -128; HaltCode := -128;
@ -502,7 +502,7 @@ BEGIN
END END
END DisplayHaltCode; END DisplayHaltCode;
PROCEDURE Halt*(code: LONGINT); PROCEDURE Halt*(code: SYSTEM.INT32);
BEGIN BEGIN
HaltCode := code; HaltCode := code;
IF HaltHandler # NIL THEN HaltHandler(code) END; IF HaltHandler # NIL THEN HaltHandler(code) END;
@ -512,7 +512,7 @@ BEGIN
exit(SYSTEM.VAL(INTEGER,code)); exit(SYSTEM.VAL(INTEGER,code));
END Halt; END Halt;
PROCEDURE AssertFail*(code: LONGINT); PROCEDURE AssertFail*(code: SYSTEM.INT32);
BEGIN BEGIN
errstring("Assertion failure."); errstring("Assertion failure.");
IF code # 0 THEN errstring(" ASSERT code "); errint(code); errstring("."); END; IF code # 0 THEN errstring(" ASSERT code "); errint(code); errstring("."); END;

View file

@ -8,8 +8,8 @@ IMPORT SYSTEM;
TYPE TYPE
HaltProcedure = PROCEDURE(n: LONGINT); HaltProcedure = PROCEDURE(n: SYSTEM.INT32);
SignalHandler = PROCEDURE(signal: INTEGER); SignalHandler = PROCEDURE(signal: SYSTEM.INT32);
ErrorCode* = INTEGER; ErrorCode* = INTEGER;
FileHandle* = LONGINT; FileHandle* = LONGINT;
@ -122,11 +122,11 @@ PROCEDURE OSFree*(address: SYSTEM.ADDRESS); BEGIN free(address) END OSFree;
PROCEDURE -ExternInitHeap "extern void Heap_InitHeap();"; PROCEDURE -ExternInitHeap "extern void Heap_InitHeap();";
PROCEDURE -HeapInitHeap() "Heap_InitHeap()"; PROCEDURE -HeapInitHeap() "Heap_InitHeap()";
PROCEDURE Init*(argc: INTEGER; argvadr: SYSTEM.ADDRESS); PROCEDURE Init*(argc: SYSTEM.INT32; argvadr: SYSTEM.ADDRESS);
VAR av: ArgVecPtr; VAR av: ArgVecPtr;
BEGIN BEGIN
MainStackFrame := argvadr; MainStackFrame := argvadr;
ArgCount := argc; ArgCount := SYSTEM.VAL(INTEGER, argc);
av := SYSTEM.VAL(ArgVecPtr, argvadr); av := SYSTEM.VAL(ArgVecPtr, argvadr);
ArgVector := av[0]; ArgVector := av[0];
HaltCode := -128; HaltCode := -128;

View file

@ -46,20 +46,30 @@ int64 SYSTEM_MOD(int64 x, int64 y)
else {return -((-x) % (-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) if (x >= 0)
return (LONGINT)x; return (int64)x;
else { else {
y = (LONGINT)x; y = (int64)x;
if (y <= x) return y; else return y - 1; if (y <= x) return y; else return y - 1;
} }
} }
void SYSTEM_INHERIT(address *t, address *t0) void SYSTEM_INHERIT(address *t, address *t0)
{ {
t -= __TPROC0OFF; 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 #ifndef _WIN32

View file

@ -8,20 +8,19 @@
#define __o_64 #define __o_64
#endif #endif
// Temporary while bootstrapping and clearing up SYSTEM.c. // // Temporary while bootstrapping and clearing up SYSTEM.c.
//
// #ifndef LONGINT
#ifndef LONGINT // #if defined (__o_64)
#if defined (__o_64) // #define INTEGER int32
#define INTEGER int32 // #define LONGINT int64
#define LONGINT int64 // #define SET uint64
#define SET uint64 // #else
#else // #define INTEGER int16
#define INTEGER int16 // #define LONGINT int32
#define LONGINT int32 // #define SET uint32
#define SET uint32 // #endif
#endif // #endif
#endif
@ -119,11 +118,11 @@ extern void Platform_OSFree (address addr);
// Assertions and Halts // Assertions and Halts
extern void Platform_Halt(LONGINT x); extern void Platform_Halt(int32 x);
extern void Platform_AssertFail(LONGINT x); extern void Platform_AssertFail(int32 x);
#define __HALT(x) Platform_Halt(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 // 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;} 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 __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 __SHORTF(x, ub) ((int)(__RF((x)+(ub),(ub)+(ub))-(ub)))
#define __CHR(x) ((CHAR)__R(x, 256)) #define __CHR(x) ((CHAR)__R(x, 256))
#define __CHRF(x) ((CHAR)__RF(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 // String comparison
static inline int __str_cmp(CHAR *x, CHAR *y){ static inline int __str_cmp(CHAR *x, CHAR *y){
LONGINT i = 0; int64 i = 0;
CHAR ch1, ch2; CHAR ch1, ch2;
do {ch1 = x[i]; ch2 = y[i]; i++; do {ch1 = x[i]; ch2 = y[i]; i++;
if (!ch1) return -(int)ch2; 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)) #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) #define __ENTIER(x) SYSTEM_ENTIER(x)
@ -275,10 +274,10 @@ extern void Heap_INCREF();
// Main module initialisation, registration and finalisation // 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(); 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 __REGMAIN(name, enum) m = Heap_REGMOD((CHAR*)name,enum)
#define __FINI Heap_FINALL(); return 0 #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_NEWBLK (address size);
extern SYSTEM_PTR Heap_NEWREC (address tag); 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 __SYSNEW(p, len) p = Heap_NEWBLK((address)(len))
#define __NEW(p, t) p = Heap_NEWREC((address)t##__typ) #define __NEW(p, t) p = Heap_NEWREC((address)t##__typ)

View file

@ -1,6 +1,6 @@
(* Test that interrupt and quit are handled correctly. *) (* Test that interrupt and quit are handled correctly. *)
MODULE SignalTest; MODULE SignalTest;
IMPORT Console, Platform, Files; IMPORT Console, Platform, Files, SYSTEM;
VAR result: Files.File; rider: Files.Rider; VAR result: Files.File; rider: Files.Rider;
@ -24,7 +24,7 @@ BEGIN
END wi; END wi;
PROCEDURE handle(signal: INTEGER); PROCEDURE handle(signal: SYSTEM.INT32);
BEGIN BEGIN
Console.Ln; Console.String("Signal: "); Console.Int(signal,1); Console.Ln; Console.Ln; Console.String("Signal: "); Console.Int(signal,1); Console.Ln;
ws("Signal "); wi(signal); wl; ws("Signal "); wi(signal); wl;

View file

@ -220,9 +220,9 @@ void determineBuildDate() {
struct {char ch; CHAR x;} c; struct {char ch; CHAR x;} c;
struct {char ch; BOOLEAN x;} b; struct {char ch; BOOLEAN x;} b;
//struct {char ch; SHORTINT x;} si; //struct {char ch; SHORTINT x;} si;
struct {char ch; INTEGER x;} i; //struct {char ch; INTEGER x;} i;
struct {char ch; LONGINT x;} li; //struct {char ch; LONGINT x;} li;
struct {char ch; SET x;} s; //struct {char ch; SET x;} s;
struct {char ch; REAL x;} r; struct {char ch; REAL x;} r;
struct {char ch; LONGREAL x;} lr; struct {char ch; LONGREAL x;} lr;
struct {char ch; void* x;} p; 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("CHAR %4zd %4td\n", sizeof(CHAR), (char*)&c.x - (char*)&c);
printf("BOOLEAN %4zd %4td\n", sizeof(BOOLEAN), (char*)&b.x - (char*)&b); 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("SHORTINT %4zd %4td\n", sizeof(SHORTINT), (char*)&si.x - (char*)&si);
printf("INTEGER %4zd %4td\n", sizeof(INTEGER), (char*)&i.x - (char*)&i); //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("LONGINT %4zd %4td\n", sizeof(LONGINT), (char*)&li.x - (char*)&li);
printf("SET %4zd %4td\n", sizeof(SET), (char*)&s.x - (char*)&s); //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("REAL %4zd %4td\n", sizeof(REAL), (char*)&r.x - (char*)&r);
printf("LONGREAL %4zd %4td\n", sizeof(LONGREAL), (char*)&lr.x - (char*)&lr); printf("LONGREAL %4zd %4td\n", sizeof(LONGREAL), (char*)&lr.x - (char*)&lr);
printf("void* %4zd %4td\n", sizeof(void*), (char*)&p.x - (char*)&p); printf("void* %4zd %4td\n", sizeof(void*), (char*)&p.x - (char*)&p);
@ -318,11 +318,14 @@ void testSystemDotH() {
/* test the __SETRNG macro */ /* test the __SETRNG macro */
long x = 0; long x = 0;
long y = sizeof(SET)*8 - 1; long y;
if (sizeof(SET) == 4) y=31; assert(__SETRNG(x, y, 32) == -1, "SETRNG(0, MAX(SET), 32) != -1.");
assert(__SETRNG(x, y, 32) == -1, "SETRNG(0, MAX(SET)) != -1."); y=63; assert(__SETRNG(x, y, 64) == -1, "SETRNG(0, MAX(SET), 32) != -1.");
else // long y = sizeof(SET)*8 - 1;
assert(__SETRNG(x, y, 64) == -1, "SETRNG(0, MAX(SET)) != -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 */ /* test string comparison for extended ascii */
{char a[10], b[10]; {char a[10], b[10];
@ -337,11 +340,11 @@ void testSystemDotH() {
assert(sizeof(CHAR) == 1, "Size of CHAR not 1."); assert(sizeof(CHAR) == 1, "Size of CHAR not 1.");
assert(sizeof(BOOLEAN) == 1, "Size of BOOLEAN not 1."); assert(sizeof(BOOLEAN) == 1, "Size of BOOLEAN not 1.");
//assert(sizeof(SHORTINT) == 1, "Size of SHORTINT not 1."); //assert(sizeof(SHORTINT) == 1, "Size of SHORTINT not 1.");
assert(sizeof(INTEGER) == 2 //assert(sizeof(INTEGER) == 2
|| sizeof(INTEGER) == 4, "Size of INTEGER neither 2 nor 4 bytes."); // || sizeof(INTEGER) == 4, "Size of INTEGER neither 2 nor 4 bytes.");
assert(sizeof(LONGINT) == 4 //assert(sizeof(LONGINT) == 4
|| sizeof(LONGINT) == 8, "Size of LONGINT neither 4 nor 8 bytes."); // || 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(SET) == sizeof(LONGINT), "Size of SET differs from size of LONGINT.");
assert(sizeof(REAL) == 4, "Size of REAL not 4 bytes."); assert(sizeof(REAL) == 4, "Size of REAL not 4 bytes.");
assert(sizeof(LONGREAL) == 8, "Size of LONGREAL not 8 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."); assert(sizeof(f.x) == sizeof(p.x), "Size of function pointer differs from size of data pointer.");
@ -354,7 +357,7 @@ void testSystemDotH() {
//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*)&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*)&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*)&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*)&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."); 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(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(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(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(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))) 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)); printf("error: unsupported record layout sizeof(rec0) = %lu sizeof(rec2) = %lu\n", (long)sizeof(rec0), (long)sizeof(rec2));