From 6dedf34785440708335a5581503a2cce74064b93 Mon Sep 17 00:00:00 2001 From: David Brown Date: Fri, 30 Sep 2016 16:38:22 +0100 Subject: [PATCH] SET32 and SET64 compatibility and bootstrap update. --- bootstrap/unix-44/Compiler.c | 24 ++++-- bootstrap/unix-44/Configuration.c | 11 +-- bootstrap/unix-44/Configuration.h | 2 +- bootstrap/unix-44/Console.c | 9 +- bootstrap/unix-44/Console.h | 2 +- bootstrap/unix-44/Files.c | 52 ++++-------- bootstrap/unix-44/Files.h | 10 +-- bootstrap/unix-44/Heap.c | 9 +- bootstrap/unix-44/Heap.h | 2 +- bootstrap/unix-44/Modules.c | 9 +- bootstrap/unix-44/Modules.h | 2 +- bootstrap/unix-44/OPB.c | 120 ++++++++++++++++----------- bootstrap/unix-44/OPB.h | 2 +- bootstrap/unix-44/OPC.c | 28 ++++--- bootstrap/unix-44/OPC.h | 2 +- bootstrap/unix-44/OPM.c | 33 ++++---- bootstrap/unix-44/OPM.h | 10 +-- bootstrap/unix-44/OPP.c | 13 +-- bootstrap/unix-44/OPP.h | 4 +- bootstrap/unix-44/OPS.c | 9 +- bootstrap/unix-44/OPS.h | 2 +- bootstrap/unix-44/OPT.c | 54 ++++++++---- bootstrap/unix-44/OPT.h | 11 +-- bootstrap/unix-44/OPV.c | 12 ++- bootstrap/unix-44/OPV.h | 2 +- bootstrap/unix-44/Platform.c | 15 ++-- bootstrap/unix-44/Platform.h | 4 +- bootstrap/unix-44/Reals.c | 9 +- bootstrap/unix-44/Reals.h | 2 +- bootstrap/unix-44/Strings.c | 9 +- bootstrap/unix-44/Strings.h | 2 +- bootstrap/unix-44/Texts.c | 13 +-- bootstrap/unix-44/Texts.h | 4 +- bootstrap/unix-44/errors.c | 9 +- bootstrap/unix-44/errors.h | 2 +- bootstrap/unix-44/extTools.c | 9 +- bootstrap/unix-44/extTools.h | 2 +- bootstrap/unix-44/vt100.c | 9 +- bootstrap/unix-44/vt100.h | 2 +- bootstrap/unix-48/Compiler.c | 24 ++++-- bootstrap/unix-48/Configuration.c | 11 +-- bootstrap/unix-48/Configuration.h | 2 +- bootstrap/unix-48/Console.c | 9 +- bootstrap/unix-48/Console.h | 2 +- bootstrap/unix-48/Files.c | 52 ++++-------- bootstrap/unix-48/Files.h | 10 +-- bootstrap/unix-48/Heap.c | 9 +- bootstrap/unix-48/Heap.h | 2 +- bootstrap/unix-48/Modules.c | 9 +- bootstrap/unix-48/Modules.h | 2 +- bootstrap/unix-48/OPB.c | 120 ++++++++++++++++----------- bootstrap/unix-48/OPB.h | 2 +- bootstrap/unix-48/OPC.c | 28 ++++--- bootstrap/unix-48/OPC.h | 2 +- bootstrap/unix-48/OPM.c | 33 ++++---- bootstrap/unix-48/OPM.h | 10 +-- bootstrap/unix-48/OPP.c | 13 +-- bootstrap/unix-48/OPP.h | 4 +- bootstrap/unix-48/OPS.c | 9 +- bootstrap/unix-48/OPS.h | 2 +- bootstrap/unix-48/OPT.c | 54 ++++++++---- bootstrap/unix-48/OPT.h | 11 +-- bootstrap/unix-48/OPV.c | 12 ++- bootstrap/unix-48/OPV.h | 2 +- bootstrap/unix-48/Platform.c | 15 ++-- bootstrap/unix-48/Platform.h | 4 +- bootstrap/unix-48/Reals.c | 9 +- bootstrap/unix-48/Reals.h | 2 +- bootstrap/unix-48/Strings.c | 9 +- bootstrap/unix-48/Strings.h | 2 +- bootstrap/unix-48/Texts.c | 13 +-- bootstrap/unix-48/Texts.h | 4 +- bootstrap/unix-48/errors.c | 9 +- bootstrap/unix-48/errors.h | 2 +- bootstrap/unix-48/extTools.c | 9 +- bootstrap/unix-48/extTools.h | 2 +- bootstrap/unix-48/vt100.c | 9 +- bootstrap/unix-48/vt100.h | 2 +- bootstrap/unix-88/Compiler.c | 24 ++++-- bootstrap/unix-88/Configuration.c | 11 +-- bootstrap/unix-88/Configuration.h | 2 +- bootstrap/unix-88/Console.c | 9 +- bootstrap/unix-88/Console.h | 2 +- bootstrap/unix-88/Files.c | 52 ++++-------- bootstrap/unix-88/Files.h | 10 +-- bootstrap/unix-88/Heap.c | 9 +- bootstrap/unix-88/Heap.h | 2 +- bootstrap/unix-88/Modules.c | 9 +- bootstrap/unix-88/Modules.h | 2 +- bootstrap/unix-88/OPB.c | 120 ++++++++++++++++----------- bootstrap/unix-88/OPB.h | 2 +- bootstrap/unix-88/OPC.c | 28 ++++--- bootstrap/unix-88/OPC.h | 2 +- bootstrap/unix-88/OPM.c | 33 ++++---- bootstrap/unix-88/OPM.h | 10 +-- bootstrap/unix-88/OPP.c | 13 +-- bootstrap/unix-88/OPP.h | 4 +- bootstrap/unix-88/OPS.c | 9 +- bootstrap/unix-88/OPS.h | 2 +- bootstrap/unix-88/OPT.c | 54 ++++++++---- bootstrap/unix-88/OPT.h | 11 +-- bootstrap/unix-88/OPV.c | 12 ++- bootstrap/unix-88/OPV.h | 2 +- bootstrap/unix-88/Platform.c | 15 ++-- bootstrap/unix-88/Platform.h | 4 +- bootstrap/unix-88/Reals.c | 9 +- bootstrap/unix-88/Reals.h | 2 +- bootstrap/unix-88/Strings.c | 9 +- bootstrap/unix-88/Strings.h | 2 +- bootstrap/unix-88/Texts.c | 13 +-- bootstrap/unix-88/Texts.h | 4 +- bootstrap/unix-88/errors.c | 9 +- bootstrap/unix-88/errors.h | 2 +- bootstrap/unix-88/extTools.c | 9 +- bootstrap/unix-88/extTools.h | 2 +- bootstrap/unix-88/vt100.c | 9 +- bootstrap/unix-88/vt100.h | 2 +- bootstrap/windows-48/Compiler.c | 24 ++++-- bootstrap/windows-48/Configuration.c | 11 +-- bootstrap/windows-48/Configuration.h | 2 +- bootstrap/windows-48/Console.c | 9 +- bootstrap/windows-48/Console.h | 2 +- bootstrap/windows-48/Files.c | 52 ++++-------- bootstrap/windows-48/Files.h | 10 +-- bootstrap/windows-48/Heap.c | 9 +- bootstrap/windows-48/Heap.h | 2 +- bootstrap/windows-48/Modules.c | 9 +- bootstrap/windows-48/Modules.h | 2 +- bootstrap/windows-48/OPB.c | 120 ++++++++++++++++----------- bootstrap/windows-48/OPB.h | 2 +- bootstrap/windows-48/OPC.c | 28 ++++--- bootstrap/windows-48/OPC.h | 2 +- bootstrap/windows-48/OPM.c | 33 ++++---- bootstrap/windows-48/OPM.h | 10 +-- bootstrap/windows-48/OPP.c | 13 +-- bootstrap/windows-48/OPP.h | 4 +- bootstrap/windows-48/OPS.c | 9 +- bootstrap/windows-48/OPS.h | 2 +- bootstrap/windows-48/OPT.c | 54 ++++++++---- bootstrap/windows-48/OPT.h | 11 +-- bootstrap/windows-48/OPV.c | 12 ++- bootstrap/windows-48/OPV.h | 2 +- bootstrap/windows-48/Platform.c | 9 +- bootstrap/windows-48/Platform.h | 2 +- bootstrap/windows-48/Reals.c | 9 +- bootstrap/windows-48/Reals.h | 2 +- bootstrap/windows-48/Strings.c | 9 +- bootstrap/windows-48/Strings.h | 2 +- bootstrap/windows-48/Texts.c | 13 +-- bootstrap/windows-48/Texts.h | 4 +- bootstrap/windows-48/errors.c | 9 +- bootstrap/windows-48/errors.h | 2 +- bootstrap/windows-48/extTools.c | 9 +- bootstrap/windows-48/extTools.h | 2 +- bootstrap/windows-48/vt100.c | 9 +- bootstrap/windows-48/vt100.h | 2 +- bootstrap/windows-88/Compiler.c | 24 ++++-- bootstrap/windows-88/Configuration.c | 11 +-- bootstrap/windows-88/Configuration.h | 2 +- bootstrap/windows-88/Console.c | 9 +- bootstrap/windows-88/Console.h | 2 +- bootstrap/windows-88/Files.c | 52 ++++-------- bootstrap/windows-88/Files.h | 10 +-- bootstrap/windows-88/Heap.c | 9 +- bootstrap/windows-88/Heap.h | 2 +- bootstrap/windows-88/Modules.c | 9 +- bootstrap/windows-88/Modules.h | 2 +- bootstrap/windows-88/OPB.c | 120 ++++++++++++++++----------- bootstrap/windows-88/OPB.h | 2 +- bootstrap/windows-88/OPC.c | 28 ++++--- bootstrap/windows-88/OPC.h | 2 +- bootstrap/windows-88/OPM.c | 33 ++++---- bootstrap/windows-88/OPM.h | 10 +-- bootstrap/windows-88/OPP.c | 13 +-- bootstrap/windows-88/OPP.h | 4 +- bootstrap/windows-88/OPS.c | 9 +- bootstrap/windows-88/OPS.h | 2 +- bootstrap/windows-88/OPT.c | 54 ++++++++---- bootstrap/windows-88/OPT.h | 11 +-- bootstrap/windows-88/OPV.c | 12 ++- bootstrap/windows-88/OPV.h | 2 +- bootstrap/windows-88/Platform.c | 9 +- bootstrap/windows-88/Platform.h | 2 +- bootstrap/windows-88/Reals.c | 9 +- bootstrap/windows-88/Reals.h | 2 +- bootstrap/windows-88/Strings.c | 9 +- bootstrap/windows-88/Strings.h | 2 +- bootstrap/windows-88/Texts.c | 13 +-- bootstrap/windows-88/Texts.h | 4 +- bootstrap/windows-88/errors.c | 9 +- bootstrap/windows-88/errors.h | 2 +- bootstrap/windows-88/extTools.c | 9 +- bootstrap/windows-88/extTools.h | 2 +- bootstrap/windows-88/vt100.c | 9 +- bootstrap/windows-88/vt100.h | 2 +- src/compiler/OPB.Mod | 14 +++- src/compiler/OPM.Mod | 24 +++++- src/compiler/OPT.Mod | 3 + src/runtime/Files.Mod | 33 +++----- src/runtime/LowReal.Mod | 69 ++++++++------- src/runtime/Math.Mod | 54 ++++++------ src/system/Files.Mod | 116 ++++++++++++-------------- 202 files changed, 1650 insertions(+), 1272 deletions(-) diff --git a/bootstrap/unix-44/Compiler.c b/bootstrap/unix-44/Compiler.c index 1b3b14f1..637fd329 100644 --- a/bootstrap/unix-44/Compiler.c +++ b/bootstrap/unix-44/Compiler.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -83,7 +84,6 @@ static void Compiler_PropagateElementaryTypeSizes (void) OPT_Struct adrinttyp = NIL; OPT_sysptrtyp->size = OPM_AddressSize; OPT_adrtyp->size = OPM_AddressSize; - OPT_settyp->size = OPM_SetSize; adrinttyp = OPT_IntType(OPM_AddressSize); OPT_adrtyp->strobj = adrinttyp->strobj; OPT_sinttyp = OPT_IntType(OPM_ShortintSize); @@ -92,6 +92,20 @@ static void Compiler_PropagateElementaryTypeSizes (void) OPT_sintobj->typ = OPT_sinttyp; OPT_intobj->typ = OPT_inttyp; OPT_lintobj->typ = OPT_linttyp; + switch (OPM_LongintSize) { + case 4: + OPT_settyp = OPT_set32typ; + break; + default: + OPT_settyp = OPT_set64typ; + break; + } + OPT_setobj->typ = OPT_settyp; + if (__STRCMP(OPM_Model, "C") == 0) { + OPT_cpbytetyp->strobj->name[4] = 0x00; + } else { + OPT_cpbytetyp->strobj->name[4] = '@'; + } } void Compiler_Translate (void) diff --git a/bootstrap/unix-44/Configuration.c b/bootstrap/unix-44/Configuration.c index 85c8cf89..a3240e8e 100644 --- a/bootstrap/unix-44/Configuration.c +++ b/bootstrap/unix-44/Configuration.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" @@ -18,6 +19,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); + __MOVE("1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); __ENDMOD; } diff --git a/bootstrap/unix-44/Configuration.h b/bootstrap/unix-44/Configuration.h index a365d693..4d4279da 100644 --- a/bootstrap/unix-44/Configuration.h +++ b/bootstrap/unix-44/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/unix-44/Console.c b/bootstrap/unix-44/Console.c index c2089f05..206f8024 100644 --- a/bootstrap/unix-44/Console.c +++ b/bootstrap/unix-44/Console.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Platform.h" diff --git a/bootstrap/unix-44/Console.h b/bootstrap/unix-44/Console.h index 08f4e38e..6549e2cc 100644 --- a/bootstrap/unix-44/Console.h +++ b/bootstrap/unix-44/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/unix-44/Files.c b/bootstrap/unix-44/Files.c index 4800d53c..b1a7e280 100644 --- a/bootstrap/unix-44/Files.c +++ b/bootstrap/unix-44/Files.c @@ -1,13 +1,13 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" -#include "Configuration.h" -#include "Console.h" #include "Heap.h" +#include "Console.h" #include "Platform.h" #include "Strings.h" @@ -89,9 +89,8 @@ export void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x); export void Files_ReadLReal (Files_Rider *R, address *R__typ, LONGREAL *x); export void Files_ReadLine (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); export void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x); -export void Files_ReadNum64 (Files_Rider *R, address *R__typ, int64 *x); export void Files_ReadReal (Files_Rider *R, address *R__typ, REAL *x); -export void Files_ReadSet (Files_Rider *R, address *R__typ, SET *x); +export void Files_ReadSet (Files_Rider *R, address *R__typ, uint32 *x); export void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); export void Files_Register (Files_File f); export void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int16 *res); @@ -104,13 +103,13 @@ export void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, L export void Files_WriteInt (Files_Rider *R, address *R__typ, int16 x); export void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x); export void Files_WriteLReal (Files_Rider *R, address *R__typ, LONGREAL x); -export void Files_WriteNum (Files_Rider *R, address *R__typ, int32 x); -export void Files_WriteNum64 (Files_Rider *R, address *R__typ, int64 x); +export void Files_WriteNum (Files_Rider *R, address *R__typ, int64 x); export void Files_WriteReal (Files_Rider *R, address *R__typ, REAL x); -export void Files_WriteSet (Files_Rider *R, address *R__typ, SET x); +export void Files_WriteSet (Files_Rider *R, address *R__typ, uint32 x); export void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); #define Files_IdxTrap() __HALT(-1) +#define Files_ToAdr(x) (address)x static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int16 errcode) { @@ -662,7 +661,7 @@ void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x } else { min = n; } - __MOVE(((address)buf->data) + offset, ((address)x) + xpos, min); + __MOVE((address)buf->data + Files_ToAdr(offset), (address)x + Files_ToAdr(xpos), min); offset += min; (*r).offset = offset; xpos += min; @@ -722,7 +721,7 @@ void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT } else { min = n; } - __MOVE(((address)x) + xpos, ((address)buf->data) + offset, min); + __MOVE((address)x + Files_ToAdr(xpos), (address)buf->data + Files_ToAdr(offset), min); offset += min; (*r).offset = offset; if (offset > buf->size) { @@ -862,13 +861,13 @@ void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x) *x = (((int16)b[0] + __ASHL((int16)b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24); } -void Files_ReadSet (Files_Rider *R, address *R__typ, SET *x) +void Files_ReadSet (Files_Rider *R, address *R__typ, uint32 *x) { CHAR b[4]; int32 l; Files_ReadBytes(&*R, R__typ, (void*)b, 4, 4); l = (((int16)b[0] + __ASHL((int16)b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24); - *x = (SET)l; + *x = (uint32)l; } void Files_ReadReal (Files_Rider *R, address *R__typ, REAL *x) @@ -932,13 +931,6 @@ void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x) *x = n; } -void Files_ReadNum64 (Files_Rider *R, address *R__typ, int64 *x) -{ - int32 n; - Files_ReadNum(&*R, R__typ, &n); - *x = n; -} - void Files_WriteBool (Files_Rider *R, address *R__typ, BOOLEAN x) { Files_Write(&*R, R__typ, __VAL(CHAR, x)); @@ -962,7 +954,7 @@ void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x) Files_WriteBytes(&*R, R__typ, (void*)b, 4, 4); } -void Files_WriteSet (Files_Rider *R, address *R__typ, SET x) +void Files_WriteSet (Files_Rider *R, address *R__typ, uint32 x) { CHAR b[4]; int32 i; @@ -998,16 +990,7 @@ void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len Files_WriteBytes(&*R, R__typ, (void*)x, x__len * 1, i + 1); } -void Files_WriteNum (Files_Rider *R, address *R__typ, int32 x) -{ - while (x < -64 || x > 63) { - Files_Write(&*R, R__typ, (CHAR)(__MASK(x, -128) + 128)); - x = __ASHR(x, 7); - } - Files_Write(&*R, R__typ, (CHAR)__MASK(x, -128)); -} - -void Files_WriteNum64 (Files_Rider *R, address *R__typ, int64 x) +void Files_WriteNum (Files_Rider *R, address *R__typ, int64 x) { while (x < -64 || x > 63) { Files_Write(&*R, R__typ, (CHAR)(__MASK(x, -128) + 128)); @@ -1059,9 +1042,8 @@ __TDESC(Files_Rider, 1, 1) = {__TDFLDS("Rider", 20), {8, -8}}; export void *Files__init(void) { __DEFMOD; - __MODULE_IMPORT(Configuration); - __MODULE_IMPORT(Console); __MODULE_IMPORT(Heap); + __MODULE_IMPORT(Console); __MODULE_IMPORT(Platform); __MODULE_IMPORT(Strings); __REGMOD("Files", EnumPtrs); diff --git a/bootstrap/unix-44/Files.h b/bootstrap/unix-44/Files.h index 55e5fa16..fd146132 100644 --- a/bootstrap/unix-44/Files.h +++ b/bootstrap/unix-44/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ #ifndef Files__h #define Files__h @@ -46,9 +46,8 @@ import void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x); import void Files_ReadLReal (Files_Rider *R, address *R__typ, LONGREAL *x); import void Files_ReadLine (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); import void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x); -import void Files_ReadNum64 (Files_Rider *R, address *R__typ, int64 *x); import void Files_ReadReal (Files_Rider *R, address *R__typ, REAL *x); -import void Files_ReadSet (Files_Rider *R, address *R__typ, SET *x); +import void Files_ReadSet (Files_Rider *R, address *R__typ, uint32 *x); import void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); import void Files_Register (Files_File f); import void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int16 *res); @@ -60,10 +59,9 @@ import void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, L import void Files_WriteInt (Files_Rider *R, address *R__typ, int16 x); import void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x); import void Files_WriteLReal (Files_Rider *R, address *R__typ, LONGREAL x); -import void Files_WriteNum (Files_Rider *R, address *R__typ, int32 x); -import void Files_WriteNum64 (Files_Rider *R, address *R__typ, int64 x); +import void Files_WriteNum (Files_Rider *R, address *R__typ, int64 x); import void Files_WriteReal (Files_Rider *R, address *R__typ, REAL x); -import void Files_WriteSet (Files_Rider *R, address *R__typ, SET x); +import void Files_WriteSet (Files_Rider *R, address *R__typ, uint32 x); import void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); import void *Files__init(void); diff --git a/bootstrap/unix-44/Heap.c b/bootstrap/unix-44/Heap.c index 1f66b283..b3eea6a3 100644 --- a/bootstrap/unix-44/Heap.c +++ b/bootstrap/unix-44/Heap.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/unix-44/Heap.h b/bootstrap/unix-44/Heap.h index 9e9400e1..a7135c5b 100644 --- a/bootstrap/unix-44/Heap.h +++ b/bootstrap/unix-44/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/unix-44/Modules.c b/bootstrap/unix-44/Modules.c index f165488e..2984f32f 100644 --- a/bootstrap/unix-44/Modules.c +++ b/bootstrap/unix-44/Modules.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Console.h" diff --git a/bootstrap/unix-44/Modules.h b/bootstrap/unix-44/Modules.h index a2ceebdf..9b84521f 100644 --- a/bootstrap/unix-44/Modules.h +++ b/bootstrap/unix-44/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/unix-44/OPB.c b/bootstrap/unix-44/OPB.c index e370e621..d099cad7 100644 --- a/bootstrap/unix-44/OPB.c +++ b/bootstrap/unix-44/OPB.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPM.h" @@ -55,6 +56,7 @@ export void OPB_Return (OPT_Node *x, OPT_Object proc); export void OPB_SetElem (OPT_Node *x); static void OPB_SetIntType (OPT_Node node); export void OPB_SetRange (OPT_Node *x, OPT_Node y); +static void OPB_SetSetType (OPT_Node node); export void OPB_StFct (OPT_Node *par0, int8 fctno, int16 parno); export void OPB_StPar0 (OPT_Node *par0, int16 fctno); export void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno); @@ -223,6 +225,17 @@ static void OPB_SetIntType (OPT_Node node) node->typ = OPT_IntType(OPT_IntSize(node->conval->intval)); } +static void OPB_SetSetType (OPT_Node node) +{ + int32 i32; + __GET((address)&node->conval->setval + 4, i32, int32); + if (i32 == 0) { + node->typ = OPT_set32typ; + } else { + node->typ = OPT_set64typ; + } +} + OPT_Node OPB_NewIntConst (int64 intval) { OPT_Node _o_result; @@ -364,16 +377,16 @@ void OPB_Field (OPT_Node *x, OPT_Object y) } } -static struct TypTest__57 { +static struct TypTest__58 { OPT_Node *x; OPT_Object *obj; BOOLEAN *guard; - struct TypTest__57 *lnk; -} *TypTest__57_s; + struct TypTest__58 *lnk; +} *TypTest__58_s; -static void GTT__58 (OPT_Struct t0, OPT_Struct t1); +static void GTT__59 (OPT_Struct t0, OPT_Struct t1); -static void GTT__58 (OPT_Struct t0, OPT_Struct t1) +static void GTT__59 (OPT_Struct t0, OPT_Struct t1) { OPT_Node node = NIL; OPT_Struct t = NIL; @@ -386,54 +399,54 @@ static void GTT__58 (OPT_Struct t0, OPT_Struct t1) t1 = t1->BaseTyp; } if (t1 == t0 || t0->form == 0) { - if (*TypTest__57_s->guard) { - OPB_BindNodes(5, NIL, &*TypTest__57_s->x, NIL); - (*TypTest__57_s->x)->readonly = (*TypTest__57_s->x)->left->readonly; + if (*TypTest__58_s->guard) { + OPB_BindNodes(5, NIL, &*TypTest__58_s->x, NIL); + (*TypTest__58_s->x)->readonly = (*TypTest__58_s->x)->left->readonly; } else { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__57_s->x; - node->obj = *TypTest__57_s->obj; - *TypTest__57_s->x = node; + node->left = *TypTest__58_s->x; + node->obj = *TypTest__58_s->obj; + *TypTest__58_s->x = node; } } else { OPB_err(85); } } else if (t0 != t1) { OPB_err(85); - } else if (!*TypTest__57_s->guard) { - if ((*TypTest__57_s->x)->class == 5) { + } else if (!*TypTest__58_s->guard) { + if ((*TypTest__58_s->x)->class == 5) { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__57_s->x; - node->obj = *TypTest__57_s->obj; - *TypTest__57_s->x = node; + node->left = *TypTest__58_s->x; + node->obj = *TypTest__58_s->obj; + *TypTest__58_s->x = node; } else { - *TypTest__57_s->x = OPB_NewBoolConst(1); + *TypTest__58_s->x = OPB_NewBoolConst(1); } } } void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) { - struct TypTest__57 _s; + struct TypTest__58 _s; _s.x = x; _s.obj = &obj; _s.guard = &guard; - _s.lnk = TypTest__57_s; - TypTest__57_s = &_s; + _s.lnk = TypTest__58_s; + TypTest__58_s = &_s; if (OPB_NotVar(*x)) { OPB_err(112); } else if ((*x)->typ->form == 11) { if (((*x)->typ->BaseTyp->comp != 4 && (*x)->typ != OPT_sysptrtyp)) { OPB_err(85); } else if (obj->typ->form == 11) { - GTT__58((*x)->typ->BaseTyp, obj->typ->BaseTyp); + GTT__59((*x)->typ->BaseTyp, obj->typ->BaseTyp); } else { OPB_err(86); } } else if (((((*x)->typ->comp == 4 && (*x)->class == 1)) && obj->typ->comp == 4)) { - GTT__58((*x)->typ, obj->typ); + GTT__59((*x)->typ, obj->typ); } else { OPB_err(87); } @@ -442,7 +455,7 @@ void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) } else { (*x)->typ = OPT_booltyp; } - TypTest__57_s = _s.lnk; + TypTest__58_s = _s.lnk; } void OPB_In (OPT_Node *x, OPT_Node y) @@ -1109,7 +1122,13 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) f = (*x)->typ->form; g = typ->form; if ((*x)->class == 7) { - if (f == 4) { + if ((((f == 7 && g == 7)) && (*x)->typ->size > typ->size)) { + OPB_SetSetType(*x); + if ((*x)->typ->size > typ->size) { + OPB_err(203); + (*x)->conval->setval = 0x0; + } + } else if (f == 4) { if (g == 4) { if ((*x)->typ->size > typ->size) { OPB_SetIntType(*x); @@ -1243,6 +1262,13 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y) OPB_err(100); } break; + case 7: + if ((g == 7 && y->typ->size < z->typ->size)) { + OPB_Convert(&y, z->typ); + } else { + OPB_err(100); + } + break; case 5: if (g == 4) { OPB_Convert(&y, z->typ); @@ -1969,13 +1995,13 @@ void OPB_StPar0 (OPT_Node *par0, int16 fctno) *par0 = x; } -static struct StPar1__52 { - struct StPar1__52 *lnk; -} *StPar1__52_s; +static struct StPar1__53 { + struct StPar1__53 *lnk; +} *StPar1__53_s; -static OPT_Node NewOp__53 (int8 class, int8 subcl, OPT_Node left, OPT_Node right); +static OPT_Node NewOp__54 (int8 class, int8 subcl, OPT_Node left, OPT_Node right); -static OPT_Node NewOp__53 (int8 class, int8 subcl, OPT_Node left, OPT_Node right) +static OPT_Node NewOp__54 (int8 class, int8 subcl, OPT_Node left, OPT_Node right) { OPT_Node _o_result; OPT_Node node = NIL; @@ -1992,9 +2018,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) int16 f, L; OPT_Struct typ = NIL; OPT_Node p = NIL, t = NIL; - struct StPar1__52 _s; - _s.lnk = StPar1__52_s; - StPar1__52_s = &_s; + struct StPar1__53 _s; + _s.lnk = StPar1__53_s; + StPar1__53_s = &_s; p = *par0; f = x->typ->form; switch (fctno) { @@ -2010,7 +2036,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) OPB_err(111); } } - p = NewOp__53(19, fctno, p, x); + p = NewOp__54(19, fctno, p, x); p->typ = OPT_notyp; } break; @@ -2021,7 +2047,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (int64)OPM_MaxSet))) { OPB_err(202); } - p = NewOp__53(19, fctno, p, x); + p = NewOp__54(19, fctno, p, x); } else { OPB_err(111); } @@ -2046,7 +2072,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) p = p->left; x->conval->intval += 1; } - p = NewOp__53(12, 19, p, x); + p = NewOp__54(12, 19, p, x); p->typ = OPT_linttyp; } else { p = x; @@ -2068,7 +2094,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) t = x; x = p; p = t; - p = NewOp__53(19, 18, p, x); + p = NewOp__54(19, 18, p, x); } else { OPB_err(111); } @@ -2094,7 +2120,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) } p->obj = NIL; } else { - p = NewOp__53(12, 17, p, x); + p = NewOp__54(12, 17, p, x); p->typ = p->left->typ; } } else { @@ -2125,9 +2151,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) OPB_err(111); } else { if (fctno == 22) { - p = NewOp__53(12, 27, p, x); + p = NewOp__54(12, 27, p, x); } else { - p = NewOp__53(12, 28, p, x); + p = NewOp__54(12, 28, p, x); } p->typ = p->left->typ; } @@ -2144,7 +2170,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) x = p; p = t; } - p = NewOp__53(19, fctno, p, x); + p = NewOp__54(19, fctno, p, x); } else { OPB_err(111); } @@ -2154,7 +2180,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) if (x->class == 8 || x->class == 9) { OPB_err(126); } else if (f == 4) { - p = NewOp__53(12, 26, p, x); + p = NewOp__54(12, 26, p, x); } else { OPB_err(111); } @@ -2182,7 +2208,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) if (x->class == 8 || x->class == 9) { OPB_err(126); } else if (f == 4) { - p = NewOp__53(19, 30, p, x); + p = NewOp__54(19, 30, p, x); } else { OPB_err(111); } @@ -2228,7 +2254,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) break; } *par0 = p; - StPar1__52_s = _s.lnk; + StPar1__53_s = _s.lnk; } void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n) diff --git a/bootstrap/unix-44/OPB.h b/bootstrap/unix-44/OPB.h index 8c0fd594..07dda5db 100644 --- a/bootstrap/unix-44/OPB.h +++ b/bootstrap/unix-44/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/unix-44/OPC.c b/bootstrap/unix-44/OPC.c index 4c9ae495..545deb33 100644 --- a/bootstrap/unix-44/OPC.c +++ b/bootstrap/unix-44/OPC.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -193,11 +194,15 @@ void OPC_Ident (OPT_Object obj) OPM_Write('_'); } } - } else if ((mode == 5 && obj->typ->form == 4)) { + } else if ((mode == 5 && __IN(obj->typ->form, 0x90, 32))) { if (obj->typ == OPT_adrtyp) { OPM_WriteString((CHAR*)"address", 8); } else { - OPM_WriteString((CHAR*)"int", 4); + if (obj->typ->form == 4) { + OPM_WriteString((CHAR*)"int", 4); + } else { + OPM_WriteString((CHAR*)"uint", 5); + } OPM_WriteInt(__ASHL(obj->typ->size, 3)); } } else { @@ -1233,13 +1238,16 @@ void OPC_GenBdy (OPT_Node n) OPM_currFile = 1; OPC_GenHeaderMsg(); OPM_WriteLn(); - OPM_WriteString((CHAR*)"#define INTEGER int", 20); + OPM_WriteString((CHAR*)"#define SHORTINT int", 21); + OPM_WriteInt(__ASHL(OPT_sinttyp->size, 3)); + OPM_WriteLn(); + OPM_WriteString((CHAR*)"#define INTEGER int", 21); OPM_WriteInt(__ASHL(OPT_inttyp->size, 3)); OPM_WriteLn(); - OPM_WriteString((CHAR*)"#define LONGINT int", 20); + OPM_WriteString((CHAR*)"#define LONGINT int", 21); OPM_WriteInt(__ASHL(OPT_linttyp->size, 3)); OPM_WriteLn(); - OPM_WriteString((CHAR*)"#define SET uint", 21); + OPM_WriteString((CHAR*)"#define SET uint", 22); OPM_WriteInt(__ASHL(OPT_settyp->size, 3)); OPM_WriteLn(); OPM_WriteLn(); @@ -1851,7 +1859,7 @@ void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim) void OPC_Constant (OPT_Const con, int16 form) { int16 i; - SET s; + uint32 s; int32 hex; BOOLEAN skipLeading; switch (form) { diff --git a/bootstrap/unix-44/OPC.h b/bootstrap/unix-44/OPC.h index e681f43d..c9cf0ace 100644 --- a/bootstrap/unix-44/OPC.h +++ b/bootstrap/unix-44/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/unix-44/OPM.c b/bootstrap/unix-44/OPM.c index 534a5c0d..32bb978e 100644 --- a/bootstrap/unix-44/OPM.c +++ b/bootstrap/unix-44/OPM.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -25,7 +26,7 @@ static int16 OPM_GlobalAddressSize; export int16 OPM_AddressSize; static int16 OPM_GlobalAlignment; export int16 OPM_Alignment; -export SET OPM_GlobalOptions, OPM_Options; +export uint32 OPM_GlobalOptions, OPM_Options; export int16 OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_SetSize, OPM_MaxSet; export int64 OPM_MaxIndex; export LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal; @@ -52,7 +53,7 @@ export void OPM_DeleteNewSym (void); export void OPM_FPrint (int32 *fp, int64 val); export void OPM_FPrintLReal (int32 *fp, LONGREAL lr); export void OPM_FPrintReal (int32 *fp, REAL real); -export void OPM_FPrintSet (int32 *fp, SET set); +export void OPM_FPrintSet (int32 *fp, uint32 set); static void OPM_FindLine (Files_File f, Files_Rider *r, address *r__typ, int64 pos); export void OPM_Get (CHAR *ch); export void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); @@ -80,12 +81,12 @@ export int32 OPM_SymRInt (void); export int64 OPM_SymRInt64 (void); export void OPM_SymRLReal (LONGREAL *lr); export void OPM_SymRReal (REAL *r); -export void OPM_SymRSet (SET *s); +export void OPM_SymRSet (uint32 *s); export void OPM_SymWCh (CHAR ch); export void OPM_SymWInt (int64 i); export void OPM_SymWLReal (LONGREAL lr); export void OPM_SymWReal (REAL r); -export void OPM_SymWSet (SET s); +export void OPM_SymWSet (uint32 s); static void OPM_VerboseListSizes (void); export void OPM_Write (CHAR ch); export void OPM_WriteHex (int64 i); @@ -329,7 +330,7 @@ BOOLEAN OPM_OpenPar (void) OPM_LogWStr((CHAR*)" -V Display compiler debugging messages.", 46); OPM_LogWLn(); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" Size model for elementary types (default O2 on 32 bit builds, OV on 64 bits)", 79); + OPM_LogWStr((CHAR*)" Size model for elementary types (default O2)", 47); OPM_LogWLn(); OPM_LogWStr((CHAR*)" -O2 Original Oberon / Oberon-2: 8 bit SHORTINT, 16 bit INTEGER, 32 bit LONGINT and SET.", 95); OPM_LogWLn(); @@ -709,10 +710,10 @@ void OPM_err (int16 n) void OPM_FPrint (int32 *fp, int64 val) { - *fp = __ROTL((int32)((SET)*fp ^ __VAL(SET, val)), 1, 32); + *fp = __ROTL((int32)((uint32)*fp ^ __VAL(uint32, val)), 1, 32); } -void OPM_FPrintSet (int32 *fp, SET set) +void OPM_FPrintSet (int32 *fp, uint32 set) { OPM_FPrint(&*fp, (int32)set); } @@ -751,13 +752,11 @@ int32 OPM_SymRInt (void) int64 OPM_SymRInt64 (void) { int64 _o_result; - int64 k; - Files_ReadNum64(&OPM_oldSF, Files_Rider__typ, &k); - _o_result = k; + _o_result = OPM_SymRInt(); return _o_result; } -void OPM_SymRSet (SET *s) +void OPM_SymRSet (uint32 *s) { Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (int32*)&*s); } @@ -808,10 +807,10 @@ void OPM_SymWCh (CHAR ch) void OPM_SymWInt (int64 i) { - Files_WriteNum64(&OPM_newSF, Files_Rider__typ, i); + Files_WriteNum(&OPM_newSF, Files_Rider__typ, i); } -void OPM_SymWSet (SET s) +void OPM_SymWSet (uint32 s) { Files_WriteNum(&OPM_newSF, Files_Rider__typ, (int32)s); } diff --git a/bootstrap/unix-44/OPM.h b/bootstrap/unix-44/OPM.h index 933ef1b5..dd3c0c27 100644 --- a/bootstrap/unix-44/OPM.h +++ b/bootstrap/unix-44/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPM__h #define OPM__h @@ -8,7 +8,7 @@ import CHAR OPM_Model[10]; import int16 OPM_AddressSize, OPM_Alignment; -import SET OPM_GlobalOptions, OPM_Options; +import uint32 OPM_GlobalOptions, OPM_Options; import int16 OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_SetSize, OPM_MaxSet; import int64 OPM_MaxIndex; import LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal; @@ -26,7 +26,7 @@ import void OPM_DeleteNewSym (void); import void OPM_FPrint (int32 *fp, int64 val); import void OPM_FPrintLReal (int32 *fp, LONGREAL lr); import void OPM_FPrintReal (int32 *fp, REAL real); -import void OPM_FPrintSet (int32 *fp, SET set); +import void OPM_FPrintSet (int32 *fp, uint32 set); import void OPM_Get (CHAR *ch); import void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); import void OPM_InitOptions (void); @@ -49,12 +49,12 @@ import int32 OPM_SymRInt (void); import int64 OPM_SymRInt64 (void); import void OPM_SymRLReal (LONGREAL *lr); import void OPM_SymRReal (REAL *r); -import void OPM_SymRSet (SET *s); +import void OPM_SymRSet (uint32 *s); import void OPM_SymWCh (CHAR ch); import void OPM_SymWInt (int64 i); import void OPM_SymWLReal (LONGREAL lr); import void OPM_SymWReal (REAL r); -import void OPM_SymWSet (SET s); +import void OPM_SymWSet (uint32 s); import void OPM_Write (CHAR ch); import void OPM_WriteHex (int64 i); import void OPM_WriteInt (int64 i); diff --git a/bootstrap/unix-44/OPP.c b/bootstrap/unix-44/OPP.c index 010efab1..1eff447d 100644 --- a/bootstrap/unix-44/OPP.c +++ b/bootstrap/unix-44/OPP.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPB.h" @@ -39,7 +40,7 @@ static void OPP_Expression (OPT_Node *x); static BOOLEAN OPP_Extends (OPT_Struct x, OPT_Struct b); static void OPP_Factor (OPT_Node *x); static void OPP_FormalParameters (OPT_Object *firstPar, OPT_Struct *resTyp); -export void OPP_Module (OPT_Node *prog, SET opt); +export void OPP_Module (OPT_Node *prog, uint32 opt); static void OPP_PointerType (OPT_Struct *typ); static void OPP_ProcedureDeclaration (OPT_Node *x); static void OPP_Receiver (int8 *mode, OPS_Name name, OPT_Struct *typ, OPT_Struct *rec); @@ -1775,7 +1776,7 @@ static void OPP_Block (OPT_Node *procdec, OPT_Node *statseq) OPP_CheckSym(41); } -void OPP_Module (OPT_Node *prog, SET opt) +void OPP_Module (OPT_Node *prog, uint32 opt) { OPS_Name impName, aliasName; OPT_Node procdec = NIL, statseq = NIL; diff --git a/bootstrap/unix-44/OPP.h b/bootstrap/unix-44/OPP.h index 373d8daa..c759545a 100644 --- a/bootstrap/unix-44/OPP.h +++ b/bootstrap/unix-44/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPP__h #define OPP__h @@ -9,7 +9,7 @@ -import void OPP_Module (OPT_Node *prog, SET opt); +import void OPP_Module (OPT_Node *prog, uint32 opt); import void *OPP__init(void); diff --git a/bootstrap/unix-44/OPS.c b/bootstrap/unix-44/OPS.c index f8ed61bf..18c3c066 100644 --- a/bootstrap/unix-44/OPS.c +++ b/bootstrap/unix-44/OPS.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPM.h" diff --git a/bootstrap/unix-44/OPS.h b/bootstrap/unix-44/OPS.h index 1f02668b..260fcd01 100644 --- a/bootstrap/unix-44/OPS.h +++ b/bootstrap/unix-44/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/unix-44/OPT.c b/bootstrap/unix-44/OPT.c index 7efc4cc4..9682088a 100644 --- a/bootstrap/unix-44/OPT.c +++ b/bootstrap/unix-44/OPT.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPM.h" @@ -19,7 +20,7 @@ typedef OPT_ConstExt ext; int64 intval; int32 intval2; - SET setval; + uint32 setval; LONGREAL realval; } OPT_ConstDesc; @@ -88,8 +89,8 @@ typedef export OPT_Object OPT_topScope; -export OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_adrtyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp; -export OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj; +export OPT_Struct OPT_undftyp, OPT_niltyp, OPT_notyp, OPT_bytetyp, OPT_cpbytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_settyp, OPT_set32typ, OPT_set64typ, OPT_realtyp, OPT_lrltyp, OPT_stringtyp, OPT_adrtyp, OPT_sysptrtyp; +export OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj, OPT_setobj; export int8 OPT_nofGmod; export OPT_Object OPT_GlbMod[64]; export OPS_Name OPT_SelfName; @@ -137,7 +138,7 @@ static void OPT_InSign (int8 mno, OPT_Struct *res, OPT_Object *par); static void OPT_InStruct (OPT_Struct *typ); static OPT_Object OPT_InTProc (int8 mno); static OPT_Struct OPT_InTyp (int32 tag); -export void OPT_Init (OPS_Name name, SET opt); +export void OPT_Init (OPS_Name name, uint32 opt); export void OPT_InitRecno (void); static void OPT_InitStruct (OPT_Struct *typ, int8 form); export void OPT_Insert (OPS_Name name, OPT_Object *obj); @@ -159,6 +160,7 @@ static void OPT_OutObj (OPT_Object obj); static void OPT_OutSign (OPT_Struct result, OPT_Object par); static void OPT_OutStr (OPT_Struct typ); static void OPT_OutTProcs (OPT_Struct typ, OPT_Object obj); +export OPT_Struct OPT_SetType (int32 size); export OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir); export int32 OPT_SizeAlignment (int32 size); export void OPT_TypSize (OPT_Struct typ); @@ -209,6 +211,17 @@ OPT_Struct OPT_IntType (int32 size) return _o_result; } +OPT_Struct OPT_SetType (int32 size) +{ + OPT_Struct _o_result; + if (size == OPT_set32typ->size) { + _o_result = OPT_set32typ; + return _o_result; + } + _o_result = OPT_set64typ; + return _o_result; +} + OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir) { OPT_Struct _o_result; @@ -449,7 +462,7 @@ void OPT_CloseScope (void) OPT_topScope = OPT_topScope->left; } -void OPT_Init (OPS_Name name, SET opt) +void OPT_Init (OPS_Name name, uint32 opt) { OPT_topScope = OPT_universe; OPT_OpenScope(0, NIL); @@ -1171,6 +1184,9 @@ static OPT_Struct OPT_InTyp (int32 tag) if (tag == 4) { _o_result = OPT_IntType(OPM_SymRInt()); return _o_result; + } else if (tag == 7) { + _o_result = OPT_SetType(OPM_SymRInt()); + return _o_result; } else { _o_result = OPT_impCtxt.ref[__X(tag, 255)]; return _o_result; @@ -1628,7 +1644,7 @@ static void OPT_OutStr (OPT_Struct typ) OPT_Object strobj = NIL; if (typ->ref < OPT_expCtxt.ref) { OPM_SymWInt(-typ->ref); - if (typ->ref == 4) { + if (__IN(typ->ref, 0x90, 32)) { OPM_SymWInt(typ->size); } } else { @@ -1732,6 +1748,7 @@ static void OPT_OutConstant (OPT_Object obj) break; case 7: OPM_SymWSet(obj->conval->setval); + OPM_SymWInt(obj->typ->size); break; case 5: rval = obj->conval->realval; @@ -1959,28 +1976,32 @@ static void EnumPtrs(void (*P)(void*)) { P(OPT_topScope); P(OPT_undftyp); + P(OPT_niltyp); + P(OPT_notyp); P(OPT_bytetyp); + P(OPT_cpbytetyp); P(OPT_booltyp); P(OPT_chartyp); P(OPT_sinttyp); P(OPT_inttyp); P(OPT_linttyp); P(OPT_hinttyp); - P(OPT_adrtyp); P(OPT_int8typ); P(OPT_int16typ); P(OPT_int32typ); P(OPT_int64typ); + P(OPT_settyp); + P(OPT_set32typ); + P(OPT_set64typ); P(OPT_realtyp); P(OPT_lrltyp); - P(OPT_settyp); P(OPT_stringtyp); - P(OPT_niltyp); - P(OPT_notyp); + P(OPT_adrtyp); P(OPT_sysptrtyp); P(OPT_sintobj); P(OPT_intobj); P(OPT_lintobj); + P(OPT_setobj); __ENUMP(OPT_GlbMod, 64, P); P(OPT_universe); P(OPT_syslink); @@ -2056,6 +2077,8 @@ export void *OPT__init(void) OPT_EnterTyp((CHAR*)"INT16", 4, 2, &OPT_int16typ); OPT_EnterTyp((CHAR*)"INT32", 4, 4, &OPT_int32typ); OPT_EnterTyp((CHAR*)"INT64", 4, 8, &OPT_int64typ); + OPT_EnterTyp((CHAR*)"SET32", 7, 4, &OPT_set32typ); + OPT_EnterTyp((CHAR*)"SET64", 7, 8, &OPT_set64typ); OPT_EnterProc((CHAR*)"ADR", 20); OPT_EnterProc((CHAR*)"CC", 21); OPT_EnterProc((CHAR*)"LSH", 22); @@ -2073,13 +2096,14 @@ export void *OPT__init(void) OPT_topScope->right = NIL; OPT_EnterTyp((CHAR*)"BOOLEAN", 2, 1, &OPT_booltyp); OPT_EnterTyp((CHAR*)"CHAR", 3, 1, &OPT_chartyp); - OPT_EnterTyp((CHAR*)"SET", 7, -1, &OPT_settyp); OPT_EnterTyp((CHAR*)"REAL", 5, 4, &OPT_realtyp); OPT_EnterTyp((CHAR*)"LONGREAL", 6, 8, &OPT_lrltyp); OPT_EnterTyp((CHAR*)"HUGEINT", 4, 8, &OPT_hinttyp); + OPT_EnterTyp((CHAR*)"BYTE@", 4, 1, &OPT_cpbytetyp); OPT_EnterTypeAlias((CHAR*)"SHORTINT", &OPT_sintobj); OPT_EnterTypeAlias((CHAR*)"INTEGER", &OPT_intobj); OPT_EnterTypeAlias((CHAR*)"LONGINT", &OPT_lintobj); + OPT_EnterTypeAlias((CHAR*)"SET", &OPT_setobj); OPT_EnterBoolConst((CHAR*)"FALSE", 0); OPT_EnterBoolConst((CHAR*)"TRUE", 1); OPT_EnterProc((CHAR*)"HALT", 0); diff --git a/bootstrap/unix-44/OPT.h b/bootstrap/unix-44/OPT.h index 202c8278..2bc05576 100644 --- a/bootstrap/unix-44/OPT.h +++ b/bootstrap/unix-44/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPT__h #define OPT__h @@ -17,7 +17,7 @@ typedef OPT_ConstExt ext; int64 intval; int32 intval2; - SET setval; + uint32 setval; LONGREAL realval; } OPT_ConstDesc; @@ -67,8 +67,8 @@ typedef import OPT_Object OPT_topScope; -import OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_adrtyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp; -import OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj; +import OPT_Struct OPT_undftyp, OPT_niltyp, OPT_notyp, OPT_bytetyp, OPT_cpbytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_settyp, OPT_set32typ, OPT_set64typ, OPT_realtyp, OPT_lrltyp, OPT_stringtyp, OPT_adrtyp, OPT_sysptrtyp; +import OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj, OPT_setobj; import int8 OPT_nofGmod; import OPT_Object OPT_GlbMod[64]; import OPS_Name OPT_SelfName; @@ -92,7 +92,7 @@ import void OPT_FindField (OPS_Name name, OPT_Struct typ, OPT_Object *res); import void OPT_FindImport (OPT_Object mod, OPT_Object *res); import void OPT_IdFPrint (OPT_Struct typ); import void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done); -import void OPT_Init (OPS_Name name, SET opt); +import void OPT_Init (OPS_Name name, uint32 opt); import void OPT_InitRecno (void); import void OPT_Insert (OPS_Name name, OPT_Object *obj); import void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old); @@ -104,6 +104,7 @@ import OPT_Node OPT_NewNode (int8 class); import OPT_Object OPT_NewObj (void); import OPT_Struct OPT_NewStr (int8 form, int8 comp); import void OPT_OpenScope (int8 level, OPT_Object owner); +import OPT_Struct OPT_SetType (int32 size); import OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir); import int32 OPT_SizeAlignment (int32 size); import void OPT_TypSize (OPT_Struct typ); diff --git a/bootstrap/unix-44/OPV.c b/bootstrap/unix-44/OPV.c index ff99f665..99e7aa6a 100644 --- a/bootstrap/unix-44/OPV.c +++ b/bootstrap/unix-44/OPV.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPC.h" @@ -187,6 +188,7 @@ void OPV_AdrAndSize (OPT_Object topScope) OPV_Traverse(topScope->right, topScope, 1); OPV_Traverse(topScope->right, topScope, 0); OPT_chartyp->strobj->linkadr = 2; + OPT_cpbytetyp->strobj->linkadr = 2; OPT_settyp->strobj->linkadr = 2; OPT_realtyp->strobj->linkadr = 2; OPT_adrtyp->strobj->linkadr = 2; @@ -194,6 +196,8 @@ void OPV_AdrAndSize (OPT_Object topScope) OPT_int16typ->strobj->linkadr = 2; OPT_int32typ->strobj->linkadr = 2; OPT_int64typ->strobj->linkadr = 2; + OPT_set32typ->strobj->linkadr = 2; + OPT_set64typ->strobj->linkadr = 2; OPT_hinttyp->strobj->linkadr = 2; OPT_lrltyp->strobj->linkadr = 2; OPT_booltyp->strobj->linkadr = 2; diff --git a/bootstrap/unix-44/OPV.h b/bootstrap/unix-44/OPV.h index a44fb5b5..f5e41d45 100644 --- a/bootstrap/unix-44/OPV.h +++ b/bootstrap/unix-44/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/unix-44/Platform.c b/bootstrap/unix-44/Platform.c index 18c66534..defb84f0 100644 --- a/bootstrap/unix-44/Platform.c +++ b/bootstrap/unix-44/Platform.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" @@ -40,7 +41,7 @@ export int32 Platform_ArgVector; static Platform_HaltProcedure Platform_HaltHandler; static int32 Platform_TimeStart; export int16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd; -export CHAR Platform_nl[3]; +export CHAR Platform_NL[3]; export address *Platform_FileIdentity__typ; @@ -798,7 +799,7 @@ export void *Platform__init(void) Platform_SeekSet = Platform_seekset(); Platform_SeekCur = Platform_seekcur(); Platform_SeekEnd = Platform_seekend(); - Platform_nl[0] = 0x0a; - Platform_nl[1] = 0x00; + Platform_NL[0] = 0x0a; + Platform_NL[1] = 0x00; __ENDMOD; } diff --git a/bootstrap/unix-44/Platform.h b/bootstrap/unix-44/Platform.h index 158cb341..01e08432 100644 --- a/bootstrap/unix-44/Platform.h +++ b/bootstrap/unix-44/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Platform__h #define Platform__h @@ -26,7 +26,7 @@ import CHAR Platform_CWD[256]; import int16 Platform_ArgCount; import int32 Platform_ArgVector; import int16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd; -import CHAR Platform_nl[3]; +import CHAR Platform_NL[3]; import address *Platform_FileIdentity__typ; diff --git a/bootstrap/unix-44/Reals.c b/bootstrap/unix-44/Reals.c index 57e22100..d7d2994c 100644 --- a/bootstrap/unix-44/Reals.c +++ b/bootstrap/unix-44/Reals.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/unix-44/Reals.h b/bootstrap/unix-44/Reals.h index f3404dda..8c1ff819 100644 --- a/bootstrap/unix-44/Reals.h +++ b/bootstrap/unix-44/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/unix-44/Strings.c b/bootstrap/unix-44/Strings.c index bcf3cb9b..ac03bada 100644 --- a/bootstrap/unix-44/Strings.c +++ b/bootstrap/unix-44/Strings.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/unix-44/Strings.h b/bootstrap/unix-44/Strings.h index 9418692a..cc9d99a1 100644 --- a/bootstrap/unix-44/Strings.h +++ b/bootstrap/unix-44/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/unix-44/Texts.c b/bootstrap/unix-44/Texts.c index efc9fd98..a8af28c1 100644 --- a/bootstrap/unix-44/Texts.c +++ b/bootstrap/unix-44/Texts.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Files.h" @@ -183,7 +184,7 @@ export address *Texts_Writer__typ; export address *Texts__1__typ; export void Texts_Append (Texts_Text T, Texts_Buffer B); -export void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff); +export void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, uint32 sel, Texts_FontsFont fnt, int8 col, int8 voff); static Texts_Elem Texts_CloneElem (Texts_Elem e); static Texts_Piece Texts_ClonePiece (Texts_Piece p); export void Texts_Close (Texts_Text T, CHAR *name, LONGINT name__len); @@ -565,7 +566,7 @@ void Texts_Delete (Texts_Text T, int32 beg, int32 end) } } -void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff) +void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, uint32 sel, Texts_FontsFont fnt, int8 col, int8 voff) { Texts_Run c = NIL, u = NIL, un = NIL, v = NIL, vn = NIL; int32 co, uo, ud, vo, vd; diff --git a/bootstrap/unix-44/Texts.h b/bootstrap/unix-44/Texts.h index e402259d..2d6de22a 100644 --- a/bootstrap/unix-44/Texts.h +++ b/bootstrap/unix-44/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Texts__h #define Texts__h @@ -129,7 +129,7 @@ import address *Texts_Scanner__typ; import address *Texts_Writer__typ; import void Texts_Append (Texts_Text T, Texts_Buffer B); -import void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff); +import void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, uint32 sel, Texts_FontsFont fnt, int8 col, int8 voff); import void Texts_Close (Texts_Text T, CHAR *name, LONGINT name__len); import void Texts_Copy (Texts_Buffer SB, Texts_Buffer DB); import void Texts_CopyElem (Texts_Elem SE, Texts_Elem DE); diff --git a/bootstrap/unix-44/errors.c b/bootstrap/unix-44/errors.c index ba890a17..f284397b 100644 --- a/bootstrap/unix-44/errors.c +++ b/bootstrap/unix-44/errors.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/unix-44/errors.h b/bootstrap/unix-44/errors.h index d8124792..5aa2a5f6 100644 --- a/bootstrap/unix-44/errors.h +++ b/bootstrap/unix-44/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/unix-44/extTools.c b/bootstrap/unix-44/extTools.c index 76fdc084..fe7eb545 100644 --- a/bootstrap/unix-44/extTools.c +++ b/bootstrap/unix-44/extTools.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" diff --git a/bootstrap/unix-44/extTools.h b/bootstrap/unix-44/extTools.h index bb5be954..8cdd8e01 100644 --- a/bootstrap/unix-44/extTools.h +++ b/bootstrap/unix-44/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/unix-44/vt100.c b/bootstrap/unix-44/vt100.c index c44586d2..a4bc9ec1 100644 --- a/bootstrap/unix-44/vt100.c +++ b/bootstrap/unix-44/vt100.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Console.h" diff --git a/bootstrap/unix-44/vt100.h b/bootstrap/unix-44/vt100.h index c9a01a7c..44d81f73 100644 --- a/bootstrap/unix-44/vt100.h +++ b/bootstrap/unix-44/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef vt100__h #define vt100__h diff --git a/bootstrap/unix-48/Compiler.c b/bootstrap/unix-48/Compiler.c index 1b3b14f1..637fd329 100644 --- a/bootstrap/unix-48/Compiler.c +++ b/bootstrap/unix-48/Compiler.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -83,7 +84,6 @@ static void Compiler_PropagateElementaryTypeSizes (void) OPT_Struct adrinttyp = NIL; OPT_sysptrtyp->size = OPM_AddressSize; OPT_adrtyp->size = OPM_AddressSize; - OPT_settyp->size = OPM_SetSize; adrinttyp = OPT_IntType(OPM_AddressSize); OPT_adrtyp->strobj = adrinttyp->strobj; OPT_sinttyp = OPT_IntType(OPM_ShortintSize); @@ -92,6 +92,20 @@ static void Compiler_PropagateElementaryTypeSizes (void) OPT_sintobj->typ = OPT_sinttyp; OPT_intobj->typ = OPT_inttyp; OPT_lintobj->typ = OPT_linttyp; + switch (OPM_LongintSize) { + case 4: + OPT_settyp = OPT_set32typ; + break; + default: + OPT_settyp = OPT_set64typ; + break; + } + OPT_setobj->typ = OPT_settyp; + if (__STRCMP(OPM_Model, "C") == 0) { + OPT_cpbytetyp->strobj->name[4] = 0x00; + } else { + OPT_cpbytetyp->strobj->name[4] = '@'; + } } void Compiler_Translate (void) diff --git a/bootstrap/unix-48/Configuration.c b/bootstrap/unix-48/Configuration.c index 85c8cf89..a3240e8e 100644 --- a/bootstrap/unix-48/Configuration.c +++ b/bootstrap/unix-48/Configuration.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" @@ -18,6 +19,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); + __MOVE("1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); __ENDMOD; } diff --git a/bootstrap/unix-48/Configuration.h b/bootstrap/unix-48/Configuration.h index a365d693..4d4279da 100644 --- a/bootstrap/unix-48/Configuration.h +++ b/bootstrap/unix-48/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/unix-48/Console.c b/bootstrap/unix-48/Console.c index c2089f05..206f8024 100644 --- a/bootstrap/unix-48/Console.c +++ b/bootstrap/unix-48/Console.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Platform.h" diff --git a/bootstrap/unix-48/Console.h b/bootstrap/unix-48/Console.h index 08f4e38e..6549e2cc 100644 --- a/bootstrap/unix-48/Console.h +++ b/bootstrap/unix-48/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/unix-48/Files.c b/bootstrap/unix-48/Files.c index 4800d53c..b1a7e280 100644 --- a/bootstrap/unix-48/Files.c +++ b/bootstrap/unix-48/Files.c @@ -1,13 +1,13 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" -#include "Configuration.h" -#include "Console.h" #include "Heap.h" +#include "Console.h" #include "Platform.h" #include "Strings.h" @@ -89,9 +89,8 @@ export void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x); export void Files_ReadLReal (Files_Rider *R, address *R__typ, LONGREAL *x); export void Files_ReadLine (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); export void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x); -export void Files_ReadNum64 (Files_Rider *R, address *R__typ, int64 *x); export void Files_ReadReal (Files_Rider *R, address *R__typ, REAL *x); -export void Files_ReadSet (Files_Rider *R, address *R__typ, SET *x); +export void Files_ReadSet (Files_Rider *R, address *R__typ, uint32 *x); export void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); export void Files_Register (Files_File f); export void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int16 *res); @@ -104,13 +103,13 @@ export void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, L export void Files_WriteInt (Files_Rider *R, address *R__typ, int16 x); export void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x); export void Files_WriteLReal (Files_Rider *R, address *R__typ, LONGREAL x); -export void Files_WriteNum (Files_Rider *R, address *R__typ, int32 x); -export void Files_WriteNum64 (Files_Rider *R, address *R__typ, int64 x); +export void Files_WriteNum (Files_Rider *R, address *R__typ, int64 x); export void Files_WriteReal (Files_Rider *R, address *R__typ, REAL x); -export void Files_WriteSet (Files_Rider *R, address *R__typ, SET x); +export void Files_WriteSet (Files_Rider *R, address *R__typ, uint32 x); export void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); #define Files_IdxTrap() __HALT(-1) +#define Files_ToAdr(x) (address)x static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int16 errcode) { @@ -662,7 +661,7 @@ void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x } else { min = n; } - __MOVE(((address)buf->data) + offset, ((address)x) + xpos, min); + __MOVE((address)buf->data + Files_ToAdr(offset), (address)x + Files_ToAdr(xpos), min); offset += min; (*r).offset = offset; xpos += min; @@ -722,7 +721,7 @@ void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT } else { min = n; } - __MOVE(((address)x) + xpos, ((address)buf->data) + offset, min); + __MOVE((address)x + Files_ToAdr(xpos), (address)buf->data + Files_ToAdr(offset), min); offset += min; (*r).offset = offset; if (offset > buf->size) { @@ -862,13 +861,13 @@ void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x) *x = (((int16)b[0] + __ASHL((int16)b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24); } -void Files_ReadSet (Files_Rider *R, address *R__typ, SET *x) +void Files_ReadSet (Files_Rider *R, address *R__typ, uint32 *x) { CHAR b[4]; int32 l; Files_ReadBytes(&*R, R__typ, (void*)b, 4, 4); l = (((int16)b[0] + __ASHL((int16)b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24); - *x = (SET)l; + *x = (uint32)l; } void Files_ReadReal (Files_Rider *R, address *R__typ, REAL *x) @@ -932,13 +931,6 @@ void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x) *x = n; } -void Files_ReadNum64 (Files_Rider *R, address *R__typ, int64 *x) -{ - int32 n; - Files_ReadNum(&*R, R__typ, &n); - *x = n; -} - void Files_WriteBool (Files_Rider *R, address *R__typ, BOOLEAN x) { Files_Write(&*R, R__typ, __VAL(CHAR, x)); @@ -962,7 +954,7 @@ void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x) Files_WriteBytes(&*R, R__typ, (void*)b, 4, 4); } -void Files_WriteSet (Files_Rider *R, address *R__typ, SET x) +void Files_WriteSet (Files_Rider *R, address *R__typ, uint32 x) { CHAR b[4]; int32 i; @@ -998,16 +990,7 @@ void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len Files_WriteBytes(&*R, R__typ, (void*)x, x__len * 1, i + 1); } -void Files_WriteNum (Files_Rider *R, address *R__typ, int32 x) -{ - while (x < -64 || x > 63) { - Files_Write(&*R, R__typ, (CHAR)(__MASK(x, -128) + 128)); - x = __ASHR(x, 7); - } - Files_Write(&*R, R__typ, (CHAR)__MASK(x, -128)); -} - -void Files_WriteNum64 (Files_Rider *R, address *R__typ, int64 x) +void Files_WriteNum (Files_Rider *R, address *R__typ, int64 x) { while (x < -64 || x > 63) { Files_Write(&*R, R__typ, (CHAR)(__MASK(x, -128) + 128)); @@ -1059,9 +1042,8 @@ __TDESC(Files_Rider, 1, 1) = {__TDFLDS("Rider", 20), {8, -8}}; export void *Files__init(void) { __DEFMOD; - __MODULE_IMPORT(Configuration); - __MODULE_IMPORT(Console); __MODULE_IMPORT(Heap); + __MODULE_IMPORT(Console); __MODULE_IMPORT(Platform); __MODULE_IMPORT(Strings); __REGMOD("Files", EnumPtrs); diff --git a/bootstrap/unix-48/Files.h b/bootstrap/unix-48/Files.h index 55e5fa16..fd146132 100644 --- a/bootstrap/unix-48/Files.h +++ b/bootstrap/unix-48/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ #ifndef Files__h #define Files__h @@ -46,9 +46,8 @@ import void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x); import void Files_ReadLReal (Files_Rider *R, address *R__typ, LONGREAL *x); import void Files_ReadLine (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); import void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x); -import void Files_ReadNum64 (Files_Rider *R, address *R__typ, int64 *x); import void Files_ReadReal (Files_Rider *R, address *R__typ, REAL *x); -import void Files_ReadSet (Files_Rider *R, address *R__typ, SET *x); +import void Files_ReadSet (Files_Rider *R, address *R__typ, uint32 *x); import void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); import void Files_Register (Files_File f); import void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int16 *res); @@ -60,10 +59,9 @@ import void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, L import void Files_WriteInt (Files_Rider *R, address *R__typ, int16 x); import void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x); import void Files_WriteLReal (Files_Rider *R, address *R__typ, LONGREAL x); -import void Files_WriteNum (Files_Rider *R, address *R__typ, int32 x); -import void Files_WriteNum64 (Files_Rider *R, address *R__typ, int64 x); +import void Files_WriteNum (Files_Rider *R, address *R__typ, int64 x); import void Files_WriteReal (Files_Rider *R, address *R__typ, REAL x); -import void Files_WriteSet (Files_Rider *R, address *R__typ, SET x); +import void Files_WriteSet (Files_Rider *R, address *R__typ, uint32 x); import void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); import void *Files__init(void); diff --git a/bootstrap/unix-48/Heap.c b/bootstrap/unix-48/Heap.c index 1f66b283..b3eea6a3 100644 --- a/bootstrap/unix-48/Heap.c +++ b/bootstrap/unix-48/Heap.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/unix-48/Heap.h b/bootstrap/unix-48/Heap.h index 9e9400e1..a7135c5b 100644 --- a/bootstrap/unix-48/Heap.h +++ b/bootstrap/unix-48/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/unix-48/Modules.c b/bootstrap/unix-48/Modules.c index f165488e..2984f32f 100644 --- a/bootstrap/unix-48/Modules.c +++ b/bootstrap/unix-48/Modules.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Console.h" diff --git a/bootstrap/unix-48/Modules.h b/bootstrap/unix-48/Modules.h index a2ceebdf..9b84521f 100644 --- a/bootstrap/unix-48/Modules.h +++ b/bootstrap/unix-48/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/unix-48/OPB.c b/bootstrap/unix-48/OPB.c index e370e621..d099cad7 100644 --- a/bootstrap/unix-48/OPB.c +++ b/bootstrap/unix-48/OPB.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPM.h" @@ -55,6 +56,7 @@ export void OPB_Return (OPT_Node *x, OPT_Object proc); export void OPB_SetElem (OPT_Node *x); static void OPB_SetIntType (OPT_Node node); export void OPB_SetRange (OPT_Node *x, OPT_Node y); +static void OPB_SetSetType (OPT_Node node); export void OPB_StFct (OPT_Node *par0, int8 fctno, int16 parno); export void OPB_StPar0 (OPT_Node *par0, int16 fctno); export void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno); @@ -223,6 +225,17 @@ static void OPB_SetIntType (OPT_Node node) node->typ = OPT_IntType(OPT_IntSize(node->conval->intval)); } +static void OPB_SetSetType (OPT_Node node) +{ + int32 i32; + __GET((address)&node->conval->setval + 4, i32, int32); + if (i32 == 0) { + node->typ = OPT_set32typ; + } else { + node->typ = OPT_set64typ; + } +} + OPT_Node OPB_NewIntConst (int64 intval) { OPT_Node _o_result; @@ -364,16 +377,16 @@ void OPB_Field (OPT_Node *x, OPT_Object y) } } -static struct TypTest__57 { +static struct TypTest__58 { OPT_Node *x; OPT_Object *obj; BOOLEAN *guard; - struct TypTest__57 *lnk; -} *TypTest__57_s; + struct TypTest__58 *lnk; +} *TypTest__58_s; -static void GTT__58 (OPT_Struct t0, OPT_Struct t1); +static void GTT__59 (OPT_Struct t0, OPT_Struct t1); -static void GTT__58 (OPT_Struct t0, OPT_Struct t1) +static void GTT__59 (OPT_Struct t0, OPT_Struct t1) { OPT_Node node = NIL; OPT_Struct t = NIL; @@ -386,54 +399,54 @@ static void GTT__58 (OPT_Struct t0, OPT_Struct t1) t1 = t1->BaseTyp; } if (t1 == t0 || t0->form == 0) { - if (*TypTest__57_s->guard) { - OPB_BindNodes(5, NIL, &*TypTest__57_s->x, NIL); - (*TypTest__57_s->x)->readonly = (*TypTest__57_s->x)->left->readonly; + if (*TypTest__58_s->guard) { + OPB_BindNodes(5, NIL, &*TypTest__58_s->x, NIL); + (*TypTest__58_s->x)->readonly = (*TypTest__58_s->x)->left->readonly; } else { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__57_s->x; - node->obj = *TypTest__57_s->obj; - *TypTest__57_s->x = node; + node->left = *TypTest__58_s->x; + node->obj = *TypTest__58_s->obj; + *TypTest__58_s->x = node; } } else { OPB_err(85); } } else if (t0 != t1) { OPB_err(85); - } else if (!*TypTest__57_s->guard) { - if ((*TypTest__57_s->x)->class == 5) { + } else if (!*TypTest__58_s->guard) { + if ((*TypTest__58_s->x)->class == 5) { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__57_s->x; - node->obj = *TypTest__57_s->obj; - *TypTest__57_s->x = node; + node->left = *TypTest__58_s->x; + node->obj = *TypTest__58_s->obj; + *TypTest__58_s->x = node; } else { - *TypTest__57_s->x = OPB_NewBoolConst(1); + *TypTest__58_s->x = OPB_NewBoolConst(1); } } } void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) { - struct TypTest__57 _s; + struct TypTest__58 _s; _s.x = x; _s.obj = &obj; _s.guard = &guard; - _s.lnk = TypTest__57_s; - TypTest__57_s = &_s; + _s.lnk = TypTest__58_s; + TypTest__58_s = &_s; if (OPB_NotVar(*x)) { OPB_err(112); } else if ((*x)->typ->form == 11) { if (((*x)->typ->BaseTyp->comp != 4 && (*x)->typ != OPT_sysptrtyp)) { OPB_err(85); } else if (obj->typ->form == 11) { - GTT__58((*x)->typ->BaseTyp, obj->typ->BaseTyp); + GTT__59((*x)->typ->BaseTyp, obj->typ->BaseTyp); } else { OPB_err(86); } } else if (((((*x)->typ->comp == 4 && (*x)->class == 1)) && obj->typ->comp == 4)) { - GTT__58((*x)->typ, obj->typ); + GTT__59((*x)->typ, obj->typ); } else { OPB_err(87); } @@ -442,7 +455,7 @@ void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) } else { (*x)->typ = OPT_booltyp; } - TypTest__57_s = _s.lnk; + TypTest__58_s = _s.lnk; } void OPB_In (OPT_Node *x, OPT_Node y) @@ -1109,7 +1122,13 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) f = (*x)->typ->form; g = typ->form; if ((*x)->class == 7) { - if (f == 4) { + if ((((f == 7 && g == 7)) && (*x)->typ->size > typ->size)) { + OPB_SetSetType(*x); + if ((*x)->typ->size > typ->size) { + OPB_err(203); + (*x)->conval->setval = 0x0; + } + } else if (f == 4) { if (g == 4) { if ((*x)->typ->size > typ->size) { OPB_SetIntType(*x); @@ -1243,6 +1262,13 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y) OPB_err(100); } break; + case 7: + if ((g == 7 && y->typ->size < z->typ->size)) { + OPB_Convert(&y, z->typ); + } else { + OPB_err(100); + } + break; case 5: if (g == 4) { OPB_Convert(&y, z->typ); @@ -1969,13 +1995,13 @@ void OPB_StPar0 (OPT_Node *par0, int16 fctno) *par0 = x; } -static struct StPar1__52 { - struct StPar1__52 *lnk; -} *StPar1__52_s; +static struct StPar1__53 { + struct StPar1__53 *lnk; +} *StPar1__53_s; -static OPT_Node NewOp__53 (int8 class, int8 subcl, OPT_Node left, OPT_Node right); +static OPT_Node NewOp__54 (int8 class, int8 subcl, OPT_Node left, OPT_Node right); -static OPT_Node NewOp__53 (int8 class, int8 subcl, OPT_Node left, OPT_Node right) +static OPT_Node NewOp__54 (int8 class, int8 subcl, OPT_Node left, OPT_Node right) { OPT_Node _o_result; OPT_Node node = NIL; @@ -1992,9 +2018,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) int16 f, L; OPT_Struct typ = NIL; OPT_Node p = NIL, t = NIL; - struct StPar1__52 _s; - _s.lnk = StPar1__52_s; - StPar1__52_s = &_s; + struct StPar1__53 _s; + _s.lnk = StPar1__53_s; + StPar1__53_s = &_s; p = *par0; f = x->typ->form; switch (fctno) { @@ -2010,7 +2036,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) OPB_err(111); } } - p = NewOp__53(19, fctno, p, x); + p = NewOp__54(19, fctno, p, x); p->typ = OPT_notyp; } break; @@ -2021,7 +2047,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (int64)OPM_MaxSet))) { OPB_err(202); } - p = NewOp__53(19, fctno, p, x); + p = NewOp__54(19, fctno, p, x); } else { OPB_err(111); } @@ -2046,7 +2072,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) p = p->left; x->conval->intval += 1; } - p = NewOp__53(12, 19, p, x); + p = NewOp__54(12, 19, p, x); p->typ = OPT_linttyp; } else { p = x; @@ -2068,7 +2094,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) t = x; x = p; p = t; - p = NewOp__53(19, 18, p, x); + p = NewOp__54(19, 18, p, x); } else { OPB_err(111); } @@ -2094,7 +2120,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) } p->obj = NIL; } else { - p = NewOp__53(12, 17, p, x); + p = NewOp__54(12, 17, p, x); p->typ = p->left->typ; } } else { @@ -2125,9 +2151,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) OPB_err(111); } else { if (fctno == 22) { - p = NewOp__53(12, 27, p, x); + p = NewOp__54(12, 27, p, x); } else { - p = NewOp__53(12, 28, p, x); + p = NewOp__54(12, 28, p, x); } p->typ = p->left->typ; } @@ -2144,7 +2170,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) x = p; p = t; } - p = NewOp__53(19, fctno, p, x); + p = NewOp__54(19, fctno, p, x); } else { OPB_err(111); } @@ -2154,7 +2180,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) if (x->class == 8 || x->class == 9) { OPB_err(126); } else if (f == 4) { - p = NewOp__53(12, 26, p, x); + p = NewOp__54(12, 26, p, x); } else { OPB_err(111); } @@ -2182,7 +2208,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) if (x->class == 8 || x->class == 9) { OPB_err(126); } else if (f == 4) { - p = NewOp__53(19, 30, p, x); + p = NewOp__54(19, 30, p, x); } else { OPB_err(111); } @@ -2228,7 +2254,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) break; } *par0 = p; - StPar1__52_s = _s.lnk; + StPar1__53_s = _s.lnk; } void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n) diff --git a/bootstrap/unix-48/OPB.h b/bootstrap/unix-48/OPB.h index 8c0fd594..07dda5db 100644 --- a/bootstrap/unix-48/OPB.h +++ b/bootstrap/unix-48/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/unix-48/OPC.c b/bootstrap/unix-48/OPC.c index 4c9ae495..545deb33 100644 --- a/bootstrap/unix-48/OPC.c +++ b/bootstrap/unix-48/OPC.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -193,11 +194,15 @@ void OPC_Ident (OPT_Object obj) OPM_Write('_'); } } - } else if ((mode == 5 && obj->typ->form == 4)) { + } else if ((mode == 5 && __IN(obj->typ->form, 0x90, 32))) { if (obj->typ == OPT_adrtyp) { OPM_WriteString((CHAR*)"address", 8); } else { - OPM_WriteString((CHAR*)"int", 4); + if (obj->typ->form == 4) { + OPM_WriteString((CHAR*)"int", 4); + } else { + OPM_WriteString((CHAR*)"uint", 5); + } OPM_WriteInt(__ASHL(obj->typ->size, 3)); } } else { @@ -1233,13 +1238,16 @@ void OPC_GenBdy (OPT_Node n) OPM_currFile = 1; OPC_GenHeaderMsg(); OPM_WriteLn(); - OPM_WriteString((CHAR*)"#define INTEGER int", 20); + OPM_WriteString((CHAR*)"#define SHORTINT int", 21); + OPM_WriteInt(__ASHL(OPT_sinttyp->size, 3)); + OPM_WriteLn(); + OPM_WriteString((CHAR*)"#define INTEGER int", 21); OPM_WriteInt(__ASHL(OPT_inttyp->size, 3)); OPM_WriteLn(); - OPM_WriteString((CHAR*)"#define LONGINT int", 20); + OPM_WriteString((CHAR*)"#define LONGINT int", 21); OPM_WriteInt(__ASHL(OPT_linttyp->size, 3)); OPM_WriteLn(); - OPM_WriteString((CHAR*)"#define SET uint", 21); + OPM_WriteString((CHAR*)"#define SET uint", 22); OPM_WriteInt(__ASHL(OPT_settyp->size, 3)); OPM_WriteLn(); OPM_WriteLn(); @@ -1851,7 +1859,7 @@ void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim) void OPC_Constant (OPT_Const con, int16 form) { int16 i; - SET s; + uint32 s; int32 hex; BOOLEAN skipLeading; switch (form) { diff --git a/bootstrap/unix-48/OPC.h b/bootstrap/unix-48/OPC.h index e681f43d..c9cf0ace 100644 --- a/bootstrap/unix-48/OPC.h +++ b/bootstrap/unix-48/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/unix-48/OPM.c b/bootstrap/unix-48/OPM.c index 534a5c0d..32bb978e 100644 --- a/bootstrap/unix-48/OPM.c +++ b/bootstrap/unix-48/OPM.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -25,7 +26,7 @@ static int16 OPM_GlobalAddressSize; export int16 OPM_AddressSize; static int16 OPM_GlobalAlignment; export int16 OPM_Alignment; -export SET OPM_GlobalOptions, OPM_Options; +export uint32 OPM_GlobalOptions, OPM_Options; export int16 OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_SetSize, OPM_MaxSet; export int64 OPM_MaxIndex; export LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal; @@ -52,7 +53,7 @@ export void OPM_DeleteNewSym (void); export void OPM_FPrint (int32 *fp, int64 val); export void OPM_FPrintLReal (int32 *fp, LONGREAL lr); export void OPM_FPrintReal (int32 *fp, REAL real); -export void OPM_FPrintSet (int32 *fp, SET set); +export void OPM_FPrintSet (int32 *fp, uint32 set); static void OPM_FindLine (Files_File f, Files_Rider *r, address *r__typ, int64 pos); export void OPM_Get (CHAR *ch); export void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); @@ -80,12 +81,12 @@ export int32 OPM_SymRInt (void); export int64 OPM_SymRInt64 (void); export void OPM_SymRLReal (LONGREAL *lr); export void OPM_SymRReal (REAL *r); -export void OPM_SymRSet (SET *s); +export void OPM_SymRSet (uint32 *s); export void OPM_SymWCh (CHAR ch); export void OPM_SymWInt (int64 i); export void OPM_SymWLReal (LONGREAL lr); export void OPM_SymWReal (REAL r); -export void OPM_SymWSet (SET s); +export void OPM_SymWSet (uint32 s); static void OPM_VerboseListSizes (void); export void OPM_Write (CHAR ch); export void OPM_WriteHex (int64 i); @@ -329,7 +330,7 @@ BOOLEAN OPM_OpenPar (void) OPM_LogWStr((CHAR*)" -V Display compiler debugging messages.", 46); OPM_LogWLn(); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" Size model for elementary types (default O2 on 32 bit builds, OV on 64 bits)", 79); + OPM_LogWStr((CHAR*)" Size model for elementary types (default O2)", 47); OPM_LogWLn(); OPM_LogWStr((CHAR*)" -O2 Original Oberon / Oberon-2: 8 bit SHORTINT, 16 bit INTEGER, 32 bit LONGINT and SET.", 95); OPM_LogWLn(); @@ -709,10 +710,10 @@ void OPM_err (int16 n) void OPM_FPrint (int32 *fp, int64 val) { - *fp = __ROTL((int32)((SET)*fp ^ __VAL(SET, val)), 1, 32); + *fp = __ROTL((int32)((uint32)*fp ^ __VAL(uint32, val)), 1, 32); } -void OPM_FPrintSet (int32 *fp, SET set) +void OPM_FPrintSet (int32 *fp, uint32 set) { OPM_FPrint(&*fp, (int32)set); } @@ -751,13 +752,11 @@ int32 OPM_SymRInt (void) int64 OPM_SymRInt64 (void) { int64 _o_result; - int64 k; - Files_ReadNum64(&OPM_oldSF, Files_Rider__typ, &k); - _o_result = k; + _o_result = OPM_SymRInt(); return _o_result; } -void OPM_SymRSet (SET *s) +void OPM_SymRSet (uint32 *s) { Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (int32*)&*s); } @@ -808,10 +807,10 @@ void OPM_SymWCh (CHAR ch) void OPM_SymWInt (int64 i) { - Files_WriteNum64(&OPM_newSF, Files_Rider__typ, i); + Files_WriteNum(&OPM_newSF, Files_Rider__typ, i); } -void OPM_SymWSet (SET s) +void OPM_SymWSet (uint32 s) { Files_WriteNum(&OPM_newSF, Files_Rider__typ, (int32)s); } diff --git a/bootstrap/unix-48/OPM.h b/bootstrap/unix-48/OPM.h index 933ef1b5..dd3c0c27 100644 --- a/bootstrap/unix-48/OPM.h +++ b/bootstrap/unix-48/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPM__h #define OPM__h @@ -8,7 +8,7 @@ import CHAR OPM_Model[10]; import int16 OPM_AddressSize, OPM_Alignment; -import SET OPM_GlobalOptions, OPM_Options; +import uint32 OPM_GlobalOptions, OPM_Options; import int16 OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_SetSize, OPM_MaxSet; import int64 OPM_MaxIndex; import LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal; @@ -26,7 +26,7 @@ import void OPM_DeleteNewSym (void); import void OPM_FPrint (int32 *fp, int64 val); import void OPM_FPrintLReal (int32 *fp, LONGREAL lr); import void OPM_FPrintReal (int32 *fp, REAL real); -import void OPM_FPrintSet (int32 *fp, SET set); +import void OPM_FPrintSet (int32 *fp, uint32 set); import void OPM_Get (CHAR *ch); import void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); import void OPM_InitOptions (void); @@ -49,12 +49,12 @@ import int32 OPM_SymRInt (void); import int64 OPM_SymRInt64 (void); import void OPM_SymRLReal (LONGREAL *lr); import void OPM_SymRReal (REAL *r); -import void OPM_SymRSet (SET *s); +import void OPM_SymRSet (uint32 *s); import void OPM_SymWCh (CHAR ch); import void OPM_SymWInt (int64 i); import void OPM_SymWLReal (LONGREAL lr); import void OPM_SymWReal (REAL r); -import void OPM_SymWSet (SET s); +import void OPM_SymWSet (uint32 s); import void OPM_Write (CHAR ch); import void OPM_WriteHex (int64 i); import void OPM_WriteInt (int64 i); diff --git a/bootstrap/unix-48/OPP.c b/bootstrap/unix-48/OPP.c index 010efab1..1eff447d 100644 --- a/bootstrap/unix-48/OPP.c +++ b/bootstrap/unix-48/OPP.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPB.h" @@ -39,7 +40,7 @@ static void OPP_Expression (OPT_Node *x); static BOOLEAN OPP_Extends (OPT_Struct x, OPT_Struct b); static void OPP_Factor (OPT_Node *x); static void OPP_FormalParameters (OPT_Object *firstPar, OPT_Struct *resTyp); -export void OPP_Module (OPT_Node *prog, SET opt); +export void OPP_Module (OPT_Node *prog, uint32 opt); static void OPP_PointerType (OPT_Struct *typ); static void OPP_ProcedureDeclaration (OPT_Node *x); static void OPP_Receiver (int8 *mode, OPS_Name name, OPT_Struct *typ, OPT_Struct *rec); @@ -1775,7 +1776,7 @@ static void OPP_Block (OPT_Node *procdec, OPT_Node *statseq) OPP_CheckSym(41); } -void OPP_Module (OPT_Node *prog, SET opt) +void OPP_Module (OPT_Node *prog, uint32 opt) { OPS_Name impName, aliasName; OPT_Node procdec = NIL, statseq = NIL; diff --git a/bootstrap/unix-48/OPP.h b/bootstrap/unix-48/OPP.h index 373d8daa..c759545a 100644 --- a/bootstrap/unix-48/OPP.h +++ b/bootstrap/unix-48/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPP__h #define OPP__h @@ -9,7 +9,7 @@ -import void OPP_Module (OPT_Node *prog, SET opt); +import void OPP_Module (OPT_Node *prog, uint32 opt); import void *OPP__init(void); diff --git a/bootstrap/unix-48/OPS.c b/bootstrap/unix-48/OPS.c index f8ed61bf..18c3c066 100644 --- a/bootstrap/unix-48/OPS.c +++ b/bootstrap/unix-48/OPS.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPM.h" diff --git a/bootstrap/unix-48/OPS.h b/bootstrap/unix-48/OPS.h index 1f02668b..260fcd01 100644 --- a/bootstrap/unix-48/OPS.h +++ b/bootstrap/unix-48/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/unix-48/OPT.c b/bootstrap/unix-48/OPT.c index 3f54ed72..5bfcda58 100644 --- a/bootstrap/unix-48/OPT.c +++ b/bootstrap/unix-48/OPT.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPM.h" @@ -19,7 +20,7 @@ typedef OPT_ConstExt ext; int64 intval; int32 intval2; - SET setval; + uint32 setval; LONGREAL realval; } OPT_ConstDesc; @@ -88,8 +89,8 @@ typedef export OPT_Object OPT_topScope; -export OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_adrtyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp; -export OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj; +export OPT_Struct OPT_undftyp, OPT_niltyp, OPT_notyp, OPT_bytetyp, OPT_cpbytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_settyp, OPT_set32typ, OPT_set64typ, OPT_realtyp, OPT_lrltyp, OPT_stringtyp, OPT_adrtyp, OPT_sysptrtyp; +export OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj, OPT_setobj; export int8 OPT_nofGmod; export OPT_Object OPT_GlbMod[64]; export OPS_Name OPT_SelfName; @@ -137,7 +138,7 @@ static void OPT_InSign (int8 mno, OPT_Struct *res, OPT_Object *par); static void OPT_InStruct (OPT_Struct *typ); static OPT_Object OPT_InTProc (int8 mno); static OPT_Struct OPT_InTyp (int32 tag); -export void OPT_Init (OPS_Name name, SET opt); +export void OPT_Init (OPS_Name name, uint32 opt); export void OPT_InitRecno (void); static void OPT_InitStruct (OPT_Struct *typ, int8 form); export void OPT_Insert (OPS_Name name, OPT_Object *obj); @@ -159,6 +160,7 @@ static void OPT_OutObj (OPT_Object obj); static void OPT_OutSign (OPT_Struct result, OPT_Object par); static void OPT_OutStr (OPT_Struct typ); static void OPT_OutTProcs (OPT_Struct typ, OPT_Object obj); +export OPT_Struct OPT_SetType (int32 size); export OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir); export int32 OPT_SizeAlignment (int32 size); export void OPT_TypSize (OPT_Struct typ); @@ -209,6 +211,17 @@ OPT_Struct OPT_IntType (int32 size) return _o_result; } +OPT_Struct OPT_SetType (int32 size) +{ + OPT_Struct _o_result; + if (size == OPT_set32typ->size) { + _o_result = OPT_set32typ; + return _o_result; + } + _o_result = OPT_set64typ; + return _o_result; +} + OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir) { OPT_Struct _o_result; @@ -449,7 +462,7 @@ void OPT_CloseScope (void) OPT_topScope = OPT_topScope->left; } -void OPT_Init (OPS_Name name, SET opt) +void OPT_Init (OPS_Name name, uint32 opt) { OPT_topScope = OPT_universe; OPT_OpenScope(0, NIL); @@ -1171,6 +1184,9 @@ static OPT_Struct OPT_InTyp (int32 tag) if (tag == 4) { _o_result = OPT_IntType(OPM_SymRInt()); return _o_result; + } else if (tag == 7) { + _o_result = OPT_SetType(OPM_SymRInt()); + return _o_result; } else { _o_result = OPT_impCtxt.ref[__X(tag, 255)]; return _o_result; @@ -1628,7 +1644,7 @@ static void OPT_OutStr (OPT_Struct typ) OPT_Object strobj = NIL; if (typ->ref < OPT_expCtxt.ref) { OPM_SymWInt(-typ->ref); - if (typ->ref == 4) { + if (__IN(typ->ref, 0x90, 32)) { OPM_SymWInt(typ->size); } } else { @@ -1732,6 +1748,7 @@ static void OPT_OutConstant (OPT_Object obj) break; case 7: OPM_SymWSet(obj->conval->setval); + OPM_SymWInt(obj->typ->size); break; case 5: rval = obj->conval->realval; @@ -1959,28 +1976,32 @@ static void EnumPtrs(void (*P)(void*)) { P(OPT_topScope); P(OPT_undftyp); + P(OPT_niltyp); + P(OPT_notyp); P(OPT_bytetyp); + P(OPT_cpbytetyp); P(OPT_booltyp); P(OPT_chartyp); P(OPT_sinttyp); P(OPT_inttyp); P(OPT_linttyp); P(OPT_hinttyp); - P(OPT_adrtyp); P(OPT_int8typ); P(OPT_int16typ); P(OPT_int32typ); P(OPT_int64typ); + P(OPT_settyp); + P(OPT_set32typ); + P(OPT_set64typ); P(OPT_realtyp); P(OPT_lrltyp); - P(OPT_settyp); P(OPT_stringtyp); - P(OPT_niltyp); - P(OPT_notyp); + P(OPT_adrtyp); P(OPT_sysptrtyp); P(OPT_sintobj); P(OPT_intobj); P(OPT_lintobj); + P(OPT_setobj); __ENUMP(OPT_GlbMod, 64, P); P(OPT_universe); P(OPT_syslink); @@ -2056,6 +2077,8 @@ export void *OPT__init(void) OPT_EnterTyp((CHAR*)"INT16", 4, 2, &OPT_int16typ); OPT_EnterTyp((CHAR*)"INT32", 4, 4, &OPT_int32typ); OPT_EnterTyp((CHAR*)"INT64", 4, 8, &OPT_int64typ); + OPT_EnterTyp((CHAR*)"SET32", 7, 4, &OPT_set32typ); + OPT_EnterTyp((CHAR*)"SET64", 7, 8, &OPT_set64typ); OPT_EnterProc((CHAR*)"ADR", 20); OPT_EnterProc((CHAR*)"CC", 21); OPT_EnterProc((CHAR*)"LSH", 22); @@ -2073,13 +2096,14 @@ export void *OPT__init(void) OPT_topScope->right = NIL; OPT_EnterTyp((CHAR*)"BOOLEAN", 2, 1, &OPT_booltyp); OPT_EnterTyp((CHAR*)"CHAR", 3, 1, &OPT_chartyp); - OPT_EnterTyp((CHAR*)"SET", 7, -1, &OPT_settyp); OPT_EnterTyp((CHAR*)"REAL", 5, 4, &OPT_realtyp); OPT_EnterTyp((CHAR*)"LONGREAL", 6, 8, &OPT_lrltyp); OPT_EnterTyp((CHAR*)"HUGEINT", 4, 8, &OPT_hinttyp); + OPT_EnterTyp((CHAR*)"BYTE@", 4, 1, &OPT_cpbytetyp); OPT_EnterTypeAlias((CHAR*)"SHORTINT", &OPT_sintobj); OPT_EnterTypeAlias((CHAR*)"INTEGER", &OPT_intobj); OPT_EnterTypeAlias((CHAR*)"LONGINT", &OPT_lintobj); + OPT_EnterTypeAlias((CHAR*)"SET", &OPT_setobj); OPT_EnterBoolConst((CHAR*)"FALSE", 0); OPT_EnterBoolConst((CHAR*)"TRUE", 1); OPT_EnterProc((CHAR*)"HALT", 0); diff --git a/bootstrap/unix-48/OPT.h b/bootstrap/unix-48/OPT.h index 202c8278..2bc05576 100644 --- a/bootstrap/unix-48/OPT.h +++ b/bootstrap/unix-48/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPT__h #define OPT__h @@ -17,7 +17,7 @@ typedef OPT_ConstExt ext; int64 intval; int32 intval2; - SET setval; + uint32 setval; LONGREAL realval; } OPT_ConstDesc; @@ -67,8 +67,8 @@ typedef import OPT_Object OPT_topScope; -import OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_adrtyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp; -import OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj; +import OPT_Struct OPT_undftyp, OPT_niltyp, OPT_notyp, OPT_bytetyp, OPT_cpbytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_settyp, OPT_set32typ, OPT_set64typ, OPT_realtyp, OPT_lrltyp, OPT_stringtyp, OPT_adrtyp, OPT_sysptrtyp; +import OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj, OPT_setobj; import int8 OPT_nofGmod; import OPT_Object OPT_GlbMod[64]; import OPS_Name OPT_SelfName; @@ -92,7 +92,7 @@ import void OPT_FindField (OPS_Name name, OPT_Struct typ, OPT_Object *res); import void OPT_FindImport (OPT_Object mod, OPT_Object *res); import void OPT_IdFPrint (OPT_Struct typ); import void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done); -import void OPT_Init (OPS_Name name, SET opt); +import void OPT_Init (OPS_Name name, uint32 opt); import void OPT_InitRecno (void); import void OPT_Insert (OPS_Name name, OPT_Object *obj); import void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old); @@ -104,6 +104,7 @@ import OPT_Node OPT_NewNode (int8 class); import OPT_Object OPT_NewObj (void); import OPT_Struct OPT_NewStr (int8 form, int8 comp); import void OPT_OpenScope (int8 level, OPT_Object owner); +import OPT_Struct OPT_SetType (int32 size); import OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir); import int32 OPT_SizeAlignment (int32 size); import void OPT_TypSize (OPT_Struct typ); diff --git a/bootstrap/unix-48/OPV.c b/bootstrap/unix-48/OPV.c index ff99f665..99e7aa6a 100644 --- a/bootstrap/unix-48/OPV.c +++ b/bootstrap/unix-48/OPV.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPC.h" @@ -187,6 +188,7 @@ void OPV_AdrAndSize (OPT_Object topScope) OPV_Traverse(topScope->right, topScope, 1); OPV_Traverse(topScope->right, topScope, 0); OPT_chartyp->strobj->linkadr = 2; + OPT_cpbytetyp->strobj->linkadr = 2; OPT_settyp->strobj->linkadr = 2; OPT_realtyp->strobj->linkadr = 2; OPT_adrtyp->strobj->linkadr = 2; @@ -194,6 +196,8 @@ void OPV_AdrAndSize (OPT_Object topScope) OPT_int16typ->strobj->linkadr = 2; OPT_int32typ->strobj->linkadr = 2; OPT_int64typ->strobj->linkadr = 2; + OPT_set32typ->strobj->linkadr = 2; + OPT_set64typ->strobj->linkadr = 2; OPT_hinttyp->strobj->linkadr = 2; OPT_lrltyp->strobj->linkadr = 2; OPT_booltyp->strobj->linkadr = 2; diff --git a/bootstrap/unix-48/OPV.h b/bootstrap/unix-48/OPV.h index a44fb5b5..f5e41d45 100644 --- a/bootstrap/unix-48/OPV.h +++ b/bootstrap/unix-48/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/unix-48/Platform.c b/bootstrap/unix-48/Platform.c index 18c66534..defb84f0 100644 --- a/bootstrap/unix-48/Platform.c +++ b/bootstrap/unix-48/Platform.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" @@ -40,7 +41,7 @@ export int32 Platform_ArgVector; static Platform_HaltProcedure Platform_HaltHandler; static int32 Platform_TimeStart; export int16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd; -export CHAR Platform_nl[3]; +export CHAR Platform_NL[3]; export address *Platform_FileIdentity__typ; @@ -798,7 +799,7 @@ export void *Platform__init(void) Platform_SeekSet = Platform_seekset(); Platform_SeekCur = Platform_seekcur(); Platform_SeekEnd = Platform_seekend(); - Platform_nl[0] = 0x0a; - Platform_nl[1] = 0x00; + Platform_NL[0] = 0x0a; + Platform_NL[1] = 0x00; __ENDMOD; } diff --git a/bootstrap/unix-48/Platform.h b/bootstrap/unix-48/Platform.h index 158cb341..01e08432 100644 --- a/bootstrap/unix-48/Platform.h +++ b/bootstrap/unix-48/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Platform__h #define Platform__h @@ -26,7 +26,7 @@ import CHAR Platform_CWD[256]; import int16 Platform_ArgCount; import int32 Platform_ArgVector; import int16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd; -import CHAR Platform_nl[3]; +import CHAR Platform_NL[3]; import address *Platform_FileIdentity__typ; diff --git a/bootstrap/unix-48/Reals.c b/bootstrap/unix-48/Reals.c index 57e22100..d7d2994c 100644 --- a/bootstrap/unix-48/Reals.c +++ b/bootstrap/unix-48/Reals.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/unix-48/Reals.h b/bootstrap/unix-48/Reals.h index f3404dda..8c1ff819 100644 --- a/bootstrap/unix-48/Reals.h +++ b/bootstrap/unix-48/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/unix-48/Strings.c b/bootstrap/unix-48/Strings.c index bcf3cb9b..ac03bada 100644 --- a/bootstrap/unix-48/Strings.c +++ b/bootstrap/unix-48/Strings.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/unix-48/Strings.h b/bootstrap/unix-48/Strings.h index 9418692a..cc9d99a1 100644 --- a/bootstrap/unix-48/Strings.h +++ b/bootstrap/unix-48/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/unix-48/Texts.c b/bootstrap/unix-48/Texts.c index 28f099a4..09661382 100644 --- a/bootstrap/unix-48/Texts.c +++ b/bootstrap/unix-48/Texts.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Files.h" @@ -183,7 +184,7 @@ export address *Texts_Writer__typ; export address *Texts__1__typ; export void Texts_Append (Texts_Text T, Texts_Buffer B); -export void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff); +export void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, uint32 sel, Texts_FontsFont fnt, int8 col, int8 voff); static Texts_Elem Texts_CloneElem (Texts_Elem e); static Texts_Piece Texts_ClonePiece (Texts_Piece p); export void Texts_Close (Texts_Text T, CHAR *name, LONGINT name__len); @@ -565,7 +566,7 @@ void Texts_Delete (Texts_Text T, int32 beg, int32 end) } } -void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff) +void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, uint32 sel, Texts_FontsFont fnt, int8 col, int8 voff) { Texts_Run c = NIL, u = NIL, un = NIL, v = NIL, vn = NIL; int32 co, uo, ud, vo, vd; diff --git a/bootstrap/unix-48/Texts.h b/bootstrap/unix-48/Texts.h index 0afd65f7..86f8f5b7 100644 --- a/bootstrap/unix-48/Texts.h +++ b/bootstrap/unix-48/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Texts__h #define Texts__h @@ -130,7 +130,7 @@ import address *Texts_Scanner__typ; import address *Texts_Writer__typ; import void Texts_Append (Texts_Text T, Texts_Buffer B); -import void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff); +import void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, uint32 sel, Texts_FontsFont fnt, int8 col, int8 voff); import void Texts_Close (Texts_Text T, CHAR *name, LONGINT name__len); import void Texts_Copy (Texts_Buffer SB, Texts_Buffer DB); import void Texts_CopyElem (Texts_Elem SE, Texts_Elem DE); diff --git a/bootstrap/unix-48/errors.c b/bootstrap/unix-48/errors.c index ba890a17..f284397b 100644 --- a/bootstrap/unix-48/errors.c +++ b/bootstrap/unix-48/errors.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/unix-48/errors.h b/bootstrap/unix-48/errors.h index d8124792..5aa2a5f6 100644 --- a/bootstrap/unix-48/errors.h +++ b/bootstrap/unix-48/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/unix-48/extTools.c b/bootstrap/unix-48/extTools.c index 76fdc084..fe7eb545 100644 --- a/bootstrap/unix-48/extTools.c +++ b/bootstrap/unix-48/extTools.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" diff --git a/bootstrap/unix-48/extTools.h b/bootstrap/unix-48/extTools.h index bb5be954..8cdd8e01 100644 --- a/bootstrap/unix-48/extTools.h +++ b/bootstrap/unix-48/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/unix-48/vt100.c b/bootstrap/unix-48/vt100.c index c44586d2..a4bc9ec1 100644 --- a/bootstrap/unix-48/vt100.c +++ b/bootstrap/unix-48/vt100.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Console.h" diff --git a/bootstrap/unix-48/vt100.h b/bootstrap/unix-48/vt100.h index c9a01a7c..44d81f73 100644 --- a/bootstrap/unix-48/vt100.h +++ b/bootstrap/unix-48/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef vt100__h #define vt100__h diff --git a/bootstrap/unix-88/Compiler.c b/bootstrap/unix-88/Compiler.c index 1b3b14f1..637fd329 100644 --- a/bootstrap/unix-88/Compiler.c +++ b/bootstrap/unix-88/Compiler.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -83,7 +84,6 @@ static void Compiler_PropagateElementaryTypeSizes (void) OPT_Struct adrinttyp = NIL; OPT_sysptrtyp->size = OPM_AddressSize; OPT_adrtyp->size = OPM_AddressSize; - OPT_settyp->size = OPM_SetSize; adrinttyp = OPT_IntType(OPM_AddressSize); OPT_adrtyp->strobj = adrinttyp->strobj; OPT_sinttyp = OPT_IntType(OPM_ShortintSize); @@ -92,6 +92,20 @@ static void Compiler_PropagateElementaryTypeSizes (void) OPT_sintobj->typ = OPT_sinttyp; OPT_intobj->typ = OPT_inttyp; OPT_lintobj->typ = OPT_linttyp; + switch (OPM_LongintSize) { + case 4: + OPT_settyp = OPT_set32typ; + break; + default: + OPT_settyp = OPT_set64typ; + break; + } + OPT_setobj->typ = OPT_settyp; + if (__STRCMP(OPM_Model, "C") == 0) { + OPT_cpbytetyp->strobj->name[4] = 0x00; + } else { + OPT_cpbytetyp->strobj->name[4] = '@'; + } } void Compiler_Translate (void) diff --git a/bootstrap/unix-88/Configuration.c b/bootstrap/unix-88/Configuration.c index 85c8cf89..a3240e8e 100644 --- a/bootstrap/unix-88/Configuration.c +++ b/bootstrap/unix-88/Configuration.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" @@ -18,6 +19,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); + __MOVE("1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); __ENDMOD; } diff --git a/bootstrap/unix-88/Configuration.h b/bootstrap/unix-88/Configuration.h index a365d693..4d4279da 100644 --- a/bootstrap/unix-88/Configuration.h +++ b/bootstrap/unix-88/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/unix-88/Console.c b/bootstrap/unix-88/Console.c index c2089f05..206f8024 100644 --- a/bootstrap/unix-88/Console.c +++ b/bootstrap/unix-88/Console.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Platform.h" diff --git a/bootstrap/unix-88/Console.h b/bootstrap/unix-88/Console.h index 08f4e38e..6549e2cc 100644 --- a/bootstrap/unix-88/Console.h +++ b/bootstrap/unix-88/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/unix-88/Files.c b/bootstrap/unix-88/Files.c index efa49511..8e446a1c 100644 --- a/bootstrap/unix-88/Files.c +++ b/bootstrap/unix-88/Files.c @@ -1,13 +1,13 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" -#include "Configuration.h" -#include "Console.h" #include "Heap.h" +#include "Console.h" #include "Platform.h" #include "Strings.h" @@ -89,9 +89,8 @@ export void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x); export void Files_ReadLReal (Files_Rider *R, address *R__typ, LONGREAL *x); export void Files_ReadLine (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); export void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x); -export void Files_ReadNum64 (Files_Rider *R, address *R__typ, int64 *x); export void Files_ReadReal (Files_Rider *R, address *R__typ, REAL *x); -export void Files_ReadSet (Files_Rider *R, address *R__typ, SET *x); +export void Files_ReadSet (Files_Rider *R, address *R__typ, uint32 *x); export void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); export void Files_Register (Files_File f); export void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int16 *res); @@ -104,13 +103,13 @@ export void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, L export void Files_WriteInt (Files_Rider *R, address *R__typ, int16 x); export void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x); export void Files_WriteLReal (Files_Rider *R, address *R__typ, LONGREAL x); -export void Files_WriteNum (Files_Rider *R, address *R__typ, int32 x); -export void Files_WriteNum64 (Files_Rider *R, address *R__typ, int64 x); +export void Files_WriteNum (Files_Rider *R, address *R__typ, int64 x); export void Files_WriteReal (Files_Rider *R, address *R__typ, REAL x); -export void Files_WriteSet (Files_Rider *R, address *R__typ, SET x); +export void Files_WriteSet (Files_Rider *R, address *R__typ, uint32 x); export void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); #define Files_IdxTrap() __HALT(-1) +#define Files_ToAdr(x) (address)x static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int16 errcode) { @@ -662,7 +661,7 @@ void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x } else { min = n; } - __MOVE((address)buf->data + (int64)offset, (address)x + (int64)xpos, min); + __MOVE((address)buf->data + Files_ToAdr(offset), (address)x + Files_ToAdr(xpos), min); offset += min; (*r).offset = offset; xpos += min; @@ -722,7 +721,7 @@ void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT } else { min = n; } - __MOVE((address)x + (int64)xpos, (address)buf->data + (int64)offset, min); + __MOVE((address)x + Files_ToAdr(xpos), (address)buf->data + Files_ToAdr(offset), min); offset += min; (*r).offset = offset; if (offset > buf->size) { @@ -862,13 +861,13 @@ void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x) *x = (((int16)b[0] + __ASHL((int16)b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24); } -void Files_ReadSet (Files_Rider *R, address *R__typ, SET *x) +void Files_ReadSet (Files_Rider *R, address *R__typ, uint32 *x) { CHAR b[4]; int32 l; Files_ReadBytes(&*R, R__typ, (void*)b, 4, 4); l = (((int16)b[0] + __ASHL((int16)b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24); - *x = (SET)l; + *x = (uint32)l; } void Files_ReadReal (Files_Rider *R, address *R__typ, REAL *x) @@ -932,13 +931,6 @@ void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x) *x = n; } -void Files_ReadNum64 (Files_Rider *R, address *R__typ, int64 *x) -{ - int32 n; - Files_ReadNum(&*R, R__typ, &n); - *x = n; -} - void Files_WriteBool (Files_Rider *R, address *R__typ, BOOLEAN x) { Files_Write(&*R, R__typ, __VAL(CHAR, x)); @@ -962,7 +954,7 @@ void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x) Files_WriteBytes(&*R, R__typ, (void*)b, 4, 4); } -void Files_WriteSet (Files_Rider *R, address *R__typ, SET x) +void Files_WriteSet (Files_Rider *R, address *R__typ, uint32 x) { CHAR b[4]; int32 i; @@ -998,16 +990,7 @@ void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len Files_WriteBytes(&*R, R__typ, (void*)x, x__len * 1, i + 1); } -void Files_WriteNum (Files_Rider *R, address *R__typ, int32 x) -{ - while (x < -64 || x > 63) { - Files_Write(&*R, R__typ, (CHAR)(__MASK(x, -128) + 128)); - x = __ASHR(x, 7); - } - Files_Write(&*R, R__typ, (CHAR)__MASK(x, -128)); -} - -void Files_WriteNum64 (Files_Rider *R, address *R__typ, int64 x) +void Files_WriteNum (Files_Rider *R, address *R__typ, int64 x) { while (x < -64 || x > 63) { Files_Write(&*R, R__typ, (CHAR)(__MASK(x, -128) + 128)); @@ -1059,9 +1042,8 @@ __TDESC(Files_Rider, 1, 1) = {__TDFLDS("Rider", 24), {8, -16}}; export void *Files__init(void) { __DEFMOD; - __MODULE_IMPORT(Configuration); - __MODULE_IMPORT(Console); __MODULE_IMPORT(Heap); + __MODULE_IMPORT(Console); __MODULE_IMPORT(Platform); __MODULE_IMPORT(Strings); __REGMOD("Files", EnumPtrs); diff --git a/bootstrap/unix-88/Files.h b/bootstrap/unix-88/Files.h index 5aebf125..edb43852 100644 --- a/bootstrap/unix-88/Files.h +++ b/bootstrap/unix-88/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ #ifndef Files__h #define Files__h @@ -48,9 +48,8 @@ import void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x); import void Files_ReadLReal (Files_Rider *R, address *R__typ, LONGREAL *x); import void Files_ReadLine (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); import void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x); -import void Files_ReadNum64 (Files_Rider *R, address *R__typ, int64 *x); import void Files_ReadReal (Files_Rider *R, address *R__typ, REAL *x); -import void Files_ReadSet (Files_Rider *R, address *R__typ, SET *x); +import void Files_ReadSet (Files_Rider *R, address *R__typ, uint32 *x); import void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); import void Files_Register (Files_File f); import void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int16 *res); @@ -62,10 +61,9 @@ import void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, L import void Files_WriteInt (Files_Rider *R, address *R__typ, int16 x); import void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x); import void Files_WriteLReal (Files_Rider *R, address *R__typ, LONGREAL x); -import void Files_WriteNum (Files_Rider *R, address *R__typ, int32 x); -import void Files_WriteNum64 (Files_Rider *R, address *R__typ, int64 x); +import void Files_WriteNum (Files_Rider *R, address *R__typ, int64 x); import void Files_WriteReal (Files_Rider *R, address *R__typ, REAL x); -import void Files_WriteSet (Files_Rider *R, address *R__typ, SET x); +import void Files_WriteSet (Files_Rider *R, address *R__typ, uint32 x); import void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); import void *Files__init(void); diff --git a/bootstrap/unix-88/Heap.c b/bootstrap/unix-88/Heap.c index 71ad15a1..571a7dd2 100644 --- a/bootstrap/unix-88/Heap.c +++ b/bootstrap/unix-88/Heap.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/unix-88/Heap.h b/bootstrap/unix-88/Heap.h index 0cd62e2b..2187094a 100644 --- a/bootstrap/unix-88/Heap.h +++ b/bootstrap/unix-88/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/unix-88/Modules.c b/bootstrap/unix-88/Modules.c index 0e05b5aa..e18d29cf 100644 --- a/bootstrap/unix-88/Modules.c +++ b/bootstrap/unix-88/Modules.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Console.h" diff --git a/bootstrap/unix-88/Modules.h b/bootstrap/unix-88/Modules.h index a2ceebdf..9b84521f 100644 --- a/bootstrap/unix-88/Modules.h +++ b/bootstrap/unix-88/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/unix-88/OPB.c b/bootstrap/unix-88/OPB.c index e370e621..d099cad7 100644 --- a/bootstrap/unix-88/OPB.c +++ b/bootstrap/unix-88/OPB.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPM.h" @@ -55,6 +56,7 @@ export void OPB_Return (OPT_Node *x, OPT_Object proc); export void OPB_SetElem (OPT_Node *x); static void OPB_SetIntType (OPT_Node node); export void OPB_SetRange (OPT_Node *x, OPT_Node y); +static void OPB_SetSetType (OPT_Node node); export void OPB_StFct (OPT_Node *par0, int8 fctno, int16 parno); export void OPB_StPar0 (OPT_Node *par0, int16 fctno); export void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno); @@ -223,6 +225,17 @@ static void OPB_SetIntType (OPT_Node node) node->typ = OPT_IntType(OPT_IntSize(node->conval->intval)); } +static void OPB_SetSetType (OPT_Node node) +{ + int32 i32; + __GET((address)&node->conval->setval + 4, i32, int32); + if (i32 == 0) { + node->typ = OPT_set32typ; + } else { + node->typ = OPT_set64typ; + } +} + OPT_Node OPB_NewIntConst (int64 intval) { OPT_Node _o_result; @@ -364,16 +377,16 @@ void OPB_Field (OPT_Node *x, OPT_Object y) } } -static struct TypTest__57 { +static struct TypTest__58 { OPT_Node *x; OPT_Object *obj; BOOLEAN *guard; - struct TypTest__57 *lnk; -} *TypTest__57_s; + struct TypTest__58 *lnk; +} *TypTest__58_s; -static void GTT__58 (OPT_Struct t0, OPT_Struct t1); +static void GTT__59 (OPT_Struct t0, OPT_Struct t1); -static void GTT__58 (OPT_Struct t0, OPT_Struct t1) +static void GTT__59 (OPT_Struct t0, OPT_Struct t1) { OPT_Node node = NIL; OPT_Struct t = NIL; @@ -386,54 +399,54 @@ static void GTT__58 (OPT_Struct t0, OPT_Struct t1) t1 = t1->BaseTyp; } if (t1 == t0 || t0->form == 0) { - if (*TypTest__57_s->guard) { - OPB_BindNodes(5, NIL, &*TypTest__57_s->x, NIL); - (*TypTest__57_s->x)->readonly = (*TypTest__57_s->x)->left->readonly; + if (*TypTest__58_s->guard) { + OPB_BindNodes(5, NIL, &*TypTest__58_s->x, NIL); + (*TypTest__58_s->x)->readonly = (*TypTest__58_s->x)->left->readonly; } else { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__57_s->x; - node->obj = *TypTest__57_s->obj; - *TypTest__57_s->x = node; + node->left = *TypTest__58_s->x; + node->obj = *TypTest__58_s->obj; + *TypTest__58_s->x = node; } } else { OPB_err(85); } } else if (t0 != t1) { OPB_err(85); - } else if (!*TypTest__57_s->guard) { - if ((*TypTest__57_s->x)->class == 5) { + } else if (!*TypTest__58_s->guard) { + if ((*TypTest__58_s->x)->class == 5) { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__57_s->x; - node->obj = *TypTest__57_s->obj; - *TypTest__57_s->x = node; + node->left = *TypTest__58_s->x; + node->obj = *TypTest__58_s->obj; + *TypTest__58_s->x = node; } else { - *TypTest__57_s->x = OPB_NewBoolConst(1); + *TypTest__58_s->x = OPB_NewBoolConst(1); } } } void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) { - struct TypTest__57 _s; + struct TypTest__58 _s; _s.x = x; _s.obj = &obj; _s.guard = &guard; - _s.lnk = TypTest__57_s; - TypTest__57_s = &_s; + _s.lnk = TypTest__58_s; + TypTest__58_s = &_s; if (OPB_NotVar(*x)) { OPB_err(112); } else if ((*x)->typ->form == 11) { if (((*x)->typ->BaseTyp->comp != 4 && (*x)->typ != OPT_sysptrtyp)) { OPB_err(85); } else if (obj->typ->form == 11) { - GTT__58((*x)->typ->BaseTyp, obj->typ->BaseTyp); + GTT__59((*x)->typ->BaseTyp, obj->typ->BaseTyp); } else { OPB_err(86); } } else if (((((*x)->typ->comp == 4 && (*x)->class == 1)) && obj->typ->comp == 4)) { - GTT__58((*x)->typ, obj->typ); + GTT__59((*x)->typ, obj->typ); } else { OPB_err(87); } @@ -442,7 +455,7 @@ void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) } else { (*x)->typ = OPT_booltyp; } - TypTest__57_s = _s.lnk; + TypTest__58_s = _s.lnk; } void OPB_In (OPT_Node *x, OPT_Node y) @@ -1109,7 +1122,13 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) f = (*x)->typ->form; g = typ->form; if ((*x)->class == 7) { - if (f == 4) { + if ((((f == 7 && g == 7)) && (*x)->typ->size > typ->size)) { + OPB_SetSetType(*x); + if ((*x)->typ->size > typ->size) { + OPB_err(203); + (*x)->conval->setval = 0x0; + } + } else if (f == 4) { if (g == 4) { if ((*x)->typ->size > typ->size) { OPB_SetIntType(*x); @@ -1243,6 +1262,13 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y) OPB_err(100); } break; + case 7: + if ((g == 7 && y->typ->size < z->typ->size)) { + OPB_Convert(&y, z->typ); + } else { + OPB_err(100); + } + break; case 5: if (g == 4) { OPB_Convert(&y, z->typ); @@ -1969,13 +1995,13 @@ void OPB_StPar0 (OPT_Node *par0, int16 fctno) *par0 = x; } -static struct StPar1__52 { - struct StPar1__52 *lnk; -} *StPar1__52_s; +static struct StPar1__53 { + struct StPar1__53 *lnk; +} *StPar1__53_s; -static OPT_Node NewOp__53 (int8 class, int8 subcl, OPT_Node left, OPT_Node right); +static OPT_Node NewOp__54 (int8 class, int8 subcl, OPT_Node left, OPT_Node right); -static OPT_Node NewOp__53 (int8 class, int8 subcl, OPT_Node left, OPT_Node right) +static OPT_Node NewOp__54 (int8 class, int8 subcl, OPT_Node left, OPT_Node right) { OPT_Node _o_result; OPT_Node node = NIL; @@ -1992,9 +2018,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) int16 f, L; OPT_Struct typ = NIL; OPT_Node p = NIL, t = NIL; - struct StPar1__52 _s; - _s.lnk = StPar1__52_s; - StPar1__52_s = &_s; + struct StPar1__53 _s; + _s.lnk = StPar1__53_s; + StPar1__53_s = &_s; p = *par0; f = x->typ->form; switch (fctno) { @@ -2010,7 +2036,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) OPB_err(111); } } - p = NewOp__53(19, fctno, p, x); + p = NewOp__54(19, fctno, p, x); p->typ = OPT_notyp; } break; @@ -2021,7 +2047,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (int64)OPM_MaxSet))) { OPB_err(202); } - p = NewOp__53(19, fctno, p, x); + p = NewOp__54(19, fctno, p, x); } else { OPB_err(111); } @@ -2046,7 +2072,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) p = p->left; x->conval->intval += 1; } - p = NewOp__53(12, 19, p, x); + p = NewOp__54(12, 19, p, x); p->typ = OPT_linttyp; } else { p = x; @@ -2068,7 +2094,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) t = x; x = p; p = t; - p = NewOp__53(19, 18, p, x); + p = NewOp__54(19, 18, p, x); } else { OPB_err(111); } @@ -2094,7 +2120,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) } p->obj = NIL; } else { - p = NewOp__53(12, 17, p, x); + p = NewOp__54(12, 17, p, x); p->typ = p->left->typ; } } else { @@ -2125,9 +2151,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) OPB_err(111); } else { if (fctno == 22) { - p = NewOp__53(12, 27, p, x); + p = NewOp__54(12, 27, p, x); } else { - p = NewOp__53(12, 28, p, x); + p = NewOp__54(12, 28, p, x); } p->typ = p->left->typ; } @@ -2144,7 +2170,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) x = p; p = t; } - p = NewOp__53(19, fctno, p, x); + p = NewOp__54(19, fctno, p, x); } else { OPB_err(111); } @@ -2154,7 +2180,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) if (x->class == 8 || x->class == 9) { OPB_err(126); } else if (f == 4) { - p = NewOp__53(12, 26, p, x); + p = NewOp__54(12, 26, p, x); } else { OPB_err(111); } @@ -2182,7 +2208,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) if (x->class == 8 || x->class == 9) { OPB_err(126); } else if (f == 4) { - p = NewOp__53(19, 30, p, x); + p = NewOp__54(19, 30, p, x); } else { OPB_err(111); } @@ -2228,7 +2254,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) break; } *par0 = p; - StPar1__52_s = _s.lnk; + StPar1__53_s = _s.lnk; } void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n) diff --git a/bootstrap/unix-88/OPB.h b/bootstrap/unix-88/OPB.h index 8c0fd594..07dda5db 100644 --- a/bootstrap/unix-88/OPB.h +++ b/bootstrap/unix-88/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/unix-88/OPC.c b/bootstrap/unix-88/OPC.c index 4c9ae495..545deb33 100644 --- a/bootstrap/unix-88/OPC.c +++ b/bootstrap/unix-88/OPC.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -193,11 +194,15 @@ void OPC_Ident (OPT_Object obj) OPM_Write('_'); } } - } else if ((mode == 5 && obj->typ->form == 4)) { + } else if ((mode == 5 && __IN(obj->typ->form, 0x90, 32))) { if (obj->typ == OPT_adrtyp) { OPM_WriteString((CHAR*)"address", 8); } else { - OPM_WriteString((CHAR*)"int", 4); + if (obj->typ->form == 4) { + OPM_WriteString((CHAR*)"int", 4); + } else { + OPM_WriteString((CHAR*)"uint", 5); + } OPM_WriteInt(__ASHL(obj->typ->size, 3)); } } else { @@ -1233,13 +1238,16 @@ void OPC_GenBdy (OPT_Node n) OPM_currFile = 1; OPC_GenHeaderMsg(); OPM_WriteLn(); - OPM_WriteString((CHAR*)"#define INTEGER int", 20); + OPM_WriteString((CHAR*)"#define SHORTINT int", 21); + OPM_WriteInt(__ASHL(OPT_sinttyp->size, 3)); + OPM_WriteLn(); + OPM_WriteString((CHAR*)"#define INTEGER int", 21); OPM_WriteInt(__ASHL(OPT_inttyp->size, 3)); OPM_WriteLn(); - OPM_WriteString((CHAR*)"#define LONGINT int", 20); + OPM_WriteString((CHAR*)"#define LONGINT int", 21); OPM_WriteInt(__ASHL(OPT_linttyp->size, 3)); OPM_WriteLn(); - OPM_WriteString((CHAR*)"#define SET uint", 21); + OPM_WriteString((CHAR*)"#define SET uint", 22); OPM_WriteInt(__ASHL(OPT_settyp->size, 3)); OPM_WriteLn(); OPM_WriteLn(); @@ -1851,7 +1859,7 @@ void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim) void OPC_Constant (OPT_Const con, int16 form) { int16 i; - SET s; + uint32 s; int32 hex; BOOLEAN skipLeading; switch (form) { diff --git a/bootstrap/unix-88/OPC.h b/bootstrap/unix-88/OPC.h index e681f43d..c9cf0ace 100644 --- a/bootstrap/unix-88/OPC.h +++ b/bootstrap/unix-88/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/unix-88/OPM.c b/bootstrap/unix-88/OPM.c index 297ade25..9ecaaba2 100644 --- a/bootstrap/unix-88/OPM.c +++ b/bootstrap/unix-88/OPM.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -25,7 +26,7 @@ static int16 OPM_GlobalAddressSize; export int16 OPM_AddressSize; static int16 OPM_GlobalAlignment; export int16 OPM_Alignment; -export SET OPM_GlobalOptions, OPM_Options; +export uint32 OPM_GlobalOptions, OPM_Options; export int16 OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_SetSize, OPM_MaxSet; export int64 OPM_MaxIndex; export LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal; @@ -52,7 +53,7 @@ export void OPM_DeleteNewSym (void); export void OPM_FPrint (int32 *fp, int64 val); export void OPM_FPrintLReal (int32 *fp, LONGREAL lr); export void OPM_FPrintReal (int32 *fp, REAL real); -export void OPM_FPrintSet (int32 *fp, SET set); +export void OPM_FPrintSet (int32 *fp, uint32 set); static void OPM_FindLine (Files_File f, Files_Rider *r, address *r__typ, int64 pos); export void OPM_Get (CHAR *ch); export void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); @@ -80,12 +81,12 @@ export int32 OPM_SymRInt (void); export int64 OPM_SymRInt64 (void); export void OPM_SymRLReal (LONGREAL *lr); export void OPM_SymRReal (REAL *r); -export void OPM_SymRSet (SET *s); +export void OPM_SymRSet (uint32 *s); export void OPM_SymWCh (CHAR ch); export void OPM_SymWInt (int64 i); export void OPM_SymWLReal (LONGREAL lr); export void OPM_SymWReal (REAL r); -export void OPM_SymWSet (SET s); +export void OPM_SymWSet (uint32 s); static void OPM_VerboseListSizes (void); export void OPM_Write (CHAR ch); export void OPM_WriteHex (int64 i); @@ -329,7 +330,7 @@ BOOLEAN OPM_OpenPar (void) OPM_LogWStr((CHAR*)" -V Display compiler debugging messages.", 46); OPM_LogWLn(); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" Size model for elementary types (default O2 on 32 bit builds, OV on 64 bits)", 79); + OPM_LogWStr((CHAR*)" Size model for elementary types (default O2)", 47); OPM_LogWLn(); OPM_LogWStr((CHAR*)" -O2 Original Oberon / Oberon-2: 8 bit SHORTINT, 16 bit INTEGER, 32 bit LONGINT and SET.", 95); OPM_LogWLn(); @@ -709,10 +710,10 @@ void OPM_err (int16 n) void OPM_FPrint (int32 *fp, int64 val) { - *fp = __ROTL((int32)((SET)*fp ^ __VAL(SET, val)), 1, 32); + *fp = __ROTL((int32)((uint32)*fp ^ __VAL(uint32, val)), 1, 32); } -void OPM_FPrintSet (int32 *fp, SET set) +void OPM_FPrintSet (int32 *fp, uint32 set) { OPM_FPrint(&*fp, (int32)set); } @@ -751,13 +752,11 @@ int32 OPM_SymRInt (void) int64 OPM_SymRInt64 (void) { int64 _o_result; - int64 k; - Files_ReadNum64(&OPM_oldSF, Files_Rider__typ, &k); - _o_result = k; + _o_result = OPM_SymRInt(); return _o_result; } -void OPM_SymRSet (SET *s) +void OPM_SymRSet (uint32 *s) { Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (int32*)&*s); } @@ -808,10 +807,10 @@ void OPM_SymWCh (CHAR ch) void OPM_SymWInt (int64 i) { - Files_WriteNum64(&OPM_newSF, Files_Rider__typ, i); + Files_WriteNum(&OPM_newSF, Files_Rider__typ, i); } -void OPM_SymWSet (SET s) +void OPM_SymWSet (uint32 s) { Files_WriteNum(&OPM_newSF, Files_Rider__typ, (int32)s); } diff --git a/bootstrap/unix-88/OPM.h b/bootstrap/unix-88/OPM.h index 933ef1b5..dd3c0c27 100644 --- a/bootstrap/unix-88/OPM.h +++ b/bootstrap/unix-88/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPM__h #define OPM__h @@ -8,7 +8,7 @@ import CHAR OPM_Model[10]; import int16 OPM_AddressSize, OPM_Alignment; -import SET OPM_GlobalOptions, OPM_Options; +import uint32 OPM_GlobalOptions, OPM_Options; import int16 OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_SetSize, OPM_MaxSet; import int64 OPM_MaxIndex; import LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal; @@ -26,7 +26,7 @@ import void OPM_DeleteNewSym (void); import void OPM_FPrint (int32 *fp, int64 val); import void OPM_FPrintLReal (int32 *fp, LONGREAL lr); import void OPM_FPrintReal (int32 *fp, REAL real); -import void OPM_FPrintSet (int32 *fp, SET set); +import void OPM_FPrintSet (int32 *fp, uint32 set); import void OPM_Get (CHAR *ch); import void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); import void OPM_InitOptions (void); @@ -49,12 +49,12 @@ import int32 OPM_SymRInt (void); import int64 OPM_SymRInt64 (void); import void OPM_SymRLReal (LONGREAL *lr); import void OPM_SymRReal (REAL *r); -import void OPM_SymRSet (SET *s); +import void OPM_SymRSet (uint32 *s); import void OPM_SymWCh (CHAR ch); import void OPM_SymWInt (int64 i); import void OPM_SymWLReal (LONGREAL lr); import void OPM_SymWReal (REAL r); -import void OPM_SymWSet (SET s); +import void OPM_SymWSet (uint32 s); import void OPM_Write (CHAR ch); import void OPM_WriteHex (int64 i); import void OPM_WriteInt (int64 i); diff --git a/bootstrap/unix-88/OPP.c b/bootstrap/unix-88/OPP.c index c9986e20..6bfd4b38 100644 --- a/bootstrap/unix-88/OPP.c +++ b/bootstrap/unix-88/OPP.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPB.h" @@ -39,7 +40,7 @@ static void OPP_Expression (OPT_Node *x); static BOOLEAN OPP_Extends (OPT_Struct x, OPT_Struct b); static void OPP_Factor (OPT_Node *x); static void OPP_FormalParameters (OPT_Object *firstPar, OPT_Struct *resTyp); -export void OPP_Module (OPT_Node *prog, SET opt); +export void OPP_Module (OPT_Node *prog, uint32 opt); static void OPP_PointerType (OPT_Struct *typ); static void OPP_ProcedureDeclaration (OPT_Node *x); static void OPP_Receiver (int8 *mode, OPS_Name name, OPT_Struct *typ, OPT_Struct *rec); @@ -1775,7 +1776,7 @@ static void OPP_Block (OPT_Node *procdec, OPT_Node *statseq) OPP_CheckSym(41); } -void OPP_Module (OPT_Node *prog, SET opt) +void OPP_Module (OPT_Node *prog, uint32 opt) { OPS_Name impName, aliasName; OPT_Node procdec = NIL, statseq = NIL; diff --git a/bootstrap/unix-88/OPP.h b/bootstrap/unix-88/OPP.h index 373d8daa..c759545a 100644 --- a/bootstrap/unix-88/OPP.h +++ b/bootstrap/unix-88/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPP__h #define OPP__h @@ -9,7 +9,7 @@ -import void OPP_Module (OPT_Node *prog, SET opt); +import void OPP_Module (OPT_Node *prog, uint32 opt); import void *OPP__init(void); diff --git a/bootstrap/unix-88/OPS.c b/bootstrap/unix-88/OPS.c index f8ed61bf..18c3c066 100644 --- a/bootstrap/unix-88/OPS.c +++ b/bootstrap/unix-88/OPS.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPM.h" diff --git a/bootstrap/unix-88/OPS.h b/bootstrap/unix-88/OPS.h index 1f02668b..260fcd01 100644 --- a/bootstrap/unix-88/OPS.h +++ b/bootstrap/unix-88/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/unix-88/OPT.c b/bootstrap/unix-88/OPT.c index b0a12a18..98ef4a7f 100644 --- a/bootstrap/unix-88/OPT.c +++ b/bootstrap/unix-88/OPT.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPM.h" @@ -19,7 +20,7 @@ typedef OPT_ConstExt ext; int64 intval; int32 intval2; - SET setval; + uint32 setval; LONGREAL realval; } OPT_ConstDesc; @@ -88,8 +89,8 @@ typedef export OPT_Object OPT_topScope; -export OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_adrtyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp; -export OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj; +export OPT_Struct OPT_undftyp, OPT_niltyp, OPT_notyp, OPT_bytetyp, OPT_cpbytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_settyp, OPT_set32typ, OPT_set64typ, OPT_realtyp, OPT_lrltyp, OPT_stringtyp, OPT_adrtyp, OPT_sysptrtyp; +export OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj, OPT_setobj; export int8 OPT_nofGmod; export OPT_Object OPT_GlbMod[64]; export OPS_Name OPT_SelfName; @@ -137,7 +138,7 @@ static void OPT_InSign (int8 mno, OPT_Struct *res, OPT_Object *par); static void OPT_InStruct (OPT_Struct *typ); static OPT_Object OPT_InTProc (int8 mno); static OPT_Struct OPT_InTyp (int32 tag); -export void OPT_Init (OPS_Name name, SET opt); +export void OPT_Init (OPS_Name name, uint32 opt); export void OPT_InitRecno (void); static void OPT_InitStruct (OPT_Struct *typ, int8 form); export void OPT_Insert (OPS_Name name, OPT_Object *obj); @@ -159,6 +160,7 @@ static void OPT_OutObj (OPT_Object obj); static void OPT_OutSign (OPT_Struct result, OPT_Object par); static void OPT_OutStr (OPT_Struct typ); static void OPT_OutTProcs (OPT_Struct typ, OPT_Object obj); +export OPT_Struct OPT_SetType (int32 size); export OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir); export int32 OPT_SizeAlignment (int32 size); export void OPT_TypSize (OPT_Struct typ); @@ -209,6 +211,17 @@ OPT_Struct OPT_IntType (int32 size) return _o_result; } +OPT_Struct OPT_SetType (int32 size) +{ + OPT_Struct _o_result; + if (size == OPT_set32typ->size) { + _o_result = OPT_set32typ; + return _o_result; + } + _o_result = OPT_set64typ; + return _o_result; +} + OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir) { OPT_Struct _o_result; @@ -449,7 +462,7 @@ void OPT_CloseScope (void) OPT_topScope = OPT_topScope->left; } -void OPT_Init (OPS_Name name, SET opt) +void OPT_Init (OPS_Name name, uint32 opt) { OPT_topScope = OPT_universe; OPT_OpenScope(0, NIL); @@ -1171,6 +1184,9 @@ static OPT_Struct OPT_InTyp (int32 tag) if (tag == 4) { _o_result = OPT_IntType(OPM_SymRInt()); return _o_result; + } else if (tag == 7) { + _o_result = OPT_SetType(OPM_SymRInt()); + return _o_result; } else { _o_result = OPT_impCtxt.ref[__X(tag, 255)]; return _o_result; @@ -1628,7 +1644,7 @@ static void OPT_OutStr (OPT_Struct typ) OPT_Object strobj = NIL; if (typ->ref < OPT_expCtxt.ref) { OPM_SymWInt(-typ->ref); - if (typ->ref == 4) { + if (__IN(typ->ref, 0x90, 32)) { OPM_SymWInt(typ->size); } } else { @@ -1732,6 +1748,7 @@ static void OPT_OutConstant (OPT_Object obj) break; case 7: OPM_SymWSet(obj->conval->setval); + OPM_SymWInt(obj->typ->size); break; case 5: rval = obj->conval->realval; @@ -1959,28 +1976,32 @@ static void EnumPtrs(void (*P)(void*)) { P(OPT_topScope); P(OPT_undftyp); + P(OPT_niltyp); + P(OPT_notyp); P(OPT_bytetyp); + P(OPT_cpbytetyp); P(OPT_booltyp); P(OPT_chartyp); P(OPT_sinttyp); P(OPT_inttyp); P(OPT_linttyp); P(OPT_hinttyp); - P(OPT_adrtyp); P(OPT_int8typ); P(OPT_int16typ); P(OPT_int32typ); P(OPT_int64typ); + P(OPT_settyp); + P(OPT_set32typ); + P(OPT_set64typ); P(OPT_realtyp); P(OPT_lrltyp); - P(OPT_settyp); P(OPT_stringtyp); - P(OPT_niltyp); - P(OPT_notyp); + P(OPT_adrtyp); P(OPT_sysptrtyp); P(OPT_sintobj); P(OPT_intobj); P(OPT_lintobj); + P(OPT_setobj); __ENUMP(OPT_GlbMod, 64, P); P(OPT_universe); P(OPT_syslink); @@ -2056,6 +2077,8 @@ export void *OPT__init(void) OPT_EnterTyp((CHAR*)"INT16", 4, 2, &OPT_int16typ); OPT_EnterTyp((CHAR*)"INT32", 4, 4, &OPT_int32typ); OPT_EnterTyp((CHAR*)"INT64", 4, 8, &OPT_int64typ); + OPT_EnterTyp((CHAR*)"SET32", 7, 4, &OPT_set32typ); + OPT_EnterTyp((CHAR*)"SET64", 7, 8, &OPT_set64typ); OPT_EnterProc((CHAR*)"ADR", 20); OPT_EnterProc((CHAR*)"CC", 21); OPT_EnterProc((CHAR*)"LSH", 22); @@ -2073,13 +2096,14 @@ export void *OPT__init(void) OPT_topScope->right = NIL; OPT_EnterTyp((CHAR*)"BOOLEAN", 2, 1, &OPT_booltyp); OPT_EnterTyp((CHAR*)"CHAR", 3, 1, &OPT_chartyp); - OPT_EnterTyp((CHAR*)"SET", 7, -1, &OPT_settyp); OPT_EnterTyp((CHAR*)"REAL", 5, 4, &OPT_realtyp); OPT_EnterTyp((CHAR*)"LONGREAL", 6, 8, &OPT_lrltyp); OPT_EnterTyp((CHAR*)"HUGEINT", 4, 8, &OPT_hinttyp); + OPT_EnterTyp((CHAR*)"BYTE@", 4, 1, &OPT_cpbytetyp); OPT_EnterTypeAlias((CHAR*)"SHORTINT", &OPT_sintobj); OPT_EnterTypeAlias((CHAR*)"INTEGER", &OPT_intobj); OPT_EnterTypeAlias((CHAR*)"LONGINT", &OPT_lintobj); + OPT_EnterTypeAlias((CHAR*)"SET", &OPT_setobj); OPT_EnterBoolConst((CHAR*)"FALSE", 0); OPT_EnterBoolConst((CHAR*)"TRUE", 1); OPT_EnterProc((CHAR*)"HALT", 0); diff --git a/bootstrap/unix-88/OPT.h b/bootstrap/unix-88/OPT.h index 202c8278..2bc05576 100644 --- a/bootstrap/unix-88/OPT.h +++ b/bootstrap/unix-88/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPT__h #define OPT__h @@ -17,7 +17,7 @@ typedef OPT_ConstExt ext; int64 intval; int32 intval2; - SET setval; + uint32 setval; LONGREAL realval; } OPT_ConstDesc; @@ -67,8 +67,8 @@ typedef import OPT_Object OPT_topScope; -import OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_adrtyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp; -import OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj; +import OPT_Struct OPT_undftyp, OPT_niltyp, OPT_notyp, OPT_bytetyp, OPT_cpbytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_settyp, OPT_set32typ, OPT_set64typ, OPT_realtyp, OPT_lrltyp, OPT_stringtyp, OPT_adrtyp, OPT_sysptrtyp; +import OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj, OPT_setobj; import int8 OPT_nofGmod; import OPT_Object OPT_GlbMod[64]; import OPS_Name OPT_SelfName; @@ -92,7 +92,7 @@ import void OPT_FindField (OPS_Name name, OPT_Struct typ, OPT_Object *res); import void OPT_FindImport (OPT_Object mod, OPT_Object *res); import void OPT_IdFPrint (OPT_Struct typ); import void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done); -import void OPT_Init (OPS_Name name, SET opt); +import void OPT_Init (OPS_Name name, uint32 opt); import void OPT_InitRecno (void); import void OPT_Insert (OPS_Name name, OPT_Object *obj); import void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old); @@ -104,6 +104,7 @@ import OPT_Node OPT_NewNode (int8 class); import OPT_Object OPT_NewObj (void); import OPT_Struct OPT_NewStr (int8 form, int8 comp); import void OPT_OpenScope (int8 level, OPT_Object owner); +import OPT_Struct OPT_SetType (int32 size); import OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir); import int32 OPT_SizeAlignment (int32 size); import void OPT_TypSize (OPT_Struct typ); diff --git a/bootstrap/unix-88/OPV.c b/bootstrap/unix-88/OPV.c index 07fa214f..5171284e 100644 --- a/bootstrap/unix-88/OPV.c +++ b/bootstrap/unix-88/OPV.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPC.h" @@ -187,6 +188,7 @@ void OPV_AdrAndSize (OPT_Object topScope) OPV_Traverse(topScope->right, topScope, 1); OPV_Traverse(topScope->right, topScope, 0); OPT_chartyp->strobj->linkadr = 2; + OPT_cpbytetyp->strobj->linkadr = 2; OPT_settyp->strobj->linkadr = 2; OPT_realtyp->strobj->linkadr = 2; OPT_adrtyp->strobj->linkadr = 2; @@ -194,6 +196,8 @@ void OPV_AdrAndSize (OPT_Object topScope) OPT_int16typ->strobj->linkadr = 2; OPT_int32typ->strobj->linkadr = 2; OPT_int64typ->strobj->linkadr = 2; + OPT_set32typ->strobj->linkadr = 2; + OPT_set64typ->strobj->linkadr = 2; OPT_hinttyp->strobj->linkadr = 2; OPT_lrltyp->strobj->linkadr = 2; OPT_booltyp->strobj->linkadr = 2; diff --git a/bootstrap/unix-88/OPV.h b/bootstrap/unix-88/OPV.h index a44fb5b5..f5e41d45 100644 --- a/bootstrap/unix-88/OPV.h +++ b/bootstrap/unix-88/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/unix-88/Platform.c b/bootstrap/unix-88/Platform.c index 26dc3ce5..4d9d1fb1 100644 --- a/bootstrap/unix-88/Platform.c +++ b/bootstrap/unix-88/Platform.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" @@ -40,7 +41,7 @@ export int64 Platform_ArgVector; static Platform_HaltProcedure Platform_HaltHandler; static int32 Platform_TimeStart; export int16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd; -export CHAR Platform_nl[3]; +export CHAR Platform_NL[3]; export address *Platform_FileIdentity__typ; @@ -798,7 +799,7 @@ export void *Platform__init(void) Platform_SeekSet = Platform_seekset(); Platform_SeekCur = Platform_seekcur(); Platform_SeekEnd = Platform_seekend(); - Platform_nl[0] = 0x0a; - Platform_nl[1] = 0x00; + Platform_NL[0] = 0x0a; + Platform_NL[1] = 0x00; __ENDMOD; } diff --git a/bootstrap/unix-88/Platform.h b/bootstrap/unix-88/Platform.h index c9b53f3c..c308ce3a 100644 --- a/bootstrap/unix-88/Platform.h +++ b/bootstrap/unix-88/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Platform__h #define Platform__h @@ -26,7 +26,7 @@ import CHAR Platform_CWD[256]; import int16 Platform_ArgCount; import int64 Platform_ArgVector; import int16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd; -import CHAR Platform_nl[3]; +import CHAR Platform_NL[3]; import address *Platform_FileIdentity__typ; diff --git a/bootstrap/unix-88/Reals.c b/bootstrap/unix-88/Reals.c index 57e22100..d7d2994c 100644 --- a/bootstrap/unix-88/Reals.c +++ b/bootstrap/unix-88/Reals.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/unix-88/Reals.h b/bootstrap/unix-88/Reals.h index f3404dda..8c1ff819 100644 --- a/bootstrap/unix-88/Reals.h +++ b/bootstrap/unix-88/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/unix-88/Strings.c b/bootstrap/unix-88/Strings.c index bcf3cb9b..ac03bada 100644 --- a/bootstrap/unix-88/Strings.c +++ b/bootstrap/unix-88/Strings.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/unix-88/Strings.h b/bootstrap/unix-88/Strings.h index 9418692a..cc9d99a1 100644 --- a/bootstrap/unix-88/Strings.h +++ b/bootstrap/unix-88/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/unix-88/Texts.c b/bootstrap/unix-88/Texts.c index a71cf72a..9a4efb22 100644 --- a/bootstrap/unix-88/Texts.c +++ b/bootstrap/unix-88/Texts.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Files.h" @@ -183,7 +184,7 @@ export address *Texts_Writer__typ; export address *Texts__1__typ; export void Texts_Append (Texts_Text T, Texts_Buffer B); -export void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff); +export void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, uint32 sel, Texts_FontsFont fnt, int8 col, int8 voff); static Texts_Elem Texts_CloneElem (Texts_Elem e); static Texts_Piece Texts_ClonePiece (Texts_Piece p); export void Texts_Close (Texts_Text T, CHAR *name, LONGINT name__len); @@ -565,7 +566,7 @@ void Texts_Delete (Texts_Text T, int32 beg, int32 end) } } -void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff) +void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, uint32 sel, Texts_FontsFont fnt, int8 col, int8 voff) { Texts_Run c = NIL, u = NIL, un = NIL, v = NIL, vn = NIL; int32 co, uo, ud, vo, vd; diff --git a/bootstrap/unix-88/Texts.h b/bootstrap/unix-88/Texts.h index 47f1e428..7f02a3aa 100644 --- a/bootstrap/unix-88/Texts.h +++ b/bootstrap/unix-88/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Texts__h #define Texts__h @@ -130,7 +130,7 @@ import address *Texts_Scanner__typ; import address *Texts_Writer__typ; import void Texts_Append (Texts_Text T, Texts_Buffer B); -import void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff); +import void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, uint32 sel, Texts_FontsFont fnt, int8 col, int8 voff); import void Texts_Close (Texts_Text T, CHAR *name, LONGINT name__len); import void Texts_Copy (Texts_Buffer SB, Texts_Buffer DB); import void Texts_CopyElem (Texts_Elem SE, Texts_Elem DE); diff --git a/bootstrap/unix-88/errors.c b/bootstrap/unix-88/errors.c index ba890a17..f284397b 100644 --- a/bootstrap/unix-88/errors.c +++ b/bootstrap/unix-88/errors.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/unix-88/errors.h b/bootstrap/unix-88/errors.h index d8124792..5aa2a5f6 100644 --- a/bootstrap/unix-88/errors.h +++ b/bootstrap/unix-88/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/unix-88/extTools.c b/bootstrap/unix-88/extTools.c index 76fdc084..fe7eb545 100644 --- a/bootstrap/unix-88/extTools.c +++ b/bootstrap/unix-88/extTools.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" diff --git a/bootstrap/unix-88/extTools.h b/bootstrap/unix-88/extTools.h index bb5be954..8cdd8e01 100644 --- a/bootstrap/unix-88/extTools.h +++ b/bootstrap/unix-88/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/unix-88/vt100.c b/bootstrap/unix-88/vt100.c index c44586d2..a4bc9ec1 100644 --- a/bootstrap/unix-88/vt100.c +++ b/bootstrap/unix-88/vt100.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Console.h" diff --git a/bootstrap/unix-88/vt100.h b/bootstrap/unix-88/vt100.h index c9a01a7c..44d81f73 100644 --- a/bootstrap/unix-88/vt100.h +++ b/bootstrap/unix-88/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef vt100__h #define vt100__h diff --git a/bootstrap/windows-48/Compiler.c b/bootstrap/windows-48/Compiler.c index 1b3b14f1..637fd329 100644 --- a/bootstrap/windows-48/Compiler.c +++ b/bootstrap/windows-48/Compiler.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -83,7 +84,6 @@ static void Compiler_PropagateElementaryTypeSizes (void) OPT_Struct adrinttyp = NIL; OPT_sysptrtyp->size = OPM_AddressSize; OPT_adrtyp->size = OPM_AddressSize; - OPT_settyp->size = OPM_SetSize; adrinttyp = OPT_IntType(OPM_AddressSize); OPT_adrtyp->strobj = adrinttyp->strobj; OPT_sinttyp = OPT_IntType(OPM_ShortintSize); @@ -92,6 +92,20 @@ static void Compiler_PropagateElementaryTypeSizes (void) OPT_sintobj->typ = OPT_sinttyp; OPT_intobj->typ = OPT_inttyp; OPT_lintobj->typ = OPT_linttyp; + switch (OPM_LongintSize) { + case 4: + OPT_settyp = OPT_set32typ; + break; + default: + OPT_settyp = OPT_set64typ; + break; + } + OPT_setobj->typ = OPT_settyp; + if (__STRCMP(OPM_Model, "C") == 0) { + OPT_cpbytetyp->strobj->name[4] = 0x00; + } else { + OPT_cpbytetyp->strobj->name[4] = '@'; + } } void Compiler_Translate (void) diff --git a/bootstrap/windows-48/Configuration.c b/bootstrap/windows-48/Configuration.c index 85c8cf89..a3240e8e 100644 --- a/bootstrap/windows-48/Configuration.c +++ b/bootstrap/windows-48/Configuration.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" @@ -18,6 +19,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); + __MOVE("1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); __ENDMOD; } diff --git a/bootstrap/windows-48/Configuration.h b/bootstrap/windows-48/Configuration.h index a365d693..4d4279da 100644 --- a/bootstrap/windows-48/Configuration.h +++ b/bootstrap/windows-48/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/windows-48/Console.c b/bootstrap/windows-48/Console.c index 7d63057e..d6ad8ef3 100644 --- a/bootstrap/windows-48/Console.c +++ b/bootstrap/windows-48/Console.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Platform.h" diff --git a/bootstrap/windows-48/Console.h b/bootstrap/windows-48/Console.h index 08f4e38e..6549e2cc 100644 --- a/bootstrap/windows-48/Console.h +++ b/bootstrap/windows-48/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/windows-48/Files.c b/bootstrap/windows-48/Files.c index ef927317..39445fd2 100644 --- a/bootstrap/windows-48/Files.c +++ b/bootstrap/windows-48/Files.c @@ -1,13 +1,13 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" -#include "Configuration.h" -#include "Console.h" #include "Heap.h" +#include "Console.h" #include "Platform.h" #include "Strings.h" @@ -89,9 +89,8 @@ export void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x); export void Files_ReadLReal (Files_Rider *R, address *R__typ, LONGREAL *x); export void Files_ReadLine (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); export void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x); -export void Files_ReadNum64 (Files_Rider *R, address *R__typ, int64 *x); export void Files_ReadReal (Files_Rider *R, address *R__typ, REAL *x); -export void Files_ReadSet (Files_Rider *R, address *R__typ, SET *x); +export void Files_ReadSet (Files_Rider *R, address *R__typ, uint32 *x); export void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); export void Files_Register (Files_File f); export void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int16 *res); @@ -104,13 +103,13 @@ export void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, L export void Files_WriteInt (Files_Rider *R, address *R__typ, int16 x); export void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x); export void Files_WriteLReal (Files_Rider *R, address *R__typ, LONGREAL x); -export void Files_WriteNum (Files_Rider *R, address *R__typ, int32 x); -export void Files_WriteNum64 (Files_Rider *R, address *R__typ, int64 x); +export void Files_WriteNum (Files_Rider *R, address *R__typ, int64 x); export void Files_WriteReal (Files_Rider *R, address *R__typ, REAL x); -export void Files_WriteSet (Files_Rider *R, address *R__typ, SET x); +export void Files_WriteSet (Files_Rider *R, address *R__typ, uint32 x); export void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); #define Files_IdxTrap() __HALT(-1) +#define Files_ToAdr(x) (address)x static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int16 errcode) { @@ -662,7 +661,7 @@ void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x } else { min = n; } - __MOVE(((address)buf->data) + offset, ((address)x) + xpos, min); + __MOVE((address)buf->data + Files_ToAdr(offset), (address)x + Files_ToAdr(xpos), min); offset += min; (*r).offset = offset; xpos += min; @@ -722,7 +721,7 @@ void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT } else { min = n; } - __MOVE(((address)x) + xpos, ((address)buf->data) + offset, min); + __MOVE((address)x + Files_ToAdr(xpos), (address)buf->data + Files_ToAdr(offset), min); offset += min; (*r).offset = offset; if (offset > buf->size) { @@ -862,13 +861,13 @@ void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x) *x = (((int16)b[0] + __ASHL((int16)b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24); } -void Files_ReadSet (Files_Rider *R, address *R__typ, SET *x) +void Files_ReadSet (Files_Rider *R, address *R__typ, uint32 *x) { CHAR b[4]; int32 l; Files_ReadBytes(&*R, R__typ, (void*)b, 4, 4); l = (((int16)b[0] + __ASHL((int16)b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24); - *x = (SET)l; + *x = (uint32)l; } void Files_ReadReal (Files_Rider *R, address *R__typ, REAL *x) @@ -932,13 +931,6 @@ void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x) *x = n; } -void Files_ReadNum64 (Files_Rider *R, address *R__typ, int64 *x) -{ - int32 n; - Files_ReadNum(&*R, R__typ, &n); - *x = n; -} - void Files_WriteBool (Files_Rider *R, address *R__typ, BOOLEAN x) { Files_Write(&*R, R__typ, __VAL(CHAR, x)); @@ -962,7 +954,7 @@ void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x) Files_WriteBytes(&*R, R__typ, (void*)b, 4, 4); } -void Files_WriteSet (Files_Rider *R, address *R__typ, SET x) +void Files_WriteSet (Files_Rider *R, address *R__typ, uint32 x) { CHAR b[4]; int32 i; @@ -998,16 +990,7 @@ void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len Files_WriteBytes(&*R, R__typ, (void*)x, x__len * 1, i + 1); } -void Files_WriteNum (Files_Rider *R, address *R__typ, int32 x) -{ - while (x < -64 || x > 63) { - Files_Write(&*R, R__typ, (CHAR)(__MASK(x, -128) + 128)); - x = __ASHR(x, 7); - } - Files_Write(&*R, R__typ, (CHAR)__MASK(x, -128)); -} - -void Files_WriteNum64 (Files_Rider *R, address *R__typ, int64 x) +void Files_WriteNum (Files_Rider *R, address *R__typ, int64 x) { while (x < -64 || x > 63) { Files_Write(&*R, R__typ, (CHAR)(__MASK(x, -128) + 128)); @@ -1059,9 +1042,8 @@ __TDESC(Files_Rider, 1, 1) = {__TDFLDS("Rider", 20), {8, -8}}; export void *Files__init(void) { __DEFMOD; - __MODULE_IMPORT(Configuration); - __MODULE_IMPORT(Console); __MODULE_IMPORT(Heap); + __MODULE_IMPORT(Console); __MODULE_IMPORT(Platform); __MODULE_IMPORT(Strings); __REGMOD("Files", EnumPtrs); diff --git a/bootstrap/windows-48/Files.h b/bootstrap/windows-48/Files.h index 8d274283..1b482bb6 100644 --- a/bootstrap/windows-48/Files.h +++ b/bootstrap/windows-48/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ #ifndef Files__h #define Files__h @@ -46,9 +46,8 @@ import void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x); import void Files_ReadLReal (Files_Rider *R, address *R__typ, LONGREAL *x); import void Files_ReadLine (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); import void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x); -import void Files_ReadNum64 (Files_Rider *R, address *R__typ, int64 *x); import void Files_ReadReal (Files_Rider *R, address *R__typ, REAL *x); -import void Files_ReadSet (Files_Rider *R, address *R__typ, SET *x); +import void Files_ReadSet (Files_Rider *R, address *R__typ, uint32 *x); import void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); import void Files_Register (Files_File f); import void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int16 *res); @@ -60,10 +59,9 @@ import void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, L import void Files_WriteInt (Files_Rider *R, address *R__typ, int16 x); import void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x); import void Files_WriteLReal (Files_Rider *R, address *R__typ, LONGREAL x); -import void Files_WriteNum (Files_Rider *R, address *R__typ, int32 x); -import void Files_WriteNum64 (Files_Rider *R, address *R__typ, int64 x); +import void Files_WriteNum (Files_Rider *R, address *R__typ, int64 x); import void Files_WriteReal (Files_Rider *R, address *R__typ, REAL x); -import void Files_WriteSet (Files_Rider *R, address *R__typ, SET x); +import void Files_WriteSet (Files_Rider *R, address *R__typ, uint32 x); import void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); import void *Files__init(void); diff --git a/bootstrap/windows-48/Heap.c b/bootstrap/windows-48/Heap.c index 1f66b283..b3eea6a3 100644 --- a/bootstrap/windows-48/Heap.c +++ b/bootstrap/windows-48/Heap.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/windows-48/Heap.h b/bootstrap/windows-48/Heap.h index 9e9400e1..a7135c5b 100644 --- a/bootstrap/windows-48/Heap.h +++ b/bootstrap/windows-48/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/windows-48/Modules.c b/bootstrap/windows-48/Modules.c index f165488e..2984f32f 100644 --- a/bootstrap/windows-48/Modules.c +++ b/bootstrap/windows-48/Modules.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Console.h" diff --git a/bootstrap/windows-48/Modules.h b/bootstrap/windows-48/Modules.h index a2ceebdf..9b84521f 100644 --- a/bootstrap/windows-48/Modules.h +++ b/bootstrap/windows-48/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/windows-48/OPB.c b/bootstrap/windows-48/OPB.c index e370e621..d099cad7 100644 --- a/bootstrap/windows-48/OPB.c +++ b/bootstrap/windows-48/OPB.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPM.h" @@ -55,6 +56,7 @@ export void OPB_Return (OPT_Node *x, OPT_Object proc); export void OPB_SetElem (OPT_Node *x); static void OPB_SetIntType (OPT_Node node); export void OPB_SetRange (OPT_Node *x, OPT_Node y); +static void OPB_SetSetType (OPT_Node node); export void OPB_StFct (OPT_Node *par0, int8 fctno, int16 parno); export void OPB_StPar0 (OPT_Node *par0, int16 fctno); export void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno); @@ -223,6 +225,17 @@ static void OPB_SetIntType (OPT_Node node) node->typ = OPT_IntType(OPT_IntSize(node->conval->intval)); } +static void OPB_SetSetType (OPT_Node node) +{ + int32 i32; + __GET((address)&node->conval->setval + 4, i32, int32); + if (i32 == 0) { + node->typ = OPT_set32typ; + } else { + node->typ = OPT_set64typ; + } +} + OPT_Node OPB_NewIntConst (int64 intval) { OPT_Node _o_result; @@ -364,16 +377,16 @@ void OPB_Field (OPT_Node *x, OPT_Object y) } } -static struct TypTest__57 { +static struct TypTest__58 { OPT_Node *x; OPT_Object *obj; BOOLEAN *guard; - struct TypTest__57 *lnk; -} *TypTest__57_s; + struct TypTest__58 *lnk; +} *TypTest__58_s; -static void GTT__58 (OPT_Struct t0, OPT_Struct t1); +static void GTT__59 (OPT_Struct t0, OPT_Struct t1); -static void GTT__58 (OPT_Struct t0, OPT_Struct t1) +static void GTT__59 (OPT_Struct t0, OPT_Struct t1) { OPT_Node node = NIL; OPT_Struct t = NIL; @@ -386,54 +399,54 @@ static void GTT__58 (OPT_Struct t0, OPT_Struct t1) t1 = t1->BaseTyp; } if (t1 == t0 || t0->form == 0) { - if (*TypTest__57_s->guard) { - OPB_BindNodes(5, NIL, &*TypTest__57_s->x, NIL); - (*TypTest__57_s->x)->readonly = (*TypTest__57_s->x)->left->readonly; + if (*TypTest__58_s->guard) { + OPB_BindNodes(5, NIL, &*TypTest__58_s->x, NIL); + (*TypTest__58_s->x)->readonly = (*TypTest__58_s->x)->left->readonly; } else { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__57_s->x; - node->obj = *TypTest__57_s->obj; - *TypTest__57_s->x = node; + node->left = *TypTest__58_s->x; + node->obj = *TypTest__58_s->obj; + *TypTest__58_s->x = node; } } else { OPB_err(85); } } else if (t0 != t1) { OPB_err(85); - } else if (!*TypTest__57_s->guard) { - if ((*TypTest__57_s->x)->class == 5) { + } else if (!*TypTest__58_s->guard) { + if ((*TypTest__58_s->x)->class == 5) { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__57_s->x; - node->obj = *TypTest__57_s->obj; - *TypTest__57_s->x = node; + node->left = *TypTest__58_s->x; + node->obj = *TypTest__58_s->obj; + *TypTest__58_s->x = node; } else { - *TypTest__57_s->x = OPB_NewBoolConst(1); + *TypTest__58_s->x = OPB_NewBoolConst(1); } } } void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) { - struct TypTest__57 _s; + struct TypTest__58 _s; _s.x = x; _s.obj = &obj; _s.guard = &guard; - _s.lnk = TypTest__57_s; - TypTest__57_s = &_s; + _s.lnk = TypTest__58_s; + TypTest__58_s = &_s; if (OPB_NotVar(*x)) { OPB_err(112); } else if ((*x)->typ->form == 11) { if (((*x)->typ->BaseTyp->comp != 4 && (*x)->typ != OPT_sysptrtyp)) { OPB_err(85); } else if (obj->typ->form == 11) { - GTT__58((*x)->typ->BaseTyp, obj->typ->BaseTyp); + GTT__59((*x)->typ->BaseTyp, obj->typ->BaseTyp); } else { OPB_err(86); } } else if (((((*x)->typ->comp == 4 && (*x)->class == 1)) && obj->typ->comp == 4)) { - GTT__58((*x)->typ, obj->typ); + GTT__59((*x)->typ, obj->typ); } else { OPB_err(87); } @@ -442,7 +455,7 @@ void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) } else { (*x)->typ = OPT_booltyp; } - TypTest__57_s = _s.lnk; + TypTest__58_s = _s.lnk; } void OPB_In (OPT_Node *x, OPT_Node y) @@ -1109,7 +1122,13 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) f = (*x)->typ->form; g = typ->form; if ((*x)->class == 7) { - if (f == 4) { + if ((((f == 7 && g == 7)) && (*x)->typ->size > typ->size)) { + OPB_SetSetType(*x); + if ((*x)->typ->size > typ->size) { + OPB_err(203); + (*x)->conval->setval = 0x0; + } + } else if (f == 4) { if (g == 4) { if ((*x)->typ->size > typ->size) { OPB_SetIntType(*x); @@ -1243,6 +1262,13 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y) OPB_err(100); } break; + case 7: + if ((g == 7 && y->typ->size < z->typ->size)) { + OPB_Convert(&y, z->typ); + } else { + OPB_err(100); + } + break; case 5: if (g == 4) { OPB_Convert(&y, z->typ); @@ -1969,13 +1995,13 @@ void OPB_StPar0 (OPT_Node *par0, int16 fctno) *par0 = x; } -static struct StPar1__52 { - struct StPar1__52 *lnk; -} *StPar1__52_s; +static struct StPar1__53 { + struct StPar1__53 *lnk; +} *StPar1__53_s; -static OPT_Node NewOp__53 (int8 class, int8 subcl, OPT_Node left, OPT_Node right); +static OPT_Node NewOp__54 (int8 class, int8 subcl, OPT_Node left, OPT_Node right); -static OPT_Node NewOp__53 (int8 class, int8 subcl, OPT_Node left, OPT_Node right) +static OPT_Node NewOp__54 (int8 class, int8 subcl, OPT_Node left, OPT_Node right) { OPT_Node _o_result; OPT_Node node = NIL; @@ -1992,9 +2018,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) int16 f, L; OPT_Struct typ = NIL; OPT_Node p = NIL, t = NIL; - struct StPar1__52 _s; - _s.lnk = StPar1__52_s; - StPar1__52_s = &_s; + struct StPar1__53 _s; + _s.lnk = StPar1__53_s; + StPar1__53_s = &_s; p = *par0; f = x->typ->form; switch (fctno) { @@ -2010,7 +2036,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) OPB_err(111); } } - p = NewOp__53(19, fctno, p, x); + p = NewOp__54(19, fctno, p, x); p->typ = OPT_notyp; } break; @@ -2021,7 +2047,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (int64)OPM_MaxSet))) { OPB_err(202); } - p = NewOp__53(19, fctno, p, x); + p = NewOp__54(19, fctno, p, x); } else { OPB_err(111); } @@ -2046,7 +2072,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) p = p->left; x->conval->intval += 1; } - p = NewOp__53(12, 19, p, x); + p = NewOp__54(12, 19, p, x); p->typ = OPT_linttyp; } else { p = x; @@ -2068,7 +2094,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) t = x; x = p; p = t; - p = NewOp__53(19, 18, p, x); + p = NewOp__54(19, 18, p, x); } else { OPB_err(111); } @@ -2094,7 +2120,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) } p->obj = NIL; } else { - p = NewOp__53(12, 17, p, x); + p = NewOp__54(12, 17, p, x); p->typ = p->left->typ; } } else { @@ -2125,9 +2151,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) OPB_err(111); } else { if (fctno == 22) { - p = NewOp__53(12, 27, p, x); + p = NewOp__54(12, 27, p, x); } else { - p = NewOp__53(12, 28, p, x); + p = NewOp__54(12, 28, p, x); } p->typ = p->left->typ; } @@ -2144,7 +2170,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) x = p; p = t; } - p = NewOp__53(19, fctno, p, x); + p = NewOp__54(19, fctno, p, x); } else { OPB_err(111); } @@ -2154,7 +2180,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) if (x->class == 8 || x->class == 9) { OPB_err(126); } else if (f == 4) { - p = NewOp__53(12, 26, p, x); + p = NewOp__54(12, 26, p, x); } else { OPB_err(111); } @@ -2182,7 +2208,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) if (x->class == 8 || x->class == 9) { OPB_err(126); } else if (f == 4) { - p = NewOp__53(19, 30, p, x); + p = NewOp__54(19, 30, p, x); } else { OPB_err(111); } @@ -2228,7 +2254,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) break; } *par0 = p; - StPar1__52_s = _s.lnk; + StPar1__53_s = _s.lnk; } void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n) diff --git a/bootstrap/windows-48/OPB.h b/bootstrap/windows-48/OPB.h index 8c0fd594..07dda5db 100644 --- a/bootstrap/windows-48/OPB.h +++ b/bootstrap/windows-48/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/windows-48/OPC.c b/bootstrap/windows-48/OPC.c index 4c9ae495..545deb33 100644 --- a/bootstrap/windows-48/OPC.c +++ b/bootstrap/windows-48/OPC.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -193,11 +194,15 @@ void OPC_Ident (OPT_Object obj) OPM_Write('_'); } } - } else if ((mode == 5 && obj->typ->form == 4)) { + } else if ((mode == 5 && __IN(obj->typ->form, 0x90, 32))) { if (obj->typ == OPT_adrtyp) { OPM_WriteString((CHAR*)"address", 8); } else { - OPM_WriteString((CHAR*)"int", 4); + if (obj->typ->form == 4) { + OPM_WriteString((CHAR*)"int", 4); + } else { + OPM_WriteString((CHAR*)"uint", 5); + } OPM_WriteInt(__ASHL(obj->typ->size, 3)); } } else { @@ -1233,13 +1238,16 @@ void OPC_GenBdy (OPT_Node n) OPM_currFile = 1; OPC_GenHeaderMsg(); OPM_WriteLn(); - OPM_WriteString((CHAR*)"#define INTEGER int", 20); + OPM_WriteString((CHAR*)"#define SHORTINT int", 21); + OPM_WriteInt(__ASHL(OPT_sinttyp->size, 3)); + OPM_WriteLn(); + OPM_WriteString((CHAR*)"#define INTEGER int", 21); OPM_WriteInt(__ASHL(OPT_inttyp->size, 3)); OPM_WriteLn(); - OPM_WriteString((CHAR*)"#define LONGINT int", 20); + OPM_WriteString((CHAR*)"#define LONGINT int", 21); OPM_WriteInt(__ASHL(OPT_linttyp->size, 3)); OPM_WriteLn(); - OPM_WriteString((CHAR*)"#define SET uint", 21); + OPM_WriteString((CHAR*)"#define SET uint", 22); OPM_WriteInt(__ASHL(OPT_settyp->size, 3)); OPM_WriteLn(); OPM_WriteLn(); @@ -1851,7 +1859,7 @@ void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim) void OPC_Constant (OPT_Const con, int16 form) { int16 i; - SET s; + uint32 s; int32 hex; BOOLEAN skipLeading; switch (form) { diff --git a/bootstrap/windows-48/OPC.h b/bootstrap/windows-48/OPC.h index e681f43d..c9cf0ace 100644 --- a/bootstrap/windows-48/OPC.h +++ b/bootstrap/windows-48/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/windows-48/OPM.c b/bootstrap/windows-48/OPM.c index 534a5c0d..32bb978e 100644 --- a/bootstrap/windows-48/OPM.c +++ b/bootstrap/windows-48/OPM.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -25,7 +26,7 @@ static int16 OPM_GlobalAddressSize; export int16 OPM_AddressSize; static int16 OPM_GlobalAlignment; export int16 OPM_Alignment; -export SET OPM_GlobalOptions, OPM_Options; +export uint32 OPM_GlobalOptions, OPM_Options; export int16 OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_SetSize, OPM_MaxSet; export int64 OPM_MaxIndex; export LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal; @@ -52,7 +53,7 @@ export void OPM_DeleteNewSym (void); export void OPM_FPrint (int32 *fp, int64 val); export void OPM_FPrintLReal (int32 *fp, LONGREAL lr); export void OPM_FPrintReal (int32 *fp, REAL real); -export void OPM_FPrintSet (int32 *fp, SET set); +export void OPM_FPrintSet (int32 *fp, uint32 set); static void OPM_FindLine (Files_File f, Files_Rider *r, address *r__typ, int64 pos); export void OPM_Get (CHAR *ch); export void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); @@ -80,12 +81,12 @@ export int32 OPM_SymRInt (void); export int64 OPM_SymRInt64 (void); export void OPM_SymRLReal (LONGREAL *lr); export void OPM_SymRReal (REAL *r); -export void OPM_SymRSet (SET *s); +export void OPM_SymRSet (uint32 *s); export void OPM_SymWCh (CHAR ch); export void OPM_SymWInt (int64 i); export void OPM_SymWLReal (LONGREAL lr); export void OPM_SymWReal (REAL r); -export void OPM_SymWSet (SET s); +export void OPM_SymWSet (uint32 s); static void OPM_VerboseListSizes (void); export void OPM_Write (CHAR ch); export void OPM_WriteHex (int64 i); @@ -329,7 +330,7 @@ BOOLEAN OPM_OpenPar (void) OPM_LogWStr((CHAR*)" -V Display compiler debugging messages.", 46); OPM_LogWLn(); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" Size model for elementary types (default O2 on 32 bit builds, OV on 64 bits)", 79); + OPM_LogWStr((CHAR*)" Size model for elementary types (default O2)", 47); OPM_LogWLn(); OPM_LogWStr((CHAR*)" -O2 Original Oberon / Oberon-2: 8 bit SHORTINT, 16 bit INTEGER, 32 bit LONGINT and SET.", 95); OPM_LogWLn(); @@ -709,10 +710,10 @@ void OPM_err (int16 n) void OPM_FPrint (int32 *fp, int64 val) { - *fp = __ROTL((int32)((SET)*fp ^ __VAL(SET, val)), 1, 32); + *fp = __ROTL((int32)((uint32)*fp ^ __VAL(uint32, val)), 1, 32); } -void OPM_FPrintSet (int32 *fp, SET set) +void OPM_FPrintSet (int32 *fp, uint32 set) { OPM_FPrint(&*fp, (int32)set); } @@ -751,13 +752,11 @@ int32 OPM_SymRInt (void) int64 OPM_SymRInt64 (void) { int64 _o_result; - int64 k; - Files_ReadNum64(&OPM_oldSF, Files_Rider__typ, &k); - _o_result = k; + _o_result = OPM_SymRInt(); return _o_result; } -void OPM_SymRSet (SET *s) +void OPM_SymRSet (uint32 *s) { Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (int32*)&*s); } @@ -808,10 +807,10 @@ void OPM_SymWCh (CHAR ch) void OPM_SymWInt (int64 i) { - Files_WriteNum64(&OPM_newSF, Files_Rider__typ, i); + Files_WriteNum(&OPM_newSF, Files_Rider__typ, i); } -void OPM_SymWSet (SET s) +void OPM_SymWSet (uint32 s) { Files_WriteNum(&OPM_newSF, Files_Rider__typ, (int32)s); } diff --git a/bootstrap/windows-48/OPM.h b/bootstrap/windows-48/OPM.h index 933ef1b5..dd3c0c27 100644 --- a/bootstrap/windows-48/OPM.h +++ b/bootstrap/windows-48/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPM__h #define OPM__h @@ -8,7 +8,7 @@ import CHAR OPM_Model[10]; import int16 OPM_AddressSize, OPM_Alignment; -import SET OPM_GlobalOptions, OPM_Options; +import uint32 OPM_GlobalOptions, OPM_Options; import int16 OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_SetSize, OPM_MaxSet; import int64 OPM_MaxIndex; import LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal; @@ -26,7 +26,7 @@ import void OPM_DeleteNewSym (void); import void OPM_FPrint (int32 *fp, int64 val); import void OPM_FPrintLReal (int32 *fp, LONGREAL lr); import void OPM_FPrintReal (int32 *fp, REAL real); -import void OPM_FPrintSet (int32 *fp, SET set); +import void OPM_FPrintSet (int32 *fp, uint32 set); import void OPM_Get (CHAR *ch); import void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); import void OPM_InitOptions (void); @@ -49,12 +49,12 @@ import int32 OPM_SymRInt (void); import int64 OPM_SymRInt64 (void); import void OPM_SymRLReal (LONGREAL *lr); import void OPM_SymRReal (REAL *r); -import void OPM_SymRSet (SET *s); +import void OPM_SymRSet (uint32 *s); import void OPM_SymWCh (CHAR ch); import void OPM_SymWInt (int64 i); import void OPM_SymWLReal (LONGREAL lr); import void OPM_SymWReal (REAL r); -import void OPM_SymWSet (SET s); +import void OPM_SymWSet (uint32 s); import void OPM_Write (CHAR ch); import void OPM_WriteHex (int64 i); import void OPM_WriteInt (int64 i); diff --git a/bootstrap/windows-48/OPP.c b/bootstrap/windows-48/OPP.c index 010efab1..1eff447d 100644 --- a/bootstrap/windows-48/OPP.c +++ b/bootstrap/windows-48/OPP.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPB.h" @@ -39,7 +40,7 @@ static void OPP_Expression (OPT_Node *x); static BOOLEAN OPP_Extends (OPT_Struct x, OPT_Struct b); static void OPP_Factor (OPT_Node *x); static void OPP_FormalParameters (OPT_Object *firstPar, OPT_Struct *resTyp); -export void OPP_Module (OPT_Node *prog, SET opt); +export void OPP_Module (OPT_Node *prog, uint32 opt); static void OPP_PointerType (OPT_Struct *typ); static void OPP_ProcedureDeclaration (OPT_Node *x); static void OPP_Receiver (int8 *mode, OPS_Name name, OPT_Struct *typ, OPT_Struct *rec); @@ -1775,7 +1776,7 @@ static void OPP_Block (OPT_Node *procdec, OPT_Node *statseq) OPP_CheckSym(41); } -void OPP_Module (OPT_Node *prog, SET opt) +void OPP_Module (OPT_Node *prog, uint32 opt) { OPS_Name impName, aliasName; OPT_Node procdec = NIL, statseq = NIL; diff --git a/bootstrap/windows-48/OPP.h b/bootstrap/windows-48/OPP.h index 373d8daa..c759545a 100644 --- a/bootstrap/windows-48/OPP.h +++ b/bootstrap/windows-48/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPP__h #define OPP__h @@ -9,7 +9,7 @@ -import void OPP_Module (OPT_Node *prog, SET opt); +import void OPP_Module (OPT_Node *prog, uint32 opt); import void *OPP__init(void); diff --git a/bootstrap/windows-48/OPS.c b/bootstrap/windows-48/OPS.c index f8ed61bf..18c3c066 100644 --- a/bootstrap/windows-48/OPS.c +++ b/bootstrap/windows-48/OPS.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPM.h" diff --git a/bootstrap/windows-48/OPS.h b/bootstrap/windows-48/OPS.h index 1f02668b..260fcd01 100644 --- a/bootstrap/windows-48/OPS.h +++ b/bootstrap/windows-48/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/windows-48/OPT.c b/bootstrap/windows-48/OPT.c index 3f54ed72..5bfcda58 100644 --- a/bootstrap/windows-48/OPT.c +++ b/bootstrap/windows-48/OPT.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPM.h" @@ -19,7 +20,7 @@ typedef OPT_ConstExt ext; int64 intval; int32 intval2; - SET setval; + uint32 setval; LONGREAL realval; } OPT_ConstDesc; @@ -88,8 +89,8 @@ typedef export OPT_Object OPT_topScope; -export OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_adrtyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp; -export OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj; +export OPT_Struct OPT_undftyp, OPT_niltyp, OPT_notyp, OPT_bytetyp, OPT_cpbytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_settyp, OPT_set32typ, OPT_set64typ, OPT_realtyp, OPT_lrltyp, OPT_stringtyp, OPT_adrtyp, OPT_sysptrtyp; +export OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj, OPT_setobj; export int8 OPT_nofGmod; export OPT_Object OPT_GlbMod[64]; export OPS_Name OPT_SelfName; @@ -137,7 +138,7 @@ static void OPT_InSign (int8 mno, OPT_Struct *res, OPT_Object *par); static void OPT_InStruct (OPT_Struct *typ); static OPT_Object OPT_InTProc (int8 mno); static OPT_Struct OPT_InTyp (int32 tag); -export void OPT_Init (OPS_Name name, SET opt); +export void OPT_Init (OPS_Name name, uint32 opt); export void OPT_InitRecno (void); static void OPT_InitStruct (OPT_Struct *typ, int8 form); export void OPT_Insert (OPS_Name name, OPT_Object *obj); @@ -159,6 +160,7 @@ static void OPT_OutObj (OPT_Object obj); static void OPT_OutSign (OPT_Struct result, OPT_Object par); static void OPT_OutStr (OPT_Struct typ); static void OPT_OutTProcs (OPT_Struct typ, OPT_Object obj); +export OPT_Struct OPT_SetType (int32 size); export OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir); export int32 OPT_SizeAlignment (int32 size); export void OPT_TypSize (OPT_Struct typ); @@ -209,6 +211,17 @@ OPT_Struct OPT_IntType (int32 size) return _o_result; } +OPT_Struct OPT_SetType (int32 size) +{ + OPT_Struct _o_result; + if (size == OPT_set32typ->size) { + _o_result = OPT_set32typ; + return _o_result; + } + _o_result = OPT_set64typ; + return _o_result; +} + OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir) { OPT_Struct _o_result; @@ -449,7 +462,7 @@ void OPT_CloseScope (void) OPT_topScope = OPT_topScope->left; } -void OPT_Init (OPS_Name name, SET opt) +void OPT_Init (OPS_Name name, uint32 opt) { OPT_topScope = OPT_universe; OPT_OpenScope(0, NIL); @@ -1171,6 +1184,9 @@ static OPT_Struct OPT_InTyp (int32 tag) if (tag == 4) { _o_result = OPT_IntType(OPM_SymRInt()); return _o_result; + } else if (tag == 7) { + _o_result = OPT_SetType(OPM_SymRInt()); + return _o_result; } else { _o_result = OPT_impCtxt.ref[__X(tag, 255)]; return _o_result; @@ -1628,7 +1644,7 @@ static void OPT_OutStr (OPT_Struct typ) OPT_Object strobj = NIL; if (typ->ref < OPT_expCtxt.ref) { OPM_SymWInt(-typ->ref); - if (typ->ref == 4) { + if (__IN(typ->ref, 0x90, 32)) { OPM_SymWInt(typ->size); } } else { @@ -1732,6 +1748,7 @@ static void OPT_OutConstant (OPT_Object obj) break; case 7: OPM_SymWSet(obj->conval->setval); + OPM_SymWInt(obj->typ->size); break; case 5: rval = obj->conval->realval; @@ -1959,28 +1976,32 @@ static void EnumPtrs(void (*P)(void*)) { P(OPT_topScope); P(OPT_undftyp); + P(OPT_niltyp); + P(OPT_notyp); P(OPT_bytetyp); + P(OPT_cpbytetyp); P(OPT_booltyp); P(OPT_chartyp); P(OPT_sinttyp); P(OPT_inttyp); P(OPT_linttyp); P(OPT_hinttyp); - P(OPT_adrtyp); P(OPT_int8typ); P(OPT_int16typ); P(OPT_int32typ); P(OPT_int64typ); + P(OPT_settyp); + P(OPT_set32typ); + P(OPT_set64typ); P(OPT_realtyp); P(OPT_lrltyp); - P(OPT_settyp); P(OPT_stringtyp); - P(OPT_niltyp); - P(OPT_notyp); + P(OPT_adrtyp); P(OPT_sysptrtyp); P(OPT_sintobj); P(OPT_intobj); P(OPT_lintobj); + P(OPT_setobj); __ENUMP(OPT_GlbMod, 64, P); P(OPT_universe); P(OPT_syslink); @@ -2056,6 +2077,8 @@ export void *OPT__init(void) OPT_EnterTyp((CHAR*)"INT16", 4, 2, &OPT_int16typ); OPT_EnterTyp((CHAR*)"INT32", 4, 4, &OPT_int32typ); OPT_EnterTyp((CHAR*)"INT64", 4, 8, &OPT_int64typ); + OPT_EnterTyp((CHAR*)"SET32", 7, 4, &OPT_set32typ); + OPT_EnterTyp((CHAR*)"SET64", 7, 8, &OPT_set64typ); OPT_EnterProc((CHAR*)"ADR", 20); OPT_EnterProc((CHAR*)"CC", 21); OPT_EnterProc((CHAR*)"LSH", 22); @@ -2073,13 +2096,14 @@ export void *OPT__init(void) OPT_topScope->right = NIL; OPT_EnterTyp((CHAR*)"BOOLEAN", 2, 1, &OPT_booltyp); OPT_EnterTyp((CHAR*)"CHAR", 3, 1, &OPT_chartyp); - OPT_EnterTyp((CHAR*)"SET", 7, -1, &OPT_settyp); OPT_EnterTyp((CHAR*)"REAL", 5, 4, &OPT_realtyp); OPT_EnterTyp((CHAR*)"LONGREAL", 6, 8, &OPT_lrltyp); OPT_EnterTyp((CHAR*)"HUGEINT", 4, 8, &OPT_hinttyp); + OPT_EnterTyp((CHAR*)"BYTE@", 4, 1, &OPT_cpbytetyp); OPT_EnterTypeAlias((CHAR*)"SHORTINT", &OPT_sintobj); OPT_EnterTypeAlias((CHAR*)"INTEGER", &OPT_intobj); OPT_EnterTypeAlias((CHAR*)"LONGINT", &OPT_lintobj); + OPT_EnterTypeAlias((CHAR*)"SET", &OPT_setobj); OPT_EnterBoolConst((CHAR*)"FALSE", 0); OPT_EnterBoolConst((CHAR*)"TRUE", 1); OPT_EnterProc((CHAR*)"HALT", 0); diff --git a/bootstrap/windows-48/OPT.h b/bootstrap/windows-48/OPT.h index 202c8278..2bc05576 100644 --- a/bootstrap/windows-48/OPT.h +++ b/bootstrap/windows-48/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPT__h #define OPT__h @@ -17,7 +17,7 @@ typedef OPT_ConstExt ext; int64 intval; int32 intval2; - SET setval; + uint32 setval; LONGREAL realval; } OPT_ConstDesc; @@ -67,8 +67,8 @@ typedef import OPT_Object OPT_topScope; -import OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_adrtyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp; -import OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj; +import OPT_Struct OPT_undftyp, OPT_niltyp, OPT_notyp, OPT_bytetyp, OPT_cpbytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_settyp, OPT_set32typ, OPT_set64typ, OPT_realtyp, OPT_lrltyp, OPT_stringtyp, OPT_adrtyp, OPT_sysptrtyp; +import OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj, OPT_setobj; import int8 OPT_nofGmod; import OPT_Object OPT_GlbMod[64]; import OPS_Name OPT_SelfName; @@ -92,7 +92,7 @@ import void OPT_FindField (OPS_Name name, OPT_Struct typ, OPT_Object *res); import void OPT_FindImport (OPT_Object mod, OPT_Object *res); import void OPT_IdFPrint (OPT_Struct typ); import void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done); -import void OPT_Init (OPS_Name name, SET opt); +import void OPT_Init (OPS_Name name, uint32 opt); import void OPT_InitRecno (void); import void OPT_Insert (OPS_Name name, OPT_Object *obj); import void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old); @@ -104,6 +104,7 @@ import OPT_Node OPT_NewNode (int8 class); import OPT_Object OPT_NewObj (void); import OPT_Struct OPT_NewStr (int8 form, int8 comp); import void OPT_OpenScope (int8 level, OPT_Object owner); +import OPT_Struct OPT_SetType (int32 size); import OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir); import int32 OPT_SizeAlignment (int32 size); import void OPT_TypSize (OPT_Struct typ); diff --git a/bootstrap/windows-48/OPV.c b/bootstrap/windows-48/OPV.c index ff99f665..99e7aa6a 100644 --- a/bootstrap/windows-48/OPV.c +++ b/bootstrap/windows-48/OPV.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPC.h" @@ -187,6 +188,7 @@ void OPV_AdrAndSize (OPT_Object topScope) OPV_Traverse(topScope->right, topScope, 1); OPV_Traverse(topScope->right, topScope, 0); OPT_chartyp->strobj->linkadr = 2; + OPT_cpbytetyp->strobj->linkadr = 2; OPT_settyp->strobj->linkadr = 2; OPT_realtyp->strobj->linkadr = 2; OPT_adrtyp->strobj->linkadr = 2; @@ -194,6 +196,8 @@ void OPV_AdrAndSize (OPT_Object topScope) OPT_int16typ->strobj->linkadr = 2; OPT_int32typ->strobj->linkadr = 2; OPT_int64typ->strobj->linkadr = 2; + OPT_set32typ->strobj->linkadr = 2; + OPT_set64typ->strobj->linkadr = 2; OPT_hinttyp->strobj->linkadr = 2; OPT_lrltyp->strobj->linkadr = 2; OPT_booltyp->strobj->linkadr = 2; diff --git a/bootstrap/windows-48/OPV.h b/bootstrap/windows-48/OPV.h index a44fb5b5..f5e41d45 100644 --- a/bootstrap/windows-48/OPV.h +++ b/bootstrap/windows-48/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/windows-48/Platform.c b/bootstrap/windows-48/Platform.c index 41a1da42..38a8dd6e 100644 --- a/bootstrap/windows-48/Platform.c +++ b/bootstrap/windows-48/Platform.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/windows-48/Platform.h b/bootstrap/windows-48/Platform.h index 7917d958..0d3476b4 100644 --- a/bootstrap/windows-48/Platform.h +++ b/bootstrap/windows-48/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/windows-48/Reals.c b/bootstrap/windows-48/Reals.c index 57e22100..d7d2994c 100644 --- a/bootstrap/windows-48/Reals.c +++ b/bootstrap/windows-48/Reals.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/windows-48/Reals.h b/bootstrap/windows-48/Reals.h index f3404dda..8c1ff819 100644 --- a/bootstrap/windows-48/Reals.h +++ b/bootstrap/windows-48/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/windows-48/Strings.c b/bootstrap/windows-48/Strings.c index bcf3cb9b..ac03bada 100644 --- a/bootstrap/windows-48/Strings.c +++ b/bootstrap/windows-48/Strings.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/windows-48/Strings.h b/bootstrap/windows-48/Strings.h index 9418692a..cc9d99a1 100644 --- a/bootstrap/windows-48/Strings.h +++ b/bootstrap/windows-48/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/windows-48/Texts.c b/bootstrap/windows-48/Texts.c index 28f099a4..09661382 100644 --- a/bootstrap/windows-48/Texts.c +++ b/bootstrap/windows-48/Texts.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Files.h" @@ -183,7 +184,7 @@ export address *Texts_Writer__typ; export address *Texts__1__typ; export void Texts_Append (Texts_Text T, Texts_Buffer B); -export void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff); +export void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, uint32 sel, Texts_FontsFont fnt, int8 col, int8 voff); static Texts_Elem Texts_CloneElem (Texts_Elem e); static Texts_Piece Texts_ClonePiece (Texts_Piece p); export void Texts_Close (Texts_Text T, CHAR *name, LONGINT name__len); @@ -565,7 +566,7 @@ void Texts_Delete (Texts_Text T, int32 beg, int32 end) } } -void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff) +void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, uint32 sel, Texts_FontsFont fnt, int8 col, int8 voff) { Texts_Run c = NIL, u = NIL, un = NIL, v = NIL, vn = NIL; int32 co, uo, ud, vo, vd; diff --git a/bootstrap/windows-48/Texts.h b/bootstrap/windows-48/Texts.h index 0afd65f7..86f8f5b7 100644 --- a/bootstrap/windows-48/Texts.h +++ b/bootstrap/windows-48/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Texts__h #define Texts__h @@ -130,7 +130,7 @@ import address *Texts_Scanner__typ; import address *Texts_Writer__typ; import void Texts_Append (Texts_Text T, Texts_Buffer B); -import void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff); +import void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, uint32 sel, Texts_FontsFont fnt, int8 col, int8 voff); import void Texts_Close (Texts_Text T, CHAR *name, LONGINT name__len); import void Texts_Copy (Texts_Buffer SB, Texts_Buffer DB); import void Texts_CopyElem (Texts_Elem SE, Texts_Elem DE); diff --git a/bootstrap/windows-48/errors.c b/bootstrap/windows-48/errors.c index ba890a17..f284397b 100644 --- a/bootstrap/windows-48/errors.c +++ b/bootstrap/windows-48/errors.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/windows-48/errors.h b/bootstrap/windows-48/errors.h index d8124792..5aa2a5f6 100644 --- a/bootstrap/windows-48/errors.h +++ b/bootstrap/windows-48/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/windows-48/extTools.c b/bootstrap/windows-48/extTools.c index 76fdc084..fe7eb545 100644 --- a/bootstrap/windows-48/extTools.c +++ b/bootstrap/windows-48/extTools.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" diff --git a/bootstrap/windows-48/extTools.h b/bootstrap/windows-48/extTools.h index bb5be954..8cdd8e01 100644 --- a/bootstrap/windows-48/extTools.h +++ b/bootstrap/windows-48/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/windows-48/vt100.c b/bootstrap/windows-48/vt100.c index c44586d2..a4bc9ec1 100644 --- a/bootstrap/windows-48/vt100.c +++ b/bootstrap/windows-48/vt100.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Console.h" diff --git a/bootstrap/windows-48/vt100.h b/bootstrap/windows-48/vt100.h index c9a01a7c..44d81f73 100644 --- a/bootstrap/windows-48/vt100.h +++ b/bootstrap/windows-48/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef vt100__h #define vt100__h diff --git a/bootstrap/windows-88/Compiler.c b/bootstrap/windows-88/Compiler.c index 1b3b14f1..637fd329 100644 --- a/bootstrap/windows-88/Compiler.c +++ b/bootstrap/windows-88/Compiler.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -83,7 +84,6 @@ static void Compiler_PropagateElementaryTypeSizes (void) OPT_Struct adrinttyp = NIL; OPT_sysptrtyp->size = OPM_AddressSize; OPT_adrtyp->size = OPM_AddressSize; - OPT_settyp->size = OPM_SetSize; adrinttyp = OPT_IntType(OPM_AddressSize); OPT_adrtyp->strobj = adrinttyp->strobj; OPT_sinttyp = OPT_IntType(OPM_ShortintSize); @@ -92,6 +92,20 @@ static void Compiler_PropagateElementaryTypeSizes (void) OPT_sintobj->typ = OPT_sinttyp; OPT_intobj->typ = OPT_inttyp; OPT_lintobj->typ = OPT_linttyp; + switch (OPM_LongintSize) { + case 4: + OPT_settyp = OPT_set32typ; + break; + default: + OPT_settyp = OPT_set64typ; + break; + } + OPT_setobj->typ = OPT_settyp; + if (__STRCMP(OPM_Model, "C") == 0) { + OPT_cpbytetyp->strobj->name[4] = 0x00; + } else { + OPT_cpbytetyp->strobj->name[4] = '@'; + } } void Compiler_Translate (void) diff --git a/bootstrap/windows-88/Configuration.c b/bootstrap/windows-88/Configuration.c index 85c8cf89..a3240e8e 100644 --- a/bootstrap/windows-88/Configuration.c +++ b/bootstrap/windows-88/Configuration.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" @@ -18,6 +19,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); + __MOVE("1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); __ENDMOD; } diff --git a/bootstrap/windows-88/Configuration.h b/bootstrap/windows-88/Configuration.h index a365d693..4d4279da 100644 --- a/bootstrap/windows-88/Configuration.h +++ b/bootstrap/windows-88/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/windows-88/Console.c b/bootstrap/windows-88/Console.c index 7d63057e..d6ad8ef3 100644 --- a/bootstrap/windows-88/Console.c +++ b/bootstrap/windows-88/Console.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Platform.h" diff --git a/bootstrap/windows-88/Console.h b/bootstrap/windows-88/Console.h index 08f4e38e..6549e2cc 100644 --- a/bootstrap/windows-88/Console.h +++ b/bootstrap/windows-88/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/windows-88/Files.c b/bootstrap/windows-88/Files.c index 72ef67df..8d9e0113 100644 --- a/bootstrap/windows-88/Files.c +++ b/bootstrap/windows-88/Files.c @@ -1,13 +1,13 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" -#include "Configuration.h" -#include "Console.h" #include "Heap.h" +#include "Console.h" #include "Platform.h" #include "Strings.h" @@ -89,9 +89,8 @@ export void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x); export void Files_ReadLReal (Files_Rider *R, address *R__typ, LONGREAL *x); export void Files_ReadLine (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); export void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x); -export void Files_ReadNum64 (Files_Rider *R, address *R__typ, int64 *x); export void Files_ReadReal (Files_Rider *R, address *R__typ, REAL *x); -export void Files_ReadSet (Files_Rider *R, address *R__typ, SET *x); +export void Files_ReadSet (Files_Rider *R, address *R__typ, uint32 *x); export void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); export void Files_Register (Files_File f); export void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int16 *res); @@ -104,13 +103,13 @@ export void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, L export void Files_WriteInt (Files_Rider *R, address *R__typ, int16 x); export void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x); export void Files_WriteLReal (Files_Rider *R, address *R__typ, LONGREAL x); -export void Files_WriteNum (Files_Rider *R, address *R__typ, int32 x); -export void Files_WriteNum64 (Files_Rider *R, address *R__typ, int64 x); +export void Files_WriteNum (Files_Rider *R, address *R__typ, int64 x); export void Files_WriteReal (Files_Rider *R, address *R__typ, REAL x); -export void Files_WriteSet (Files_Rider *R, address *R__typ, SET x); +export void Files_WriteSet (Files_Rider *R, address *R__typ, uint32 x); export void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); #define Files_IdxTrap() __HALT(-1) +#define Files_ToAdr(x) (address)x static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int16 errcode) { @@ -662,7 +661,7 @@ void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x } else { min = n; } - __MOVE((address)buf->data + (int64)offset, (address)x + (int64)xpos, min); + __MOVE((address)buf->data + Files_ToAdr(offset), (address)x + Files_ToAdr(xpos), min); offset += min; (*r).offset = offset; xpos += min; @@ -722,7 +721,7 @@ void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT } else { min = n; } - __MOVE((address)x + (int64)xpos, (address)buf->data + (int64)offset, min); + __MOVE((address)x + Files_ToAdr(xpos), (address)buf->data + Files_ToAdr(offset), min); offset += min; (*r).offset = offset; if (offset > buf->size) { @@ -862,13 +861,13 @@ void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x) *x = (((int16)b[0] + __ASHL((int16)b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24); } -void Files_ReadSet (Files_Rider *R, address *R__typ, SET *x) +void Files_ReadSet (Files_Rider *R, address *R__typ, uint32 *x) { CHAR b[4]; int32 l; Files_ReadBytes(&*R, R__typ, (void*)b, 4, 4); l = (((int16)b[0] + __ASHL((int16)b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24); - *x = (SET)l; + *x = (uint32)l; } void Files_ReadReal (Files_Rider *R, address *R__typ, REAL *x) @@ -932,13 +931,6 @@ void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x) *x = n; } -void Files_ReadNum64 (Files_Rider *R, address *R__typ, int64 *x) -{ - int32 n; - Files_ReadNum(&*R, R__typ, &n); - *x = n; -} - void Files_WriteBool (Files_Rider *R, address *R__typ, BOOLEAN x) { Files_Write(&*R, R__typ, __VAL(CHAR, x)); @@ -962,7 +954,7 @@ void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x) Files_WriteBytes(&*R, R__typ, (void*)b, 4, 4); } -void Files_WriteSet (Files_Rider *R, address *R__typ, SET x) +void Files_WriteSet (Files_Rider *R, address *R__typ, uint32 x) { CHAR b[4]; int32 i; @@ -998,16 +990,7 @@ void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len Files_WriteBytes(&*R, R__typ, (void*)x, x__len * 1, i + 1); } -void Files_WriteNum (Files_Rider *R, address *R__typ, int32 x) -{ - while (x < -64 || x > 63) { - Files_Write(&*R, R__typ, (CHAR)(__MASK(x, -128) + 128)); - x = __ASHR(x, 7); - } - Files_Write(&*R, R__typ, (CHAR)__MASK(x, -128)); -} - -void Files_WriteNum64 (Files_Rider *R, address *R__typ, int64 x) +void Files_WriteNum (Files_Rider *R, address *R__typ, int64 x) { while (x < -64 || x > 63) { Files_Write(&*R, R__typ, (CHAR)(__MASK(x, -128) + 128)); @@ -1059,9 +1042,8 @@ __TDESC(Files_Rider, 1, 1) = {__TDFLDS("Rider", 24), {8, -16}}; export void *Files__init(void) { __DEFMOD; - __MODULE_IMPORT(Configuration); - __MODULE_IMPORT(Console); __MODULE_IMPORT(Heap); + __MODULE_IMPORT(Console); __MODULE_IMPORT(Platform); __MODULE_IMPORT(Strings); __REGMOD("Files", EnumPtrs); diff --git a/bootstrap/windows-88/Files.h b/bootstrap/windows-88/Files.h index 668d8ebf..acb178a5 100644 --- a/bootstrap/windows-88/Files.h +++ b/bootstrap/windows-88/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ #ifndef Files__h #define Files__h @@ -48,9 +48,8 @@ import void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x); import void Files_ReadLReal (Files_Rider *R, address *R__typ, LONGREAL *x); import void Files_ReadLine (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); import void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x); -import void Files_ReadNum64 (Files_Rider *R, address *R__typ, int64 *x); import void Files_ReadReal (Files_Rider *R, address *R__typ, REAL *x); -import void Files_ReadSet (Files_Rider *R, address *R__typ, SET *x); +import void Files_ReadSet (Files_Rider *R, address *R__typ, uint32 *x); import void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); import void Files_Register (Files_File f); import void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int16 *res); @@ -62,10 +61,9 @@ import void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, L import void Files_WriteInt (Files_Rider *R, address *R__typ, int16 x); import void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x); import void Files_WriteLReal (Files_Rider *R, address *R__typ, LONGREAL x); -import void Files_WriteNum (Files_Rider *R, address *R__typ, int32 x); -import void Files_WriteNum64 (Files_Rider *R, address *R__typ, int64 x); +import void Files_WriteNum (Files_Rider *R, address *R__typ, int64 x); import void Files_WriteReal (Files_Rider *R, address *R__typ, REAL x); -import void Files_WriteSet (Files_Rider *R, address *R__typ, SET x); +import void Files_WriteSet (Files_Rider *R, address *R__typ, uint32 x); import void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); import void *Files__init(void); diff --git a/bootstrap/windows-88/Heap.c b/bootstrap/windows-88/Heap.c index 71ad15a1..571a7dd2 100644 --- a/bootstrap/windows-88/Heap.c +++ b/bootstrap/windows-88/Heap.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/windows-88/Heap.h b/bootstrap/windows-88/Heap.h index 0cd62e2b..2187094a 100644 --- a/bootstrap/windows-88/Heap.h +++ b/bootstrap/windows-88/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/windows-88/Modules.c b/bootstrap/windows-88/Modules.c index 0e05b5aa..e18d29cf 100644 --- a/bootstrap/windows-88/Modules.c +++ b/bootstrap/windows-88/Modules.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Console.h" diff --git a/bootstrap/windows-88/Modules.h b/bootstrap/windows-88/Modules.h index a2ceebdf..9b84521f 100644 --- a/bootstrap/windows-88/Modules.h +++ b/bootstrap/windows-88/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/windows-88/OPB.c b/bootstrap/windows-88/OPB.c index e370e621..d099cad7 100644 --- a/bootstrap/windows-88/OPB.c +++ b/bootstrap/windows-88/OPB.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPM.h" @@ -55,6 +56,7 @@ export void OPB_Return (OPT_Node *x, OPT_Object proc); export void OPB_SetElem (OPT_Node *x); static void OPB_SetIntType (OPT_Node node); export void OPB_SetRange (OPT_Node *x, OPT_Node y); +static void OPB_SetSetType (OPT_Node node); export void OPB_StFct (OPT_Node *par0, int8 fctno, int16 parno); export void OPB_StPar0 (OPT_Node *par0, int16 fctno); export void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno); @@ -223,6 +225,17 @@ static void OPB_SetIntType (OPT_Node node) node->typ = OPT_IntType(OPT_IntSize(node->conval->intval)); } +static void OPB_SetSetType (OPT_Node node) +{ + int32 i32; + __GET((address)&node->conval->setval + 4, i32, int32); + if (i32 == 0) { + node->typ = OPT_set32typ; + } else { + node->typ = OPT_set64typ; + } +} + OPT_Node OPB_NewIntConst (int64 intval) { OPT_Node _o_result; @@ -364,16 +377,16 @@ void OPB_Field (OPT_Node *x, OPT_Object y) } } -static struct TypTest__57 { +static struct TypTest__58 { OPT_Node *x; OPT_Object *obj; BOOLEAN *guard; - struct TypTest__57 *lnk; -} *TypTest__57_s; + struct TypTest__58 *lnk; +} *TypTest__58_s; -static void GTT__58 (OPT_Struct t0, OPT_Struct t1); +static void GTT__59 (OPT_Struct t0, OPT_Struct t1); -static void GTT__58 (OPT_Struct t0, OPT_Struct t1) +static void GTT__59 (OPT_Struct t0, OPT_Struct t1) { OPT_Node node = NIL; OPT_Struct t = NIL; @@ -386,54 +399,54 @@ static void GTT__58 (OPT_Struct t0, OPT_Struct t1) t1 = t1->BaseTyp; } if (t1 == t0 || t0->form == 0) { - if (*TypTest__57_s->guard) { - OPB_BindNodes(5, NIL, &*TypTest__57_s->x, NIL); - (*TypTest__57_s->x)->readonly = (*TypTest__57_s->x)->left->readonly; + if (*TypTest__58_s->guard) { + OPB_BindNodes(5, NIL, &*TypTest__58_s->x, NIL); + (*TypTest__58_s->x)->readonly = (*TypTest__58_s->x)->left->readonly; } else { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__57_s->x; - node->obj = *TypTest__57_s->obj; - *TypTest__57_s->x = node; + node->left = *TypTest__58_s->x; + node->obj = *TypTest__58_s->obj; + *TypTest__58_s->x = node; } } else { OPB_err(85); } } else if (t0 != t1) { OPB_err(85); - } else if (!*TypTest__57_s->guard) { - if ((*TypTest__57_s->x)->class == 5) { + } else if (!*TypTest__58_s->guard) { + if ((*TypTest__58_s->x)->class == 5) { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__57_s->x; - node->obj = *TypTest__57_s->obj; - *TypTest__57_s->x = node; + node->left = *TypTest__58_s->x; + node->obj = *TypTest__58_s->obj; + *TypTest__58_s->x = node; } else { - *TypTest__57_s->x = OPB_NewBoolConst(1); + *TypTest__58_s->x = OPB_NewBoolConst(1); } } } void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) { - struct TypTest__57 _s; + struct TypTest__58 _s; _s.x = x; _s.obj = &obj; _s.guard = &guard; - _s.lnk = TypTest__57_s; - TypTest__57_s = &_s; + _s.lnk = TypTest__58_s; + TypTest__58_s = &_s; if (OPB_NotVar(*x)) { OPB_err(112); } else if ((*x)->typ->form == 11) { if (((*x)->typ->BaseTyp->comp != 4 && (*x)->typ != OPT_sysptrtyp)) { OPB_err(85); } else if (obj->typ->form == 11) { - GTT__58((*x)->typ->BaseTyp, obj->typ->BaseTyp); + GTT__59((*x)->typ->BaseTyp, obj->typ->BaseTyp); } else { OPB_err(86); } } else if (((((*x)->typ->comp == 4 && (*x)->class == 1)) && obj->typ->comp == 4)) { - GTT__58((*x)->typ, obj->typ); + GTT__59((*x)->typ, obj->typ); } else { OPB_err(87); } @@ -442,7 +455,7 @@ void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) } else { (*x)->typ = OPT_booltyp; } - TypTest__57_s = _s.lnk; + TypTest__58_s = _s.lnk; } void OPB_In (OPT_Node *x, OPT_Node y) @@ -1109,7 +1122,13 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) f = (*x)->typ->form; g = typ->form; if ((*x)->class == 7) { - if (f == 4) { + if ((((f == 7 && g == 7)) && (*x)->typ->size > typ->size)) { + OPB_SetSetType(*x); + if ((*x)->typ->size > typ->size) { + OPB_err(203); + (*x)->conval->setval = 0x0; + } + } else if (f == 4) { if (g == 4) { if ((*x)->typ->size > typ->size) { OPB_SetIntType(*x); @@ -1243,6 +1262,13 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y) OPB_err(100); } break; + case 7: + if ((g == 7 && y->typ->size < z->typ->size)) { + OPB_Convert(&y, z->typ); + } else { + OPB_err(100); + } + break; case 5: if (g == 4) { OPB_Convert(&y, z->typ); @@ -1969,13 +1995,13 @@ void OPB_StPar0 (OPT_Node *par0, int16 fctno) *par0 = x; } -static struct StPar1__52 { - struct StPar1__52 *lnk; -} *StPar1__52_s; +static struct StPar1__53 { + struct StPar1__53 *lnk; +} *StPar1__53_s; -static OPT_Node NewOp__53 (int8 class, int8 subcl, OPT_Node left, OPT_Node right); +static OPT_Node NewOp__54 (int8 class, int8 subcl, OPT_Node left, OPT_Node right); -static OPT_Node NewOp__53 (int8 class, int8 subcl, OPT_Node left, OPT_Node right) +static OPT_Node NewOp__54 (int8 class, int8 subcl, OPT_Node left, OPT_Node right) { OPT_Node _o_result; OPT_Node node = NIL; @@ -1992,9 +2018,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) int16 f, L; OPT_Struct typ = NIL; OPT_Node p = NIL, t = NIL; - struct StPar1__52 _s; - _s.lnk = StPar1__52_s; - StPar1__52_s = &_s; + struct StPar1__53 _s; + _s.lnk = StPar1__53_s; + StPar1__53_s = &_s; p = *par0; f = x->typ->form; switch (fctno) { @@ -2010,7 +2036,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) OPB_err(111); } } - p = NewOp__53(19, fctno, p, x); + p = NewOp__54(19, fctno, p, x); p->typ = OPT_notyp; } break; @@ -2021,7 +2047,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (int64)OPM_MaxSet))) { OPB_err(202); } - p = NewOp__53(19, fctno, p, x); + p = NewOp__54(19, fctno, p, x); } else { OPB_err(111); } @@ -2046,7 +2072,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) p = p->left; x->conval->intval += 1; } - p = NewOp__53(12, 19, p, x); + p = NewOp__54(12, 19, p, x); p->typ = OPT_linttyp; } else { p = x; @@ -2068,7 +2094,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) t = x; x = p; p = t; - p = NewOp__53(19, 18, p, x); + p = NewOp__54(19, 18, p, x); } else { OPB_err(111); } @@ -2094,7 +2120,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) } p->obj = NIL; } else { - p = NewOp__53(12, 17, p, x); + p = NewOp__54(12, 17, p, x); p->typ = p->left->typ; } } else { @@ -2125,9 +2151,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) OPB_err(111); } else { if (fctno == 22) { - p = NewOp__53(12, 27, p, x); + p = NewOp__54(12, 27, p, x); } else { - p = NewOp__53(12, 28, p, x); + p = NewOp__54(12, 28, p, x); } p->typ = p->left->typ; } @@ -2144,7 +2170,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) x = p; p = t; } - p = NewOp__53(19, fctno, p, x); + p = NewOp__54(19, fctno, p, x); } else { OPB_err(111); } @@ -2154,7 +2180,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) if (x->class == 8 || x->class == 9) { OPB_err(126); } else if (f == 4) { - p = NewOp__53(12, 26, p, x); + p = NewOp__54(12, 26, p, x); } else { OPB_err(111); } @@ -2182,7 +2208,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) if (x->class == 8 || x->class == 9) { OPB_err(126); } else if (f == 4) { - p = NewOp__53(19, 30, p, x); + p = NewOp__54(19, 30, p, x); } else { OPB_err(111); } @@ -2228,7 +2254,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) break; } *par0 = p; - StPar1__52_s = _s.lnk; + StPar1__53_s = _s.lnk; } void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n) diff --git a/bootstrap/windows-88/OPB.h b/bootstrap/windows-88/OPB.h index 8c0fd594..07dda5db 100644 --- a/bootstrap/windows-88/OPB.h +++ b/bootstrap/windows-88/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/windows-88/OPC.c b/bootstrap/windows-88/OPC.c index 4c9ae495..545deb33 100644 --- a/bootstrap/windows-88/OPC.c +++ b/bootstrap/windows-88/OPC.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -193,11 +194,15 @@ void OPC_Ident (OPT_Object obj) OPM_Write('_'); } } - } else if ((mode == 5 && obj->typ->form == 4)) { + } else if ((mode == 5 && __IN(obj->typ->form, 0x90, 32))) { if (obj->typ == OPT_adrtyp) { OPM_WriteString((CHAR*)"address", 8); } else { - OPM_WriteString((CHAR*)"int", 4); + if (obj->typ->form == 4) { + OPM_WriteString((CHAR*)"int", 4); + } else { + OPM_WriteString((CHAR*)"uint", 5); + } OPM_WriteInt(__ASHL(obj->typ->size, 3)); } } else { @@ -1233,13 +1238,16 @@ void OPC_GenBdy (OPT_Node n) OPM_currFile = 1; OPC_GenHeaderMsg(); OPM_WriteLn(); - OPM_WriteString((CHAR*)"#define INTEGER int", 20); + OPM_WriteString((CHAR*)"#define SHORTINT int", 21); + OPM_WriteInt(__ASHL(OPT_sinttyp->size, 3)); + OPM_WriteLn(); + OPM_WriteString((CHAR*)"#define INTEGER int", 21); OPM_WriteInt(__ASHL(OPT_inttyp->size, 3)); OPM_WriteLn(); - OPM_WriteString((CHAR*)"#define LONGINT int", 20); + OPM_WriteString((CHAR*)"#define LONGINT int", 21); OPM_WriteInt(__ASHL(OPT_linttyp->size, 3)); OPM_WriteLn(); - OPM_WriteString((CHAR*)"#define SET uint", 21); + OPM_WriteString((CHAR*)"#define SET uint", 22); OPM_WriteInt(__ASHL(OPT_settyp->size, 3)); OPM_WriteLn(); OPM_WriteLn(); @@ -1851,7 +1859,7 @@ void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim) void OPC_Constant (OPT_Const con, int16 form) { int16 i; - SET s; + uint32 s; int32 hex; BOOLEAN skipLeading; switch (form) { diff --git a/bootstrap/windows-88/OPC.h b/bootstrap/windows-88/OPC.h index e681f43d..c9cf0ace 100644 --- a/bootstrap/windows-88/OPC.h +++ b/bootstrap/windows-88/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/windows-88/OPM.c b/bootstrap/windows-88/OPM.c index 297ade25..9ecaaba2 100644 --- a/bootstrap/windows-88/OPM.c +++ b/bootstrap/windows-88/OPM.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -25,7 +26,7 @@ static int16 OPM_GlobalAddressSize; export int16 OPM_AddressSize; static int16 OPM_GlobalAlignment; export int16 OPM_Alignment; -export SET OPM_GlobalOptions, OPM_Options; +export uint32 OPM_GlobalOptions, OPM_Options; export int16 OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_SetSize, OPM_MaxSet; export int64 OPM_MaxIndex; export LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal; @@ -52,7 +53,7 @@ export void OPM_DeleteNewSym (void); export void OPM_FPrint (int32 *fp, int64 val); export void OPM_FPrintLReal (int32 *fp, LONGREAL lr); export void OPM_FPrintReal (int32 *fp, REAL real); -export void OPM_FPrintSet (int32 *fp, SET set); +export void OPM_FPrintSet (int32 *fp, uint32 set); static void OPM_FindLine (Files_File f, Files_Rider *r, address *r__typ, int64 pos); export void OPM_Get (CHAR *ch); export void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); @@ -80,12 +81,12 @@ export int32 OPM_SymRInt (void); export int64 OPM_SymRInt64 (void); export void OPM_SymRLReal (LONGREAL *lr); export void OPM_SymRReal (REAL *r); -export void OPM_SymRSet (SET *s); +export void OPM_SymRSet (uint32 *s); export void OPM_SymWCh (CHAR ch); export void OPM_SymWInt (int64 i); export void OPM_SymWLReal (LONGREAL lr); export void OPM_SymWReal (REAL r); -export void OPM_SymWSet (SET s); +export void OPM_SymWSet (uint32 s); static void OPM_VerboseListSizes (void); export void OPM_Write (CHAR ch); export void OPM_WriteHex (int64 i); @@ -329,7 +330,7 @@ BOOLEAN OPM_OpenPar (void) OPM_LogWStr((CHAR*)" -V Display compiler debugging messages.", 46); OPM_LogWLn(); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" Size model for elementary types (default O2 on 32 bit builds, OV on 64 bits)", 79); + OPM_LogWStr((CHAR*)" Size model for elementary types (default O2)", 47); OPM_LogWLn(); OPM_LogWStr((CHAR*)" -O2 Original Oberon / Oberon-2: 8 bit SHORTINT, 16 bit INTEGER, 32 bit LONGINT and SET.", 95); OPM_LogWLn(); @@ -709,10 +710,10 @@ void OPM_err (int16 n) void OPM_FPrint (int32 *fp, int64 val) { - *fp = __ROTL((int32)((SET)*fp ^ __VAL(SET, val)), 1, 32); + *fp = __ROTL((int32)((uint32)*fp ^ __VAL(uint32, val)), 1, 32); } -void OPM_FPrintSet (int32 *fp, SET set) +void OPM_FPrintSet (int32 *fp, uint32 set) { OPM_FPrint(&*fp, (int32)set); } @@ -751,13 +752,11 @@ int32 OPM_SymRInt (void) int64 OPM_SymRInt64 (void) { int64 _o_result; - int64 k; - Files_ReadNum64(&OPM_oldSF, Files_Rider__typ, &k); - _o_result = k; + _o_result = OPM_SymRInt(); return _o_result; } -void OPM_SymRSet (SET *s) +void OPM_SymRSet (uint32 *s) { Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (int32*)&*s); } @@ -808,10 +807,10 @@ void OPM_SymWCh (CHAR ch) void OPM_SymWInt (int64 i) { - Files_WriteNum64(&OPM_newSF, Files_Rider__typ, i); + Files_WriteNum(&OPM_newSF, Files_Rider__typ, i); } -void OPM_SymWSet (SET s) +void OPM_SymWSet (uint32 s) { Files_WriteNum(&OPM_newSF, Files_Rider__typ, (int32)s); } diff --git a/bootstrap/windows-88/OPM.h b/bootstrap/windows-88/OPM.h index 933ef1b5..dd3c0c27 100644 --- a/bootstrap/windows-88/OPM.h +++ b/bootstrap/windows-88/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPM__h #define OPM__h @@ -8,7 +8,7 @@ import CHAR OPM_Model[10]; import int16 OPM_AddressSize, OPM_Alignment; -import SET OPM_GlobalOptions, OPM_Options; +import uint32 OPM_GlobalOptions, OPM_Options; import int16 OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_SetSize, OPM_MaxSet; import int64 OPM_MaxIndex; import LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal; @@ -26,7 +26,7 @@ import void OPM_DeleteNewSym (void); import void OPM_FPrint (int32 *fp, int64 val); import void OPM_FPrintLReal (int32 *fp, LONGREAL lr); import void OPM_FPrintReal (int32 *fp, REAL real); -import void OPM_FPrintSet (int32 *fp, SET set); +import void OPM_FPrintSet (int32 *fp, uint32 set); import void OPM_Get (CHAR *ch); import void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); import void OPM_InitOptions (void); @@ -49,12 +49,12 @@ import int32 OPM_SymRInt (void); import int64 OPM_SymRInt64 (void); import void OPM_SymRLReal (LONGREAL *lr); import void OPM_SymRReal (REAL *r); -import void OPM_SymRSet (SET *s); +import void OPM_SymRSet (uint32 *s); import void OPM_SymWCh (CHAR ch); import void OPM_SymWInt (int64 i); import void OPM_SymWLReal (LONGREAL lr); import void OPM_SymWReal (REAL r); -import void OPM_SymWSet (SET s); +import void OPM_SymWSet (uint32 s); import void OPM_Write (CHAR ch); import void OPM_WriteHex (int64 i); import void OPM_WriteInt (int64 i); diff --git a/bootstrap/windows-88/OPP.c b/bootstrap/windows-88/OPP.c index c9986e20..6bfd4b38 100644 --- a/bootstrap/windows-88/OPP.c +++ b/bootstrap/windows-88/OPP.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPB.h" @@ -39,7 +40,7 @@ static void OPP_Expression (OPT_Node *x); static BOOLEAN OPP_Extends (OPT_Struct x, OPT_Struct b); static void OPP_Factor (OPT_Node *x); static void OPP_FormalParameters (OPT_Object *firstPar, OPT_Struct *resTyp); -export void OPP_Module (OPT_Node *prog, SET opt); +export void OPP_Module (OPT_Node *prog, uint32 opt); static void OPP_PointerType (OPT_Struct *typ); static void OPP_ProcedureDeclaration (OPT_Node *x); static void OPP_Receiver (int8 *mode, OPS_Name name, OPT_Struct *typ, OPT_Struct *rec); @@ -1775,7 +1776,7 @@ static void OPP_Block (OPT_Node *procdec, OPT_Node *statseq) OPP_CheckSym(41); } -void OPP_Module (OPT_Node *prog, SET opt) +void OPP_Module (OPT_Node *prog, uint32 opt) { OPS_Name impName, aliasName; OPT_Node procdec = NIL, statseq = NIL; diff --git a/bootstrap/windows-88/OPP.h b/bootstrap/windows-88/OPP.h index 373d8daa..c759545a 100644 --- a/bootstrap/windows-88/OPP.h +++ b/bootstrap/windows-88/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPP__h #define OPP__h @@ -9,7 +9,7 @@ -import void OPP_Module (OPT_Node *prog, SET opt); +import void OPP_Module (OPT_Node *prog, uint32 opt); import void *OPP__init(void); diff --git a/bootstrap/windows-88/OPS.c b/bootstrap/windows-88/OPS.c index f8ed61bf..18c3c066 100644 --- a/bootstrap/windows-88/OPS.c +++ b/bootstrap/windows-88/OPS.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPM.h" diff --git a/bootstrap/windows-88/OPS.h b/bootstrap/windows-88/OPS.h index 1f02668b..260fcd01 100644 --- a/bootstrap/windows-88/OPS.h +++ b/bootstrap/windows-88/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/windows-88/OPT.c b/bootstrap/windows-88/OPT.c index b0a12a18..98ef4a7f 100644 --- a/bootstrap/windows-88/OPT.c +++ b/bootstrap/windows-88/OPT.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPM.h" @@ -19,7 +20,7 @@ typedef OPT_ConstExt ext; int64 intval; int32 intval2; - SET setval; + uint32 setval; LONGREAL realval; } OPT_ConstDesc; @@ -88,8 +89,8 @@ typedef export OPT_Object OPT_topScope; -export OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_adrtyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp; -export OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj; +export OPT_Struct OPT_undftyp, OPT_niltyp, OPT_notyp, OPT_bytetyp, OPT_cpbytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_settyp, OPT_set32typ, OPT_set64typ, OPT_realtyp, OPT_lrltyp, OPT_stringtyp, OPT_adrtyp, OPT_sysptrtyp; +export OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj, OPT_setobj; export int8 OPT_nofGmod; export OPT_Object OPT_GlbMod[64]; export OPS_Name OPT_SelfName; @@ -137,7 +138,7 @@ static void OPT_InSign (int8 mno, OPT_Struct *res, OPT_Object *par); static void OPT_InStruct (OPT_Struct *typ); static OPT_Object OPT_InTProc (int8 mno); static OPT_Struct OPT_InTyp (int32 tag); -export void OPT_Init (OPS_Name name, SET opt); +export void OPT_Init (OPS_Name name, uint32 opt); export void OPT_InitRecno (void); static void OPT_InitStruct (OPT_Struct *typ, int8 form); export void OPT_Insert (OPS_Name name, OPT_Object *obj); @@ -159,6 +160,7 @@ static void OPT_OutObj (OPT_Object obj); static void OPT_OutSign (OPT_Struct result, OPT_Object par); static void OPT_OutStr (OPT_Struct typ); static void OPT_OutTProcs (OPT_Struct typ, OPT_Object obj); +export OPT_Struct OPT_SetType (int32 size); export OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir); export int32 OPT_SizeAlignment (int32 size); export void OPT_TypSize (OPT_Struct typ); @@ -209,6 +211,17 @@ OPT_Struct OPT_IntType (int32 size) return _o_result; } +OPT_Struct OPT_SetType (int32 size) +{ + OPT_Struct _o_result; + if (size == OPT_set32typ->size) { + _o_result = OPT_set32typ; + return _o_result; + } + _o_result = OPT_set64typ; + return _o_result; +} + OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir) { OPT_Struct _o_result; @@ -449,7 +462,7 @@ void OPT_CloseScope (void) OPT_topScope = OPT_topScope->left; } -void OPT_Init (OPS_Name name, SET opt) +void OPT_Init (OPS_Name name, uint32 opt) { OPT_topScope = OPT_universe; OPT_OpenScope(0, NIL); @@ -1171,6 +1184,9 @@ static OPT_Struct OPT_InTyp (int32 tag) if (tag == 4) { _o_result = OPT_IntType(OPM_SymRInt()); return _o_result; + } else if (tag == 7) { + _o_result = OPT_SetType(OPM_SymRInt()); + return _o_result; } else { _o_result = OPT_impCtxt.ref[__X(tag, 255)]; return _o_result; @@ -1628,7 +1644,7 @@ static void OPT_OutStr (OPT_Struct typ) OPT_Object strobj = NIL; if (typ->ref < OPT_expCtxt.ref) { OPM_SymWInt(-typ->ref); - if (typ->ref == 4) { + if (__IN(typ->ref, 0x90, 32)) { OPM_SymWInt(typ->size); } } else { @@ -1732,6 +1748,7 @@ static void OPT_OutConstant (OPT_Object obj) break; case 7: OPM_SymWSet(obj->conval->setval); + OPM_SymWInt(obj->typ->size); break; case 5: rval = obj->conval->realval; @@ -1959,28 +1976,32 @@ static void EnumPtrs(void (*P)(void*)) { P(OPT_topScope); P(OPT_undftyp); + P(OPT_niltyp); + P(OPT_notyp); P(OPT_bytetyp); + P(OPT_cpbytetyp); P(OPT_booltyp); P(OPT_chartyp); P(OPT_sinttyp); P(OPT_inttyp); P(OPT_linttyp); P(OPT_hinttyp); - P(OPT_adrtyp); P(OPT_int8typ); P(OPT_int16typ); P(OPT_int32typ); P(OPT_int64typ); + P(OPT_settyp); + P(OPT_set32typ); + P(OPT_set64typ); P(OPT_realtyp); P(OPT_lrltyp); - P(OPT_settyp); P(OPT_stringtyp); - P(OPT_niltyp); - P(OPT_notyp); + P(OPT_adrtyp); P(OPT_sysptrtyp); P(OPT_sintobj); P(OPT_intobj); P(OPT_lintobj); + P(OPT_setobj); __ENUMP(OPT_GlbMod, 64, P); P(OPT_universe); P(OPT_syslink); @@ -2056,6 +2077,8 @@ export void *OPT__init(void) OPT_EnterTyp((CHAR*)"INT16", 4, 2, &OPT_int16typ); OPT_EnterTyp((CHAR*)"INT32", 4, 4, &OPT_int32typ); OPT_EnterTyp((CHAR*)"INT64", 4, 8, &OPT_int64typ); + OPT_EnterTyp((CHAR*)"SET32", 7, 4, &OPT_set32typ); + OPT_EnterTyp((CHAR*)"SET64", 7, 8, &OPT_set64typ); OPT_EnterProc((CHAR*)"ADR", 20); OPT_EnterProc((CHAR*)"CC", 21); OPT_EnterProc((CHAR*)"LSH", 22); @@ -2073,13 +2096,14 @@ export void *OPT__init(void) OPT_topScope->right = NIL; OPT_EnterTyp((CHAR*)"BOOLEAN", 2, 1, &OPT_booltyp); OPT_EnterTyp((CHAR*)"CHAR", 3, 1, &OPT_chartyp); - OPT_EnterTyp((CHAR*)"SET", 7, -1, &OPT_settyp); OPT_EnterTyp((CHAR*)"REAL", 5, 4, &OPT_realtyp); OPT_EnterTyp((CHAR*)"LONGREAL", 6, 8, &OPT_lrltyp); OPT_EnterTyp((CHAR*)"HUGEINT", 4, 8, &OPT_hinttyp); + OPT_EnterTyp((CHAR*)"BYTE@", 4, 1, &OPT_cpbytetyp); OPT_EnterTypeAlias((CHAR*)"SHORTINT", &OPT_sintobj); OPT_EnterTypeAlias((CHAR*)"INTEGER", &OPT_intobj); OPT_EnterTypeAlias((CHAR*)"LONGINT", &OPT_lintobj); + OPT_EnterTypeAlias((CHAR*)"SET", &OPT_setobj); OPT_EnterBoolConst((CHAR*)"FALSE", 0); OPT_EnterBoolConst((CHAR*)"TRUE", 1); OPT_EnterProc((CHAR*)"HALT", 0); diff --git a/bootstrap/windows-88/OPT.h b/bootstrap/windows-88/OPT.h index 202c8278..2bc05576 100644 --- a/bootstrap/windows-88/OPT.h +++ b/bootstrap/windows-88/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPT__h #define OPT__h @@ -17,7 +17,7 @@ typedef OPT_ConstExt ext; int64 intval; int32 intval2; - SET setval; + uint32 setval; LONGREAL realval; } OPT_ConstDesc; @@ -67,8 +67,8 @@ typedef import OPT_Object OPT_topScope; -import OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_adrtyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp; -import OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj; +import OPT_Struct OPT_undftyp, OPT_niltyp, OPT_notyp, OPT_bytetyp, OPT_cpbytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_settyp, OPT_set32typ, OPT_set64typ, OPT_realtyp, OPT_lrltyp, OPT_stringtyp, OPT_adrtyp, OPT_sysptrtyp; +import OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj, OPT_setobj; import int8 OPT_nofGmod; import OPT_Object OPT_GlbMod[64]; import OPS_Name OPT_SelfName; @@ -92,7 +92,7 @@ import void OPT_FindField (OPS_Name name, OPT_Struct typ, OPT_Object *res); import void OPT_FindImport (OPT_Object mod, OPT_Object *res); import void OPT_IdFPrint (OPT_Struct typ); import void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done); -import void OPT_Init (OPS_Name name, SET opt); +import void OPT_Init (OPS_Name name, uint32 opt); import void OPT_InitRecno (void); import void OPT_Insert (OPS_Name name, OPT_Object *obj); import void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old); @@ -104,6 +104,7 @@ import OPT_Node OPT_NewNode (int8 class); import OPT_Object OPT_NewObj (void); import OPT_Struct OPT_NewStr (int8 form, int8 comp); import void OPT_OpenScope (int8 level, OPT_Object owner); +import OPT_Struct OPT_SetType (int32 size); import OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir); import int32 OPT_SizeAlignment (int32 size); import void OPT_TypSize (OPT_Struct typ); diff --git a/bootstrap/windows-88/OPV.c b/bootstrap/windows-88/OPV.c index 07fa214f..5171284e 100644 --- a/bootstrap/windows-88/OPV.c +++ b/bootstrap/windows-88/OPV.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPC.h" @@ -187,6 +188,7 @@ void OPV_AdrAndSize (OPT_Object topScope) OPV_Traverse(topScope->right, topScope, 1); OPV_Traverse(topScope->right, topScope, 0); OPT_chartyp->strobj->linkadr = 2; + OPT_cpbytetyp->strobj->linkadr = 2; OPT_settyp->strobj->linkadr = 2; OPT_realtyp->strobj->linkadr = 2; OPT_adrtyp->strobj->linkadr = 2; @@ -194,6 +196,8 @@ void OPV_AdrAndSize (OPT_Object topScope) OPT_int16typ->strobj->linkadr = 2; OPT_int32typ->strobj->linkadr = 2; OPT_int64typ->strobj->linkadr = 2; + OPT_set32typ->strobj->linkadr = 2; + OPT_set64typ->strobj->linkadr = 2; OPT_hinttyp->strobj->linkadr = 2; OPT_lrltyp->strobj->linkadr = 2; OPT_booltyp->strobj->linkadr = 2; diff --git a/bootstrap/windows-88/OPV.h b/bootstrap/windows-88/OPV.h index a44fb5b5..f5e41d45 100644 --- a/bootstrap/windows-88/OPV.h +++ b/bootstrap/windows-88/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/windows-88/Platform.c b/bootstrap/windows-88/Platform.c index 95dd629a..5a5ee14a 100644 --- a/bootstrap/windows-88/Platform.c +++ b/bootstrap/windows-88/Platform.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/windows-88/Platform.h b/bootstrap/windows-88/Platform.h index b99b4747..b8d8c5e7 100644 --- a/bootstrap/windows-88/Platform.h +++ b/bootstrap/windows-88/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/windows-88/Reals.c b/bootstrap/windows-88/Reals.c index 57e22100..d7d2994c 100644 --- a/bootstrap/windows-88/Reals.c +++ b/bootstrap/windows-88/Reals.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/windows-88/Reals.h b/bootstrap/windows-88/Reals.h index f3404dda..8c1ff819 100644 --- a/bootstrap/windows-88/Reals.h +++ b/bootstrap/windows-88/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/windows-88/Strings.c b/bootstrap/windows-88/Strings.c index bcf3cb9b..ac03bada 100644 --- a/bootstrap/windows-88/Strings.c +++ b/bootstrap/windows-88/Strings.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/windows-88/Strings.h b/bootstrap/windows-88/Strings.h index 9418692a..cc9d99a1 100644 --- a/bootstrap/windows-88/Strings.h +++ b/bootstrap/windows-88/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/windows-88/Texts.c b/bootstrap/windows-88/Texts.c index a71cf72a..9a4efb22 100644 --- a/bootstrap/windows-88/Texts.c +++ b/bootstrap/windows-88/Texts.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Files.h" @@ -183,7 +184,7 @@ export address *Texts_Writer__typ; export address *Texts__1__typ; export void Texts_Append (Texts_Text T, Texts_Buffer B); -export void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff); +export void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, uint32 sel, Texts_FontsFont fnt, int8 col, int8 voff); static Texts_Elem Texts_CloneElem (Texts_Elem e); static Texts_Piece Texts_ClonePiece (Texts_Piece p); export void Texts_Close (Texts_Text T, CHAR *name, LONGINT name__len); @@ -565,7 +566,7 @@ void Texts_Delete (Texts_Text T, int32 beg, int32 end) } } -void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff) +void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, uint32 sel, Texts_FontsFont fnt, int8 col, int8 voff) { Texts_Run c = NIL, u = NIL, un = NIL, v = NIL, vn = NIL; int32 co, uo, ud, vo, vd; diff --git a/bootstrap/windows-88/Texts.h b/bootstrap/windows-88/Texts.h index 47f1e428..7f02a3aa 100644 --- a/bootstrap/windows-88/Texts.h +++ b/bootstrap/windows-88/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef Texts__h #define Texts__h @@ -130,7 +130,7 @@ import address *Texts_Scanner__typ; import address *Texts_Writer__typ; import void Texts_Append (Texts_Text T, Texts_Buffer B); -import void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff); +import void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, uint32 sel, Texts_FontsFont fnt, int8 col, int8 voff); import void Texts_Close (Texts_Text T, CHAR *name, LONGINT name__len); import void Texts_Copy (Texts_Buffer SB, Texts_Buffer DB); import void Texts_CopyElem (Texts_Elem SE, Texts_Elem DE); diff --git a/bootstrap/windows-88/errors.c b/bootstrap/windows-88/errors.c index ba890a17..f284397b 100644 --- a/bootstrap/windows-88/errors.c +++ b/bootstrap/windows-88/errors.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/windows-88/errors.h b/bootstrap/windows-88/errors.h index d8124792..5aa2a5f6 100644 --- a/bootstrap/windows-88/errors.h +++ b/bootstrap/windows-88/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/windows-88/extTools.c b/bootstrap/windows-88/extTools.c index 76fdc084..fe7eb545 100644 --- a/bootstrap/windows-88/extTools.c +++ b/bootstrap/windows-88/extTools.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" diff --git a/bootstrap/windows-88/extTools.h b/bootstrap/windows-88/extTools.h index bb5be954..8cdd8e01 100644 --- a/bootstrap/windows-88/extTools.h +++ b/bootstrap/windows-88/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/windows-88/vt100.c b/bootstrap/windows-88/vt100.c index c44586d2..a4bc9ec1 100644 --- a/bootstrap/windows-88/vt100.c +++ b/bootstrap/windows-88/vt100.c @@ -1,8 +1,9 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ -#define INTEGER int16 -#define LONGINT int32 -#define SET uint32 +#define SHORTINT int8 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Console.h" diff --git a/bootstrap/windows-88/vt100.h b/bootstrap/windows-88/vt100.h index c9a01a7c..44d81f73 100644 --- a/bootstrap/windows-88/vt100.h +++ b/bootstrap/windows-88/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ +/* voc 1.95 [2016/09/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ #ifndef vt100__h #define vt100__h diff --git a/src/compiler/OPB.Mod b/src/compiler/OPB.Mod index 547f2521..b29f6b49 100644 --- a/src/compiler/OPB.Mod +++ b/src/compiler/OPB.Mod @@ -107,6 +107,12 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *) BEGIN node.typ := OPT.IntType(OPT.IntSize(node.conval.intval)) END SetIntType; + PROCEDURE SetSetType(node: OPT.Node); + VAR i32: SYSTEM.INT32; + BEGIN SYSTEM.GET(SYSTEM.ADR(node.conval.setval)+4, i32); (* See if upper 32 bits are zero *) + IF i32 = 0 THEN node.typ := OPT.set32typ ELSE node.typ := OPT.set64typ END + END SetSetType; + PROCEDURE NewIntConst*(intval: SYSTEM.INT64): OPT.Node; VAR x: OPT.Node; BEGIN @@ -593,7 +599,10 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *) VAR node: OPT.Node; f, g: INTEGER; k: SYSTEM.INT64; r: LONGREAL; BEGIN f := x^.typ^.form; g := typ^.form; (* f: old form, g: new form *) IF x^.class = OPT.Nconst THEN - IF f = OPT.Int THEN + IF (f = OPT.Set) & (g = OPT.Set) & (x.typ.size > typ.size) THEN + SetSetType(x); + IF x.typ.size > typ.size THEN err(203); x^.conval^.setval := {} END + ELSIF f = OPT.Int THEN IF g = OPT.Int THEN IF x.typ.size > typ.size THEN SetIntType(x); IF x.typ.size > typ.size THEN err(203); x^.conval^.intval := 1 END @@ -663,6 +672,9 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *) ELSIF g IN {OPT.Int} + OPT.realSet THEN Convert(z, y.typ) ELSE err(100) END + |OPT.Set: IF (g = OPT.Set) & (y.typ.size < z.typ.size) THEN Convert(y, z.typ) + ELSE err(100) + END |OPT.Real: IF g = OPT.Int THEN Convert(y, z^.typ) ELSIF g IN OPT.realSet THEN Convert(z, y^.typ) ELSE err(100) diff --git a/src/compiler/OPM.Mod b/src/compiler/OPM.Mod index c0f59250..3dd56c16 100644 --- a/src/compiler/OPM.Mod +++ b/src/compiler/OPM.Mod @@ -268,7 +268,7 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) LogWStr(" -f Disable vt100 control characters in status output."); LogWLn; LogWStr(" -V Display compiler debugging messages."); LogWLn; LogWLn; - LogWStr(" Size model for elementary types (default O2 on 32 bit builds, OV on 64 bits)"); LogWLn; + LogWStr(" Size model for elementary types (default O2)"); LogWLn; LogWStr(" -O2 Original Oberon / Oberon-2: 8 bit SHORTINT, 16 bit INTEGER, 32 bit LONGINT and SET."); LogWLn; LogWStr(" -OC Component Pascal: 16 bit SHORTINT, 32 bit INTEGER, 64 bit LONGINT and SET."); LogWLn; LogWStr(" -OV Alternate large model: 8 bit SHORTINT, 32 bit INTEGER, 64 bit LONGINT and SET."); LogWLn; @@ -597,10 +597,22 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) BEGIN Files.ReadNum(oldSF, k); RETURN k END SymRInt; + (* todo PROCEDURE SymRInt64*(): SYSTEM.INT64; VAR k: SYSTEM.INT64; - BEGIN Files.ReadNum64(oldSF, k); RETURN k + BEGIN Files.ReadNum(oldSF, k); RETURN k END SymRInt64; + *) + + PROCEDURE SymRInt64*(): SYSTEM.INT64; + BEGIN RETURN SymRInt() + END SymRInt64; + + (* todo + PROCEDURE SymRSet*(VAR s: SYSTEM.SET64); + BEGIN Files.ReadNum(oldSF, SYSTEM.VAL(SYSTEM.INT64, s)) + END SymRSet; + *) PROCEDURE SymRSet*(VAR s: SET); BEGIN Files.ReadNum(oldSF, SYSTEM.VAL(LONGINT, s)) @@ -644,9 +656,15 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) END SymWCh; PROCEDURE SymWInt*(i: SYSTEM.INT64); - BEGIN Files.WriteNum64(newSF, i) + BEGIN Files.WriteNum(newSF, i) END SymWInt; + (* todo + PROCEDURE SymWSet*(s: SYSTEM.SET64); + BEGIN Files.WriteNum(newSF, SYSTEM.VAL(SYSTEM.INT64, s)) + END SymWSet; + *) + PROCEDURE SymWSet*(s: SET); BEGIN Files.WriteNum(newSF, SYSTEM.VAL(LONGINT, s)) END SymWSet; diff --git a/src/compiler/OPT.Mod b/src/compiler/OPT.Mod index ac134c9c..e55c7d3c 100644 --- a/src/compiler/OPT.Mod +++ b/src/compiler/OPT.Mod @@ -15,6 +15,9 @@ TYPE ext*: ConstExt; (* string or code for code proc *) intval*: SYSTEM.INT64; (* constant value or adr, proc par size, text position or least case label *) intval2*: LONGINT; (* string length, proc var size or larger case label *) + (* todo + setval*: SYSTEM.SET64; (* constant value, procedure body present or "ELSE" present in case *) + *) setval*: SET; (* constant value, procedure body present or "ELSE" present in case *) realval*: LONGREAL (* real or longreal constant value *) END; diff --git a/src/runtime/Files.Mod b/src/runtime/Files.Mod index 46f16c85..73d527cf 100644 --- a/src/runtime/Files.Mod +++ b/src/runtime/Files.Mod @@ -58,8 +58,8 @@ MODULE Files; (* J. Templ 1.12. 89/12.4.95 Oberon files mapped onto Unix files res*: LONGINT; eof*: BOOLEAN; buf: Buffer; - org: LONGINT; - offset: LONGINT + org: LONGINT; (* File offset of block containing current position *) + offset: LONGINT (* Current position offset within block at org. *) END; @@ -654,6 +654,7 @@ Especially Length would become fairly complex. UNTIL b END ReadLine; + (* PROCEDURE ReadNum* (VAR R: Rider; VAR x: LONGINT); VAR s: SHORTINT; ch: CHAR; n: LONGINT; BEGIN s := 0; n := 0; Read(R, ch); @@ -661,18 +662,16 @@ Especially Length would become fairly complex. INC(n, ASH(ORD(ch) MOD 64 - ORD(ch) DIV 64 * 64, s) ); x := n END ReadNum; - - PROCEDURE ReadNum64* (VAR R: Rider; VAR x: SYSTEM.INT64); - (* todo. use proper code when INC/ASH properly support INT64 on 32 bit platforms - VAR s: SHORTINT; ch: CHAR; n: SYSTEM.INT64; - BEGIN s := 0; n := 0; Read(R, ch); - WHILE ORD(ch) >= 128 DO INC(n, ASH(ORD(ch) - 128, s) ); INC(s, 7); Read(R, ch) END; - INC(n, ASH(ORD(ch) MOD 64 - ORD(ch) DIV 64 * 64, s) ); - x := n *) - VAR n: LONGINT; - BEGIN ReadNum(R, n); x := n - END ReadNum64; + + PROCEDURE ReadNum*(VAR R: Rider; VAR x: ARRAY OF SYSTEM.BYTE); + VAR s, b: SYSTEM.INT8; q: SYSTEM.INT64; + BEGIN s := 0; q := 0; Read(R, b); + WHILE b >= 128 DO INC(q, ASH(b-128, s)); INC(s, 7); Read(R, b) END; + INC(q, ASH(b MOD 64 - b DIV 64 * 64, s)); + ASSERT(LEN(x) <= 8); + SYSTEM.MOVE(SYSTEM.ADR(q), SYSTEM.ADR(x), LEN(x)) (* Assumes little endian representation of q and x. *) + END ReadNum; PROCEDURE WriteBool* (VAR R: Rider; x: BOOLEAN); BEGIN Write(R, SYSTEM.VAL(CHAR, x)) @@ -715,18 +714,12 @@ Especially Length would become fairly complex. WriteBytes(R, x, i+1) END WriteString; - PROCEDURE WriteNum* (VAR R: Rider; x: LONGINT); + PROCEDURE WriteNum* (VAR R: Rider; x: SYSTEM.INT64); BEGIN WHILE (x < - 64) OR (x > 63) DO Write(R, CHR(x MOD 128 + 128)); x := x DIV 128 END; Write(R, CHR(x MOD 128)) END WriteNum; - PROCEDURE WriteNum64* (VAR R: Rider; x: SYSTEM.INT64); - BEGIN - WHILE (x < - 64) OR (x > 63) DO Write(R, CHR(x MOD 128 + 128)); x := x DIV 128 END; - Write(R, CHR(x MOD 128)) - END WriteNum64; - PROCEDURE GetName*(f: File; VAR name: ARRAY OF CHAR); BEGIN COPY (f.workName, name); diff --git a/src/runtime/LowReal.Mod b/src/runtime/LowReal.Mod index 98f2a8a9..e5a8f8a6 100644 --- a/src/runtime/LowReal.Mod +++ b/src/runtime/LowReal.Mod @@ -23,7 +23,7 @@ MODULE LowReal; *) -IMPORT S := SYSTEM, Reals; +IMPORT SYSTEM; (* @@ -99,13 +99,13 @@ CONST ZERO = 0.0; expOffset = expoMax; - hiBit = 22; - expBit = hiBit+1; - nMask = {0..hiBit,31}; (* number mask *) - expMask = {expBit..30}; (* exponent mask *) + (*hiBit = 22;*) + (*expBit = hiBit+1;*) + nMask = {0..22,31}; (* number mask *) + expMask = {23..30}; (* exponent mask *) TYPE - Modes*= SET; + Modes* = SET; VAR (*small* : REAL; tmp: REAL;*) (* this was a test to get small as a variable at runtime. obviously, compile time preferred; -- noch *) @@ -131,15 +131,24 @@ PROCEDURE exponent*(x: REAL): INTEGER; that lies between `expoMin' and `expoMax'. An exception shall occur and may be raised if `x' is equal to 0.0. *) + VAR w: SYSTEM.INT16; BEGIN (* NOTE: x=0.0 should raise exception *) - IF x = ZERO THEN RETURN 0 - ELSE RETURN Reals.Expo(x) - expOffset - END + IF x = ZERO THEN RETURN 0 END; + + RETURN SYSTEM.VAL(INTEGER, SYSTEM.LSH((SYSTEM.VAL(SYSTEM.SET32, x) * expMask), -23)); + + + SYSTEM.GET(SYSTEM.ADR(x)+2, w); (* Load most significant word *) + RETURN ((w DIV 128) MOD 256) - expOffset END exponent; -PROCEDURE SetExponent(VAR x: REAL; ex: INTEGER); -BEGIN Reals.SetExpo(x, ex + expOffset) +PROCEDURE SetExponent(VAR x: REAL; ex: SYSTEM.INT32); + VAR s: SYSTEM.SET32; +BEGIN + ex := SYSTEM.LSH(ex + expOffset, 23); + s := SYSTEM.VAL(SYSTEM.SET32, s) * nMask + SYSTEM.VAL(SYSTEM.SET32, ex) * expMask; + SYSTEM.PUT(SYSTEM.ADR(x), s) END SetExponent; PROCEDURE exponent10*(x: REAL): INTEGER; @@ -170,20 +179,20 @@ BEGIN IF x=ZERO THEN RETURN ZERO ELSE (* Set top 7 bits of exponent to 0111111 *) - S.GET(S.ADR(x)+3, c); + SYSTEM.GET(SYSTEM.ADR(x)+3, c); c := CHR(((ORD(c) DIV 128) * 128) + 63); (* Set X0111111 (X unchanged) *) - S.PUT(S.ADR(x)+3, c); + SYSTEM.PUT(SYSTEM.ADR(x)+3, c); (* Set bottom bit of exponent to 0 *) - S.GET(S.ADR(x)+2, c); + SYSTEM.GET(SYSTEM.ADR(x)+2, c); c := CHR(ORD(c) MOD 128); (* Set 0XXXXXXX (X unchanged) *) - S.PUT(S.ADR(x)+2, c); + SYSTEM.PUT(SYSTEM.ADR(x)+2, c); RETURN x * 2.0; END (* CONST eZero={(hiBit+2)..29}; BEGIN IF x=ZERO THEN RETURN ZERO - ELSE RETURN S.VAL(REAL,(S.VAL(SET,x)*nMask)+eZero)*2.0 (* set the mantissa's exponent to zero *) + ELSE RETURN SYSTEM.VAL(REAL,(SYSTEM.VAL(SET,x)*nMask)+eZero)*2.0 (* set the mantissa's exponent to zero *) END *) END fraction; @@ -191,20 +200,20 @@ END fraction; PROCEDURE IsInfinity * (real: REAL) : BOOLEAN; VAR c0, c1, c2, c3: CHAR; BEGIN - S.GET(S.ADR(real)+0, c3); - S.GET(S.ADR(real)+1, c2); - S.GET(S.ADR(real)+2, c1); - S.GET(S.ADR(real)+3, c0); + SYSTEM.GET(SYSTEM.ADR(real)+0, c3); + SYSTEM.GET(SYSTEM.ADR(real)+1, c2); + SYSTEM.GET(SYSTEM.ADR(real)+2, c1); + SYSTEM.GET(SYSTEM.ADR(real)+3, c0); RETURN (ORD(c0) MOD 128 = 127) & (ORD(c1) = 128) & (ORD(c2) = 0) & (ORD(c3) = 0) END IsInfinity; PROCEDURE IsNaN * (real: REAL) : BOOLEAN; VAR c0, c1, c2, c3: CHAR; BEGIN - S.GET(S.ADR(real)+0, c3); - S.GET(S.ADR(real)+1, c2); - S.GET(S.ADR(real)+2, c1); - S.GET(S.ADR(real)+3, c0); + SYSTEM.GET(SYSTEM.ADR(real)+0, c3); + SYSTEM.GET(SYSTEM.ADR(real)+1, c2); + SYSTEM.GET(SYSTEM.ADR(real)+2, c1); + SYSTEM.GET(SYSTEM.ADR(real)+3, c0); RETURN (ORD(c0) MOD 128 = 127) & (ORD(c1) DIV 128 = 1) & ((ORD(c1) MOD 128 # 0) OR (ORD(c2) # 0) OR (ORD(c3) # 0)) @@ -235,8 +244,8 @@ BEGIN END; SetExponent(x, SHORT(exp)); (* SetExponent replaces these 2 lines: - lexp := S.VAL(SET, S.LSH(exp + expOffset, expBit)); (* shifted exponent bits *) - RETURN S.VAL(REAL, (S.VAL(SET, x) * nMask) + lexp) (* insert new exponent *) + lexp := SYSTEM.VAL(SET, SYSTEM.LSH(exp + expOffset, expBit)); (* shifted exponent bits *) + RETURN SYSTEM.VAL(REAL, (SYSTEM.VAL(SET, x) * nMask) + lexp) (* insert new exponent *) *) END scale; @@ -280,7 +289,7 @@ BEGIN loBit := (hiBit+1) - exponent(x); IF loBit <= 0 THEN RETURN x (* no fractional part *) ELSIF loBit <= hiBit+1 THEN - RETURN S.VAL(REAL,S.VAL(SET,x)*{loBit..31}) (* integer part is extracted *) + RETURN SYSTEM.VAL(REAL,SYSTEM.VAL(SET,x)*{loBit..31}) (* integer part is extracted *) ELSE RETURN ZERO (* no whole part *) END END intpart; @@ -305,7 +314,7 @@ BEGIN loBit:=places-n; IF n<=0 THEN RETURN ZERO (* exception should be raised *) ELSIF loBit<=0 THEN RETURN x (* nothing was truncated *) ELSE mask:={loBit..31}; (* truncation bit mask *) - RETURN S.VAL(REAL,S.VAL(SET,x)*mask) + RETURN SYSTEM.VAL(REAL,SYSTEM.VAL(SET,x)*mask) END END trunc; @@ -320,8 +329,8 @@ PROCEDURE round*(x: REAL; n: INTEGER): REAL; BEGIN loBit:=places-n; IF n<=0 THEN RETURN ZERO (* exception should be raised *) ELSIF loBit<=0 THEN RETURN x (* nothing was rounded *) - ELSE mask:={loBit..31}; num:=S.VAL(SET,x); (* truncation bit mask and number as SET *) - x:=S.VAL(REAL,num*mask); (* truncated result *) + ELSE mask:={loBit..31}; num:=SYSTEM.VAL(SET,x); (* truncation bit mask and number as SET *) + x:=SYSTEM.VAL(REAL,num*mask); (* truncated result *) IF loBit-1 IN num THEN (* check if result should be rounded *) r:=scale(ONE,exponent(x)-n+1); (* rounding fraction *) IF 31 IN num THEN RETURN x-r (* negative rounding toward -infinity *) diff --git a/src/runtime/Math.Mod b/src/runtime/Math.Mod index c2a648c9..392534bd 100644 --- a/src/runtime/Math.Mod +++ b/src/runtime/Math.Mod @@ -573,6 +573,10 @@ BEGIN t:=ABS(x); RETURN arcsinh(x/sqrt(ONE-x*x)) END arctanh; +PROCEDURE ToREAL(h: HUGEINT): REAL; +BEGIN RETURN SYSTEM.VAL(REAL, h) +END ToREAL; + BEGIN (* determine some fundamental constants used by hyperbolic trig functions *) em:=l.ulp(ONE); @@ -582,31 +586,31 @@ BEGIN t:=l.pred(ONE)/sqrt(em); TanhMax:=ln(t+sqrt(t*t+ONE)); (* initialize some tables for the power() function a1[i]=2**((1-i)/16) *) - a1[1] :=ONE; - a1[2] :=S.VAL(REAL, 3F75257DH); - a1[3] :=S.VAL(REAL, 3F6AC0C7H); - a1[4] :=S.VAL(REAL, 3F60CCDFH); - a1[5] :=S.VAL(REAL, 3F5744FDH); - a1[6] :=S.VAL(REAL, 3F4E248CH); - a1[7] :=S.VAL(REAL, 3F45672AH); - a1[8] :=S.VAL(REAL, 3F3D08A4H); - a1[9] :=S.VAL(REAL, 3F3504F3H); - a1[10]:=S.VAL(REAL, 3F2D583FH); - a1[11]:=S.VAL(REAL, 3F25FED7H); - a1[12]:=S.VAL(REAL, 3F1EF532H); - a1[13]:=S.VAL(REAL, 3F1837F0H); - a1[14]:=S.VAL(REAL, 3F11C3D3H); - a1[15]:=S.VAL(REAL, 3F0B95C2H); - a1[16]:=S.VAL(REAL, 3F05AAC3H); - a1[17]:=HALF; + a1[1] := ONE; + a1[2] := ToREAL(3F75257DH); + a1[3] := ToREAL(3F6AC0C7H); + a1[4] := ToREAL(3F60CCDFH); + a1[5] := ToREAL(3F5744FDH); + a1[6] := ToREAL(3F4E248CH); + a1[7] := ToREAL(3F45672AH); + a1[8] := ToREAL(3F3D08A4H); + a1[9] := ToREAL(3F3504F3H); + a1[10] := ToREAL(3F2D583FH); + a1[11] := ToREAL(3F25FED7H); + a1[12] := ToREAL(3F1EF532H); + a1[13] := ToREAL(3F1837F0H); + a1[14] := ToREAL(3F11C3D3H); + a1[15] := ToREAL(3F0B95C2H); + a1[16] := ToREAL(3F05AAC3H); + a1[17] := HALF; (* a2[i]=2**[(1-2i)/16] - a1[2i]; delta resolution *) - a2[1]:=S.VAL(REAL, 31A92436H); - a2[2]:=S.VAL(REAL, 336C2A95H); - a2[3]:=S.VAL(REAL, 31A8FC24H); - a2[4]:=S.VAL(REAL, 331F580CH); - a2[5]:=S.VAL(REAL, 336A42A1H); - a2[6]:=S.VAL(REAL, 32C12342H); - a2[7]:=S.VAL(REAL, 32E75624H); - a2[8]:=S.VAL(REAL, 32CF9890H) + a2[1] := ToREAL(31A92436H); + a2[2] := ToREAL(336C2A95H); + a2[3] := ToREAL(31A8FC24H); + a2[4] := ToREAL(331F580CH); + a2[5] := ToREAL(336A42A1H); + a2[6] := ToREAL(32C12342H); + a2[7] := ToREAL(32E75624H); + a2[8] := ToREAL(32CF9890H) END oocRealMath. diff --git a/src/system/Files.Mod b/src/system/Files.Mod index 76732ebc..04495ccb 100644 --- a/src/system/Files.Mod +++ b/src/system/Files.Mod @@ -1,6 +1,6 @@ MODULE Files; (* J. Templ 1.12. 89/12.4.95 Oberon files mapped onto Unix files *) - IMPORT SYSTEM, Platform, Heap, Strings, Configuration, Console; + IMPORT SYSTEM, Platform, Heap, Strings, Out := Console; (* standard data type I/O @@ -58,8 +58,8 @@ MODULE Files; (* J. Templ 1.12. 89/12.4.95 Oberon files mapped onto Unix files res*: LONGINT; eof*: BOOLEAN; buf: Buffer; - org: LONGINT; - offset: LONGINT + org: LONGINT; (* File offset of block containing current position *) + offset: LONGINT (* Current position offset within block at org. *) END; @@ -73,18 +73,19 @@ MODULE Files; (* J. Templ 1.12. 89/12.4.95 Oberon files mapped onto Unix files PROCEDURE -IdxTrap "__HALT(-1)"; + PROCEDURE -ToAdr(x: SYSTEM.INT64): SYSTEM.ADDRESS "(address)x"; PROCEDURE^ Finalize(o: SYSTEM.PTR); PROCEDURE Err(s: ARRAY OF CHAR; f: File; errcode: Platform.ErrorCode); BEGIN - Console.Ln; Console.String("-- "); Console.String(s); Console.String(": "); + Out.Ln; Out.String("-- "); Out.String(s); Out.String(": "); IF f # NIL THEN - IF f.registerName # "" THEN Console.String(f.registerName) ELSE Console.String(f.workName) END; - IF f.fd # 0 THEN Console.String("f.fd = "); Console.Int(f.fd,1) END + IF f.registerName # "" THEN Out.String(f.registerName) ELSE Out.String(f.workName) END; + IF f.fd # 0 THEN Out.String("f.fd = "); Out.Int(f.fd,1) END END; - IF errcode # 0 THEN Console.String(" errcode = "); Console.Int(errcode, 1) END; - Console.Ln; + IF errcode # 0 THEN Out.String(" errcode = "); Out.Int(errcode, 1) END; + Out.Ln; HALT(99) END Err; @@ -124,11 +125,11 @@ MODULE Files; (* J. Templ 1.12. 89/12.4.95 Oberon files mapped onto Unix files err: ARRAY 32 OF CHAR; BEGIN (* - Console.String("Files.Create fd = "); Console.Int(f.fd,1); - Console.String(", registerName = "); Console.String(f.registerName); - Console.String(", workName = "); Console.String(f.workName); - Console.String(", state = "); Console.Int(f.state,1); - Console.Ln; + Out.String("Files.Create fd = "); Out.Int(f.fd,1); + Out.String(", registerName = "); Out.String(f.registerName); + Out.String(", workName = "); Out.String(f.workName); + Out.String(", state = "); Out.Int(f.state,1); + Out.Ln; *) IF f.fd = noDesc THEN IF f.state = create THEN @@ -164,17 +165,17 @@ MODULE Files; (* J. Templ 1.12. 89/12.4.95 Oberon files mapped onto Unix files (* identity: Platform.FileIdentity; *) BEGIN (* - Console.String("Files.Flush buf.f.registername = "); Console.String(buf.f.registerName); - Console.String(", buf.f.fd = "); Console.Int(buf.f.fd,1); - Console.String(", buffer at $"); Console.Hex(SYSTEM.ADR(buf.data)); - Console.String(", size "); Console.Int(buf.size,1); Console.Ln; + Out.String("Files.Flush buf.f.registername = "); Out.String(buf.f.registerName); + Out.String(", buf.f.fd = "); Out.Int(buf.f.fd,1); + Out.String(", buffer at $"); Out.Hex(SYSTEM.ADR(buf.data)); + Out.String(", size "); Out.Int(buf.size,1); Out.Ln; *) IF buf.chg THEN f := buf.f; Create(f); IF buf.org # f.pos THEN error := Platform.Seek(f.fd, buf.org, Platform.SeekSet); (* - Console.String("Seeking to "); Console.Int(buf.org,1); - Console.String(", error code "); Console.Int(error,1); Console.Ln; + Out.String("Seeking to "); Out.Int(buf.org,1); + Out.String(", error code "); Out.Int(error,1); Out.Ln; *) END; error := Platform.Write(f.fd, SYSTEM.ADR(buf.data), buf.size); @@ -295,7 +296,7 @@ MODULE Files; (* J. Templ 1.12. 89/12.4.95 Oberon files mapped onto Unix files error: Platform.ErrorCode; identity: Platform.FileIdentity; BEGIN - (* Console.String("Files.Old "); Console.String(name); Console.Ln; *) + (* Out.String("Files.Old "); Out.String(name); Out.Ln; *) IF name # "" THEN IF HasDir(name) THEN dir := ""; COPY(name, path) ELSE pos := 0; ScanPath(pos, dir); MakeFileName(dir, name, path); ScanPath(pos, dir) @@ -307,11 +308,11 @@ MODULE Files; (* J. Templ 1.12. 89/12.4.95 Oberon files mapped onto Unix files error := Platform.OldRO(path, fd); done := error = 0; END; IF ~done & ~Platform.Absent(error) THEN - Console.String("Warning: Files.Old "); Console.String(name); - Console.String(" error = "); Console.Int(error, 0); Console.Ln; + Out.String("Warning: Files.Old "); Out.String(name); + Out.String(" error = "); Out.Int(error, 0); Out.Ln; END; IF done THEN - (* Console.String(" fd = "); Console.Int(fd,1); Console.Ln; *) + (* Out.String(" fd = "); Out.Int(fd,1); Out.Ln; *) error := Platform.Identify(fd, identity); f := CacheEntry(identity); IF f # NIL THEN @@ -365,11 +366,11 @@ MODULE Files; (* J. Templ 1.12. 89/12.4.95 Oberon files mapped onto Unix files BEGIN IF f # NIL THEN (* - Console.String("Files.Set rider on fd = "); Console.Int(f.fd,1); - Console.String(", registerName = "); Console.String(f.registerName); - Console.String(", workName = "); Console.String(f.workName); - Console.String(", state = "); Console.Int(f.state,1); - Console.Ln; + Out.String("Files.Set rider on fd = "); Out.Int(f.fd,1); + Out.String(", registerName = "); Out.String(f.registerName); + Out.String(", workName = "); Out.String(f.workName); + Out.String(", state = "); Out.Int(f.state,1); + Out.Ln; *) IF pos > f.len THEN pos := f.len ELSIF pos < 0 THEN pos := 0 END; offset := pos MOD bufsize; org := pos - offset; i := 0; @@ -427,7 +428,7 @@ MODULE Files; (* J. Templ 1.12. 89/12.4.95 Oberon files mapped onto Unix files restInBuf := buf.size - offset; IF restInBuf = 0 THEN r.res := n; r.eof := TRUE; RETURN ELSIF n > restInBuf THEN min := restInBuf ELSE min := n END; - SYSTEM.MOVE(SYSTEM.ADR(buf.data) + offset, SYSTEM.ADR(x) + xpos, min); + SYSTEM.MOVE(SYSTEM.ADR(buf.data) + ToAdr(offset), SYSTEM.ADR(x) + ToAdr(xpos), min); INC(offset, min); r.offset := offset; INC(xpos, min); DEC(n, min) END; r.res := 0; r.eof := FALSE @@ -465,7 +466,7 @@ MODULE Files; (* J. Templ 1.12. 89/12.4.95 Oberon files mapped onto Unix files END; restInBuf := bufsize - offset; IF n > restInBuf THEN min := restInBuf ELSE min := n END; - SYSTEM.MOVE(SYSTEM.ADR(x) + xpos, SYSTEM.ADR(buf.data) + offset, min); + SYSTEM.MOVE(SYSTEM.ADR(x) + ToAdr(xpos), SYSTEM.ADR(buf.data) + ToAdr(offset), min); INC(offset, min); r.offset := offset; IF offset > buf.size THEN INC(buf.f.len, offset - buf.size); buf.size := offset END; INC(xpos, min); DEC(n, min); buf.chg := TRUE @@ -518,8 +519,8 @@ Especially Length would become fairly complex. buf: ARRAY 4096 OF CHAR; BEGIN (* - Console.String("Files.Rename old = "); Console.String(old); - Console.String(", new = "); Console.String(new); Console.Ln; + Out.String("Files.Rename old = "); Out.String(old); + Out.String(", new = "); Out.String(new); Out.Ln; *) error := Platform.IdentifyByName(old, oldidentity); IF error = 0 THEN @@ -528,7 +529,7 @@ Especially Length would become fairly complex. Delete(new, error); (* work around stale nfs handles *) END; error := Platform.Rename(old, new); - (* Console.String("Platform.Rename error code "); Console.Int(error,1); Console.Ln; *) + (* Out.String("Platform.Rename error code "); Out.Int(error,1); Out.Ln; *) IF ~Platform.DifferentFilesystems(error) THEN res := error; RETURN ELSE @@ -564,18 +565,18 @@ Especially Length would become fairly complex. VAR idx, errcode: INTEGER; f1: File; file: ARRAY 104 OF CHAR; BEGIN (* - Console.String("Files.Register f.registerName = "); Console.String(f.registerName); - Console.String(", fd = "); Console.Int(f.fd,1); Console.Ln; + Out.String("Files.Register f.registerName = "); Out.String(f.registerName); + Out.String(", fd = "); Out.Int(f.fd,1); Out.Ln; *) IF (f.state = create) & (f.registerName # "") THEN f.state := close (* shortcut renaming *) END; Close(f); IF f.registerName # "" THEN Rename(f.workName, f.registerName, errcode); (* - Console.String("Renamed (for register) f.fd = "); Console.Int(f.fd,1); - Console.String(" from workname "); Console.String(f.workName); - Console.String(" to registerName "); Console.String(f.registerName); - Console.String(" errorcode = "); Console.Int(errcode,1); Console.Ln; + Out.String("Renamed (for register) f.fd = "); Out.Int(f.fd,1); + Out.String(" from workname "); Out.String(f.workName); + Out.String(" to registerName "); Out.String(f.registerName); + Out.String(" errorcode = "); Out.Int(errcode,1); Out.Ln; *) IF errcode # 0 THEN COPY(f.registerName, file); HALT(99) END; f.workName := f.registerName; f.registerName := ""; f.tempFile := FALSE @@ -653,6 +654,17 @@ Especially Length would become fairly complex. UNTIL b END ReadLine; + (* todo + PROCEDURE ReadNum*(VAR R: Rider; VAR x: ARRAY OF SYSTEM.BYTE); + VAR s, b: SYSTEM.INT8; q: SYSTEM.INT64; + BEGIN s := 0; q := 0; Read(R, b); + WHILE b >= 128 DO INC(q, ASH(b-128, s)); INC(s, 7); Read(R, b) END; + INC(q, ASH(b MOD 64 - b DIV 64 * 64, s)); + ASSERT(LEN(x) <= 8); + SYSTEM.MOVE(SYSTEM.ADR(q), SYSTEM.ADR(x), LEN(x)) (* Assumes little endian representation of q and x. *) + END ReadNum; + *) + PROCEDURE ReadNum* (VAR R: Rider; VAR x: LONGINT); VAR s: SHORTINT; ch: CHAR; n: LONGINT; BEGIN s := 0; n := 0; Read(R, ch); @@ -661,18 +673,6 @@ Especially Length would become fairly complex. x := n END ReadNum; - PROCEDURE ReadNum64* (VAR R: Rider; VAR x: SYSTEM.INT64); - (* todo. use proper code when INC/ASH properly support INT64 on 32 bit platforms - VAR s: SHORTINT; ch: CHAR; n: SYSTEM.INT64; - BEGIN s := 0; n := 0; Read(R, ch); - WHILE ORD(ch) >= 128 DO INC(n, ASH(ORD(ch) - 128, s) ); INC(s, 7); Read(R, ch) END; - INC(n, ASH(ORD(ch) MOD 64 - ORD(ch) DIV 64 * 64, s) ); - x := n - *) - VAR n: LONGINT; - BEGIN ReadNum(R, n); x := n - END ReadNum64; - PROCEDURE WriteBool* (VAR R: Rider; x: BOOLEAN); BEGIN Write(R, SYSTEM.VAL(CHAR, x)) END WriteBool; @@ -714,18 +714,12 @@ Especially Length would become fairly complex. WriteBytes(R, x, i+1) END WriteString; - PROCEDURE WriteNum* (VAR R: Rider; x: LONGINT); + PROCEDURE WriteNum* (VAR R: Rider; x: SYSTEM.INT64); BEGIN WHILE (x < - 64) OR (x > 63) DO Write(R, CHR(x MOD 128 + 128)); x := x DIV 128 END; Write(R, CHR(x MOD 128)) END WriteNum; - PROCEDURE WriteNum64* (VAR R: Rider; x: SYSTEM.INT64); - BEGIN - WHILE (x < - 64) OR (x > 63) DO Write(R, CHR(x MOD 128 + 128)); x := x DIV 128 END; - Write(R, CHR(x MOD 128)) - END WriteNum64; - PROCEDURE GetName*(f: File; VAR name: ARRAY OF CHAR); BEGIN COPY (f.workName, name); @@ -736,9 +730,9 @@ Especially Length would become fairly complex. BEGIN f := SYSTEM.VAL(File, o); (* - Console.String("Files.Finalize f.fd = "); Console.Int(f.fd,1); - Console.String(", f.registername = "); Console.String(f.registerName); - Console.String(", f.workName = "); Console.String(f.workName); Console.Ln; + Out.String("Files.Finalize f.fd = "); Out.Int(f.fd,1); + Out.String(", f.registername = "); Out.String(f.registerName); + Out.String(", f.workName = "); Out.String(f.workName); Out.Ln; *) IF f.fd >= 0 THEN CloseOSFile(f);