diff --git a/.gitignore b/.gitignore index 0e401127..2c05bb3a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,9 +4,12 @@ /build/* /*.exe /*.obj -/*.o +/*.[cho] /*.lib /*.map +/*.sym +/*.asm +/*.mod /olang /src/test/**/*.exe /src/test/**/*.c @@ -14,10 +17,11 @@ /src/test/**/*.o /src/test/**/*.obj /src/test/**/*.sym -/src/test/**/*.stackdump +**/*.stackdump /src/test/confidence/**/result /src/test/confidence/**/*.asm /src/test/confidence/**/*.s +/src/test/confidence/**/*.map /.DS_store **/.DS_store **/*.dSYM diff --git a/bootstrap/unix-44/SYSTEM.c b/bootstrap/SYSTEM.c similarity index 100% rename from bootstrap/unix-44/SYSTEM.c rename to bootstrap/SYSTEM.c diff --git a/bootstrap/unix-44/SYSTEM.h b/bootstrap/SYSTEM.h similarity index 94% rename from bootstrap/unix-44/SYSTEM.h rename to bootstrap/SYSTEM.h index 168b0beb..709c26a7 100644 --- a/bootstrap/unix-44/SYSTEM.h +++ b/bootstrap/SYSTEM.h @@ -33,14 +33,11 @@ #if defined (__o_64) #if defined(_WIN64) typedef unsigned long long size_t; -// typedef long long address; #else typedef unsigned long size_t; -// typedef long address; #endif #else typedef unsigned int size_t; -//typedef int address; #endif #define _SIZE_T_DECLARED // For FreeBSD @@ -71,14 +68,6 @@ typedef signed char int8; typedef unsigned char uint8; -// 'address' is a synonym for an int32 of pointer size - -#if defined (__o_64) - #define address int64 -#else - #define address int32 -#endif - // The compiler uses 'import' and 'export' which translate to 'extern' and // nothing respectively. @@ -98,9 +87,7 @@ typedef unsigned char uint8; typedef int8 BOOLEAN; typedef int8 SYSTEM_BYTE; -typedef uint8 uSYSTEM_BYTE; typedef uint8 CHAR; -typedef uint8 uCHAR; typedef float REAL; typedef double LONGREAL; typedef void* SYSTEM_PTR; @@ -108,6 +95,16 @@ typedef void* SYSTEM_PTR; #define uSET SET +// 'address' is a synonym for an int of pointer size + +#if defined (__o_64) + #define address int64 +#else + #define address int32 +#endif + + + // ---------------------------------------------------------------------- @@ -200,13 +197,13 @@ static inline int __str_cmp(CHAR *x, CHAR *y){ #define __GET(a, x, t) x=*(t*)(address)(a) #define __PUT(a, x, t) *(t*)(address)(a)=x -#define __LSHL(x, n, t) ((t)((u##t)(x)<<(n))) -#define __LSHR(x, n, t) ((t)((u##t)(x)>>(n))) -#define __LSH(x, n, t) ((n)>=0? __LSHL(x, n, t): __LSHR(x, -(n), t)) +#define __LSHL(x, n, s) ((int##s)((uint##s)(x)<<(n))) +#define __LSHR(x, n, s) ((int##s)((uint##s)(x)>>(n))) +#define __LSH(x, n, s) ((n)>=0? __LSHL(x, n, s): __LSHR(x, -(n), s)) -#define __ROTL(x, n, t) ((t)((u##t)(x)<<(n)|(u##t)(x)>>(8*sizeof(t)-(n)))) -#define __ROTR(x, n, t) ((t)((u##t)(x)>>(n)|(u##t)(x)<<(8*sizeof(t)-(n)))) -#define __ROT(x, n, t) ((n)>=0? __ROTL(x, n, t): __ROTR(x, -(n), t)) +#define __ROTL(x, n, s) ((int##s)((uint##s)(x)<<(n)|(uint##s)(x)>>(s-(n)))) +#define __ROTR(x, n, s) ((int##s)((uint##s)(x)>>(n)|(uint##s)(x)<<(s-(n)))) +#define __ROT(x, n, s) ((n)>=0? __ROTL(x, n, s): __ROTR(x, -(n), s)) #define __ASHL(x, n) ((int64)(x)<<(n)) #define __ASHR(x, n) ((int64)(x)>>(n)) diff --git a/bootstrap/unix-44/WindowsWrapper.h b/bootstrap/WindowsWrapper.h similarity index 100% rename from bootstrap/unix-44/WindowsWrapper.h rename to bootstrap/WindowsWrapper.h diff --git a/bootstrap/unix-44/Configuration.c b/bootstrap/unix-44/Configuration.c index 5736ed9f..cc4f7969 100644 --- a/bootstrap/unix-44/Configuration.c +++ b/bootstrap/unix-44/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -18,6 +18,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("1.95 [2016/09/11] for gcc LP64 on cygwin", Configuration_versionLong, 41); + __MOVE("1.95 [2016/09/12] for gcc LP64 on cygwin", Configuration_versionLong, 41); __ENDMOD; } diff --git a/bootstrap/unix-44/Configuration.h b/bootstrap/unix-44/Configuration.h index 31877f12..3ce4467e 100644 --- a/bootstrap/unix-44/Configuration.h +++ b/bootstrap/unix-44/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/unix-44/Console.c b/bootstrap/unix-44/Console.c index 6181cbfd..e33f3d7c 100644 --- a/bootstrap/unix-44/Console.c +++ b/bootstrap/unix-44/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -58,7 +58,7 @@ void Console_Int (int32 i, int32 n) { CHAR s[32]; int32 i1, k; - if (i == __LSHL(1, 31, int32)) { + if (i == __LSHL(1, 31, 32)) { __MOVE("8463847412", s, 11); k = 10; } else { diff --git a/bootstrap/unix-44/Console.h b/bootstrap/unix-44/Console.h index 78586a68..c6fe7fc4 100644 --- a/bootstrap/unix-44/Console.h +++ b/bootstrap/unix-44/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/unix-44/Files.c b/bootstrap/unix-44/Files.c index f98f4e55..ebdd14a9 100644 --- a/bootstrap/unix-44/Files.c +++ b/bootstrap/unix-44/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/Files.h b/bootstrap/unix-44/Files.h index de420c7c..42e60467 100644 --- a/bootstrap/unix-44/Files.h +++ b/bootstrap/unix-44/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tspkaSfF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/unix-44/Heap.c b/bootstrap/unix-44/Heap.c index 58be6181..4d96ea89 100644 --- a/bootstrap/unix-44/Heap.c +++ b/bootstrap/unix-44/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tskSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/Heap.h b/bootstrap/unix-44/Heap.h index 827a3a7c..1a6c9e05 100644 --- a/bootstrap/unix-44/Heap.h +++ b/bootstrap/unix-44/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tskSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/unix-44/Modules.c b/bootstrap/unix-44/Modules.c index 66a8c776..9834a814 100644 --- a/bootstrap/unix-44/Modules.c +++ b/bootstrap/unix-44/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/Modules.h b/bootstrap/unix-44/Modules.h index 02abd713..e34e59ed 100644 --- a/bootstrap/unix-44/Modules.h +++ b/bootstrap/unix-44/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/unix-44/OPB.c b/bootstrap/unix-44/OPB.c index 8d44024a..92c0af42 100644 --- a/bootstrap/unix-44/OPB.c +++ b/bootstrap/unix-44/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/OPB.h b/bootstrap/unix-44/OPB.h index 5aaa8469..96866563 100644 --- a/bootstrap/unix-44/OPB.h +++ b/bootstrap/unix-44/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/unix-44/OPC.c b/bootstrap/unix-44/OPC.c index 1122a8d0..452c85d2 100644 --- a/bootstrap/unix-44/OPC.c +++ b/bootstrap/unix-44/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/OPC.h b/bootstrap/unix-44/OPC.h index 1a9ad61f..81e8362d 100644 --- a/bootstrap/unix-44/OPC.h +++ b/bootstrap/unix-44/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/unix-44/OPM.c b/bootstrap/unix-44/OPM.c index e6d709e7..671a9d8f 100644 --- a/bootstrap/unix-44/OPM.c +++ b/bootstrap/unix-44/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -537,7 +537,7 @@ void OPM_err (int16 n) void OPM_FPrint (int32 *fp, int32 val) { - *fp = __ROTL((int32)((SET)*fp ^ (SET)val), 1, int32); + *fp = __ROTL((int32)((SET)*fp ^ (SET)val), 1, 32); } void OPM_FPrintSet (int32 *fp, SET set) @@ -652,7 +652,7 @@ int32 OPM_SignedMaximum (int32 bytecount) int32 _o_result; int32 result; result = 1; - result = __LSH(result, __ASHL(bytecount, 3) - 1, int32); + result = __LSH(result, __ASHL(bytecount, 3) - 1, 32); _o_result = result - 1; return _o_result; } diff --git a/bootstrap/unix-44/OPM.h b/bootstrap/unix-44/OPM.h index c5192f5b..0d9bcdeb 100644 --- a/bootstrap/unix-44/OPM.h +++ b/bootstrap/unix-44/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPM__h #define OPM__h diff --git a/bootstrap/unix-44/OPP.c b/bootstrap/unix-44/OPP.c index 6e2d4cd0..de0afa51 100644 --- a/bootstrap/unix-44/OPP.c +++ b/bootstrap/unix-44/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/OPP.h b/bootstrap/unix-44/OPP.h index de48c5ba..2d3ebd77 100644 --- a/bootstrap/unix-44/OPP.h +++ b/bootstrap/unix-44/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/unix-44/OPS.c b/bootstrap/unix-44/OPS.c index 9b3bf8f0..e6e99c02 100644 --- a/bootstrap/unix-44/OPS.c +++ b/bootstrap/unix-44/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/OPS.h b/bootstrap/unix-44/OPS.h index 8689aa3b..99448598 100644 --- a/bootstrap/unix-44/OPS.h +++ b/bootstrap/unix-44/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tspkaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/unix-44/OPT.c b/bootstrap/unix-44/OPT.c index 0d16f8ec..4a645e7a 100644 --- a/bootstrap/unix-44/OPT.c +++ b/bootstrap/unix-44/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/OPT.h b/bootstrap/unix-44/OPT.h index b9e46b1a..93975ea1 100644 --- a/bootstrap/unix-44/OPT.h +++ b/bootstrap/unix-44/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/unix-44/OPV.c b/bootstrap/unix-44/OPV.c index e36e3be5..b264d44e 100644 --- a/bootstrap/unix-44/OPV.c +++ b/bootstrap/unix-44/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -1039,7 +1039,7 @@ static void OPV_expr (OPT_Node n, int16 prec) } if (__IN(subclass, 0x18000000)) { OPM_WriteString((CHAR*)", ", 3); - OPC_Ident(l->typ->strobj); + OPM_WriteInt(__ASHL(l->typ->size, 3)); } OPM_Write(')'); break; diff --git a/bootstrap/unix-44/OPV.h b/bootstrap/unix-44/OPV.h index c692efd8..3b43e61e 100644 --- a/bootstrap/unix-44/OPV.h +++ b/bootstrap/unix-44/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/unix-44/Platform.c b/bootstrap/unix-44/Platform.c index b8559160..4842a8c4 100644 --- a/bootstrap/unix-44/Platform.c +++ b/bootstrap/unix-44/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/Platform.h b/bootstrap/unix-44/Platform.h index 868c4e52..295013cf 100644 --- a/bootstrap/unix-44/Platform.h +++ b/bootstrap/unix-44/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/unix-44/Reals.c b/bootstrap/unix-44/Reals.c index c9e8e867..e209af08 100644 --- a/bootstrap/unix-44/Reals.c +++ b/bootstrap/unix-44/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/Reals.h b/bootstrap/unix-44/Reals.h index bd36f8d6..2779fc88 100644 --- a/bootstrap/unix-44/Reals.h +++ b/bootstrap/unix-44/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/unix-44/Strings.c b/bootstrap/unix-44/Strings.c index af7a679b..387345ab 100644 --- a/bootstrap/unix-44/Strings.c +++ b/bootstrap/unix-44/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/Strings.h b/bootstrap/unix-44/Strings.h index d145001a..fe90bd09 100644 --- a/bootstrap/unix-44/Strings.h +++ b/bootstrap/unix-44/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/unix-44/Texts.c b/bootstrap/unix-44/Texts.c index ace0257e..1d7b5409 100644 --- a/bootstrap/unix-44/Texts.c +++ b/bootstrap/unix-44/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/Texts.h b/bootstrap/unix-44/Texts.h index e52c65ca..d684a9c0 100644 --- a/bootstrap/unix-44/Texts.h +++ b/bootstrap/unix-44/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/unix-44/Vishap.c b/bootstrap/unix-44/Vishap.c index b289dfa6..fb1c1662 100644 --- a/bootstrap/unix-44/Vishap.c +++ b/bootstrap/unix-44/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkamSf */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/errors.c b/bootstrap/unix-44/errors.c index 76fa35bf..7feed8e7 100644 --- a/bootstrap/unix-44/errors.c +++ b/bootstrap/unix-44/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/errors.h b/bootstrap/unix-44/errors.h index 9d5bbe45..4fe434e1 100644 --- a/bootstrap/unix-44/errors.h +++ b/bootstrap/unix-44/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/unix-44/extTools.c b/bootstrap/unix-44/extTools.c index 3dbc28ba..0afff1f0 100644 --- a/bootstrap/unix-44/extTools.c +++ b/bootstrap/unix-44/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/extTools.h b/bootstrap/unix-44/extTools.h index 8bdd3b71..5d996dae 100644 --- a/bootstrap/unix-44/extTools.h +++ b/bootstrap/unix-44/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/unix-44/vt100.c b/bootstrap/unix-44/vt100.c index 2e236578..8a5286ec 100644 --- a/bootstrap/unix-44/vt100.c +++ b/bootstrap/unix-44/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/vt100.h b/bootstrap/unix-44/vt100.h index 0eae5799..c09b4c71 100644 --- a/bootstrap/unix-44/vt100.h +++ b/bootstrap/unix-44/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef vt100__h #define vt100__h diff --git a/bootstrap/unix-48/Configuration.c b/bootstrap/unix-48/Configuration.c index 5736ed9f..cc4f7969 100644 --- a/bootstrap/unix-48/Configuration.c +++ b/bootstrap/unix-48/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -18,6 +18,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("1.95 [2016/09/11] for gcc LP64 on cygwin", Configuration_versionLong, 41); + __MOVE("1.95 [2016/09/12] for gcc LP64 on cygwin", Configuration_versionLong, 41); __ENDMOD; } diff --git a/bootstrap/unix-48/Configuration.h b/bootstrap/unix-48/Configuration.h index 31877f12..3ce4467e 100644 --- a/bootstrap/unix-48/Configuration.h +++ b/bootstrap/unix-48/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/unix-48/Console.c b/bootstrap/unix-48/Console.c index 6181cbfd..e33f3d7c 100644 --- a/bootstrap/unix-48/Console.c +++ b/bootstrap/unix-48/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -58,7 +58,7 @@ void Console_Int (int32 i, int32 n) { CHAR s[32]; int32 i1, k; - if (i == __LSHL(1, 31, int32)) { + if (i == __LSHL(1, 31, 32)) { __MOVE("8463847412", s, 11); k = 10; } else { diff --git a/bootstrap/unix-48/Console.h b/bootstrap/unix-48/Console.h index 78586a68..c6fe7fc4 100644 --- a/bootstrap/unix-48/Console.h +++ b/bootstrap/unix-48/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/unix-48/Files.c b/bootstrap/unix-48/Files.c index f98f4e55..ebdd14a9 100644 --- a/bootstrap/unix-48/Files.c +++ b/bootstrap/unix-48/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/Files.h b/bootstrap/unix-48/Files.h index de420c7c..42e60467 100644 --- a/bootstrap/unix-48/Files.h +++ b/bootstrap/unix-48/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tspkaSfF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/unix-48/Heap.c b/bootstrap/unix-48/Heap.c index 58be6181..4d96ea89 100644 --- a/bootstrap/unix-48/Heap.c +++ b/bootstrap/unix-48/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tskSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/Heap.h b/bootstrap/unix-48/Heap.h index 827a3a7c..1a6c9e05 100644 --- a/bootstrap/unix-48/Heap.h +++ b/bootstrap/unix-48/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tskSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/unix-48/Modules.c b/bootstrap/unix-48/Modules.c index 66a8c776..9834a814 100644 --- a/bootstrap/unix-48/Modules.c +++ b/bootstrap/unix-48/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/Modules.h b/bootstrap/unix-48/Modules.h index 02abd713..e34e59ed 100644 --- a/bootstrap/unix-48/Modules.h +++ b/bootstrap/unix-48/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/unix-48/OPB.c b/bootstrap/unix-48/OPB.c index 8d44024a..92c0af42 100644 --- a/bootstrap/unix-48/OPB.c +++ b/bootstrap/unix-48/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/OPB.h b/bootstrap/unix-48/OPB.h index 5aaa8469..96866563 100644 --- a/bootstrap/unix-48/OPB.h +++ b/bootstrap/unix-48/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/unix-48/OPC.c b/bootstrap/unix-48/OPC.c index 1122a8d0..452c85d2 100644 --- a/bootstrap/unix-48/OPC.c +++ b/bootstrap/unix-48/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/OPC.h b/bootstrap/unix-48/OPC.h index 1a9ad61f..81e8362d 100644 --- a/bootstrap/unix-48/OPC.h +++ b/bootstrap/unix-48/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/unix-48/OPM.c b/bootstrap/unix-48/OPM.c index e6d709e7..671a9d8f 100644 --- a/bootstrap/unix-48/OPM.c +++ b/bootstrap/unix-48/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -537,7 +537,7 @@ void OPM_err (int16 n) void OPM_FPrint (int32 *fp, int32 val) { - *fp = __ROTL((int32)((SET)*fp ^ (SET)val), 1, int32); + *fp = __ROTL((int32)((SET)*fp ^ (SET)val), 1, 32); } void OPM_FPrintSet (int32 *fp, SET set) @@ -652,7 +652,7 @@ int32 OPM_SignedMaximum (int32 bytecount) int32 _o_result; int32 result; result = 1; - result = __LSH(result, __ASHL(bytecount, 3) - 1, int32); + result = __LSH(result, __ASHL(bytecount, 3) - 1, 32); _o_result = result - 1; return _o_result; } diff --git a/bootstrap/unix-48/OPM.h b/bootstrap/unix-48/OPM.h index c5192f5b..0d9bcdeb 100644 --- a/bootstrap/unix-48/OPM.h +++ b/bootstrap/unix-48/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPM__h #define OPM__h diff --git a/bootstrap/unix-48/OPP.c b/bootstrap/unix-48/OPP.c index 6e2d4cd0..de0afa51 100644 --- a/bootstrap/unix-48/OPP.c +++ b/bootstrap/unix-48/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/OPP.h b/bootstrap/unix-48/OPP.h index de48c5ba..2d3ebd77 100644 --- a/bootstrap/unix-48/OPP.h +++ b/bootstrap/unix-48/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/unix-48/OPS.c b/bootstrap/unix-48/OPS.c index 9b3bf8f0..e6e99c02 100644 --- a/bootstrap/unix-48/OPS.c +++ b/bootstrap/unix-48/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/OPS.h b/bootstrap/unix-48/OPS.h index 8689aa3b..99448598 100644 --- a/bootstrap/unix-48/OPS.h +++ b/bootstrap/unix-48/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tspkaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/unix-48/OPT.c b/bootstrap/unix-48/OPT.c index 0d16f8ec..4a645e7a 100644 --- a/bootstrap/unix-48/OPT.c +++ b/bootstrap/unix-48/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/OPT.h b/bootstrap/unix-48/OPT.h index b9e46b1a..93975ea1 100644 --- a/bootstrap/unix-48/OPT.h +++ b/bootstrap/unix-48/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/unix-48/OPV.c b/bootstrap/unix-48/OPV.c index e36e3be5..b264d44e 100644 --- a/bootstrap/unix-48/OPV.c +++ b/bootstrap/unix-48/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -1039,7 +1039,7 @@ static void OPV_expr (OPT_Node n, int16 prec) } if (__IN(subclass, 0x18000000)) { OPM_WriteString((CHAR*)", ", 3); - OPC_Ident(l->typ->strobj); + OPM_WriteInt(__ASHL(l->typ->size, 3)); } OPM_Write(')'); break; diff --git a/bootstrap/unix-48/OPV.h b/bootstrap/unix-48/OPV.h index c692efd8..3b43e61e 100644 --- a/bootstrap/unix-48/OPV.h +++ b/bootstrap/unix-48/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/unix-48/Platform.c b/bootstrap/unix-48/Platform.c index b8559160..4842a8c4 100644 --- a/bootstrap/unix-48/Platform.c +++ b/bootstrap/unix-48/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/Platform.h b/bootstrap/unix-48/Platform.h index 868c4e52..295013cf 100644 --- a/bootstrap/unix-48/Platform.h +++ b/bootstrap/unix-48/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/unix-48/Reals.c b/bootstrap/unix-48/Reals.c index c9e8e867..e209af08 100644 --- a/bootstrap/unix-48/Reals.c +++ b/bootstrap/unix-48/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/Reals.h b/bootstrap/unix-48/Reals.h index bd36f8d6..2779fc88 100644 --- a/bootstrap/unix-48/Reals.h +++ b/bootstrap/unix-48/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/unix-48/SYSTEM.c b/bootstrap/unix-48/SYSTEM.c deleted file mode 100644 index d7603f8e..00000000 --- a/bootstrap/unix-48/SYSTEM.c +++ /dev/null @@ -1,220 +0,0 @@ -/* -* The body prefix file of the voc(jet backend) runtime system, Version 1.0 -* -* Copyright (c) Software Templ, 1994, 1995 -* -* Module SYSTEM is subject to change any time without prior notification. -* Software Templ disclaims all warranties with regard to module SYSTEM, -* in particular shall Software Templ not be liable for any damage resulting -* from inappropriate use or modification of module SYSTEM. -* -* Version 1.1 jt, 24.11.95 fixes for correct pointer arithmetic on Cray computers -* jt 31.1.2007 ANSI prototypes for malloc and exit in order to avoid cc warnings -* -*/ - -#include "SYSTEM.h" -#include "stdarg.h" -#include - - -// Procedure verions of SYSTEM.H versions used when a multiply accessed -// parameter has side effects. - - - -LONGINT SYSTEM_ABS (LONGINT i) {return __ABS(i);} -double SYSTEM_ABSD(double i) {return __ABS(i);} - - -int64 SYSTEM_DIV(int64 x, int64 y) -{ - if (x == 0) return 0; - if (x >= 0) - if (y >= 0) {return x/y;} - else {return -((x-y-1)/(-y));} - else - if (y >= 0) {return -((y-x-1)/y);} - else {return (-x)/(-y);} -} - -int64 SYSTEM_MOD(int64 x, int64 y) -{ - if (x == 0) return 0; - if (x >= 0) - if (y >= 0) {return x % y;} - else {return (y+1) + ((x-1) % (-y));} - else - if (y >= 0) {return (y-1) - ((-x-1) % y);} - else {return -((-x) % (-y));} -} - - -void SYSTEM_INHERIT(LONGINT *t, LONGINT *t0) -{ - t -= __TPROC0OFF; - t0 -= __TPROC0OFF; - while (*t0 != __EOM) {*t = *t0; t--; t0--;} -} - - -void SYSTEM_ENUMP(void *adr, LONGINT n, void (*P)()) -{ - while (n > 0) { - P((address)(*((void**)(adr)))); - adr = ((void**)adr) + 1; - n--; - } -} - -void SYSTEM_ENUMR(void *adr, LONGINT *typ, LONGINT size, LONGINT n, void (*P)()) -{ - LONGINT *t, off; - typ++; - while (n > 0) { - t = typ; - off = *t; - while (off >= 0) {P(*(address*)((char*)adr+off)); t++; off = *t;} - adr = ((char*)adr) + size; - n--; - } -} - -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; - } -} - -extern void Heap_Lock(); -extern void Heap_Unlock(); - -SYSTEM_PTR SYSTEM_NEWARR(LONGINT *typ, LONGINT elemsz, int elemalgn, int nofdim, int nofdyn, ...) -{ - LONGINT nofelems, size, dataoff, n, nptr, *x, *p, nofptrs, i, *ptab, off; - va_list ap; - va_start(ap, nofdyn); - nofelems = 1; - while (nofdim > 0) { - nofelems = nofelems * va_arg(ap, LONGINT); nofdim--; - if (nofelems <= 0) __HALT(-20); - } - va_end(ap); - dataoff = nofdyn * sizeof(LONGINT); - if (elemalgn > sizeof(LONGINT)) { - n = dataoff % elemalgn; - if (n != 0) dataoff += elemalgn - n; - } - size = dataoff + nofelems * elemsz; - Heap_Lock(); - if (typ == NIL) { - /* element typ does not contain pointers */ - x = Heap_NEWBLK(size); - } - else if (typ == (LONGINT*)POINTER__typ) { - /* element type is a pointer */ - x = Heap_NEWBLK(size + nofelems * sizeof(LONGINT)); - p = (LONGINT*)(address)x[-1]; - p[-nofelems] = *p; /* build new type desc in situ: 1. copy block size; 2. setup ptr tab; 3. set sentinel; 4. patch tag */ - p -= nofelems - 1; n = 1; /* n =1 for skipping the size field */ - while (n <= nofelems) {*p = n*sizeof(LONGINT); p++; n++;} - *p = - (nofelems + 1) * sizeof(LONGINT); /* sentinel */ - x[-1] -= nofelems * sizeof(LONGINT); - } - else { - /* element type is a record that contains pointers */ - ptab = typ + 1; nofptrs = 0; - while (ptab[nofptrs] >= 0) {nofptrs++;} /* number of pointers per element */ - nptr = nofelems * nofptrs; /* total number of pointers */ - x = Heap_NEWBLK(size + nptr * sizeof(LONGINT)); - p = (LONGINT*)(address)x[- 1]; - p[-nptr] = *p; /* build new type desc in situ; 1. copy block size; 2. setup ptr tab; 3. set sentinel; 4. patch tag */ - p -= nptr - 1; n = 0; off = dataoff; - while (n < nofelems) {i = 0; - while (i < nofptrs) {*p = off + ptab[i]; p++; i++;} - off += elemsz; n++; - } - *p = - (nptr + 1) * sizeof(LONGINT); /* sentinel */ - x[-1] -= nptr * sizeof(LONGINT); - } - if (nofdyn != 0) { - /* setup len vector for index checks */ - va_start(ap, nofdyn); - p = x; - while (nofdyn > 0) {*p = va_arg(ap, LONGINT); p++, nofdyn--;} - va_end(ap); - } - Heap_Unlock(); - return x; -} - - - - -typedef void (*SystemSignalHandler)(INTEGER); // = Platform_SignalHandler - -#ifndef _WIN32 - - SystemSignalHandler handler[3] = {0}; - - // Provide signal handling for Unix based systems - void signalHandler(int s) { - if (s >= 2 && s <= 4) handler[s-2](s); - // (Ignore other signals) - } - - void SystemSetHandler(int s, address h) { - if (s >= 2 && s <= 4) { - int needtosetsystemhandler = handler[s-2] == 0; - handler[s-2] = (SystemSignalHandler)h; - if (needtosetsystemhandler) {signal(s, signalHandler);} - } - } - -#else - - // Provides Windows callback handlers for signal-like scenarios - #include "WindowsWrapper.h" - - SystemSignalHandler SystemInterruptHandler = 0; - SystemSignalHandler SystemQuitHandler = 0; - BOOL ConsoleCtrlHandlerSet = FALSE; - - BOOL WINAPI SystemConsoleCtrlHandler(DWORD ctrlType) { - if ((ctrlType == CTRL_C_EVENT) || (ctrlType == CTRL_BREAK_EVENT)) { - if (SystemInterruptHandler) { - SystemInterruptHandler(2); // SIGINT - return TRUE; - } - } else { // Close, logoff or shutdown - if (SystemQuitHandler) { - SystemQuitHandler(3); // SIGQUIT - return TRUE; - } - } - return FALSE; - } - - void EnsureConsoleCtrlHandler() { - if (!ConsoleCtrlHandlerSet) { - SetConsoleCtrlHandler(SystemConsoleCtrlHandler, TRUE); - ConsoleCtrlHandlerSet = TRUE; - } - } - - void SystemSetInterruptHandler(address h) { - EnsureConsoleCtrlHandler(); - SystemInterruptHandler = (SystemSignalHandler)h; - } - - void SystemSetQuitHandler(address h) { - EnsureConsoleCtrlHandler(); - SystemQuitHandler = (SystemSignalHandler)h; - } - -#endif diff --git a/bootstrap/unix-48/SYSTEM.h b/bootstrap/unix-48/SYSTEM.h deleted file mode 100644 index 168b0beb..00000000 --- a/bootstrap/unix-48/SYSTEM.h +++ /dev/null @@ -1,340 +0,0 @@ -#ifndef SYSTEM__h -#define SYSTEM__h - - -// 64 bit system detection - -#if (__SIZEOF_POINTER__ == 8) || defined (_LP64) || defined(__LP64__) || defined(_WIN64) - #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 - - - - - -// Declare memcpy in a way compatible with C compilers intrinsic -// built in implementations. - -#if defined (__o_64) - #if defined(_WIN64) - typedef unsigned long long size_t; -// typedef long long address; - #else - typedef unsigned long size_t; -// typedef long address; - #endif -#else - typedef unsigned int size_t; -//typedef int address; -#endif - -#define _SIZE_T_DECLARED // For FreeBSD -#define _SIZE_T_DEFINED_ // For OpenBSD - -void *memcpy(void *dest, const void *source, size_t size); - - -// Declare fixed size versions of basic intger types - -#if defined (__o_64) && !defined(_WIN64) - // LP64 - typedef long int64; - typedef unsigned long uint64; -#else - // ILP32 or LLP64 - typedef long long int64; - typedef unsigned long long uint64; -#endif - -typedef int int32; -typedef unsigned int uint32; - -typedef short int int16; -typedef unsigned short int uint16; - -typedef signed char int8; -typedef unsigned char uint8; - - -// 'address' is a synonym for an int32 of pointer size - -#if defined (__o_64) - #define address int64 -#else - #define address int32 -#endif - -// The compiler uses 'import' and 'export' which translate to 'extern' and -// nothing respectively. - -#define import extern -#define export - - - -// Known constants - -#define NIL ((void*)0) -#define __MAXEXT 16 -#define POINTER__typ ((address*)(1)) // not NIL and not a valid type - - -// Oberon types - -typedef int8 BOOLEAN; -typedef int8 SYSTEM_BYTE; -typedef uint8 uSYSTEM_BYTE; -typedef uint8 CHAR; -typedef uint8 uCHAR; -typedef float REAL; -typedef double LONGREAL; -typedef void* SYSTEM_PTR; - -#define uSET SET - - - - -// ---------------------------------------------------------------------- -// ---------------------------------------------------------------------- - - - -// OS Memory allocation interfaces are in PlatformXXX.Mod - -extern address Platform_OSAllocate (address size); -extern void Platform_OSFree (address addr); - - -// Assertions and Halts - -extern void Platform_Halt(LONGINT x); -extern void Platform_AssertFail(LONGINT x); - -#define __HALT(x) Platform_Halt(x) -#define __ASSERT(cond, x) if (!(cond)) Platform_AssertFail((LONGINT)(x)) - - -// Index checking - -static inline int64 __XF(uint64 i, uint64 ub) {if (i >= ub) {__HALT(-2);} return i;} -#define __X(i, ub) (((uint64)(i)<(uint64)(ub))?i:(__HALT(-2),0)) - - -// Range checking, and checked SHORT and CHR functions - -static inline int64 __RF(uint64 i, uint64 ub) {if (i >= ub) {__HALT(-8);} return i;} -#define __R(i, ub) (((uint64)(i)<(uint64)(ub))?i:(__HALT(-8),0)) -#define __SHORT(x, ub) ((int)((uLONGINT)(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)) - - - -// Run time system routines in SYSTEM.c - - -extern LONGINT SYSTEM_ABS (LONGINT i); -extern double SYSTEM_ABSD (double i); -extern void SYSTEM_INHERIT(LONGINT *t, LONGINT *t0); -extern void SYSTEM_ENUMP (void *adr, LONGINT n, void (*P)()); -extern void SYSTEM_ENUMR (void *adr, LONGINT *typ, LONGINT size, LONGINT n, void (*P)()); -extern LONGINT SYSTEM_ENTIER (double x); - - -// Signal handling in SYSTEM.c - -#ifndef _WIN32 - extern void SystemSetHandler(int s, address h); -#else - extern void SystemSetInterruptHandler(address h); - extern void SystemSetQuitHandler (address h); -#endif - - - -// String comparison - -static inline int __str_cmp(CHAR *x, CHAR *y){ - LONGINT i = 0; - CHAR ch1, ch2; - do {ch1 = x[i]; ch2 = y[i]; i++; - if (!ch1) return -(int)ch2; - } while (ch1==ch2); - return (int)ch1 - (int)ch2; -} -#define __STRCMP(a,b) __str_cmp((CHAR*)(a), (CHAR*)(b)) - - - -// Inline string, record and array copy - -#define __COPY(s, d, n) {char*_a=(void*)s,*_b=(void*)d; LONGINT _i=0,_t=n-1; \ - while(_i<_t&&((_b[_i]=_a[_i])!=0)){_i++;};_b[_i]=0;} -#define __DUP(x, l, t) x=(void*)memcpy((void*)Platform_OSAllocate(l*sizeof(t)),x,l*sizeof(t)) -#define __DUPARR(v, t) v=(void*)memcpy(v##__copy,v,sizeof(t)) -#define __DEL(x) Platform_OSFree((address)x) - - -/* SYSTEM ops */ - -#define __VAL(t, x) (*(t*)&(x)) - - -#define __GET(a, x, t) x=*(t*)(address)(a) -#define __PUT(a, x, t) *(t*)(address)(a)=x - -#define __LSHL(x, n, t) ((t)((u##t)(x)<<(n))) -#define __LSHR(x, n, t) ((t)((u##t)(x)>>(n))) -#define __LSH(x, n, t) ((n)>=0? __LSHL(x, n, t): __LSHR(x, -(n), t)) - -#define __ROTL(x, n, t) ((t)((u##t)(x)<<(n)|(u##t)(x)>>(8*sizeof(t)-(n)))) -#define __ROTR(x, n, t) ((t)((u##t)(x)>>(n)|(u##t)(x)<<(8*sizeof(t)-(n)))) -#define __ROT(x, n, t) ((n)>=0? __ROTL(x, n, t): __ROTR(x, -(n), t)) - -#define __ASHL(x, n) ((int64)(x)<<(n)) -#define __ASHR(x, n) ((int64)(x)>>(n)) -#define __ASH(x, n) ((n)>=0?__ASHL(x,n):__ASHR(x,-(n))) -static inline int64 SYSTEM_ASH(int64 x, int64 n) {return __ASH(x,n);} -#define __ASHF(x, n) SYSTEM_ASH((int64)(x), (int64)(n)) - -#define __BIT(x, n) (*(uint64*)(x)>>(n)&1) -#define __MOVE(s, d, n) memcpy((char*)(address)(d),(char*)(address)(s),n) - - -extern int64 SYSTEM_DIV(int64 x, int64 y); -#define __DIVF(x, y) SYSTEM_DIV(x, y) -#define __DIV(x, y) (((x)>0 && (y)>0) ? (x)/(y) : __DIVF(x, y)) - - -extern int64 SYSTEM_MOD(int64 x, int64 y); -#define __MODF(x, y) SYSTEM_MOD(x, y) -#define __MOD(x, y) (((x)>0 && (y)>0) ? (x)%(y) : __MODF(x, y)) - - - -#define __ENTIER(x) SYSTEM_ENTIER(x) -#define __ABS(x) (((x)<0)?-(x):(x)) -#define __ABSF(x) SYSTEM_ABS((LONGINT)(x)) -#define __ABSFD(x) SYSTEM_ABSD((double)(x)) -#define __CAP(ch) ((CHAR)((ch)&0x5f)) -#define __ODD(x) ((x)&1) -#define __IN(x, s) ((x)>=0 && (x)<(8*sizeof(SET)) && ((((uSET)(s))>>(x))&1)) -#define __SETOF(x) ((SET)1<<(x)) -#define __SETRNG(l, h) ((~(SET)0<<(l))&~(SET)0>>(8*sizeof(SET)-1-(h))) -#define __MASK(x, m) ((x)&~(m)) - - - -// Runtime checks - -#define __RETCHK __retchk: __HALT(-3); return 0; -#define __CASECHK __HALT(-4) -#define __WITHCHK __HALT(-7) - -#define __GUARDP(p, typ, level) ((typ*)(__ISP(p,typ,level)?p:(__HALT(-5),p))) -#define __GUARDR(r, typ, level) (*((typ*)(__IS(r##__typ,typ,level)?r:(__HALT(-5),r)))) -#define __GUARDA(p, typ, level) ((struct typ*)(__IS(__TYPEOF(p),typ,level)?p:(__HALT(-5),p))) -#define __GUARDEQR(p, dyntyp, typ) if(dyntyp!=typ##__typ) __HALT(-6);*(p) -#define __GUARDEQP(p, typ) if(__TYPEOF(p)!=typ##__typ)__HALT(-6);*(p) - - - -// Module entry/registration/exit - -extern void Heap_REGCMD(); -extern SYSTEM_PTR Heap_REGMOD(); -extern void Heap_REGTYP(); -extern void Heap_INCREF(); - -#define __DEFMOD static void *m; if (m!=0) {return m;} -#define __REGCMD(name, cmd) Heap_REGCMD(m, (CHAR*)name, cmd) -#define __REGMOD(name, enum) if (m==0) {m = Heap_REGMOD((CHAR*)name,enum);} -#define __ENDMOD return m -#define __MODULE_IMPORT(name) Heap_INCREF(name##__init()) - - - -// Main module initialisation, registration and finalisation - -extern void Platform_Init(INTEGER argc, address argv); -extern void Heap_FINALL(); - -#define __INIT(argc, argv) static void *m; Platform_Init((INTEGER)argc, (address)&argv); -#define __REGMAIN(name, enum) m = Heap_REGMOD((CHAR*)name,enum) -#define __FINI Heap_FINALL(); return 0 - - -// Memory allocation - -extern SYSTEM_PTR Heap_NEWBLK (address size); -extern SYSTEM_PTR Heap_NEWREC (address tag); -extern SYSTEM_PTR SYSTEM_NEWARR(LONGINT*, LONGINT, int, int, int, ...); - -#define __SYSNEW(p, len) p = Heap_NEWBLK((LONGINT)(len)) -#define __NEW(p, t) p = Heap_NEWREC((LONGINT)(address)t##__typ) -#define __NEWARR SYSTEM_NEWARR - - - -/* Type handling */ - -#define __TDESC(t, m, n) \ - static struct t##__desc { \ - LONGINT tproc[m]; /* Proc for each ptr field */ \ - LONGINT tag; \ - LONGINT next; /* Module table type list points here */ \ - LONGINT level; \ - LONGINT module; \ - char name[24]; \ - LONGINT basep[__MAXEXT]; /* List of bases this extends */ \ - LONGINT reserved; \ - LONGINT blksz; /* xxx_typ points here */ \ - LONGINT ptr[n+1]; /* Offsets of ptrs up to -ve sentinel */ \ - } t##__desc - -#define __BASEOFF (__MAXEXT+1) // blksz as index to base. -#define __TPROC0OFF (__BASEOFF+24/sizeof(LONGINT)+5) // blksz as index to tproc IFF m=1. -#define __EOM 1 -#define __TDFLDS(name, size) {__EOM}, 1, 0, 0, 0, name, {0}, 0, size -#define __ENUMP(adr, n, P) SYSTEM_ENUMP(adr, (LONGINT)(n), P) -#define __ENUMR(adr, typ, size, n, P) SYSTEM_ENUMR(adr, typ, (LONGINT)(size), (LONGINT)(n), P) - -#define __INITYP(t, t0, level) \ - t##__typ = (LONGINT*)&t##__desc.blksz; \ - memcpy(t##__desc.basep, t0##__typ - __BASEOFF, level*sizeof(LONGINT)); \ - t##__desc.basep[level] = (LONGINT)(address)t##__typ; \ - t##__desc.module = (LONGINT)(address)m; \ - if(t##__desc.blksz!=sizeof(struct t)) __HALT(-15); \ - t##__desc.blksz = (t##__desc.blksz+5*sizeof(LONGINT)-1)/(4*sizeof(LONGINT))*(4*sizeof(LONGINT)); \ - Heap_REGTYP(m, (LONGINT)(address)&t##__desc.next); \ - SYSTEM_INHERIT(t##__typ, t0##__typ) - -#define __IS(tag, typ, level) (*(tag-(__BASEOFF-level))==(LONGINT)(address)typ##__typ) -#define __TYPEOF(p) ((LONGINT*)(address)(*(((LONGINT*)(p))-1))) -#define __ISP(p, typ, level) __IS(__TYPEOF(p),typ,level) - -// Oberon-2 type bound procedures support -#define __INITBP(t, proc, num) *(t##__typ-(__TPROC0OFF+num))=(LONGINT)(address)proc -#define __SEND(typ, num, funtyp, parlist) ((funtyp)((address)*(typ-(__TPROC0OFF+num))))parlist - - - - -#endif diff --git a/bootstrap/unix-48/Strings.c b/bootstrap/unix-48/Strings.c index af7a679b..387345ab 100644 --- a/bootstrap/unix-48/Strings.c +++ b/bootstrap/unix-48/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/Strings.h b/bootstrap/unix-48/Strings.h index d145001a..fe90bd09 100644 --- a/bootstrap/unix-48/Strings.h +++ b/bootstrap/unix-48/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/unix-48/Texts.c b/bootstrap/unix-48/Texts.c index c40b975f..c37a4a2c 100644 --- a/bootstrap/unix-48/Texts.c +++ b/bootstrap/unix-48/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/Texts.h b/bootstrap/unix-48/Texts.h index 0aac4cc8..c6ee484f 100644 --- a/bootstrap/unix-48/Texts.h +++ b/bootstrap/unix-48/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/unix-48/Vishap.c b/bootstrap/unix-48/Vishap.c index b289dfa6..fb1c1662 100644 --- a/bootstrap/unix-48/Vishap.c +++ b/bootstrap/unix-48/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkamSf */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/WindowsWrapper.h b/bootstrap/unix-48/WindowsWrapper.h deleted file mode 100644 index b72c815a..00000000 --- a/bootstrap/unix-48/WindowsWrapper.h +++ /dev/null @@ -1,10 +0,0 @@ -// WindowsWrapper.h -// -// Includes Windows.h while avoiding conflicts with Oberon types. - - -#define BOOLEAN _BOOLEAN -#define CHAR _CHAR -#include -#undef BOOLEAN -#undef CHAR diff --git a/bootstrap/unix-48/errors.c b/bootstrap/unix-48/errors.c index 76fa35bf..7feed8e7 100644 --- a/bootstrap/unix-48/errors.c +++ b/bootstrap/unix-48/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/errors.h b/bootstrap/unix-48/errors.h index 9d5bbe45..4fe434e1 100644 --- a/bootstrap/unix-48/errors.h +++ b/bootstrap/unix-48/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/unix-48/extTools.c b/bootstrap/unix-48/extTools.c index 3dbc28ba..0afff1f0 100644 --- a/bootstrap/unix-48/extTools.c +++ b/bootstrap/unix-48/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/extTools.h b/bootstrap/unix-48/extTools.h index 8bdd3b71..5d996dae 100644 --- a/bootstrap/unix-48/extTools.h +++ b/bootstrap/unix-48/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/unix-48/vt100.c b/bootstrap/unix-48/vt100.c index 2e236578..8a5286ec 100644 --- a/bootstrap/unix-48/vt100.c +++ b/bootstrap/unix-48/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/vt100.h b/bootstrap/unix-48/vt100.h index 0eae5799..c09b4c71 100644 --- a/bootstrap/unix-48/vt100.h +++ b/bootstrap/unix-48/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef vt100__h #define vt100__h diff --git a/bootstrap/unix-88/Configuration.c b/bootstrap/unix-88/Configuration.c index b5ee44a5..b023c21b 100644 --- a/bootstrap/unix-88/Configuration.c +++ b/bootstrap/unix-88/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 @@ -18,6 +18,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("1.95 [2016/09/11] for gcc LP64 on cygwin", Configuration_versionLong, 41); + __MOVE("1.95 [2016/09/12] for gcc LP64 on cygwin", Configuration_versionLong, 41); __ENDMOD; } diff --git a/bootstrap/unix-88/Configuration.h b/bootstrap/unix-88/Configuration.h index 31877f12..3ce4467e 100644 --- a/bootstrap/unix-88/Configuration.h +++ b/bootstrap/unix-88/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/unix-88/Console.c b/bootstrap/unix-88/Console.c index 74de0b0a..3677dd09 100644 --- a/bootstrap/unix-88/Console.c +++ b/bootstrap/unix-88/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 @@ -58,7 +58,7 @@ void Console_Int (int64 i, int64 n) { CHAR s[32]; int64 i1, k; - if (i == __LSHL(1, 63, int64)) { + if (i == __LSHL(1, 63, 64)) { __MOVE("8085774586302733229", s, 20); k = 19; } else { diff --git a/bootstrap/unix-88/Console.h b/bootstrap/unix-88/Console.h index 1d06d0fe..27d906ad 100644 --- a/bootstrap/unix-88/Console.h +++ b/bootstrap/unix-88/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/unix-88/Files.c b/bootstrap/unix-88/Files.c index aabcb14d..acdf5f8a 100644 --- a/bootstrap/unix-88/Files.c +++ b/bootstrap/unix-88/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/Files.h b/bootstrap/unix-88/Files.h index 054cde33..7fb2cb03 100644 --- a/bootstrap/unix-88/Files.h +++ b/bootstrap/unix-88/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tspkaSfF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/unix-88/Heap.c b/bootstrap/unix-88/Heap.c index d0175b87..67044d79 100644 --- a/bootstrap/unix-88/Heap.c +++ b/bootstrap/unix-88/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tskSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/Heap.h b/bootstrap/unix-88/Heap.h index fabb54ef..584661bc 100644 --- a/bootstrap/unix-88/Heap.h +++ b/bootstrap/unix-88/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tskSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/unix-88/Modules.c b/bootstrap/unix-88/Modules.c index 53bf2640..547909bb 100644 --- a/bootstrap/unix-88/Modules.c +++ b/bootstrap/unix-88/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/Modules.h b/bootstrap/unix-88/Modules.h index 8e54ce53..2666971d 100644 --- a/bootstrap/unix-88/Modules.h +++ b/bootstrap/unix-88/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/unix-88/OPB.c b/bootstrap/unix-88/OPB.c index f22a9ab5..f048dc85 100644 --- a/bootstrap/unix-88/OPB.c +++ b/bootstrap/unix-88/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/OPB.h b/bootstrap/unix-88/OPB.h index aa26ea1c..adefb869 100644 --- a/bootstrap/unix-88/OPB.h +++ b/bootstrap/unix-88/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/unix-88/OPC.c b/bootstrap/unix-88/OPC.c index 8916c00b..aee5581c 100644 --- a/bootstrap/unix-88/OPC.c +++ b/bootstrap/unix-88/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/OPC.h b/bootstrap/unix-88/OPC.h index 71b95812..aba4bdbb 100644 --- a/bootstrap/unix-88/OPC.h +++ b/bootstrap/unix-88/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/unix-88/OPM.c b/bootstrap/unix-88/OPM.c index b15aba16..55420864 100644 --- a/bootstrap/unix-88/OPM.c +++ b/bootstrap/unix-88/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 @@ -537,7 +537,7 @@ void OPM_err (int32 n) void OPM_FPrint (int64 *fp, int64 val) { - *fp = __ROTL((int64)((SET)*fp ^ (SET)val), 1, int64); + *fp = __ROTL((int64)((SET)*fp ^ (SET)val), 1, 64); } void OPM_FPrintSet (int64 *fp, SET set) @@ -650,7 +650,7 @@ int64 OPM_SignedMaximum (int64 bytecount) int64 _o_result; int64 result; result = 1; - result = __LSH(result, __ASHL(bytecount, 3) - 1, int64); + result = __LSH(result, __ASHL(bytecount, 3) - 1, 64); _o_result = result - 1; return _o_result; } diff --git a/bootstrap/unix-88/OPM.h b/bootstrap/unix-88/OPM.h index d23aed25..1e5c3e72 100644 --- a/bootstrap/unix-88/OPM.h +++ b/bootstrap/unix-88/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPM__h #define OPM__h diff --git a/bootstrap/unix-88/OPP.c b/bootstrap/unix-88/OPP.c index 3f77df4f..f175938c 100644 --- a/bootstrap/unix-88/OPP.c +++ b/bootstrap/unix-88/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/OPP.h b/bootstrap/unix-88/OPP.h index de48c5ba..2d3ebd77 100644 --- a/bootstrap/unix-88/OPP.h +++ b/bootstrap/unix-88/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/unix-88/OPS.c b/bootstrap/unix-88/OPS.c index 491faa22..0c36910a 100644 --- a/bootstrap/unix-88/OPS.c +++ b/bootstrap/unix-88/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/OPS.h b/bootstrap/unix-88/OPS.h index 3937b6f6..a16c2ce8 100644 --- a/bootstrap/unix-88/OPS.h +++ b/bootstrap/unix-88/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tspkaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/unix-88/OPT.c b/bootstrap/unix-88/OPT.c index da8bab08..3006ea90 100644 --- a/bootstrap/unix-88/OPT.c +++ b/bootstrap/unix-88/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/OPT.h b/bootstrap/unix-88/OPT.h index 668c3d79..5f466ec4 100644 --- a/bootstrap/unix-88/OPT.h +++ b/bootstrap/unix-88/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/unix-88/OPV.c b/bootstrap/unix-88/OPV.c index 52fc9966..082797f1 100644 --- a/bootstrap/unix-88/OPV.c +++ b/bootstrap/unix-88/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 @@ -1039,7 +1039,7 @@ static void OPV_expr (OPT_Node n, int32 prec) } if (__IN(subclass, 0x18000000)) { OPM_WriteString((CHAR*)", ", 3); - OPC_Ident(l->typ->strobj); + OPM_WriteInt(__ASHL(l->typ->size, 3)); } OPM_Write(')'); break; diff --git a/bootstrap/unix-88/OPV.h b/bootstrap/unix-88/OPV.h index c692efd8..3b43e61e 100644 --- a/bootstrap/unix-88/OPV.h +++ b/bootstrap/unix-88/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/unix-88/Platform.c b/bootstrap/unix-88/Platform.c index 9142bf02..cf8dfa9f 100644 --- a/bootstrap/unix-88/Platform.c +++ b/bootstrap/unix-88/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/Platform.h b/bootstrap/unix-88/Platform.h index e52525fd..708e58d7 100644 --- a/bootstrap/unix-88/Platform.h +++ b/bootstrap/unix-88/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/unix-88/Reals.c b/bootstrap/unix-88/Reals.c index 185aec0b..2a753b7a 100644 --- a/bootstrap/unix-88/Reals.c +++ b/bootstrap/unix-88/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/Reals.h b/bootstrap/unix-88/Reals.h index a2fc2612..c3cac05a 100644 --- a/bootstrap/unix-88/Reals.h +++ b/bootstrap/unix-88/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/unix-88/SYSTEM.c b/bootstrap/unix-88/SYSTEM.c deleted file mode 100644 index d7603f8e..00000000 --- a/bootstrap/unix-88/SYSTEM.c +++ /dev/null @@ -1,220 +0,0 @@ -/* -* The body prefix file of the voc(jet backend) runtime system, Version 1.0 -* -* Copyright (c) Software Templ, 1994, 1995 -* -* Module SYSTEM is subject to change any time without prior notification. -* Software Templ disclaims all warranties with regard to module SYSTEM, -* in particular shall Software Templ not be liable for any damage resulting -* from inappropriate use or modification of module SYSTEM. -* -* Version 1.1 jt, 24.11.95 fixes for correct pointer arithmetic on Cray computers -* jt 31.1.2007 ANSI prototypes for malloc and exit in order to avoid cc warnings -* -*/ - -#include "SYSTEM.h" -#include "stdarg.h" -#include - - -// Procedure verions of SYSTEM.H versions used when a multiply accessed -// parameter has side effects. - - - -LONGINT SYSTEM_ABS (LONGINT i) {return __ABS(i);} -double SYSTEM_ABSD(double i) {return __ABS(i);} - - -int64 SYSTEM_DIV(int64 x, int64 y) -{ - if (x == 0) return 0; - if (x >= 0) - if (y >= 0) {return x/y;} - else {return -((x-y-1)/(-y));} - else - if (y >= 0) {return -((y-x-1)/y);} - else {return (-x)/(-y);} -} - -int64 SYSTEM_MOD(int64 x, int64 y) -{ - if (x == 0) return 0; - if (x >= 0) - if (y >= 0) {return x % y;} - else {return (y+1) + ((x-1) % (-y));} - else - if (y >= 0) {return (y-1) - ((-x-1) % y);} - else {return -((-x) % (-y));} -} - - -void SYSTEM_INHERIT(LONGINT *t, LONGINT *t0) -{ - t -= __TPROC0OFF; - t0 -= __TPROC0OFF; - while (*t0 != __EOM) {*t = *t0; t--; t0--;} -} - - -void SYSTEM_ENUMP(void *adr, LONGINT n, void (*P)()) -{ - while (n > 0) { - P((address)(*((void**)(adr)))); - adr = ((void**)adr) + 1; - n--; - } -} - -void SYSTEM_ENUMR(void *adr, LONGINT *typ, LONGINT size, LONGINT n, void (*P)()) -{ - LONGINT *t, off; - typ++; - while (n > 0) { - t = typ; - off = *t; - while (off >= 0) {P(*(address*)((char*)adr+off)); t++; off = *t;} - adr = ((char*)adr) + size; - n--; - } -} - -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; - } -} - -extern void Heap_Lock(); -extern void Heap_Unlock(); - -SYSTEM_PTR SYSTEM_NEWARR(LONGINT *typ, LONGINT elemsz, int elemalgn, int nofdim, int nofdyn, ...) -{ - LONGINT nofelems, size, dataoff, n, nptr, *x, *p, nofptrs, i, *ptab, off; - va_list ap; - va_start(ap, nofdyn); - nofelems = 1; - while (nofdim > 0) { - nofelems = nofelems * va_arg(ap, LONGINT); nofdim--; - if (nofelems <= 0) __HALT(-20); - } - va_end(ap); - dataoff = nofdyn * sizeof(LONGINT); - if (elemalgn > sizeof(LONGINT)) { - n = dataoff % elemalgn; - if (n != 0) dataoff += elemalgn - n; - } - size = dataoff + nofelems * elemsz; - Heap_Lock(); - if (typ == NIL) { - /* element typ does not contain pointers */ - x = Heap_NEWBLK(size); - } - else if (typ == (LONGINT*)POINTER__typ) { - /* element type is a pointer */ - x = Heap_NEWBLK(size + nofelems * sizeof(LONGINT)); - p = (LONGINT*)(address)x[-1]; - p[-nofelems] = *p; /* build new type desc in situ: 1. copy block size; 2. setup ptr tab; 3. set sentinel; 4. patch tag */ - p -= nofelems - 1; n = 1; /* n =1 for skipping the size field */ - while (n <= nofelems) {*p = n*sizeof(LONGINT); p++; n++;} - *p = - (nofelems + 1) * sizeof(LONGINT); /* sentinel */ - x[-1] -= nofelems * sizeof(LONGINT); - } - else { - /* element type is a record that contains pointers */ - ptab = typ + 1; nofptrs = 0; - while (ptab[nofptrs] >= 0) {nofptrs++;} /* number of pointers per element */ - nptr = nofelems * nofptrs; /* total number of pointers */ - x = Heap_NEWBLK(size + nptr * sizeof(LONGINT)); - p = (LONGINT*)(address)x[- 1]; - p[-nptr] = *p; /* build new type desc in situ; 1. copy block size; 2. setup ptr tab; 3. set sentinel; 4. patch tag */ - p -= nptr - 1; n = 0; off = dataoff; - while (n < nofelems) {i = 0; - while (i < nofptrs) {*p = off + ptab[i]; p++; i++;} - off += elemsz; n++; - } - *p = - (nptr + 1) * sizeof(LONGINT); /* sentinel */ - x[-1] -= nptr * sizeof(LONGINT); - } - if (nofdyn != 0) { - /* setup len vector for index checks */ - va_start(ap, nofdyn); - p = x; - while (nofdyn > 0) {*p = va_arg(ap, LONGINT); p++, nofdyn--;} - va_end(ap); - } - Heap_Unlock(); - return x; -} - - - - -typedef void (*SystemSignalHandler)(INTEGER); // = Platform_SignalHandler - -#ifndef _WIN32 - - SystemSignalHandler handler[3] = {0}; - - // Provide signal handling for Unix based systems - void signalHandler(int s) { - if (s >= 2 && s <= 4) handler[s-2](s); - // (Ignore other signals) - } - - void SystemSetHandler(int s, address h) { - if (s >= 2 && s <= 4) { - int needtosetsystemhandler = handler[s-2] == 0; - handler[s-2] = (SystemSignalHandler)h; - if (needtosetsystemhandler) {signal(s, signalHandler);} - } - } - -#else - - // Provides Windows callback handlers for signal-like scenarios - #include "WindowsWrapper.h" - - SystemSignalHandler SystemInterruptHandler = 0; - SystemSignalHandler SystemQuitHandler = 0; - BOOL ConsoleCtrlHandlerSet = FALSE; - - BOOL WINAPI SystemConsoleCtrlHandler(DWORD ctrlType) { - if ((ctrlType == CTRL_C_EVENT) || (ctrlType == CTRL_BREAK_EVENT)) { - if (SystemInterruptHandler) { - SystemInterruptHandler(2); // SIGINT - return TRUE; - } - } else { // Close, logoff or shutdown - if (SystemQuitHandler) { - SystemQuitHandler(3); // SIGQUIT - return TRUE; - } - } - return FALSE; - } - - void EnsureConsoleCtrlHandler() { - if (!ConsoleCtrlHandlerSet) { - SetConsoleCtrlHandler(SystemConsoleCtrlHandler, TRUE); - ConsoleCtrlHandlerSet = TRUE; - } - } - - void SystemSetInterruptHandler(address h) { - EnsureConsoleCtrlHandler(); - SystemInterruptHandler = (SystemSignalHandler)h; - } - - void SystemSetQuitHandler(address h) { - EnsureConsoleCtrlHandler(); - SystemQuitHandler = (SystemSignalHandler)h; - } - -#endif diff --git a/bootstrap/unix-88/SYSTEM.h b/bootstrap/unix-88/SYSTEM.h deleted file mode 100644 index 168b0beb..00000000 --- a/bootstrap/unix-88/SYSTEM.h +++ /dev/null @@ -1,340 +0,0 @@ -#ifndef SYSTEM__h -#define SYSTEM__h - - -// 64 bit system detection - -#if (__SIZEOF_POINTER__ == 8) || defined (_LP64) || defined(__LP64__) || defined(_WIN64) - #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 - - - - - -// Declare memcpy in a way compatible with C compilers intrinsic -// built in implementations. - -#if defined (__o_64) - #if defined(_WIN64) - typedef unsigned long long size_t; -// typedef long long address; - #else - typedef unsigned long size_t; -// typedef long address; - #endif -#else - typedef unsigned int size_t; -//typedef int address; -#endif - -#define _SIZE_T_DECLARED // For FreeBSD -#define _SIZE_T_DEFINED_ // For OpenBSD - -void *memcpy(void *dest, const void *source, size_t size); - - -// Declare fixed size versions of basic intger types - -#if defined (__o_64) && !defined(_WIN64) - // LP64 - typedef long int64; - typedef unsigned long uint64; -#else - // ILP32 or LLP64 - typedef long long int64; - typedef unsigned long long uint64; -#endif - -typedef int int32; -typedef unsigned int uint32; - -typedef short int int16; -typedef unsigned short int uint16; - -typedef signed char int8; -typedef unsigned char uint8; - - -// 'address' is a synonym for an int32 of pointer size - -#if defined (__o_64) - #define address int64 -#else - #define address int32 -#endif - -// The compiler uses 'import' and 'export' which translate to 'extern' and -// nothing respectively. - -#define import extern -#define export - - - -// Known constants - -#define NIL ((void*)0) -#define __MAXEXT 16 -#define POINTER__typ ((address*)(1)) // not NIL and not a valid type - - -// Oberon types - -typedef int8 BOOLEAN; -typedef int8 SYSTEM_BYTE; -typedef uint8 uSYSTEM_BYTE; -typedef uint8 CHAR; -typedef uint8 uCHAR; -typedef float REAL; -typedef double LONGREAL; -typedef void* SYSTEM_PTR; - -#define uSET SET - - - - -// ---------------------------------------------------------------------- -// ---------------------------------------------------------------------- - - - -// OS Memory allocation interfaces are in PlatformXXX.Mod - -extern address Platform_OSAllocate (address size); -extern void Platform_OSFree (address addr); - - -// Assertions and Halts - -extern void Platform_Halt(LONGINT x); -extern void Platform_AssertFail(LONGINT x); - -#define __HALT(x) Platform_Halt(x) -#define __ASSERT(cond, x) if (!(cond)) Platform_AssertFail((LONGINT)(x)) - - -// Index checking - -static inline int64 __XF(uint64 i, uint64 ub) {if (i >= ub) {__HALT(-2);} return i;} -#define __X(i, ub) (((uint64)(i)<(uint64)(ub))?i:(__HALT(-2),0)) - - -// Range checking, and checked SHORT and CHR functions - -static inline int64 __RF(uint64 i, uint64 ub) {if (i >= ub) {__HALT(-8);} return i;} -#define __R(i, ub) (((uint64)(i)<(uint64)(ub))?i:(__HALT(-8),0)) -#define __SHORT(x, ub) ((int)((uLONGINT)(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)) - - - -// Run time system routines in SYSTEM.c - - -extern LONGINT SYSTEM_ABS (LONGINT i); -extern double SYSTEM_ABSD (double i); -extern void SYSTEM_INHERIT(LONGINT *t, LONGINT *t0); -extern void SYSTEM_ENUMP (void *adr, LONGINT n, void (*P)()); -extern void SYSTEM_ENUMR (void *adr, LONGINT *typ, LONGINT size, LONGINT n, void (*P)()); -extern LONGINT SYSTEM_ENTIER (double x); - - -// Signal handling in SYSTEM.c - -#ifndef _WIN32 - extern void SystemSetHandler(int s, address h); -#else - extern void SystemSetInterruptHandler(address h); - extern void SystemSetQuitHandler (address h); -#endif - - - -// String comparison - -static inline int __str_cmp(CHAR *x, CHAR *y){ - LONGINT i = 0; - CHAR ch1, ch2; - do {ch1 = x[i]; ch2 = y[i]; i++; - if (!ch1) return -(int)ch2; - } while (ch1==ch2); - return (int)ch1 - (int)ch2; -} -#define __STRCMP(a,b) __str_cmp((CHAR*)(a), (CHAR*)(b)) - - - -// Inline string, record and array copy - -#define __COPY(s, d, n) {char*_a=(void*)s,*_b=(void*)d; LONGINT _i=0,_t=n-1; \ - while(_i<_t&&((_b[_i]=_a[_i])!=0)){_i++;};_b[_i]=0;} -#define __DUP(x, l, t) x=(void*)memcpy((void*)Platform_OSAllocate(l*sizeof(t)),x,l*sizeof(t)) -#define __DUPARR(v, t) v=(void*)memcpy(v##__copy,v,sizeof(t)) -#define __DEL(x) Platform_OSFree((address)x) - - -/* SYSTEM ops */ - -#define __VAL(t, x) (*(t*)&(x)) - - -#define __GET(a, x, t) x=*(t*)(address)(a) -#define __PUT(a, x, t) *(t*)(address)(a)=x - -#define __LSHL(x, n, t) ((t)((u##t)(x)<<(n))) -#define __LSHR(x, n, t) ((t)((u##t)(x)>>(n))) -#define __LSH(x, n, t) ((n)>=0? __LSHL(x, n, t): __LSHR(x, -(n), t)) - -#define __ROTL(x, n, t) ((t)((u##t)(x)<<(n)|(u##t)(x)>>(8*sizeof(t)-(n)))) -#define __ROTR(x, n, t) ((t)((u##t)(x)>>(n)|(u##t)(x)<<(8*sizeof(t)-(n)))) -#define __ROT(x, n, t) ((n)>=0? __ROTL(x, n, t): __ROTR(x, -(n), t)) - -#define __ASHL(x, n) ((int64)(x)<<(n)) -#define __ASHR(x, n) ((int64)(x)>>(n)) -#define __ASH(x, n) ((n)>=0?__ASHL(x,n):__ASHR(x,-(n))) -static inline int64 SYSTEM_ASH(int64 x, int64 n) {return __ASH(x,n);} -#define __ASHF(x, n) SYSTEM_ASH((int64)(x), (int64)(n)) - -#define __BIT(x, n) (*(uint64*)(x)>>(n)&1) -#define __MOVE(s, d, n) memcpy((char*)(address)(d),(char*)(address)(s),n) - - -extern int64 SYSTEM_DIV(int64 x, int64 y); -#define __DIVF(x, y) SYSTEM_DIV(x, y) -#define __DIV(x, y) (((x)>0 && (y)>0) ? (x)/(y) : __DIVF(x, y)) - - -extern int64 SYSTEM_MOD(int64 x, int64 y); -#define __MODF(x, y) SYSTEM_MOD(x, y) -#define __MOD(x, y) (((x)>0 && (y)>0) ? (x)%(y) : __MODF(x, y)) - - - -#define __ENTIER(x) SYSTEM_ENTIER(x) -#define __ABS(x) (((x)<0)?-(x):(x)) -#define __ABSF(x) SYSTEM_ABS((LONGINT)(x)) -#define __ABSFD(x) SYSTEM_ABSD((double)(x)) -#define __CAP(ch) ((CHAR)((ch)&0x5f)) -#define __ODD(x) ((x)&1) -#define __IN(x, s) ((x)>=0 && (x)<(8*sizeof(SET)) && ((((uSET)(s))>>(x))&1)) -#define __SETOF(x) ((SET)1<<(x)) -#define __SETRNG(l, h) ((~(SET)0<<(l))&~(SET)0>>(8*sizeof(SET)-1-(h))) -#define __MASK(x, m) ((x)&~(m)) - - - -// Runtime checks - -#define __RETCHK __retchk: __HALT(-3); return 0; -#define __CASECHK __HALT(-4) -#define __WITHCHK __HALT(-7) - -#define __GUARDP(p, typ, level) ((typ*)(__ISP(p,typ,level)?p:(__HALT(-5),p))) -#define __GUARDR(r, typ, level) (*((typ*)(__IS(r##__typ,typ,level)?r:(__HALT(-5),r)))) -#define __GUARDA(p, typ, level) ((struct typ*)(__IS(__TYPEOF(p),typ,level)?p:(__HALT(-5),p))) -#define __GUARDEQR(p, dyntyp, typ) if(dyntyp!=typ##__typ) __HALT(-6);*(p) -#define __GUARDEQP(p, typ) if(__TYPEOF(p)!=typ##__typ)__HALT(-6);*(p) - - - -// Module entry/registration/exit - -extern void Heap_REGCMD(); -extern SYSTEM_PTR Heap_REGMOD(); -extern void Heap_REGTYP(); -extern void Heap_INCREF(); - -#define __DEFMOD static void *m; if (m!=0) {return m;} -#define __REGCMD(name, cmd) Heap_REGCMD(m, (CHAR*)name, cmd) -#define __REGMOD(name, enum) if (m==0) {m = Heap_REGMOD((CHAR*)name,enum);} -#define __ENDMOD return m -#define __MODULE_IMPORT(name) Heap_INCREF(name##__init()) - - - -// Main module initialisation, registration and finalisation - -extern void Platform_Init(INTEGER argc, address argv); -extern void Heap_FINALL(); - -#define __INIT(argc, argv) static void *m; Platform_Init((INTEGER)argc, (address)&argv); -#define __REGMAIN(name, enum) m = Heap_REGMOD((CHAR*)name,enum) -#define __FINI Heap_FINALL(); return 0 - - -// Memory allocation - -extern SYSTEM_PTR Heap_NEWBLK (address size); -extern SYSTEM_PTR Heap_NEWREC (address tag); -extern SYSTEM_PTR SYSTEM_NEWARR(LONGINT*, LONGINT, int, int, int, ...); - -#define __SYSNEW(p, len) p = Heap_NEWBLK((LONGINT)(len)) -#define __NEW(p, t) p = Heap_NEWREC((LONGINT)(address)t##__typ) -#define __NEWARR SYSTEM_NEWARR - - - -/* Type handling */ - -#define __TDESC(t, m, n) \ - static struct t##__desc { \ - LONGINT tproc[m]; /* Proc for each ptr field */ \ - LONGINT tag; \ - LONGINT next; /* Module table type list points here */ \ - LONGINT level; \ - LONGINT module; \ - char name[24]; \ - LONGINT basep[__MAXEXT]; /* List of bases this extends */ \ - LONGINT reserved; \ - LONGINT blksz; /* xxx_typ points here */ \ - LONGINT ptr[n+1]; /* Offsets of ptrs up to -ve sentinel */ \ - } t##__desc - -#define __BASEOFF (__MAXEXT+1) // blksz as index to base. -#define __TPROC0OFF (__BASEOFF+24/sizeof(LONGINT)+5) // blksz as index to tproc IFF m=1. -#define __EOM 1 -#define __TDFLDS(name, size) {__EOM}, 1, 0, 0, 0, name, {0}, 0, size -#define __ENUMP(adr, n, P) SYSTEM_ENUMP(adr, (LONGINT)(n), P) -#define __ENUMR(adr, typ, size, n, P) SYSTEM_ENUMR(adr, typ, (LONGINT)(size), (LONGINT)(n), P) - -#define __INITYP(t, t0, level) \ - t##__typ = (LONGINT*)&t##__desc.blksz; \ - memcpy(t##__desc.basep, t0##__typ - __BASEOFF, level*sizeof(LONGINT)); \ - t##__desc.basep[level] = (LONGINT)(address)t##__typ; \ - t##__desc.module = (LONGINT)(address)m; \ - if(t##__desc.blksz!=sizeof(struct t)) __HALT(-15); \ - t##__desc.blksz = (t##__desc.blksz+5*sizeof(LONGINT)-1)/(4*sizeof(LONGINT))*(4*sizeof(LONGINT)); \ - Heap_REGTYP(m, (LONGINT)(address)&t##__desc.next); \ - SYSTEM_INHERIT(t##__typ, t0##__typ) - -#define __IS(tag, typ, level) (*(tag-(__BASEOFF-level))==(LONGINT)(address)typ##__typ) -#define __TYPEOF(p) ((LONGINT*)(address)(*(((LONGINT*)(p))-1))) -#define __ISP(p, typ, level) __IS(__TYPEOF(p),typ,level) - -// Oberon-2 type bound procedures support -#define __INITBP(t, proc, num) *(t##__typ-(__TPROC0OFF+num))=(LONGINT)(address)proc -#define __SEND(typ, num, funtyp, parlist) ((funtyp)((address)*(typ-(__TPROC0OFF+num))))parlist - - - - -#endif diff --git a/bootstrap/unix-88/Strings.c b/bootstrap/unix-88/Strings.c index d4ecf06e..d8c606d3 100644 --- a/bootstrap/unix-88/Strings.c +++ b/bootstrap/unix-88/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/Strings.h b/bootstrap/unix-88/Strings.h index b664568e..130e1d06 100644 --- a/bootstrap/unix-88/Strings.h +++ b/bootstrap/unix-88/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/unix-88/Texts.c b/bootstrap/unix-88/Texts.c index b3c1a3bf..056c54e0 100644 --- a/bootstrap/unix-88/Texts.c +++ b/bootstrap/unix-88/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/Texts.h b/bootstrap/unix-88/Texts.h index 116ee5e3..1e734f9d 100644 --- a/bootstrap/unix-88/Texts.h +++ b/bootstrap/unix-88/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/unix-88/Vishap.c b/bootstrap/unix-88/Vishap.c index a04ca149..08b89b00 100644 --- a/bootstrap/unix-88/Vishap.c +++ b/bootstrap/unix-88/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkamSf */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/WindowsWrapper.h b/bootstrap/unix-88/WindowsWrapper.h deleted file mode 100644 index b72c815a..00000000 --- a/bootstrap/unix-88/WindowsWrapper.h +++ /dev/null @@ -1,10 +0,0 @@ -// WindowsWrapper.h -// -// Includes Windows.h while avoiding conflicts with Oberon types. - - -#define BOOLEAN _BOOLEAN -#define CHAR _CHAR -#include -#undef BOOLEAN -#undef CHAR diff --git a/bootstrap/unix-88/errors.c b/bootstrap/unix-88/errors.c index 5dba1a33..84d35faf 100644 --- a/bootstrap/unix-88/errors.c +++ b/bootstrap/unix-88/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/errors.h b/bootstrap/unix-88/errors.h index 9d5bbe45..4fe434e1 100644 --- a/bootstrap/unix-88/errors.h +++ b/bootstrap/unix-88/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/unix-88/extTools.c b/bootstrap/unix-88/extTools.c index 1080b9a3..7651bcf8 100644 --- a/bootstrap/unix-88/extTools.c +++ b/bootstrap/unix-88/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/extTools.h b/bootstrap/unix-88/extTools.h index 8bdd3b71..5d996dae 100644 --- a/bootstrap/unix-88/extTools.h +++ b/bootstrap/unix-88/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/unix-88/vt100.c b/bootstrap/unix-88/vt100.c index 3efc2842..b7524886 100644 --- a/bootstrap/unix-88/vt100.c +++ b/bootstrap/unix-88/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/vt100.h b/bootstrap/unix-88/vt100.h index 71738164..ef3afa5a 100644 --- a/bootstrap/unix-88/vt100.h +++ b/bootstrap/unix-88/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef vt100__h #define vt100__h diff --git a/bootstrap/windows-48/Configuration.c b/bootstrap/windows-48/Configuration.c index 5736ed9f..cc4f7969 100644 --- a/bootstrap/windows-48/Configuration.c +++ b/bootstrap/windows-48/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -18,6 +18,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("1.95 [2016/09/11] for gcc LP64 on cygwin", Configuration_versionLong, 41); + __MOVE("1.95 [2016/09/12] for gcc LP64 on cygwin", Configuration_versionLong, 41); __ENDMOD; } diff --git a/bootstrap/windows-48/Configuration.h b/bootstrap/windows-48/Configuration.h index 31877f12..3ce4467e 100644 --- a/bootstrap/windows-48/Configuration.h +++ b/bootstrap/windows-48/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/windows-48/Console.c b/bootstrap/windows-48/Console.c index 111663dc..6ad2295c 100644 --- a/bootstrap/windows-48/Console.c +++ b/bootstrap/windows-48/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -58,7 +58,7 @@ void Console_Int (int32 i, int32 n) { CHAR s[32]; int32 i1, k; - if (i == __LSHL(1, 31, int32)) { + if (i == __LSHL(1, 31, 32)) { __MOVE("8463847412", s, 11); k = 10; } else { diff --git a/bootstrap/windows-48/Console.h b/bootstrap/windows-48/Console.h index 78586a68..c6fe7fc4 100644 --- a/bootstrap/windows-48/Console.h +++ b/bootstrap/windows-48/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/windows-48/Files.c b/bootstrap/windows-48/Files.c index b50a99c2..1e560865 100644 --- a/bootstrap/windows-48/Files.c +++ b/bootstrap/windows-48/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/Files.h b/bootstrap/windows-48/Files.h index 54236cf4..b082c461 100644 --- a/bootstrap/windows-48/Files.h +++ b/bootstrap/windows-48/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tspkaSfF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/windows-48/Heap.c b/bootstrap/windows-48/Heap.c index 58be6181..4d96ea89 100644 --- a/bootstrap/windows-48/Heap.c +++ b/bootstrap/windows-48/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tskSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/Heap.h b/bootstrap/windows-48/Heap.h index 827a3a7c..1a6c9e05 100644 --- a/bootstrap/windows-48/Heap.h +++ b/bootstrap/windows-48/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tskSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/windows-48/Modules.c b/bootstrap/windows-48/Modules.c index 66a8c776..9834a814 100644 --- a/bootstrap/windows-48/Modules.c +++ b/bootstrap/windows-48/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/Modules.h b/bootstrap/windows-48/Modules.h index 02abd713..e34e59ed 100644 --- a/bootstrap/windows-48/Modules.h +++ b/bootstrap/windows-48/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/windows-48/OPB.c b/bootstrap/windows-48/OPB.c index 8d44024a..92c0af42 100644 --- a/bootstrap/windows-48/OPB.c +++ b/bootstrap/windows-48/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/OPB.h b/bootstrap/windows-48/OPB.h index 5aaa8469..96866563 100644 --- a/bootstrap/windows-48/OPB.h +++ b/bootstrap/windows-48/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/windows-48/OPC.c b/bootstrap/windows-48/OPC.c index 1122a8d0..452c85d2 100644 --- a/bootstrap/windows-48/OPC.c +++ b/bootstrap/windows-48/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/OPC.h b/bootstrap/windows-48/OPC.h index 1a9ad61f..81e8362d 100644 --- a/bootstrap/windows-48/OPC.h +++ b/bootstrap/windows-48/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/windows-48/OPM.c b/bootstrap/windows-48/OPM.c index e6d709e7..671a9d8f 100644 --- a/bootstrap/windows-48/OPM.c +++ b/bootstrap/windows-48/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -537,7 +537,7 @@ void OPM_err (int16 n) void OPM_FPrint (int32 *fp, int32 val) { - *fp = __ROTL((int32)((SET)*fp ^ (SET)val), 1, int32); + *fp = __ROTL((int32)((SET)*fp ^ (SET)val), 1, 32); } void OPM_FPrintSet (int32 *fp, SET set) @@ -652,7 +652,7 @@ int32 OPM_SignedMaximum (int32 bytecount) int32 _o_result; int32 result; result = 1; - result = __LSH(result, __ASHL(bytecount, 3) - 1, int32); + result = __LSH(result, __ASHL(bytecount, 3) - 1, 32); _o_result = result - 1; return _o_result; } diff --git a/bootstrap/windows-48/OPM.h b/bootstrap/windows-48/OPM.h index c5192f5b..0d9bcdeb 100644 --- a/bootstrap/windows-48/OPM.h +++ b/bootstrap/windows-48/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPM__h #define OPM__h diff --git a/bootstrap/windows-48/OPP.c b/bootstrap/windows-48/OPP.c index 6e2d4cd0..de0afa51 100644 --- a/bootstrap/windows-48/OPP.c +++ b/bootstrap/windows-48/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/OPP.h b/bootstrap/windows-48/OPP.h index de48c5ba..2d3ebd77 100644 --- a/bootstrap/windows-48/OPP.h +++ b/bootstrap/windows-48/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/windows-48/OPS.c b/bootstrap/windows-48/OPS.c index 9b3bf8f0..e6e99c02 100644 --- a/bootstrap/windows-48/OPS.c +++ b/bootstrap/windows-48/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/OPS.h b/bootstrap/windows-48/OPS.h index 8689aa3b..99448598 100644 --- a/bootstrap/windows-48/OPS.h +++ b/bootstrap/windows-48/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tspkaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/windows-48/OPT.c b/bootstrap/windows-48/OPT.c index 0d16f8ec..4a645e7a 100644 --- a/bootstrap/windows-48/OPT.c +++ b/bootstrap/windows-48/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/OPT.h b/bootstrap/windows-48/OPT.h index b9e46b1a..93975ea1 100644 --- a/bootstrap/windows-48/OPT.h +++ b/bootstrap/windows-48/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/windows-48/OPV.c b/bootstrap/windows-48/OPV.c index e36e3be5..b264d44e 100644 --- a/bootstrap/windows-48/OPV.c +++ b/bootstrap/windows-48/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -1039,7 +1039,7 @@ static void OPV_expr (OPT_Node n, int16 prec) } if (__IN(subclass, 0x18000000)) { OPM_WriteString((CHAR*)", ", 3); - OPC_Ident(l->typ->strobj); + OPM_WriteInt(__ASHL(l->typ->size, 3)); } OPM_Write(')'); break; diff --git a/bootstrap/windows-48/OPV.h b/bootstrap/windows-48/OPV.h index c692efd8..3b43e61e 100644 --- a/bootstrap/windows-48/OPV.h +++ b/bootstrap/windows-48/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/windows-48/Platform.c b/bootstrap/windows-48/Platform.c index 777ee3b8..06824f8e 100644 --- a/bootstrap/windows-48/Platform.c +++ b/bootstrap/windows-48/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/Platform.h b/bootstrap/windows-48/Platform.h index 587135b3..a2301fff 100644 --- a/bootstrap/windows-48/Platform.h +++ b/bootstrap/windows-48/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/windows-48/Reals.c b/bootstrap/windows-48/Reals.c index c9e8e867..e209af08 100644 --- a/bootstrap/windows-48/Reals.c +++ b/bootstrap/windows-48/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/Reals.h b/bootstrap/windows-48/Reals.h index bd36f8d6..2779fc88 100644 --- a/bootstrap/windows-48/Reals.h +++ b/bootstrap/windows-48/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/windows-48/SYSTEM.c b/bootstrap/windows-48/SYSTEM.c deleted file mode 100644 index d7603f8e..00000000 --- a/bootstrap/windows-48/SYSTEM.c +++ /dev/null @@ -1,220 +0,0 @@ -/* -* The body prefix file of the voc(jet backend) runtime system, Version 1.0 -* -* Copyright (c) Software Templ, 1994, 1995 -* -* Module SYSTEM is subject to change any time without prior notification. -* Software Templ disclaims all warranties with regard to module SYSTEM, -* in particular shall Software Templ not be liable for any damage resulting -* from inappropriate use or modification of module SYSTEM. -* -* Version 1.1 jt, 24.11.95 fixes for correct pointer arithmetic on Cray computers -* jt 31.1.2007 ANSI prototypes for malloc and exit in order to avoid cc warnings -* -*/ - -#include "SYSTEM.h" -#include "stdarg.h" -#include - - -// Procedure verions of SYSTEM.H versions used when a multiply accessed -// parameter has side effects. - - - -LONGINT SYSTEM_ABS (LONGINT i) {return __ABS(i);} -double SYSTEM_ABSD(double i) {return __ABS(i);} - - -int64 SYSTEM_DIV(int64 x, int64 y) -{ - if (x == 0) return 0; - if (x >= 0) - if (y >= 0) {return x/y;} - else {return -((x-y-1)/(-y));} - else - if (y >= 0) {return -((y-x-1)/y);} - else {return (-x)/(-y);} -} - -int64 SYSTEM_MOD(int64 x, int64 y) -{ - if (x == 0) return 0; - if (x >= 0) - if (y >= 0) {return x % y;} - else {return (y+1) + ((x-1) % (-y));} - else - if (y >= 0) {return (y-1) - ((-x-1) % y);} - else {return -((-x) % (-y));} -} - - -void SYSTEM_INHERIT(LONGINT *t, LONGINT *t0) -{ - t -= __TPROC0OFF; - t0 -= __TPROC0OFF; - while (*t0 != __EOM) {*t = *t0; t--; t0--;} -} - - -void SYSTEM_ENUMP(void *adr, LONGINT n, void (*P)()) -{ - while (n > 0) { - P((address)(*((void**)(adr)))); - adr = ((void**)adr) + 1; - n--; - } -} - -void SYSTEM_ENUMR(void *adr, LONGINT *typ, LONGINT size, LONGINT n, void (*P)()) -{ - LONGINT *t, off; - typ++; - while (n > 0) { - t = typ; - off = *t; - while (off >= 0) {P(*(address*)((char*)adr+off)); t++; off = *t;} - adr = ((char*)adr) + size; - n--; - } -} - -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; - } -} - -extern void Heap_Lock(); -extern void Heap_Unlock(); - -SYSTEM_PTR SYSTEM_NEWARR(LONGINT *typ, LONGINT elemsz, int elemalgn, int nofdim, int nofdyn, ...) -{ - LONGINT nofelems, size, dataoff, n, nptr, *x, *p, nofptrs, i, *ptab, off; - va_list ap; - va_start(ap, nofdyn); - nofelems = 1; - while (nofdim > 0) { - nofelems = nofelems * va_arg(ap, LONGINT); nofdim--; - if (nofelems <= 0) __HALT(-20); - } - va_end(ap); - dataoff = nofdyn * sizeof(LONGINT); - if (elemalgn > sizeof(LONGINT)) { - n = dataoff % elemalgn; - if (n != 0) dataoff += elemalgn - n; - } - size = dataoff + nofelems * elemsz; - Heap_Lock(); - if (typ == NIL) { - /* element typ does not contain pointers */ - x = Heap_NEWBLK(size); - } - else if (typ == (LONGINT*)POINTER__typ) { - /* element type is a pointer */ - x = Heap_NEWBLK(size + nofelems * sizeof(LONGINT)); - p = (LONGINT*)(address)x[-1]; - p[-nofelems] = *p; /* build new type desc in situ: 1. copy block size; 2. setup ptr tab; 3. set sentinel; 4. patch tag */ - p -= nofelems - 1; n = 1; /* n =1 for skipping the size field */ - while (n <= nofelems) {*p = n*sizeof(LONGINT); p++; n++;} - *p = - (nofelems + 1) * sizeof(LONGINT); /* sentinel */ - x[-1] -= nofelems * sizeof(LONGINT); - } - else { - /* element type is a record that contains pointers */ - ptab = typ + 1; nofptrs = 0; - while (ptab[nofptrs] >= 0) {nofptrs++;} /* number of pointers per element */ - nptr = nofelems * nofptrs; /* total number of pointers */ - x = Heap_NEWBLK(size + nptr * sizeof(LONGINT)); - p = (LONGINT*)(address)x[- 1]; - p[-nptr] = *p; /* build new type desc in situ; 1. copy block size; 2. setup ptr tab; 3. set sentinel; 4. patch tag */ - p -= nptr - 1; n = 0; off = dataoff; - while (n < nofelems) {i = 0; - while (i < nofptrs) {*p = off + ptab[i]; p++; i++;} - off += elemsz; n++; - } - *p = - (nptr + 1) * sizeof(LONGINT); /* sentinel */ - x[-1] -= nptr * sizeof(LONGINT); - } - if (nofdyn != 0) { - /* setup len vector for index checks */ - va_start(ap, nofdyn); - p = x; - while (nofdyn > 0) {*p = va_arg(ap, LONGINT); p++, nofdyn--;} - va_end(ap); - } - Heap_Unlock(); - return x; -} - - - - -typedef void (*SystemSignalHandler)(INTEGER); // = Platform_SignalHandler - -#ifndef _WIN32 - - SystemSignalHandler handler[3] = {0}; - - // Provide signal handling for Unix based systems - void signalHandler(int s) { - if (s >= 2 && s <= 4) handler[s-2](s); - // (Ignore other signals) - } - - void SystemSetHandler(int s, address h) { - if (s >= 2 && s <= 4) { - int needtosetsystemhandler = handler[s-2] == 0; - handler[s-2] = (SystemSignalHandler)h; - if (needtosetsystemhandler) {signal(s, signalHandler);} - } - } - -#else - - // Provides Windows callback handlers for signal-like scenarios - #include "WindowsWrapper.h" - - SystemSignalHandler SystemInterruptHandler = 0; - SystemSignalHandler SystemQuitHandler = 0; - BOOL ConsoleCtrlHandlerSet = FALSE; - - BOOL WINAPI SystemConsoleCtrlHandler(DWORD ctrlType) { - if ((ctrlType == CTRL_C_EVENT) || (ctrlType == CTRL_BREAK_EVENT)) { - if (SystemInterruptHandler) { - SystemInterruptHandler(2); // SIGINT - return TRUE; - } - } else { // Close, logoff or shutdown - if (SystemQuitHandler) { - SystemQuitHandler(3); // SIGQUIT - return TRUE; - } - } - return FALSE; - } - - void EnsureConsoleCtrlHandler() { - if (!ConsoleCtrlHandlerSet) { - SetConsoleCtrlHandler(SystemConsoleCtrlHandler, TRUE); - ConsoleCtrlHandlerSet = TRUE; - } - } - - void SystemSetInterruptHandler(address h) { - EnsureConsoleCtrlHandler(); - SystemInterruptHandler = (SystemSignalHandler)h; - } - - void SystemSetQuitHandler(address h) { - EnsureConsoleCtrlHandler(); - SystemQuitHandler = (SystemSignalHandler)h; - } - -#endif diff --git a/bootstrap/windows-48/SYSTEM.h b/bootstrap/windows-48/SYSTEM.h deleted file mode 100644 index 168b0beb..00000000 --- a/bootstrap/windows-48/SYSTEM.h +++ /dev/null @@ -1,340 +0,0 @@ -#ifndef SYSTEM__h -#define SYSTEM__h - - -// 64 bit system detection - -#if (__SIZEOF_POINTER__ == 8) || defined (_LP64) || defined(__LP64__) || defined(_WIN64) - #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 - - - - - -// Declare memcpy in a way compatible with C compilers intrinsic -// built in implementations. - -#if defined (__o_64) - #if defined(_WIN64) - typedef unsigned long long size_t; -// typedef long long address; - #else - typedef unsigned long size_t; -// typedef long address; - #endif -#else - typedef unsigned int size_t; -//typedef int address; -#endif - -#define _SIZE_T_DECLARED // For FreeBSD -#define _SIZE_T_DEFINED_ // For OpenBSD - -void *memcpy(void *dest, const void *source, size_t size); - - -// Declare fixed size versions of basic intger types - -#if defined (__o_64) && !defined(_WIN64) - // LP64 - typedef long int64; - typedef unsigned long uint64; -#else - // ILP32 or LLP64 - typedef long long int64; - typedef unsigned long long uint64; -#endif - -typedef int int32; -typedef unsigned int uint32; - -typedef short int int16; -typedef unsigned short int uint16; - -typedef signed char int8; -typedef unsigned char uint8; - - -// 'address' is a synonym for an int32 of pointer size - -#if defined (__o_64) - #define address int64 -#else - #define address int32 -#endif - -// The compiler uses 'import' and 'export' which translate to 'extern' and -// nothing respectively. - -#define import extern -#define export - - - -// Known constants - -#define NIL ((void*)0) -#define __MAXEXT 16 -#define POINTER__typ ((address*)(1)) // not NIL and not a valid type - - -// Oberon types - -typedef int8 BOOLEAN; -typedef int8 SYSTEM_BYTE; -typedef uint8 uSYSTEM_BYTE; -typedef uint8 CHAR; -typedef uint8 uCHAR; -typedef float REAL; -typedef double LONGREAL; -typedef void* SYSTEM_PTR; - -#define uSET SET - - - - -// ---------------------------------------------------------------------- -// ---------------------------------------------------------------------- - - - -// OS Memory allocation interfaces are in PlatformXXX.Mod - -extern address Platform_OSAllocate (address size); -extern void Platform_OSFree (address addr); - - -// Assertions and Halts - -extern void Platform_Halt(LONGINT x); -extern void Platform_AssertFail(LONGINT x); - -#define __HALT(x) Platform_Halt(x) -#define __ASSERT(cond, x) if (!(cond)) Platform_AssertFail((LONGINT)(x)) - - -// Index checking - -static inline int64 __XF(uint64 i, uint64 ub) {if (i >= ub) {__HALT(-2);} return i;} -#define __X(i, ub) (((uint64)(i)<(uint64)(ub))?i:(__HALT(-2),0)) - - -// Range checking, and checked SHORT and CHR functions - -static inline int64 __RF(uint64 i, uint64 ub) {if (i >= ub) {__HALT(-8);} return i;} -#define __R(i, ub) (((uint64)(i)<(uint64)(ub))?i:(__HALT(-8),0)) -#define __SHORT(x, ub) ((int)((uLONGINT)(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)) - - - -// Run time system routines in SYSTEM.c - - -extern LONGINT SYSTEM_ABS (LONGINT i); -extern double SYSTEM_ABSD (double i); -extern void SYSTEM_INHERIT(LONGINT *t, LONGINT *t0); -extern void SYSTEM_ENUMP (void *adr, LONGINT n, void (*P)()); -extern void SYSTEM_ENUMR (void *adr, LONGINT *typ, LONGINT size, LONGINT n, void (*P)()); -extern LONGINT SYSTEM_ENTIER (double x); - - -// Signal handling in SYSTEM.c - -#ifndef _WIN32 - extern void SystemSetHandler(int s, address h); -#else - extern void SystemSetInterruptHandler(address h); - extern void SystemSetQuitHandler (address h); -#endif - - - -// String comparison - -static inline int __str_cmp(CHAR *x, CHAR *y){ - LONGINT i = 0; - CHAR ch1, ch2; - do {ch1 = x[i]; ch2 = y[i]; i++; - if (!ch1) return -(int)ch2; - } while (ch1==ch2); - return (int)ch1 - (int)ch2; -} -#define __STRCMP(a,b) __str_cmp((CHAR*)(a), (CHAR*)(b)) - - - -// Inline string, record and array copy - -#define __COPY(s, d, n) {char*_a=(void*)s,*_b=(void*)d; LONGINT _i=0,_t=n-1; \ - while(_i<_t&&((_b[_i]=_a[_i])!=0)){_i++;};_b[_i]=0;} -#define __DUP(x, l, t) x=(void*)memcpy((void*)Platform_OSAllocate(l*sizeof(t)),x,l*sizeof(t)) -#define __DUPARR(v, t) v=(void*)memcpy(v##__copy,v,sizeof(t)) -#define __DEL(x) Platform_OSFree((address)x) - - -/* SYSTEM ops */ - -#define __VAL(t, x) (*(t*)&(x)) - - -#define __GET(a, x, t) x=*(t*)(address)(a) -#define __PUT(a, x, t) *(t*)(address)(a)=x - -#define __LSHL(x, n, t) ((t)((u##t)(x)<<(n))) -#define __LSHR(x, n, t) ((t)((u##t)(x)>>(n))) -#define __LSH(x, n, t) ((n)>=0? __LSHL(x, n, t): __LSHR(x, -(n), t)) - -#define __ROTL(x, n, t) ((t)((u##t)(x)<<(n)|(u##t)(x)>>(8*sizeof(t)-(n)))) -#define __ROTR(x, n, t) ((t)((u##t)(x)>>(n)|(u##t)(x)<<(8*sizeof(t)-(n)))) -#define __ROT(x, n, t) ((n)>=0? __ROTL(x, n, t): __ROTR(x, -(n), t)) - -#define __ASHL(x, n) ((int64)(x)<<(n)) -#define __ASHR(x, n) ((int64)(x)>>(n)) -#define __ASH(x, n) ((n)>=0?__ASHL(x,n):__ASHR(x,-(n))) -static inline int64 SYSTEM_ASH(int64 x, int64 n) {return __ASH(x,n);} -#define __ASHF(x, n) SYSTEM_ASH((int64)(x), (int64)(n)) - -#define __BIT(x, n) (*(uint64*)(x)>>(n)&1) -#define __MOVE(s, d, n) memcpy((char*)(address)(d),(char*)(address)(s),n) - - -extern int64 SYSTEM_DIV(int64 x, int64 y); -#define __DIVF(x, y) SYSTEM_DIV(x, y) -#define __DIV(x, y) (((x)>0 && (y)>0) ? (x)/(y) : __DIVF(x, y)) - - -extern int64 SYSTEM_MOD(int64 x, int64 y); -#define __MODF(x, y) SYSTEM_MOD(x, y) -#define __MOD(x, y) (((x)>0 && (y)>0) ? (x)%(y) : __MODF(x, y)) - - - -#define __ENTIER(x) SYSTEM_ENTIER(x) -#define __ABS(x) (((x)<0)?-(x):(x)) -#define __ABSF(x) SYSTEM_ABS((LONGINT)(x)) -#define __ABSFD(x) SYSTEM_ABSD((double)(x)) -#define __CAP(ch) ((CHAR)((ch)&0x5f)) -#define __ODD(x) ((x)&1) -#define __IN(x, s) ((x)>=0 && (x)<(8*sizeof(SET)) && ((((uSET)(s))>>(x))&1)) -#define __SETOF(x) ((SET)1<<(x)) -#define __SETRNG(l, h) ((~(SET)0<<(l))&~(SET)0>>(8*sizeof(SET)-1-(h))) -#define __MASK(x, m) ((x)&~(m)) - - - -// Runtime checks - -#define __RETCHK __retchk: __HALT(-3); return 0; -#define __CASECHK __HALT(-4) -#define __WITHCHK __HALT(-7) - -#define __GUARDP(p, typ, level) ((typ*)(__ISP(p,typ,level)?p:(__HALT(-5),p))) -#define __GUARDR(r, typ, level) (*((typ*)(__IS(r##__typ,typ,level)?r:(__HALT(-5),r)))) -#define __GUARDA(p, typ, level) ((struct typ*)(__IS(__TYPEOF(p),typ,level)?p:(__HALT(-5),p))) -#define __GUARDEQR(p, dyntyp, typ) if(dyntyp!=typ##__typ) __HALT(-6);*(p) -#define __GUARDEQP(p, typ) if(__TYPEOF(p)!=typ##__typ)__HALT(-6);*(p) - - - -// Module entry/registration/exit - -extern void Heap_REGCMD(); -extern SYSTEM_PTR Heap_REGMOD(); -extern void Heap_REGTYP(); -extern void Heap_INCREF(); - -#define __DEFMOD static void *m; if (m!=0) {return m;} -#define __REGCMD(name, cmd) Heap_REGCMD(m, (CHAR*)name, cmd) -#define __REGMOD(name, enum) if (m==0) {m = Heap_REGMOD((CHAR*)name,enum);} -#define __ENDMOD return m -#define __MODULE_IMPORT(name) Heap_INCREF(name##__init()) - - - -// Main module initialisation, registration and finalisation - -extern void Platform_Init(INTEGER argc, address argv); -extern void Heap_FINALL(); - -#define __INIT(argc, argv) static void *m; Platform_Init((INTEGER)argc, (address)&argv); -#define __REGMAIN(name, enum) m = Heap_REGMOD((CHAR*)name,enum) -#define __FINI Heap_FINALL(); return 0 - - -// Memory allocation - -extern SYSTEM_PTR Heap_NEWBLK (address size); -extern SYSTEM_PTR Heap_NEWREC (address tag); -extern SYSTEM_PTR SYSTEM_NEWARR(LONGINT*, LONGINT, int, int, int, ...); - -#define __SYSNEW(p, len) p = Heap_NEWBLK((LONGINT)(len)) -#define __NEW(p, t) p = Heap_NEWREC((LONGINT)(address)t##__typ) -#define __NEWARR SYSTEM_NEWARR - - - -/* Type handling */ - -#define __TDESC(t, m, n) \ - static struct t##__desc { \ - LONGINT tproc[m]; /* Proc for each ptr field */ \ - LONGINT tag; \ - LONGINT next; /* Module table type list points here */ \ - LONGINT level; \ - LONGINT module; \ - char name[24]; \ - LONGINT basep[__MAXEXT]; /* List of bases this extends */ \ - LONGINT reserved; \ - LONGINT blksz; /* xxx_typ points here */ \ - LONGINT ptr[n+1]; /* Offsets of ptrs up to -ve sentinel */ \ - } t##__desc - -#define __BASEOFF (__MAXEXT+1) // blksz as index to base. -#define __TPROC0OFF (__BASEOFF+24/sizeof(LONGINT)+5) // blksz as index to tproc IFF m=1. -#define __EOM 1 -#define __TDFLDS(name, size) {__EOM}, 1, 0, 0, 0, name, {0}, 0, size -#define __ENUMP(adr, n, P) SYSTEM_ENUMP(adr, (LONGINT)(n), P) -#define __ENUMR(adr, typ, size, n, P) SYSTEM_ENUMR(adr, typ, (LONGINT)(size), (LONGINT)(n), P) - -#define __INITYP(t, t0, level) \ - t##__typ = (LONGINT*)&t##__desc.blksz; \ - memcpy(t##__desc.basep, t0##__typ - __BASEOFF, level*sizeof(LONGINT)); \ - t##__desc.basep[level] = (LONGINT)(address)t##__typ; \ - t##__desc.module = (LONGINT)(address)m; \ - if(t##__desc.blksz!=sizeof(struct t)) __HALT(-15); \ - t##__desc.blksz = (t##__desc.blksz+5*sizeof(LONGINT)-1)/(4*sizeof(LONGINT))*(4*sizeof(LONGINT)); \ - Heap_REGTYP(m, (LONGINT)(address)&t##__desc.next); \ - SYSTEM_INHERIT(t##__typ, t0##__typ) - -#define __IS(tag, typ, level) (*(tag-(__BASEOFF-level))==(LONGINT)(address)typ##__typ) -#define __TYPEOF(p) ((LONGINT*)(address)(*(((LONGINT*)(p))-1))) -#define __ISP(p, typ, level) __IS(__TYPEOF(p),typ,level) - -// Oberon-2 type bound procedures support -#define __INITBP(t, proc, num) *(t##__typ-(__TPROC0OFF+num))=(LONGINT)(address)proc -#define __SEND(typ, num, funtyp, parlist) ((funtyp)((address)*(typ-(__TPROC0OFF+num))))parlist - - - - -#endif diff --git a/bootstrap/windows-48/Strings.c b/bootstrap/windows-48/Strings.c index af7a679b..387345ab 100644 --- a/bootstrap/windows-48/Strings.c +++ b/bootstrap/windows-48/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/Strings.h b/bootstrap/windows-48/Strings.h index d145001a..fe90bd09 100644 --- a/bootstrap/windows-48/Strings.h +++ b/bootstrap/windows-48/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/windows-48/Texts.c b/bootstrap/windows-48/Texts.c index c40b975f..c37a4a2c 100644 --- a/bootstrap/windows-48/Texts.c +++ b/bootstrap/windows-48/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/Texts.h b/bootstrap/windows-48/Texts.h index 0aac4cc8..c6ee484f 100644 --- a/bootstrap/windows-48/Texts.h +++ b/bootstrap/windows-48/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/windows-48/Vishap.c b/bootstrap/windows-48/Vishap.c index b289dfa6..fb1c1662 100644 --- a/bootstrap/windows-48/Vishap.c +++ b/bootstrap/windows-48/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkamSf */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/WindowsWrapper.h b/bootstrap/windows-48/WindowsWrapper.h deleted file mode 100644 index b72c815a..00000000 --- a/bootstrap/windows-48/WindowsWrapper.h +++ /dev/null @@ -1,10 +0,0 @@ -// WindowsWrapper.h -// -// Includes Windows.h while avoiding conflicts with Oberon types. - - -#define BOOLEAN _BOOLEAN -#define CHAR _CHAR -#include -#undef BOOLEAN -#undef CHAR diff --git a/bootstrap/windows-48/errors.c b/bootstrap/windows-48/errors.c index 76fa35bf..7feed8e7 100644 --- a/bootstrap/windows-48/errors.c +++ b/bootstrap/windows-48/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/errors.h b/bootstrap/windows-48/errors.h index 9d5bbe45..4fe434e1 100644 --- a/bootstrap/windows-48/errors.h +++ b/bootstrap/windows-48/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/windows-48/extTools.c b/bootstrap/windows-48/extTools.c index 3dbc28ba..0afff1f0 100644 --- a/bootstrap/windows-48/extTools.c +++ b/bootstrap/windows-48/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/extTools.h b/bootstrap/windows-48/extTools.h index 8bdd3b71..5d996dae 100644 --- a/bootstrap/windows-48/extTools.h +++ b/bootstrap/windows-48/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/windows-48/vt100.c b/bootstrap/windows-48/vt100.c index 2e236578..8a5286ec 100644 --- a/bootstrap/windows-48/vt100.c +++ b/bootstrap/windows-48/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/vt100.h b/bootstrap/windows-48/vt100.h index 0eae5799..c09b4c71 100644 --- a/bootstrap/windows-48/vt100.h +++ b/bootstrap/windows-48/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef vt100__h #define vt100__h diff --git a/bootstrap/windows-88/Configuration.c b/bootstrap/windows-88/Configuration.c index b5ee44a5..b023c21b 100644 --- a/bootstrap/windows-88/Configuration.c +++ b/bootstrap/windows-88/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 @@ -18,6 +18,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("1.95 [2016/09/11] for gcc LP64 on cygwin", Configuration_versionLong, 41); + __MOVE("1.95 [2016/09/12] for gcc LP64 on cygwin", Configuration_versionLong, 41); __ENDMOD; } diff --git a/bootstrap/windows-88/Configuration.h b/bootstrap/windows-88/Configuration.h index 31877f12..3ce4467e 100644 --- a/bootstrap/windows-88/Configuration.h +++ b/bootstrap/windows-88/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/windows-88/Console.c b/bootstrap/windows-88/Console.c index e24d169a..1190773d 100644 --- a/bootstrap/windows-88/Console.c +++ b/bootstrap/windows-88/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 @@ -58,7 +58,7 @@ void Console_Int (int64 i, int64 n) { CHAR s[32]; int64 i1, k; - if (i == __LSHL(1, 63, int64)) { + if (i == __LSHL(1, 63, 64)) { __MOVE("8085774586302733229", s, 20); k = 19; } else { diff --git a/bootstrap/windows-88/Console.h b/bootstrap/windows-88/Console.h index 1d06d0fe..27d906ad 100644 --- a/bootstrap/windows-88/Console.h +++ b/bootstrap/windows-88/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/windows-88/Files.c b/bootstrap/windows-88/Files.c index 0f262baa..dbe8d119 100644 --- a/bootstrap/windows-88/Files.c +++ b/bootstrap/windows-88/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/Files.h b/bootstrap/windows-88/Files.h index 58cb3b1e..8a4fb7c5 100644 --- a/bootstrap/windows-88/Files.h +++ b/bootstrap/windows-88/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tspkaSfF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/windows-88/Heap.c b/bootstrap/windows-88/Heap.c index d0175b87..67044d79 100644 --- a/bootstrap/windows-88/Heap.c +++ b/bootstrap/windows-88/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tskSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/Heap.h b/bootstrap/windows-88/Heap.h index fabb54ef..584661bc 100644 --- a/bootstrap/windows-88/Heap.h +++ b/bootstrap/windows-88/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tskSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/windows-88/Modules.c b/bootstrap/windows-88/Modules.c index 53bf2640..547909bb 100644 --- a/bootstrap/windows-88/Modules.c +++ b/bootstrap/windows-88/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/Modules.h b/bootstrap/windows-88/Modules.h index 8e54ce53..2666971d 100644 --- a/bootstrap/windows-88/Modules.h +++ b/bootstrap/windows-88/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/windows-88/OPB.c b/bootstrap/windows-88/OPB.c index f22a9ab5..f048dc85 100644 --- a/bootstrap/windows-88/OPB.c +++ b/bootstrap/windows-88/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/OPB.h b/bootstrap/windows-88/OPB.h index aa26ea1c..adefb869 100644 --- a/bootstrap/windows-88/OPB.h +++ b/bootstrap/windows-88/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/windows-88/OPC.c b/bootstrap/windows-88/OPC.c index 8916c00b..aee5581c 100644 --- a/bootstrap/windows-88/OPC.c +++ b/bootstrap/windows-88/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/OPC.h b/bootstrap/windows-88/OPC.h index 71b95812..aba4bdbb 100644 --- a/bootstrap/windows-88/OPC.h +++ b/bootstrap/windows-88/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/windows-88/OPM.c b/bootstrap/windows-88/OPM.c index b15aba16..55420864 100644 --- a/bootstrap/windows-88/OPM.c +++ b/bootstrap/windows-88/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 @@ -537,7 +537,7 @@ void OPM_err (int32 n) void OPM_FPrint (int64 *fp, int64 val) { - *fp = __ROTL((int64)((SET)*fp ^ (SET)val), 1, int64); + *fp = __ROTL((int64)((SET)*fp ^ (SET)val), 1, 64); } void OPM_FPrintSet (int64 *fp, SET set) @@ -650,7 +650,7 @@ int64 OPM_SignedMaximum (int64 bytecount) int64 _o_result; int64 result; result = 1; - result = __LSH(result, __ASHL(bytecount, 3) - 1, int64); + result = __LSH(result, __ASHL(bytecount, 3) - 1, 64); _o_result = result - 1; return _o_result; } diff --git a/bootstrap/windows-88/OPM.h b/bootstrap/windows-88/OPM.h index d23aed25..1e5c3e72 100644 --- a/bootstrap/windows-88/OPM.h +++ b/bootstrap/windows-88/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPM__h #define OPM__h diff --git a/bootstrap/windows-88/OPP.c b/bootstrap/windows-88/OPP.c index 3f77df4f..f175938c 100644 --- a/bootstrap/windows-88/OPP.c +++ b/bootstrap/windows-88/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/OPP.h b/bootstrap/windows-88/OPP.h index de48c5ba..2d3ebd77 100644 --- a/bootstrap/windows-88/OPP.h +++ b/bootstrap/windows-88/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/windows-88/OPS.c b/bootstrap/windows-88/OPS.c index 491faa22..0c36910a 100644 --- a/bootstrap/windows-88/OPS.c +++ b/bootstrap/windows-88/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/OPS.h b/bootstrap/windows-88/OPS.h index 3937b6f6..a16c2ce8 100644 --- a/bootstrap/windows-88/OPS.h +++ b/bootstrap/windows-88/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin tspkaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/windows-88/OPT.c b/bootstrap/windows-88/OPT.c index da8bab08..3006ea90 100644 --- a/bootstrap/windows-88/OPT.c +++ b/bootstrap/windows-88/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/OPT.h b/bootstrap/windows-88/OPT.h index 668c3d79..5f466ec4 100644 --- a/bootstrap/windows-88/OPT.h +++ b/bootstrap/windows-88/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/windows-88/OPV.c b/bootstrap/windows-88/OPV.c index 52fc9966..082797f1 100644 --- a/bootstrap/windows-88/OPV.c +++ b/bootstrap/windows-88/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 @@ -1039,7 +1039,7 @@ static void OPV_expr (OPT_Node n, int32 prec) } if (__IN(subclass, 0x18000000)) { OPM_WriteString((CHAR*)", ", 3); - OPC_Ident(l->typ->strobj); + OPM_WriteInt(__ASHL(l->typ->size, 3)); } OPM_Write(')'); break; diff --git a/bootstrap/windows-88/OPV.h b/bootstrap/windows-88/OPV.h index c692efd8..3b43e61e 100644 --- a/bootstrap/windows-88/OPV.h +++ b/bootstrap/windows-88/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/windows-88/Platform.c b/bootstrap/windows-88/Platform.c index b862e3ee..b7705767 100644 --- a/bootstrap/windows-88/Platform.c +++ b/bootstrap/windows-88/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/Platform.h b/bootstrap/windows-88/Platform.h index d74f41bc..290fc518 100644 --- a/bootstrap/windows-88/Platform.h +++ b/bootstrap/windows-88/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/windows-88/Reals.c b/bootstrap/windows-88/Reals.c index 185aec0b..2a753b7a 100644 --- a/bootstrap/windows-88/Reals.c +++ b/bootstrap/windows-88/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/Reals.h b/bootstrap/windows-88/Reals.h index a2fc2612..c3cac05a 100644 --- a/bootstrap/windows-88/Reals.h +++ b/bootstrap/windows-88/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/windows-88/SYSTEM.c b/bootstrap/windows-88/SYSTEM.c deleted file mode 100644 index d7603f8e..00000000 --- a/bootstrap/windows-88/SYSTEM.c +++ /dev/null @@ -1,220 +0,0 @@ -/* -* The body prefix file of the voc(jet backend) runtime system, Version 1.0 -* -* Copyright (c) Software Templ, 1994, 1995 -* -* Module SYSTEM is subject to change any time without prior notification. -* Software Templ disclaims all warranties with regard to module SYSTEM, -* in particular shall Software Templ not be liable for any damage resulting -* from inappropriate use or modification of module SYSTEM. -* -* Version 1.1 jt, 24.11.95 fixes for correct pointer arithmetic on Cray computers -* jt 31.1.2007 ANSI prototypes for malloc and exit in order to avoid cc warnings -* -*/ - -#include "SYSTEM.h" -#include "stdarg.h" -#include - - -// Procedure verions of SYSTEM.H versions used when a multiply accessed -// parameter has side effects. - - - -LONGINT SYSTEM_ABS (LONGINT i) {return __ABS(i);} -double SYSTEM_ABSD(double i) {return __ABS(i);} - - -int64 SYSTEM_DIV(int64 x, int64 y) -{ - if (x == 0) return 0; - if (x >= 0) - if (y >= 0) {return x/y;} - else {return -((x-y-1)/(-y));} - else - if (y >= 0) {return -((y-x-1)/y);} - else {return (-x)/(-y);} -} - -int64 SYSTEM_MOD(int64 x, int64 y) -{ - if (x == 0) return 0; - if (x >= 0) - if (y >= 0) {return x % y;} - else {return (y+1) + ((x-1) % (-y));} - else - if (y >= 0) {return (y-1) - ((-x-1) % y);} - else {return -((-x) % (-y));} -} - - -void SYSTEM_INHERIT(LONGINT *t, LONGINT *t0) -{ - t -= __TPROC0OFF; - t0 -= __TPROC0OFF; - while (*t0 != __EOM) {*t = *t0; t--; t0--;} -} - - -void SYSTEM_ENUMP(void *adr, LONGINT n, void (*P)()) -{ - while (n > 0) { - P((address)(*((void**)(adr)))); - adr = ((void**)adr) + 1; - n--; - } -} - -void SYSTEM_ENUMR(void *adr, LONGINT *typ, LONGINT size, LONGINT n, void (*P)()) -{ - LONGINT *t, off; - typ++; - while (n > 0) { - t = typ; - off = *t; - while (off >= 0) {P(*(address*)((char*)adr+off)); t++; off = *t;} - adr = ((char*)adr) + size; - n--; - } -} - -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; - } -} - -extern void Heap_Lock(); -extern void Heap_Unlock(); - -SYSTEM_PTR SYSTEM_NEWARR(LONGINT *typ, LONGINT elemsz, int elemalgn, int nofdim, int nofdyn, ...) -{ - LONGINT nofelems, size, dataoff, n, nptr, *x, *p, nofptrs, i, *ptab, off; - va_list ap; - va_start(ap, nofdyn); - nofelems = 1; - while (nofdim > 0) { - nofelems = nofelems * va_arg(ap, LONGINT); nofdim--; - if (nofelems <= 0) __HALT(-20); - } - va_end(ap); - dataoff = nofdyn * sizeof(LONGINT); - if (elemalgn > sizeof(LONGINT)) { - n = dataoff % elemalgn; - if (n != 0) dataoff += elemalgn - n; - } - size = dataoff + nofelems * elemsz; - Heap_Lock(); - if (typ == NIL) { - /* element typ does not contain pointers */ - x = Heap_NEWBLK(size); - } - else if (typ == (LONGINT*)POINTER__typ) { - /* element type is a pointer */ - x = Heap_NEWBLK(size + nofelems * sizeof(LONGINT)); - p = (LONGINT*)(address)x[-1]; - p[-nofelems] = *p; /* build new type desc in situ: 1. copy block size; 2. setup ptr tab; 3. set sentinel; 4. patch tag */ - p -= nofelems - 1; n = 1; /* n =1 for skipping the size field */ - while (n <= nofelems) {*p = n*sizeof(LONGINT); p++; n++;} - *p = - (nofelems + 1) * sizeof(LONGINT); /* sentinel */ - x[-1] -= nofelems * sizeof(LONGINT); - } - else { - /* element type is a record that contains pointers */ - ptab = typ + 1; nofptrs = 0; - while (ptab[nofptrs] >= 0) {nofptrs++;} /* number of pointers per element */ - nptr = nofelems * nofptrs; /* total number of pointers */ - x = Heap_NEWBLK(size + nptr * sizeof(LONGINT)); - p = (LONGINT*)(address)x[- 1]; - p[-nptr] = *p; /* build new type desc in situ; 1. copy block size; 2. setup ptr tab; 3. set sentinel; 4. patch tag */ - p -= nptr - 1; n = 0; off = dataoff; - while (n < nofelems) {i = 0; - while (i < nofptrs) {*p = off + ptab[i]; p++; i++;} - off += elemsz; n++; - } - *p = - (nptr + 1) * sizeof(LONGINT); /* sentinel */ - x[-1] -= nptr * sizeof(LONGINT); - } - if (nofdyn != 0) { - /* setup len vector for index checks */ - va_start(ap, nofdyn); - p = x; - while (nofdyn > 0) {*p = va_arg(ap, LONGINT); p++, nofdyn--;} - va_end(ap); - } - Heap_Unlock(); - return x; -} - - - - -typedef void (*SystemSignalHandler)(INTEGER); // = Platform_SignalHandler - -#ifndef _WIN32 - - SystemSignalHandler handler[3] = {0}; - - // Provide signal handling for Unix based systems - void signalHandler(int s) { - if (s >= 2 && s <= 4) handler[s-2](s); - // (Ignore other signals) - } - - void SystemSetHandler(int s, address h) { - if (s >= 2 && s <= 4) { - int needtosetsystemhandler = handler[s-2] == 0; - handler[s-2] = (SystemSignalHandler)h; - if (needtosetsystemhandler) {signal(s, signalHandler);} - } - } - -#else - - // Provides Windows callback handlers for signal-like scenarios - #include "WindowsWrapper.h" - - SystemSignalHandler SystemInterruptHandler = 0; - SystemSignalHandler SystemQuitHandler = 0; - BOOL ConsoleCtrlHandlerSet = FALSE; - - BOOL WINAPI SystemConsoleCtrlHandler(DWORD ctrlType) { - if ((ctrlType == CTRL_C_EVENT) || (ctrlType == CTRL_BREAK_EVENT)) { - if (SystemInterruptHandler) { - SystemInterruptHandler(2); // SIGINT - return TRUE; - } - } else { // Close, logoff or shutdown - if (SystemQuitHandler) { - SystemQuitHandler(3); // SIGQUIT - return TRUE; - } - } - return FALSE; - } - - void EnsureConsoleCtrlHandler() { - if (!ConsoleCtrlHandlerSet) { - SetConsoleCtrlHandler(SystemConsoleCtrlHandler, TRUE); - ConsoleCtrlHandlerSet = TRUE; - } - } - - void SystemSetInterruptHandler(address h) { - EnsureConsoleCtrlHandler(); - SystemInterruptHandler = (SystemSignalHandler)h; - } - - void SystemSetQuitHandler(address h) { - EnsureConsoleCtrlHandler(); - SystemQuitHandler = (SystemSignalHandler)h; - } - -#endif diff --git a/bootstrap/windows-88/SYSTEM.h b/bootstrap/windows-88/SYSTEM.h deleted file mode 100644 index 168b0beb..00000000 --- a/bootstrap/windows-88/SYSTEM.h +++ /dev/null @@ -1,340 +0,0 @@ -#ifndef SYSTEM__h -#define SYSTEM__h - - -// 64 bit system detection - -#if (__SIZEOF_POINTER__ == 8) || defined (_LP64) || defined(__LP64__) || defined(_WIN64) - #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 - - - - - -// Declare memcpy in a way compatible with C compilers intrinsic -// built in implementations. - -#if defined (__o_64) - #if defined(_WIN64) - typedef unsigned long long size_t; -// typedef long long address; - #else - typedef unsigned long size_t; -// typedef long address; - #endif -#else - typedef unsigned int size_t; -//typedef int address; -#endif - -#define _SIZE_T_DECLARED // For FreeBSD -#define _SIZE_T_DEFINED_ // For OpenBSD - -void *memcpy(void *dest, const void *source, size_t size); - - -// Declare fixed size versions of basic intger types - -#if defined (__o_64) && !defined(_WIN64) - // LP64 - typedef long int64; - typedef unsigned long uint64; -#else - // ILP32 or LLP64 - typedef long long int64; - typedef unsigned long long uint64; -#endif - -typedef int int32; -typedef unsigned int uint32; - -typedef short int int16; -typedef unsigned short int uint16; - -typedef signed char int8; -typedef unsigned char uint8; - - -// 'address' is a synonym for an int32 of pointer size - -#if defined (__o_64) - #define address int64 -#else - #define address int32 -#endif - -// The compiler uses 'import' and 'export' which translate to 'extern' and -// nothing respectively. - -#define import extern -#define export - - - -// Known constants - -#define NIL ((void*)0) -#define __MAXEXT 16 -#define POINTER__typ ((address*)(1)) // not NIL and not a valid type - - -// Oberon types - -typedef int8 BOOLEAN; -typedef int8 SYSTEM_BYTE; -typedef uint8 uSYSTEM_BYTE; -typedef uint8 CHAR; -typedef uint8 uCHAR; -typedef float REAL; -typedef double LONGREAL; -typedef void* SYSTEM_PTR; - -#define uSET SET - - - - -// ---------------------------------------------------------------------- -// ---------------------------------------------------------------------- - - - -// OS Memory allocation interfaces are in PlatformXXX.Mod - -extern address Platform_OSAllocate (address size); -extern void Platform_OSFree (address addr); - - -// Assertions and Halts - -extern void Platform_Halt(LONGINT x); -extern void Platform_AssertFail(LONGINT x); - -#define __HALT(x) Platform_Halt(x) -#define __ASSERT(cond, x) if (!(cond)) Platform_AssertFail((LONGINT)(x)) - - -// Index checking - -static inline int64 __XF(uint64 i, uint64 ub) {if (i >= ub) {__HALT(-2);} return i;} -#define __X(i, ub) (((uint64)(i)<(uint64)(ub))?i:(__HALT(-2),0)) - - -// Range checking, and checked SHORT and CHR functions - -static inline int64 __RF(uint64 i, uint64 ub) {if (i >= ub) {__HALT(-8);} return i;} -#define __R(i, ub) (((uint64)(i)<(uint64)(ub))?i:(__HALT(-8),0)) -#define __SHORT(x, ub) ((int)((uLONGINT)(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)) - - - -// Run time system routines in SYSTEM.c - - -extern LONGINT SYSTEM_ABS (LONGINT i); -extern double SYSTEM_ABSD (double i); -extern void SYSTEM_INHERIT(LONGINT *t, LONGINT *t0); -extern void SYSTEM_ENUMP (void *adr, LONGINT n, void (*P)()); -extern void SYSTEM_ENUMR (void *adr, LONGINT *typ, LONGINT size, LONGINT n, void (*P)()); -extern LONGINT SYSTEM_ENTIER (double x); - - -// Signal handling in SYSTEM.c - -#ifndef _WIN32 - extern void SystemSetHandler(int s, address h); -#else - extern void SystemSetInterruptHandler(address h); - extern void SystemSetQuitHandler (address h); -#endif - - - -// String comparison - -static inline int __str_cmp(CHAR *x, CHAR *y){ - LONGINT i = 0; - CHAR ch1, ch2; - do {ch1 = x[i]; ch2 = y[i]; i++; - if (!ch1) return -(int)ch2; - } while (ch1==ch2); - return (int)ch1 - (int)ch2; -} -#define __STRCMP(a,b) __str_cmp((CHAR*)(a), (CHAR*)(b)) - - - -// Inline string, record and array copy - -#define __COPY(s, d, n) {char*_a=(void*)s,*_b=(void*)d; LONGINT _i=0,_t=n-1; \ - while(_i<_t&&((_b[_i]=_a[_i])!=0)){_i++;};_b[_i]=0;} -#define __DUP(x, l, t) x=(void*)memcpy((void*)Platform_OSAllocate(l*sizeof(t)),x,l*sizeof(t)) -#define __DUPARR(v, t) v=(void*)memcpy(v##__copy,v,sizeof(t)) -#define __DEL(x) Platform_OSFree((address)x) - - -/* SYSTEM ops */ - -#define __VAL(t, x) (*(t*)&(x)) - - -#define __GET(a, x, t) x=*(t*)(address)(a) -#define __PUT(a, x, t) *(t*)(address)(a)=x - -#define __LSHL(x, n, t) ((t)((u##t)(x)<<(n))) -#define __LSHR(x, n, t) ((t)((u##t)(x)>>(n))) -#define __LSH(x, n, t) ((n)>=0? __LSHL(x, n, t): __LSHR(x, -(n), t)) - -#define __ROTL(x, n, t) ((t)((u##t)(x)<<(n)|(u##t)(x)>>(8*sizeof(t)-(n)))) -#define __ROTR(x, n, t) ((t)((u##t)(x)>>(n)|(u##t)(x)<<(8*sizeof(t)-(n)))) -#define __ROT(x, n, t) ((n)>=0? __ROTL(x, n, t): __ROTR(x, -(n), t)) - -#define __ASHL(x, n) ((int64)(x)<<(n)) -#define __ASHR(x, n) ((int64)(x)>>(n)) -#define __ASH(x, n) ((n)>=0?__ASHL(x,n):__ASHR(x,-(n))) -static inline int64 SYSTEM_ASH(int64 x, int64 n) {return __ASH(x,n);} -#define __ASHF(x, n) SYSTEM_ASH((int64)(x), (int64)(n)) - -#define __BIT(x, n) (*(uint64*)(x)>>(n)&1) -#define __MOVE(s, d, n) memcpy((char*)(address)(d),(char*)(address)(s),n) - - -extern int64 SYSTEM_DIV(int64 x, int64 y); -#define __DIVF(x, y) SYSTEM_DIV(x, y) -#define __DIV(x, y) (((x)>0 && (y)>0) ? (x)/(y) : __DIVF(x, y)) - - -extern int64 SYSTEM_MOD(int64 x, int64 y); -#define __MODF(x, y) SYSTEM_MOD(x, y) -#define __MOD(x, y) (((x)>0 && (y)>0) ? (x)%(y) : __MODF(x, y)) - - - -#define __ENTIER(x) SYSTEM_ENTIER(x) -#define __ABS(x) (((x)<0)?-(x):(x)) -#define __ABSF(x) SYSTEM_ABS((LONGINT)(x)) -#define __ABSFD(x) SYSTEM_ABSD((double)(x)) -#define __CAP(ch) ((CHAR)((ch)&0x5f)) -#define __ODD(x) ((x)&1) -#define __IN(x, s) ((x)>=0 && (x)<(8*sizeof(SET)) && ((((uSET)(s))>>(x))&1)) -#define __SETOF(x) ((SET)1<<(x)) -#define __SETRNG(l, h) ((~(SET)0<<(l))&~(SET)0>>(8*sizeof(SET)-1-(h))) -#define __MASK(x, m) ((x)&~(m)) - - - -// Runtime checks - -#define __RETCHK __retchk: __HALT(-3); return 0; -#define __CASECHK __HALT(-4) -#define __WITHCHK __HALT(-7) - -#define __GUARDP(p, typ, level) ((typ*)(__ISP(p,typ,level)?p:(__HALT(-5),p))) -#define __GUARDR(r, typ, level) (*((typ*)(__IS(r##__typ,typ,level)?r:(__HALT(-5),r)))) -#define __GUARDA(p, typ, level) ((struct typ*)(__IS(__TYPEOF(p),typ,level)?p:(__HALT(-5),p))) -#define __GUARDEQR(p, dyntyp, typ) if(dyntyp!=typ##__typ) __HALT(-6);*(p) -#define __GUARDEQP(p, typ) if(__TYPEOF(p)!=typ##__typ)__HALT(-6);*(p) - - - -// Module entry/registration/exit - -extern void Heap_REGCMD(); -extern SYSTEM_PTR Heap_REGMOD(); -extern void Heap_REGTYP(); -extern void Heap_INCREF(); - -#define __DEFMOD static void *m; if (m!=0) {return m;} -#define __REGCMD(name, cmd) Heap_REGCMD(m, (CHAR*)name, cmd) -#define __REGMOD(name, enum) if (m==0) {m = Heap_REGMOD((CHAR*)name,enum);} -#define __ENDMOD return m -#define __MODULE_IMPORT(name) Heap_INCREF(name##__init()) - - - -// Main module initialisation, registration and finalisation - -extern void Platform_Init(INTEGER argc, address argv); -extern void Heap_FINALL(); - -#define __INIT(argc, argv) static void *m; Platform_Init((INTEGER)argc, (address)&argv); -#define __REGMAIN(name, enum) m = Heap_REGMOD((CHAR*)name,enum) -#define __FINI Heap_FINALL(); return 0 - - -// Memory allocation - -extern SYSTEM_PTR Heap_NEWBLK (address size); -extern SYSTEM_PTR Heap_NEWREC (address tag); -extern SYSTEM_PTR SYSTEM_NEWARR(LONGINT*, LONGINT, int, int, int, ...); - -#define __SYSNEW(p, len) p = Heap_NEWBLK((LONGINT)(len)) -#define __NEW(p, t) p = Heap_NEWREC((LONGINT)(address)t##__typ) -#define __NEWARR SYSTEM_NEWARR - - - -/* Type handling */ - -#define __TDESC(t, m, n) \ - static struct t##__desc { \ - LONGINT tproc[m]; /* Proc for each ptr field */ \ - LONGINT tag; \ - LONGINT next; /* Module table type list points here */ \ - LONGINT level; \ - LONGINT module; \ - char name[24]; \ - LONGINT basep[__MAXEXT]; /* List of bases this extends */ \ - LONGINT reserved; \ - LONGINT blksz; /* xxx_typ points here */ \ - LONGINT ptr[n+1]; /* Offsets of ptrs up to -ve sentinel */ \ - } t##__desc - -#define __BASEOFF (__MAXEXT+1) // blksz as index to base. -#define __TPROC0OFF (__BASEOFF+24/sizeof(LONGINT)+5) // blksz as index to tproc IFF m=1. -#define __EOM 1 -#define __TDFLDS(name, size) {__EOM}, 1, 0, 0, 0, name, {0}, 0, size -#define __ENUMP(adr, n, P) SYSTEM_ENUMP(adr, (LONGINT)(n), P) -#define __ENUMR(adr, typ, size, n, P) SYSTEM_ENUMR(adr, typ, (LONGINT)(size), (LONGINT)(n), P) - -#define __INITYP(t, t0, level) \ - t##__typ = (LONGINT*)&t##__desc.blksz; \ - memcpy(t##__desc.basep, t0##__typ - __BASEOFF, level*sizeof(LONGINT)); \ - t##__desc.basep[level] = (LONGINT)(address)t##__typ; \ - t##__desc.module = (LONGINT)(address)m; \ - if(t##__desc.blksz!=sizeof(struct t)) __HALT(-15); \ - t##__desc.blksz = (t##__desc.blksz+5*sizeof(LONGINT)-1)/(4*sizeof(LONGINT))*(4*sizeof(LONGINT)); \ - Heap_REGTYP(m, (LONGINT)(address)&t##__desc.next); \ - SYSTEM_INHERIT(t##__typ, t0##__typ) - -#define __IS(tag, typ, level) (*(tag-(__BASEOFF-level))==(LONGINT)(address)typ##__typ) -#define __TYPEOF(p) ((LONGINT*)(address)(*(((LONGINT*)(p))-1))) -#define __ISP(p, typ, level) __IS(__TYPEOF(p),typ,level) - -// Oberon-2 type bound procedures support -#define __INITBP(t, proc, num) *(t##__typ-(__TPROC0OFF+num))=(LONGINT)(address)proc -#define __SEND(typ, num, funtyp, parlist) ((funtyp)((address)*(typ-(__TPROC0OFF+num))))parlist - - - - -#endif diff --git a/bootstrap/windows-88/Strings.c b/bootstrap/windows-88/Strings.c index d4ecf06e..d8c606d3 100644 --- a/bootstrap/windows-88/Strings.c +++ b/bootstrap/windows-88/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/Strings.h b/bootstrap/windows-88/Strings.h index b664568e..130e1d06 100644 --- a/bootstrap/windows-88/Strings.h +++ b/bootstrap/windows-88/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/windows-88/Texts.c b/bootstrap/windows-88/Texts.c index b3c1a3bf..056c54e0 100644 --- a/bootstrap/windows-88/Texts.c +++ b/bootstrap/windows-88/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/Texts.h b/bootstrap/windows-88/Texts.h index 116ee5e3..1e734f9d 100644 --- a/bootstrap/windows-88/Texts.h +++ b/bootstrap/windows-88/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/windows-88/Vishap.c b/bootstrap/windows-88/Vishap.c index a04ca149..08b89b00 100644 --- a/bootstrap/windows-88/Vishap.c +++ b/bootstrap/windows-88/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkamSf */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/WindowsWrapper.h b/bootstrap/windows-88/WindowsWrapper.h deleted file mode 100644 index b72c815a..00000000 --- a/bootstrap/windows-88/WindowsWrapper.h +++ /dev/null @@ -1,10 +0,0 @@ -// WindowsWrapper.h -// -// Includes Windows.h while avoiding conflicts with Oberon types. - - -#define BOOLEAN _BOOLEAN -#define CHAR _CHAR -#include -#undef BOOLEAN -#undef CHAR diff --git a/bootstrap/windows-88/errors.c b/bootstrap/windows-88/errors.c index 5dba1a33..84d35faf 100644 --- a/bootstrap/windows-88/errors.c +++ b/bootstrap/windows-88/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/errors.h b/bootstrap/windows-88/errors.h index 9d5bbe45..4fe434e1 100644 --- a/bootstrap/windows-88/errors.h +++ b/bootstrap/windows-88/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/windows-88/extTools.c b/bootstrap/windows-88/extTools.c index 1080b9a3..7651bcf8 100644 --- a/bootstrap/windows-88/extTools.c +++ b/bootstrap/windows-88/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/extTools.h b/bootstrap/windows-88/extTools.h index 8bdd3b71..5d996dae 100644 --- a/bootstrap/windows-88/extTools.h +++ b/bootstrap/windows-88/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/windows-88/vt100.c b/bootstrap/windows-88/vt100.c index 3efc2842..b7524886 100644 --- a/bootstrap/windows-88/vt100.c +++ b/bootstrap/windows-88/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/vt100.h b/bootstrap/windows-88/vt100.h index 71738164..ef3afa5a 100644 --- a/bootstrap/windows-88/vt100.h +++ b/bootstrap/windows-88/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/11] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/12] for gcc LP64 on cygwin xtspkaSfF */ #ifndef vt100__h #define vt100__h diff --git a/makefile b/makefile index 31f5fa39..ade812e7 100644 --- a/makefile +++ b/makefile @@ -248,6 +248,7 @@ bootstrap: configuration make -f src/tools/make/vishap.make -s translate INTSIZE=4 ADRSIZE=8 ALIGNMENT=8 PLATFORM=unix BUILDDIR=bootstrap/unix-88 && rm bootstrap/unix-88/*.sym make -f src/tools/make/vishap.make -s translate INTSIZE=2 ADRSIZE=4 ALIGNMENT=8 PLATFORM=windows BUILDDIR=bootstrap/windows-48 && rm bootstrap/windows-48/*.sym make -f src/tools/make/vishap.make -s translate INTSIZE=4 ADRSIZE=8 ALIGNMENT=8 PLATFORM=windows BUILDDIR=bootstrap/windows-88 && rm bootstrap/windows-88/*.sym + cp src/system/*.[ch] bootstrap bootstrapunclean: @@ -257,6 +258,7 @@ bootstrapunclean: make -f src/tools/make/vishap.make -s translate INTSIZE=4 ADRSIZE=8 ALIGNMENT=8 PLATFORM=unix BUILDDIR=bootstrap/unix-88 && rm bootstrap/unix-88/*.sym make -f src/tools/make/vishap.make -s translate INTSIZE=2 ADRSIZE=4 ALIGNMENT=8 PLATFORM=windows BUILDDIR=bootstrap/windows-48 && rm bootstrap/windows-48/*.sym make -f src/tools/make/vishap.make -s translate INTSIZE=4 ADRSIZE=8 ALIGNMENT=8 PLATFORM=windows BUILDDIR=bootstrap/windows-88 && rm bootstrap/windows-88/*.sym + cp src/system/*.[ch] bootstrap diff --git a/src/compiler/OPV.Mod b/src/compiler/OPV.Mod index 61125e5b..2f679ace 100644 --- a/src/compiler/OPV.Mod +++ b/src/compiler/OPV.Mod @@ -625,7 +625,7 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96 OPM.WriteInt(-r^.conval^.intval) ELSE expr(r, MinPrec) END ; - IF subclass IN {OPT.lsh, OPT.rot} THEN OPM.WriteString(Comma); OPC.Ident(l^.typ^.strobj) END ; + IF subclass IN {OPT.lsh, OPT.rot} THEN OPM.WriteString(Comma); OPM.WriteInt(l.typ.size*8) END; OPM.Write(CloseParen) | OPS.eql .. OPS.geq: IF l^.typ^.form IN {OPT.String, OPT.Comp} THEN diff --git a/src/system/SYSTEM.h b/src/system/SYSTEM.h index 168b0beb..709c26a7 100644 --- a/src/system/SYSTEM.h +++ b/src/system/SYSTEM.h @@ -33,14 +33,11 @@ #if defined (__o_64) #if defined(_WIN64) typedef unsigned long long size_t; -// typedef long long address; #else typedef unsigned long size_t; -// typedef long address; #endif #else typedef unsigned int size_t; -//typedef int address; #endif #define _SIZE_T_DECLARED // For FreeBSD @@ -71,14 +68,6 @@ typedef signed char int8; typedef unsigned char uint8; -// 'address' is a synonym for an int32 of pointer size - -#if defined (__o_64) - #define address int64 -#else - #define address int32 -#endif - // The compiler uses 'import' and 'export' which translate to 'extern' and // nothing respectively. @@ -98,9 +87,7 @@ typedef unsigned char uint8; typedef int8 BOOLEAN; typedef int8 SYSTEM_BYTE; -typedef uint8 uSYSTEM_BYTE; typedef uint8 CHAR; -typedef uint8 uCHAR; typedef float REAL; typedef double LONGREAL; typedef void* SYSTEM_PTR; @@ -108,6 +95,16 @@ typedef void* SYSTEM_PTR; #define uSET SET +// 'address' is a synonym for an int of pointer size + +#if defined (__o_64) + #define address int64 +#else + #define address int32 +#endif + + + // ---------------------------------------------------------------------- @@ -200,13 +197,13 @@ static inline int __str_cmp(CHAR *x, CHAR *y){ #define __GET(a, x, t) x=*(t*)(address)(a) #define __PUT(a, x, t) *(t*)(address)(a)=x -#define __LSHL(x, n, t) ((t)((u##t)(x)<<(n))) -#define __LSHR(x, n, t) ((t)((u##t)(x)>>(n))) -#define __LSH(x, n, t) ((n)>=0? __LSHL(x, n, t): __LSHR(x, -(n), t)) +#define __LSHL(x, n, s) ((int##s)((uint##s)(x)<<(n))) +#define __LSHR(x, n, s) ((int##s)((uint##s)(x)>>(n))) +#define __LSH(x, n, s) ((n)>=0? __LSHL(x, n, s): __LSHR(x, -(n), s)) -#define __ROTL(x, n, t) ((t)((u##t)(x)<<(n)|(u##t)(x)>>(8*sizeof(t)-(n)))) -#define __ROTR(x, n, t) ((t)((u##t)(x)>>(n)|(u##t)(x)<<(8*sizeof(t)-(n)))) -#define __ROT(x, n, t) ((n)>=0? __ROTL(x, n, t): __ROTR(x, -(n), t)) +#define __ROTL(x, n, s) ((int##s)((uint##s)(x)<<(n)|(uint##s)(x)>>(s-(n)))) +#define __ROTR(x, n, s) ((int##s)((uint##s)(x)>>(n)|(uint##s)(x)<<(s-(n)))) +#define __ROT(x, n, s) ((n)>=0? __ROTL(x, n, s): __ROTR(x, -(n), s)) #define __ASHL(x, n) ((int64)(x)<<(n)) #define __ASHR(x, n) ((int64)(x)>>(n)) diff --git a/src/test/confidence/language/TestLanguage.mod b/src/test/confidence/language/TestLanguage.mod index 3db99f44..724ae63a 100644 --- a/src/test/confidence/language/TestLanguage.mod +++ b/src/test/confidence/language/TestLanguage.mod @@ -2,8 +2,20 @@ MODULE TestLanguage; IMPORT SYSTEM, Console; +PROCEDURE TestShiftResult(of, by, actual, expected: LONGINT; msg: ARRAY OF CHAR); +BEGIN + IF actual # expected THEN + Console.String(msg); + Console.String(" of $"); Console.Hex(of); + Console.String(" by "); Console.Int(by,1); + Console.String(" is $"); Console.Hex(actual); + Console.String(" but should be $"); Console.Hex(expected); + Console.Ln; + END +END TestShiftResult; + PROCEDURE Shift; -VAR c: CHAR; b: SYSTEM.BYTE; s,t,u: SHORTINT; h,i,j,k: INTEGER; l,m,n: LONGINT; +VAR c: CHAR; b: SYSTEM.BYTE; s,t,u: SHORTINT; h,i,j,k: INTEGER; l,m,n,r: LONGINT; (* Aritmetic shift always returns type LONGINT. Defined as x * 2**n. LSH and ROT produces results of the same type as the value being shifted. @@ -13,8 +25,8 @@ BEGIN i := 0; m := 1; WHILE i < SIZE(LONGINT)*8 DO - l := 1; l := SYSTEM.LSH(l,i); ASSERT(l = m, 16); - l := 1; l := SYSTEM.ROT(l,i); ASSERT(l = m, 17); + l := 1; r := SYSTEM.LSH(l,i); TestShiftResult(l, i, r, m, "LSH"); + l := 1; r := SYSTEM.ROT(l,i); TestShiftResult(l, i, r, m, "ROT(1)"); m := m * 2; INC(i); END; @@ -84,9 +96,55 @@ BEGIN END; + (* Positive LSH shifts and ROTs with overflow *) + + i := 1; m := 1; + WHILE i < SIZE(LONGINT)*8 DO + l := MAX(LONGINT); INC(l); r := SYSTEM.LSH(l,i); TestShiftResult(l, i, r, 0, "LSH"); + l := MAX(LONGINT); INC(l); r := SYSTEM.ROT(l,i); TestShiftResult(l, i, r, m, "ROT(2)"); + m := m * 2; INC(i); + END; + + i := 1; k := 1; + WHILE i < SIZE(INTEGER)*8 DO + j := MAX(INTEGER); INC(j); r := SYSTEM.LSH(j,i); TestShiftResult(j, i, r, 0, "LSH"); + j := MAX(INTEGER); INC(j); r := SYSTEM.ROT(j,i); TestShiftResult(j, i, r, k, "ROT(3)"); + k := k * 2; INC(i); + END; + + i := 1; t := 1; + WHILE i < SIZE(SHORTINT)*8 DO + s := MAX(SHORTINT); INC(s); r := SYSTEM.LSH(s,i); TestShiftResult(s, i, r, 0, "LSH"); + s := MAX(SHORTINT); INC(s); r := SYSTEM.ROT(s,i); TestShiftResult(s, i, r, t, "ROT(4)"); + t := t * 2; INC(i); + END; + + (* Negative LSH shifts and ROTs without overflow *) + + i := -1; m := MAX(LONGINT); INC(m); + WHILE i > -SIZE(LONGINT)*8 DO + l := 1; r := SYSTEM.LSH(l,i); TestShiftResult(l, i, r, 0, "LSH"); + l := 1; r := SYSTEM.ROT(l,i); TestShiftResult(l, i, r, m, "ROT"); + m := SYSTEM.LSH(m,-1); (* m := m DIV 2; *) + DEC(i); + END; + + i := -1; k := MAX(INTEGER); INC(k); + WHILE i > -SIZE(INTEGER)*8 DO + j := 1; r := SYSTEM.LSH(j,i); TestShiftResult(j, i, r, 0, "LSH"); + j := 1; r := SYSTEM.ROT(j,i); TestShiftResult(j, i, r, k, "ROT"); + k := SYSTEM.LSH(k,-1); (* k := k DIV 2; *) + DEC(i); + END; + + i := -1; t := MAX(SHORTINT); INC(t); + WHILE i > -SIZE(SHORTINT)*8 DO + s := 1; r := SYSTEM.LSH(s,i); TestShiftResult(s, i, r, 0, "LSH"); + s := 1; r := SYSTEM.ROT(s,i); TestShiftResult(s, i, r, t, "ROT"); + t := SYSTEM.LSH(t,-1); (* t := t DIV 2; *) + DEC(i); + END; - (* Also need tests that bits that are shifted / rotated off the end - are zeroed or wrapped correctly. *) (* Also need full tests for CHAR, and poossibly SYSTEM.BYTE. Here's a simple one *) @@ -138,7 +196,6 @@ BEGIN => x MOd y = x - ((x DIV y) * y) *) - i := 4; j := 3; TestValue(i MOD j, i - ((i DIV j) * j), "4 MOD 3"); i := 5; j := 3; TestValue(i MOD j, i - ((i DIV j) * j), "5 MOD 3"); i := 6; j := 3; TestValue(i MOD j, i - ((i DIV j) * j), "6 MOD 3"); @@ -161,6 +218,8 @@ BEGIN END DivMod; + + PROCEDURE IntSize; VAR l: LONGINT; BEGIN @@ -187,6 +246,9 @@ BEGIN END; END IntSize; + + + BEGIN Shift; DivMod; diff --git a/src/test/confidence/planned-binary-change b/src/test/confidence/planned-binary-change index 3c9d13b0..ebcef2cb 100644 --- a/src/test/confidence/planned-binary-change +++ b/src/test/confidence/planned-binary-change @@ -1 +1 @@ -09 Sep 2016 14:20:47 +12 Sep 2016 15:40:20 diff --git a/src/tools/make/vishap.make b/src/tools/make/vishap.make index 838b5ef7..faacf33f 100644 --- a/src/tools/make/vishap.make +++ b/src/tools/make/vishap.make @@ -70,6 +70,8 @@ assemble: SYSTEM.o Configuration.o Platform.o Heap.o Console.o Strings.o Modules.o Files.o \ Reals.o Texts.o vt100.o errors.o OPM.o extTools.o OPS.o OPT.o \ OPC.o OPV.o OPB.o OPP.o + + cp src/system/*.[ch] $(BUILDDIR) @printf "$(VISHAP) created.\n" @@ -79,7 +81,9 @@ compilerfromsavedsource: @echo Populating clean build directory from bootstrap C sources. @mkdir -p $(BUILDDIR) @cp bootstrap/$(PLATFORM)-$(ADRSIZE)$(ALIGNMENT)/* $(BUILDDIR) + @cp bootstrap/*.[ch] $(BUILDDIR) @make -f src/tools/make/vishap.make -s assemble + @cp bootstrap/*.[ch] $(BUILDDIR) @@ -119,8 +123,6 @@ translate: cd $(BUILDDIR); $(ROOTDIR)/$(VISHAP) -SsfF -B$(INTSIZE)$(ADRSIZE)$(ALIGNMENT) ../../src/compiler/OPP.Mod cd $(BUILDDIR); $(ROOTDIR)/$(VISHAP) -Ssfm -B$(INTSIZE)$(ADRSIZE)$(ALIGNMENT) ../../src/compiler/Vishap.Mod - cp src/system/*.[ch] $(BUILDDIR) - @printf "$(BUILDDIR) filled with compiler C source.\n"