From b3c71fb2f0b78403b72ae499125cc348b4456250 Mon Sep 17 00:00:00 2001 From: David Brown Date: Tue, 30 Aug 2016 19:01:24 +0100 Subject: [PATCH] Include int size in .sym files, fix __IN for out of range values, better naming. --- bootstrap/unix-44/Configuration.c | 4 +- bootstrap/unix-44/Configuration.h | 2 +- bootstrap/unix-44/Console.c | 2 +- bootstrap/unix-44/Console.h | 2 +- bootstrap/unix-44/Files.c | 2 +- bootstrap/unix-44/Files.h | 2 +- bootstrap/unix-44/Heap.c | 2 +- bootstrap/unix-44/Heap.h | 2 +- bootstrap/unix-44/Modules.c | 2 +- bootstrap/unix-44/Modules.h | 2 +- bootstrap/unix-44/OPB.c | 268 +++++++++++---------------- bootstrap/unix-44/OPB.h | 2 +- bootstrap/unix-44/OPC.c | 2 +- bootstrap/unix-44/OPC.h | 2 +- bootstrap/unix-44/OPM.c | 2 +- bootstrap/unix-44/OPM.h | 2 +- bootstrap/unix-44/OPP.c | 14 +- bootstrap/unix-44/OPP.h | 2 +- bootstrap/unix-44/OPS.c | 2 +- bootstrap/unix-44/OPS.h | 2 +- bootstrap/unix-44/OPT.c | 144 +++++++++----- bootstrap/unix-44/OPT.h | 4 +- bootstrap/unix-44/OPV.c | 2 +- bootstrap/unix-44/OPV.h | 2 +- bootstrap/unix-44/Platform.c | 2 +- bootstrap/unix-44/Platform.h | 2 +- bootstrap/unix-44/Reals.c | 2 +- bootstrap/unix-44/Reals.h | 2 +- bootstrap/unix-44/SYSTEM.h | 19 +- bootstrap/unix-44/Strings.c | 2 +- bootstrap/unix-44/Strings.h | 2 +- bootstrap/unix-44/Texts.c | 2 +- bootstrap/unix-44/Texts.h | 2 +- bootstrap/unix-44/Vishap.c | 2 +- bootstrap/unix-44/errors.c | 2 +- bootstrap/unix-44/errors.h | 2 +- bootstrap/unix-44/extTools.c | 2 +- bootstrap/unix-44/extTools.h | 2 +- bootstrap/unix-44/vt100.c | 2 +- bootstrap/unix-44/vt100.h | 2 +- bootstrap/unix-48/Configuration.c | 4 +- bootstrap/unix-48/Configuration.h | 2 +- bootstrap/unix-48/Console.c | 2 +- bootstrap/unix-48/Console.h | 2 +- bootstrap/unix-48/Files.c | 2 +- bootstrap/unix-48/Files.h | 2 +- bootstrap/unix-48/Heap.c | 2 +- bootstrap/unix-48/Heap.h | 2 +- bootstrap/unix-48/Modules.c | 2 +- bootstrap/unix-48/Modules.h | 2 +- bootstrap/unix-48/OPB.c | 268 +++++++++++---------------- bootstrap/unix-48/OPB.h | 2 +- bootstrap/unix-48/OPC.c | 2 +- bootstrap/unix-48/OPC.h | 2 +- bootstrap/unix-48/OPM.c | 2 +- bootstrap/unix-48/OPM.h | 2 +- bootstrap/unix-48/OPP.c | 14 +- bootstrap/unix-48/OPP.h | 2 +- bootstrap/unix-48/OPS.c | 2 +- bootstrap/unix-48/OPS.h | 2 +- bootstrap/unix-48/OPT.c | 144 +++++++++----- bootstrap/unix-48/OPT.h | 4 +- bootstrap/unix-48/OPV.c | 2 +- bootstrap/unix-48/OPV.h | 2 +- bootstrap/unix-48/Platform.c | 2 +- bootstrap/unix-48/Platform.h | 2 +- bootstrap/unix-48/Reals.c | 2 +- bootstrap/unix-48/Reals.h | 2 +- bootstrap/unix-48/SYSTEM.h | 19 +- bootstrap/unix-48/Strings.c | 2 +- bootstrap/unix-48/Strings.h | 2 +- bootstrap/unix-48/Texts.c | 2 +- bootstrap/unix-48/Texts.h | 2 +- bootstrap/unix-48/Vishap.c | 2 +- bootstrap/unix-48/errors.c | 2 +- bootstrap/unix-48/errors.h | 2 +- bootstrap/unix-48/extTools.c | 2 +- bootstrap/unix-48/extTools.h | 2 +- bootstrap/unix-48/vt100.c | 2 +- bootstrap/unix-48/vt100.h | 2 +- bootstrap/unix-88/Configuration.c | 4 +- bootstrap/unix-88/Configuration.h | 2 +- bootstrap/unix-88/Console.c | 2 +- bootstrap/unix-88/Console.h | 2 +- bootstrap/unix-88/Files.c | 2 +- bootstrap/unix-88/Files.h | 2 +- bootstrap/unix-88/Heap.c | 2 +- bootstrap/unix-88/Heap.h | 2 +- bootstrap/unix-88/Modules.c | 2 +- bootstrap/unix-88/Modules.h | 2 +- bootstrap/unix-88/OPB.c | 268 +++++++++++---------------- bootstrap/unix-88/OPB.h | 2 +- bootstrap/unix-88/OPC.c | 2 +- bootstrap/unix-88/OPC.h | 2 +- bootstrap/unix-88/OPM.c | 2 +- bootstrap/unix-88/OPM.h | 2 +- bootstrap/unix-88/OPP.c | 14 +- bootstrap/unix-88/OPP.h | 2 +- bootstrap/unix-88/OPS.c | 2 +- bootstrap/unix-88/OPS.h | 2 +- bootstrap/unix-88/OPT.c | 144 +++++++++----- bootstrap/unix-88/OPT.h | 4 +- bootstrap/unix-88/OPV.c | 2 +- bootstrap/unix-88/OPV.h | 2 +- bootstrap/unix-88/Platform.c | 2 +- bootstrap/unix-88/Platform.h | 2 +- bootstrap/unix-88/Reals.c | 2 +- bootstrap/unix-88/Reals.h | 2 +- bootstrap/unix-88/SYSTEM.h | 19 +- bootstrap/unix-88/Strings.c | 2 +- bootstrap/unix-88/Strings.h | 2 +- bootstrap/unix-88/Texts.c | 2 +- bootstrap/unix-88/Texts.h | 2 +- bootstrap/unix-88/Vishap.c | 2 +- bootstrap/unix-88/errors.c | 2 +- bootstrap/unix-88/errors.h | 2 +- bootstrap/unix-88/extTools.c | 2 +- bootstrap/unix-88/extTools.h | 2 +- bootstrap/unix-88/vt100.c | 2 +- bootstrap/unix-88/vt100.h | 2 +- bootstrap/windows-48/Configuration.c | 4 +- bootstrap/windows-48/Configuration.h | 2 +- bootstrap/windows-48/Console.c | 2 +- bootstrap/windows-48/Console.h | 2 +- bootstrap/windows-48/Files.c | 2 +- bootstrap/windows-48/Files.h | 2 +- bootstrap/windows-48/Heap.c | 2 +- bootstrap/windows-48/Heap.h | 2 +- bootstrap/windows-48/Modules.c | 2 +- bootstrap/windows-48/Modules.h | 2 +- bootstrap/windows-48/OPB.c | 268 +++++++++++---------------- bootstrap/windows-48/OPB.h | 2 +- bootstrap/windows-48/OPC.c | 2 +- bootstrap/windows-48/OPC.h | 2 +- bootstrap/windows-48/OPM.c | 2 +- bootstrap/windows-48/OPM.h | 2 +- bootstrap/windows-48/OPP.c | 14 +- bootstrap/windows-48/OPP.h | 2 +- bootstrap/windows-48/OPS.c | 2 +- bootstrap/windows-48/OPS.h | 2 +- bootstrap/windows-48/OPT.c | 144 +++++++++----- bootstrap/windows-48/OPT.h | 4 +- bootstrap/windows-48/OPV.c | 2 +- bootstrap/windows-48/OPV.h | 2 +- bootstrap/windows-48/Platform.c | 2 +- bootstrap/windows-48/Platform.h | 2 +- bootstrap/windows-48/Reals.c | 2 +- bootstrap/windows-48/Reals.h | 2 +- bootstrap/windows-48/SYSTEM.h | 19 +- bootstrap/windows-48/Strings.c | 2 +- bootstrap/windows-48/Strings.h | 2 +- bootstrap/windows-48/Texts.c | 2 +- bootstrap/windows-48/Texts.h | 2 +- bootstrap/windows-48/Vishap.c | 2 +- bootstrap/windows-48/errors.c | 2 +- bootstrap/windows-48/errors.h | 2 +- bootstrap/windows-48/extTools.c | 2 +- bootstrap/windows-48/extTools.h | 2 +- bootstrap/windows-48/vt100.c | 2 +- bootstrap/windows-48/vt100.h | 2 +- bootstrap/windows-88/Configuration.c | 4 +- bootstrap/windows-88/Configuration.h | 2 +- bootstrap/windows-88/Console.c | 2 +- bootstrap/windows-88/Console.h | 2 +- bootstrap/windows-88/Files.c | 2 +- bootstrap/windows-88/Files.h | 2 +- bootstrap/windows-88/Heap.c | 2 +- bootstrap/windows-88/Heap.h | 2 +- bootstrap/windows-88/Modules.c | 2 +- bootstrap/windows-88/Modules.h | 2 +- bootstrap/windows-88/OPB.c | 268 +++++++++++---------------- bootstrap/windows-88/OPB.h | 2 +- bootstrap/windows-88/OPC.c | 2 +- bootstrap/windows-88/OPC.h | 2 +- bootstrap/windows-88/OPM.c | 2 +- bootstrap/windows-88/OPM.h | 2 +- bootstrap/windows-88/OPP.c | 14 +- bootstrap/windows-88/OPP.h | 2 +- bootstrap/windows-88/OPS.c | 2 +- bootstrap/windows-88/OPS.h | 2 +- bootstrap/windows-88/OPT.c | 144 +++++++++----- bootstrap/windows-88/OPT.h | 4 +- bootstrap/windows-88/OPV.c | 2 +- bootstrap/windows-88/OPV.h | 2 +- bootstrap/windows-88/Platform.c | 2 +- bootstrap/windows-88/Platform.h | 2 +- bootstrap/windows-88/Reals.c | 2 +- bootstrap/windows-88/Reals.h | 2 +- bootstrap/windows-88/SYSTEM.h | 19 +- bootstrap/windows-88/Strings.c | 2 +- bootstrap/windows-88/Strings.h | 2 +- bootstrap/windows-88/Texts.c | 2 +- bootstrap/windows-88/Texts.h | 2 +- bootstrap/windows-88/Vishap.c | 2 +- bootstrap/windows-88/errors.c | 2 +- bootstrap/windows-88/errors.h | 2 +- bootstrap/windows-88/extTools.c | 2 +- bootstrap/windows-88/extTools.h | 2 +- bootstrap/windows-88/vt100.c | 2 +- bootstrap/windows-88/vt100.h | 2 +- src/compiler/OPB.Mod | 4 +- src/compiler/OPT.Mod | 61 +++--- src/compiler/OPV.Mod | 2 +- src/system/SYSTEM.h | 2 +- src/test/confidence/testresult.sh | 4 +- 205 files changed, 1353 insertions(+), 1325 deletions(-) diff --git a/bootstrap/unix-44/Configuration.c b/bootstrap/unix-44/Configuration.c index b0d48f0a..947863a2 100644 --- a/bootstrap/unix-44/Configuration.c +++ b/bootstrap/unix-44/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" @@ -13,6 +13,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("1.95 [2016/08/26] for gcc LP64 on cygwin", Configuration_versionLong, 41); + __MOVE("1.95 [2016/08/30] for gcc LP64 on cygwin", Configuration_versionLong, 41); __ENDMOD; } diff --git a/bootstrap/unix-44/Configuration.h b/bootstrap/unix-44/Configuration.h index 38a63260..33303334 100644 --- a/bootstrap/unix-44/Configuration.h +++ b/bootstrap/unix-44/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/unix-44/Console.c b/bootstrap/unix-44/Console.c index cc4cc8bd..375896e6 100644 --- a/bootstrap/unix-44/Console.c +++ b/bootstrap/unix-44/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Platform.h" diff --git a/bootstrap/unix-44/Console.h b/bootstrap/unix-44/Console.h index 2c462da9..0e7cb823 100644 --- a/bootstrap/unix-44/Console.h +++ b/bootstrap/unix-44/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/unix-44/Files.c b/bootstrap/unix-44/Files.c index 496a4a87..069b901c 100644 --- a/bootstrap/unix-44/Files.c +++ b/bootstrap/unix-44/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "Console.h" diff --git a/bootstrap/unix-44/Files.h b/bootstrap/unix-44/Files.h index bc1d11eb..7241c31a 100644 --- a/bootstrap/unix-44/Files.h +++ b/bootstrap/unix-44/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tspkaSfF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/unix-44/Heap.c b/bootstrap/unix-44/Heap.c index cca2fc74..5fcaf193 100644 --- a/bootstrap/unix-44/Heap.c +++ b/bootstrap/unix-44/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tskSfF */ #include "SYSTEM.h" struct Heap__1 { diff --git a/bootstrap/unix-44/Heap.h b/bootstrap/unix-44/Heap.h index d05f688c..4247d33d 100644 --- a/bootstrap/unix-44/Heap.h +++ b/bootstrap/unix-44/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tskSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/unix-44/Modules.c b/bootstrap/unix-44/Modules.c index d76a50a2..148c062a 100644 --- a/bootstrap/unix-44/Modules.c +++ b/bootstrap/unix-44/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Console.h" #include "Heap.h" diff --git a/bootstrap/unix-44/Modules.h b/bootstrap/unix-44/Modules.h index 78c8d49e..85b1ec59 100644 --- a/bootstrap/unix-44/Modules.h +++ b/bootstrap/unix-44/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/unix-44/OPB.c b/bootstrap/unix-44/OPB.c index 60b37750..9a06ac24 100644 --- a/bootstrap/unix-44/OPB.c +++ b/bootstrap/unix-44/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPM.h" #include "OPS.h" @@ -34,9 +34,7 @@ export void OPB_In (OPT_Node *x, OPT_Node y); export void OPB_Index (OPT_Node *x, OPT_Node y); export void OPB_Inittd (OPT_Node *inittd, OPT_Node *last, OPT_Struct typ); static BOOLEAN OPB_IntToBool (LONGINT i); -static OPT_Struct OPB_IntType (LONGINT size); export void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y); -static LONGINT OPB_LongerSize (LONGINT i); export void OPB_MOp (SHORTINT op, OPT_Node *x); export OPT_Node OPB_NewBoolConst (BOOLEAN boolval); export OPT_Node OPB_NewIntConst (LONGINT intval); @@ -53,8 +51,6 @@ 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 LONGINT OPB_ShorterSize (LONGINT i); -static INTEGER OPB_SignedByteSize (LONGINT n); export void OPB_StFct (OPT_Node *par0, SHORTINT fctno, INTEGER parno); export void OPB_StPar0 (OPT_Node *par0, INTEGER fctno); export void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno); @@ -224,68 +220,20 @@ OPT_Node OPB_EmptySet (void) return _o_result; } -static INTEGER OPB_SignedByteSize (LONGINT n) +static void OPB_SetIntType (OPT_Node node) { - INTEGER _o_result; INTEGER b; - if (n < 0) { - n = -(n + 1); + LONGINT n; + if (node->conval->intval >= 0) { + n = node->conval->intval; + } else { + n = -(node->conval->intval + 1); } b = 1; while ((b < 8 && __ASH(n, -(__ASHL(b, 3) - 1)) != 0)) { b += 1; } - _o_result = b; - return _o_result; -} - -static LONGINT OPB_ShorterSize (LONGINT i) -{ - LONGINT _o_result; - if (i >= (int)OPM_LIntSize) { - _o_result = OPM_IntSize; - return _o_result; - } else { - _o_result = OPM_SIntSize; - return _o_result; - } - __RETCHK; -} - -static LONGINT OPB_LongerSize (LONGINT i) -{ - LONGINT _o_result; - if (i <= (int)OPM_SIntSize) { - _o_result = OPM_IntSize; - return _o_result; - } else { - _o_result = OPM_LIntSize; - return _o_result; - } - __RETCHK; -} - -static OPT_Struct OPB_IntType (LONGINT size) -{ - OPT_Struct _o_result; - OPT_Struct result = NIL; - if (size <= OPT_sinttyp->size) { - result = OPT_sinttyp; - } else if (size <= OPT_inttyp->size) { - result = OPT_inttyp; - } else { - result = OPT_linttyp; - } - if (size > OPT_linttyp->size) { - OPB_err(203); - } - _o_result = result; - return _o_result; -} - -static void OPB_SetIntType (OPT_Node node) -{ - node->typ = OPB_IntType(OPB_SignedByteSize(node->conval->intval)); + node->typ = OPT_IntType(b); } OPT_Node OPB_NewIntConst (LONGINT intval) @@ -429,16 +377,16 @@ void OPB_Field (OPT_Node *x, OPT_Object y) } } -static struct TypTest__61 { +static struct TypTest__57 { OPT_Node *x; OPT_Object *obj; BOOLEAN *guard; - struct TypTest__61 *lnk; -} *TypTest__61_s; + struct TypTest__57 *lnk; +} *TypTest__57_s; -static void GTT__62 (OPT_Struct t0, OPT_Struct t1); +static void GTT__58 (OPT_Struct t0, OPT_Struct t1); -static void GTT__62 (OPT_Struct t0, OPT_Struct t1) +static void GTT__58 (OPT_Struct t0, OPT_Struct t1) { OPT_Node node = NIL; OPT_Struct t = NIL; @@ -451,54 +399,54 @@ static void GTT__62 (OPT_Struct t0, OPT_Struct t1) t1 = t1->BaseTyp; } if (t1 == t0 || t0->form == 0) { - if (*TypTest__61_s->guard) { - OPB_BindNodes(5, NIL, &*TypTest__61_s->x, NIL); - (*TypTest__61_s->x)->readonly = (*TypTest__61_s->x)->left->readonly; + 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; } else { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__61_s->x; - node->obj = *TypTest__61_s->obj; - *TypTest__61_s->x = node; + node->left = *TypTest__57_s->x; + node->obj = *TypTest__57_s->obj; + *TypTest__57_s->x = node; } } else { OPB_err(85); } } else if (t0 != t1) { OPB_err(85); - } else if (!*TypTest__61_s->guard) { - if ((*TypTest__61_s->x)->class == 5) { + } else if (!*TypTest__57_s->guard) { + if ((*TypTest__57_s->x)->class == 5) { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__61_s->x; - node->obj = *TypTest__61_s->obj; - *TypTest__61_s->x = node; + node->left = *TypTest__57_s->x; + node->obj = *TypTest__57_s->obj; + *TypTest__57_s->x = node; } else { - *TypTest__61_s->x = OPB_NewBoolConst(1); + *TypTest__57_s->x = OPB_NewBoolConst(1); } } } void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) { - struct TypTest__61 _s; + struct TypTest__57 _s; _s.x = x; _s.obj = &obj; _s.guard = &guard; - _s.lnk = TypTest__61_s; - TypTest__61_s = &_s; + _s.lnk = TypTest__57_s; + TypTest__57_s = &_s; if (OPB_NotVar(*x)) { OPB_err(112); } else if ((*x)->typ->form == 13) { if (((*x)->typ->BaseTyp->comp != 4 && (*x)->typ != OPT_sysptrtyp)) { OPB_err(85); } else if (obj->typ->form == 13) { - GTT__62((*x)->typ->BaseTyp, obj->typ->BaseTyp); + GTT__58((*x)->typ->BaseTyp, obj->typ->BaseTyp); } else { OPB_err(86); } } else if (((((*x)->typ->comp == 4 && (*x)->class == 1)) && obj->typ->comp == 4)) { - GTT__62((*x)->typ, obj->typ); + GTT__58((*x)->typ, obj->typ); } else { OPB_err(87); } @@ -507,7 +455,7 @@ void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) } else { (*x)->typ = OPT_booltyp; } - TypTest__61_s = _s.lnk; + TypTest__57_s = _s.lnk; } void OPB_In (OPT_Node *x, OPT_Node y) @@ -573,13 +521,13 @@ static void OPB_CheckRealType (INTEGER f, INTEGER nr, OPT_Const x) x->intval = -1; } -static struct MOp__30 { - struct MOp__30 *lnk; -} *MOp__30_s; +static struct MOp__28 { + struct MOp__28 *lnk; +} *MOp__28_s; -static OPT_Node NewOp__31 (SHORTINT op, OPT_Struct typ, OPT_Node z); +static OPT_Node NewOp__29 (SHORTINT op, OPT_Struct typ, OPT_Node z); -static OPT_Node NewOp__31 (SHORTINT op, OPT_Struct typ, OPT_Node z) +static OPT_Node NewOp__29 (SHORTINT op, OPT_Struct typ, OPT_Node z) { OPT_Node _o_result; OPT_Node node = NIL; @@ -596,9 +544,9 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) INTEGER f; OPT_Struct typ = NIL; OPT_Node z = NIL; - struct MOp__30 _s; - _s.lnk = MOp__30_s; - MOp__30_s = &_s; + struct MOp__28 _s; + _s.lnk = MOp__28_s; + MOp__28_s = &_s; z = *x; if (z->class == 8 || z->class == 9) { OPB_err(126); @@ -612,7 +560,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = OPB_BoolToInt(!OPB_IntToBool(z->conval->intval)); z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(98); @@ -640,7 +588,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(97); @@ -661,7 +609,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(111); @@ -673,7 +621,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = (int)__CAP((CHAR)z->conval->intval); z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(111); @@ -686,7 +634,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = OPB_BoolToInt(__ODD(z->conval->intval)); z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(111); @@ -699,7 +647,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) f = 10; } if (z->class < 7 || f == 10) { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } else { OPB_err(127); } @@ -708,7 +656,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) case 25: if ((__IN(f, 0x70) && z->class == 7)) { if ((0 <= z->conval->intval && z->conval->intval <= -1)) { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } else { OPB_err(219); } @@ -725,7 +673,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } } *x = z; - MOp__30_s = _s.lnk; + MOp__28_s = _s.lnk; } static void OPB_CheckPtr (OPT_Node x, OPT_Node y) @@ -921,7 +869,7 @@ static void OPB_ConstOp (INTEGER op, OPT_Node x, OPT_Node y) if (x->typ->size <= y->typ->size) { x->typ = y->typ; } else { - x->typ = OPB_IntType(x->typ->size); + x->typ = OPT_IntType(x->typ->size); } } else if (g == 7) { x->typ = OPT_realtyp; @@ -1178,7 +1126,7 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) if (__IN(g, 0x70)) { if (f > g) { OPB_SetIntType(*x); - if ((int)(*x)->typ->form > g) { + if ((*x)->typ->size > typ->size) { OPB_err(203); (*x)->conval->intval = 1; } @@ -1219,15 +1167,15 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) (*x)->typ = typ; } -static struct Op__40 { +static struct Op__38 { INTEGER *f, *g; - struct Op__40 *lnk; -} *Op__40_s; + struct Op__38 *lnk; +} *Op__38_s; -static void NewOp__41 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y); -static BOOLEAN strings__43 (OPT_Node *x, OPT_Node *y); +static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y); +static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y); -static void NewOp__41 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) +static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) { OPT_Node node = NIL; node = OPT_NewNode(12); @@ -1238,29 +1186,29 @@ static void NewOp__41 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) *x = node; } -static BOOLEAN strings__43 (OPT_Node *x, OPT_Node *y) +static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y) { BOOLEAN _o_result; BOOLEAN ok, xCharArr, yCharArr; - xCharArr = (__IN((*x)->typ->comp, 0x0c) && (*x)->typ->BaseTyp->form == 3) || *Op__40_s->f == 10; - yCharArr = (__IN((*y)->typ->comp, 0x0c) && (*y)->typ->BaseTyp->form == 3) || *Op__40_s->g == 10; - if ((((xCharArr && *Op__40_s->g == 3)) && (*y)->class == 7)) { + xCharArr = (__IN((*x)->typ->comp, 0x0c) && (*x)->typ->BaseTyp->form == 3) || *Op__38_s->f == 10; + yCharArr = (__IN((*y)->typ->comp, 0x0c) && (*y)->typ->BaseTyp->form == 3) || *Op__38_s->g == 10; + if ((((xCharArr && *Op__38_s->g == 3)) && (*y)->class == 7)) { OPB_CharToString(*y); - *Op__40_s->g = 10; + *Op__38_s->g = 10; yCharArr = 1; } - if ((((yCharArr && *Op__40_s->f == 3)) && (*x)->class == 7)) { + if ((((yCharArr && *Op__38_s->f == 3)) && (*x)->class == 7)) { OPB_CharToString(*x); - *Op__40_s->f = 10; + *Op__38_s->f = 10; xCharArr = 1; } ok = (xCharArr && yCharArr); if (ok) { - if ((*Op__40_s->f == 10 && (*x)->conval->intval2 == 1)) { + if ((*Op__38_s->f == 10 && (*x)->conval->intval2 == 1)) { (*x)->typ = OPT_chartyp; (*x)->conval->intval = 0; OPB_Index(&*y, OPB_NewIntConst(((LONGINT)(0)))); - } else if ((*Op__40_s->g == 10 && (*y)->conval->intval2 == 1)) { + } else if ((*Op__38_s->g == 10 && (*y)->conval->intval2 == 1)) { (*y)->typ = OPT_chartyp; (*y)->conval->intval = 0; OPB_Index(&*x, OPB_NewIntConst(((LONGINT)(0)))); @@ -1277,11 +1225,11 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPT_Struct typ = NIL; BOOLEAN do_; LONGINT val; - struct Op__40 _s; + struct Op__38 _s; _s.f = &f; _s.g = &g; - _s.lnk = Op__40_s; - Op__40_s = &_s; + _s.lnk = Op__38_s; + Op__38_s = &_s; z = *x; if (((z->class == 8 || z->class == 9) || y->class == 8) || y->class == 9) { OPB_err(126); @@ -1393,7 +1341,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if (do_) { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } break; case 2: @@ -1412,7 +1360,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(102); typ = OPT_undftyp; } - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); break; case 3: do_ = 1; @@ -1435,7 +1383,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if (do_) { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } break; case 4: @@ -1453,7 +1401,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(104); typ = OPT_undftyp; } - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); break; case 5: if (f == 2) { @@ -1463,7 +1411,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } else if ((y->class == 7 && OPB_IntToBool(y->conval->intval))) { } else { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } } else if (f != 0) { OPB_err(94); @@ -1486,7 +1434,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } if (do_) { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } break; case 7: @@ -1495,7 +1443,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if ((!__IN(f, 0x70) || y->class != 7) || y->conval->intval != 0) { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } break; case 8: @@ -1506,7 +1454,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } else if ((y->class == 7 && !OPB_IntToBool(y->conval->intval))) { } else { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } } else if (f != 0) { OPB_err(95); @@ -1514,16 +1462,16 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } break; case 9: case 10: - if (__IN(f, 0x6bff) || strings__43(&z, &y)) { + if (__IN(f, 0x6bff) || strings__41(&z, &y)) { typ = OPT_booltyp; } else { OPB_err(107); typ = OPT_undftyp; } - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); break; case 11: case 12: case 13: case 14: - if (__IN(f, 0x01f9) || strings__43(&z, &y)) { + if (__IN(f, 0x01f9) || strings__41(&z, &y)) { typ = OPT_booltyp; } else { OPM_LogWLn(); @@ -1532,7 +1480,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(108); typ = OPT_undftyp; } - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); break; default: OPM_LogWStr((CHAR*)"unhandled case in OPB.Op, op = ", (LONGINT)32); @@ -1542,7 +1490,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } *x = z; - Op__40_s = _s.lnk; + Op__38_s = _s.lnk; } void OPB_SetRange (OPT_Node *x, OPT_Node y) @@ -1894,8 +1842,13 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) case 10: if (x->class == 8 || x->class == 9) { OPB_err(126); - } else if ((__IN(f, 0x70) && x->typ->size > (int)OPM_SIntSize)) { - OPB_Convert(&x, OPB_IntType(OPB_ShorterSize(x->typ->size))); + } else if (__IN(f, 0x70)) { + typ = OPT_ShorterOrLongerType(x->typ, -1); + if (typ == NIL) { + OPB_err(111); + } else { + OPB_Convert(&x, typ); + } } else if (f == 8) { OPB_Convert(&x, OPT_realtyp); } else { @@ -1905,8 +1858,13 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) case 11: if (x->class == 8 || x->class == 9) { OPB_err(126); - } else if ((__IN(f, 0x70) && x->typ->size < (int)OPM_LIntSize)) { - OPB_Convert(&x, OPB_IntType(OPB_LongerSize(x->typ->size))); + } else if (__IN(f, 0x70)) { + typ = OPT_ShorterOrLongerType(x->typ, 1); + if (typ == NIL) { + OPB_err(111); + } else { + OPB_Convert(&x, typ); + } } else if (f == 7) { OPB_Convert(&x, OPT_lrltyp); } else if (f == 3) { @@ -2043,13 +2001,13 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) *par0 = x; } -static struct StPar1__56 { - struct StPar1__56 *lnk; -} *StPar1__56_s; +static struct StPar1__52 { + struct StPar1__52 *lnk; +} *StPar1__52_s; -static OPT_Node NewOp__57 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right); +static OPT_Node NewOp__53 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right); -static OPT_Node NewOp__57 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right) +static OPT_Node NewOp__53 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right) { OPT_Node _o_result; OPT_Node node = NIL; @@ -2066,9 +2024,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) INTEGER f, L; OPT_Struct typ = NIL; OPT_Node p = NIL, t = NIL; - struct StPar1__56 _s; - _s.lnk = StPar1__56_s; - StPar1__56_s = &_s; + struct StPar1__52 _s; + _s.lnk = StPar1__52_s; + StPar1__52_s = &_s; p = *par0; f = x->typ->form; switch (fctno) { @@ -2084,7 +2042,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) OPB_err(111); } } - p = NewOp__57(19, fctno, p, x); + p = NewOp__53(19, fctno, p, x); p->typ = OPT_notyp; } break; @@ -2095,7 +2053,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (int)OPM_MaxSet))) { OPB_err(202); } - p = NewOp__57(19, fctno, p, x); + p = NewOp__53(19, fctno, p, x); } else { OPB_err(111); } @@ -2120,7 +2078,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) p = p->left; x->conval->intval += 1; } - p = NewOp__57(12, 19, p, x); + p = NewOp__53(12, 19, p, x); p->typ = OPT_linttyp; } else { p = x; @@ -2142,7 +2100,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) t = x; x = p; p = t; - p = NewOp__57(19, 18, p, x); + p = NewOp__53(19, 18, p, x); } else { OPB_err(111); } @@ -2168,7 +2126,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) } p->obj = NIL; } else { - p = NewOp__57(12, 17, p, x); + p = NewOp__53(12, 17, p, x); p->typ = OPT_linttyp; } } else { @@ -2199,9 +2157,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) OPB_err(111); } else { if (fctno == 22) { - p = NewOp__57(12, 27, p, x); + p = NewOp__53(12, 27, p, x); } else { - p = NewOp__57(12, 28, p, x); + p = NewOp__53(12, 28, p, x); } p->typ = p->left->typ; } @@ -2218,7 +2176,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) x = p; p = t; } - p = NewOp__57(19, fctno, p, x); + p = NewOp__53(19, fctno, p, x); } else { OPB_err(111); } @@ -2228,7 +2186,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) if (x->class == 8 || x->class == 9) { OPB_err(126); } else if (__IN(f, 0x70)) { - p = NewOp__57(12, 26, p, x); + p = NewOp__53(12, 26, p, x); } else { OPB_err(111); } @@ -2252,7 +2210,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) if (x->class == 8 || x->class == 9) { OPB_err(126); } else if (__IN(f, 0x70)) { - p = NewOp__57(19, 30, p, x); + p = NewOp__53(19, 30, p, x); } else { OPB_err(111); } @@ -2298,7 +2256,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) break; } *par0 = p; - StPar1__56_s = _s.lnk; + StPar1__52_s = _s.lnk; } void OPB_StParN (OPT_Node *par0, OPT_Node x, INTEGER fctno, INTEGER n) diff --git a/bootstrap/unix-44/OPB.h b/bootstrap/unix-44/OPB.h index e7a96131..81b3745b 100644 --- a/bootstrap/unix-44/OPB.h +++ b/bootstrap/unix-44/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/unix-44/OPC.c b/bootstrap/unix-44/OPC.c index 02a24b4d..8a3a54cf 100644 --- a/bootstrap/unix-44/OPC.c +++ b/bootstrap/unix-44/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "OPM.h" diff --git a/bootstrap/unix-44/OPC.h b/bootstrap/unix-44/OPC.h index 7aea7283..dcd53d63 100644 --- a/bootstrap/unix-44/OPC.h +++ b/bootstrap/unix-44/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/unix-44/OPM.c b/bootstrap/unix-44/OPM.c index 88c3bd4d..65ebb8b0 100644 --- a/bootstrap/unix-44/OPM.c +++ b/bootstrap/unix-44/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "Console.h" diff --git a/bootstrap/unix-44/OPM.h b/bootstrap/unix-44/OPM.h index 3c2be746..a61c632e 100644 --- a/bootstrap/unix-44/OPM.h +++ b/bootstrap/unix-44/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPM__h #define OPM__h diff --git a/bootstrap/unix-44/OPP.c b/bootstrap/unix-44/OPP.c index a0c19958..5620c5ec 100644 --- a/bootstrap/unix-44/OPP.c +++ b/bootstrap/unix-44/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPB.h" #include "OPM.h" @@ -24,7 +24,7 @@ export LONGINT *OPP__1__typ; static void OPP_ActualParameters (OPT_Node *aparlist, OPT_Object fpar); static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned); static void OPP_Block (OPT_Node *procdec, OPT_Node *statseq); -static void OPP_CaseLabelList (OPT_Node *lab, INTEGER LabelForm, INTEGER *n, OPP_CaseTable tab); +static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, INTEGER *n, OPP_CaseTable tab); static void OPP_CheckMark (SHORTINT *vis); static void OPP_CheckSym (INTEGER s); static void OPP_CheckSysFlag (INTEGER *sysflag, INTEGER default_); @@ -1163,7 +1163,7 @@ static void OPP_ProcedureDeclaration (OPT_Node *x) ProcedureDeclaration__16_s = _s.lnk; } -static void OPP_CaseLabelList (OPT_Node *lab, INTEGER LabelForm, INTEGER *n, OPP_CaseTable tab) +static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, INTEGER *n, OPP_CaseTable tab) { OPT_Node x = NIL, y = NIL, lastlab = NIL; INTEGER i, f; @@ -1180,10 +1180,10 @@ static void OPP_CaseLabelList (OPT_Node *lab, INTEGER LabelForm, INTEGER *n, OPP xval = 1; } if (__IN(f, 0x70)) { - if (LabelForm < f) { + if (!__IN(LabelTyp->form, 0x70) || LabelTyp->size < x->typ->size) { OPP_err(60); } - } else if (LabelForm != f) { + } else if ((int)LabelTyp->form != f) { OPP_err(60); } if (OPP_sym == 21) { @@ -1262,7 +1262,7 @@ static void CasePart__31 (OPT_Node *x) n = 0; for (;;) { if (OPP_sym < 40) { - OPP_CaseLabelList(&lab, (*x)->typ->form, &n, tab); + OPP_CaseLabelList(&lab, (*x)->typ, &n, tab); OPP_CheckSym(20); OPP_StatSeq(&y); OPB_Construct(17, &lab, y); @@ -1471,7 +1471,7 @@ static void OPP_StatSeq (OPT_Node *stat) SetPos__35(z); OPB_Link(&*stat, &last, z); y = OPB_NewLeaf(t); - } else if (y->typ->form < 4 || y->typ->form > x->left->typ->form) { + } else if (!__IN(y->typ->form, 0x70) || y->typ->size > x->left->typ->size) { OPP_err(113); } OPB_Link(&*stat, &last, x); diff --git a/bootstrap/unix-44/OPP.h b/bootstrap/unix-44/OPP.h index 6c24817c..be6b6252 100644 --- a/bootstrap/unix-44/OPP.h +++ b/bootstrap/unix-44/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/unix-44/OPS.c b/bootstrap/unix-44/OPS.c index 85c8b275..1f721944 100644 --- a/bootstrap/unix-44/OPS.c +++ b/bootstrap/unix-44/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tspkaSfF */ #include "SYSTEM.h" #include "OPM.h" diff --git a/bootstrap/unix-44/OPS.h b/bootstrap/unix-44/OPS.h index 313c0ac7..ecd93034 100644 --- a/bootstrap/unix-44/OPS.h +++ b/bootstrap/unix-44/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tspkaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/unix-44/OPT.c b/bootstrap/unix-44/OPT.c index cbd147e6..8efa4803 100644 --- a/bootstrap/unix-44/OPT.c +++ b/bootstrap/unix-44/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPM.h" #include "OPS.h" @@ -84,11 +84,11 @@ typedef export void (*OPT_typSize)(OPT_Struct); export OPT_Object OPT_topScope; export OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_ainttyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp; -static OPT_Object OPT_LIntObj; export SHORTINT OPT_nofGmod; export OPT_Object OPT_GlbMod[64]; export OPS_Name OPT_SelfName; export BOOLEAN OPT_SYSimported; +static OPT_Struct OPT_IntTypes[20]; static OPT_Object OPT_universe, OPT_syslink; static OPT_ImpCtxt OPT_impCtxt; static OPT_ExpCtxt OPT_expCtxt; @@ -106,7 +106,6 @@ export void OPT_Close (void); export void OPT_CloseScope (void); static void OPT_DebugStruct (OPT_Struct btyp); static void OPT_EnterBoolConst (OPS_Name name, LONGINT value); -static void OPT_EnterDerivedType (OPS_Name name, OPT_Struct typ, OPT_Object *obj); static void OPT_EnterProc (OPS_Name name, INTEGER num); static void OPT_EnterTyp (OPS_Name name, SHORTINT form, INTEGER size, OPT_Struct *res); export void OPT_Export (BOOLEAN *ext, BOOLEAN *new); @@ -128,10 +127,12 @@ static OPT_Object OPT_InObj (SHORTINT mno); static void OPT_InSign (SHORTINT mno, OPT_Struct *res, OPT_Object *par); static void OPT_InStruct (OPT_Struct *typ); static OPT_Object OPT_InTProc (SHORTINT mno); +static OPT_Struct OPT_InTyp (LONGINT tag); export void OPT_Init (OPS_Name name, SET opt); static void OPT_InitStruct (OPT_Struct *typ, SHORTINT form); export void OPT_Insert (OPS_Name name, OPT_Object *obj); export void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old); +export OPT_Struct OPT_IntType (LONGINT size); export OPT_Const OPT_NewConst (void); export OPT_ConstExt OPT_NewExt (void); export OPT_Node OPT_NewNode (SHORTINT class); @@ -147,6 +148,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_ShorterOrLongerType (OPT_Struct x, INTEGER dir); static void OPT_err (INTEGER n); @@ -155,6 +157,34 @@ static void OPT_err (INTEGER n) OPM_err(n); } +OPT_Struct OPT_IntType (LONGINT size) +{ + OPT_Struct _o_result; + INTEGER i; + i = 1; + while ((OPT_IntTypes[__X(i, ((LONGINT)(20)))]->size < size && OPT_IntTypes[__X(i + 1, ((LONGINT)(20)))] != NIL)) { + i += 1; + } + _o_result = OPT_IntTypes[__X(i, ((LONGINT)(20)))]; + return _o_result; +} + +OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, INTEGER dir) +{ + OPT_Struct _o_result; + INTEGER i; + __ASSERT(__IN(x->form, 0x70), 0); + __ASSERT(dir == 1 || dir == -1, 0); + __ASSERT(x->BaseTyp == OPT_undftyp, 0); + i = 0; + while ((OPT_IntTypes[__X(i, ((LONGINT)(20)))] != x && i < 20)) { + i += 1; + } + __ASSERT(i < 19, 0); + _o_result = OPT_IntTypes[__X(i + dir, ((LONGINT)(20)))]; + return _o_result; +} + OPT_Const OPT_NewConst (void) { OPT_Const _o_result; @@ -467,21 +497,21 @@ void OPT_IdFPrint (OPT_Struct typ) } } -static struct FPrintStr__13 { +static struct FPrintStr__12 { LONGINT *pbfp, *pvfp; - struct FPrintStr__13 *lnk; -} *FPrintStr__13_s; + struct FPrintStr__12 *lnk; +} *FPrintStr__12_s; -static void FPrintFlds__14 (OPT_Object fld, LONGINT adr, BOOLEAN visible); -static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, LONGINT adr); -static void FPrintTProcs__18 (OPT_Object obj); +static void FPrintFlds__13 (OPT_Object fld, LONGINT adr, BOOLEAN visible); +static void FPrintHdFld__15 (OPT_Struct typ, OPT_Object fld, LONGINT adr); +static void FPrintTProcs__17 (OPT_Object obj); -static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, LONGINT adr) +static void FPrintHdFld__15 (OPT_Struct typ, OPT_Object fld, LONGINT adr) { LONGINT i, j, n; OPT_Struct btyp = NIL; if (typ->comp == 4) { - FPrintFlds__14(typ->link, adr, 0); + FPrintFlds__13(typ->link, adr, 0); } else if (typ->comp == 2) { btyp = typ->BaseTyp; n = typ->n; @@ -491,53 +521,53 @@ static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, LONGINT adr) } if (btyp->form == 13 || btyp->comp == 4) { j = OPT_nofhdfld; - FPrintHdFld__16(btyp, fld, adr); + FPrintHdFld__15(btyp, fld, adr); if (j != OPT_nofhdfld) { i = 1; while ((i < n && OPT_nofhdfld <= 2048)) { adr += btyp->size; - FPrintHdFld__16(btyp, fld, adr); + FPrintHdFld__15(btyp, fld, adr); i += 1; } } } } else if (typ->form == 13 || __STRCMP(fld->name, "@ptr") == 0) { - OPM_FPrint(&*FPrintStr__13_s->pvfp, ((LONGINT)(13))); - OPM_FPrint(&*FPrintStr__13_s->pvfp, adr); + OPM_FPrint(&*FPrintStr__12_s->pvfp, ((LONGINT)(13))); + OPM_FPrint(&*FPrintStr__12_s->pvfp, adr); OPT_nofhdfld += 1; } } -static void FPrintFlds__14 (OPT_Object fld, LONGINT adr, BOOLEAN visible) +static void FPrintFlds__13 (OPT_Object fld, LONGINT adr, BOOLEAN visible) { while ((fld != NIL && fld->mode == 4)) { if ((fld->vis != 0 && visible)) { - OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->vis); - OPT_FPrintName(&*FPrintStr__13_s->pbfp, (void*)fld->name, ((LONGINT)(256))); - OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->adr); + OPM_FPrint(&*FPrintStr__12_s->pbfp, fld->vis); + OPT_FPrintName(&*FPrintStr__12_s->pbfp, (void*)fld->name, ((LONGINT)(256))); + OPM_FPrint(&*FPrintStr__12_s->pbfp, fld->adr); OPT_FPrintStr(fld->typ); - OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->typ->pbfp); - OPM_FPrint(&*FPrintStr__13_s->pvfp, fld->typ->pvfp); + OPM_FPrint(&*FPrintStr__12_s->pbfp, fld->typ->pbfp); + OPM_FPrint(&*FPrintStr__12_s->pvfp, fld->typ->pvfp); } else { - FPrintHdFld__16(fld->typ, fld, fld->adr + adr); + FPrintHdFld__15(fld->typ, fld, fld->adr + adr); } fld = fld->link; } } -static void FPrintTProcs__18 (OPT_Object obj) +static void FPrintTProcs__17 (OPT_Object obj) { if (obj != NIL) { - FPrintTProcs__18(obj->left); + FPrintTProcs__17(obj->left); if (obj->mode == 13) { if (obj->vis != 0) { - OPM_FPrint(&*FPrintStr__13_s->pbfp, ((LONGINT)(13))); - OPM_FPrint(&*FPrintStr__13_s->pbfp, __ASHR(obj->adr, 16)); - OPT_FPrintSign(&*FPrintStr__13_s->pbfp, obj->typ, obj->link); - OPT_FPrintName(&*FPrintStr__13_s->pbfp, (void*)obj->name, ((LONGINT)(256))); + OPM_FPrint(&*FPrintStr__12_s->pbfp, ((LONGINT)(13))); + OPM_FPrint(&*FPrintStr__12_s->pbfp, __ASHR(obj->adr, 16)); + OPT_FPrintSign(&*FPrintStr__12_s->pbfp, obj->typ, obj->link); + OPT_FPrintName(&*FPrintStr__12_s->pbfp, (void*)obj->name, ((LONGINT)(256))); } } - FPrintTProcs__18(obj->right); + FPrintTProcs__17(obj->right); } } @@ -547,11 +577,11 @@ void OPT_FPrintStr (OPT_Struct typ) OPT_Struct btyp = NIL; OPT_Object strobj = NIL, bstrobj = NIL; LONGINT pbfp, pvfp; - struct FPrintStr__13 _s; + struct FPrintStr__12 _s; _s.pbfp = &pbfp; _s.pvfp = &pvfp; - _s.lnk = FPrintStr__13_s; - FPrintStr__13_s = &_s; + _s.lnk = FPrintStr__12_s; + FPrintStr__12_s = &_s; if (!typ->fpdone) { OPT_IdFPrint(typ); pbfp = typ->idfp; @@ -588,11 +618,11 @@ void OPT_FPrintStr (OPT_Struct typ) OPM_FPrint(&pvfp, typ->align); OPM_FPrint(&pvfp, typ->n); OPT_nofhdfld = 0; - FPrintFlds__14(typ->link, ((LONGINT)(0)), 1); + FPrintFlds__13(typ->link, ((LONGINT)(0)), 1); if (OPT_nofhdfld > 2048) { OPM_Mark(225, typ->txtpos); } - FPrintTProcs__18(typ->link); + FPrintTProcs__17(typ->link); OPM_FPrint(&pvfp, pbfp); strobj = typ->strobj; if (strobj == NIL || strobj->name[0] == 0x00) { @@ -602,7 +632,7 @@ void OPT_FPrintStr (OPT_Struct typ) typ->pbfp = pbfp; typ->pvfp = pvfp; } - FPrintStr__13_s = _s.lnk; + FPrintStr__12_s = _s.lnk; } void OPT_FPrintObj (OPT_Object obj) @@ -946,6 +976,19 @@ static OPT_Object OPT_InTProc (SHORTINT mno) return _o_result; } +static OPT_Struct OPT_InTyp (LONGINT tag) +{ + OPT_Struct _o_result; + if (__IN(tag, 0x70)) { + _o_result = OPT_IntType(OPM_SymRInt()); + return _o_result; + } else { + _o_result = OPT_impCtxt.ref[__X(tag, ((LONGINT)(255)))]; + return _o_result; + } + __RETCHK; +} + static void OPT_InStruct (OPT_Struct *typ) { SHORTINT mno; @@ -956,7 +999,7 @@ static void OPT_InStruct (OPT_Struct *typ) OPT_Object obj = NIL, last = NIL, fld = NIL, old = NIL, dummy = NIL; tag = OPM_SymRInt(); if (tag != 34) { - *typ = OPT_impCtxt.ref[__X(-tag, ((LONGINT)(255)))]; + *typ = OPT_InTyp(-tag); } else { ref = OPT_impCtxt.nofr; OPT_impCtxt.nofr += 1; @@ -1081,7 +1124,7 @@ static void OPT_InStruct (OPT_Struct *typ) } if (ref == OPT_impCtxt.minr) { while (ref < OPT_impCtxt.nofr) { - t = OPT_impCtxt.ref[__X(ref, ((LONGINT)(255)))]; + t = OPT_InTyp(ref); OPT_FPrintStr(t); obj = t->strobj; if (obj->name[0] != 0x00) { @@ -1150,9 +1193,9 @@ static OPT_Object OPT_InObj (SHORTINT mno) obj->vis = 1; if (tag <= 13) { obj->mode = 3; - obj->typ = OPT_impCtxt.ref[__X(tag, ((LONGINT)(255)))]; obj->conval = OPT_NewConst(); OPT_InConstant(tag, obj->conval); + obj->typ = OPT_InTyp(tag); } else if (tag >= 31) { obj->conval = OPT_NewConst(); obj->conval->intval = -1; @@ -1396,6 +1439,9 @@ static void OPT_OutStr (OPT_Struct typ) OPT_Object strobj = NIL; if (typ->ref < OPT_expCtxt.ref) { OPM_SymWInt(-typ->ref); + if (__IN(typ->ref, 0x70)) { + OPM_SymWInt(typ->size); + } } else { OPM_SymWInt(((LONGINT)(34))); typ->ref = OPT_expCtxt.ref; @@ -1493,6 +1539,7 @@ static void OPT_OutConstant (OPT_Object obj) break; case 4: case 5: case 6: OPM_SymWInt(obj->conval->intval); + OPM_SymWInt(obj->typ->size); break; case 9: OPM_SymWSet(obj->conval->setval); @@ -1699,15 +1746,6 @@ static void OPT_EnterTyp (OPS_Name name, SHORTINT form, INTEGER size, OPT_Struct *res = typ; } -static void OPT_EnterDerivedType (OPS_Name name, OPT_Struct typ, OPT_Object *obj) -{ - OPS_Name name__copy; - __DUPARR(name, OPS_Name); - OPT_Insert(name, &*obj); - (*obj)->mode = 5; - (*obj)->typ = typ; -} - static void OPT_EnterProc (OPS_Name name, INTEGER num) { OPT_Object obj = NIL; @@ -1741,8 +1779,8 @@ static void EnumPtrs(void (*P)(void*)) P(OPT_niltyp); P(OPT_notyp); P(OPT_sysptrtyp); - P(OPT_LIntObj); __ENUMP(OPT_GlbMod, 64, P); + __ENUMP(OPT_IntTypes, 20, P); P(OPT_universe); P(OPT_syslink); __ENUMR(&OPT_impCtxt, OPT_ImpCtxt__typ, 3140, 1, P); @@ -1811,7 +1849,7 @@ export void *OPT__init(void) OPT_InitStruct(&OPT_niltyp, 11); OPT_EnterTyp((CHAR*)"BYTE", 1, OPM_ByteSize, &OPT_bytetyp); OPT_EnterTyp((CHAR*)"PTR", 13, OPM_PointerSize, &OPT_sysptrtyp); - OPT_EnterTyp((CHAR*)"ADRINT", 5, OPM_LIntSize, &OPT_ainttyp); + OPT_EnterTyp((CHAR*)"ADRINT", 5, OPM_PointerSize, &OPT_ainttyp); OPT_EnterTyp((CHAR*)"INT8", 5, 1, &OPT_int8typ); OPT_EnterTyp((CHAR*)"INT16", 5, 2, &OPT_int16typ); OPT_EnterTyp((CHAR*)"INT32", 5, 4, &OPT_int32typ); @@ -1839,7 +1877,6 @@ export void *OPT__init(void) OPT_EnterTyp((CHAR*)"LONGINT", 6, OPM_LIntSize, &OPT_linttyp); OPT_EnterTyp((CHAR*)"LONGREAL", 8, OPM_LRealSize, &OPT_lrltyp); OPT_EnterTyp((CHAR*)"SHORTINT", 4, OPM_SIntSize, &OPT_sinttyp); - OPT_EnterDerivedType((CHAR*)"LINT", OPT_int64typ, &OPT_LIntObj); OPT_EnterBoolConst((CHAR*)"FALSE", ((LONGINT)(0))); OPT_EnterBoolConst((CHAR*)"TRUE", ((LONGINT)(1))); OPT_EnterProc((CHAR*)"HALT", 0); @@ -1877,5 +1914,12 @@ export void *OPT__init(void) OPT_impCtxt.ref[11] = OPT_niltyp; OPT_impCtxt.ref[12] = OPT_notyp; OPT_impCtxt.ref[13] = OPT_sysptrtyp; + OPT_IntTypes[1] = OPT_sinttyp; + OPT_IntTypes[2] = OPT_inttyp; + OPT_IntTypes[3] = OPT_linttyp; + OPT_IntTypes[5] = OPT_int8typ; + OPT_IntTypes[6] = OPT_int16typ; + OPT_IntTypes[7] = OPT_int32typ; + OPT_IntTypes[8] = OPT_int64typ; __ENDMOD; } diff --git a/bootstrap/unix-44/OPT.h b/bootstrap/unix-44/OPT.h index c4975398..f6206e42 100644 --- a/bootstrap/unix-44/OPT.h +++ b/bootstrap/unix-44/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPT__h #define OPT__h @@ -92,12 +92,14 @@ import void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done); import void OPT_Init (OPS_Name name, SET opt); import void OPT_Insert (OPS_Name name, OPT_Object *obj); import void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old); +import OPT_Struct OPT_IntType (LONGINT size); import OPT_Const OPT_NewConst (void); import OPT_ConstExt OPT_NewExt (void); import OPT_Node OPT_NewNode (SHORTINT class); import OPT_Object OPT_NewObj (void); import OPT_Struct OPT_NewStr (SHORTINT form, SHORTINT comp); import void OPT_OpenScope (SHORTINT level, OPT_Object owner); +import OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, INTEGER dir); import void *OPT__init(void); diff --git a/bootstrap/unix-44/OPV.c b/bootstrap/unix-44/OPV.c index 2172dee5..03b675a9 100644 --- a/bootstrap/unix-44/OPV.c +++ b/bootstrap/unix-44/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPC.h" #include "OPM.h" diff --git a/bootstrap/unix-44/OPV.h b/bootstrap/unix-44/OPV.h index 122fda4a..6926d6ac 100644 --- a/bootstrap/unix-44/OPV.h +++ b/bootstrap/unix-44/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/unix-44/Platform.c b/bootstrap/unix-44/Platform.c index 6326549f..9e1c6dfd 100644 --- a/bootstrap/unix-44/Platform.c +++ b/bootstrap/unix-44/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" typedef diff --git a/bootstrap/unix-44/Platform.h b/bootstrap/unix-44/Platform.h index 77a9b68f..b890523b 100644 --- a/bootstrap/unix-44/Platform.h +++ b/bootstrap/unix-44/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/unix-44/Reals.c b/bootstrap/unix-44/Reals.c index 11c99924..4ee29f7d 100644 --- a/bootstrap/unix-44/Reals.c +++ b/bootstrap/unix-44/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" diff --git a/bootstrap/unix-44/Reals.h b/bootstrap/unix-44/Reals.h index b0497a9c..0a81ebf4 100644 --- a/bootstrap/unix-44/Reals.h +++ b/bootstrap/unix-44/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/unix-44/SYSTEM.h b/bootstrap/unix-44/SYSTEM.h index 35620b9b..343404a4 100644 --- a/bootstrap/unix-44/SYSTEM.h +++ b/bootstrap/unix-44/SYSTEM.h @@ -60,12 +60,6 @@ typedef float REAL; typedef double LONGREAL; typedef void* SYSTEM_PTR; -// Unsigned variants are for use by shift and rotate macros. - -typedef unsigned char U_SYSTEM_BYTE; -typedef unsigned char U_CHAR; -typedef unsigned char U_SHORTINT; - // For 32 bit builds, the size of LONGINT depends on a make option: #if (__SIZEOF_POINTER__ == 8) || defined(LARGE) || defined(_WIN64) @@ -80,9 +74,20 @@ typedef unsigned char U_SHORTINT; typedef unsigned long U_LONGINT; #endif +// Unsigned variants are for use by shift and rotate macros. + +typedef unsigned char U_SYSTEM_BYTE; +typedef unsigned char U_CHAR; +typedef unsigned char U_SHORTINT; + typedef U_LONGINT SET; typedef U_LONGINT U_SET; +typedef SYSTEM_CARD8 U_SYSTEM_INT8; +typedef SYSTEM_CARD16 U_SYSTEM_INT16; +typedef SYSTEM_CARD32 U_SYSTEM_INT32; +typedef SYSTEM_CARD64 U_SYSTEM_INT64; + // OS Memory allocation interfaces are in PlatformXXX.Mod @@ -178,7 +183,7 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __ABSFD(x) SYSTEM_ABSD((double)(x)) #define __CAP(ch) ((CHAR)((ch)&0x5f)) #define __ODD(x) ((x)&1) -#define __IN(x, s) (((s)>>(x))&1) +#define __IN(x, s) ((x)>=0 && (x)<(8*sizeof(SET)) && ((((U_SET)(s))>>(x))&1)) #define __SETOF(x) ((SET)1<<(x)) #define __SETRNG(l, h) ((~(SET)0<<(l))&~(SET)0>>(8*sizeof(SET)-1-(h))) #define __MASK(x, m) ((x)&~(m)) diff --git a/bootstrap/unix-44/Strings.c b/bootstrap/unix-44/Strings.c index 15aeff29..0c372b8b 100644 --- a/bootstrap/unix-44/Strings.c +++ b/bootstrap/unix-44/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" diff --git a/bootstrap/unix-44/Strings.h b/bootstrap/unix-44/Strings.h index 385096bc..0dbfdb8e 100644 --- a/bootstrap/unix-44/Strings.h +++ b/bootstrap/unix-44/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/unix-44/Texts.c b/bootstrap/unix-44/Texts.c index 52012a3c..41ad5883 100644 --- a/bootstrap/unix-44/Texts.c +++ b/bootstrap/unix-44/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Files.h" #include "Modules.h" diff --git a/bootstrap/unix-44/Texts.h b/bootstrap/unix-44/Texts.h index 9a5617f1..f5aabe8a 100644 --- a/bootstrap/unix-44/Texts.h +++ b/bootstrap/unix-44/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/unix-44/Vishap.c b/bootstrap/unix-44/Vishap.c index 66a97f5d..e8b1e4d1 100644 --- a/bootstrap/unix-44/Vishap.c +++ b/bootstrap/unix-44/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkamSf */ #include "SYSTEM.h" #include "Configuration.h" #include "Heap.h" diff --git a/bootstrap/unix-44/errors.c b/bootstrap/unix-44/errors.c index 59b8db27..a8573f9a 100644 --- a/bootstrap/unix-44/errors.c +++ b/bootstrap/unix-44/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" typedef diff --git a/bootstrap/unix-44/errors.h b/bootstrap/unix-44/errors.h index 6ae0cd7a..6dfe7b1d 100644 --- a/bootstrap/unix-44/errors.h +++ b/bootstrap/unix-44/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/unix-44/extTools.c b/bootstrap/unix-44/extTools.c index 2ef65e7b..d2141803 100644 --- a/bootstrap/unix-44/extTools.c +++ b/bootstrap/unix-44/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "Console.h" diff --git a/bootstrap/unix-44/extTools.h b/bootstrap/unix-44/extTools.h index 39837586..38d2da7b 100644 --- a/bootstrap/unix-44/extTools.h +++ b/bootstrap/unix-44/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/unix-44/vt100.c b/bootstrap/unix-44/vt100.c index e0edabd9..5eb4f70e 100644 --- a/bootstrap/unix-44/vt100.c +++ b/bootstrap/unix-44/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Console.h" #include "Strings.h" diff --git a/bootstrap/unix-44/vt100.h b/bootstrap/unix-44/vt100.h index 413ae867..770cf66d 100644 --- a/bootstrap/unix-44/vt100.h +++ b/bootstrap/unix-44/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef vt100__h #define vt100__h diff --git a/bootstrap/unix-48/Configuration.c b/bootstrap/unix-48/Configuration.c index b0d48f0a..947863a2 100644 --- a/bootstrap/unix-48/Configuration.c +++ b/bootstrap/unix-48/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" @@ -13,6 +13,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("1.95 [2016/08/26] for gcc LP64 on cygwin", Configuration_versionLong, 41); + __MOVE("1.95 [2016/08/30] for gcc LP64 on cygwin", Configuration_versionLong, 41); __ENDMOD; } diff --git a/bootstrap/unix-48/Configuration.h b/bootstrap/unix-48/Configuration.h index 38a63260..33303334 100644 --- a/bootstrap/unix-48/Configuration.h +++ b/bootstrap/unix-48/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/unix-48/Console.c b/bootstrap/unix-48/Console.c index cc4cc8bd..375896e6 100644 --- a/bootstrap/unix-48/Console.c +++ b/bootstrap/unix-48/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Platform.h" diff --git a/bootstrap/unix-48/Console.h b/bootstrap/unix-48/Console.h index 2c462da9..0e7cb823 100644 --- a/bootstrap/unix-48/Console.h +++ b/bootstrap/unix-48/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/unix-48/Files.c b/bootstrap/unix-48/Files.c index 496a4a87..069b901c 100644 --- a/bootstrap/unix-48/Files.c +++ b/bootstrap/unix-48/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "Console.h" diff --git a/bootstrap/unix-48/Files.h b/bootstrap/unix-48/Files.h index bc1d11eb..7241c31a 100644 --- a/bootstrap/unix-48/Files.h +++ b/bootstrap/unix-48/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tspkaSfF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/unix-48/Heap.c b/bootstrap/unix-48/Heap.c index cca2fc74..5fcaf193 100644 --- a/bootstrap/unix-48/Heap.c +++ b/bootstrap/unix-48/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tskSfF */ #include "SYSTEM.h" struct Heap__1 { diff --git a/bootstrap/unix-48/Heap.h b/bootstrap/unix-48/Heap.h index d05f688c..4247d33d 100644 --- a/bootstrap/unix-48/Heap.h +++ b/bootstrap/unix-48/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tskSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/unix-48/Modules.c b/bootstrap/unix-48/Modules.c index d76a50a2..148c062a 100644 --- a/bootstrap/unix-48/Modules.c +++ b/bootstrap/unix-48/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Console.h" #include "Heap.h" diff --git a/bootstrap/unix-48/Modules.h b/bootstrap/unix-48/Modules.h index 78c8d49e..85b1ec59 100644 --- a/bootstrap/unix-48/Modules.h +++ b/bootstrap/unix-48/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/unix-48/OPB.c b/bootstrap/unix-48/OPB.c index 60b37750..9a06ac24 100644 --- a/bootstrap/unix-48/OPB.c +++ b/bootstrap/unix-48/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPM.h" #include "OPS.h" @@ -34,9 +34,7 @@ export void OPB_In (OPT_Node *x, OPT_Node y); export void OPB_Index (OPT_Node *x, OPT_Node y); export void OPB_Inittd (OPT_Node *inittd, OPT_Node *last, OPT_Struct typ); static BOOLEAN OPB_IntToBool (LONGINT i); -static OPT_Struct OPB_IntType (LONGINT size); export void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y); -static LONGINT OPB_LongerSize (LONGINT i); export void OPB_MOp (SHORTINT op, OPT_Node *x); export OPT_Node OPB_NewBoolConst (BOOLEAN boolval); export OPT_Node OPB_NewIntConst (LONGINT intval); @@ -53,8 +51,6 @@ 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 LONGINT OPB_ShorterSize (LONGINT i); -static INTEGER OPB_SignedByteSize (LONGINT n); export void OPB_StFct (OPT_Node *par0, SHORTINT fctno, INTEGER parno); export void OPB_StPar0 (OPT_Node *par0, INTEGER fctno); export void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno); @@ -224,68 +220,20 @@ OPT_Node OPB_EmptySet (void) return _o_result; } -static INTEGER OPB_SignedByteSize (LONGINT n) +static void OPB_SetIntType (OPT_Node node) { - INTEGER _o_result; INTEGER b; - if (n < 0) { - n = -(n + 1); + LONGINT n; + if (node->conval->intval >= 0) { + n = node->conval->intval; + } else { + n = -(node->conval->intval + 1); } b = 1; while ((b < 8 && __ASH(n, -(__ASHL(b, 3) - 1)) != 0)) { b += 1; } - _o_result = b; - return _o_result; -} - -static LONGINT OPB_ShorterSize (LONGINT i) -{ - LONGINT _o_result; - if (i >= (int)OPM_LIntSize) { - _o_result = OPM_IntSize; - return _o_result; - } else { - _o_result = OPM_SIntSize; - return _o_result; - } - __RETCHK; -} - -static LONGINT OPB_LongerSize (LONGINT i) -{ - LONGINT _o_result; - if (i <= (int)OPM_SIntSize) { - _o_result = OPM_IntSize; - return _o_result; - } else { - _o_result = OPM_LIntSize; - return _o_result; - } - __RETCHK; -} - -static OPT_Struct OPB_IntType (LONGINT size) -{ - OPT_Struct _o_result; - OPT_Struct result = NIL; - if (size <= OPT_sinttyp->size) { - result = OPT_sinttyp; - } else if (size <= OPT_inttyp->size) { - result = OPT_inttyp; - } else { - result = OPT_linttyp; - } - if (size > OPT_linttyp->size) { - OPB_err(203); - } - _o_result = result; - return _o_result; -} - -static void OPB_SetIntType (OPT_Node node) -{ - node->typ = OPB_IntType(OPB_SignedByteSize(node->conval->intval)); + node->typ = OPT_IntType(b); } OPT_Node OPB_NewIntConst (LONGINT intval) @@ -429,16 +377,16 @@ void OPB_Field (OPT_Node *x, OPT_Object y) } } -static struct TypTest__61 { +static struct TypTest__57 { OPT_Node *x; OPT_Object *obj; BOOLEAN *guard; - struct TypTest__61 *lnk; -} *TypTest__61_s; + struct TypTest__57 *lnk; +} *TypTest__57_s; -static void GTT__62 (OPT_Struct t0, OPT_Struct t1); +static void GTT__58 (OPT_Struct t0, OPT_Struct t1); -static void GTT__62 (OPT_Struct t0, OPT_Struct t1) +static void GTT__58 (OPT_Struct t0, OPT_Struct t1) { OPT_Node node = NIL; OPT_Struct t = NIL; @@ -451,54 +399,54 @@ static void GTT__62 (OPT_Struct t0, OPT_Struct t1) t1 = t1->BaseTyp; } if (t1 == t0 || t0->form == 0) { - if (*TypTest__61_s->guard) { - OPB_BindNodes(5, NIL, &*TypTest__61_s->x, NIL); - (*TypTest__61_s->x)->readonly = (*TypTest__61_s->x)->left->readonly; + 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; } else { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__61_s->x; - node->obj = *TypTest__61_s->obj; - *TypTest__61_s->x = node; + node->left = *TypTest__57_s->x; + node->obj = *TypTest__57_s->obj; + *TypTest__57_s->x = node; } } else { OPB_err(85); } } else if (t0 != t1) { OPB_err(85); - } else if (!*TypTest__61_s->guard) { - if ((*TypTest__61_s->x)->class == 5) { + } else if (!*TypTest__57_s->guard) { + if ((*TypTest__57_s->x)->class == 5) { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__61_s->x; - node->obj = *TypTest__61_s->obj; - *TypTest__61_s->x = node; + node->left = *TypTest__57_s->x; + node->obj = *TypTest__57_s->obj; + *TypTest__57_s->x = node; } else { - *TypTest__61_s->x = OPB_NewBoolConst(1); + *TypTest__57_s->x = OPB_NewBoolConst(1); } } } void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) { - struct TypTest__61 _s; + struct TypTest__57 _s; _s.x = x; _s.obj = &obj; _s.guard = &guard; - _s.lnk = TypTest__61_s; - TypTest__61_s = &_s; + _s.lnk = TypTest__57_s; + TypTest__57_s = &_s; if (OPB_NotVar(*x)) { OPB_err(112); } else if ((*x)->typ->form == 13) { if (((*x)->typ->BaseTyp->comp != 4 && (*x)->typ != OPT_sysptrtyp)) { OPB_err(85); } else if (obj->typ->form == 13) { - GTT__62((*x)->typ->BaseTyp, obj->typ->BaseTyp); + GTT__58((*x)->typ->BaseTyp, obj->typ->BaseTyp); } else { OPB_err(86); } } else if (((((*x)->typ->comp == 4 && (*x)->class == 1)) && obj->typ->comp == 4)) { - GTT__62((*x)->typ, obj->typ); + GTT__58((*x)->typ, obj->typ); } else { OPB_err(87); } @@ -507,7 +455,7 @@ void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) } else { (*x)->typ = OPT_booltyp; } - TypTest__61_s = _s.lnk; + TypTest__57_s = _s.lnk; } void OPB_In (OPT_Node *x, OPT_Node y) @@ -573,13 +521,13 @@ static void OPB_CheckRealType (INTEGER f, INTEGER nr, OPT_Const x) x->intval = -1; } -static struct MOp__30 { - struct MOp__30 *lnk; -} *MOp__30_s; +static struct MOp__28 { + struct MOp__28 *lnk; +} *MOp__28_s; -static OPT_Node NewOp__31 (SHORTINT op, OPT_Struct typ, OPT_Node z); +static OPT_Node NewOp__29 (SHORTINT op, OPT_Struct typ, OPT_Node z); -static OPT_Node NewOp__31 (SHORTINT op, OPT_Struct typ, OPT_Node z) +static OPT_Node NewOp__29 (SHORTINT op, OPT_Struct typ, OPT_Node z) { OPT_Node _o_result; OPT_Node node = NIL; @@ -596,9 +544,9 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) INTEGER f; OPT_Struct typ = NIL; OPT_Node z = NIL; - struct MOp__30 _s; - _s.lnk = MOp__30_s; - MOp__30_s = &_s; + struct MOp__28 _s; + _s.lnk = MOp__28_s; + MOp__28_s = &_s; z = *x; if (z->class == 8 || z->class == 9) { OPB_err(126); @@ -612,7 +560,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = OPB_BoolToInt(!OPB_IntToBool(z->conval->intval)); z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(98); @@ -640,7 +588,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(97); @@ -661,7 +609,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(111); @@ -673,7 +621,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = (int)__CAP((CHAR)z->conval->intval); z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(111); @@ -686,7 +634,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = OPB_BoolToInt(__ODD(z->conval->intval)); z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(111); @@ -699,7 +647,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) f = 10; } if (z->class < 7 || f == 10) { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } else { OPB_err(127); } @@ -708,7 +656,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) case 25: if ((__IN(f, 0x70) && z->class == 7)) { if ((0 <= z->conval->intval && z->conval->intval <= -1)) { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } else { OPB_err(219); } @@ -725,7 +673,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } } *x = z; - MOp__30_s = _s.lnk; + MOp__28_s = _s.lnk; } static void OPB_CheckPtr (OPT_Node x, OPT_Node y) @@ -921,7 +869,7 @@ static void OPB_ConstOp (INTEGER op, OPT_Node x, OPT_Node y) if (x->typ->size <= y->typ->size) { x->typ = y->typ; } else { - x->typ = OPB_IntType(x->typ->size); + x->typ = OPT_IntType(x->typ->size); } } else if (g == 7) { x->typ = OPT_realtyp; @@ -1178,7 +1126,7 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) if (__IN(g, 0x70)) { if (f > g) { OPB_SetIntType(*x); - if ((int)(*x)->typ->form > g) { + if ((*x)->typ->size > typ->size) { OPB_err(203); (*x)->conval->intval = 1; } @@ -1219,15 +1167,15 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) (*x)->typ = typ; } -static struct Op__40 { +static struct Op__38 { INTEGER *f, *g; - struct Op__40 *lnk; -} *Op__40_s; + struct Op__38 *lnk; +} *Op__38_s; -static void NewOp__41 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y); -static BOOLEAN strings__43 (OPT_Node *x, OPT_Node *y); +static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y); +static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y); -static void NewOp__41 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) +static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) { OPT_Node node = NIL; node = OPT_NewNode(12); @@ -1238,29 +1186,29 @@ static void NewOp__41 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) *x = node; } -static BOOLEAN strings__43 (OPT_Node *x, OPT_Node *y) +static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y) { BOOLEAN _o_result; BOOLEAN ok, xCharArr, yCharArr; - xCharArr = (__IN((*x)->typ->comp, 0x0c) && (*x)->typ->BaseTyp->form == 3) || *Op__40_s->f == 10; - yCharArr = (__IN((*y)->typ->comp, 0x0c) && (*y)->typ->BaseTyp->form == 3) || *Op__40_s->g == 10; - if ((((xCharArr && *Op__40_s->g == 3)) && (*y)->class == 7)) { + xCharArr = (__IN((*x)->typ->comp, 0x0c) && (*x)->typ->BaseTyp->form == 3) || *Op__38_s->f == 10; + yCharArr = (__IN((*y)->typ->comp, 0x0c) && (*y)->typ->BaseTyp->form == 3) || *Op__38_s->g == 10; + if ((((xCharArr && *Op__38_s->g == 3)) && (*y)->class == 7)) { OPB_CharToString(*y); - *Op__40_s->g = 10; + *Op__38_s->g = 10; yCharArr = 1; } - if ((((yCharArr && *Op__40_s->f == 3)) && (*x)->class == 7)) { + if ((((yCharArr && *Op__38_s->f == 3)) && (*x)->class == 7)) { OPB_CharToString(*x); - *Op__40_s->f = 10; + *Op__38_s->f = 10; xCharArr = 1; } ok = (xCharArr && yCharArr); if (ok) { - if ((*Op__40_s->f == 10 && (*x)->conval->intval2 == 1)) { + if ((*Op__38_s->f == 10 && (*x)->conval->intval2 == 1)) { (*x)->typ = OPT_chartyp; (*x)->conval->intval = 0; OPB_Index(&*y, OPB_NewIntConst(((LONGINT)(0)))); - } else if ((*Op__40_s->g == 10 && (*y)->conval->intval2 == 1)) { + } else if ((*Op__38_s->g == 10 && (*y)->conval->intval2 == 1)) { (*y)->typ = OPT_chartyp; (*y)->conval->intval = 0; OPB_Index(&*x, OPB_NewIntConst(((LONGINT)(0)))); @@ -1277,11 +1225,11 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPT_Struct typ = NIL; BOOLEAN do_; LONGINT val; - struct Op__40 _s; + struct Op__38 _s; _s.f = &f; _s.g = &g; - _s.lnk = Op__40_s; - Op__40_s = &_s; + _s.lnk = Op__38_s; + Op__38_s = &_s; z = *x; if (((z->class == 8 || z->class == 9) || y->class == 8) || y->class == 9) { OPB_err(126); @@ -1393,7 +1341,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if (do_) { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } break; case 2: @@ -1412,7 +1360,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(102); typ = OPT_undftyp; } - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); break; case 3: do_ = 1; @@ -1435,7 +1383,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if (do_) { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } break; case 4: @@ -1453,7 +1401,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(104); typ = OPT_undftyp; } - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); break; case 5: if (f == 2) { @@ -1463,7 +1411,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } else if ((y->class == 7 && OPB_IntToBool(y->conval->intval))) { } else { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } } else if (f != 0) { OPB_err(94); @@ -1486,7 +1434,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } if (do_) { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } break; case 7: @@ -1495,7 +1443,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if ((!__IN(f, 0x70) || y->class != 7) || y->conval->intval != 0) { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } break; case 8: @@ -1506,7 +1454,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } else if ((y->class == 7 && !OPB_IntToBool(y->conval->intval))) { } else { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } } else if (f != 0) { OPB_err(95); @@ -1514,16 +1462,16 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } break; case 9: case 10: - if (__IN(f, 0x6bff) || strings__43(&z, &y)) { + if (__IN(f, 0x6bff) || strings__41(&z, &y)) { typ = OPT_booltyp; } else { OPB_err(107); typ = OPT_undftyp; } - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); break; case 11: case 12: case 13: case 14: - if (__IN(f, 0x01f9) || strings__43(&z, &y)) { + if (__IN(f, 0x01f9) || strings__41(&z, &y)) { typ = OPT_booltyp; } else { OPM_LogWLn(); @@ -1532,7 +1480,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(108); typ = OPT_undftyp; } - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); break; default: OPM_LogWStr((CHAR*)"unhandled case in OPB.Op, op = ", (LONGINT)32); @@ -1542,7 +1490,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } *x = z; - Op__40_s = _s.lnk; + Op__38_s = _s.lnk; } void OPB_SetRange (OPT_Node *x, OPT_Node y) @@ -1894,8 +1842,13 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) case 10: if (x->class == 8 || x->class == 9) { OPB_err(126); - } else if ((__IN(f, 0x70) && x->typ->size > (int)OPM_SIntSize)) { - OPB_Convert(&x, OPB_IntType(OPB_ShorterSize(x->typ->size))); + } else if (__IN(f, 0x70)) { + typ = OPT_ShorterOrLongerType(x->typ, -1); + if (typ == NIL) { + OPB_err(111); + } else { + OPB_Convert(&x, typ); + } } else if (f == 8) { OPB_Convert(&x, OPT_realtyp); } else { @@ -1905,8 +1858,13 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) case 11: if (x->class == 8 || x->class == 9) { OPB_err(126); - } else if ((__IN(f, 0x70) && x->typ->size < (int)OPM_LIntSize)) { - OPB_Convert(&x, OPB_IntType(OPB_LongerSize(x->typ->size))); + } else if (__IN(f, 0x70)) { + typ = OPT_ShorterOrLongerType(x->typ, 1); + if (typ == NIL) { + OPB_err(111); + } else { + OPB_Convert(&x, typ); + } } else if (f == 7) { OPB_Convert(&x, OPT_lrltyp); } else if (f == 3) { @@ -2043,13 +2001,13 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) *par0 = x; } -static struct StPar1__56 { - struct StPar1__56 *lnk; -} *StPar1__56_s; +static struct StPar1__52 { + struct StPar1__52 *lnk; +} *StPar1__52_s; -static OPT_Node NewOp__57 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right); +static OPT_Node NewOp__53 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right); -static OPT_Node NewOp__57 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right) +static OPT_Node NewOp__53 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right) { OPT_Node _o_result; OPT_Node node = NIL; @@ -2066,9 +2024,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) INTEGER f, L; OPT_Struct typ = NIL; OPT_Node p = NIL, t = NIL; - struct StPar1__56 _s; - _s.lnk = StPar1__56_s; - StPar1__56_s = &_s; + struct StPar1__52 _s; + _s.lnk = StPar1__52_s; + StPar1__52_s = &_s; p = *par0; f = x->typ->form; switch (fctno) { @@ -2084,7 +2042,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) OPB_err(111); } } - p = NewOp__57(19, fctno, p, x); + p = NewOp__53(19, fctno, p, x); p->typ = OPT_notyp; } break; @@ -2095,7 +2053,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (int)OPM_MaxSet))) { OPB_err(202); } - p = NewOp__57(19, fctno, p, x); + p = NewOp__53(19, fctno, p, x); } else { OPB_err(111); } @@ -2120,7 +2078,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) p = p->left; x->conval->intval += 1; } - p = NewOp__57(12, 19, p, x); + p = NewOp__53(12, 19, p, x); p->typ = OPT_linttyp; } else { p = x; @@ -2142,7 +2100,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) t = x; x = p; p = t; - p = NewOp__57(19, 18, p, x); + p = NewOp__53(19, 18, p, x); } else { OPB_err(111); } @@ -2168,7 +2126,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) } p->obj = NIL; } else { - p = NewOp__57(12, 17, p, x); + p = NewOp__53(12, 17, p, x); p->typ = OPT_linttyp; } } else { @@ -2199,9 +2157,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) OPB_err(111); } else { if (fctno == 22) { - p = NewOp__57(12, 27, p, x); + p = NewOp__53(12, 27, p, x); } else { - p = NewOp__57(12, 28, p, x); + p = NewOp__53(12, 28, p, x); } p->typ = p->left->typ; } @@ -2218,7 +2176,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) x = p; p = t; } - p = NewOp__57(19, fctno, p, x); + p = NewOp__53(19, fctno, p, x); } else { OPB_err(111); } @@ -2228,7 +2186,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) if (x->class == 8 || x->class == 9) { OPB_err(126); } else if (__IN(f, 0x70)) { - p = NewOp__57(12, 26, p, x); + p = NewOp__53(12, 26, p, x); } else { OPB_err(111); } @@ -2252,7 +2210,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) if (x->class == 8 || x->class == 9) { OPB_err(126); } else if (__IN(f, 0x70)) { - p = NewOp__57(19, 30, p, x); + p = NewOp__53(19, 30, p, x); } else { OPB_err(111); } @@ -2298,7 +2256,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) break; } *par0 = p; - StPar1__56_s = _s.lnk; + StPar1__52_s = _s.lnk; } void OPB_StParN (OPT_Node *par0, OPT_Node x, INTEGER fctno, INTEGER n) diff --git a/bootstrap/unix-48/OPB.h b/bootstrap/unix-48/OPB.h index e7a96131..81b3745b 100644 --- a/bootstrap/unix-48/OPB.h +++ b/bootstrap/unix-48/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/unix-48/OPC.c b/bootstrap/unix-48/OPC.c index 02a24b4d..8a3a54cf 100644 --- a/bootstrap/unix-48/OPC.c +++ b/bootstrap/unix-48/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "OPM.h" diff --git a/bootstrap/unix-48/OPC.h b/bootstrap/unix-48/OPC.h index 7aea7283..dcd53d63 100644 --- a/bootstrap/unix-48/OPC.h +++ b/bootstrap/unix-48/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/unix-48/OPM.c b/bootstrap/unix-48/OPM.c index 88c3bd4d..65ebb8b0 100644 --- a/bootstrap/unix-48/OPM.c +++ b/bootstrap/unix-48/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "Console.h" diff --git a/bootstrap/unix-48/OPM.h b/bootstrap/unix-48/OPM.h index 3c2be746..a61c632e 100644 --- a/bootstrap/unix-48/OPM.h +++ b/bootstrap/unix-48/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPM__h #define OPM__h diff --git a/bootstrap/unix-48/OPP.c b/bootstrap/unix-48/OPP.c index a0c19958..5620c5ec 100644 --- a/bootstrap/unix-48/OPP.c +++ b/bootstrap/unix-48/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPB.h" #include "OPM.h" @@ -24,7 +24,7 @@ export LONGINT *OPP__1__typ; static void OPP_ActualParameters (OPT_Node *aparlist, OPT_Object fpar); static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned); static void OPP_Block (OPT_Node *procdec, OPT_Node *statseq); -static void OPP_CaseLabelList (OPT_Node *lab, INTEGER LabelForm, INTEGER *n, OPP_CaseTable tab); +static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, INTEGER *n, OPP_CaseTable tab); static void OPP_CheckMark (SHORTINT *vis); static void OPP_CheckSym (INTEGER s); static void OPP_CheckSysFlag (INTEGER *sysflag, INTEGER default_); @@ -1163,7 +1163,7 @@ static void OPP_ProcedureDeclaration (OPT_Node *x) ProcedureDeclaration__16_s = _s.lnk; } -static void OPP_CaseLabelList (OPT_Node *lab, INTEGER LabelForm, INTEGER *n, OPP_CaseTable tab) +static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, INTEGER *n, OPP_CaseTable tab) { OPT_Node x = NIL, y = NIL, lastlab = NIL; INTEGER i, f; @@ -1180,10 +1180,10 @@ static void OPP_CaseLabelList (OPT_Node *lab, INTEGER LabelForm, INTEGER *n, OPP xval = 1; } if (__IN(f, 0x70)) { - if (LabelForm < f) { + if (!__IN(LabelTyp->form, 0x70) || LabelTyp->size < x->typ->size) { OPP_err(60); } - } else if (LabelForm != f) { + } else if ((int)LabelTyp->form != f) { OPP_err(60); } if (OPP_sym == 21) { @@ -1262,7 +1262,7 @@ static void CasePart__31 (OPT_Node *x) n = 0; for (;;) { if (OPP_sym < 40) { - OPP_CaseLabelList(&lab, (*x)->typ->form, &n, tab); + OPP_CaseLabelList(&lab, (*x)->typ, &n, tab); OPP_CheckSym(20); OPP_StatSeq(&y); OPB_Construct(17, &lab, y); @@ -1471,7 +1471,7 @@ static void OPP_StatSeq (OPT_Node *stat) SetPos__35(z); OPB_Link(&*stat, &last, z); y = OPB_NewLeaf(t); - } else if (y->typ->form < 4 || y->typ->form > x->left->typ->form) { + } else if (!__IN(y->typ->form, 0x70) || y->typ->size > x->left->typ->size) { OPP_err(113); } OPB_Link(&*stat, &last, x); diff --git a/bootstrap/unix-48/OPP.h b/bootstrap/unix-48/OPP.h index 6c24817c..be6b6252 100644 --- a/bootstrap/unix-48/OPP.h +++ b/bootstrap/unix-48/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/unix-48/OPS.c b/bootstrap/unix-48/OPS.c index 85c8b275..1f721944 100644 --- a/bootstrap/unix-48/OPS.c +++ b/bootstrap/unix-48/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tspkaSfF */ #include "SYSTEM.h" #include "OPM.h" diff --git a/bootstrap/unix-48/OPS.h b/bootstrap/unix-48/OPS.h index 313c0ac7..ecd93034 100644 --- a/bootstrap/unix-48/OPS.h +++ b/bootstrap/unix-48/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tspkaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/unix-48/OPT.c b/bootstrap/unix-48/OPT.c index cbd147e6..8efa4803 100644 --- a/bootstrap/unix-48/OPT.c +++ b/bootstrap/unix-48/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPM.h" #include "OPS.h" @@ -84,11 +84,11 @@ typedef export void (*OPT_typSize)(OPT_Struct); export OPT_Object OPT_topScope; export OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_ainttyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp; -static OPT_Object OPT_LIntObj; export SHORTINT OPT_nofGmod; export OPT_Object OPT_GlbMod[64]; export OPS_Name OPT_SelfName; export BOOLEAN OPT_SYSimported; +static OPT_Struct OPT_IntTypes[20]; static OPT_Object OPT_universe, OPT_syslink; static OPT_ImpCtxt OPT_impCtxt; static OPT_ExpCtxt OPT_expCtxt; @@ -106,7 +106,6 @@ export void OPT_Close (void); export void OPT_CloseScope (void); static void OPT_DebugStruct (OPT_Struct btyp); static void OPT_EnterBoolConst (OPS_Name name, LONGINT value); -static void OPT_EnterDerivedType (OPS_Name name, OPT_Struct typ, OPT_Object *obj); static void OPT_EnterProc (OPS_Name name, INTEGER num); static void OPT_EnterTyp (OPS_Name name, SHORTINT form, INTEGER size, OPT_Struct *res); export void OPT_Export (BOOLEAN *ext, BOOLEAN *new); @@ -128,10 +127,12 @@ static OPT_Object OPT_InObj (SHORTINT mno); static void OPT_InSign (SHORTINT mno, OPT_Struct *res, OPT_Object *par); static void OPT_InStruct (OPT_Struct *typ); static OPT_Object OPT_InTProc (SHORTINT mno); +static OPT_Struct OPT_InTyp (LONGINT tag); export void OPT_Init (OPS_Name name, SET opt); static void OPT_InitStruct (OPT_Struct *typ, SHORTINT form); export void OPT_Insert (OPS_Name name, OPT_Object *obj); export void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old); +export OPT_Struct OPT_IntType (LONGINT size); export OPT_Const OPT_NewConst (void); export OPT_ConstExt OPT_NewExt (void); export OPT_Node OPT_NewNode (SHORTINT class); @@ -147,6 +148,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_ShorterOrLongerType (OPT_Struct x, INTEGER dir); static void OPT_err (INTEGER n); @@ -155,6 +157,34 @@ static void OPT_err (INTEGER n) OPM_err(n); } +OPT_Struct OPT_IntType (LONGINT size) +{ + OPT_Struct _o_result; + INTEGER i; + i = 1; + while ((OPT_IntTypes[__X(i, ((LONGINT)(20)))]->size < size && OPT_IntTypes[__X(i + 1, ((LONGINT)(20)))] != NIL)) { + i += 1; + } + _o_result = OPT_IntTypes[__X(i, ((LONGINT)(20)))]; + return _o_result; +} + +OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, INTEGER dir) +{ + OPT_Struct _o_result; + INTEGER i; + __ASSERT(__IN(x->form, 0x70), 0); + __ASSERT(dir == 1 || dir == -1, 0); + __ASSERT(x->BaseTyp == OPT_undftyp, 0); + i = 0; + while ((OPT_IntTypes[__X(i, ((LONGINT)(20)))] != x && i < 20)) { + i += 1; + } + __ASSERT(i < 19, 0); + _o_result = OPT_IntTypes[__X(i + dir, ((LONGINT)(20)))]; + return _o_result; +} + OPT_Const OPT_NewConst (void) { OPT_Const _o_result; @@ -467,21 +497,21 @@ void OPT_IdFPrint (OPT_Struct typ) } } -static struct FPrintStr__13 { +static struct FPrintStr__12 { LONGINT *pbfp, *pvfp; - struct FPrintStr__13 *lnk; -} *FPrintStr__13_s; + struct FPrintStr__12 *lnk; +} *FPrintStr__12_s; -static void FPrintFlds__14 (OPT_Object fld, LONGINT adr, BOOLEAN visible); -static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, LONGINT adr); -static void FPrintTProcs__18 (OPT_Object obj); +static void FPrintFlds__13 (OPT_Object fld, LONGINT adr, BOOLEAN visible); +static void FPrintHdFld__15 (OPT_Struct typ, OPT_Object fld, LONGINT adr); +static void FPrintTProcs__17 (OPT_Object obj); -static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, LONGINT adr) +static void FPrintHdFld__15 (OPT_Struct typ, OPT_Object fld, LONGINT adr) { LONGINT i, j, n; OPT_Struct btyp = NIL; if (typ->comp == 4) { - FPrintFlds__14(typ->link, adr, 0); + FPrintFlds__13(typ->link, adr, 0); } else if (typ->comp == 2) { btyp = typ->BaseTyp; n = typ->n; @@ -491,53 +521,53 @@ static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, LONGINT adr) } if (btyp->form == 13 || btyp->comp == 4) { j = OPT_nofhdfld; - FPrintHdFld__16(btyp, fld, adr); + FPrintHdFld__15(btyp, fld, adr); if (j != OPT_nofhdfld) { i = 1; while ((i < n && OPT_nofhdfld <= 2048)) { adr += btyp->size; - FPrintHdFld__16(btyp, fld, adr); + FPrintHdFld__15(btyp, fld, adr); i += 1; } } } } else if (typ->form == 13 || __STRCMP(fld->name, "@ptr") == 0) { - OPM_FPrint(&*FPrintStr__13_s->pvfp, ((LONGINT)(13))); - OPM_FPrint(&*FPrintStr__13_s->pvfp, adr); + OPM_FPrint(&*FPrintStr__12_s->pvfp, ((LONGINT)(13))); + OPM_FPrint(&*FPrintStr__12_s->pvfp, adr); OPT_nofhdfld += 1; } } -static void FPrintFlds__14 (OPT_Object fld, LONGINT adr, BOOLEAN visible) +static void FPrintFlds__13 (OPT_Object fld, LONGINT adr, BOOLEAN visible) { while ((fld != NIL && fld->mode == 4)) { if ((fld->vis != 0 && visible)) { - OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->vis); - OPT_FPrintName(&*FPrintStr__13_s->pbfp, (void*)fld->name, ((LONGINT)(256))); - OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->adr); + OPM_FPrint(&*FPrintStr__12_s->pbfp, fld->vis); + OPT_FPrintName(&*FPrintStr__12_s->pbfp, (void*)fld->name, ((LONGINT)(256))); + OPM_FPrint(&*FPrintStr__12_s->pbfp, fld->adr); OPT_FPrintStr(fld->typ); - OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->typ->pbfp); - OPM_FPrint(&*FPrintStr__13_s->pvfp, fld->typ->pvfp); + OPM_FPrint(&*FPrintStr__12_s->pbfp, fld->typ->pbfp); + OPM_FPrint(&*FPrintStr__12_s->pvfp, fld->typ->pvfp); } else { - FPrintHdFld__16(fld->typ, fld, fld->adr + adr); + FPrintHdFld__15(fld->typ, fld, fld->adr + adr); } fld = fld->link; } } -static void FPrintTProcs__18 (OPT_Object obj) +static void FPrintTProcs__17 (OPT_Object obj) { if (obj != NIL) { - FPrintTProcs__18(obj->left); + FPrintTProcs__17(obj->left); if (obj->mode == 13) { if (obj->vis != 0) { - OPM_FPrint(&*FPrintStr__13_s->pbfp, ((LONGINT)(13))); - OPM_FPrint(&*FPrintStr__13_s->pbfp, __ASHR(obj->adr, 16)); - OPT_FPrintSign(&*FPrintStr__13_s->pbfp, obj->typ, obj->link); - OPT_FPrintName(&*FPrintStr__13_s->pbfp, (void*)obj->name, ((LONGINT)(256))); + OPM_FPrint(&*FPrintStr__12_s->pbfp, ((LONGINT)(13))); + OPM_FPrint(&*FPrintStr__12_s->pbfp, __ASHR(obj->adr, 16)); + OPT_FPrintSign(&*FPrintStr__12_s->pbfp, obj->typ, obj->link); + OPT_FPrintName(&*FPrintStr__12_s->pbfp, (void*)obj->name, ((LONGINT)(256))); } } - FPrintTProcs__18(obj->right); + FPrintTProcs__17(obj->right); } } @@ -547,11 +577,11 @@ void OPT_FPrintStr (OPT_Struct typ) OPT_Struct btyp = NIL; OPT_Object strobj = NIL, bstrobj = NIL; LONGINT pbfp, pvfp; - struct FPrintStr__13 _s; + struct FPrintStr__12 _s; _s.pbfp = &pbfp; _s.pvfp = &pvfp; - _s.lnk = FPrintStr__13_s; - FPrintStr__13_s = &_s; + _s.lnk = FPrintStr__12_s; + FPrintStr__12_s = &_s; if (!typ->fpdone) { OPT_IdFPrint(typ); pbfp = typ->idfp; @@ -588,11 +618,11 @@ void OPT_FPrintStr (OPT_Struct typ) OPM_FPrint(&pvfp, typ->align); OPM_FPrint(&pvfp, typ->n); OPT_nofhdfld = 0; - FPrintFlds__14(typ->link, ((LONGINT)(0)), 1); + FPrintFlds__13(typ->link, ((LONGINT)(0)), 1); if (OPT_nofhdfld > 2048) { OPM_Mark(225, typ->txtpos); } - FPrintTProcs__18(typ->link); + FPrintTProcs__17(typ->link); OPM_FPrint(&pvfp, pbfp); strobj = typ->strobj; if (strobj == NIL || strobj->name[0] == 0x00) { @@ -602,7 +632,7 @@ void OPT_FPrintStr (OPT_Struct typ) typ->pbfp = pbfp; typ->pvfp = pvfp; } - FPrintStr__13_s = _s.lnk; + FPrintStr__12_s = _s.lnk; } void OPT_FPrintObj (OPT_Object obj) @@ -946,6 +976,19 @@ static OPT_Object OPT_InTProc (SHORTINT mno) return _o_result; } +static OPT_Struct OPT_InTyp (LONGINT tag) +{ + OPT_Struct _o_result; + if (__IN(tag, 0x70)) { + _o_result = OPT_IntType(OPM_SymRInt()); + return _o_result; + } else { + _o_result = OPT_impCtxt.ref[__X(tag, ((LONGINT)(255)))]; + return _o_result; + } + __RETCHK; +} + static void OPT_InStruct (OPT_Struct *typ) { SHORTINT mno; @@ -956,7 +999,7 @@ static void OPT_InStruct (OPT_Struct *typ) OPT_Object obj = NIL, last = NIL, fld = NIL, old = NIL, dummy = NIL; tag = OPM_SymRInt(); if (tag != 34) { - *typ = OPT_impCtxt.ref[__X(-tag, ((LONGINT)(255)))]; + *typ = OPT_InTyp(-tag); } else { ref = OPT_impCtxt.nofr; OPT_impCtxt.nofr += 1; @@ -1081,7 +1124,7 @@ static void OPT_InStruct (OPT_Struct *typ) } if (ref == OPT_impCtxt.minr) { while (ref < OPT_impCtxt.nofr) { - t = OPT_impCtxt.ref[__X(ref, ((LONGINT)(255)))]; + t = OPT_InTyp(ref); OPT_FPrintStr(t); obj = t->strobj; if (obj->name[0] != 0x00) { @@ -1150,9 +1193,9 @@ static OPT_Object OPT_InObj (SHORTINT mno) obj->vis = 1; if (tag <= 13) { obj->mode = 3; - obj->typ = OPT_impCtxt.ref[__X(tag, ((LONGINT)(255)))]; obj->conval = OPT_NewConst(); OPT_InConstant(tag, obj->conval); + obj->typ = OPT_InTyp(tag); } else if (tag >= 31) { obj->conval = OPT_NewConst(); obj->conval->intval = -1; @@ -1396,6 +1439,9 @@ static void OPT_OutStr (OPT_Struct typ) OPT_Object strobj = NIL; if (typ->ref < OPT_expCtxt.ref) { OPM_SymWInt(-typ->ref); + if (__IN(typ->ref, 0x70)) { + OPM_SymWInt(typ->size); + } } else { OPM_SymWInt(((LONGINT)(34))); typ->ref = OPT_expCtxt.ref; @@ -1493,6 +1539,7 @@ static void OPT_OutConstant (OPT_Object obj) break; case 4: case 5: case 6: OPM_SymWInt(obj->conval->intval); + OPM_SymWInt(obj->typ->size); break; case 9: OPM_SymWSet(obj->conval->setval); @@ -1699,15 +1746,6 @@ static void OPT_EnterTyp (OPS_Name name, SHORTINT form, INTEGER size, OPT_Struct *res = typ; } -static void OPT_EnterDerivedType (OPS_Name name, OPT_Struct typ, OPT_Object *obj) -{ - OPS_Name name__copy; - __DUPARR(name, OPS_Name); - OPT_Insert(name, &*obj); - (*obj)->mode = 5; - (*obj)->typ = typ; -} - static void OPT_EnterProc (OPS_Name name, INTEGER num) { OPT_Object obj = NIL; @@ -1741,8 +1779,8 @@ static void EnumPtrs(void (*P)(void*)) P(OPT_niltyp); P(OPT_notyp); P(OPT_sysptrtyp); - P(OPT_LIntObj); __ENUMP(OPT_GlbMod, 64, P); + __ENUMP(OPT_IntTypes, 20, P); P(OPT_universe); P(OPT_syslink); __ENUMR(&OPT_impCtxt, OPT_ImpCtxt__typ, 3140, 1, P); @@ -1811,7 +1849,7 @@ export void *OPT__init(void) OPT_InitStruct(&OPT_niltyp, 11); OPT_EnterTyp((CHAR*)"BYTE", 1, OPM_ByteSize, &OPT_bytetyp); OPT_EnterTyp((CHAR*)"PTR", 13, OPM_PointerSize, &OPT_sysptrtyp); - OPT_EnterTyp((CHAR*)"ADRINT", 5, OPM_LIntSize, &OPT_ainttyp); + OPT_EnterTyp((CHAR*)"ADRINT", 5, OPM_PointerSize, &OPT_ainttyp); OPT_EnterTyp((CHAR*)"INT8", 5, 1, &OPT_int8typ); OPT_EnterTyp((CHAR*)"INT16", 5, 2, &OPT_int16typ); OPT_EnterTyp((CHAR*)"INT32", 5, 4, &OPT_int32typ); @@ -1839,7 +1877,6 @@ export void *OPT__init(void) OPT_EnterTyp((CHAR*)"LONGINT", 6, OPM_LIntSize, &OPT_linttyp); OPT_EnterTyp((CHAR*)"LONGREAL", 8, OPM_LRealSize, &OPT_lrltyp); OPT_EnterTyp((CHAR*)"SHORTINT", 4, OPM_SIntSize, &OPT_sinttyp); - OPT_EnterDerivedType((CHAR*)"LINT", OPT_int64typ, &OPT_LIntObj); OPT_EnterBoolConst((CHAR*)"FALSE", ((LONGINT)(0))); OPT_EnterBoolConst((CHAR*)"TRUE", ((LONGINT)(1))); OPT_EnterProc((CHAR*)"HALT", 0); @@ -1877,5 +1914,12 @@ export void *OPT__init(void) OPT_impCtxt.ref[11] = OPT_niltyp; OPT_impCtxt.ref[12] = OPT_notyp; OPT_impCtxt.ref[13] = OPT_sysptrtyp; + OPT_IntTypes[1] = OPT_sinttyp; + OPT_IntTypes[2] = OPT_inttyp; + OPT_IntTypes[3] = OPT_linttyp; + OPT_IntTypes[5] = OPT_int8typ; + OPT_IntTypes[6] = OPT_int16typ; + OPT_IntTypes[7] = OPT_int32typ; + OPT_IntTypes[8] = OPT_int64typ; __ENDMOD; } diff --git a/bootstrap/unix-48/OPT.h b/bootstrap/unix-48/OPT.h index c4975398..f6206e42 100644 --- a/bootstrap/unix-48/OPT.h +++ b/bootstrap/unix-48/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPT__h #define OPT__h @@ -92,12 +92,14 @@ import void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done); import void OPT_Init (OPS_Name name, SET opt); import void OPT_Insert (OPS_Name name, OPT_Object *obj); import void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old); +import OPT_Struct OPT_IntType (LONGINT size); import OPT_Const OPT_NewConst (void); import OPT_ConstExt OPT_NewExt (void); import OPT_Node OPT_NewNode (SHORTINT class); import OPT_Object OPT_NewObj (void); import OPT_Struct OPT_NewStr (SHORTINT form, SHORTINT comp); import void OPT_OpenScope (SHORTINT level, OPT_Object owner); +import OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, INTEGER dir); import void *OPT__init(void); diff --git a/bootstrap/unix-48/OPV.c b/bootstrap/unix-48/OPV.c index 2172dee5..03b675a9 100644 --- a/bootstrap/unix-48/OPV.c +++ b/bootstrap/unix-48/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPC.h" #include "OPM.h" diff --git a/bootstrap/unix-48/OPV.h b/bootstrap/unix-48/OPV.h index 122fda4a..6926d6ac 100644 --- a/bootstrap/unix-48/OPV.h +++ b/bootstrap/unix-48/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/unix-48/Platform.c b/bootstrap/unix-48/Platform.c index 6326549f..9e1c6dfd 100644 --- a/bootstrap/unix-48/Platform.c +++ b/bootstrap/unix-48/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" typedef diff --git a/bootstrap/unix-48/Platform.h b/bootstrap/unix-48/Platform.h index 77a9b68f..b890523b 100644 --- a/bootstrap/unix-48/Platform.h +++ b/bootstrap/unix-48/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/unix-48/Reals.c b/bootstrap/unix-48/Reals.c index 11c99924..4ee29f7d 100644 --- a/bootstrap/unix-48/Reals.c +++ b/bootstrap/unix-48/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" diff --git a/bootstrap/unix-48/Reals.h b/bootstrap/unix-48/Reals.h index b0497a9c..0a81ebf4 100644 --- a/bootstrap/unix-48/Reals.h +++ b/bootstrap/unix-48/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/unix-48/SYSTEM.h b/bootstrap/unix-48/SYSTEM.h index 35620b9b..343404a4 100644 --- a/bootstrap/unix-48/SYSTEM.h +++ b/bootstrap/unix-48/SYSTEM.h @@ -60,12 +60,6 @@ typedef float REAL; typedef double LONGREAL; typedef void* SYSTEM_PTR; -// Unsigned variants are for use by shift and rotate macros. - -typedef unsigned char U_SYSTEM_BYTE; -typedef unsigned char U_CHAR; -typedef unsigned char U_SHORTINT; - // For 32 bit builds, the size of LONGINT depends on a make option: #if (__SIZEOF_POINTER__ == 8) || defined(LARGE) || defined(_WIN64) @@ -80,9 +74,20 @@ typedef unsigned char U_SHORTINT; typedef unsigned long U_LONGINT; #endif +// Unsigned variants are for use by shift and rotate macros. + +typedef unsigned char U_SYSTEM_BYTE; +typedef unsigned char U_CHAR; +typedef unsigned char U_SHORTINT; + typedef U_LONGINT SET; typedef U_LONGINT U_SET; +typedef SYSTEM_CARD8 U_SYSTEM_INT8; +typedef SYSTEM_CARD16 U_SYSTEM_INT16; +typedef SYSTEM_CARD32 U_SYSTEM_INT32; +typedef SYSTEM_CARD64 U_SYSTEM_INT64; + // OS Memory allocation interfaces are in PlatformXXX.Mod @@ -178,7 +183,7 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __ABSFD(x) SYSTEM_ABSD((double)(x)) #define __CAP(ch) ((CHAR)((ch)&0x5f)) #define __ODD(x) ((x)&1) -#define __IN(x, s) (((s)>>(x))&1) +#define __IN(x, s) ((x)>=0 && (x)<(8*sizeof(SET)) && ((((U_SET)(s))>>(x))&1)) #define __SETOF(x) ((SET)1<<(x)) #define __SETRNG(l, h) ((~(SET)0<<(l))&~(SET)0>>(8*sizeof(SET)-1-(h))) #define __MASK(x, m) ((x)&~(m)) diff --git a/bootstrap/unix-48/Strings.c b/bootstrap/unix-48/Strings.c index 15aeff29..0c372b8b 100644 --- a/bootstrap/unix-48/Strings.c +++ b/bootstrap/unix-48/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" diff --git a/bootstrap/unix-48/Strings.h b/bootstrap/unix-48/Strings.h index 385096bc..0dbfdb8e 100644 --- a/bootstrap/unix-48/Strings.h +++ b/bootstrap/unix-48/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/unix-48/Texts.c b/bootstrap/unix-48/Texts.c index f7a3fdd3..c40f0930 100644 --- a/bootstrap/unix-48/Texts.c +++ b/bootstrap/unix-48/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Files.h" #include "Modules.h" diff --git a/bootstrap/unix-48/Texts.h b/bootstrap/unix-48/Texts.h index d178499a..99931953 100644 --- a/bootstrap/unix-48/Texts.h +++ b/bootstrap/unix-48/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/unix-48/Vishap.c b/bootstrap/unix-48/Vishap.c index 66a97f5d..e8b1e4d1 100644 --- a/bootstrap/unix-48/Vishap.c +++ b/bootstrap/unix-48/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkamSf */ #include "SYSTEM.h" #include "Configuration.h" #include "Heap.h" diff --git a/bootstrap/unix-48/errors.c b/bootstrap/unix-48/errors.c index 59b8db27..a8573f9a 100644 --- a/bootstrap/unix-48/errors.c +++ b/bootstrap/unix-48/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" typedef diff --git a/bootstrap/unix-48/errors.h b/bootstrap/unix-48/errors.h index 6ae0cd7a..6dfe7b1d 100644 --- a/bootstrap/unix-48/errors.h +++ b/bootstrap/unix-48/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/unix-48/extTools.c b/bootstrap/unix-48/extTools.c index 2ef65e7b..d2141803 100644 --- a/bootstrap/unix-48/extTools.c +++ b/bootstrap/unix-48/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "Console.h" diff --git a/bootstrap/unix-48/extTools.h b/bootstrap/unix-48/extTools.h index 39837586..38d2da7b 100644 --- a/bootstrap/unix-48/extTools.h +++ b/bootstrap/unix-48/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/unix-48/vt100.c b/bootstrap/unix-48/vt100.c index e0edabd9..5eb4f70e 100644 --- a/bootstrap/unix-48/vt100.c +++ b/bootstrap/unix-48/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Console.h" #include "Strings.h" diff --git a/bootstrap/unix-48/vt100.h b/bootstrap/unix-48/vt100.h index 413ae867..770cf66d 100644 --- a/bootstrap/unix-48/vt100.h +++ b/bootstrap/unix-48/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef vt100__h #define vt100__h diff --git a/bootstrap/unix-88/Configuration.c b/bootstrap/unix-88/Configuration.c index 8539a1e2..166df1dc 100644 --- a/bootstrap/unix-88/Configuration.c +++ b/bootstrap/unix-88/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" @@ -14,6 +14,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("1.95 [2016/08/26] for gcc LP64 on cygwin", Configuration_versionLong, 41); + __MOVE("1.95 [2016/08/30] for gcc LP64 on cygwin", Configuration_versionLong, 41); __ENDMOD; } diff --git a/bootstrap/unix-88/Configuration.h b/bootstrap/unix-88/Configuration.h index b091f1f7..e30e1366 100644 --- a/bootstrap/unix-88/Configuration.h +++ b/bootstrap/unix-88/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/unix-88/Console.c b/bootstrap/unix-88/Console.c index 6cd166ef..70e9a7e2 100644 --- a/bootstrap/unix-88/Console.c +++ b/bootstrap/unix-88/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Platform.h" diff --git a/bootstrap/unix-88/Console.h b/bootstrap/unix-88/Console.h index a0813c94..6c86c19c 100644 --- a/bootstrap/unix-88/Console.h +++ b/bootstrap/unix-88/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/unix-88/Files.c b/bootstrap/unix-88/Files.c index 86914f24..3a575916 100644 --- a/bootstrap/unix-88/Files.c +++ b/bootstrap/unix-88/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Configuration.h" diff --git a/bootstrap/unix-88/Files.h b/bootstrap/unix-88/Files.h index 8bcec40e..4135c1d4 100644 --- a/bootstrap/unix-88/Files.h +++ b/bootstrap/unix-88/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tspkaSfF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/unix-88/Heap.c b/bootstrap/unix-88/Heap.c index d3529141..1eb56133 100644 --- a/bootstrap/unix-88/Heap.c +++ b/bootstrap/unix-88/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tskSfF */ #define LARGE #include "SYSTEM.h" diff --git a/bootstrap/unix-88/Heap.h b/bootstrap/unix-88/Heap.h index 7827d119..7e4094a1 100644 --- a/bootstrap/unix-88/Heap.h +++ b/bootstrap/unix-88/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tskSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/unix-88/Modules.c b/bootstrap/unix-88/Modules.c index e006bde8..51f3204d 100644 --- a/bootstrap/unix-88/Modules.c +++ b/bootstrap/unix-88/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Console.h" diff --git a/bootstrap/unix-88/Modules.h b/bootstrap/unix-88/Modules.h index 9a0517b5..8431e4a2 100644 --- a/bootstrap/unix-88/Modules.h +++ b/bootstrap/unix-88/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/unix-88/OPB.c b/bootstrap/unix-88/OPB.c index cb07c606..ce3f00ec 100644 --- a/bootstrap/unix-88/OPB.c +++ b/bootstrap/unix-88/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPM.h" @@ -35,9 +35,7 @@ export void OPB_In (OPT_Node *x, OPT_Node y); export void OPB_Index (OPT_Node *x, OPT_Node y); export void OPB_Inittd (OPT_Node *inittd, OPT_Node *last, OPT_Struct typ); static BOOLEAN OPB_IntToBool (LONGINT i); -static OPT_Struct OPB_IntType (LONGINT size); export void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y); -static LONGINT OPB_LongerSize (LONGINT i); export void OPB_MOp (SHORTINT op, OPT_Node *x); export OPT_Node OPB_NewBoolConst (BOOLEAN boolval); export OPT_Node OPB_NewIntConst (LONGINT intval); @@ -54,8 +52,6 @@ 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 LONGINT OPB_ShorterSize (LONGINT i); -static INTEGER OPB_SignedByteSize (LONGINT n); export void OPB_StFct (OPT_Node *par0, SHORTINT fctno, INTEGER parno); export void OPB_StPar0 (OPT_Node *par0, INTEGER fctno); export void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno); @@ -225,68 +221,20 @@ OPT_Node OPB_EmptySet (void) return _o_result; } -static INTEGER OPB_SignedByteSize (LONGINT n) +static void OPB_SetIntType (OPT_Node node) { - INTEGER _o_result; INTEGER b; - if (n < 0) { - n = -(n + 1); + LONGINT n; + if (node->conval->intval >= 0) { + n = node->conval->intval; + } else { + n = -(node->conval->intval + 1); } b = 1; while ((b < 8 && __ASH(n, -(__ASHL(b, 3) - 1)) != 0)) { b += 1; } - _o_result = b; - return _o_result; -} - -static LONGINT OPB_ShorterSize (LONGINT i) -{ - LONGINT _o_result; - if (i >= (SYSTEM_INT64)OPM_LIntSize) { - _o_result = OPM_IntSize; - return _o_result; - } else { - _o_result = OPM_SIntSize; - return _o_result; - } - __RETCHK; -} - -static LONGINT OPB_LongerSize (LONGINT i) -{ - LONGINT _o_result; - if (i <= (SYSTEM_INT64)OPM_SIntSize) { - _o_result = OPM_IntSize; - return _o_result; - } else { - _o_result = OPM_LIntSize; - return _o_result; - } - __RETCHK; -} - -static OPT_Struct OPB_IntType (LONGINT size) -{ - OPT_Struct _o_result; - OPT_Struct result = NIL; - if (size <= OPT_sinttyp->size) { - result = OPT_sinttyp; - } else if (size <= OPT_inttyp->size) { - result = OPT_inttyp; - } else { - result = OPT_linttyp; - } - if (size > OPT_linttyp->size) { - OPB_err(203); - } - _o_result = result; - return _o_result; -} - -static void OPB_SetIntType (OPT_Node node) -{ - node->typ = OPB_IntType(OPB_SignedByteSize(node->conval->intval)); + node->typ = OPT_IntType(b); } OPT_Node OPB_NewIntConst (LONGINT intval) @@ -430,16 +378,16 @@ void OPB_Field (OPT_Node *x, OPT_Object y) } } -static struct TypTest__61 { +static struct TypTest__57 { OPT_Node *x; OPT_Object *obj; BOOLEAN *guard; - struct TypTest__61 *lnk; -} *TypTest__61_s; + struct TypTest__57 *lnk; +} *TypTest__57_s; -static void GTT__62 (OPT_Struct t0, OPT_Struct t1); +static void GTT__58 (OPT_Struct t0, OPT_Struct t1); -static void GTT__62 (OPT_Struct t0, OPT_Struct t1) +static void GTT__58 (OPT_Struct t0, OPT_Struct t1) { OPT_Node node = NIL; OPT_Struct t = NIL; @@ -452,54 +400,54 @@ static void GTT__62 (OPT_Struct t0, OPT_Struct t1) t1 = t1->BaseTyp; } if (t1 == t0 || t0->form == 0) { - if (*TypTest__61_s->guard) { - OPB_BindNodes(5, NIL, &*TypTest__61_s->x, NIL); - (*TypTest__61_s->x)->readonly = (*TypTest__61_s->x)->left->readonly; + 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; } else { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__61_s->x; - node->obj = *TypTest__61_s->obj; - *TypTest__61_s->x = node; + node->left = *TypTest__57_s->x; + node->obj = *TypTest__57_s->obj; + *TypTest__57_s->x = node; } } else { OPB_err(85); } } else if (t0 != t1) { OPB_err(85); - } else if (!*TypTest__61_s->guard) { - if ((*TypTest__61_s->x)->class == 5) { + } else if (!*TypTest__57_s->guard) { + if ((*TypTest__57_s->x)->class == 5) { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__61_s->x; - node->obj = *TypTest__61_s->obj; - *TypTest__61_s->x = node; + node->left = *TypTest__57_s->x; + node->obj = *TypTest__57_s->obj; + *TypTest__57_s->x = node; } else { - *TypTest__61_s->x = OPB_NewBoolConst(1); + *TypTest__57_s->x = OPB_NewBoolConst(1); } } } void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) { - struct TypTest__61 _s; + struct TypTest__57 _s; _s.x = x; _s.obj = &obj; _s.guard = &guard; - _s.lnk = TypTest__61_s; - TypTest__61_s = &_s; + _s.lnk = TypTest__57_s; + TypTest__57_s = &_s; if (OPB_NotVar(*x)) { OPB_err(112); } else if ((*x)->typ->form == 13) { if (((*x)->typ->BaseTyp->comp != 4 && (*x)->typ != OPT_sysptrtyp)) { OPB_err(85); } else if (obj->typ->form == 13) { - GTT__62((*x)->typ->BaseTyp, obj->typ->BaseTyp); + GTT__58((*x)->typ->BaseTyp, obj->typ->BaseTyp); } else { OPB_err(86); } } else if (((((*x)->typ->comp == 4 && (*x)->class == 1)) && obj->typ->comp == 4)) { - GTT__62((*x)->typ, obj->typ); + GTT__58((*x)->typ, obj->typ); } else { OPB_err(87); } @@ -508,7 +456,7 @@ void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) } else { (*x)->typ = OPT_booltyp; } - TypTest__61_s = _s.lnk; + TypTest__57_s = _s.lnk; } void OPB_In (OPT_Node *x, OPT_Node y) @@ -574,13 +522,13 @@ static void OPB_CheckRealType (INTEGER f, INTEGER nr, OPT_Const x) x->intval = -1; } -static struct MOp__30 { - struct MOp__30 *lnk; -} *MOp__30_s; +static struct MOp__28 { + struct MOp__28 *lnk; +} *MOp__28_s; -static OPT_Node NewOp__31 (SHORTINT op, OPT_Struct typ, OPT_Node z); +static OPT_Node NewOp__29 (SHORTINT op, OPT_Struct typ, OPT_Node z); -static OPT_Node NewOp__31 (SHORTINT op, OPT_Struct typ, OPT_Node z) +static OPT_Node NewOp__29 (SHORTINT op, OPT_Struct typ, OPT_Node z) { OPT_Node _o_result; OPT_Node node = NIL; @@ -597,9 +545,9 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) INTEGER f; OPT_Struct typ = NIL; OPT_Node z = NIL; - struct MOp__30 _s; - _s.lnk = MOp__30_s; - MOp__30_s = &_s; + struct MOp__28 _s; + _s.lnk = MOp__28_s; + MOp__28_s = &_s; z = *x; if (z->class == 8 || z->class == 9) { OPB_err(126); @@ -613,7 +561,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = OPB_BoolToInt(!OPB_IntToBool(z->conval->intval)); z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(98); @@ -641,7 +589,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(97); @@ -662,7 +610,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(111); @@ -674,7 +622,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = (int)__CAP((CHAR)z->conval->intval); z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(111); @@ -687,7 +635,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = OPB_BoolToInt(__ODD(z->conval->intval)); z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(111); @@ -700,7 +648,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) f = 10; } if (z->class < 7 || f == 10) { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } else { OPB_err(127); } @@ -709,7 +657,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) case 25: if ((__IN(f, 0x70) && z->class == 7)) { if ((0 <= z->conval->intval && z->conval->intval <= -1)) { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } else { OPB_err(219); } @@ -726,7 +674,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } } *x = z; - MOp__30_s = _s.lnk; + MOp__28_s = _s.lnk; } static void OPB_CheckPtr (OPT_Node x, OPT_Node y) @@ -922,7 +870,7 @@ static void OPB_ConstOp (INTEGER op, OPT_Node x, OPT_Node y) if (x->typ->size <= y->typ->size) { x->typ = y->typ; } else { - x->typ = OPB_IntType(x->typ->size); + x->typ = OPT_IntType(x->typ->size); } } else if (g == 7) { x->typ = OPT_realtyp; @@ -1179,7 +1127,7 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) if (__IN(g, 0x70)) { if (f > g) { OPB_SetIntType(*x); - if ((int)(*x)->typ->form > g) { + if ((*x)->typ->size > typ->size) { OPB_err(203); (*x)->conval->intval = 1; } @@ -1220,15 +1168,15 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) (*x)->typ = typ; } -static struct Op__40 { +static struct Op__38 { INTEGER *f, *g; - struct Op__40 *lnk; -} *Op__40_s; + struct Op__38 *lnk; +} *Op__38_s; -static void NewOp__41 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y); -static BOOLEAN strings__43 (OPT_Node *x, OPT_Node *y); +static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y); +static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y); -static void NewOp__41 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) +static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) { OPT_Node node = NIL; node = OPT_NewNode(12); @@ -1239,29 +1187,29 @@ static void NewOp__41 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) *x = node; } -static BOOLEAN strings__43 (OPT_Node *x, OPT_Node *y) +static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y) { BOOLEAN _o_result; BOOLEAN ok, xCharArr, yCharArr; - xCharArr = (__IN((*x)->typ->comp, 0x0c) && (*x)->typ->BaseTyp->form == 3) || *Op__40_s->f == 10; - yCharArr = (__IN((*y)->typ->comp, 0x0c) && (*y)->typ->BaseTyp->form == 3) || *Op__40_s->g == 10; - if ((((xCharArr && *Op__40_s->g == 3)) && (*y)->class == 7)) { + xCharArr = (__IN((*x)->typ->comp, 0x0c) && (*x)->typ->BaseTyp->form == 3) || *Op__38_s->f == 10; + yCharArr = (__IN((*y)->typ->comp, 0x0c) && (*y)->typ->BaseTyp->form == 3) || *Op__38_s->g == 10; + if ((((xCharArr && *Op__38_s->g == 3)) && (*y)->class == 7)) { OPB_CharToString(*y); - *Op__40_s->g = 10; + *Op__38_s->g = 10; yCharArr = 1; } - if ((((yCharArr && *Op__40_s->f == 3)) && (*x)->class == 7)) { + if ((((yCharArr && *Op__38_s->f == 3)) && (*x)->class == 7)) { OPB_CharToString(*x); - *Op__40_s->f = 10; + *Op__38_s->f = 10; xCharArr = 1; } ok = (xCharArr && yCharArr); if (ok) { - if ((*Op__40_s->f == 10 && (*x)->conval->intval2 == 1)) { + if ((*Op__38_s->f == 10 && (*x)->conval->intval2 == 1)) { (*x)->typ = OPT_chartyp; (*x)->conval->intval = 0; OPB_Index(&*y, OPB_NewIntConst(((LONGINT)(0)))); - } else if ((*Op__40_s->g == 10 && (*y)->conval->intval2 == 1)) { + } else if ((*Op__38_s->g == 10 && (*y)->conval->intval2 == 1)) { (*y)->typ = OPT_chartyp; (*y)->conval->intval = 0; OPB_Index(&*x, OPB_NewIntConst(((LONGINT)(0)))); @@ -1278,11 +1226,11 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPT_Struct typ = NIL; BOOLEAN do_; LONGINT val; - struct Op__40 _s; + struct Op__38 _s; _s.f = &f; _s.g = &g; - _s.lnk = Op__40_s; - Op__40_s = &_s; + _s.lnk = Op__38_s; + Op__38_s = &_s; z = *x; if (((z->class == 8 || z->class == 9) || y->class == 8) || y->class == 9) { OPB_err(126); @@ -1394,7 +1342,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if (do_) { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } break; case 2: @@ -1413,7 +1361,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(102); typ = OPT_undftyp; } - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); break; case 3: do_ = 1; @@ -1436,7 +1384,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if (do_) { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } break; case 4: @@ -1454,7 +1402,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(104); typ = OPT_undftyp; } - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); break; case 5: if (f == 2) { @@ -1464,7 +1412,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } else if ((y->class == 7 && OPB_IntToBool(y->conval->intval))) { } else { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } } else if (f != 0) { OPB_err(94); @@ -1487,7 +1435,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } if (do_) { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } break; case 7: @@ -1496,7 +1444,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if ((!__IN(f, 0x70) || y->class != 7) || y->conval->intval != 0) { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } break; case 8: @@ -1507,7 +1455,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } else if ((y->class == 7 && !OPB_IntToBool(y->conval->intval))) { } else { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } } else if (f != 0) { OPB_err(95); @@ -1515,16 +1463,16 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } break; case 9: case 10: - if (__IN(f, 0x6bff) || strings__43(&z, &y)) { + if (__IN(f, 0x6bff) || strings__41(&z, &y)) { typ = OPT_booltyp; } else { OPB_err(107); typ = OPT_undftyp; } - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); break; case 11: case 12: case 13: case 14: - if (__IN(f, 0x01f9) || strings__43(&z, &y)) { + if (__IN(f, 0x01f9) || strings__41(&z, &y)) { typ = OPT_booltyp; } else { OPM_LogWLn(); @@ -1533,7 +1481,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(108); typ = OPT_undftyp; } - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); break; default: OPM_LogWStr((CHAR*)"unhandled case in OPB.Op, op = ", (LONGINT)32); @@ -1543,7 +1491,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } *x = z; - Op__40_s = _s.lnk; + Op__38_s = _s.lnk; } void OPB_SetRange (OPT_Node *x, OPT_Node y) @@ -1895,8 +1843,13 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) case 10: if (x->class == 8 || x->class == 9) { OPB_err(126); - } else if ((__IN(f, 0x70) && x->typ->size > (SYSTEM_INT64)OPM_SIntSize)) { - OPB_Convert(&x, OPB_IntType(OPB_ShorterSize(x->typ->size))); + } else if (__IN(f, 0x70)) { + typ = OPT_ShorterOrLongerType(x->typ, -1); + if (typ == NIL) { + OPB_err(111); + } else { + OPB_Convert(&x, typ); + } } else if (f == 8) { OPB_Convert(&x, OPT_realtyp); } else { @@ -1906,8 +1859,13 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) case 11: if (x->class == 8 || x->class == 9) { OPB_err(126); - } else if ((__IN(f, 0x70) && x->typ->size < (SYSTEM_INT64)OPM_LIntSize)) { - OPB_Convert(&x, OPB_IntType(OPB_LongerSize(x->typ->size))); + } else if (__IN(f, 0x70)) { + typ = OPT_ShorterOrLongerType(x->typ, 1); + if (typ == NIL) { + OPB_err(111); + } else { + OPB_Convert(&x, typ); + } } else if (f == 7) { OPB_Convert(&x, OPT_lrltyp); } else if (f == 3) { @@ -2044,13 +2002,13 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) *par0 = x; } -static struct StPar1__56 { - struct StPar1__56 *lnk; -} *StPar1__56_s; +static struct StPar1__52 { + struct StPar1__52 *lnk; +} *StPar1__52_s; -static OPT_Node NewOp__57 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right); +static OPT_Node NewOp__53 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right); -static OPT_Node NewOp__57 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right) +static OPT_Node NewOp__53 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right) { OPT_Node _o_result; OPT_Node node = NIL; @@ -2067,9 +2025,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) INTEGER f, L; OPT_Struct typ = NIL; OPT_Node p = NIL, t = NIL; - struct StPar1__56 _s; - _s.lnk = StPar1__56_s; - StPar1__56_s = &_s; + struct StPar1__52 _s; + _s.lnk = StPar1__52_s; + StPar1__52_s = &_s; p = *par0; f = x->typ->form; switch (fctno) { @@ -2085,7 +2043,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) OPB_err(111); } } - p = NewOp__57(19, fctno, p, x); + p = NewOp__53(19, fctno, p, x); p->typ = OPT_notyp; } break; @@ -2096,7 +2054,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (SYSTEM_INT64)OPM_MaxSet))) { OPB_err(202); } - p = NewOp__57(19, fctno, p, x); + p = NewOp__53(19, fctno, p, x); } else { OPB_err(111); } @@ -2121,7 +2079,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) p = p->left; x->conval->intval += 1; } - p = NewOp__57(12, 19, p, x); + p = NewOp__53(12, 19, p, x); p->typ = OPT_linttyp; } else { p = x; @@ -2143,7 +2101,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) t = x; x = p; p = t; - p = NewOp__57(19, 18, p, x); + p = NewOp__53(19, 18, p, x); } else { OPB_err(111); } @@ -2169,7 +2127,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) } p->obj = NIL; } else { - p = NewOp__57(12, 17, p, x); + p = NewOp__53(12, 17, p, x); p->typ = OPT_linttyp; } } else { @@ -2200,9 +2158,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) OPB_err(111); } else { if (fctno == 22) { - p = NewOp__57(12, 27, p, x); + p = NewOp__53(12, 27, p, x); } else { - p = NewOp__57(12, 28, p, x); + p = NewOp__53(12, 28, p, x); } p->typ = p->left->typ; } @@ -2219,7 +2177,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) x = p; p = t; } - p = NewOp__57(19, fctno, p, x); + p = NewOp__53(19, fctno, p, x); } else { OPB_err(111); } @@ -2229,7 +2187,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) if (x->class == 8 || x->class == 9) { OPB_err(126); } else if (__IN(f, 0x70)) { - p = NewOp__57(12, 26, p, x); + p = NewOp__53(12, 26, p, x); } else { OPB_err(111); } @@ -2253,7 +2211,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) if (x->class == 8 || x->class == 9) { OPB_err(126); } else if (__IN(f, 0x70)) { - p = NewOp__57(19, 30, p, x); + p = NewOp__53(19, 30, p, x); } else { OPB_err(111); } @@ -2299,7 +2257,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) break; } *par0 = p; - StPar1__56_s = _s.lnk; + StPar1__52_s = _s.lnk; } void OPB_StParN (OPT_Node *par0, OPT_Node x, INTEGER fctno, INTEGER n) diff --git a/bootstrap/unix-88/OPB.h b/bootstrap/unix-88/OPB.h index f2056569..ccef7627 100644 --- a/bootstrap/unix-88/OPB.h +++ b/bootstrap/unix-88/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/unix-88/OPC.c b/bootstrap/unix-88/OPC.c index 0813dca9..a5276b17 100644 --- a/bootstrap/unix-88/OPC.c +++ b/bootstrap/unix-88/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Configuration.h" diff --git a/bootstrap/unix-88/OPC.h b/bootstrap/unix-88/OPC.h index aa92d405..de932c60 100644 --- a/bootstrap/unix-88/OPC.h +++ b/bootstrap/unix-88/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/unix-88/OPM.c b/bootstrap/unix-88/OPM.c index 3bc1b6d2..0e43a013 100644 --- a/bootstrap/unix-88/OPM.c +++ b/bootstrap/unix-88/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Configuration.h" diff --git a/bootstrap/unix-88/OPM.h b/bootstrap/unix-88/OPM.h index f11b56ba..e94f0303 100644 --- a/bootstrap/unix-88/OPM.h +++ b/bootstrap/unix-88/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPM__h #define OPM__h diff --git a/bootstrap/unix-88/OPP.c b/bootstrap/unix-88/OPP.c index 3a345c1f..63b71ce5 100644 --- a/bootstrap/unix-88/OPP.c +++ b/bootstrap/unix-88/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPB.h" @@ -25,7 +25,7 @@ export LONGINT *OPP__1__typ; static void OPP_ActualParameters (OPT_Node *aparlist, OPT_Object fpar); static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned); static void OPP_Block (OPT_Node *procdec, OPT_Node *statseq); -static void OPP_CaseLabelList (OPT_Node *lab, INTEGER LabelForm, INTEGER *n, OPP_CaseTable tab); +static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, INTEGER *n, OPP_CaseTable tab); static void OPP_CheckMark (SHORTINT *vis); static void OPP_CheckSym (INTEGER s); static void OPP_CheckSysFlag (INTEGER *sysflag, INTEGER default_); @@ -1164,7 +1164,7 @@ static void OPP_ProcedureDeclaration (OPT_Node *x) ProcedureDeclaration__16_s = _s.lnk; } -static void OPP_CaseLabelList (OPT_Node *lab, INTEGER LabelForm, INTEGER *n, OPP_CaseTable tab) +static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, INTEGER *n, OPP_CaseTable tab) { OPT_Node x = NIL, y = NIL, lastlab = NIL; INTEGER i, f; @@ -1181,10 +1181,10 @@ static void OPP_CaseLabelList (OPT_Node *lab, INTEGER LabelForm, INTEGER *n, OPP xval = 1; } if (__IN(f, 0x70)) { - if (LabelForm < f) { + if (!__IN(LabelTyp->form, 0x70) || LabelTyp->size < x->typ->size) { OPP_err(60); } - } else if (LabelForm != f) { + } else if ((int)LabelTyp->form != f) { OPP_err(60); } if (OPP_sym == 21) { @@ -1263,7 +1263,7 @@ static void CasePart__31 (OPT_Node *x) n = 0; for (;;) { if (OPP_sym < 40) { - OPP_CaseLabelList(&lab, (*x)->typ->form, &n, tab); + OPP_CaseLabelList(&lab, (*x)->typ, &n, tab); OPP_CheckSym(20); OPP_StatSeq(&y); OPB_Construct(17, &lab, y); @@ -1472,7 +1472,7 @@ static void OPP_StatSeq (OPT_Node *stat) SetPos__35(z); OPB_Link(&*stat, &last, z); y = OPB_NewLeaf(t); - } else if (y->typ->form < 4 || y->typ->form > x->left->typ->form) { + } else if (!__IN(y->typ->form, 0x70) || y->typ->size > x->left->typ->size) { OPP_err(113); } OPB_Link(&*stat, &last, x); diff --git a/bootstrap/unix-88/OPP.h b/bootstrap/unix-88/OPP.h index c0c9c3dd..fb0cf655 100644 --- a/bootstrap/unix-88/OPP.h +++ b/bootstrap/unix-88/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/unix-88/OPS.c b/bootstrap/unix-88/OPS.c index 1f9f2a46..e2d48c61 100644 --- a/bootstrap/unix-88/OPS.c +++ b/bootstrap/unix-88/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPM.h" diff --git a/bootstrap/unix-88/OPS.h b/bootstrap/unix-88/OPS.h index 4b760b22..ea28a764 100644 --- a/bootstrap/unix-88/OPS.h +++ b/bootstrap/unix-88/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tspkaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/unix-88/OPT.c b/bootstrap/unix-88/OPT.c index 20234e22..b028d164 100644 --- a/bootstrap/unix-88/OPT.c +++ b/bootstrap/unix-88/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPM.h" @@ -85,11 +85,11 @@ typedef export void (*OPT_typSize)(OPT_Struct); export OPT_Object OPT_topScope; export OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_ainttyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp; -static OPT_Object OPT_LIntObj; export SHORTINT OPT_nofGmod; export OPT_Object OPT_GlbMod[64]; export OPS_Name OPT_SelfName; export BOOLEAN OPT_SYSimported; +static OPT_Struct OPT_IntTypes[20]; static OPT_Object OPT_universe, OPT_syslink; static OPT_ImpCtxt OPT_impCtxt; static OPT_ExpCtxt OPT_expCtxt; @@ -107,7 +107,6 @@ export void OPT_Close (void); export void OPT_CloseScope (void); static void OPT_DebugStruct (OPT_Struct btyp); static void OPT_EnterBoolConst (OPS_Name name, LONGINT value); -static void OPT_EnterDerivedType (OPS_Name name, OPT_Struct typ, OPT_Object *obj); static void OPT_EnterProc (OPS_Name name, INTEGER num); static void OPT_EnterTyp (OPS_Name name, SHORTINT form, INTEGER size, OPT_Struct *res); export void OPT_Export (BOOLEAN *ext, BOOLEAN *new); @@ -129,10 +128,12 @@ static OPT_Object OPT_InObj (SHORTINT mno); static void OPT_InSign (SHORTINT mno, OPT_Struct *res, OPT_Object *par); static void OPT_InStruct (OPT_Struct *typ); static OPT_Object OPT_InTProc (SHORTINT mno); +static OPT_Struct OPT_InTyp (LONGINT tag); export void OPT_Init (OPS_Name name, SET opt); static void OPT_InitStruct (OPT_Struct *typ, SHORTINT form); export void OPT_Insert (OPS_Name name, OPT_Object *obj); export void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old); +export OPT_Struct OPT_IntType (LONGINT size); export OPT_Const OPT_NewConst (void); export OPT_ConstExt OPT_NewExt (void); export OPT_Node OPT_NewNode (SHORTINT class); @@ -148,6 +149,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_ShorterOrLongerType (OPT_Struct x, INTEGER dir); static void OPT_err (INTEGER n); @@ -156,6 +158,34 @@ static void OPT_err (INTEGER n) OPM_err(n); } +OPT_Struct OPT_IntType (LONGINT size) +{ + OPT_Struct _o_result; + INTEGER i; + i = 1; + while ((OPT_IntTypes[__X(i, ((LONGINT)(20)))]->size < size && OPT_IntTypes[__X(i + 1, ((LONGINT)(20)))] != NIL)) { + i += 1; + } + _o_result = OPT_IntTypes[__X(i, ((LONGINT)(20)))]; + return _o_result; +} + +OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, INTEGER dir) +{ + OPT_Struct _o_result; + INTEGER i; + __ASSERT(__IN(x->form, 0x70), 0); + __ASSERT(dir == 1 || dir == -1, 0); + __ASSERT(x->BaseTyp == OPT_undftyp, 0); + i = 0; + while ((OPT_IntTypes[__X(i, ((LONGINT)(20)))] != x && i < 20)) { + i += 1; + } + __ASSERT(i < 19, 0); + _o_result = OPT_IntTypes[__X(i + dir, ((LONGINT)(20)))]; + return _o_result; +} + OPT_Const OPT_NewConst (void) { OPT_Const _o_result; @@ -468,21 +498,21 @@ void OPT_IdFPrint (OPT_Struct typ) } } -static struct FPrintStr__13 { +static struct FPrintStr__12 { LONGINT *pbfp, *pvfp; - struct FPrintStr__13 *lnk; -} *FPrintStr__13_s; + struct FPrintStr__12 *lnk; +} *FPrintStr__12_s; -static void FPrintFlds__14 (OPT_Object fld, LONGINT adr, BOOLEAN visible); -static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, LONGINT adr); -static void FPrintTProcs__18 (OPT_Object obj); +static void FPrintFlds__13 (OPT_Object fld, LONGINT adr, BOOLEAN visible); +static void FPrintHdFld__15 (OPT_Struct typ, OPT_Object fld, LONGINT adr); +static void FPrintTProcs__17 (OPT_Object obj); -static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, LONGINT adr) +static void FPrintHdFld__15 (OPT_Struct typ, OPT_Object fld, LONGINT adr) { LONGINT i, j, n; OPT_Struct btyp = NIL; if (typ->comp == 4) { - FPrintFlds__14(typ->link, adr, 0); + FPrintFlds__13(typ->link, adr, 0); } else if (typ->comp == 2) { btyp = typ->BaseTyp; n = typ->n; @@ -492,53 +522,53 @@ static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, LONGINT adr) } if (btyp->form == 13 || btyp->comp == 4) { j = OPT_nofhdfld; - FPrintHdFld__16(btyp, fld, adr); + FPrintHdFld__15(btyp, fld, adr); if (j != OPT_nofhdfld) { i = 1; while ((i < n && OPT_nofhdfld <= 2048)) { adr += btyp->size; - FPrintHdFld__16(btyp, fld, adr); + FPrintHdFld__15(btyp, fld, adr); i += 1; } } } } else if (typ->form == 13 || __STRCMP(fld->name, "@ptr") == 0) { - OPM_FPrint(&*FPrintStr__13_s->pvfp, ((LONGINT)(13))); - OPM_FPrint(&*FPrintStr__13_s->pvfp, adr); + OPM_FPrint(&*FPrintStr__12_s->pvfp, ((LONGINT)(13))); + OPM_FPrint(&*FPrintStr__12_s->pvfp, adr); OPT_nofhdfld += 1; } } -static void FPrintFlds__14 (OPT_Object fld, LONGINT adr, BOOLEAN visible) +static void FPrintFlds__13 (OPT_Object fld, LONGINT adr, BOOLEAN visible) { while ((fld != NIL && fld->mode == 4)) { if ((fld->vis != 0 && visible)) { - OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->vis); - OPT_FPrintName(&*FPrintStr__13_s->pbfp, (void*)fld->name, ((LONGINT)(256))); - OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->adr); + OPM_FPrint(&*FPrintStr__12_s->pbfp, fld->vis); + OPT_FPrintName(&*FPrintStr__12_s->pbfp, (void*)fld->name, ((LONGINT)(256))); + OPM_FPrint(&*FPrintStr__12_s->pbfp, fld->adr); OPT_FPrintStr(fld->typ); - OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->typ->pbfp); - OPM_FPrint(&*FPrintStr__13_s->pvfp, fld->typ->pvfp); + OPM_FPrint(&*FPrintStr__12_s->pbfp, fld->typ->pbfp); + OPM_FPrint(&*FPrintStr__12_s->pvfp, fld->typ->pvfp); } else { - FPrintHdFld__16(fld->typ, fld, fld->adr + adr); + FPrintHdFld__15(fld->typ, fld, fld->adr + adr); } fld = fld->link; } } -static void FPrintTProcs__18 (OPT_Object obj) +static void FPrintTProcs__17 (OPT_Object obj) { if (obj != NIL) { - FPrintTProcs__18(obj->left); + FPrintTProcs__17(obj->left); if (obj->mode == 13) { if (obj->vis != 0) { - OPM_FPrint(&*FPrintStr__13_s->pbfp, ((LONGINT)(13))); - OPM_FPrint(&*FPrintStr__13_s->pbfp, __ASHR(obj->adr, 16)); - OPT_FPrintSign(&*FPrintStr__13_s->pbfp, obj->typ, obj->link); - OPT_FPrintName(&*FPrintStr__13_s->pbfp, (void*)obj->name, ((LONGINT)(256))); + OPM_FPrint(&*FPrintStr__12_s->pbfp, ((LONGINT)(13))); + OPM_FPrint(&*FPrintStr__12_s->pbfp, __ASHR(obj->adr, 16)); + OPT_FPrintSign(&*FPrintStr__12_s->pbfp, obj->typ, obj->link); + OPT_FPrintName(&*FPrintStr__12_s->pbfp, (void*)obj->name, ((LONGINT)(256))); } } - FPrintTProcs__18(obj->right); + FPrintTProcs__17(obj->right); } } @@ -548,11 +578,11 @@ void OPT_FPrintStr (OPT_Struct typ) OPT_Struct btyp = NIL; OPT_Object strobj = NIL, bstrobj = NIL; LONGINT pbfp, pvfp; - struct FPrintStr__13 _s; + struct FPrintStr__12 _s; _s.pbfp = &pbfp; _s.pvfp = &pvfp; - _s.lnk = FPrintStr__13_s; - FPrintStr__13_s = &_s; + _s.lnk = FPrintStr__12_s; + FPrintStr__12_s = &_s; if (!typ->fpdone) { OPT_IdFPrint(typ); pbfp = typ->idfp; @@ -589,11 +619,11 @@ void OPT_FPrintStr (OPT_Struct typ) OPM_FPrint(&pvfp, typ->align); OPM_FPrint(&pvfp, typ->n); OPT_nofhdfld = 0; - FPrintFlds__14(typ->link, ((LONGINT)(0)), 1); + FPrintFlds__13(typ->link, ((LONGINT)(0)), 1); if (OPT_nofhdfld > 2048) { OPM_Mark(225, typ->txtpos); } - FPrintTProcs__18(typ->link); + FPrintTProcs__17(typ->link); OPM_FPrint(&pvfp, pbfp); strobj = typ->strobj; if (strobj == NIL || strobj->name[0] == 0x00) { @@ -603,7 +633,7 @@ void OPT_FPrintStr (OPT_Struct typ) typ->pbfp = pbfp; typ->pvfp = pvfp; } - FPrintStr__13_s = _s.lnk; + FPrintStr__12_s = _s.lnk; } void OPT_FPrintObj (OPT_Object obj) @@ -947,6 +977,19 @@ static OPT_Object OPT_InTProc (SHORTINT mno) return _o_result; } +static OPT_Struct OPT_InTyp (LONGINT tag) +{ + OPT_Struct _o_result; + if (__IN(tag, 0x70)) { + _o_result = OPT_IntType(OPM_SymRInt()); + return _o_result; + } else { + _o_result = OPT_impCtxt.ref[__X(tag, ((LONGINT)(255)))]; + return _o_result; + } + __RETCHK; +} + static void OPT_InStruct (OPT_Struct *typ) { SHORTINT mno; @@ -957,7 +1000,7 @@ static void OPT_InStruct (OPT_Struct *typ) OPT_Object obj = NIL, last = NIL, fld = NIL, old = NIL, dummy = NIL; tag = OPM_SymRInt(); if (tag != 34) { - *typ = OPT_impCtxt.ref[__X(-tag, ((LONGINT)(255)))]; + *typ = OPT_InTyp(-tag); } else { ref = OPT_impCtxt.nofr; OPT_impCtxt.nofr += 1; @@ -1082,7 +1125,7 @@ static void OPT_InStruct (OPT_Struct *typ) } if (ref == OPT_impCtxt.minr) { while (ref < OPT_impCtxt.nofr) { - t = OPT_impCtxt.ref[__X(ref, ((LONGINT)(255)))]; + t = OPT_InTyp(ref); OPT_FPrintStr(t); obj = t->strobj; if (obj->name[0] != 0x00) { @@ -1151,9 +1194,9 @@ static OPT_Object OPT_InObj (SHORTINT mno) obj->vis = 1; if (tag <= 13) { obj->mode = 3; - obj->typ = OPT_impCtxt.ref[__X(tag, ((LONGINT)(255)))]; obj->conval = OPT_NewConst(); OPT_InConstant(tag, obj->conval); + obj->typ = OPT_InTyp(tag); } else if (tag >= 31) { obj->conval = OPT_NewConst(); obj->conval->intval = -1; @@ -1397,6 +1440,9 @@ static void OPT_OutStr (OPT_Struct typ) OPT_Object strobj = NIL; if (typ->ref < OPT_expCtxt.ref) { OPM_SymWInt(-typ->ref); + if (__IN(typ->ref, 0x70)) { + OPM_SymWInt(typ->size); + } } else { OPM_SymWInt(((LONGINT)(34))); typ->ref = OPT_expCtxt.ref; @@ -1494,6 +1540,7 @@ static void OPT_OutConstant (OPT_Object obj) break; case 4: case 5: case 6: OPM_SymWInt(obj->conval->intval); + OPM_SymWInt(obj->typ->size); break; case 9: OPM_SymWSet(obj->conval->setval); @@ -1700,15 +1747,6 @@ static void OPT_EnterTyp (OPS_Name name, SHORTINT form, INTEGER size, OPT_Struct *res = typ; } -static void OPT_EnterDerivedType (OPS_Name name, OPT_Struct typ, OPT_Object *obj) -{ - OPS_Name name__copy; - __DUPARR(name, OPS_Name); - OPT_Insert(name, &*obj); - (*obj)->mode = 5; - (*obj)->typ = typ; -} - static void OPT_EnterProc (OPS_Name name, INTEGER num) { OPT_Object obj = NIL; @@ -1742,8 +1780,8 @@ static void EnumPtrs(void (*P)(void*)) P(OPT_niltyp); P(OPT_notyp); P(OPT_sysptrtyp); - P(OPT_LIntObj); __ENUMP(OPT_GlbMod, 64, P); + __ENUMP(OPT_IntTypes, 20, P); P(OPT_universe); P(OPT_syslink); __ENUMR(&OPT_impCtxt, OPT_ImpCtxt__typ, 6216, 1, P); @@ -1812,7 +1850,7 @@ export void *OPT__init(void) OPT_InitStruct(&OPT_niltyp, 11); OPT_EnterTyp((CHAR*)"BYTE", 1, OPM_ByteSize, &OPT_bytetyp); OPT_EnterTyp((CHAR*)"PTR", 13, OPM_PointerSize, &OPT_sysptrtyp); - OPT_EnterTyp((CHAR*)"ADRINT", 5, OPM_LIntSize, &OPT_ainttyp); + OPT_EnterTyp((CHAR*)"ADRINT", 5, OPM_PointerSize, &OPT_ainttyp); OPT_EnterTyp((CHAR*)"INT8", 5, 1, &OPT_int8typ); OPT_EnterTyp((CHAR*)"INT16", 5, 2, &OPT_int16typ); OPT_EnterTyp((CHAR*)"INT32", 5, 4, &OPT_int32typ); @@ -1840,7 +1878,6 @@ export void *OPT__init(void) OPT_EnterTyp((CHAR*)"LONGINT", 6, OPM_LIntSize, &OPT_linttyp); OPT_EnterTyp((CHAR*)"LONGREAL", 8, OPM_LRealSize, &OPT_lrltyp); OPT_EnterTyp((CHAR*)"SHORTINT", 4, OPM_SIntSize, &OPT_sinttyp); - OPT_EnterDerivedType((CHAR*)"LINT", OPT_int64typ, &OPT_LIntObj); OPT_EnterBoolConst((CHAR*)"FALSE", ((LONGINT)(0))); OPT_EnterBoolConst((CHAR*)"TRUE", ((LONGINT)(1))); OPT_EnterProc((CHAR*)"HALT", 0); @@ -1878,5 +1915,12 @@ export void *OPT__init(void) OPT_impCtxt.ref[11] = OPT_niltyp; OPT_impCtxt.ref[12] = OPT_notyp; OPT_impCtxt.ref[13] = OPT_sysptrtyp; + OPT_IntTypes[1] = OPT_sinttyp; + OPT_IntTypes[2] = OPT_inttyp; + OPT_IntTypes[3] = OPT_linttyp; + OPT_IntTypes[5] = OPT_int8typ; + OPT_IntTypes[6] = OPT_int16typ; + OPT_IntTypes[7] = OPT_int32typ; + OPT_IntTypes[8] = OPT_int64typ; __ENDMOD; } diff --git a/bootstrap/unix-88/OPT.h b/bootstrap/unix-88/OPT.h index f1865573..9878e30b 100644 --- a/bootstrap/unix-88/OPT.h +++ b/bootstrap/unix-88/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPT__h #define OPT__h @@ -93,12 +93,14 @@ import void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done); import void OPT_Init (OPS_Name name, SET opt); import void OPT_Insert (OPS_Name name, OPT_Object *obj); import void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old); +import OPT_Struct OPT_IntType (LONGINT size); import OPT_Const OPT_NewConst (void); import OPT_ConstExt OPT_NewExt (void); import OPT_Node OPT_NewNode (SHORTINT class); import OPT_Object OPT_NewObj (void); import OPT_Struct OPT_NewStr (SHORTINT form, SHORTINT comp); import void OPT_OpenScope (SHORTINT level, OPT_Object owner); +import OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, INTEGER dir); import void *OPT__init(void); diff --git a/bootstrap/unix-88/OPV.c b/bootstrap/unix-88/OPV.c index 638891f1..f74e0890 100644 --- a/bootstrap/unix-88/OPV.c +++ b/bootstrap/unix-88/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPC.h" diff --git a/bootstrap/unix-88/OPV.h b/bootstrap/unix-88/OPV.h index b0551679..43ab4681 100644 --- a/bootstrap/unix-88/OPV.h +++ b/bootstrap/unix-88/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/unix-88/Platform.c b/bootstrap/unix-88/Platform.c index 7ecd9794..7637b515 100644 --- a/bootstrap/unix-88/Platform.c +++ b/bootstrap/unix-88/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" diff --git a/bootstrap/unix-88/Platform.h b/bootstrap/unix-88/Platform.h index 832aaa35..0fee3539 100644 --- a/bootstrap/unix-88/Platform.h +++ b/bootstrap/unix-88/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/unix-88/Reals.c b/bootstrap/unix-88/Reals.c index 660cd605..a5a93902 100644 --- a/bootstrap/unix-88/Reals.c +++ b/bootstrap/unix-88/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" diff --git a/bootstrap/unix-88/Reals.h b/bootstrap/unix-88/Reals.h index 3102ce18..76bda39d 100644 --- a/bootstrap/unix-88/Reals.h +++ b/bootstrap/unix-88/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/unix-88/SYSTEM.h b/bootstrap/unix-88/SYSTEM.h index 35620b9b..343404a4 100644 --- a/bootstrap/unix-88/SYSTEM.h +++ b/bootstrap/unix-88/SYSTEM.h @@ -60,12 +60,6 @@ typedef float REAL; typedef double LONGREAL; typedef void* SYSTEM_PTR; -// Unsigned variants are for use by shift and rotate macros. - -typedef unsigned char U_SYSTEM_BYTE; -typedef unsigned char U_CHAR; -typedef unsigned char U_SHORTINT; - // For 32 bit builds, the size of LONGINT depends on a make option: #if (__SIZEOF_POINTER__ == 8) || defined(LARGE) || defined(_WIN64) @@ -80,9 +74,20 @@ typedef unsigned char U_SHORTINT; typedef unsigned long U_LONGINT; #endif +// Unsigned variants are for use by shift and rotate macros. + +typedef unsigned char U_SYSTEM_BYTE; +typedef unsigned char U_CHAR; +typedef unsigned char U_SHORTINT; + typedef U_LONGINT SET; typedef U_LONGINT U_SET; +typedef SYSTEM_CARD8 U_SYSTEM_INT8; +typedef SYSTEM_CARD16 U_SYSTEM_INT16; +typedef SYSTEM_CARD32 U_SYSTEM_INT32; +typedef SYSTEM_CARD64 U_SYSTEM_INT64; + // OS Memory allocation interfaces are in PlatformXXX.Mod @@ -178,7 +183,7 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __ABSFD(x) SYSTEM_ABSD((double)(x)) #define __CAP(ch) ((CHAR)((ch)&0x5f)) #define __ODD(x) ((x)&1) -#define __IN(x, s) (((s)>>(x))&1) +#define __IN(x, s) ((x)>=0 && (x)<(8*sizeof(SET)) && ((((U_SET)(s))>>(x))&1)) #define __SETOF(x) ((SET)1<<(x)) #define __SETRNG(l, h) ((~(SET)0<<(l))&~(SET)0>>(8*sizeof(SET)-1-(h))) #define __MASK(x, m) ((x)&~(m)) diff --git a/bootstrap/unix-88/Strings.c b/bootstrap/unix-88/Strings.c index 2df49d25..bd57ef4e 100644 --- a/bootstrap/unix-88/Strings.c +++ b/bootstrap/unix-88/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" diff --git a/bootstrap/unix-88/Strings.h b/bootstrap/unix-88/Strings.h index 9505fe03..aa97eeac 100644 --- a/bootstrap/unix-88/Strings.h +++ b/bootstrap/unix-88/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/unix-88/Texts.c b/bootstrap/unix-88/Texts.c index 0e0b4725..cd9388a6 100644 --- a/bootstrap/unix-88/Texts.c +++ b/bootstrap/unix-88/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Files.h" diff --git a/bootstrap/unix-88/Texts.h b/bootstrap/unix-88/Texts.h index 3086fb00..b591e699 100644 --- a/bootstrap/unix-88/Texts.h +++ b/bootstrap/unix-88/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/unix-88/Vishap.c b/bootstrap/unix-88/Vishap.c index a487fe66..19624204 100644 --- a/bootstrap/unix-88/Vishap.c +++ b/bootstrap/unix-88/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkamSf */ #define LARGE #include "SYSTEM.h" #include "Configuration.h" diff --git a/bootstrap/unix-88/errors.c b/bootstrap/unix-88/errors.c index 8489752b..5493978e 100644 --- a/bootstrap/unix-88/errors.c +++ b/bootstrap/unix-88/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" diff --git a/bootstrap/unix-88/errors.h b/bootstrap/unix-88/errors.h index a5af5a7d..8ce5a106 100644 --- a/bootstrap/unix-88/errors.h +++ b/bootstrap/unix-88/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/unix-88/extTools.c b/bootstrap/unix-88/extTools.c index fce52835..72df4f99 100644 --- a/bootstrap/unix-88/extTools.c +++ b/bootstrap/unix-88/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Configuration.h" diff --git a/bootstrap/unix-88/extTools.h b/bootstrap/unix-88/extTools.h index 9e5aed51..4523936a 100644 --- a/bootstrap/unix-88/extTools.h +++ b/bootstrap/unix-88/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/unix-88/vt100.c b/bootstrap/unix-88/vt100.c index 0e0401e3..efcf43ab 100644 --- a/bootstrap/unix-88/vt100.c +++ b/bootstrap/unix-88/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Console.h" diff --git a/bootstrap/unix-88/vt100.h b/bootstrap/unix-88/vt100.h index eb6374ea..65ae6d58 100644 --- a/bootstrap/unix-88/vt100.h +++ b/bootstrap/unix-88/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef vt100__h #define vt100__h diff --git a/bootstrap/windows-48/Configuration.c b/bootstrap/windows-48/Configuration.c index b0d48f0a..947863a2 100644 --- a/bootstrap/windows-48/Configuration.c +++ b/bootstrap/windows-48/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" @@ -13,6 +13,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("1.95 [2016/08/26] for gcc LP64 on cygwin", Configuration_versionLong, 41); + __MOVE("1.95 [2016/08/30] for gcc LP64 on cygwin", Configuration_versionLong, 41); __ENDMOD; } diff --git a/bootstrap/windows-48/Configuration.h b/bootstrap/windows-48/Configuration.h index 38a63260..33303334 100644 --- a/bootstrap/windows-48/Configuration.h +++ b/bootstrap/windows-48/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/windows-48/Console.c b/bootstrap/windows-48/Console.c index 52a0ced0..3d09ab84 100644 --- a/bootstrap/windows-48/Console.c +++ b/bootstrap/windows-48/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Platform.h" diff --git a/bootstrap/windows-48/Console.h b/bootstrap/windows-48/Console.h index 2c462da9..0e7cb823 100644 --- a/bootstrap/windows-48/Console.h +++ b/bootstrap/windows-48/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/windows-48/Files.c b/bootstrap/windows-48/Files.c index 966fb2ca..5b20dd10 100644 --- a/bootstrap/windows-48/Files.c +++ b/bootstrap/windows-48/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "Console.h" diff --git a/bootstrap/windows-48/Files.h b/bootstrap/windows-48/Files.h index 7e437f34..85814163 100644 --- a/bootstrap/windows-48/Files.h +++ b/bootstrap/windows-48/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tspkaSfF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/windows-48/Heap.c b/bootstrap/windows-48/Heap.c index cca2fc74..5fcaf193 100644 --- a/bootstrap/windows-48/Heap.c +++ b/bootstrap/windows-48/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tskSfF */ #include "SYSTEM.h" struct Heap__1 { diff --git a/bootstrap/windows-48/Heap.h b/bootstrap/windows-48/Heap.h index d05f688c..4247d33d 100644 --- a/bootstrap/windows-48/Heap.h +++ b/bootstrap/windows-48/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tskSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/windows-48/Modules.c b/bootstrap/windows-48/Modules.c index d76a50a2..148c062a 100644 --- a/bootstrap/windows-48/Modules.c +++ b/bootstrap/windows-48/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Console.h" #include "Heap.h" diff --git a/bootstrap/windows-48/Modules.h b/bootstrap/windows-48/Modules.h index 78c8d49e..85b1ec59 100644 --- a/bootstrap/windows-48/Modules.h +++ b/bootstrap/windows-48/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/windows-48/OPB.c b/bootstrap/windows-48/OPB.c index 60b37750..9a06ac24 100644 --- a/bootstrap/windows-48/OPB.c +++ b/bootstrap/windows-48/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPM.h" #include "OPS.h" @@ -34,9 +34,7 @@ export void OPB_In (OPT_Node *x, OPT_Node y); export void OPB_Index (OPT_Node *x, OPT_Node y); export void OPB_Inittd (OPT_Node *inittd, OPT_Node *last, OPT_Struct typ); static BOOLEAN OPB_IntToBool (LONGINT i); -static OPT_Struct OPB_IntType (LONGINT size); export void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y); -static LONGINT OPB_LongerSize (LONGINT i); export void OPB_MOp (SHORTINT op, OPT_Node *x); export OPT_Node OPB_NewBoolConst (BOOLEAN boolval); export OPT_Node OPB_NewIntConst (LONGINT intval); @@ -53,8 +51,6 @@ 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 LONGINT OPB_ShorterSize (LONGINT i); -static INTEGER OPB_SignedByteSize (LONGINT n); export void OPB_StFct (OPT_Node *par0, SHORTINT fctno, INTEGER parno); export void OPB_StPar0 (OPT_Node *par0, INTEGER fctno); export void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno); @@ -224,68 +220,20 @@ OPT_Node OPB_EmptySet (void) return _o_result; } -static INTEGER OPB_SignedByteSize (LONGINT n) +static void OPB_SetIntType (OPT_Node node) { - INTEGER _o_result; INTEGER b; - if (n < 0) { - n = -(n + 1); + LONGINT n; + if (node->conval->intval >= 0) { + n = node->conval->intval; + } else { + n = -(node->conval->intval + 1); } b = 1; while ((b < 8 && __ASH(n, -(__ASHL(b, 3) - 1)) != 0)) { b += 1; } - _o_result = b; - return _o_result; -} - -static LONGINT OPB_ShorterSize (LONGINT i) -{ - LONGINT _o_result; - if (i >= (int)OPM_LIntSize) { - _o_result = OPM_IntSize; - return _o_result; - } else { - _o_result = OPM_SIntSize; - return _o_result; - } - __RETCHK; -} - -static LONGINT OPB_LongerSize (LONGINT i) -{ - LONGINT _o_result; - if (i <= (int)OPM_SIntSize) { - _o_result = OPM_IntSize; - return _o_result; - } else { - _o_result = OPM_LIntSize; - return _o_result; - } - __RETCHK; -} - -static OPT_Struct OPB_IntType (LONGINT size) -{ - OPT_Struct _o_result; - OPT_Struct result = NIL; - if (size <= OPT_sinttyp->size) { - result = OPT_sinttyp; - } else if (size <= OPT_inttyp->size) { - result = OPT_inttyp; - } else { - result = OPT_linttyp; - } - if (size > OPT_linttyp->size) { - OPB_err(203); - } - _o_result = result; - return _o_result; -} - -static void OPB_SetIntType (OPT_Node node) -{ - node->typ = OPB_IntType(OPB_SignedByteSize(node->conval->intval)); + node->typ = OPT_IntType(b); } OPT_Node OPB_NewIntConst (LONGINT intval) @@ -429,16 +377,16 @@ void OPB_Field (OPT_Node *x, OPT_Object y) } } -static struct TypTest__61 { +static struct TypTest__57 { OPT_Node *x; OPT_Object *obj; BOOLEAN *guard; - struct TypTest__61 *lnk; -} *TypTest__61_s; + struct TypTest__57 *lnk; +} *TypTest__57_s; -static void GTT__62 (OPT_Struct t0, OPT_Struct t1); +static void GTT__58 (OPT_Struct t0, OPT_Struct t1); -static void GTT__62 (OPT_Struct t0, OPT_Struct t1) +static void GTT__58 (OPT_Struct t0, OPT_Struct t1) { OPT_Node node = NIL; OPT_Struct t = NIL; @@ -451,54 +399,54 @@ static void GTT__62 (OPT_Struct t0, OPT_Struct t1) t1 = t1->BaseTyp; } if (t1 == t0 || t0->form == 0) { - if (*TypTest__61_s->guard) { - OPB_BindNodes(5, NIL, &*TypTest__61_s->x, NIL); - (*TypTest__61_s->x)->readonly = (*TypTest__61_s->x)->left->readonly; + 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; } else { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__61_s->x; - node->obj = *TypTest__61_s->obj; - *TypTest__61_s->x = node; + node->left = *TypTest__57_s->x; + node->obj = *TypTest__57_s->obj; + *TypTest__57_s->x = node; } } else { OPB_err(85); } } else if (t0 != t1) { OPB_err(85); - } else if (!*TypTest__61_s->guard) { - if ((*TypTest__61_s->x)->class == 5) { + } else if (!*TypTest__57_s->guard) { + if ((*TypTest__57_s->x)->class == 5) { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__61_s->x; - node->obj = *TypTest__61_s->obj; - *TypTest__61_s->x = node; + node->left = *TypTest__57_s->x; + node->obj = *TypTest__57_s->obj; + *TypTest__57_s->x = node; } else { - *TypTest__61_s->x = OPB_NewBoolConst(1); + *TypTest__57_s->x = OPB_NewBoolConst(1); } } } void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) { - struct TypTest__61 _s; + struct TypTest__57 _s; _s.x = x; _s.obj = &obj; _s.guard = &guard; - _s.lnk = TypTest__61_s; - TypTest__61_s = &_s; + _s.lnk = TypTest__57_s; + TypTest__57_s = &_s; if (OPB_NotVar(*x)) { OPB_err(112); } else if ((*x)->typ->form == 13) { if (((*x)->typ->BaseTyp->comp != 4 && (*x)->typ != OPT_sysptrtyp)) { OPB_err(85); } else if (obj->typ->form == 13) { - GTT__62((*x)->typ->BaseTyp, obj->typ->BaseTyp); + GTT__58((*x)->typ->BaseTyp, obj->typ->BaseTyp); } else { OPB_err(86); } } else if (((((*x)->typ->comp == 4 && (*x)->class == 1)) && obj->typ->comp == 4)) { - GTT__62((*x)->typ, obj->typ); + GTT__58((*x)->typ, obj->typ); } else { OPB_err(87); } @@ -507,7 +455,7 @@ void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) } else { (*x)->typ = OPT_booltyp; } - TypTest__61_s = _s.lnk; + TypTest__57_s = _s.lnk; } void OPB_In (OPT_Node *x, OPT_Node y) @@ -573,13 +521,13 @@ static void OPB_CheckRealType (INTEGER f, INTEGER nr, OPT_Const x) x->intval = -1; } -static struct MOp__30 { - struct MOp__30 *lnk; -} *MOp__30_s; +static struct MOp__28 { + struct MOp__28 *lnk; +} *MOp__28_s; -static OPT_Node NewOp__31 (SHORTINT op, OPT_Struct typ, OPT_Node z); +static OPT_Node NewOp__29 (SHORTINT op, OPT_Struct typ, OPT_Node z); -static OPT_Node NewOp__31 (SHORTINT op, OPT_Struct typ, OPT_Node z) +static OPT_Node NewOp__29 (SHORTINT op, OPT_Struct typ, OPT_Node z) { OPT_Node _o_result; OPT_Node node = NIL; @@ -596,9 +544,9 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) INTEGER f; OPT_Struct typ = NIL; OPT_Node z = NIL; - struct MOp__30 _s; - _s.lnk = MOp__30_s; - MOp__30_s = &_s; + struct MOp__28 _s; + _s.lnk = MOp__28_s; + MOp__28_s = &_s; z = *x; if (z->class == 8 || z->class == 9) { OPB_err(126); @@ -612,7 +560,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = OPB_BoolToInt(!OPB_IntToBool(z->conval->intval)); z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(98); @@ -640,7 +588,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(97); @@ -661,7 +609,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(111); @@ -673,7 +621,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = (int)__CAP((CHAR)z->conval->intval); z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(111); @@ -686,7 +634,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = OPB_BoolToInt(__ODD(z->conval->intval)); z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(111); @@ -699,7 +647,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) f = 10; } if (z->class < 7 || f == 10) { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } else { OPB_err(127); } @@ -708,7 +656,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) case 25: if ((__IN(f, 0x70) && z->class == 7)) { if ((0 <= z->conval->intval && z->conval->intval <= -1)) { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } else { OPB_err(219); } @@ -725,7 +673,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } } *x = z; - MOp__30_s = _s.lnk; + MOp__28_s = _s.lnk; } static void OPB_CheckPtr (OPT_Node x, OPT_Node y) @@ -921,7 +869,7 @@ static void OPB_ConstOp (INTEGER op, OPT_Node x, OPT_Node y) if (x->typ->size <= y->typ->size) { x->typ = y->typ; } else { - x->typ = OPB_IntType(x->typ->size); + x->typ = OPT_IntType(x->typ->size); } } else if (g == 7) { x->typ = OPT_realtyp; @@ -1178,7 +1126,7 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) if (__IN(g, 0x70)) { if (f > g) { OPB_SetIntType(*x); - if ((int)(*x)->typ->form > g) { + if ((*x)->typ->size > typ->size) { OPB_err(203); (*x)->conval->intval = 1; } @@ -1219,15 +1167,15 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) (*x)->typ = typ; } -static struct Op__40 { +static struct Op__38 { INTEGER *f, *g; - struct Op__40 *lnk; -} *Op__40_s; + struct Op__38 *lnk; +} *Op__38_s; -static void NewOp__41 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y); -static BOOLEAN strings__43 (OPT_Node *x, OPT_Node *y); +static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y); +static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y); -static void NewOp__41 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) +static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) { OPT_Node node = NIL; node = OPT_NewNode(12); @@ -1238,29 +1186,29 @@ static void NewOp__41 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) *x = node; } -static BOOLEAN strings__43 (OPT_Node *x, OPT_Node *y) +static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y) { BOOLEAN _o_result; BOOLEAN ok, xCharArr, yCharArr; - xCharArr = (__IN((*x)->typ->comp, 0x0c) && (*x)->typ->BaseTyp->form == 3) || *Op__40_s->f == 10; - yCharArr = (__IN((*y)->typ->comp, 0x0c) && (*y)->typ->BaseTyp->form == 3) || *Op__40_s->g == 10; - if ((((xCharArr && *Op__40_s->g == 3)) && (*y)->class == 7)) { + xCharArr = (__IN((*x)->typ->comp, 0x0c) && (*x)->typ->BaseTyp->form == 3) || *Op__38_s->f == 10; + yCharArr = (__IN((*y)->typ->comp, 0x0c) && (*y)->typ->BaseTyp->form == 3) || *Op__38_s->g == 10; + if ((((xCharArr && *Op__38_s->g == 3)) && (*y)->class == 7)) { OPB_CharToString(*y); - *Op__40_s->g = 10; + *Op__38_s->g = 10; yCharArr = 1; } - if ((((yCharArr && *Op__40_s->f == 3)) && (*x)->class == 7)) { + if ((((yCharArr && *Op__38_s->f == 3)) && (*x)->class == 7)) { OPB_CharToString(*x); - *Op__40_s->f = 10; + *Op__38_s->f = 10; xCharArr = 1; } ok = (xCharArr && yCharArr); if (ok) { - if ((*Op__40_s->f == 10 && (*x)->conval->intval2 == 1)) { + if ((*Op__38_s->f == 10 && (*x)->conval->intval2 == 1)) { (*x)->typ = OPT_chartyp; (*x)->conval->intval = 0; OPB_Index(&*y, OPB_NewIntConst(((LONGINT)(0)))); - } else if ((*Op__40_s->g == 10 && (*y)->conval->intval2 == 1)) { + } else if ((*Op__38_s->g == 10 && (*y)->conval->intval2 == 1)) { (*y)->typ = OPT_chartyp; (*y)->conval->intval = 0; OPB_Index(&*x, OPB_NewIntConst(((LONGINT)(0)))); @@ -1277,11 +1225,11 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPT_Struct typ = NIL; BOOLEAN do_; LONGINT val; - struct Op__40 _s; + struct Op__38 _s; _s.f = &f; _s.g = &g; - _s.lnk = Op__40_s; - Op__40_s = &_s; + _s.lnk = Op__38_s; + Op__38_s = &_s; z = *x; if (((z->class == 8 || z->class == 9) || y->class == 8) || y->class == 9) { OPB_err(126); @@ -1393,7 +1341,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if (do_) { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } break; case 2: @@ -1412,7 +1360,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(102); typ = OPT_undftyp; } - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); break; case 3: do_ = 1; @@ -1435,7 +1383,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if (do_) { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } break; case 4: @@ -1453,7 +1401,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(104); typ = OPT_undftyp; } - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); break; case 5: if (f == 2) { @@ -1463,7 +1411,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } else if ((y->class == 7 && OPB_IntToBool(y->conval->intval))) { } else { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } } else if (f != 0) { OPB_err(94); @@ -1486,7 +1434,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } if (do_) { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } break; case 7: @@ -1495,7 +1443,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if ((!__IN(f, 0x70) || y->class != 7) || y->conval->intval != 0) { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } break; case 8: @@ -1506,7 +1454,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } else if ((y->class == 7 && !OPB_IntToBool(y->conval->intval))) { } else { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } } else if (f != 0) { OPB_err(95); @@ -1514,16 +1462,16 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } break; case 9: case 10: - if (__IN(f, 0x6bff) || strings__43(&z, &y)) { + if (__IN(f, 0x6bff) || strings__41(&z, &y)) { typ = OPT_booltyp; } else { OPB_err(107); typ = OPT_undftyp; } - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); break; case 11: case 12: case 13: case 14: - if (__IN(f, 0x01f9) || strings__43(&z, &y)) { + if (__IN(f, 0x01f9) || strings__41(&z, &y)) { typ = OPT_booltyp; } else { OPM_LogWLn(); @@ -1532,7 +1480,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(108); typ = OPT_undftyp; } - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); break; default: OPM_LogWStr((CHAR*)"unhandled case in OPB.Op, op = ", (LONGINT)32); @@ -1542,7 +1490,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } *x = z; - Op__40_s = _s.lnk; + Op__38_s = _s.lnk; } void OPB_SetRange (OPT_Node *x, OPT_Node y) @@ -1894,8 +1842,13 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) case 10: if (x->class == 8 || x->class == 9) { OPB_err(126); - } else if ((__IN(f, 0x70) && x->typ->size > (int)OPM_SIntSize)) { - OPB_Convert(&x, OPB_IntType(OPB_ShorterSize(x->typ->size))); + } else if (__IN(f, 0x70)) { + typ = OPT_ShorterOrLongerType(x->typ, -1); + if (typ == NIL) { + OPB_err(111); + } else { + OPB_Convert(&x, typ); + } } else if (f == 8) { OPB_Convert(&x, OPT_realtyp); } else { @@ -1905,8 +1858,13 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) case 11: if (x->class == 8 || x->class == 9) { OPB_err(126); - } else if ((__IN(f, 0x70) && x->typ->size < (int)OPM_LIntSize)) { - OPB_Convert(&x, OPB_IntType(OPB_LongerSize(x->typ->size))); + } else if (__IN(f, 0x70)) { + typ = OPT_ShorterOrLongerType(x->typ, 1); + if (typ == NIL) { + OPB_err(111); + } else { + OPB_Convert(&x, typ); + } } else if (f == 7) { OPB_Convert(&x, OPT_lrltyp); } else if (f == 3) { @@ -2043,13 +2001,13 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) *par0 = x; } -static struct StPar1__56 { - struct StPar1__56 *lnk; -} *StPar1__56_s; +static struct StPar1__52 { + struct StPar1__52 *lnk; +} *StPar1__52_s; -static OPT_Node NewOp__57 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right); +static OPT_Node NewOp__53 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right); -static OPT_Node NewOp__57 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right) +static OPT_Node NewOp__53 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right) { OPT_Node _o_result; OPT_Node node = NIL; @@ -2066,9 +2024,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) INTEGER f, L; OPT_Struct typ = NIL; OPT_Node p = NIL, t = NIL; - struct StPar1__56 _s; - _s.lnk = StPar1__56_s; - StPar1__56_s = &_s; + struct StPar1__52 _s; + _s.lnk = StPar1__52_s; + StPar1__52_s = &_s; p = *par0; f = x->typ->form; switch (fctno) { @@ -2084,7 +2042,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) OPB_err(111); } } - p = NewOp__57(19, fctno, p, x); + p = NewOp__53(19, fctno, p, x); p->typ = OPT_notyp; } break; @@ -2095,7 +2053,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (int)OPM_MaxSet))) { OPB_err(202); } - p = NewOp__57(19, fctno, p, x); + p = NewOp__53(19, fctno, p, x); } else { OPB_err(111); } @@ -2120,7 +2078,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) p = p->left; x->conval->intval += 1; } - p = NewOp__57(12, 19, p, x); + p = NewOp__53(12, 19, p, x); p->typ = OPT_linttyp; } else { p = x; @@ -2142,7 +2100,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) t = x; x = p; p = t; - p = NewOp__57(19, 18, p, x); + p = NewOp__53(19, 18, p, x); } else { OPB_err(111); } @@ -2168,7 +2126,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) } p->obj = NIL; } else { - p = NewOp__57(12, 17, p, x); + p = NewOp__53(12, 17, p, x); p->typ = OPT_linttyp; } } else { @@ -2199,9 +2157,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) OPB_err(111); } else { if (fctno == 22) { - p = NewOp__57(12, 27, p, x); + p = NewOp__53(12, 27, p, x); } else { - p = NewOp__57(12, 28, p, x); + p = NewOp__53(12, 28, p, x); } p->typ = p->left->typ; } @@ -2218,7 +2176,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) x = p; p = t; } - p = NewOp__57(19, fctno, p, x); + p = NewOp__53(19, fctno, p, x); } else { OPB_err(111); } @@ -2228,7 +2186,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) if (x->class == 8 || x->class == 9) { OPB_err(126); } else if (__IN(f, 0x70)) { - p = NewOp__57(12, 26, p, x); + p = NewOp__53(12, 26, p, x); } else { OPB_err(111); } @@ -2252,7 +2210,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) if (x->class == 8 || x->class == 9) { OPB_err(126); } else if (__IN(f, 0x70)) { - p = NewOp__57(19, 30, p, x); + p = NewOp__53(19, 30, p, x); } else { OPB_err(111); } @@ -2298,7 +2256,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) break; } *par0 = p; - StPar1__56_s = _s.lnk; + StPar1__52_s = _s.lnk; } void OPB_StParN (OPT_Node *par0, OPT_Node x, INTEGER fctno, INTEGER n) diff --git a/bootstrap/windows-48/OPB.h b/bootstrap/windows-48/OPB.h index e7a96131..81b3745b 100644 --- a/bootstrap/windows-48/OPB.h +++ b/bootstrap/windows-48/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/windows-48/OPC.c b/bootstrap/windows-48/OPC.c index 02a24b4d..8a3a54cf 100644 --- a/bootstrap/windows-48/OPC.c +++ b/bootstrap/windows-48/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "OPM.h" diff --git a/bootstrap/windows-48/OPC.h b/bootstrap/windows-48/OPC.h index 7aea7283..dcd53d63 100644 --- a/bootstrap/windows-48/OPC.h +++ b/bootstrap/windows-48/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/windows-48/OPM.c b/bootstrap/windows-48/OPM.c index 88c3bd4d..65ebb8b0 100644 --- a/bootstrap/windows-48/OPM.c +++ b/bootstrap/windows-48/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "Console.h" diff --git a/bootstrap/windows-48/OPM.h b/bootstrap/windows-48/OPM.h index 3c2be746..a61c632e 100644 --- a/bootstrap/windows-48/OPM.h +++ b/bootstrap/windows-48/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPM__h #define OPM__h diff --git a/bootstrap/windows-48/OPP.c b/bootstrap/windows-48/OPP.c index a0c19958..5620c5ec 100644 --- a/bootstrap/windows-48/OPP.c +++ b/bootstrap/windows-48/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPB.h" #include "OPM.h" @@ -24,7 +24,7 @@ export LONGINT *OPP__1__typ; static void OPP_ActualParameters (OPT_Node *aparlist, OPT_Object fpar); static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned); static void OPP_Block (OPT_Node *procdec, OPT_Node *statseq); -static void OPP_CaseLabelList (OPT_Node *lab, INTEGER LabelForm, INTEGER *n, OPP_CaseTable tab); +static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, INTEGER *n, OPP_CaseTable tab); static void OPP_CheckMark (SHORTINT *vis); static void OPP_CheckSym (INTEGER s); static void OPP_CheckSysFlag (INTEGER *sysflag, INTEGER default_); @@ -1163,7 +1163,7 @@ static void OPP_ProcedureDeclaration (OPT_Node *x) ProcedureDeclaration__16_s = _s.lnk; } -static void OPP_CaseLabelList (OPT_Node *lab, INTEGER LabelForm, INTEGER *n, OPP_CaseTable tab) +static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, INTEGER *n, OPP_CaseTable tab) { OPT_Node x = NIL, y = NIL, lastlab = NIL; INTEGER i, f; @@ -1180,10 +1180,10 @@ static void OPP_CaseLabelList (OPT_Node *lab, INTEGER LabelForm, INTEGER *n, OPP xval = 1; } if (__IN(f, 0x70)) { - if (LabelForm < f) { + if (!__IN(LabelTyp->form, 0x70) || LabelTyp->size < x->typ->size) { OPP_err(60); } - } else if (LabelForm != f) { + } else if ((int)LabelTyp->form != f) { OPP_err(60); } if (OPP_sym == 21) { @@ -1262,7 +1262,7 @@ static void CasePart__31 (OPT_Node *x) n = 0; for (;;) { if (OPP_sym < 40) { - OPP_CaseLabelList(&lab, (*x)->typ->form, &n, tab); + OPP_CaseLabelList(&lab, (*x)->typ, &n, tab); OPP_CheckSym(20); OPP_StatSeq(&y); OPB_Construct(17, &lab, y); @@ -1471,7 +1471,7 @@ static void OPP_StatSeq (OPT_Node *stat) SetPos__35(z); OPB_Link(&*stat, &last, z); y = OPB_NewLeaf(t); - } else if (y->typ->form < 4 || y->typ->form > x->left->typ->form) { + } else if (!__IN(y->typ->form, 0x70) || y->typ->size > x->left->typ->size) { OPP_err(113); } OPB_Link(&*stat, &last, x); diff --git a/bootstrap/windows-48/OPP.h b/bootstrap/windows-48/OPP.h index 6c24817c..be6b6252 100644 --- a/bootstrap/windows-48/OPP.h +++ b/bootstrap/windows-48/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/windows-48/OPS.c b/bootstrap/windows-48/OPS.c index 85c8b275..1f721944 100644 --- a/bootstrap/windows-48/OPS.c +++ b/bootstrap/windows-48/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tspkaSfF */ #include "SYSTEM.h" #include "OPM.h" diff --git a/bootstrap/windows-48/OPS.h b/bootstrap/windows-48/OPS.h index 313c0ac7..ecd93034 100644 --- a/bootstrap/windows-48/OPS.h +++ b/bootstrap/windows-48/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tspkaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/windows-48/OPT.c b/bootstrap/windows-48/OPT.c index cbd147e6..8efa4803 100644 --- a/bootstrap/windows-48/OPT.c +++ b/bootstrap/windows-48/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPM.h" #include "OPS.h" @@ -84,11 +84,11 @@ typedef export void (*OPT_typSize)(OPT_Struct); export OPT_Object OPT_topScope; export OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_ainttyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp; -static OPT_Object OPT_LIntObj; export SHORTINT OPT_nofGmod; export OPT_Object OPT_GlbMod[64]; export OPS_Name OPT_SelfName; export BOOLEAN OPT_SYSimported; +static OPT_Struct OPT_IntTypes[20]; static OPT_Object OPT_universe, OPT_syslink; static OPT_ImpCtxt OPT_impCtxt; static OPT_ExpCtxt OPT_expCtxt; @@ -106,7 +106,6 @@ export void OPT_Close (void); export void OPT_CloseScope (void); static void OPT_DebugStruct (OPT_Struct btyp); static void OPT_EnterBoolConst (OPS_Name name, LONGINT value); -static void OPT_EnterDerivedType (OPS_Name name, OPT_Struct typ, OPT_Object *obj); static void OPT_EnterProc (OPS_Name name, INTEGER num); static void OPT_EnterTyp (OPS_Name name, SHORTINT form, INTEGER size, OPT_Struct *res); export void OPT_Export (BOOLEAN *ext, BOOLEAN *new); @@ -128,10 +127,12 @@ static OPT_Object OPT_InObj (SHORTINT mno); static void OPT_InSign (SHORTINT mno, OPT_Struct *res, OPT_Object *par); static void OPT_InStruct (OPT_Struct *typ); static OPT_Object OPT_InTProc (SHORTINT mno); +static OPT_Struct OPT_InTyp (LONGINT tag); export void OPT_Init (OPS_Name name, SET opt); static void OPT_InitStruct (OPT_Struct *typ, SHORTINT form); export void OPT_Insert (OPS_Name name, OPT_Object *obj); export void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old); +export OPT_Struct OPT_IntType (LONGINT size); export OPT_Const OPT_NewConst (void); export OPT_ConstExt OPT_NewExt (void); export OPT_Node OPT_NewNode (SHORTINT class); @@ -147,6 +148,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_ShorterOrLongerType (OPT_Struct x, INTEGER dir); static void OPT_err (INTEGER n); @@ -155,6 +157,34 @@ static void OPT_err (INTEGER n) OPM_err(n); } +OPT_Struct OPT_IntType (LONGINT size) +{ + OPT_Struct _o_result; + INTEGER i; + i = 1; + while ((OPT_IntTypes[__X(i, ((LONGINT)(20)))]->size < size && OPT_IntTypes[__X(i + 1, ((LONGINT)(20)))] != NIL)) { + i += 1; + } + _o_result = OPT_IntTypes[__X(i, ((LONGINT)(20)))]; + return _o_result; +} + +OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, INTEGER dir) +{ + OPT_Struct _o_result; + INTEGER i; + __ASSERT(__IN(x->form, 0x70), 0); + __ASSERT(dir == 1 || dir == -1, 0); + __ASSERT(x->BaseTyp == OPT_undftyp, 0); + i = 0; + while ((OPT_IntTypes[__X(i, ((LONGINT)(20)))] != x && i < 20)) { + i += 1; + } + __ASSERT(i < 19, 0); + _o_result = OPT_IntTypes[__X(i + dir, ((LONGINT)(20)))]; + return _o_result; +} + OPT_Const OPT_NewConst (void) { OPT_Const _o_result; @@ -467,21 +497,21 @@ void OPT_IdFPrint (OPT_Struct typ) } } -static struct FPrintStr__13 { +static struct FPrintStr__12 { LONGINT *pbfp, *pvfp; - struct FPrintStr__13 *lnk; -} *FPrintStr__13_s; + struct FPrintStr__12 *lnk; +} *FPrintStr__12_s; -static void FPrintFlds__14 (OPT_Object fld, LONGINT adr, BOOLEAN visible); -static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, LONGINT adr); -static void FPrintTProcs__18 (OPT_Object obj); +static void FPrintFlds__13 (OPT_Object fld, LONGINT adr, BOOLEAN visible); +static void FPrintHdFld__15 (OPT_Struct typ, OPT_Object fld, LONGINT adr); +static void FPrintTProcs__17 (OPT_Object obj); -static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, LONGINT adr) +static void FPrintHdFld__15 (OPT_Struct typ, OPT_Object fld, LONGINT adr) { LONGINT i, j, n; OPT_Struct btyp = NIL; if (typ->comp == 4) { - FPrintFlds__14(typ->link, adr, 0); + FPrintFlds__13(typ->link, adr, 0); } else if (typ->comp == 2) { btyp = typ->BaseTyp; n = typ->n; @@ -491,53 +521,53 @@ static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, LONGINT adr) } if (btyp->form == 13 || btyp->comp == 4) { j = OPT_nofhdfld; - FPrintHdFld__16(btyp, fld, adr); + FPrintHdFld__15(btyp, fld, adr); if (j != OPT_nofhdfld) { i = 1; while ((i < n && OPT_nofhdfld <= 2048)) { adr += btyp->size; - FPrintHdFld__16(btyp, fld, adr); + FPrintHdFld__15(btyp, fld, adr); i += 1; } } } } else if (typ->form == 13 || __STRCMP(fld->name, "@ptr") == 0) { - OPM_FPrint(&*FPrintStr__13_s->pvfp, ((LONGINT)(13))); - OPM_FPrint(&*FPrintStr__13_s->pvfp, adr); + OPM_FPrint(&*FPrintStr__12_s->pvfp, ((LONGINT)(13))); + OPM_FPrint(&*FPrintStr__12_s->pvfp, adr); OPT_nofhdfld += 1; } } -static void FPrintFlds__14 (OPT_Object fld, LONGINT adr, BOOLEAN visible) +static void FPrintFlds__13 (OPT_Object fld, LONGINT adr, BOOLEAN visible) { while ((fld != NIL && fld->mode == 4)) { if ((fld->vis != 0 && visible)) { - OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->vis); - OPT_FPrintName(&*FPrintStr__13_s->pbfp, (void*)fld->name, ((LONGINT)(256))); - OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->adr); + OPM_FPrint(&*FPrintStr__12_s->pbfp, fld->vis); + OPT_FPrintName(&*FPrintStr__12_s->pbfp, (void*)fld->name, ((LONGINT)(256))); + OPM_FPrint(&*FPrintStr__12_s->pbfp, fld->adr); OPT_FPrintStr(fld->typ); - OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->typ->pbfp); - OPM_FPrint(&*FPrintStr__13_s->pvfp, fld->typ->pvfp); + OPM_FPrint(&*FPrintStr__12_s->pbfp, fld->typ->pbfp); + OPM_FPrint(&*FPrintStr__12_s->pvfp, fld->typ->pvfp); } else { - FPrintHdFld__16(fld->typ, fld, fld->adr + adr); + FPrintHdFld__15(fld->typ, fld, fld->adr + adr); } fld = fld->link; } } -static void FPrintTProcs__18 (OPT_Object obj) +static void FPrintTProcs__17 (OPT_Object obj) { if (obj != NIL) { - FPrintTProcs__18(obj->left); + FPrintTProcs__17(obj->left); if (obj->mode == 13) { if (obj->vis != 0) { - OPM_FPrint(&*FPrintStr__13_s->pbfp, ((LONGINT)(13))); - OPM_FPrint(&*FPrintStr__13_s->pbfp, __ASHR(obj->adr, 16)); - OPT_FPrintSign(&*FPrintStr__13_s->pbfp, obj->typ, obj->link); - OPT_FPrintName(&*FPrintStr__13_s->pbfp, (void*)obj->name, ((LONGINT)(256))); + OPM_FPrint(&*FPrintStr__12_s->pbfp, ((LONGINT)(13))); + OPM_FPrint(&*FPrintStr__12_s->pbfp, __ASHR(obj->adr, 16)); + OPT_FPrintSign(&*FPrintStr__12_s->pbfp, obj->typ, obj->link); + OPT_FPrintName(&*FPrintStr__12_s->pbfp, (void*)obj->name, ((LONGINT)(256))); } } - FPrintTProcs__18(obj->right); + FPrintTProcs__17(obj->right); } } @@ -547,11 +577,11 @@ void OPT_FPrintStr (OPT_Struct typ) OPT_Struct btyp = NIL; OPT_Object strobj = NIL, bstrobj = NIL; LONGINT pbfp, pvfp; - struct FPrintStr__13 _s; + struct FPrintStr__12 _s; _s.pbfp = &pbfp; _s.pvfp = &pvfp; - _s.lnk = FPrintStr__13_s; - FPrintStr__13_s = &_s; + _s.lnk = FPrintStr__12_s; + FPrintStr__12_s = &_s; if (!typ->fpdone) { OPT_IdFPrint(typ); pbfp = typ->idfp; @@ -588,11 +618,11 @@ void OPT_FPrintStr (OPT_Struct typ) OPM_FPrint(&pvfp, typ->align); OPM_FPrint(&pvfp, typ->n); OPT_nofhdfld = 0; - FPrintFlds__14(typ->link, ((LONGINT)(0)), 1); + FPrintFlds__13(typ->link, ((LONGINT)(0)), 1); if (OPT_nofhdfld > 2048) { OPM_Mark(225, typ->txtpos); } - FPrintTProcs__18(typ->link); + FPrintTProcs__17(typ->link); OPM_FPrint(&pvfp, pbfp); strobj = typ->strobj; if (strobj == NIL || strobj->name[0] == 0x00) { @@ -602,7 +632,7 @@ void OPT_FPrintStr (OPT_Struct typ) typ->pbfp = pbfp; typ->pvfp = pvfp; } - FPrintStr__13_s = _s.lnk; + FPrintStr__12_s = _s.lnk; } void OPT_FPrintObj (OPT_Object obj) @@ -946,6 +976,19 @@ static OPT_Object OPT_InTProc (SHORTINT mno) return _o_result; } +static OPT_Struct OPT_InTyp (LONGINT tag) +{ + OPT_Struct _o_result; + if (__IN(tag, 0x70)) { + _o_result = OPT_IntType(OPM_SymRInt()); + return _o_result; + } else { + _o_result = OPT_impCtxt.ref[__X(tag, ((LONGINT)(255)))]; + return _o_result; + } + __RETCHK; +} + static void OPT_InStruct (OPT_Struct *typ) { SHORTINT mno; @@ -956,7 +999,7 @@ static void OPT_InStruct (OPT_Struct *typ) OPT_Object obj = NIL, last = NIL, fld = NIL, old = NIL, dummy = NIL; tag = OPM_SymRInt(); if (tag != 34) { - *typ = OPT_impCtxt.ref[__X(-tag, ((LONGINT)(255)))]; + *typ = OPT_InTyp(-tag); } else { ref = OPT_impCtxt.nofr; OPT_impCtxt.nofr += 1; @@ -1081,7 +1124,7 @@ static void OPT_InStruct (OPT_Struct *typ) } if (ref == OPT_impCtxt.minr) { while (ref < OPT_impCtxt.nofr) { - t = OPT_impCtxt.ref[__X(ref, ((LONGINT)(255)))]; + t = OPT_InTyp(ref); OPT_FPrintStr(t); obj = t->strobj; if (obj->name[0] != 0x00) { @@ -1150,9 +1193,9 @@ static OPT_Object OPT_InObj (SHORTINT mno) obj->vis = 1; if (tag <= 13) { obj->mode = 3; - obj->typ = OPT_impCtxt.ref[__X(tag, ((LONGINT)(255)))]; obj->conval = OPT_NewConst(); OPT_InConstant(tag, obj->conval); + obj->typ = OPT_InTyp(tag); } else if (tag >= 31) { obj->conval = OPT_NewConst(); obj->conval->intval = -1; @@ -1396,6 +1439,9 @@ static void OPT_OutStr (OPT_Struct typ) OPT_Object strobj = NIL; if (typ->ref < OPT_expCtxt.ref) { OPM_SymWInt(-typ->ref); + if (__IN(typ->ref, 0x70)) { + OPM_SymWInt(typ->size); + } } else { OPM_SymWInt(((LONGINT)(34))); typ->ref = OPT_expCtxt.ref; @@ -1493,6 +1539,7 @@ static void OPT_OutConstant (OPT_Object obj) break; case 4: case 5: case 6: OPM_SymWInt(obj->conval->intval); + OPM_SymWInt(obj->typ->size); break; case 9: OPM_SymWSet(obj->conval->setval); @@ -1699,15 +1746,6 @@ static void OPT_EnterTyp (OPS_Name name, SHORTINT form, INTEGER size, OPT_Struct *res = typ; } -static void OPT_EnterDerivedType (OPS_Name name, OPT_Struct typ, OPT_Object *obj) -{ - OPS_Name name__copy; - __DUPARR(name, OPS_Name); - OPT_Insert(name, &*obj); - (*obj)->mode = 5; - (*obj)->typ = typ; -} - static void OPT_EnterProc (OPS_Name name, INTEGER num) { OPT_Object obj = NIL; @@ -1741,8 +1779,8 @@ static void EnumPtrs(void (*P)(void*)) P(OPT_niltyp); P(OPT_notyp); P(OPT_sysptrtyp); - P(OPT_LIntObj); __ENUMP(OPT_GlbMod, 64, P); + __ENUMP(OPT_IntTypes, 20, P); P(OPT_universe); P(OPT_syslink); __ENUMR(&OPT_impCtxt, OPT_ImpCtxt__typ, 3140, 1, P); @@ -1811,7 +1849,7 @@ export void *OPT__init(void) OPT_InitStruct(&OPT_niltyp, 11); OPT_EnterTyp((CHAR*)"BYTE", 1, OPM_ByteSize, &OPT_bytetyp); OPT_EnterTyp((CHAR*)"PTR", 13, OPM_PointerSize, &OPT_sysptrtyp); - OPT_EnterTyp((CHAR*)"ADRINT", 5, OPM_LIntSize, &OPT_ainttyp); + OPT_EnterTyp((CHAR*)"ADRINT", 5, OPM_PointerSize, &OPT_ainttyp); OPT_EnterTyp((CHAR*)"INT8", 5, 1, &OPT_int8typ); OPT_EnterTyp((CHAR*)"INT16", 5, 2, &OPT_int16typ); OPT_EnterTyp((CHAR*)"INT32", 5, 4, &OPT_int32typ); @@ -1839,7 +1877,6 @@ export void *OPT__init(void) OPT_EnterTyp((CHAR*)"LONGINT", 6, OPM_LIntSize, &OPT_linttyp); OPT_EnterTyp((CHAR*)"LONGREAL", 8, OPM_LRealSize, &OPT_lrltyp); OPT_EnterTyp((CHAR*)"SHORTINT", 4, OPM_SIntSize, &OPT_sinttyp); - OPT_EnterDerivedType((CHAR*)"LINT", OPT_int64typ, &OPT_LIntObj); OPT_EnterBoolConst((CHAR*)"FALSE", ((LONGINT)(0))); OPT_EnterBoolConst((CHAR*)"TRUE", ((LONGINT)(1))); OPT_EnterProc((CHAR*)"HALT", 0); @@ -1877,5 +1914,12 @@ export void *OPT__init(void) OPT_impCtxt.ref[11] = OPT_niltyp; OPT_impCtxt.ref[12] = OPT_notyp; OPT_impCtxt.ref[13] = OPT_sysptrtyp; + OPT_IntTypes[1] = OPT_sinttyp; + OPT_IntTypes[2] = OPT_inttyp; + OPT_IntTypes[3] = OPT_linttyp; + OPT_IntTypes[5] = OPT_int8typ; + OPT_IntTypes[6] = OPT_int16typ; + OPT_IntTypes[7] = OPT_int32typ; + OPT_IntTypes[8] = OPT_int64typ; __ENDMOD; } diff --git a/bootstrap/windows-48/OPT.h b/bootstrap/windows-48/OPT.h index c4975398..f6206e42 100644 --- a/bootstrap/windows-48/OPT.h +++ b/bootstrap/windows-48/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPT__h #define OPT__h @@ -92,12 +92,14 @@ import void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done); import void OPT_Init (OPS_Name name, SET opt); import void OPT_Insert (OPS_Name name, OPT_Object *obj); import void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old); +import OPT_Struct OPT_IntType (LONGINT size); import OPT_Const OPT_NewConst (void); import OPT_ConstExt OPT_NewExt (void); import OPT_Node OPT_NewNode (SHORTINT class); import OPT_Object OPT_NewObj (void); import OPT_Struct OPT_NewStr (SHORTINT form, SHORTINT comp); import void OPT_OpenScope (SHORTINT level, OPT_Object owner); +import OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, INTEGER dir); import void *OPT__init(void); diff --git a/bootstrap/windows-48/OPV.c b/bootstrap/windows-48/OPV.c index 2172dee5..03b675a9 100644 --- a/bootstrap/windows-48/OPV.c +++ b/bootstrap/windows-48/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPC.h" #include "OPM.h" diff --git a/bootstrap/windows-48/OPV.h b/bootstrap/windows-48/OPV.h index 122fda4a..6926d6ac 100644 --- a/bootstrap/windows-48/OPV.h +++ b/bootstrap/windows-48/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/windows-48/Platform.c b/bootstrap/windows-48/Platform.c index 6204567c..13bb2453 100644 --- a/bootstrap/windows-48/Platform.c +++ b/bootstrap/windows-48/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" typedef diff --git a/bootstrap/windows-48/Platform.h b/bootstrap/windows-48/Platform.h index b4e3ecf5..8bb15073 100644 --- a/bootstrap/windows-48/Platform.h +++ b/bootstrap/windows-48/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/windows-48/Reals.c b/bootstrap/windows-48/Reals.c index 11c99924..4ee29f7d 100644 --- a/bootstrap/windows-48/Reals.c +++ b/bootstrap/windows-48/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" diff --git a/bootstrap/windows-48/Reals.h b/bootstrap/windows-48/Reals.h index b0497a9c..0a81ebf4 100644 --- a/bootstrap/windows-48/Reals.h +++ b/bootstrap/windows-48/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/windows-48/SYSTEM.h b/bootstrap/windows-48/SYSTEM.h index 35620b9b..343404a4 100644 --- a/bootstrap/windows-48/SYSTEM.h +++ b/bootstrap/windows-48/SYSTEM.h @@ -60,12 +60,6 @@ typedef float REAL; typedef double LONGREAL; typedef void* SYSTEM_PTR; -// Unsigned variants are for use by shift and rotate macros. - -typedef unsigned char U_SYSTEM_BYTE; -typedef unsigned char U_CHAR; -typedef unsigned char U_SHORTINT; - // For 32 bit builds, the size of LONGINT depends on a make option: #if (__SIZEOF_POINTER__ == 8) || defined(LARGE) || defined(_WIN64) @@ -80,9 +74,20 @@ typedef unsigned char U_SHORTINT; typedef unsigned long U_LONGINT; #endif +// Unsigned variants are for use by shift and rotate macros. + +typedef unsigned char U_SYSTEM_BYTE; +typedef unsigned char U_CHAR; +typedef unsigned char U_SHORTINT; + typedef U_LONGINT SET; typedef U_LONGINT U_SET; +typedef SYSTEM_CARD8 U_SYSTEM_INT8; +typedef SYSTEM_CARD16 U_SYSTEM_INT16; +typedef SYSTEM_CARD32 U_SYSTEM_INT32; +typedef SYSTEM_CARD64 U_SYSTEM_INT64; + // OS Memory allocation interfaces are in PlatformXXX.Mod @@ -178,7 +183,7 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __ABSFD(x) SYSTEM_ABSD((double)(x)) #define __CAP(ch) ((CHAR)((ch)&0x5f)) #define __ODD(x) ((x)&1) -#define __IN(x, s) (((s)>>(x))&1) +#define __IN(x, s) ((x)>=0 && (x)<(8*sizeof(SET)) && ((((U_SET)(s))>>(x))&1)) #define __SETOF(x) ((SET)1<<(x)) #define __SETRNG(l, h) ((~(SET)0<<(l))&~(SET)0>>(8*sizeof(SET)-1-(h))) #define __MASK(x, m) ((x)&~(m)) diff --git a/bootstrap/windows-48/Strings.c b/bootstrap/windows-48/Strings.c index 15aeff29..0c372b8b 100644 --- a/bootstrap/windows-48/Strings.c +++ b/bootstrap/windows-48/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" diff --git a/bootstrap/windows-48/Strings.h b/bootstrap/windows-48/Strings.h index 385096bc..0dbfdb8e 100644 --- a/bootstrap/windows-48/Strings.h +++ b/bootstrap/windows-48/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/windows-48/Texts.c b/bootstrap/windows-48/Texts.c index f7a3fdd3..c40f0930 100644 --- a/bootstrap/windows-48/Texts.c +++ b/bootstrap/windows-48/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Files.h" #include "Modules.h" diff --git a/bootstrap/windows-48/Texts.h b/bootstrap/windows-48/Texts.h index d178499a..99931953 100644 --- a/bootstrap/windows-48/Texts.h +++ b/bootstrap/windows-48/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/windows-48/Vishap.c b/bootstrap/windows-48/Vishap.c index 66a97f5d..e8b1e4d1 100644 --- a/bootstrap/windows-48/Vishap.c +++ b/bootstrap/windows-48/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkamSf */ #include "SYSTEM.h" #include "Configuration.h" #include "Heap.h" diff --git a/bootstrap/windows-48/errors.c b/bootstrap/windows-48/errors.c index 59b8db27..a8573f9a 100644 --- a/bootstrap/windows-48/errors.c +++ b/bootstrap/windows-48/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" typedef diff --git a/bootstrap/windows-48/errors.h b/bootstrap/windows-48/errors.h index 6ae0cd7a..6dfe7b1d 100644 --- a/bootstrap/windows-48/errors.h +++ b/bootstrap/windows-48/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/windows-48/extTools.c b/bootstrap/windows-48/extTools.c index 2ef65e7b..d2141803 100644 --- a/bootstrap/windows-48/extTools.c +++ b/bootstrap/windows-48/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Configuration.h" #include "Console.h" diff --git a/bootstrap/windows-48/extTools.h b/bootstrap/windows-48/extTools.h index 39837586..38d2da7b 100644 --- a/bootstrap/windows-48/extTools.h +++ b/bootstrap/windows-48/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/windows-48/vt100.c b/bootstrap/windows-48/vt100.c index e0edabd9..5eb4f70e 100644 --- a/bootstrap/windows-48/vt100.c +++ b/bootstrap/windows-48/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "Console.h" #include "Strings.h" diff --git a/bootstrap/windows-48/vt100.h b/bootstrap/windows-48/vt100.h index 413ae867..770cf66d 100644 --- a/bootstrap/windows-48/vt100.h +++ b/bootstrap/windows-48/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef vt100__h #define vt100__h diff --git a/bootstrap/windows-88/Configuration.c b/bootstrap/windows-88/Configuration.c index 8539a1e2..166df1dc 100644 --- a/bootstrap/windows-88/Configuration.c +++ b/bootstrap/windows-88/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" @@ -14,6 +14,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("1.95 [2016/08/26] for gcc LP64 on cygwin", Configuration_versionLong, 41); + __MOVE("1.95 [2016/08/30] for gcc LP64 on cygwin", Configuration_versionLong, 41); __ENDMOD; } diff --git a/bootstrap/windows-88/Configuration.h b/bootstrap/windows-88/Configuration.h index b091f1f7..e30e1366 100644 --- a/bootstrap/windows-88/Configuration.h +++ b/bootstrap/windows-88/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/windows-88/Console.c b/bootstrap/windows-88/Console.c index e0344732..332ebd52 100644 --- a/bootstrap/windows-88/Console.c +++ b/bootstrap/windows-88/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Platform.h" diff --git a/bootstrap/windows-88/Console.h b/bootstrap/windows-88/Console.h index a0813c94..6c86c19c 100644 --- a/bootstrap/windows-88/Console.h +++ b/bootstrap/windows-88/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/windows-88/Files.c b/bootstrap/windows-88/Files.c index db7f4cd9..4fa9852c 100644 --- a/bootstrap/windows-88/Files.c +++ b/bootstrap/windows-88/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Configuration.h" diff --git a/bootstrap/windows-88/Files.h b/bootstrap/windows-88/Files.h index 12178ad1..a0a4c4f3 100644 --- a/bootstrap/windows-88/Files.h +++ b/bootstrap/windows-88/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tspkaSfF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/windows-88/Heap.c b/bootstrap/windows-88/Heap.c index d3529141..1eb56133 100644 --- a/bootstrap/windows-88/Heap.c +++ b/bootstrap/windows-88/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tskSfF */ #define LARGE #include "SYSTEM.h" diff --git a/bootstrap/windows-88/Heap.h b/bootstrap/windows-88/Heap.h index 7827d119..7e4094a1 100644 --- a/bootstrap/windows-88/Heap.h +++ b/bootstrap/windows-88/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tskSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/windows-88/Modules.c b/bootstrap/windows-88/Modules.c index e006bde8..51f3204d 100644 --- a/bootstrap/windows-88/Modules.c +++ b/bootstrap/windows-88/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Console.h" diff --git a/bootstrap/windows-88/Modules.h b/bootstrap/windows-88/Modules.h index 9a0517b5..8431e4a2 100644 --- a/bootstrap/windows-88/Modules.h +++ b/bootstrap/windows-88/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/windows-88/OPB.c b/bootstrap/windows-88/OPB.c index cb07c606..ce3f00ec 100644 --- a/bootstrap/windows-88/OPB.c +++ b/bootstrap/windows-88/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPM.h" @@ -35,9 +35,7 @@ export void OPB_In (OPT_Node *x, OPT_Node y); export void OPB_Index (OPT_Node *x, OPT_Node y); export void OPB_Inittd (OPT_Node *inittd, OPT_Node *last, OPT_Struct typ); static BOOLEAN OPB_IntToBool (LONGINT i); -static OPT_Struct OPB_IntType (LONGINT size); export void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y); -static LONGINT OPB_LongerSize (LONGINT i); export void OPB_MOp (SHORTINT op, OPT_Node *x); export OPT_Node OPB_NewBoolConst (BOOLEAN boolval); export OPT_Node OPB_NewIntConst (LONGINT intval); @@ -54,8 +52,6 @@ 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 LONGINT OPB_ShorterSize (LONGINT i); -static INTEGER OPB_SignedByteSize (LONGINT n); export void OPB_StFct (OPT_Node *par0, SHORTINT fctno, INTEGER parno); export void OPB_StPar0 (OPT_Node *par0, INTEGER fctno); export void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno); @@ -225,68 +221,20 @@ OPT_Node OPB_EmptySet (void) return _o_result; } -static INTEGER OPB_SignedByteSize (LONGINT n) +static void OPB_SetIntType (OPT_Node node) { - INTEGER _o_result; INTEGER b; - if (n < 0) { - n = -(n + 1); + LONGINT n; + if (node->conval->intval >= 0) { + n = node->conval->intval; + } else { + n = -(node->conval->intval + 1); } b = 1; while ((b < 8 && __ASH(n, -(__ASHL(b, 3) - 1)) != 0)) { b += 1; } - _o_result = b; - return _o_result; -} - -static LONGINT OPB_ShorterSize (LONGINT i) -{ - LONGINT _o_result; - if (i >= (SYSTEM_INT64)OPM_LIntSize) { - _o_result = OPM_IntSize; - return _o_result; - } else { - _o_result = OPM_SIntSize; - return _o_result; - } - __RETCHK; -} - -static LONGINT OPB_LongerSize (LONGINT i) -{ - LONGINT _o_result; - if (i <= (SYSTEM_INT64)OPM_SIntSize) { - _o_result = OPM_IntSize; - return _o_result; - } else { - _o_result = OPM_LIntSize; - return _o_result; - } - __RETCHK; -} - -static OPT_Struct OPB_IntType (LONGINT size) -{ - OPT_Struct _o_result; - OPT_Struct result = NIL; - if (size <= OPT_sinttyp->size) { - result = OPT_sinttyp; - } else if (size <= OPT_inttyp->size) { - result = OPT_inttyp; - } else { - result = OPT_linttyp; - } - if (size > OPT_linttyp->size) { - OPB_err(203); - } - _o_result = result; - return _o_result; -} - -static void OPB_SetIntType (OPT_Node node) -{ - node->typ = OPB_IntType(OPB_SignedByteSize(node->conval->intval)); + node->typ = OPT_IntType(b); } OPT_Node OPB_NewIntConst (LONGINT intval) @@ -430,16 +378,16 @@ void OPB_Field (OPT_Node *x, OPT_Object y) } } -static struct TypTest__61 { +static struct TypTest__57 { OPT_Node *x; OPT_Object *obj; BOOLEAN *guard; - struct TypTest__61 *lnk; -} *TypTest__61_s; + struct TypTest__57 *lnk; +} *TypTest__57_s; -static void GTT__62 (OPT_Struct t0, OPT_Struct t1); +static void GTT__58 (OPT_Struct t0, OPT_Struct t1); -static void GTT__62 (OPT_Struct t0, OPT_Struct t1) +static void GTT__58 (OPT_Struct t0, OPT_Struct t1) { OPT_Node node = NIL; OPT_Struct t = NIL; @@ -452,54 +400,54 @@ static void GTT__62 (OPT_Struct t0, OPT_Struct t1) t1 = t1->BaseTyp; } if (t1 == t0 || t0->form == 0) { - if (*TypTest__61_s->guard) { - OPB_BindNodes(5, NIL, &*TypTest__61_s->x, NIL); - (*TypTest__61_s->x)->readonly = (*TypTest__61_s->x)->left->readonly; + 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; } else { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__61_s->x; - node->obj = *TypTest__61_s->obj; - *TypTest__61_s->x = node; + node->left = *TypTest__57_s->x; + node->obj = *TypTest__57_s->obj; + *TypTest__57_s->x = node; } } else { OPB_err(85); } } else if (t0 != t1) { OPB_err(85); - } else if (!*TypTest__61_s->guard) { - if ((*TypTest__61_s->x)->class == 5) { + } else if (!*TypTest__57_s->guard) { + if ((*TypTest__57_s->x)->class == 5) { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__61_s->x; - node->obj = *TypTest__61_s->obj; - *TypTest__61_s->x = node; + node->left = *TypTest__57_s->x; + node->obj = *TypTest__57_s->obj; + *TypTest__57_s->x = node; } else { - *TypTest__61_s->x = OPB_NewBoolConst(1); + *TypTest__57_s->x = OPB_NewBoolConst(1); } } } void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) { - struct TypTest__61 _s; + struct TypTest__57 _s; _s.x = x; _s.obj = &obj; _s.guard = &guard; - _s.lnk = TypTest__61_s; - TypTest__61_s = &_s; + _s.lnk = TypTest__57_s; + TypTest__57_s = &_s; if (OPB_NotVar(*x)) { OPB_err(112); } else if ((*x)->typ->form == 13) { if (((*x)->typ->BaseTyp->comp != 4 && (*x)->typ != OPT_sysptrtyp)) { OPB_err(85); } else if (obj->typ->form == 13) { - GTT__62((*x)->typ->BaseTyp, obj->typ->BaseTyp); + GTT__58((*x)->typ->BaseTyp, obj->typ->BaseTyp); } else { OPB_err(86); } } else if (((((*x)->typ->comp == 4 && (*x)->class == 1)) && obj->typ->comp == 4)) { - GTT__62((*x)->typ, obj->typ); + GTT__58((*x)->typ, obj->typ); } else { OPB_err(87); } @@ -508,7 +456,7 @@ void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) } else { (*x)->typ = OPT_booltyp; } - TypTest__61_s = _s.lnk; + TypTest__57_s = _s.lnk; } void OPB_In (OPT_Node *x, OPT_Node y) @@ -574,13 +522,13 @@ static void OPB_CheckRealType (INTEGER f, INTEGER nr, OPT_Const x) x->intval = -1; } -static struct MOp__30 { - struct MOp__30 *lnk; -} *MOp__30_s; +static struct MOp__28 { + struct MOp__28 *lnk; +} *MOp__28_s; -static OPT_Node NewOp__31 (SHORTINT op, OPT_Struct typ, OPT_Node z); +static OPT_Node NewOp__29 (SHORTINT op, OPT_Struct typ, OPT_Node z); -static OPT_Node NewOp__31 (SHORTINT op, OPT_Struct typ, OPT_Node z) +static OPT_Node NewOp__29 (SHORTINT op, OPT_Struct typ, OPT_Node z) { OPT_Node _o_result; OPT_Node node = NIL; @@ -597,9 +545,9 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) INTEGER f; OPT_Struct typ = NIL; OPT_Node z = NIL; - struct MOp__30 _s; - _s.lnk = MOp__30_s; - MOp__30_s = &_s; + struct MOp__28 _s; + _s.lnk = MOp__28_s; + MOp__28_s = &_s; z = *x; if (z->class == 8 || z->class == 9) { OPB_err(126); @@ -613,7 +561,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = OPB_BoolToInt(!OPB_IntToBool(z->conval->intval)); z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(98); @@ -641,7 +589,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(97); @@ -662,7 +610,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(111); @@ -674,7 +622,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = (int)__CAP((CHAR)z->conval->intval); z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(111); @@ -687,7 +635,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = OPB_BoolToInt(__ODD(z->conval->intval)); z->obj = NIL; } else { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } } else { OPB_err(111); @@ -700,7 +648,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) f = 10; } if (z->class < 7 || f == 10) { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } else { OPB_err(127); } @@ -709,7 +657,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) case 25: if ((__IN(f, 0x70) && z->class == 7)) { if ((0 <= z->conval->intval && z->conval->intval <= -1)) { - z = NewOp__31(op, typ, z); + z = NewOp__29(op, typ, z); } else { OPB_err(219); } @@ -726,7 +674,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } } *x = z; - MOp__30_s = _s.lnk; + MOp__28_s = _s.lnk; } static void OPB_CheckPtr (OPT_Node x, OPT_Node y) @@ -922,7 +870,7 @@ static void OPB_ConstOp (INTEGER op, OPT_Node x, OPT_Node y) if (x->typ->size <= y->typ->size) { x->typ = y->typ; } else { - x->typ = OPB_IntType(x->typ->size); + x->typ = OPT_IntType(x->typ->size); } } else if (g == 7) { x->typ = OPT_realtyp; @@ -1179,7 +1127,7 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) if (__IN(g, 0x70)) { if (f > g) { OPB_SetIntType(*x); - if ((int)(*x)->typ->form > g) { + if ((*x)->typ->size > typ->size) { OPB_err(203); (*x)->conval->intval = 1; } @@ -1220,15 +1168,15 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) (*x)->typ = typ; } -static struct Op__40 { +static struct Op__38 { INTEGER *f, *g; - struct Op__40 *lnk; -} *Op__40_s; + struct Op__38 *lnk; +} *Op__38_s; -static void NewOp__41 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y); -static BOOLEAN strings__43 (OPT_Node *x, OPT_Node *y); +static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y); +static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y); -static void NewOp__41 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) +static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) { OPT_Node node = NIL; node = OPT_NewNode(12); @@ -1239,29 +1187,29 @@ static void NewOp__41 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) *x = node; } -static BOOLEAN strings__43 (OPT_Node *x, OPT_Node *y) +static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y) { BOOLEAN _o_result; BOOLEAN ok, xCharArr, yCharArr; - xCharArr = (__IN((*x)->typ->comp, 0x0c) && (*x)->typ->BaseTyp->form == 3) || *Op__40_s->f == 10; - yCharArr = (__IN((*y)->typ->comp, 0x0c) && (*y)->typ->BaseTyp->form == 3) || *Op__40_s->g == 10; - if ((((xCharArr && *Op__40_s->g == 3)) && (*y)->class == 7)) { + xCharArr = (__IN((*x)->typ->comp, 0x0c) && (*x)->typ->BaseTyp->form == 3) || *Op__38_s->f == 10; + yCharArr = (__IN((*y)->typ->comp, 0x0c) && (*y)->typ->BaseTyp->form == 3) || *Op__38_s->g == 10; + if ((((xCharArr && *Op__38_s->g == 3)) && (*y)->class == 7)) { OPB_CharToString(*y); - *Op__40_s->g = 10; + *Op__38_s->g = 10; yCharArr = 1; } - if ((((yCharArr && *Op__40_s->f == 3)) && (*x)->class == 7)) { + if ((((yCharArr && *Op__38_s->f == 3)) && (*x)->class == 7)) { OPB_CharToString(*x); - *Op__40_s->f = 10; + *Op__38_s->f = 10; xCharArr = 1; } ok = (xCharArr && yCharArr); if (ok) { - if ((*Op__40_s->f == 10 && (*x)->conval->intval2 == 1)) { + if ((*Op__38_s->f == 10 && (*x)->conval->intval2 == 1)) { (*x)->typ = OPT_chartyp; (*x)->conval->intval = 0; OPB_Index(&*y, OPB_NewIntConst(((LONGINT)(0)))); - } else if ((*Op__40_s->g == 10 && (*y)->conval->intval2 == 1)) { + } else if ((*Op__38_s->g == 10 && (*y)->conval->intval2 == 1)) { (*y)->typ = OPT_chartyp; (*y)->conval->intval = 0; OPB_Index(&*x, OPB_NewIntConst(((LONGINT)(0)))); @@ -1278,11 +1226,11 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPT_Struct typ = NIL; BOOLEAN do_; LONGINT val; - struct Op__40 _s; + struct Op__38 _s; _s.f = &f; _s.g = &g; - _s.lnk = Op__40_s; - Op__40_s = &_s; + _s.lnk = Op__38_s; + Op__38_s = &_s; z = *x; if (((z->class == 8 || z->class == 9) || y->class == 8) || y->class == 9) { OPB_err(126); @@ -1394,7 +1342,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if (do_) { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } break; case 2: @@ -1413,7 +1361,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(102); typ = OPT_undftyp; } - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); break; case 3: do_ = 1; @@ -1436,7 +1384,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if (do_) { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } break; case 4: @@ -1454,7 +1402,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(104); typ = OPT_undftyp; } - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); break; case 5: if (f == 2) { @@ -1464,7 +1412,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } else if ((y->class == 7 && OPB_IntToBool(y->conval->intval))) { } else { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } } else if (f != 0) { OPB_err(94); @@ -1487,7 +1435,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } if (do_) { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } break; case 7: @@ -1496,7 +1444,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if ((!__IN(f, 0x70) || y->class != 7) || y->conval->intval != 0) { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } break; case 8: @@ -1507,7 +1455,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } else if ((y->class == 7 && !OPB_IntToBool(y->conval->intval))) { } else { - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); } } else if (f != 0) { OPB_err(95); @@ -1515,16 +1463,16 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } break; case 9: case 10: - if (__IN(f, 0x6bff) || strings__43(&z, &y)) { + if (__IN(f, 0x6bff) || strings__41(&z, &y)) { typ = OPT_booltyp; } else { OPB_err(107); typ = OPT_undftyp; } - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); break; case 11: case 12: case 13: case 14: - if (__IN(f, 0x01f9) || strings__43(&z, &y)) { + if (__IN(f, 0x01f9) || strings__41(&z, &y)) { typ = OPT_booltyp; } else { OPM_LogWLn(); @@ -1533,7 +1481,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(108); typ = OPT_undftyp; } - NewOp__41(op, typ, &z, y); + NewOp__39(op, typ, &z, y); break; default: OPM_LogWStr((CHAR*)"unhandled case in OPB.Op, op = ", (LONGINT)32); @@ -1543,7 +1491,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } *x = z; - Op__40_s = _s.lnk; + Op__38_s = _s.lnk; } void OPB_SetRange (OPT_Node *x, OPT_Node y) @@ -1895,8 +1843,13 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) case 10: if (x->class == 8 || x->class == 9) { OPB_err(126); - } else if ((__IN(f, 0x70) && x->typ->size > (SYSTEM_INT64)OPM_SIntSize)) { - OPB_Convert(&x, OPB_IntType(OPB_ShorterSize(x->typ->size))); + } else if (__IN(f, 0x70)) { + typ = OPT_ShorterOrLongerType(x->typ, -1); + if (typ == NIL) { + OPB_err(111); + } else { + OPB_Convert(&x, typ); + } } else if (f == 8) { OPB_Convert(&x, OPT_realtyp); } else { @@ -1906,8 +1859,13 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) case 11: if (x->class == 8 || x->class == 9) { OPB_err(126); - } else if ((__IN(f, 0x70) && x->typ->size < (SYSTEM_INT64)OPM_LIntSize)) { - OPB_Convert(&x, OPB_IntType(OPB_LongerSize(x->typ->size))); + } else if (__IN(f, 0x70)) { + typ = OPT_ShorterOrLongerType(x->typ, 1); + if (typ == NIL) { + OPB_err(111); + } else { + OPB_Convert(&x, typ); + } } else if (f == 7) { OPB_Convert(&x, OPT_lrltyp); } else if (f == 3) { @@ -2044,13 +2002,13 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) *par0 = x; } -static struct StPar1__56 { - struct StPar1__56 *lnk; -} *StPar1__56_s; +static struct StPar1__52 { + struct StPar1__52 *lnk; +} *StPar1__52_s; -static OPT_Node NewOp__57 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right); +static OPT_Node NewOp__53 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right); -static OPT_Node NewOp__57 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right) +static OPT_Node NewOp__53 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right) { OPT_Node _o_result; OPT_Node node = NIL; @@ -2067,9 +2025,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) INTEGER f, L; OPT_Struct typ = NIL; OPT_Node p = NIL, t = NIL; - struct StPar1__56 _s; - _s.lnk = StPar1__56_s; - StPar1__56_s = &_s; + struct StPar1__52 _s; + _s.lnk = StPar1__52_s; + StPar1__52_s = &_s; p = *par0; f = x->typ->form; switch (fctno) { @@ -2085,7 +2043,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) OPB_err(111); } } - p = NewOp__57(19, fctno, p, x); + p = NewOp__53(19, fctno, p, x); p->typ = OPT_notyp; } break; @@ -2096,7 +2054,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (SYSTEM_INT64)OPM_MaxSet))) { OPB_err(202); } - p = NewOp__57(19, fctno, p, x); + p = NewOp__53(19, fctno, p, x); } else { OPB_err(111); } @@ -2121,7 +2079,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) p = p->left; x->conval->intval += 1; } - p = NewOp__57(12, 19, p, x); + p = NewOp__53(12, 19, p, x); p->typ = OPT_linttyp; } else { p = x; @@ -2143,7 +2101,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) t = x; x = p; p = t; - p = NewOp__57(19, 18, p, x); + p = NewOp__53(19, 18, p, x); } else { OPB_err(111); } @@ -2169,7 +2127,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) } p->obj = NIL; } else { - p = NewOp__57(12, 17, p, x); + p = NewOp__53(12, 17, p, x); p->typ = OPT_linttyp; } } else { @@ -2200,9 +2158,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) OPB_err(111); } else { if (fctno == 22) { - p = NewOp__57(12, 27, p, x); + p = NewOp__53(12, 27, p, x); } else { - p = NewOp__57(12, 28, p, x); + p = NewOp__53(12, 28, p, x); } p->typ = p->left->typ; } @@ -2219,7 +2177,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) x = p; p = t; } - p = NewOp__57(19, fctno, p, x); + p = NewOp__53(19, fctno, p, x); } else { OPB_err(111); } @@ -2229,7 +2187,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) if (x->class == 8 || x->class == 9) { OPB_err(126); } else if (__IN(f, 0x70)) { - p = NewOp__57(12, 26, p, x); + p = NewOp__53(12, 26, p, x); } else { OPB_err(111); } @@ -2253,7 +2211,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) if (x->class == 8 || x->class == 9) { OPB_err(126); } else if (__IN(f, 0x70)) { - p = NewOp__57(19, 30, p, x); + p = NewOp__53(19, 30, p, x); } else { OPB_err(111); } @@ -2299,7 +2257,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) break; } *par0 = p; - StPar1__56_s = _s.lnk; + StPar1__52_s = _s.lnk; } void OPB_StParN (OPT_Node *par0, OPT_Node x, INTEGER fctno, INTEGER n) diff --git a/bootstrap/windows-88/OPB.h b/bootstrap/windows-88/OPB.h index f2056569..ccef7627 100644 --- a/bootstrap/windows-88/OPB.h +++ b/bootstrap/windows-88/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/windows-88/OPC.c b/bootstrap/windows-88/OPC.c index 0813dca9..a5276b17 100644 --- a/bootstrap/windows-88/OPC.c +++ b/bootstrap/windows-88/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Configuration.h" diff --git a/bootstrap/windows-88/OPC.h b/bootstrap/windows-88/OPC.h index aa92d405..de932c60 100644 --- a/bootstrap/windows-88/OPC.h +++ b/bootstrap/windows-88/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/windows-88/OPM.c b/bootstrap/windows-88/OPM.c index 3bc1b6d2..0e43a013 100644 --- a/bootstrap/windows-88/OPM.c +++ b/bootstrap/windows-88/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Configuration.h" diff --git a/bootstrap/windows-88/OPM.h b/bootstrap/windows-88/OPM.h index f11b56ba..e94f0303 100644 --- a/bootstrap/windows-88/OPM.h +++ b/bootstrap/windows-88/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPM__h #define OPM__h diff --git a/bootstrap/windows-88/OPP.c b/bootstrap/windows-88/OPP.c index 3a345c1f..63b71ce5 100644 --- a/bootstrap/windows-88/OPP.c +++ b/bootstrap/windows-88/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPB.h" @@ -25,7 +25,7 @@ export LONGINT *OPP__1__typ; static void OPP_ActualParameters (OPT_Node *aparlist, OPT_Object fpar); static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned); static void OPP_Block (OPT_Node *procdec, OPT_Node *statseq); -static void OPP_CaseLabelList (OPT_Node *lab, INTEGER LabelForm, INTEGER *n, OPP_CaseTable tab); +static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, INTEGER *n, OPP_CaseTable tab); static void OPP_CheckMark (SHORTINT *vis); static void OPP_CheckSym (INTEGER s); static void OPP_CheckSysFlag (INTEGER *sysflag, INTEGER default_); @@ -1164,7 +1164,7 @@ static void OPP_ProcedureDeclaration (OPT_Node *x) ProcedureDeclaration__16_s = _s.lnk; } -static void OPP_CaseLabelList (OPT_Node *lab, INTEGER LabelForm, INTEGER *n, OPP_CaseTable tab) +static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, INTEGER *n, OPP_CaseTable tab) { OPT_Node x = NIL, y = NIL, lastlab = NIL; INTEGER i, f; @@ -1181,10 +1181,10 @@ static void OPP_CaseLabelList (OPT_Node *lab, INTEGER LabelForm, INTEGER *n, OPP xval = 1; } if (__IN(f, 0x70)) { - if (LabelForm < f) { + if (!__IN(LabelTyp->form, 0x70) || LabelTyp->size < x->typ->size) { OPP_err(60); } - } else if (LabelForm != f) { + } else if ((int)LabelTyp->form != f) { OPP_err(60); } if (OPP_sym == 21) { @@ -1263,7 +1263,7 @@ static void CasePart__31 (OPT_Node *x) n = 0; for (;;) { if (OPP_sym < 40) { - OPP_CaseLabelList(&lab, (*x)->typ->form, &n, tab); + OPP_CaseLabelList(&lab, (*x)->typ, &n, tab); OPP_CheckSym(20); OPP_StatSeq(&y); OPB_Construct(17, &lab, y); @@ -1472,7 +1472,7 @@ static void OPP_StatSeq (OPT_Node *stat) SetPos__35(z); OPB_Link(&*stat, &last, z); y = OPB_NewLeaf(t); - } else if (y->typ->form < 4 || y->typ->form > x->left->typ->form) { + } else if (!__IN(y->typ->form, 0x70) || y->typ->size > x->left->typ->size) { OPP_err(113); } OPB_Link(&*stat, &last, x); diff --git a/bootstrap/windows-88/OPP.h b/bootstrap/windows-88/OPP.h index c0c9c3dd..fb0cf655 100644 --- a/bootstrap/windows-88/OPP.h +++ b/bootstrap/windows-88/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/windows-88/OPS.c b/bootstrap/windows-88/OPS.c index 1f9f2a46..e2d48c61 100644 --- a/bootstrap/windows-88/OPS.c +++ b/bootstrap/windows-88/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPM.h" diff --git a/bootstrap/windows-88/OPS.h b/bootstrap/windows-88/OPS.h index 4b760b22..ea28a764 100644 --- a/bootstrap/windows-88/OPS.h +++ b/bootstrap/windows-88/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin tspkaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/windows-88/OPT.c b/bootstrap/windows-88/OPT.c index 20234e22..b028d164 100644 --- a/bootstrap/windows-88/OPT.c +++ b/bootstrap/windows-88/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPM.h" @@ -85,11 +85,11 @@ typedef export void (*OPT_typSize)(OPT_Struct); export OPT_Object OPT_topScope; export OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_ainttyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp; -static OPT_Object OPT_LIntObj; export SHORTINT OPT_nofGmod; export OPT_Object OPT_GlbMod[64]; export OPS_Name OPT_SelfName; export BOOLEAN OPT_SYSimported; +static OPT_Struct OPT_IntTypes[20]; static OPT_Object OPT_universe, OPT_syslink; static OPT_ImpCtxt OPT_impCtxt; static OPT_ExpCtxt OPT_expCtxt; @@ -107,7 +107,6 @@ export void OPT_Close (void); export void OPT_CloseScope (void); static void OPT_DebugStruct (OPT_Struct btyp); static void OPT_EnterBoolConst (OPS_Name name, LONGINT value); -static void OPT_EnterDerivedType (OPS_Name name, OPT_Struct typ, OPT_Object *obj); static void OPT_EnterProc (OPS_Name name, INTEGER num); static void OPT_EnterTyp (OPS_Name name, SHORTINT form, INTEGER size, OPT_Struct *res); export void OPT_Export (BOOLEAN *ext, BOOLEAN *new); @@ -129,10 +128,12 @@ static OPT_Object OPT_InObj (SHORTINT mno); static void OPT_InSign (SHORTINT mno, OPT_Struct *res, OPT_Object *par); static void OPT_InStruct (OPT_Struct *typ); static OPT_Object OPT_InTProc (SHORTINT mno); +static OPT_Struct OPT_InTyp (LONGINT tag); export void OPT_Init (OPS_Name name, SET opt); static void OPT_InitStruct (OPT_Struct *typ, SHORTINT form); export void OPT_Insert (OPS_Name name, OPT_Object *obj); export void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old); +export OPT_Struct OPT_IntType (LONGINT size); export OPT_Const OPT_NewConst (void); export OPT_ConstExt OPT_NewExt (void); export OPT_Node OPT_NewNode (SHORTINT class); @@ -148,6 +149,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_ShorterOrLongerType (OPT_Struct x, INTEGER dir); static void OPT_err (INTEGER n); @@ -156,6 +158,34 @@ static void OPT_err (INTEGER n) OPM_err(n); } +OPT_Struct OPT_IntType (LONGINT size) +{ + OPT_Struct _o_result; + INTEGER i; + i = 1; + while ((OPT_IntTypes[__X(i, ((LONGINT)(20)))]->size < size && OPT_IntTypes[__X(i + 1, ((LONGINT)(20)))] != NIL)) { + i += 1; + } + _o_result = OPT_IntTypes[__X(i, ((LONGINT)(20)))]; + return _o_result; +} + +OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, INTEGER dir) +{ + OPT_Struct _o_result; + INTEGER i; + __ASSERT(__IN(x->form, 0x70), 0); + __ASSERT(dir == 1 || dir == -1, 0); + __ASSERT(x->BaseTyp == OPT_undftyp, 0); + i = 0; + while ((OPT_IntTypes[__X(i, ((LONGINT)(20)))] != x && i < 20)) { + i += 1; + } + __ASSERT(i < 19, 0); + _o_result = OPT_IntTypes[__X(i + dir, ((LONGINT)(20)))]; + return _o_result; +} + OPT_Const OPT_NewConst (void) { OPT_Const _o_result; @@ -468,21 +498,21 @@ void OPT_IdFPrint (OPT_Struct typ) } } -static struct FPrintStr__13 { +static struct FPrintStr__12 { LONGINT *pbfp, *pvfp; - struct FPrintStr__13 *lnk; -} *FPrintStr__13_s; + struct FPrintStr__12 *lnk; +} *FPrintStr__12_s; -static void FPrintFlds__14 (OPT_Object fld, LONGINT adr, BOOLEAN visible); -static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, LONGINT adr); -static void FPrintTProcs__18 (OPT_Object obj); +static void FPrintFlds__13 (OPT_Object fld, LONGINT adr, BOOLEAN visible); +static void FPrintHdFld__15 (OPT_Struct typ, OPT_Object fld, LONGINT adr); +static void FPrintTProcs__17 (OPT_Object obj); -static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, LONGINT adr) +static void FPrintHdFld__15 (OPT_Struct typ, OPT_Object fld, LONGINT adr) { LONGINT i, j, n; OPT_Struct btyp = NIL; if (typ->comp == 4) { - FPrintFlds__14(typ->link, adr, 0); + FPrintFlds__13(typ->link, adr, 0); } else if (typ->comp == 2) { btyp = typ->BaseTyp; n = typ->n; @@ -492,53 +522,53 @@ static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, LONGINT adr) } if (btyp->form == 13 || btyp->comp == 4) { j = OPT_nofhdfld; - FPrintHdFld__16(btyp, fld, adr); + FPrintHdFld__15(btyp, fld, adr); if (j != OPT_nofhdfld) { i = 1; while ((i < n && OPT_nofhdfld <= 2048)) { adr += btyp->size; - FPrintHdFld__16(btyp, fld, adr); + FPrintHdFld__15(btyp, fld, adr); i += 1; } } } } else if (typ->form == 13 || __STRCMP(fld->name, "@ptr") == 0) { - OPM_FPrint(&*FPrintStr__13_s->pvfp, ((LONGINT)(13))); - OPM_FPrint(&*FPrintStr__13_s->pvfp, adr); + OPM_FPrint(&*FPrintStr__12_s->pvfp, ((LONGINT)(13))); + OPM_FPrint(&*FPrintStr__12_s->pvfp, adr); OPT_nofhdfld += 1; } } -static void FPrintFlds__14 (OPT_Object fld, LONGINT adr, BOOLEAN visible) +static void FPrintFlds__13 (OPT_Object fld, LONGINT adr, BOOLEAN visible) { while ((fld != NIL && fld->mode == 4)) { if ((fld->vis != 0 && visible)) { - OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->vis); - OPT_FPrintName(&*FPrintStr__13_s->pbfp, (void*)fld->name, ((LONGINT)(256))); - OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->adr); + OPM_FPrint(&*FPrintStr__12_s->pbfp, fld->vis); + OPT_FPrintName(&*FPrintStr__12_s->pbfp, (void*)fld->name, ((LONGINT)(256))); + OPM_FPrint(&*FPrintStr__12_s->pbfp, fld->adr); OPT_FPrintStr(fld->typ); - OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->typ->pbfp); - OPM_FPrint(&*FPrintStr__13_s->pvfp, fld->typ->pvfp); + OPM_FPrint(&*FPrintStr__12_s->pbfp, fld->typ->pbfp); + OPM_FPrint(&*FPrintStr__12_s->pvfp, fld->typ->pvfp); } else { - FPrintHdFld__16(fld->typ, fld, fld->adr + adr); + FPrintHdFld__15(fld->typ, fld, fld->adr + adr); } fld = fld->link; } } -static void FPrintTProcs__18 (OPT_Object obj) +static void FPrintTProcs__17 (OPT_Object obj) { if (obj != NIL) { - FPrintTProcs__18(obj->left); + FPrintTProcs__17(obj->left); if (obj->mode == 13) { if (obj->vis != 0) { - OPM_FPrint(&*FPrintStr__13_s->pbfp, ((LONGINT)(13))); - OPM_FPrint(&*FPrintStr__13_s->pbfp, __ASHR(obj->adr, 16)); - OPT_FPrintSign(&*FPrintStr__13_s->pbfp, obj->typ, obj->link); - OPT_FPrintName(&*FPrintStr__13_s->pbfp, (void*)obj->name, ((LONGINT)(256))); + OPM_FPrint(&*FPrintStr__12_s->pbfp, ((LONGINT)(13))); + OPM_FPrint(&*FPrintStr__12_s->pbfp, __ASHR(obj->adr, 16)); + OPT_FPrintSign(&*FPrintStr__12_s->pbfp, obj->typ, obj->link); + OPT_FPrintName(&*FPrintStr__12_s->pbfp, (void*)obj->name, ((LONGINT)(256))); } } - FPrintTProcs__18(obj->right); + FPrintTProcs__17(obj->right); } } @@ -548,11 +578,11 @@ void OPT_FPrintStr (OPT_Struct typ) OPT_Struct btyp = NIL; OPT_Object strobj = NIL, bstrobj = NIL; LONGINT pbfp, pvfp; - struct FPrintStr__13 _s; + struct FPrintStr__12 _s; _s.pbfp = &pbfp; _s.pvfp = &pvfp; - _s.lnk = FPrintStr__13_s; - FPrintStr__13_s = &_s; + _s.lnk = FPrintStr__12_s; + FPrintStr__12_s = &_s; if (!typ->fpdone) { OPT_IdFPrint(typ); pbfp = typ->idfp; @@ -589,11 +619,11 @@ void OPT_FPrintStr (OPT_Struct typ) OPM_FPrint(&pvfp, typ->align); OPM_FPrint(&pvfp, typ->n); OPT_nofhdfld = 0; - FPrintFlds__14(typ->link, ((LONGINT)(0)), 1); + FPrintFlds__13(typ->link, ((LONGINT)(0)), 1); if (OPT_nofhdfld > 2048) { OPM_Mark(225, typ->txtpos); } - FPrintTProcs__18(typ->link); + FPrintTProcs__17(typ->link); OPM_FPrint(&pvfp, pbfp); strobj = typ->strobj; if (strobj == NIL || strobj->name[0] == 0x00) { @@ -603,7 +633,7 @@ void OPT_FPrintStr (OPT_Struct typ) typ->pbfp = pbfp; typ->pvfp = pvfp; } - FPrintStr__13_s = _s.lnk; + FPrintStr__12_s = _s.lnk; } void OPT_FPrintObj (OPT_Object obj) @@ -947,6 +977,19 @@ static OPT_Object OPT_InTProc (SHORTINT mno) return _o_result; } +static OPT_Struct OPT_InTyp (LONGINT tag) +{ + OPT_Struct _o_result; + if (__IN(tag, 0x70)) { + _o_result = OPT_IntType(OPM_SymRInt()); + return _o_result; + } else { + _o_result = OPT_impCtxt.ref[__X(tag, ((LONGINT)(255)))]; + return _o_result; + } + __RETCHK; +} + static void OPT_InStruct (OPT_Struct *typ) { SHORTINT mno; @@ -957,7 +1000,7 @@ static void OPT_InStruct (OPT_Struct *typ) OPT_Object obj = NIL, last = NIL, fld = NIL, old = NIL, dummy = NIL; tag = OPM_SymRInt(); if (tag != 34) { - *typ = OPT_impCtxt.ref[__X(-tag, ((LONGINT)(255)))]; + *typ = OPT_InTyp(-tag); } else { ref = OPT_impCtxt.nofr; OPT_impCtxt.nofr += 1; @@ -1082,7 +1125,7 @@ static void OPT_InStruct (OPT_Struct *typ) } if (ref == OPT_impCtxt.minr) { while (ref < OPT_impCtxt.nofr) { - t = OPT_impCtxt.ref[__X(ref, ((LONGINT)(255)))]; + t = OPT_InTyp(ref); OPT_FPrintStr(t); obj = t->strobj; if (obj->name[0] != 0x00) { @@ -1151,9 +1194,9 @@ static OPT_Object OPT_InObj (SHORTINT mno) obj->vis = 1; if (tag <= 13) { obj->mode = 3; - obj->typ = OPT_impCtxt.ref[__X(tag, ((LONGINT)(255)))]; obj->conval = OPT_NewConst(); OPT_InConstant(tag, obj->conval); + obj->typ = OPT_InTyp(tag); } else if (tag >= 31) { obj->conval = OPT_NewConst(); obj->conval->intval = -1; @@ -1397,6 +1440,9 @@ static void OPT_OutStr (OPT_Struct typ) OPT_Object strobj = NIL; if (typ->ref < OPT_expCtxt.ref) { OPM_SymWInt(-typ->ref); + if (__IN(typ->ref, 0x70)) { + OPM_SymWInt(typ->size); + } } else { OPM_SymWInt(((LONGINT)(34))); typ->ref = OPT_expCtxt.ref; @@ -1494,6 +1540,7 @@ static void OPT_OutConstant (OPT_Object obj) break; case 4: case 5: case 6: OPM_SymWInt(obj->conval->intval); + OPM_SymWInt(obj->typ->size); break; case 9: OPM_SymWSet(obj->conval->setval); @@ -1700,15 +1747,6 @@ static void OPT_EnterTyp (OPS_Name name, SHORTINT form, INTEGER size, OPT_Struct *res = typ; } -static void OPT_EnterDerivedType (OPS_Name name, OPT_Struct typ, OPT_Object *obj) -{ - OPS_Name name__copy; - __DUPARR(name, OPS_Name); - OPT_Insert(name, &*obj); - (*obj)->mode = 5; - (*obj)->typ = typ; -} - static void OPT_EnterProc (OPS_Name name, INTEGER num) { OPT_Object obj = NIL; @@ -1742,8 +1780,8 @@ static void EnumPtrs(void (*P)(void*)) P(OPT_niltyp); P(OPT_notyp); P(OPT_sysptrtyp); - P(OPT_LIntObj); __ENUMP(OPT_GlbMod, 64, P); + __ENUMP(OPT_IntTypes, 20, P); P(OPT_universe); P(OPT_syslink); __ENUMR(&OPT_impCtxt, OPT_ImpCtxt__typ, 6216, 1, P); @@ -1812,7 +1850,7 @@ export void *OPT__init(void) OPT_InitStruct(&OPT_niltyp, 11); OPT_EnterTyp((CHAR*)"BYTE", 1, OPM_ByteSize, &OPT_bytetyp); OPT_EnterTyp((CHAR*)"PTR", 13, OPM_PointerSize, &OPT_sysptrtyp); - OPT_EnterTyp((CHAR*)"ADRINT", 5, OPM_LIntSize, &OPT_ainttyp); + OPT_EnterTyp((CHAR*)"ADRINT", 5, OPM_PointerSize, &OPT_ainttyp); OPT_EnterTyp((CHAR*)"INT8", 5, 1, &OPT_int8typ); OPT_EnterTyp((CHAR*)"INT16", 5, 2, &OPT_int16typ); OPT_EnterTyp((CHAR*)"INT32", 5, 4, &OPT_int32typ); @@ -1840,7 +1878,6 @@ export void *OPT__init(void) OPT_EnterTyp((CHAR*)"LONGINT", 6, OPM_LIntSize, &OPT_linttyp); OPT_EnterTyp((CHAR*)"LONGREAL", 8, OPM_LRealSize, &OPT_lrltyp); OPT_EnterTyp((CHAR*)"SHORTINT", 4, OPM_SIntSize, &OPT_sinttyp); - OPT_EnterDerivedType((CHAR*)"LINT", OPT_int64typ, &OPT_LIntObj); OPT_EnterBoolConst((CHAR*)"FALSE", ((LONGINT)(0))); OPT_EnterBoolConst((CHAR*)"TRUE", ((LONGINT)(1))); OPT_EnterProc((CHAR*)"HALT", 0); @@ -1878,5 +1915,12 @@ export void *OPT__init(void) OPT_impCtxt.ref[11] = OPT_niltyp; OPT_impCtxt.ref[12] = OPT_notyp; OPT_impCtxt.ref[13] = OPT_sysptrtyp; + OPT_IntTypes[1] = OPT_sinttyp; + OPT_IntTypes[2] = OPT_inttyp; + OPT_IntTypes[3] = OPT_linttyp; + OPT_IntTypes[5] = OPT_int8typ; + OPT_IntTypes[6] = OPT_int16typ; + OPT_IntTypes[7] = OPT_int32typ; + OPT_IntTypes[8] = OPT_int64typ; __ENDMOD; } diff --git a/bootstrap/windows-88/OPT.h b/bootstrap/windows-88/OPT.h index f1865573..9878e30b 100644 --- a/bootstrap/windows-88/OPT.h +++ b/bootstrap/windows-88/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPT__h #define OPT__h @@ -93,12 +93,14 @@ import void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done); import void OPT_Init (OPS_Name name, SET opt); import void OPT_Insert (OPS_Name name, OPT_Object *obj); import void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old); +import OPT_Struct OPT_IntType (LONGINT size); import OPT_Const OPT_NewConst (void); import OPT_ConstExt OPT_NewExt (void); import OPT_Node OPT_NewNode (SHORTINT class); import OPT_Object OPT_NewObj (void); import OPT_Struct OPT_NewStr (SHORTINT form, SHORTINT comp); import void OPT_OpenScope (SHORTINT level, OPT_Object owner); +import OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, INTEGER dir); import void *OPT__init(void); diff --git a/bootstrap/windows-88/OPV.c b/bootstrap/windows-88/OPV.c index 638891f1..f74e0890 100644 --- a/bootstrap/windows-88/OPV.c +++ b/bootstrap/windows-88/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPC.h" diff --git a/bootstrap/windows-88/OPV.h b/bootstrap/windows-88/OPV.h index b0551679..43ab4681 100644 --- a/bootstrap/windows-88/OPV.h +++ b/bootstrap/windows-88/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/windows-88/Platform.c b/bootstrap/windows-88/Platform.c index 875aa4b4..679e8b8d 100644 --- a/bootstrap/windows-88/Platform.c +++ b/bootstrap/windows-88/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" diff --git a/bootstrap/windows-88/Platform.h b/bootstrap/windows-88/Platform.h index 1c350cbf..aa08a76c 100644 --- a/bootstrap/windows-88/Platform.h +++ b/bootstrap/windows-88/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/windows-88/Reals.c b/bootstrap/windows-88/Reals.c index 660cd605..a5a93902 100644 --- a/bootstrap/windows-88/Reals.c +++ b/bootstrap/windows-88/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" diff --git a/bootstrap/windows-88/Reals.h b/bootstrap/windows-88/Reals.h index 3102ce18..76bda39d 100644 --- a/bootstrap/windows-88/Reals.h +++ b/bootstrap/windows-88/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/windows-88/SYSTEM.h b/bootstrap/windows-88/SYSTEM.h index 35620b9b..343404a4 100644 --- a/bootstrap/windows-88/SYSTEM.h +++ b/bootstrap/windows-88/SYSTEM.h @@ -60,12 +60,6 @@ typedef float REAL; typedef double LONGREAL; typedef void* SYSTEM_PTR; -// Unsigned variants are for use by shift and rotate macros. - -typedef unsigned char U_SYSTEM_BYTE; -typedef unsigned char U_CHAR; -typedef unsigned char U_SHORTINT; - // For 32 bit builds, the size of LONGINT depends on a make option: #if (__SIZEOF_POINTER__ == 8) || defined(LARGE) || defined(_WIN64) @@ -80,9 +74,20 @@ typedef unsigned char U_SHORTINT; typedef unsigned long U_LONGINT; #endif +// Unsigned variants are for use by shift and rotate macros. + +typedef unsigned char U_SYSTEM_BYTE; +typedef unsigned char U_CHAR; +typedef unsigned char U_SHORTINT; + typedef U_LONGINT SET; typedef U_LONGINT U_SET; +typedef SYSTEM_CARD8 U_SYSTEM_INT8; +typedef SYSTEM_CARD16 U_SYSTEM_INT16; +typedef SYSTEM_CARD32 U_SYSTEM_INT32; +typedef SYSTEM_CARD64 U_SYSTEM_INT64; + // OS Memory allocation interfaces are in PlatformXXX.Mod @@ -178,7 +183,7 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __ABSFD(x) SYSTEM_ABSD((double)(x)) #define __CAP(ch) ((CHAR)((ch)&0x5f)) #define __ODD(x) ((x)&1) -#define __IN(x, s) (((s)>>(x))&1) +#define __IN(x, s) ((x)>=0 && (x)<(8*sizeof(SET)) && ((((U_SET)(s))>>(x))&1)) #define __SETOF(x) ((SET)1<<(x)) #define __SETRNG(l, h) ((~(SET)0<<(l))&~(SET)0>>(8*sizeof(SET)-1-(h))) #define __MASK(x, m) ((x)&~(m)) diff --git a/bootstrap/windows-88/Strings.c b/bootstrap/windows-88/Strings.c index 2df49d25..bd57ef4e 100644 --- a/bootstrap/windows-88/Strings.c +++ b/bootstrap/windows-88/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" diff --git a/bootstrap/windows-88/Strings.h b/bootstrap/windows-88/Strings.h index 9505fe03..aa97eeac 100644 --- a/bootstrap/windows-88/Strings.h +++ b/bootstrap/windows-88/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/windows-88/Texts.c b/bootstrap/windows-88/Texts.c index 0e0b4725..cd9388a6 100644 --- a/bootstrap/windows-88/Texts.c +++ b/bootstrap/windows-88/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Files.h" diff --git a/bootstrap/windows-88/Texts.h b/bootstrap/windows-88/Texts.h index 3086fb00..b591e699 100644 --- a/bootstrap/windows-88/Texts.h +++ b/bootstrap/windows-88/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/windows-88/Vishap.c b/bootstrap/windows-88/Vishap.c index a487fe66..19624204 100644 --- a/bootstrap/windows-88/Vishap.c +++ b/bootstrap/windows-88/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkamSf */ #define LARGE #include "SYSTEM.h" #include "Configuration.h" diff --git a/bootstrap/windows-88/errors.c b/bootstrap/windows-88/errors.c index 8489752b..5493978e 100644 --- a/bootstrap/windows-88/errors.c +++ b/bootstrap/windows-88/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" diff --git a/bootstrap/windows-88/errors.h b/bootstrap/windows-88/errors.h index a5af5a7d..8ce5a106 100644 --- a/bootstrap/windows-88/errors.h +++ b/bootstrap/windows-88/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/windows-88/extTools.c b/bootstrap/windows-88/extTools.c index fce52835..72df4f99 100644 --- a/bootstrap/windows-88/extTools.c +++ b/bootstrap/windows-88/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Configuration.h" diff --git a/bootstrap/windows-88/extTools.h b/bootstrap/windows-88/extTools.h index 9e5aed51..4523936a 100644 --- a/bootstrap/windows-88/extTools.h +++ b/bootstrap/windows-88/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/windows-88/vt100.c b/bootstrap/windows-88/vt100.c index 0e0401e3..efcf43ab 100644 --- a/bootstrap/windows-88/vt100.c +++ b/bootstrap/windows-88/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "Console.h" diff --git a/bootstrap/windows-88/vt100.h b/bootstrap/windows-88/vt100.h index eb6374ea..65ae6d58 100644 --- a/bootstrap/windows-88/vt100.h +++ b/bootstrap/windows-88/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */ #ifndef vt100__h #define vt100__h diff --git a/src/compiler/OPB.Mod b/src/compiler/OPB.Mod index cfb983b5..000e1aef 100644 --- a/src/compiler/OPB.Mod +++ b/src/compiler/OPB.Mod @@ -1007,7 +1007,7 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *) |OPT.shortfn: (*SHORT*) IF (x^.class = OPT.Ntype) OR (x^.class = OPT.Nproc) THEN err(126) ELSIF f IN OPT.intSet THEN - typ := OPT.NextType(x.typ, -1); + typ := OPT.ShorterOrLongerType(x.typ, -1); IF typ = NIL THEN err(111) ELSE Convert(x, typ) END ELSIF f = OPT.LReal THEN Convert(x, OPT.realtyp) ELSE err(111) @@ -1015,7 +1015,7 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *) |OPT.longfn: (*LONG*) IF (x^.class = OPT.Ntype) OR (x^.class = OPT.Nproc) THEN err(126) ELSIF f IN OPT.intSet THEN - typ := OPT.NextType(x.typ, 1); + typ := OPT.ShorterOrLongerType(x.typ, 1); IF typ = NIL THEN err(111) ELSE Convert(x, typ) END ELSIF f = OPT.Real THEN Convert(x, OPT.lrltyp) ELSIF f = OPT.Char THEN Convert(x, OPT.linttyp) diff --git a/src/compiler/OPT.Mod b/src/compiler/OPT.Mod index e1b33ac3..efaac954 100644 --- a/src/compiler/OPT.Mod +++ b/src/compiler/OPT.Mod @@ -166,7 +166,7 @@ VAR SelfName*: OPS.Name; (* name of module being compiled *) SYSimported*: BOOLEAN; - NextSize: ARRAY 20 OF Struct; (* Lists integer types in SHORT/LONG ordering *) + IntTypes: ARRAY 20 OF Struct; (* Lists integer types in SHORT/LONG ordering *) CONST @@ -217,11 +217,11 @@ PROCEDURE IntType*(size: LONGINT): Struct; (* Selects smallest standard integer type for given size in bytes *) VAR i: INTEGER; BEGIN - i := 1; WHILE (NextSize[i].size < size) & (NextSize[i+1] # NIL) DO INC(i) END; - RETURN NextSize[i]; + i := 1; WHILE (IntTypes[i].size < size) & (IntTypes[i+1] # NIL) DO INC(i) END; + RETURN IntTypes[i]; END IntType; -PROCEDURE NextType*(x: Struct; dir: INTEGER): Struct; +PROCEDURE ShorterOrLongerType*(x: Struct; dir: INTEGER): Struct; VAR i: INTEGER; BEGIN ASSERT(x.form IN intSet); @@ -232,10 +232,10 @@ BEGIN (* WHILE x.BaseTyp # undftyp DO ASSERT(x # x.BaseTyp); ASSERT(x.BaseTyp # NIL); x := x.BaseTyp END; *) - i := 0; WHILE (NextSize[i] # x) & (i < LEN(NextSize)) DO INC(i) END; - ASSERT(i < LEN(NextSize)-1); - RETURN NextSize[i+dir] -END NextType; + i := 0; WHILE (IntTypes[i] # x) & (i < LEN(IntTypes)) DO INC(i) END; + ASSERT(i < LEN(IntTypes)-1); + RETURN IntTypes[i+dir] +END ShorterOrLongerType; @@ -705,18 +705,9 @@ END InTProc; PROCEDURE InTyp(tag: LONGINT): Struct; - VAR size: LONGINT; BEGIN IF tag IN intSet THEN - size := OPM.SymRInt(); - (* - IF size = 123456789 THEN (* Expected magic number while testing *) - size := OPM.SymRInt(); - ELSE - OPM.LogWLn; OPM.LogWStr("Missing constant magic number. size = "); OPM.LogWNum(size,1); - END; - *) - RETURN IntType(size) + RETURN IntType(OPM.SymRInt()) ELSE RETURN impCtxt.ref[tag] END @@ -728,8 +719,7 @@ PROCEDURE InStruct(VAR typ: Struct); t: Struct; obj, last, fld, old, dummy: Object; BEGIN tag := OPM.SymRInt(); - IF tag # Sstruct THEN - typ := impCtxt.ref[-tag] + IF tag # Sstruct THEN typ := InTyp(-tag) ELSE ref := impCtxt.nofr; INC(impCtxt.nofr); IF ref < impCtxt.minr THEN impCtxt.minr := ref END; @@ -804,7 +794,7 @@ BEGIN END; IF ref = impCtxt.minr THEN WHILE (ref < impCtxt.nofr) DO - t := impCtxt.ref[ref]; FPrintStr(t); + t := InTyp(ref); FPrintStr(t); obj := t^.strobj; (* obj^.typ^.strobj = obj, else obj^.fprint differs (alias) *) IF obj^.name # "" THEN FPrintObj(obj) END; old := impCtxt.old[ref]; @@ -998,7 +988,7 @@ END Import; END END OutFlds; - PROCEDURE OutSign(result: Struct; par: Object); + PROCEDURE OutSign(result: Struct; par: Object); (* Procedure signature *) BEGIN OutStr(result); WHILE par # NIL DO @@ -1010,7 +1000,7 @@ END Import; OPM.SymWInt(Send) END OutSign; - PROCEDURE OutTProcs(typ: Struct; obj: Object); + PROCEDURE OutTProcs(typ: Struct; obj: Object); (* Type bound procedures *) BEGIN IF obj # NIL THEN OutTProcs(typ, obj^.left); @@ -1033,18 +1023,11 @@ END Import; END END OutTProcs; - - PROCEDURE OutSize(size: LONGINT); - BEGIN - (* OPM.SymWInt(123456789); *) - OPM.SymWInt(size) - END OutSize; - - PROCEDURE OutStr(typ: Struct); (* OPV.TypeAlloc already applied *) VAR strobj: Object; BEGIN IF (typ^.ref < expCtxt.ref) THEN OPM.SymWInt(-typ^.ref); + IF typ.ref IN intSet THEN OPM.SymWInt(typ.size) END ELSE OPM.SymWInt(Sstruct); typ^.ref := expCtxt.ref; INC(expCtxt.ref); @@ -1091,7 +1074,7 @@ END Import; Char: OPM.SymWCh(CHR(obj^.conval^.intval)) | SInt, Int, - LInt: OPM.SymWInt(obj^.conval^.intval); OutSize(obj.typ.size) + LInt: OPM.SymWInt(obj^.conval^.intval); OPM.SymWInt(obj.typ.size) | Set: OPM.SymWSet(obj^.conval^.setval) | Real: rval := SHORT(obj^.conval^.realval); OPM.SymWReal(rval) | LReal: OPM.SymWLReal(obj^.conval^.realval) @@ -1280,14 +1263,14 @@ BEGIN topScope := NIL; OpenScope(0, NIL); OPM.errpos := 0; impCtxt.ref[NoTyp] := notyp; impCtxt.ref[Pointer] := sysptrtyp; - NextSize[1] := sinttyp; - NextSize[2] := inttyp; - NextSize[3] := linttyp; + IntTypes[1] := sinttyp; + IntTypes[2] := inttyp; + IntTypes[3] := linttyp; - NextSize[5] := int8typ; - NextSize[6] := int16typ; - NextSize[7] := int32typ; - NextSize[8] := int64typ + IntTypes[5] := int8typ; + IntTypes[6] := int16typ; + IntTypes[7] := int32typ; + IntTypes[8] := int64typ END OPT. diff --git a/src/compiler/OPV.Mod b/src/compiler/OPV.Mod index 7518f811..a3e2272d 100644 --- a/src/compiler/OPV.Mod +++ b/src/compiler/OPV.Mod @@ -624,7 +624,7 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96 IF SideEffects(n) THEN OPM.WriteString("__MODF(") ELSE OPM.WriteString("__MOD(") END; - ELSE OPM.LogWStr("unhandled case in OPV.expr, subclass = "); OPM.LogWNum(subclass, 0); OPM.LogWLn; + ELSE OPM.LogWStr("unhandled case in OPV.expr, subclass = "); OPM.LogWNum(subclass, 0); OPM.LogWLn; END ; expr(l, MinPrec); OPM.WriteString(Comma); diff --git a/src/system/SYSTEM.h b/src/system/SYSTEM.h index 216af910..343404a4 100644 --- a/src/system/SYSTEM.h +++ b/src/system/SYSTEM.h @@ -183,7 +183,7 @@ static int __str_cmp(CHAR *x, CHAR *y){ #define __ABSFD(x) SYSTEM_ABSD((double)(x)) #define __CAP(ch) ((CHAR)((ch)&0x5f)) #define __ODD(x) ((x)&1) -#define __IN(x, s) (((s)>>(x))&1) +#define __IN(x, s) ((x)>=0 && (x)<(8*sizeof(SET)) && ((((U_SET)(s))>>(x))&1)) #define __SETOF(x) ((SET)1<<(x)) #define __SETRNG(l, h) ((~(SET)0<<(l))&~(SET)0>>(8*sizeof(SET)-1-(h))) #define __MASK(x, m) ((x)&~(m)) diff --git a/src/test/confidence/testresult.sh b/src/test/confidence/testresult.sh index bdfcccfe..2dfd8a34 100755 --- a/src/test/confidence/testresult.sh +++ b/src/test/confidence/testresult.sh @@ -7,8 +7,8 @@ fi # Compare generated code if [ -f new.asm ] -#then egrep '^[0-9 ]{4} ([0-9a-f]{4}| ) [0-9A-F]{2}[0-9A-F ]{6}' new.asm|cut -c 11- >new.$FLAVOUR.$BRANCH.s -then sed -n '/^ *[0-9]\+ \([0-9a-f]\{4\}\| \) [0-9A-F]\{2\}[0-9A-F ]\{6\}/s/^ *[0-9]\+ ....//p' new.asm>new.$FLAVOUR.$BRANCH.s +#then sed -n '/^ *[0-9]\+ \([0-9a-f]\{4\}\| \) [0-9A-F]\{2\}[0-9A-F ]\{6\}/s/^ *[0-9]\+ ....//p' new.asm>new.$FLAVOUR.$BRANCH.s +then sed -n '/^ *[0-9]\+ \([0-9a-f]\{4\}\| \) [0-9A-F]\{2\}[0-9A-F ]\{6\}/s/^ *[0-9]\+ ....//p' new.asm | sed 's/_m.[0-9]\+/_m.xxx/' >new.$FLAVOUR.$BRANCH.s if [ -f old.$FLAVOUR.$BRANCH.s -a old.$FLAVOUR.$BRANCH.s -nt ../planned-binary-change ] then