diff --git a/bootstrap/unix-44/Configuration.c b/bootstrap/unix-44/Configuration.c index 2fda7317..36e599bd 100644 --- a/bootstrap/unix-44/Configuration.c +++ b/bootstrap/unix-44/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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/13] for gcc LP64 on cygwin", Configuration_versionLong, 41); + __MOVE("1.95 [2016/08/16] for gcc LP64 on cygwin", Configuration_versionLong, 41); __ENDMOD; } diff --git a/bootstrap/unix-44/Configuration.h b/bootstrap/unix-44/Configuration.h index c67723f0..9712e1ee 100644 --- a/bootstrap/unix-44/Configuration.h +++ b/bootstrap/unix-44/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 3a1202fd..e6b9c126 100644 --- a/bootstrap/unix-44/Console.c +++ b/bootstrap/unix-44/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 98c3ffbb..06f26feb 100644 --- a/bootstrap/unix-44/Console.h +++ b/bootstrap/unix-44/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 9ddec6db..e0c81e49 100644 --- a/bootstrap/unix-44/Files.c +++ b/bootstrap/unix-44/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/16] 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 00151b5b..6cbf6d8f 100644 --- a/bootstrap/unix-44/Files.h +++ b/bootstrap/unix-44/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/16] 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 b06aa205..2383245d 100644 --- a/bootstrap/unix-44/Heap.c +++ b/bootstrap/unix-44/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/16] 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 2e607154..03e3bc31 100644 --- a/bootstrap/unix-44/Heap.h +++ b/bootstrap/unix-44/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/16] 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 b7445042..558cd58f 100644 --- a/bootstrap/unix-44/Modules.c +++ b/bootstrap/unix-44/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 69c32c2e..cf536137 100644 --- a/bootstrap/unix-44/Modules.h +++ b/bootstrap/unix-44/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 d2c67317..170446bd 100644 --- a/bootstrap/unix-44/OPB.c +++ b/bootstrap/unix-44/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPM.h" #include "OPS.h" @@ -34,6 +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); export void OPB_MOp (SHORTINT op, OPT_Node *x); export OPT_Node OPB_NewBoolConst (BOOLEAN boolval); @@ -51,6 +52,9 @@ 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 INTEGER OPB_SignedByteSize (LONGINT n); +static LONGINT OPB_SignedMaximum (LONGINT bytecount); +static LONGINT OPB_SignedMinimum (LONGINT bytecount); 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); @@ -220,21 +224,46 @@ OPT_Node OPB_EmptySet (void) return _o_result; } +static INTEGER OPB_SignedByteSize (LONGINT n) +{ + INTEGER _o_result; + INTEGER b; + if (n < 0) { + n = -(n + 1); + } + b = 1; + while (b < 8) { + if (__ASH(n, -(__ASHL(b, 3) - 1)) == 0) { + _o_result = b; + return _o_result; + } + b += 1; + } + _o_result = 8; + return _o_result; +} + +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) { - LONGINT v; - v = node->conval->intval; - if ((OPM_MinSInt <= (LONGINT)v && (LONGINT)v <= OPM_MaxSInt)) { - node->typ = OPT_sinttyp; - } else if ((OPM_MinInt <= (LONGINT)v && (LONGINT)v <= OPM_MaxInt)) { - node->typ = OPT_inttyp; - } else if ((OPM_MinLInt <= v && v <= OPM_MaxLInt)) { - node->typ = OPT_linttyp; - } else { - OPB_err(203); - node->typ = OPT_sinttyp; - node->conval->intval = 1; - } + node->typ = OPB_IntType(OPB_SignedByteSize(node->conval->intval)); } OPT_Node OPB_NewIntConst (LONGINT intval) @@ -378,16 +407,16 @@ void OPB_Field (OPT_Node *x, OPT_Object y) } } -static struct TypTest__57 { +static struct TypTest__61 { OPT_Node *x; OPT_Object *obj; BOOLEAN *guard; - struct TypTest__57 *lnk; -} *TypTest__57_s; + struct TypTest__61 *lnk; +} *TypTest__61_s; -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) +static void GTT__62 (OPT_Struct t0, OPT_Struct t1) { OPT_Node node = NIL; OPT_Struct t = NIL; @@ -400,54 +429,54 @@ static void GTT__58 (OPT_Struct t0, OPT_Struct t1) t1 = t1->BaseTyp; } if (t1 == t0 || t0->form == 0) { - if (*TypTest__57_s->guard) { - OPB_BindNodes(5, NIL, &*TypTest__57_s->x, NIL); - (*TypTest__57_s->x)->readonly = (*TypTest__57_s->x)->left->readonly; + if (*TypTest__61_s->guard) { + OPB_BindNodes(5, NIL, &*TypTest__61_s->x, NIL); + (*TypTest__61_s->x)->readonly = (*TypTest__61_s->x)->left->readonly; } else { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__57_s->x; - node->obj = *TypTest__57_s->obj; - *TypTest__57_s->x = node; + node->left = *TypTest__61_s->x; + node->obj = *TypTest__61_s->obj; + *TypTest__61_s->x = node; } } else { OPB_err(85); } } else if (t0 != t1) { OPB_err(85); - } else if (!*TypTest__57_s->guard) { - if ((*TypTest__57_s->x)->class == 5) { + } else if (!*TypTest__61_s->guard) { + if ((*TypTest__61_s->x)->class == 5) { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__57_s->x; - node->obj = *TypTest__57_s->obj; - *TypTest__57_s->x = node; + node->left = *TypTest__61_s->x; + node->obj = *TypTest__61_s->obj; + *TypTest__61_s->x = node; } else { - *TypTest__57_s->x = OPB_NewBoolConst(1); + *TypTest__61_s->x = OPB_NewBoolConst(1); } } } void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) { - struct TypTest__57 _s; + struct TypTest__61 _s; _s.x = x; _s.obj = &obj; _s.guard = &guard; - _s.lnk = TypTest__57_s; - TypTest__57_s = &_s; + _s.lnk = TypTest__61_s; + TypTest__61_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__58((*x)->typ->BaseTyp, obj->typ->BaseTyp); + GTT__62((*x)->typ->BaseTyp, obj->typ->BaseTyp); } else { OPB_err(86); } } else if (((((*x)->typ->comp == 4 && (*x)->class == 1)) && obj->typ->comp == 4)) { - GTT__58((*x)->typ, obj->typ); + GTT__62((*x)->typ, obj->typ); } else { OPB_err(87); } @@ -456,7 +485,7 @@ void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) } else { (*x)->typ = OPT_booltyp; } - TypTest__57_s = _s.lnk; + TypTest__61_s = _s.lnk; } void OPB_In (OPT_Node *x, OPT_Node y) @@ -522,13 +551,13 @@ static void OPB_CheckRealType (INTEGER f, INTEGER nr, OPT_Const x) x->intval = -1; } -static struct MOp__28 { - struct MOp__28 *lnk; -} *MOp__28_s; +static struct MOp__29 { + struct MOp__29 *lnk; +} *MOp__29_s; -static OPT_Node NewOp__29 (SHORTINT op, OPT_Struct typ, OPT_Node z); +static OPT_Node NewOp__30 (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__30 (SHORTINT op, OPT_Struct typ, OPT_Node z) { OPT_Node _o_result; OPT_Node node = NIL; @@ -545,9 +574,9 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) INTEGER f; OPT_Struct typ = NIL; OPT_Node z = NIL; - struct MOp__28 _s; - _s.lnk = MOp__28_s; - MOp__28_s = &_s; + struct MOp__29 _s; + _s.lnk = MOp__29_s; + MOp__29_s = &_s; z = *x; if (z->class == 8 || z->class == 9) { OPB_err(126); @@ -561,7 +590,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__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(98); @@ -589,7 +618,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } z->obj = NIL; } else { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(97); @@ -610,7 +639,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } z->obj = NIL; } else { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(111); @@ -622,7 +651,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = (int)__CAP((CHAR)z->conval->intval); z->obj = NIL; } else { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(111); @@ -635,7 +664,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = OPB_BoolToInt(__ODD(z->conval->intval)); z->obj = NIL; } else { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(111); @@ -648,7 +677,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) f = 10; } if (z->class < 7 || f == 10) { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } else { OPB_err(127); } @@ -657,7 +686,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__29(op, typ, z); + z = NewOp__30(op, typ, z); } else { OPB_err(219); } @@ -674,7 +703,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } } *x = z; - MOp__28_s = _s.lnk; + MOp__29_s = _s.lnk; } static void OPB_CheckPtr (OPT_Node x, OPT_Node y) @@ -865,41 +894,13 @@ static void OPB_ConstOp (INTEGER op, OPT_Node x, OPT_Node y) __GUARDEQP(yval, OPT_ConstDesc) = *xval; } break; - case 4: + case 4: case 5: case 6: if (__IN(g, 0x70)) { - x->typ = y->typ; - } else if (g == 7) { - x->typ = OPT_realtyp; - xval->realval = xval->intval; - } else if (g == 8) { - x->typ = OPT_lrltyp; - xval->realval = xval->intval; - } else { - OPB_err(100); - y->typ = x->typ; - __GUARDEQP(yval, OPT_ConstDesc) = *xval; - } - break; - case 5: - if (g == 4) { - y->typ = OPT_inttyp; - } else if (__IN(g, 0x70)) { - x->typ = y->typ; - } else if (g == 7) { - x->typ = OPT_realtyp; - xval->realval = xval->intval; - } else if (g == 8) { - x->typ = OPT_lrltyp; - xval->realval = xval->intval; - } else { - OPB_err(100); - y->typ = x->typ; - __GUARDEQP(yval, OPT_ConstDesc) = *xval; - } - break; - case 6: - if (__IN(g, 0x70)) { - y->typ = OPT_linttyp; + if (x->typ->size <= y->typ->size) { + x->typ = y->typ; + } else { + x->typ = OPB_IntType(x->typ->size); + } } else if (g == 7) { x->typ = OPT_realtyp; xval->realval = xval->intval; @@ -1196,15 +1197,15 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) (*x)->typ = typ; } -static struct Op__38 { +static struct Op__39 { INTEGER *f, *g; - struct Op__38 *lnk; -} *Op__38_s; + struct Op__39 *lnk; +} *Op__39_s; -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__40 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y); +static BOOLEAN strings__42 (OPT_Node *x, OPT_Node *y); -static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) +static void NewOp__40 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) { OPT_Node node = NIL; node = OPT_NewNode(12); @@ -1215,29 +1216,29 @@ static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) *x = node; } -static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y) +static BOOLEAN strings__42 (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__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)) { + xCharArr = (__IN((*x)->typ->comp, 0x0c) && (*x)->typ->BaseTyp->form == 3) || *Op__39_s->f == 10; + yCharArr = (__IN((*y)->typ->comp, 0x0c) && (*y)->typ->BaseTyp->form == 3) || *Op__39_s->g == 10; + if ((((xCharArr && *Op__39_s->g == 3)) && (*y)->class == 7)) { OPB_CharToString(*y); - *Op__38_s->g = 10; + *Op__39_s->g = 10; yCharArr = 1; } - if ((((yCharArr && *Op__38_s->f == 3)) && (*x)->class == 7)) { + if ((((yCharArr && *Op__39_s->f == 3)) && (*x)->class == 7)) { OPB_CharToString(*x); - *Op__38_s->f = 10; + *Op__39_s->f = 10; xCharArr = 1; } ok = (xCharArr && yCharArr); if (ok) { - if ((*Op__38_s->f == 10 && (*x)->conval->intval2 == 1)) { + if ((*Op__39_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__38_s->g == 10 && (*y)->conval->intval2 == 1)) { + } else if ((*Op__39_s->g == 10 && (*y)->conval->intval2 == 1)) { (*y)->typ = OPT_chartyp; (*y)->conval->intval = 0; OPB_Index(&*x, OPB_NewIntConst(((LONGINT)(0)))); @@ -1254,11 +1255,11 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPT_Struct typ = NIL; BOOLEAN do_; LONGINT val; - struct Op__38 _s; + struct Op__39 _s; _s.f = &f; _s.g = &g; - _s.lnk = Op__38_s; - Op__38_s = &_s; + _s.lnk = Op__39_s; + Op__39_s = &_s; z = *x; if (((z->class == 8 || z->class == 9) || y->class == 8) || y->class == 9) { OPB_err(126); @@ -1276,15 +1277,8 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(100); } break; - case 4: - if (__IN(g, 0x01f0)) { - OPB_Convert(&z, y->typ); - } else { - OPB_err(100); - } - break; - case 5: - if (g == 4) { + case 4: case 5: case 6: + if ((__IN(g, 0x70) && y->typ->size < z->typ->size)) { OPB_Convert(&y, z->typ); } else if (__IN(g, 0x01f0)) { OPB_Convert(&z, y->typ); @@ -1292,15 +1286,6 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(100); } break; - case 6: - if (__IN(g, 0x70)) { - OPB_Convert(&y, z->typ); - } else if (__IN(g, 0x0180)) { - OPB_Convert(&z, y->typ); - } else { - OPB_err(100); - } - break; case 7: if (__IN(g, 0x70)) { OPB_Convert(&y, z->typ); @@ -1386,7 +1371,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if (do_) { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } break; case 2: @@ -1405,7 +1390,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(102); typ = OPT_undftyp; } - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); break; case 3: do_ = 1; @@ -1428,7 +1413,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if (do_) { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } break; case 4: @@ -1446,7 +1431,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(104); typ = OPT_undftyp; } - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); break; case 5: if (f == 2) { @@ -1456,7 +1441,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } else if ((y->class == 7 && OPB_IntToBool(y->conval->intval))) { } else { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } } else if (f != 0) { OPB_err(94); @@ -1479,7 +1464,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } if (do_) { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } break; case 7: @@ -1488,7 +1473,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__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } break; case 8: @@ -1499,7 +1484,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } else if ((y->class == 7 && !OPB_IntToBool(y->conval->intval))) { } else { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } } else if (f != 0) { OPB_err(95); @@ -1507,16 +1492,16 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } break; case 9: case 10: - if (__IN(f, 0x6bff) || strings__41(&z, &y)) { + if (__IN(f, 0x6bff) || strings__42(&z, &y)) { typ = OPT_booltyp; } else { OPB_err(107); typ = OPT_undftyp; } - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); break; case 11: case 12: case 13: case 14: - if (__IN(f, 0x01f9) || strings__41(&z, &y)) { + if (__IN(f, 0x01f9) || strings__42(&z, &y)) { typ = OPT_booltyp; } else { OPM_LogWLn(); @@ -1525,7 +1510,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(108); typ = OPT_undftyp; } - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); break; default: OPM_LogWStr((CHAR*)"unhandled case in OPB.Op, op = ", (LONGINT)32); @@ -1535,7 +1520,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } *x = z; - Op__38_s = _s.lnk; + Op__39_s = _s.lnk; } void OPB_SetRange (OPT_Node *x, OPT_Node y) @@ -1632,18 +1617,13 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) OPB_err(113); } break; - case 2: case 3: case 4: case 9: + case 2: case 3: case 9: if (g != f) { OPB_err(113); } break; - case 5: - if (!__IN(g, 0x30)) { - OPB_err(113); - } - break; - case 6: - if (!__IN(g, 0x70)) { + case 4: case 5: case 6: + if (!__IN(g, 0x70) || x->size < y->size) { OPB_err(113); } break; @@ -1745,6 +1725,23 @@ static void OPB_CheckLeaf (OPT_Node x, BOOLEAN dynArrToo) { } +static LONGINT OPB_SignedMaximum (LONGINT bytecount) +{ + LONGINT _o_result; + LONGINT result; + result = 1; + result = __LSH(result, __ASHL(bytecount, 3) - 1, LONGINT); + _o_result = result - 1; + return _o_result; +} + +static LONGINT OPB_SignedMinimum (LONGINT bytecount) +{ + LONGINT _o_result; + _o_result = -OPB_SignedMaximum(bytecount) - 1; + return _o_result; +} + void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) { INTEGER f; @@ -1827,14 +1824,8 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) x = OPB_NewIntConst(((LONGINT)(0))); x->typ = OPT_chartyp; break; - case 4: - x = OPB_NewIntConst(OPM_MinSInt); - break; - case 5: - x = OPB_NewIntConst(OPM_MinInt); - break; - case 6: - x = OPB_NewIntConst(OPM_MinLInt); + case 4: case 5: case 6: + x = OPB_NewIntConst(OPB_SignedMinimum(x->typ->size)); break; case 9: x = OPB_NewIntConst(((LONGINT)(0))); @@ -1864,14 +1855,8 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) x = OPB_NewIntConst(((LONGINT)(255))); x->typ = OPT_chartyp; break; - case 4: - x = OPB_NewIntConst(OPM_MaxSInt); - break; - case 5: - x = OPB_NewIntConst(OPM_MaxInt); - break; - case 6: - x = OPB_NewIntConst(OPM_MaxLInt); + case 4: case 5: case 6: + x = OPB_NewIntConst(OPB_SignedMaximum(x->typ->size)); break; case 9: x = OPB_NewIntConst(OPM_MaxSet); @@ -2057,13 +2042,13 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) *par0 = x; } -static struct StPar1__52 { - struct StPar1__52 *lnk; -} *StPar1__52_s; +static struct StPar1__56 { + struct StPar1__56 *lnk; +} *StPar1__56_s; -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) +static OPT_Node NewOp__57 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right) { OPT_Node _o_result; OPT_Node node = NIL; @@ -2080,9 +2065,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__52 _s; - _s.lnk = StPar1__52_s; - StPar1__52_s = &_s; + struct StPar1__56 _s; + _s.lnk = StPar1__56_s; + StPar1__56_s = &_s; p = *par0; f = x->typ->form; switch (fctno) { @@ -2098,7 +2083,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) OPB_err(111); } } - p = NewOp__53(19, fctno, p, x); + p = NewOp__57(19, fctno, p, x); p->typ = OPT_notyp; } break; @@ -2109,7 +2094,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (LONGINT)OPM_MaxSet))) { OPB_err(202); } - p = NewOp__53(19, fctno, p, x); + p = NewOp__57(19, fctno, p, x); } else { OPB_err(111); } @@ -2118,7 +2103,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) case 17: if (!__IN(f, 0x70) || x->class != 7) { OPB_err(69); - } else if (f == 4) { + } else if (x->typ->size == 1) { L = (int)x->conval->intval; typ = p->typ; while ((L > 0 && __IN(typ->comp, 0x0c))) { @@ -2134,7 +2119,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) p = p->left; x->conval->intval += 1; } - p = NewOp__53(12, 19, p, x); + p = NewOp__57(12, 19, p, x); p->typ = OPT_linttyp; } else { p = x; @@ -2156,7 +2141,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) t = x; x = p; p = t; - p = NewOp__53(19, 18, p, x); + p = NewOp__57(19, 18, p, x); } else { OPB_err(111); } @@ -2182,7 +2167,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) } p->obj = NIL; } else { - p = NewOp__53(12, 17, p, x); + p = NewOp__57(12, 17, p, x); p->typ = OPT_linttyp; } } else { @@ -2213,9 +2198,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) OPB_err(111); } else { if (fctno == 22) { - p = NewOp__53(12, 27, p, x); + p = NewOp__57(12, 27, p, x); } else { - p = NewOp__53(12, 28, p, x); + p = NewOp__57(12, 28, p, x); } p->typ = p->left->typ; } @@ -2232,7 +2217,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) x = p; p = t; } - p = NewOp__53(19, fctno, p, x); + p = NewOp__57(19, fctno, p, x); } else { OPB_err(111); } @@ -2242,7 +2227,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__53(12, 26, p, x); + p = NewOp__57(12, 26, p, x); } else { OPB_err(111); } @@ -2263,7 +2248,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__53(19, 30, p, x); + p = NewOp__57(19, 30, p, x); } else { OPB_err(111); } @@ -2309,7 +2294,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) break; } *par0 = p; - StPar1__52_s = _s.lnk; + StPar1__56_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 1f8facf4..4de09d08 100644 --- a/bootstrap/unix-44/OPB.h +++ b/bootstrap/unix-44/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 ef8689fc..beb2a994 100644 --- a/bootstrap/unix-44/OPC.c +++ b/bootstrap/unix-44/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 c9862e14..70e642a0 100644 --- a/bootstrap/unix-44/OPC.h +++ b/bootstrap/unix-44/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 d8f72c90..1d0fcc55 100644 --- a/bootstrap/unix-44/OPM.c +++ b/bootstrap/unix-44/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 b7ccaa8c..b813f21a 100644 --- a/bootstrap/unix-44/OPM.h +++ b/bootstrap/unix-44/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 35e12b80..0b912709 100644 --- a/bootstrap/unix-44/OPP.c +++ b/bootstrap/unix-44/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPB.h" #include "OPM.h" diff --git a/bootstrap/unix-44/OPP.h b/bootstrap/unix-44/OPP.h index 6ece1008..2de55e8b 100644 --- a/bootstrap/unix-44/OPP.h +++ b/bootstrap/unix-44/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 0c19bed7..9ee4c536 100644 --- a/bootstrap/unix-44/OPS.c +++ b/bootstrap/unix-44/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/16] 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 9cf75700..7f4d049d 100644 --- a/bootstrap/unix-44/OPS.h +++ b/bootstrap/unix-44/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/16] 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 3bbdb55e..898af6d0 100644 --- a/bootstrap/unix-44/OPT.c +++ b/bootstrap/unix-44/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPM.h" #include "OPS.h" diff --git a/bootstrap/unix-44/OPT.h b/bootstrap/unix-44/OPT.h index d5063407..1346d74e 100644 --- a/bootstrap/unix-44/OPT.h +++ b/bootstrap/unix-44/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/unix-44/OPV.c b/bootstrap/unix-44/OPV.c index b0b70038..9699164e 100644 --- a/bootstrap/unix-44/OPV.c +++ b/bootstrap/unix-44/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 1498c5e1..e31b63fe 100644 --- a/bootstrap/unix-44/OPV.h +++ b/bootstrap/unix-44/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 47bc2d3e..da8c75d2 100644 --- a/bootstrap/unix-44/Platform.c +++ b/bootstrap/unix-44/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 657985ac..f1a0d63f 100644 --- a/bootstrap/unix-44/Platform.h +++ b/bootstrap/unix-44/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 e2eb8b86..fe1db847 100644 --- a/bootstrap/unix-44/Reals.c +++ b/bootstrap/unix-44/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" diff --git a/bootstrap/unix-44/Reals.h b/bootstrap/unix-44/Reals.h index 5eeb8c59..6f9b9ca8 100644 --- a/bootstrap/unix-44/Reals.h +++ b/bootstrap/unix-44/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 949951ac..2941064e 100644 --- a/bootstrap/unix-44/SYSTEM.h +++ b/bootstrap/unix-44/SYSTEM.h @@ -4,6 +4,8 @@ #ifndef _WIN32 // Building for a Unix/Linux based system + + // TODO: Remove these includes #include // For memcpy ... #include // For uintptr_t ... @@ -70,6 +72,7 @@ typedef unsigned char U_SHORTINT; #endif typedef U_LONGINT SET; +typedef U_LONGINT U_SET; // OS Memory allocation interfaces are in PlatformXXX.Mod diff --git a/bootstrap/unix-44/Strings.c b/bootstrap/unix-44/Strings.c index c85628da..d944f9bc 100644 --- a/bootstrap/unix-44/Strings.c +++ b/bootstrap/unix-44/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" diff --git a/bootstrap/unix-44/Strings.h b/bootstrap/unix-44/Strings.h index 788bc149..43c4284d 100644 --- a/bootstrap/unix-44/Strings.h +++ b/bootstrap/unix-44/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 d1f05b6c..bcd72091 100644 --- a/bootstrap/unix-44/Texts.c +++ b/bootstrap/unix-44/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 c587606b..36073bc7 100644 --- a/bootstrap/unix-44/Texts.h +++ b/bootstrap/unix-44/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 acd3d9fa..c2ec4928 100644 --- a/bootstrap/unix-44/Vishap.c +++ b/bootstrap/unix-44/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/08/16] 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 07eb8447..31ec3cc6 100644 --- a/bootstrap/unix-44/errors.c +++ b/bootstrap/unix-44/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" typedef @@ -194,5 +194,6 @@ export void *errors__init(void) __MOVE("implicit type cast", errors_errors[301], 19); __MOVE("inappropriate symbol file ignored", errors_errors[306], 34); __MOVE("no ELSE symbol after CASE statement sequence may lead to trap", errors_errors[307], 62); + __MOVE("SYSTEM.VAL result includes memory past end of source variable", errors_errors[308], 62); __ENDMOD; } diff --git a/bootstrap/unix-44/errors.h b/bootstrap/unix-44/errors.h index c1acc3e7..3270e9f8 100644 --- a/bootstrap/unix-44/errors.h +++ b/bootstrap/unix-44/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 f6a31f58..3cad087d 100644 --- a/bootstrap/unix-44/extTools.c +++ b/bootstrap/unix-44/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 2848d260..191d54b2 100644 --- a/bootstrap/unix-44/extTools.h +++ b/bootstrap/unix-44/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 8bb3888c..d8bd7a49 100644 --- a/bootstrap/unix-44/vt100.c +++ b/bootstrap/unix-44/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 1194b358..9d09c058 100644 --- a/bootstrap/unix-44/vt100.h +++ b/bootstrap/unix-44/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 2fda7317..36e599bd 100644 --- a/bootstrap/unix-48/Configuration.c +++ b/bootstrap/unix-48/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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/13] for gcc LP64 on cygwin", Configuration_versionLong, 41); + __MOVE("1.95 [2016/08/16] for gcc LP64 on cygwin", Configuration_versionLong, 41); __ENDMOD; } diff --git a/bootstrap/unix-48/Configuration.h b/bootstrap/unix-48/Configuration.h index c67723f0..9712e1ee 100644 --- a/bootstrap/unix-48/Configuration.h +++ b/bootstrap/unix-48/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 3a1202fd..e6b9c126 100644 --- a/bootstrap/unix-48/Console.c +++ b/bootstrap/unix-48/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 98c3ffbb..06f26feb 100644 --- a/bootstrap/unix-48/Console.h +++ b/bootstrap/unix-48/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 9ddec6db..e0c81e49 100644 --- a/bootstrap/unix-48/Files.c +++ b/bootstrap/unix-48/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/16] 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 00151b5b..6cbf6d8f 100644 --- a/bootstrap/unix-48/Files.h +++ b/bootstrap/unix-48/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/16] 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 b06aa205..2383245d 100644 --- a/bootstrap/unix-48/Heap.c +++ b/bootstrap/unix-48/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/16] 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 2e607154..03e3bc31 100644 --- a/bootstrap/unix-48/Heap.h +++ b/bootstrap/unix-48/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/16] 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 b7445042..558cd58f 100644 --- a/bootstrap/unix-48/Modules.c +++ b/bootstrap/unix-48/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 69c32c2e..cf536137 100644 --- a/bootstrap/unix-48/Modules.h +++ b/bootstrap/unix-48/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 d2c67317..170446bd 100644 --- a/bootstrap/unix-48/OPB.c +++ b/bootstrap/unix-48/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPM.h" #include "OPS.h" @@ -34,6 +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); export void OPB_MOp (SHORTINT op, OPT_Node *x); export OPT_Node OPB_NewBoolConst (BOOLEAN boolval); @@ -51,6 +52,9 @@ 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 INTEGER OPB_SignedByteSize (LONGINT n); +static LONGINT OPB_SignedMaximum (LONGINT bytecount); +static LONGINT OPB_SignedMinimum (LONGINT bytecount); 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); @@ -220,21 +224,46 @@ OPT_Node OPB_EmptySet (void) return _o_result; } +static INTEGER OPB_SignedByteSize (LONGINT n) +{ + INTEGER _o_result; + INTEGER b; + if (n < 0) { + n = -(n + 1); + } + b = 1; + while (b < 8) { + if (__ASH(n, -(__ASHL(b, 3) - 1)) == 0) { + _o_result = b; + return _o_result; + } + b += 1; + } + _o_result = 8; + return _o_result; +} + +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) { - LONGINT v; - v = node->conval->intval; - if ((OPM_MinSInt <= (LONGINT)v && (LONGINT)v <= OPM_MaxSInt)) { - node->typ = OPT_sinttyp; - } else if ((OPM_MinInt <= (LONGINT)v && (LONGINT)v <= OPM_MaxInt)) { - node->typ = OPT_inttyp; - } else if ((OPM_MinLInt <= v && v <= OPM_MaxLInt)) { - node->typ = OPT_linttyp; - } else { - OPB_err(203); - node->typ = OPT_sinttyp; - node->conval->intval = 1; - } + node->typ = OPB_IntType(OPB_SignedByteSize(node->conval->intval)); } OPT_Node OPB_NewIntConst (LONGINT intval) @@ -378,16 +407,16 @@ void OPB_Field (OPT_Node *x, OPT_Object y) } } -static struct TypTest__57 { +static struct TypTest__61 { OPT_Node *x; OPT_Object *obj; BOOLEAN *guard; - struct TypTest__57 *lnk; -} *TypTest__57_s; + struct TypTest__61 *lnk; +} *TypTest__61_s; -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) +static void GTT__62 (OPT_Struct t0, OPT_Struct t1) { OPT_Node node = NIL; OPT_Struct t = NIL; @@ -400,54 +429,54 @@ static void GTT__58 (OPT_Struct t0, OPT_Struct t1) t1 = t1->BaseTyp; } if (t1 == t0 || t0->form == 0) { - if (*TypTest__57_s->guard) { - OPB_BindNodes(5, NIL, &*TypTest__57_s->x, NIL); - (*TypTest__57_s->x)->readonly = (*TypTest__57_s->x)->left->readonly; + if (*TypTest__61_s->guard) { + OPB_BindNodes(5, NIL, &*TypTest__61_s->x, NIL); + (*TypTest__61_s->x)->readonly = (*TypTest__61_s->x)->left->readonly; } else { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__57_s->x; - node->obj = *TypTest__57_s->obj; - *TypTest__57_s->x = node; + node->left = *TypTest__61_s->x; + node->obj = *TypTest__61_s->obj; + *TypTest__61_s->x = node; } } else { OPB_err(85); } } else if (t0 != t1) { OPB_err(85); - } else if (!*TypTest__57_s->guard) { - if ((*TypTest__57_s->x)->class == 5) { + } else if (!*TypTest__61_s->guard) { + if ((*TypTest__61_s->x)->class == 5) { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__57_s->x; - node->obj = *TypTest__57_s->obj; - *TypTest__57_s->x = node; + node->left = *TypTest__61_s->x; + node->obj = *TypTest__61_s->obj; + *TypTest__61_s->x = node; } else { - *TypTest__57_s->x = OPB_NewBoolConst(1); + *TypTest__61_s->x = OPB_NewBoolConst(1); } } } void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) { - struct TypTest__57 _s; + struct TypTest__61 _s; _s.x = x; _s.obj = &obj; _s.guard = &guard; - _s.lnk = TypTest__57_s; - TypTest__57_s = &_s; + _s.lnk = TypTest__61_s; + TypTest__61_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__58((*x)->typ->BaseTyp, obj->typ->BaseTyp); + GTT__62((*x)->typ->BaseTyp, obj->typ->BaseTyp); } else { OPB_err(86); } } else if (((((*x)->typ->comp == 4 && (*x)->class == 1)) && obj->typ->comp == 4)) { - GTT__58((*x)->typ, obj->typ); + GTT__62((*x)->typ, obj->typ); } else { OPB_err(87); } @@ -456,7 +485,7 @@ void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) } else { (*x)->typ = OPT_booltyp; } - TypTest__57_s = _s.lnk; + TypTest__61_s = _s.lnk; } void OPB_In (OPT_Node *x, OPT_Node y) @@ -522,13 +551,13 @@ static void OPB_CheckRealType (INTEGER f, INTEGER nr, OPT_Const x) x->intval = -1; } -static struct MOp__28 { - struct MOp__28 *lnk; -} *MOp__28_s; +static struct MOp__29 { + struct MOp__29 *lnk; +} *MOp__29_s; -static OPT_Node NewOp__29 (SHORTINT op, OPT_Struct typ, OPT_Node z); +static OPT_Node NewOp__30 (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__30 (SHORTINT op, OPT_Struct typ, OPT_Node z) { OPT_Node _o_result; OPT_Node node = NIL; @@ -545,9 +574,9 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) INTEGER f; OPT_Struct typ = NIL; OPT_Node z = NIL; - struct MOp__28 _s; - _s.lnk = MOp__28_s; - MOp__28_s = &_s; + struct MOp__29 _s; + _s.lnk = MOp__29_s; + MOp__29_s = &_s; z = *x; if (z->class == 8 || z->class == 9) { OPB_err(126); @@ -561,7 +590,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__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(98); @@ -589,7 +618,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } z->obj = NIL; } else { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(97); @@ -610,7 +639,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } z->obj = NIL; } else { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(111); @@ -622,7 +651,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = (int)__CAP((CHAR)z->conval->intval); z->obj = NIL; } else { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(111); @@ -635,7 +664,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = OPB_BoolToInt(__ODD(z->conval->intval)); z->obj = NIL; } else { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(111); @@ -648,7 +677,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) f = 10; } if (z->class < 7 || f == 10) { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } else { OPB_err(127); } @@ -657,7 +686,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__29(op, typ, z); + z = NewOp__30(op, typ, z); } else { OPB_err(219); } @@ -674,7 +703,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } } *x = z; - MOp__28_s = _s.lnk; + MOp__29_s = _s.lnk; } static void OPB_CheckPtr (OPT_Node x, OPT_Node y) @@ -865,41 +894,13 @@ static void OPB_ConstOp (INTEGER op, OPT_Node x, OPT_Node y) __GUARDEQP(yval, OPT_ConstDesc) = *xval; } break; - case 4: + case 4: case 5: case 6: if (__IN(g, 0x70)) { - x->typ = y->typ; - } else if (g == 7) { - x->typ = OPT_realtyp; - xval->realval = xval->intval; - } else if (g == 8) { - x->typ = OPT_lrltyp; - xval->realval = xval->intval; - } else { - OPB_err(100); - y->typ = x->typ; - __GUARDEQP(yval, OPT_ConstDesc) = *xval; - } - break; - case 5: - if (g == 4) { - y->typ = OPT_inttyp; - } else if (__IN(g, 0x70)) { - x->typ = y->typ; - } else if (g == 7) { - x->typ = OPT_realtyp; - xval->realval = xval->intval; - } else if (g == 8) { - x->typ = OPT_lrltyp; - xval->realval = xval->intval; - } else { - OPB_err(100); - y->typ = x->typ; - __GUARDEQP(yval, OPT_ConstDesc) = *xval; - } - break; - case 6: - if (__IN(g, 0x70)) { - y->typ = OPT_linttyp; + if (x->typ->size <= y->typ->size) { + x->typ = y->typ; + } else { + x->typ = OPB_IntType(x->typ->size); + } } else if (g == 7) { x->typ = OPT_realtyp; xval->realval = xval->intval; @@ -1196,15 +1197,15 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) (*x)->typ = typ; } -static struct Op__38 { +static struct Op__39 { INTEGER *f, *g; - struct Op__38 *lnk; -} *Op__38_s; + struct Op__39 *lnk; +} *Op__39_s; -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__40 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y); +static BOOLEAN strings__42 (OPT_Node *x, OPT_Node *y); -static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) +static void NewOp__40 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) { OPT_Node node = NIL; node = OPT_NewNode(12); @@ -1215,29 +1216,29 @@ static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) *x = node; } -static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y) +static BOOLEAN strings__42 (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__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)) { + xCharArr = (__IN((*x)->typ->comp, 0x0c) && (*x)->typ->BaseTyp->form == 3) || *Op__39_s->f == 10; + yCharArr = (__IN((*y)->typ->comp, 0x0c) && (*y)->typ->BaseTyp->form == 3) || *Op__39_s->g == 10; + if ((((xCharArr && *Op__39_s->g == 3)) && (*y)->class == 7)) { OPB_CharToString(*y); - *Op__38_s->g = 10; + *Op__39_s->g = 10; yCharArr = 1; } - if ((((yCharArr && *Op__38_s->f == 3)) && (*x)->class == 7)) { + if ((((yCharArr && *Op__39_s->f == 3)) && (*x)->class == 7)) { OPB_CharToString(*x); - *Op__38_s->f = 10; + *Op__39_s->f = 10; xCharArr = 1; } ok = (xCharArr && yCharArr); if (ok) { - if ((*Op__38_s->f == 10 && (*x)->conval->intval2 == 1)) { + if ((*Op__39_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__38_s->g == 10 && (*y)->conval->intval2 == 1)) { + } else if ((*Op__39_s->g == 10 && (*y)->conval->intval2 == 1)) { (*y)->typ = OPT_chartyp; (*y)->conval->intval = 0; OPB_Index(&*x, OPB_NewIntConst(((LONGINT)(0)))); @@ -1254,11 +1255,11 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPT_Struct typ = NIL; BOOLEAN do_; LONGINT val; - struct Op__38 _s; + struct Op__39 _s; _s.f = &f; _s.g = &g; - _s.lnk = Op__38_s; - Op__38_s = &_s; + _s.lnk = Op__39_s; + Op__39_s = &_s; z = *x; if (((z->class == 8 || z->class == 9) || y->class == 8) || y->class == 9) { OPB_err(126); @@ -1276,15 +1277,8 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(100); } break; - case 4: - if (__IN(g, 0x01f0)) { - OPB_Convert(&z, y->typ); - } else { - OPB_err(100); - } - break; - case 5: - if (g == 4) { + case 4: case 5: case 6: + if ((__IN(g, 0x70) && y->typ->size < z->typ->size)) { OPB_Convert(&y, z->typ); } else if (__IN(g, 0x01f0)) { OPB_Convert(&z, y->typ); @@ -1292,15 +1286,6 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(100); } break; - case 6: - if (__IN(g, 0x70)) { - OPB_Convert(&y, z->typ); - } else if (__IN(g, 0x0180)) { - OPB_Convert(&z, y->typ); - } else { - OPB_err(100); - } - break; case 7: if (__IN(g, 0x70)) { OPB_Convert(&y, z->typ); @@ -1386,7 +1371,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if (do_) { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } break; case 2: @@ -1405,7 +1390,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(102); typ = OPT_undftyp; } - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); break; case 3: do_ = 1; @@ -1428,7 +1413,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if (do_) { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } break; case 4: @@ -1446,7 +1431,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(104); typ = OPT_undftyp; } - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); break; case 5: if (f == 2) { @@ -1456,7 +1441,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } else if ((y->class == 7 && OPB_IntToBool(y->conval->intval))) { } else { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } } else if (f != 0) { OPB_err(94); @@ -1479,7 +1464,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } if (do_) { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } break; case 7: @@ -1488,7 +1473,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__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } break; case 8: @@ -1499,7 +1484,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } else if ((y->class == 7 && !OPB_IntToBool(y->conval->intval))) { } else { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } } else if (f != 0) { OPB_err(95); @@ -1507,16 +1492,16 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } break; case 9: case 10: - if (__IN(f, 0x6bff) || strings__41(&z, &y)) { + if (__IN(f, 0x6bff) || strings__42(&z, &y)) { typ = OPT_booltyp; } else { OPB_err(107); typ = OPT_undftyp; } - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); break; case 11: case 12: case 13: case 14: - if (__IN(f, 0x01f9) || strings__41(&z, &y)) { + if (__IN(f, 0x01f9) || strings__42(&z, &y)) { typ = OPT_booltyp; } else { OPM_LogWLn(); @@ -1525,7 +1510,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(108); typ = OPT_undftyp; } - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); break; default: OPM_LogWStr((CHAR*)"unhandled case in OPB.Op, op = ", (LONGINT)32); @@ -1535,7 +1520,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } *x = z; - Op__38_s = _s.lnk; + Op__39_s = _s.lnk; } void OPB_SetRange (OPT_Node *x, OPT_Node y) @@ -1632,18 +1617,13 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) OPB_err(113); } break; - case 2: case 3: case 4: case 9: + case 2: case 3: case 9: if (g != f) { OPB_err(113); } break; - case 5: - if (!__IN(g, 0x30)) { - OPB_err(113); - } - break; - case 6: - if (!__IN(g, 0x70)) { + case 4: case 5: case 6: + if (!__IN(g, 0x70) || x->size < y->size) { OPB_err(113); } break; @@ -1745,6 +1725,23 @@ static void OPB_CheckLeaf (OPT_Node x, BOOLEAN dynArrToo) { } +static LONGINT OPB_SignedMaximum (LONGINT bytecount) +{ + LONGINT _o_result; + LONGINT result; + result = 1; + result = __LSH(result, __ASHL(bytecount, 3) - 1, LONGINT); + _o_result = result - 1; + return _o_result; +} + +static LONGINT OPB_SignedMinimum (LONGINT bytecount) +{ + LONGINT _o_result; + _o_result = -OPB_SignedMaximum(bytecount) - 1; + return _o_result; +} + void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) { INTEGER f; @@ -1827,14 +1824,8 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) x = OPB_NewIntConst(((LONGINT)(0))); x->typ = OPT_chartyp; break; - case 4: - x = OPB_NewIntConst(OPM_MinSInt); - break; - case 5: - x = OPB_NewIntConst(OPM_MinInt); - break; - case 6: - x = OPB_NewIntConst(OPM_MinLInt); + case 4: case 5: case 6: + x = OPB_NewIntConst(OPB_SignedMinimum(x->typ->size)); break; case 9: x = OPB_NewIntConst(((LONGINT)(0))); @@ -1864,14 +1855,8 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) x = OPB_NewIntConst(((LONGINT)(255))); x->typ = OPT_chartyp; break; - case 4: - x = OPB_NewIntConst(OPM_MaxSInt); - break; - case 5: - x = OPB_NewIntConst(OPM_MaxInt); - break; - case 6: - x = OPB_NewIntConst(OPM_MaxLInt); + case 4: case 5: case 6: + x = OPB_NewIntConst(OPB_SignedMaximum(x->typ->size)); break; case 9: x = OPB_NewIntConst(OPM_MaxSet); @@ -2057,13 +2042,13 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) *par0 = x; } -static struct StPar1__52 { - struct StPar1__52 *lnk; -} *StPar1__52_s; +static struct StPar1__56 { + struct StPar1__56 *lnk; +} *StPar1__56_s; -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) +static OPT_Node NewOp__57 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right) { OPT_Node _o_result; OPT_Node node = NIL; @@ -2080,9 +2065,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__52 _s; - _s.lnk = StPar1__52_s; - StPar1__52_s = &_s; + struct StPar1__56 _s; + _s.lnk = StPar1__56_s; + StPar1__56_s = &_s; p = *par0; f = x->typ->form; switch (fctno) { @@ -2098,7 +2083,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) OPB_err(111); } } - p = NewOp__53(19, fctno, p, x); + p = NewOp__57(19, fctno, p, x); p->typ = OPT_notyp; } break; @@ -2109,7 +2094,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (LONGINT)OPM_MaxSet))) { OPB_err(202); } - p = NewOp__53(19, fctno, p, x); + p = NewOp__57(19, fctno, p, x); } else { OPB_err(111); } @@ -2118,7 +2103,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) case 17: if (!__IN(f, 0x70) || x->class != 7) { OPB_err(69); - } else if (f == 4) { + } else if (x->typ->size == 1) { L = (int)x->conval->intval; typ = p->typ; while ((L > 0 && __IN(typ->comp, 0x0c))) { @@ -2134,7 +2119,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) p = p->left; x->conval->intval += 1; } - p = NewOp__53(12, 19, p, x); + p = NewOp__57(12, 19, p, x); p->typ = OPT_linttyp; } else { p = x; @@ -2156,7 +2141,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) t = x; x = p; p = t; - p = NewOp__53(19, 18, p, x); + p = NewOp__57(19, 18, p, x); } else { OPB_err(111); } @@ -2182,7 +2167,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) } p->obj = NIL; } else { - p = NewOp__53(12, 17, p, x); + p = NewOp__57(12, 17, p, x); p->typ = OPT_linttyp; } } else { @@ -2213,9 +2198,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) OPB_err(111); } else { if (fctno == 22) { - p = NewOp__53(12, 27, p, x); + p = NewOp__57(12, 27, p, x); } else { - p = NewOp__53(12, 28, p, x); + p = NewOp__57(12, 28, p, x); } p->typ = p->left->typ; } @@ -2232,7 +2217,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) x = p; p = t; } - p = NewOp__53(19, fctno, p, x); + p = NewOp__57(19, fctno, p, x); } else { OPB_err(111); } @@ -2242,7 +2227,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__53(12, 26, p, x); + p = NewOp__57(12, 26, p, x); } else { OPB_err(111); } @@ -2263,7 +2248,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__53(19, 30, p, x); + p = NewOp__57(19, 30, p, x); } else { OPB_err(111); } @@ -2309,7 +2294,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) break; } *par0 = p; - StPar1__52_s = _s.lnk; + StPar1__56_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 1f8facf4..4de09d08 100644 --- a/bootstrap/unix-48/OPB.h +++ b/bootstrap/unix-48/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 ef8689fc..beb2a994 100644 --- a/bootstrap/unix-48/OPC.c +++ b/bootstrap/unix-48/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 c9862e14..70e642a0 100644 --- a/bootstrap/unix-48/OPC.h +++ b/bootstrap/unix-48/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 d8f72c90..1d0fcc55 100644 --- a/bootstrap/unix-48/OPM.c +++ b/bootstrap/unix-48/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 b7ccaa8c..b813f21a 100644 --- a/bootstrap/unix-48/OPM.h +++ b/bootstrap/unix-48/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 35e12b80..0b912709 100644 --- a/bootstrap/unix-48/OPP.c +++ b/bootstrap/unix-48/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPB.h" #include "OPM.h" diff --git a/bootstrap/unix-48/OPP.h b/bootstrap/unix-48/OPP.h index 6ece1008..2de55e8b 100644 --- a/bootstrap/unix-48/OPP.h +++ b/bootstrap/unix-48/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 0c19bed7..9ee4c536 100644 --- a/bootstrap/unix-48/OPS.c +++ b/bootstrap/unix-48/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/16] 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 9cf75700..7f4d049d 100644 --- a/bootstrap/unix-48/OPS.h +++ b/bootstrap/unix-48/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/16] 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 3bbdb55e..898af6d0 100644 --- a/bootstrap/unix-48/OPT.c +++ b/bootstrap/unix-48/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPM.h" #include "OPS.h" diff --git a/bootstrap/unix-48/OPT.h b/bootstrap/unix-48/OPT.h index d5063407..1346d74e 100644 --- a/bootstrap/unix-48/OPT.h +++ b/bootstrap/unix-48/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/unix-48/OPV.c b/bootstrap/unix-48/OPV.c index b0b70038..9699164e 100644 --- a/bootstrap/unix-48/OPV.c +++ b/bootstrap/unix-48/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 1498c5e1..e31b63fe 100644 --- a/bootstrap/unix-48/OPV.h +++ b/bootstrap/unix-48/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 47bc2d3e..da8c75d2 100644 --- a/bootstrap/unix-48/Platform.c +++ b/bootstrap/unix-48/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 657985ac..f1a0d63f 100644 --- a/bootstrap/unix-48/Platform.h +++ b/bootstrap/unix-48/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 e2eb8b86..fe1db847 100644 --- a/bootstrap/unix-48/Reals.c +++ b/bootstrap/unix-48/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" diff --git a/bootstrap/unix-48/Reals.h b/bootstrap/unix-48/Reals.h index 5eeb8c59..6f9b9ca8 100644 --- a/bootstrap/unix-48/Reals.h +++ b/bootstrap/unix-48/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 949951ac..2941064e 100644 --- a/bootstrap/unix-48/SYSTEM.h +++ b/bootstrap/unix-48/SYSTEM.h @@ -4,6 +4,8 @@ #ifndef _WIN32 // Building for a Unix/Linux based system + + // TODO: Remove these includes #include // For memcpy ... #include // For uintptr_t ... @@ -70,6 +72,7 @@ typedef unsigned char U_SHORTINT; #endif typedef U_LONGINT SET; +typedef U_LONGINT U_SET; // OS Memory allocation interfaces are in PlatformXXX.Mod diff --git a/bootstrap/unix-48/Strings.c b/bootstrap/unix-48/Strings.c index c85628da..d944f9bc 100644 --- a/bootstrap/unix-48/Strings.c +++ b/bootstrap/unix-48/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" diff --git a/bootstrap/unix-48/Strings.h b/bootstrap/unix-48/Strings.h index 788bc149..43c4284d 100644 --- a/bootstrap/unix-48/Strings.h +++ b/bootstrap/unix-48/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 df56b9da..9df4e8d1 100644 --- a/bootstrap/unix-48/Texts.c +++ b/bootstrap/unix-48/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 ea5c22e0..a2e8c7d0 100644 --- a/bootstrap/unix-48/Texts.h +++ b/bootstrap/unix-48/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 acd3d9fa..c2ec4928 100644 --- a/bootstrap/unix-48/Vishap.c +++ b/bootstrap/unix-48/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/08/16] 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 07eb8447..31ec3cc6 100644 --- a/bootstrap/unix-48/errors.c +++ b/bootstrap/unix-48/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" typedef @@ -194,5 +194,6 @@ export void *errors__init(void) __MOVE("implicit type cast", errors_errors[301], 19); __MOVE("inappropriate symbol file ignored", errors_errors[306], 34); __MOVE("no ELSE symbol after CASE statement sequence may lead to trap", errors_errors[307], 62); + __MOVE("SYSTEM.VAL result includes memory past end of source variable", errors_errors[308], 62); __ENDMOD; } diff --git a/bootstrap/unix-48/errors.h b/bootstrap/unix-48/errors.h index c1acc3e7..3270e9f8 100644 --- a/bootstrap/unix-48/errors.h +++ b/bootstrap/unix-48/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 f6a31f58..3cad087d 100644 --- a/bootstrap/unix-48/extTools.c +++ b/bootstrap/unix-48/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 2848d260..191d54b2 100644 --- a/bootstrap/unix-48/extTools.h +++ b/bootstrap/unix-48/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 8bb3888c..d8bd7a49 100644 --- a/bootstrap/unix-48/vt100.c +++ b/bootstrap/unix-48/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 1194b358..9d09c058 100644 --- a/bootstrap/unix-48/vt100.h +++ b/bootstrap/unix-48/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 c429cc82..ba9e7098 100644 --- a/bootstrap/unix-88/Configuration.c +++ b/bootstrap/unix-88/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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/13] for gcc LP64 on cygwin", Configuration_versionLong, 41); + __MOVE("1.95 [2016/08/16] for gcc LP64 on cygwin", Configuration_versionLong, 41); __ENDMOD; } diff --git a/bootstrap/unix-88/Configuration.h b/bootstrap/unix-88/Configuration.h index e0354bd7..4657606c 100644 --- a/bootstrap/unix-88/Configuration.h +++ b/bootstrap/unix-88/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 3b19aeb0..8e06ac08 100644 --- a/bootstrap/unix-88/Console.c +++ b/bootstrap/unix-88/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 54e28f67..2397393b 100644 --- a/bootstrap/unix-88/Console.h +++ b/bootstrap/unix-88/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 e73e86c5..af05eb47 100644 --- a/bootstrap/unix-88/Files.c +++ b/bootstrap/unix-88/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/16] 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 7d5e7ccf..2c953a36 100644 --- a/bootstrap/unix-88/Files.h +++ b/bootstrap/unix-88/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/16] 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 10533c6b..47408639 100644 --- a/bootstrap/unix-88/Heap.c +++ b/bootstrap/unix-88/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/16] 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 9c7e7409..5e2d316f 100644 --- a/bootstrap/unix-88/Heap.h +++ b/bootstrap/unix-88/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/16] 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 6c0090bd..ae712385 100644 --- a/bootstrap/unix-88/Modules.c +++ b/bootstrap/unix-88/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 73046a00..6854654f 100644 --- a/bootstrap/unix-88/Modules.h +++ b/bootstrap/unix-88/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 517d6403..7c386855 100644 --- a/bootstrap/unix-88/OPB.c +++ b/bootstrap/unix-88/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPM.h" @@ -35,6 +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); export void OPB_MOp (SHORTINT op, OPT_Node *x); export OPT_Node OPB_NewBoolConst (BOOLEAN boolval); @@ -52,6 +53,9 @@ 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 INTEGER OPB_SignedByteSize (LONGINT n); +static LONGINT OPB_SignedMaximum (LONGINT bytecount); +static LONGINT OPB_SignedMinimum (LONGINT bytecount); 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); @@ -221,21 +225,46 @@ OPT_Node OPB_EmptySet (void) return _o_result; } +static INTEGER OPB_SignedByteSize (LONGINT n) +{ + INTEGER _o_result; + INTEGER b; + if (n < 0) { + n = -(n + 1); + } + b = 1; + while (b < 8) { + if (__ASH(n, -(__ASHL(b, 3) - 1)) == 0) { + _o_result = b; + return _o_result; + } + b += 1; + } + _o_result = 8; + return _o_result; +} + +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) { - LONGINT v; - v = node->conval->intval; - if ((OPM_MinSInt <= (LONGINT)v && (LONGINT)v <= OPM_MaxSInt)) { - node->typ = OPT_sinttyp; - } else if ((OPM_MinInt <= (LONGINT)v && (LONGINT)v <= OPM_MaxInt)) { - node->typ = OPT_inttyp; - } else if ((OPM_MinLInt <= v && v <= OPM_MaxLInt)) { - node->typ = OPT_linttyp; - } else { - OPB_err(203); - node->typ = OPT_sinttyp; - node->conval->intval = 1; - } + node->typ = OPB_IntType(OPB_SignedByteSize(node->conval->intval)); } OPT_Node OPB_NewIntConst (LONGINT intval) @@ -379,16 +408,16 @@ void OPB_Field (OPT_Node *x, OPT_Object y) } } -static struct TypTest__57 { +static struct TypTest__61 { OPT_Node *x; OPT_Object *obj; BOOLEAN *guard; - struct TypTest__57 *lnk; -} *TypTest__57_s; + struct TypTest__61 *lnk; +} *TypTest__61_s; -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) +static void GTT__62 (OPT_Struct t0, OPT_Struct t1) { OPT_Node node = NIL; OPT_Struct t = NIL; @@ -401,54 +430,54 @@ static void GTT__58 (OPT_Struct t0, OPT_Struct t1) t1 = t1->BaseTyp; } if (t1 == t0 || t0->form == 0) { - if (*TypTest__57_s->guard) { - OPB_BindNodes(5, NIL, &*TypTest__57_s->x, NIL); - (*TypTest__57_s->x)->readonly = (*TypTest__57_s->x)->left->readonly; + if (*TypTest__61_s->guard) { + OPB_BindNodes(5, NIL, &*TypTest__61_s->x, NIL); + (*TypTest__61_s->x)->readonly = (*TypTest__61_s->x)->left->readonly; } else { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__57_s->x; - node->obj = *TypTest__57_s->obj; - *TypTest__57_s->x = node; + node->left = *TypTest__61_s->x; + node->obj = *TypTest__61_s->obj; + *TypTest__61_s->x = node; } } else { OPB_err(85); } } else if (t0 != t1) { OPB_err(85); - } else if (!*TypTest__57_s->guard) { - if ((*TypTest__57_s->x)->class == 5) { + } else if (!*TypTest__61_s->guard) { + if ((*TypTest__61_s->x)->class == 5) { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__57_s->x; - node->obj = *TypTest__57_s->obj; - *TypTest__57_s->x = node; + node->left = *TypTest__61_s->x; + node->obj = *TypTest__61_s->obj; + *TypTest__61_s->x = node; } else { - *TypTest__57_s->x = OPB_NewBoolConst(1); + *TypTest__61_s->x = OPB_NewBoolConst(1); } } } void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) { - struct TypTest__57 _s; + struct TypTest__61 _s; _s.x = x; _s.obj = &obj; _s.guard = &guard; - _s.lnk = TypTest__57_s; - TypTest__57_s = &_s; + _s.lnk = TypTest__61_s; + TypTest__61_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__58((*x)->typ->BaseTyp, obj->typ->BaseTyp); + GTT__62((*x)->typ->BaseTyp, obj->typ->BaseTyp); } else { OPB_err(86); } } else if (((((*x)->typ->comp == 4 && (*x)->class == 1)) && obj->typ->comp == 4)) { - GTT__58((*x)->typ, obj->typ); + GTT__62((*x)->typ, obj->typ); } else { OPB_err(87); } @@ -457,7 +486,7 @@ void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) } else { (*x)->typ = OPT_booltyp; } - TypTest__57_s = _s.lnk; + TypTest__61_s = _s.lnk; } void OPB_In (OPT_Node *x, OPT_Node y) @@ -523,13 +552,13 @@ static void OPB_CheckRealType (INTEGER f, INTEGER nr, OPT_Const x) x->intval = -1; } -static struct MOp__28 { - struct MOp__28 *lnk; -} *MOp__28_s; +static struct MOp__29 { + struct MOp__29 *lnk; +} *MOp__29_s; -static OPT_Node NewOp__29 (SHORTINT op, OPT_Struct typ, OPT_Node z); +static OPT_Node NewOp__30 (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__30 (SHORTINT op, OPT_Struct typ, OPT_Node z) { OPT_Node _o_result; OPT_Node node = NIL; @@ -546,9 +575,9 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) INTEGER f; OPT_Struct typ = NIL; OPT_Node z = NIL; - struct MOp__28 _s; - _s.lnk = MOp__28_s; - MOp__28_s = &_s; + struct MOp__29 _s; + _s.lnk = MOp__29_s; + MOp__29_s = &_s; z = *x; if (z->class == 8 || z->class == 9) { OPB_err(126); @@ -562,7 +591,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__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(98); @@ -590,7 +619,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } z->obj = NIL; } else { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(97); @@ -611,7 +640,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } z->obj = NIL; } else { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(111); @@ -623,7 +652,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = (int)__CAP((CHAR)z->conval->intval); z->obj = NIL; } else { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(111); @@ -636,7 +665,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = OPB_BoolToInt(__ODD(z->conval->intval)); z->obj = NIL; } else { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(111); @@ -649,7 +678,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) f = 10; } if (z->class < 7 || f == 10) { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } else { OPB_err(127); } @@ -658,7 +687,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__29(op, typ, z); + z = NewOp__30(op, typ, z); } else { OPB_err(219); } @@ -675,7 +704,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } } *x = z; - MOp__28_s = _s.lnk; + MOp__29_s = _s.lnk; } static void OPB_CheckPtr (OPT_Node x, OPT_Node y) @@ -866,41 +895,13 @@ static void OPB_ConstOp (INTEGER op, OPT_Node x, OPT_Node y) __GUARDEQP(yval, OPT_ConstDesc) = *xval; } break; - case 4: + case 4: case 5: case 6: if (__IN(g, 0x70)) { - x->typ = y->typ; - } else if (g == 7) { - x->typ = OPT_realtyp; - xval->realval = xval->intval; - } else if (g == 8) { - x->typ = OPT_lrltyp; - xval->realval = xval->intval; - } else { - OPB_err(100); - y->typ = x->typ; - __GUARDEQP(yval, OPT_ConstDesc) = *xval; - } - break; - case 5: - if (g == 4) { - y->typ = OPT_inttyp; - } else if (__IN(g, 0x70)) { - x->typ = y->typ; - } else if (g == 7) { - x->typ = OPT_realtyp; - xval->realval = xval->intval; - } else if (g == 8) { - x->typ = OPT_lrltyp; - xval->realval = xval->intval; - } else { - OPB_err(100); - y->typ = x->typ; - __GUARDEQP(yval, OPT_ConstDesc) = *xval; - } - break; - case 6: - if (__IN(g, 0x70)) { - y->typ = OPT_linttyp; + if (x->typ->size <= y->typ->size) { + x->typ = y->typ; + } else { + x->typ = OPB_IntType(x->typ->size); + } } else if (g == 7) { x->typ = OPT_realtyp; xval->realval = xval->intval; @@ -1197,15 +1198,15 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) (*x)->typ = typ; } -static struct Op__38 { +static struct Op__39 { INTEGER *f, *g; - struct Op__38 *lnk; -} *Op__38_s; + struct Op__39 *lnk; +} *Op__39_s; -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__40 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y); +static BOOLEAN strings__42 (OPT_Node *x, OPT_Node *y); -static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) +static void NewOp__40 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) { OPT_Node node = NIL; node = OPT_NewNode(12); @@ -1216,29 +1217,29 @@ static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) *x = node; } -static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y) +static BOOLEAN strings__42 (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__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)) { + xCharArr = (__IN((*x)->typ->comp, 0x0c) && (*x)->typ->BaseTyp->form == 3) || *Op__39_s->f == 10; + yCharArr = (__IN((*y)->typ->comp, 0x0c) && (*y)->typ->BaseTyp->form == 3) || *Op__39_s->g == 10; + if ((((xCharArr && *Op__39_s->g == 3)) && (*y)->class == 7)) { OPB_CharToString(*y); - *Op__38_s->g = 10; + *Op__39_s->g = 10; yCharArr = 1; } - if ((((yCharArr && *Op__38_s->f == 3)) && (*x)->class == 7)) { + if ((((yCharArr && *Op__39_s->f == 3)) && (*x)->class == 7)) { OPB_CharToString(*x); - *Op__38_s->f = 10; + *Op__39_s->f = 10; xCharArr = 1; } ok = (xCharArr && yCharArr); if (ok) { - if ((*Op__38_s->f == 10 && (*x)->conval->intval2 == 1)) { + if ((*Op__39_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__38_s->g == 10 && (*y)->conval->intval2 == 1)) { + } else if ((*Op__39_s->g == 10 && (*y)->conval->intval2 == 1)) { (*y)->typ = OPT_chartyp; (*y)->conval->intval = 0; OPB_Index(&*x, OPB_NewIntConst(((LONGINT)(0)))); @@ -1255,11 +1256,11 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPT_Struct typ = NIL; BOOLEAN do_; LONGINT val; - struct Op__38 _s; + struct Op__39 _s; _s.f = &f; _s.g = &g; - _s.lnk = Op__38_s; - Op__38_s = &_s; + _s.lnk = Op__39_s; + Op__39_s = &_s; z = *x; if (((z->class == 8 || z->class == 9) || y->class == 8) || y->class == 9) { OPB_err(126); @@ -1277,15 +1278,8 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(100); } break; - case 4: - if (__IN(g, 0x01f0)) { - OPB_Convert(&z, y->typ); - } else { - OPB_err(100); - } - break; - case 5: - if (g == 4) { + case 4: case 5: case 6: + if ((__IN(g, 0x70) && y->typ->size < z->typ->size)) { OPB_Convert(&y, z->typ); } else if (__IN(g, 0x01f0)) { OPB_Convert(&z, y->typ); @@ -1293,15 +1287,6 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(100); } break; - case 6: - if (__IN(g, 0x70)) { - OPB_Convert(&y, z->typ); - } else if (__IN(g, 0x0180)) { - OPB_Convert(&z, y->typ); - } else { - OPB_err(100); - } - break; case 7: if (__IN(g, 0x70)) { OPB_Convert(&y, z->typ); @@ -1387,7 +1372,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if (do_) { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } break; case 2: @@ -1406,7 +1391,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(102); typ = OPT_undftyp; } - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); break; case 3: do_ = 1; @@ -1429,7 +1414,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if (do_) { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } break; case 4: @@ -1447,7 +1432,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(104); typ = OPT_undftyp; } - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); break; case 5: if (f == 2) { @@ -1457,7 +1442,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } else if ((y->class == 7 && OPB_IntToBool(y->conval->intval))) { } else { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } } else if (f != 0) { OPB_err(94); @@ -1480,7 +1465,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } if (do_) { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } break; case 7: @@ -1489,7 +1474,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__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } break; case 8: @@ -1500,7 +1485,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } else if ((y->class == 7 && !OPB_IntToBool(y->conval->intval))) { } else { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } } else if (f != 0) { OPB_err(95); @@ -1508,16 +1493,16 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } break; case 9: case 10: - if (__IN(f, 0x6bff) || strings__41(&z, &y)) { + if (__IN(f, 0x6bff) || strings__42(&z, &y)) { typ = OPT_booltyp; } else { OPB_err(107); typ = OPT_undftyp; } - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); break; case 11: case 12: case 13: case 14: - if (__IN(f, 0x01f9) || strings__41(&z, &y)) { + if (__IN(f, 0x01f9) || strings__42(&z, &y)) { typ = OPT_booltyp; } else { OPM_LogWLn(); @@ -1526,7 +1511,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(108); typ = OPT_undftyp; } - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); break; default: OPM_LogWStr((CHAR*)"unhandled case in OPB.Op, op = ", (LONGINT)32); @@ -1536,7 +1521,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } *x = z; - Op__38_s = _s.lnk; + Op__39_s = _s.lnk; } void OPB_SetRange (OPT_Node *x, OPT_Node y) @@ -1633,18 +1618,13 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) OPB_err(113); } break; - case 2: case 3: case 4: case 9: + case 2: case 3: case 9: if (g != f) { OPB_err(113); } break; - case 5: - if (!__IN(g, 0x30)) { - OPB_err(113); - } - break; - case 6: - if (!__IN(g, 0x70)) { + case 4: case 5: case 6: + if (!__IN(g, 0x70) || x->size < y->size) { OPB_err(113); } break; @@ -1746,6 +1726,23 @@ static void OPB_CheckLeaf (OPT_Node x, BOOLEAN dynArrToo) { } +static LONGINT OPB_SignedMaximum (LONGINT bytecount) +{ + LONGINT _o_result; + LONGINT result; + result = 1; + result = __LSH(result, __ASHL(bytecount, 3) - 1, LONGINT); + _o_result = result - 1; + return _o_result; +} + +static LONGINT OPB_SignedMinimum (LONGINT bytecount) +{ + LONGINT _o_result; + _o_result = -OPB_SignedMaximum(bytecount) - 1; + return _o_result; +} + void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) { INTEGER f; @@ -1828,14 +1825,8 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) x = OPB_NewIntConst(((LONGINT)(0))); x->typ = OPT_chartyp; break; - case 4: - x = OPB_NewIntConst(OPM_MinSInt); - break; - case 5: - x = OPB_NewIntConst(OPM_MinInt); - break; - case 6: - x = OPB_NewIntConst(OPM_MinLInt); + case 4: case 5: case 6: + x = OPB_NewIntConst(OPB_SignedMinimum(x->typ->size)); break; case 9: x = OPB_NewIntConst(((LONGINT)(0))); @@ -1865,14 +1856,8 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) x = OPB_NewIntConst(((LONGINT)(255))); x->typ = OPT_chartyp; break; - case 4: - x = OPB_NewIntConst(OPM_MaxSInt); - break; - case 5: - x = OPB_NewIntConst(OPM_MaxInt); - break; - case 6: - x = OPB_NewIntConst(OPM_MaxLInt); + case 4: case 5: case 6: + x = OPB_NewIntConst(OPB_SignedMaximum(x->typ->size)); break; case 9: x = OPB_NewIntConst(OPM_MaxSet); @@ -2058,13 +2043,13 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) *par0 = x; } -static struct StPar1__52 { - struct StPar1__52 *lnk; -} *StPar1__52_s; +static struct StPar1__56 { + struct StPar1__56 *lnk; +} *StPar1__56_s; -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) +static OPT_Node NewOp__57 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right) { OPT_Node _o_result; OPT_Node node = NIL; @@ -2081,9 +2066,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__52 _s; - _s.lnk = StPar1__52_s; - StPar1__52_s = &_s; + struct StPar1__56 _s; + _s.lnk = StPar1__56_s; + StPar1__56_s = &_s; p = *par0; f = x->typ->form; switch (fctno) { @@ -2099,7 +2084,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) OPB_err(111); } } - p = NewOp__53(19, fctno, p, x); + p = NewOp__57(19, fctno, p, x); p->typ = OPT_notyp; } break; @@ -2110,7 +2095,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (LONGINT)OPM_MaxSet))) { OPB_err(202); } - p = NewOp__53(19, fctno, p, x); + p = NewOp__57(19, fctno, p, x); } else { OPB_err(111); } @@ -2119,7 +2104,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) case 17: if (!__IN(f, 0x70) || x->class != 7) { OPB_err(69); - } else if (f == 4) { + } else if (x->typ->size == 1) { L = (int)x->conval->intval; typ = p->typ; while ((L > 0 && __IN(typ->comp, 0x0c))) { @@ -2135,7 +2120,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) p = p->left; x->conval->intval += 1; } - p = NewOp__53(12, 19, p, x); + p = NewOp__57(12, 19, p, x); p->typ = OPT_linttyp; } else { p = x; @@ -2157,7 +2142,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) t = x; x = p; p = t; - p = NewOp__53(19, 18, p, x); + p = NewOp__57(19, 18, p, x); } else { OPB_err(111); } @@ -2183,7 +2168,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) } p->obj = NIL; } else { - p = NewOp__53(12, 17, p, x); + p = NewOp__57(12, 17, p, x); p->typ = OPT_linttyp; } } else { @@ -2214,9 +2199,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) OPB_err(111); } else { if (fctno == 22) { - p = NewOp__53(12, 27, p, x); + p = NewOp__57(12, 27, p, x); } else { - p = NewOp__53(12, 28, p, x); + p = NewOp__57(12, 28, p, x); } p->typ = p->left->typ; } @@ -2233,7 +2218,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) x = p; p = t; } - p = NewOp__53(19, fctno, p, x); + p = NewOp__57(19, fctno, p, x); } else { OPB_err(111); } @@ -2243,7 +2228,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__53(12, 26, p, x); + p = NewOp__57(12, 26, p, x); } else { OPB_err(111); } @@ -2264,7 +2249,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__53(19, 30, p, x); + p = NewOp__57(19, 30, p, x); } else { OPB_err(111); } @@ -2310,7 +2295,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) break; } *par0 = p; - StPar1__52_s = _s.lnk; + StPar1__56_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 07a13133..f5706dd7 100644 --- a/bootstrap/unix-88/OPB.h +++ b/bootstrap/unix-88/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 dc959d54..efe720a3 100644 --- a/bootstrap/unix-88/OPC.c +++ b/bootstrap/unix-88/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 4441a602..eec830f1 100644 --- a/bootstrap/unix-88/OPC.h +++ b/bootstrap/unix-88/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 20c18510..62922f95 100644 --- a/bootstrap/unix-88/OPM.c +++ b/bootstrap/unix-88/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 d14da113..18397e74 100644 --- a/bootstrap/unix-88/OPM.h +++ b/bootstrap/unix-88/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 b9ce6cca..f69a1750 100644 --- a/bootstrap/unix-88/OPP.c +++ b/bootstrap/unix-88/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPB.h" diff --git a/bootstrap/unix-88/OPP.h b/bootstrap/unix-88/OPP.h index 9bafbb94..6e42de59 100644 --- a/bootstrap/unix-88/OPP.h +++ b/bootstrap/unix-88/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 ed021bc6..57b90bad 100644 --- a/bootstrap/unix-88/OPS.c +++ b/bootstrap/unix-88/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/16] 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 716781ca..b2d2cf55 100644 --- a/bootstrap/unix-88/OPS.h +++ b/bootstrap/unix-88/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/16] 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 e36ed325..371d31a9 100644 --- a/bootstrap/unix-88/OPT.c +++ b/bootstrap/unix-88/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPM.h" diff --git a/bootstrap/unix-88/OPT.h b/bootstrap/unix-88/OPT.h index b7bb82b3..343a6059 100644 --- a/bootstrap/unix-88/OPT.h +++ b/bootstrap/unix-88/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/unix-88/OPV.c b/bootstrap/unix-88/OPV.c index 539569d5..f5d943cd 100644 --- a/bootstrap/unix-88/OPV.c +++ b/bootstrap/unix-88/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 6ade6c8c..b10b4265 100644 --- a/bootstrap/unix-88/OPV.h +++ b/bootstrap/unix-88/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 8b1da92d..a2e4d4e9 100644 --- a/bootstrap/unix-88/Platform.c +++ b/bootstrap/unix-88/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 938ee368..294cd0ea 100644 --- a/bootstrap/unix-88/Platform.h +++ b/bootstrap/unix-88/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 a9740584..f38e5bd8 100644 --- a/bootstrap/unix-88/Reals.c +++ b/bootstrap/unix-88/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 c8a7d146..0647106c 100644 --- a/bootstrap/unix-88/Reals.h +++ b/bootstrap/unix-88/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 949951ac..2941064e 100644 --- a/bootstrap/unix-88/SYSTEM.h +++ b/bootstrap/unix-88/SYSTEM.h @@ -4,6 +4,8 @@ #ifndef _WIN32 // Building for a Unix/Linux based system + + // TODO: Remove these includes #include // For memcpy ... #include // For uintptr_t ... @@ -70,6 +72,7 @@ typedef unsigned char U_SHORTINT; #endif typedef U_LONGINT SET; +typedef U_LONGINT U_SET; // OS Memory allocation interfaces are in PlatformXXX.Mod diff --git a/bootstrap/unix-88/Strings.c b/bootstrap/unix-88/Strings.c index 03a18d6b..a1b5c956 100644 --- a/bootstrap/unix-88/Strings.c +++ b/bootstrap/unix-88/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 4363c0d4..29cd1c88 100644 --- a/bootstrap/unix-88/Strings.h +++ b/bootstrap/unix-88/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 600c578b..fa9a1311 100644 --- a/bootstrap/unix-88/Texts.c +++ b/bootstrap/unix-88/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 4c196474..240b0acb 100644 --- a/bootstrap/unix-88/Texts.h +++ b/bootstrap/unix-88/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 3e51f987..bc48ed60 100644 --- a/bootstrap/unix-88/Vishap.c +++ b/bootstrap/unix-88/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/08/16] 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 ef82167a..4911b020 100644 --- a/bootstrap/unix-88/errors.c +++ b/bootstrap/unix-88/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" @@ -195,5 +195,6 @@ export void *errors__init(void) __MOVE("implicit type cast", errors_errors[301], 19); __MOVE("inappropriate symbol file ignored", errors_errors[306], 34); __MOVE("no ELSE symbol after CASE statement sequence may lead to trap", errors_errors[307], 62); + __MOVE("SYSTEM.VAL result includes memory past end of source variable", errors_errors[308], 62); __ENDMOD; } diff --git a/bootstrap/unix-88/errors.h b/bootstrap/unix-88/errors.h index f9bc34cb..571c65b9 100644 --- a/bootstrap/unix-88/errors.h +++ b/bootstrap/unix-88/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 a2a218d3..6865568d 100644 --- a/bootstrap/unix-88/extTools.c +++ b/bootstrap/unix-88/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 1bce82ff..88620668 100644 --- a/bootstrap/unix-88/extTools.h +++ b/bootstrap/unix-88/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 672f496c..e668fc2c 100644 --- a/bootstrap/unix-88/vt100.c +++ b/bootstrap/unix-88/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 da57987b..15d39b23 100644 --- a/bootstrap/unix-88/vt100.h +++ b/bootstrap/unix-88/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 2fda7317..36e599bd 100644 --- a/bootstrap/windows-48/Configuration.c +++ b/bootstrap/windows-48/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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/13] for gcc LP64 on cygwin", Configuration_versionLong, 41); + __MOVE("1.95 [2016/08/16] for gcc LP64 on cygwin", Configuration_versionLong, 41); __ENDMOD; } diff --git a/bootstrap/windows-48/Configuration.h b/bootstrap/windows-48/Configuration.h index c67723f0..9712e1ee 100644 --- a/bootstrap/windows-48/Configuration.h +++ b/bootstrap/windows-48/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 29a8d64a..bac2ff35 100644 --- a/bootstrap/windows-48/Console.c +++ b/bootstrap/windows-48/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 98c3ffbb..06f26feb 100644 --- a/bootstrap/windows-48/Console.h +++ b/bootstrap/windows-48/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 3490509b..71c35083 100644 --- a/bootstrap/windows-48/Files.c +++ b/bootstrap/windows-48/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/16] 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 8c7761c3..69fc5ad3 100644 --- a/bootstrap/windows-48/Files.h +++ b/bootstrap/windows-48/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/16] 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 b06aa205..2383245d 100644 --- a/bootstrap/windows-48/Heap.c +++ b/bootstrap/windows-48/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/16] 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 2e607154..03e3bc31 100644 --- a/bootstrap/windows-48/Heap.h +++ b/bootstrap/windows-48/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/16] 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 b7445042..558cd58f 100644 --- a/bootstrap/windows-48/Modules.c +++ b/bootstrap/windows-48/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 69c32c2e..cf536137 100644 --- a/bootstrap/windows-48/Modules.h +++ b/bootstrap/windows-48/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 d2c67317..170446bd 100644 --- a/bootstrap/windows-48/OPB.c +++ b/bootstrap/windows-48/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPM.h" #include "OPS.h" @@ -34,6 +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); export void OPB_MOp (SHORTINT op, OPT_Node *x); export OPT_Node OPB_NewBoolConst (BOOLEAN boolval); @@ -51,6 +52,9 @@ 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 INTEGER OPB_SignedByteSize (LONGINT n); +static LONGINT OPB_SignedMaximum (LONGINT bytecount); +static LONGINT OPB_SignedMinimum (LONGINT bytecount); 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); @@ -220,21 +224,46 @@ OPT_Node OPB_EmptySet (void) return _o_result; } +static INTEGER OPB_SignedByteSize (LONGINT n) +{ + INTEGER _o_result; + INTEGER b; + if (n < 0) { + n = -(n + 1); + } + b = 1; + while (b < 8) { + if (__ASH(n, -(__ASHL(b, 3) - 1)) == 0) { + _o_result = b; + return _o_result; + } + b += 1; + } + _o_result = 8; + return _o_result; +} + +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) { - LONGINT v; - v = node->conval->intval; - if ((OPM_MinSInt <= (LONGINT)v && (LONGINT)v <= OPM_MaxSInt)) { - node->typ = OPT_sinttyp; - } else if ((OPM_MinInt <= (LONGINT)v && (LONGINT)v <= OPM_MaxInt)) { - node->typ = OPT_inttyp; - } else if ((OPM_MinLInt <= v && v <= OPM_MaxLInt)) { - node->typ = OPT_linttyp; - } else { - OPB_err(203); - node->typ = OPT_sinttyp; - node->conval->intval = 1; - } + node->typ = OPB_IntType(OPB_SignedByteSize(node->conval->intval)); } OPT_Node OPB_NewIntConst (LONGINT intval) @@ -378,16 +407,16 @@ void OPB_Field (OPT_Node *x, OPT_Object y) } } -static struct TypTest__57 { +static struct TypTest__61 { OPT_Node *x; OPT_Object *obj; BOOLEAN *guard; - struct TypTest__57 *lnk; -} *TypTest__57_s; + struct TypTest__61 *lnk; +} *TypTest__61_s; -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) +static void GTT__62 (OPT_Struct t0, OPT_Struct t1) { OPT_Node node = NIL; OPT_Struct t = NIL; @@ -400,54 +429,54 @@ static void GTT__58 (OPT_Struct t0, OPT_Struct t1) t1 = t1->BaseTyp; } if (t1 == t0 || t0->form == 0) { - if (*TypTest__57_s->guard) { - OPB_BindNodes(5, NIL, &*TypTest__57_s->x, NIL); - (*TypTest__57_s->x)->readonly = (*TypTest__57_s->x)->left->readonly; + if (*TypTest__61_s->guard) { + OPB_BindNodes(5, NIL, &*TypTest__61_s->x, NIL); + (*TypTest__61_s->x)->readonly = (*TypTest__61_s->x)->left->readonly; } else { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__57_s->x; - node->obj = *TypTest__57_s->obj; - *TypTest__57_s->x = node; + node->left = *TypTest__61_s->x; + node->obj = *TypTest__61_s->obj; + *TypTest__61_s->x = node; } } else { OPB_err(85); } } else if (t0 != t1) { OPB_err(85); - } else if (!*TypTest__57_s->guard) { - if ((*TypTest__57_s->x)->class == 5) { + } else if (!*TypTest__61_s->guard) { + if ((*TypTest__61_s->x)->class == 5) { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__57_s->x; - node->obj = *TypTest__57_s->obj; - *TypTest__57_s->x = node; + node->left = *TypTest__61_s->x; + node->obj = *TypTest__61_s->obj; + *TypTest__61_s->x = node; } else { - *TypTest__57_s->x = OPB_NewBoolConst(1); + *TypTest__61_s->x = OPB_NewBoolConst(1); } } } void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) { - struct TypTest__57 _s; + struct TypTest__61 _s; _s.x = x; _s.obj = &obj; _s.guard = &guard; - _s.lnk = TypTest__57_s; - TypTest__57_s = &_s; + _s.lnk = TypTest__61_s; + TypTest__61_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__58((*x)->typ->BaseTyp, obj->typ->BaseTyp); + GTT__62((*x)->typ->BaseTyp, obj->typ->BaseTyp); } else { OPB_err(86); } } else if (((((*x)->typ->comp == 4 && (*x)->class == 1)) && obj->typ->comp == 4)) { - GTT__58((*x)->typ, obj->typ); + GTT__62((*x)->typ, obj->typ); } else { OPB_err(87); } @@ -456,7 +485,7 @@ void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) } else { (*x)->typ = OPT_booltyp; } - TypTest__57_s = _s.lnk; + TypTest__61_s = _s.lnk; } void OPB_In (OPT_Node *x, OPT_Node y) @@ -522,13 +551,13 @@ static void OPB_CheckRealType (INTEGER f, INTEGER nr, OPT_Const x) x->intval = -1; } -static struct MOp__28 { - struct MOp__28 *lnk; -} *MOp__28_s; +static struct MOp__29 { + struct MOp__29 *lnk; +} *MOp__29_s; -static OPT_Node NewOp__29 (SHORTINT op, OPT_Struct typ, OPT_Node z); +static OPT_Node NewOp__30 (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__30 (SHORTINT op, OPT_Struct typ, OPT_Node z) { OPT_Node _o_result; OPT_Node node = NIL; @@ -545,9 +574,9 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) INTEGER f; OPT_Struct typ = NIL; OPT_Node z = NIL; - struct MOp__28 _s; - _s.lnk = MOp__28_s; - MOp__28_s = &_s; + struct MOp__29 _s; + _s.lnk = MOp__29_s; + MOp__29_s = &_s; z = *x; if (z->class == 8 || z->class == 9) { OPB_err(126); @@ -561,7 +590,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__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(98); @@ -589,7 +618,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } z->obj = NIL; } else { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(97); @@ -610,7 +639,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } z->obj = NIL; } else { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(111); @@ -622,7 +651,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = (int)__CAP((CHAR)z->conval->intval); z->obj = NIL; } else { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(111); @@ -635,7 +664,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = OPB_BoolToInt(__ODD(z->conval->intval)); z->obj = NIL; } else { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(111); @@ -648,7 +677,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) f = 10; } if (z->class < 7 || f == 10) { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } else { OPB_err(127); } @@ -657,7 +686,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__29(op, typ, z); + z = NewOp__30(op, typ, z); } else { OPB_err(219); } @@ -674,7 +703,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } } *x = z; - MOp__28_s = _s.lnk; + MOp__29_s = _s.lnk; } static void OPB_CheckPtr (OPT_Node x, OPT_Node y) @@ -865,41 +894,13 @@ static void OPB_ConstOp (INTEGER op, OPT_Node x, OPT_Node y) __GUARDEQP(yval, OPT_ConstDesc) = *xval; } break; - case 4: + case 4: case 5: case 6: if (__IN(g, 0x70)) { - x->typ = y->typ; - } else if (g == 7) { - x->typ = OPT_realtyp; - xval->realval = xval->intval; - } else if (g == 8) { - x->typ = OPT_lrltyp; - xval->realval = xval->intval; - } else { - OPB_err(100); - y->typ = x->typ; - __GUARDEQP(yval, OPT_ConstDesc) = *xval; - } - break; - case 5: - if (g == 4) { - y->typ = OPT_inttyp; - } else if (__IN(g, 0x70)) { - x->typ = y->typ; - } else if (g == 7) { - x->typ = OPT_realtyp; - xval->realval = xval->intval; - } else if (g == 8) { - x->typ = OPT_lrltyp; - xval->realval = xval->intval; - } else { - OPB_err(100); - y->typ = x->typ; - __GUARDEQP(yval, OPT_ConstDesc) = *xval; - } - break; - case 6: - if (__IN(g, 0x70)) { - y->typ = OPT_linttyp; + if (x->typ->size <= y->typ->size) { + x->typ = y->typ; + } else { + x->typ = OPB_IntType(x->typ->size); + } } else if (g == 7) { x->typ = OPT_realtyp; xval->realval = xval->intval; @@ -1196,15 +1197,15 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) (*x)->typ = typ; } -static struct Op__38 { +static struct Op__39 { INTEGER *f, *g; - struct Op__38 *lnk; -} *Op__38_s; + struct Op__39 *lnk; +} *Op__39_s; -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__40 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y); +static BOOLEAN strings__42 (OPT_Node *x, OPT_Node *y); -static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) +static void NewOp__40 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) { OPT_Node node = NIL; node = OPT_NewNode(12); @@ -1215,29 +1216,29 @@ static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) *x = node; } -static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y) +static BOOLEAN strings__42 (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__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)) { + xCharArr = (__IN((*x)->typ->comp, 0x0c) && (*x)->typ->BaseTyp->form == 3) || *Op__39_s->f == 10; + yCharArr = (__IN((*y)->typ->comp, 0x0c) && (*y)->typ->BaseTyp->form == 3) || *Op__39_s->g == 10; + if ((((xCharArr && *Op__39_s->g == 3)) && (*y)->class == 7)) { OPB_CharToString(*y); - *Op__38_s->g = 10; + *Op__39_s->g = 10; yCharArr = 1; } - if ((((yCharArr && *Op__38_s->f == 3)) && (*x)->class == 7)) { + if ((((yCharArr && *Op__39_s->f == 3)) && (*x)->class == 7)) { OPB_CharToString(*x); - *Op__38_s->f = 10; + *Op__39_s->f = 10; xCharArr = 1; } ok = (xCharArr && yCharArr); if (ok) { - if ((*Op__38_s->f == 10 && (*x)->conval->intval2 == 1)) { + if ((*Op__39_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__38_s->g == 10 && (*y)->conval->intval2 == 1)) { + } else if ((*Op__39_s->g == 10 && (*y)->conval->intval2 == 1)) { (*y)->typ = OPT_chartyp; (*y)->conval->intval = 0; OPB_Index(&*x, OPB_NewIntConst(((LONGINT)(0)))); @@ -1254,11 +1255,11 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPT_Struct typ = NIL; BOOLEAN do_; LONGINT val; - struct Op__38 _s; + struct Op__39 _s; _s.f = &f; _s.g = &g; - _s.lnk = Op__38_s; - Op__38_s = &_s; + _s.lnk = Op__39_s; + Op__39_s = &_s; z = *x; if (((z->class == 8 || z->class == 9) || y->class == 8) || y->class == 9) { OPB_err(126); @@ -1276,15 +1277,8 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(100); } break; - case 4: - if (__IN(g, 0x01f0)) { - OPB_Convert(&z, y->typ); - } else { - OPB_err(100); - } - break; - case 5: - if (g == 4) { + case 4: case 5: case 6: + if ((__IN(g, 0x70) && y->typ->size < z->typ->size)) { OPB_Convert(&y, z->typ); } else if (__IN(g, 0x01f0)) { OPB_Convert(&z, y->typ); @@ -1292,15 +1286,6 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(100); } break; - case 6: - if (__IN(g, 0x70)) { - OPB_Convert(&y, z->typ); - } else if (__IN(g, 0x0180)) { - OPB_Convert(&z, y->typ); - } else { - OPB_err(100); - } - break; case 7: if (__IN(g, 0x70)) { OPB_Convert(&y, z->typ); @@ -1386,7 +1371,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if (do_) { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } break; case 2: @@ -1405,7 +1390,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(102); typ = OPT_undftyp; } - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); break; case 3: do_ = 1; @@ -1428,7 +1413,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if (do_) { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } break; case 4: @@ -1446,7 +1431,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(104); typ = OPT_undftyp; } - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); break; case 5: if (f == 2) { @@ -1456,7 +1441,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } else if ((y->class == 7 && OPB_IntToBool(y->conval->intval))) { } else { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } } else if (f != 0) { OPB_err(94); @@ -1479,7 +1464,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } if (do_) { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } break; case 7: @@ -1488,7 +1473,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__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } break; case 8: @@ -1499,7 +1484,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } else if ((y->class == 7 && !OPB_IntToBool(y->conval->intval))) { } else { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } } else if (f != 0) { OPB_err(95); @@ -1507,16 +1492,16 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } break; case 9: case 10: - if (__IN(f, 0x6bff) || strings__41(&z, &y)) { + if (__IN(f, 0x6bff) || strings__42(&z, &y)) { typ = OPT_booltyp; } else { OPB_err(107); typ = OPT_undftyp; } - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); break; case 11: case 12: case 13: case 14: - if (__IN(f, 0x01f9) || strings__41(&z, &y)) { + if (__IN(f, 0x01f9) || strings__42(&z, &y)) { typ = OPT_booltyp; } else { OPM_LogWLn(); @@ -1525,7 +1510,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(108); typ = OPT_undftyp; } - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); break; default: OPM_LogWStr((CHAR*)"unhandled case in OPB.Op, op = ", (LONGINT)32); @@ -1535,7 +1520,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } *x = z; - Op__38_s = _s.lnk; + Op__39_s = _s.lnk; } void OPB_SetRange (OPT_Node *x, OPT_Node y) @@ -1632,18 +1617,13 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) OPB_err(113); } break; - case 2: case 3: case 4: case 9: + case 2: case 3: case 9: if (g != f) { OPB_err(113); } break; - case 5: - if (!__IN(g, 0x30)) { - OPB_err(113); - } - break; - case 6: - if (!__IN(g, 0x70)) { + case 4: case 5: case 6: + if (!__IN(g, 0x70) || x->size < y->size) { OPB_err(113); } break; @@ -1745,6 +1725,23 @@ static void OPB_CheckLeaf (OPT_Node x, BOOLEAN dynArrToo) { } +static LONGINT OPB_SignedMaximum (LONGINT bytecount) +{ + LONGINT _o_result; + LONGINT result; + result = 1; + result = __LSH(result, __ASHL(bytecount, 3) - 1, LONGINT); + _o_result = result - 1; + return _o_result; +} + +static LONGINT OPB_SignedMinimum (LONGINT bytecount) +{ + LONGINT _o_result; + _o_result = -OPB_SignedMaximum(bytecount) - 1; + return _o_result; +} + void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) { INTEGER f; @@ -1827,14 +1824,8 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) x = OPB_NewIntConst(((LONGINT)(0))); x->typ = OPT_chartyp; break; - case 4: - x = OPB_NewIntConst(OPM_MinSInt); - break; - case 5: - x = OPB_NewIntConst(OPM_MinInt); - break; - case 6: - x = OPB_NewIntConst(OPM_MinLInt); + case 4: case 5: case 6: + x = OPB_NewIntConst(OPB_SignedMinimum(x->typ->size)); break; case 9: x = OPB_NewIntConst(((LONGINT)(0))); @@ -1864,14 +1855,8 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) x = OPB_NewIntConst(((LONGINT)(255))); x->typ = OPT_chartyp; break; - case 4: - x = OPB_NewIntConst(OPM_MaxSInt); - break; - case 5: - x = OPB_NewIntConst(OPM_MaxInt); - break; - case 6: - x = OPB_NewIntConst(OPM_MaxLInt); + case 4: case 5: case 6: + x = OPB_NewIntConst(OPB_SignedMaximum(x->typ->size)); break; case 9: x = OPB_NewIntConst(OPM_MaxSet); @@ -2057,13 +2042,13 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) *par0 = x; } -static struct StPar1__52 { - struct StPar1__52 *lnk; -} *StPar1__52_s; +static struct StPar1__56 { + struct StPar1__56 *lnk; +} *StPar1__56_s; -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) +static OPT_Node NewOp__57 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right) { OPT_Node _o_result; OPT_Node node = NIL; @@ -2080,9 +2065,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__52 _s; - _s.lnk = StPar1__52_s; - StPar1__52_s = &_s; + struct StPar1__56 _s; + _s.lnk = StPar1__56_s; + StPar1__56_s = &_s; p = *par0; f = x->typ->form; switch (fctno) { @@ -2098,7 +2083,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) OPB_err(111); } } - p = NewOp__53(19, fctno, p, x); + p = NewOp__57(19, fctno, p, x); p->typ = OPT_notyp; } break; @@ -2109,7 +2094,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (LONGINT)OPM_MaxSet))) { OPB_err(202); } - p = NewOp__53(19, fctno, p, x); + p = NewOp__57(19, fctno, p, x); } else { OPB_err(111); } @@ -2118,7 +2103,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) case 17: if (!__IN(f, 0x70) || x->class != 7) { OPB_err(69); - } else if (f == 4) { + } else if (x->typ->size == 1) { L = (int)x->conval->intval; typ = p->typ; while ((L > 0 && __IN(typ->comp, 0x0c))) { @@ -2134,7 +2119,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) p = p->left; x->conval->intval += 1; } - p = NewOp__53(12, 19, p, x); + p = NewOp__57(12, 19, p, x); p->typ = OPT_linttyp; } else { p = x; @@ -2156,7 +2141,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) t = x; x = p; p = t; - p = NewOp__53(19, 18, p, x); + p = NewOp__57(19, 18, p, x); } else { OPB_err(111); } @@ -2182,7 +2167,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) } p->obj = NIL; } else { - p = NewOp__53(12, 17, p, x); + p = NewOp__57(12, 17, p, x); p->typ = OPT_linttyp; } } else { @@ -2213,9 +2198,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) OPB_err(111); } else { if (fctno == 22) { - p = NewOp__53(12, 27, p, x); + p = NewOp__57(12, 27, p, x); } else { - p = NewOp__53(12, 28, p, x); + p = NewOp__57(12, 28, p, x); } p->typ = p->left->typ; } @@ -2232,7 +2217,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) x = p; p = t; } - p = NewOp__53(19, fctno, p, x); + p = NewOp__57(19, fctno, p, x); } else { OPB_err(111); } @@ -2242,7 +2227,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__53(12, 26, p, x); + p = NewOp__57(12, 26, p, x); } else { OPB_err(111); } @@ -2263,7 +2248,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__53(19, 30, p, x); + p = NewOp__57(19, 30, p, x); } else { OPB_err(111); } @@ -2309,7 +2294,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) break; } *par0 = p; - StPar1__52_s = _s.lnk; + StPar1__56_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 1f8facf4..4de09d08 100644 --- a/bootstrap/windows-48/OPB.h +++ b/bootstrap/windows-48/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 ef8689fc..beb2a994 100644 --- a/bootstrap/windows-48/OPC.c +++ b/bootstrap/windows-48/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 c9862e14..70e642a0 100644 --- a/bootstrap/windows-48/OPC.h +++ b/bootstrap/windows-48/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 d8f72c90..1d0fcc55 100644 --- a/bootstrap/windows-48/OPM.c +++ b/bootstrap/windows-48/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 b7ccaa8c..b813f21a 100644 --- a/bootstrap/windows-48/OPM.h +++ b/bootstrap/windows-48/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 35e12b80..0b912709 100644 --- a/bootstrap/windows-48/OPP.c +++ b/bootstrap/windows-48/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPB.h" #include "OPM.h" diff --git a/bootstrap/windows-48/OPP.h b/bootstrap/windows-48/OPP.h index 6ece1008..2de55e8b 100644 --- a/bootstrap/windows-48/OPP.h +++ b/bootstrap/windows-48/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 0c19bed7..9ee4c536 100644 --- a/bootstrap/windows-48/OPS.c +++ b/bootstrap/windows-48/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/16] 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 9cf75700..7f4d049d 100644 --- a/bootstrap/windows-48/OPS.h +++ b/bootstrap/windows-48/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/16] 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 3bbdb55e..898af6d0 100644 --- a/bootstrap/windows-48/OPT.c +++ b/bootstrap/windows-48/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" #include "OPM.h" #include "OPS.h" diff --git a/bootstrap/windows-48/OPT.h b/bootstrap/windows-48/OPT.h index d5063407..1346d74e 100644 --- a/bootstrap/windows-48/OPT.h +++ b/bootstrap/windows-48/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/windows-48/OPV.c b/bootstrap/windows-48/OPV.c index b0b70038..9699164e 100644 --- a/bootstrap/windows-48/OPV.c +++ b/bootstrap/windows-48/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 1498c5e1..e31b63fe 100644 --- a/bootstrap/windows-48/OPV.h +++ b/bootstrap/windows-48/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 642d65b8..506cf3ba 100644 --- a/bootstrap/windows-48/Platform.c +++ b/bootstrap/windows-48/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 069b41e0..eac1f538 100644 --- a/bootstrap/windows-48/Platform.h +++ b/bootstrap/windows-48/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 e2eb8b86..fe1db847 100644 --- a/bootstrap/windows-48/Reals.c +++ b/bootstrap/windows-48/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" diff --git a/bootstrap/windows-48/Reals.h b/bootstrap/windows-48/Reals.h index 5eeb8c59..6f9b9ca8 100644 --- a/bootstrap/windows-48/Reals.h +++ b/bootstrap/windows-48/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 949951ac..2941064e 100644 --- a/bootstrap/windows-48/SYSTEM.h +++ b/bootstrap/windows-48/SYSTEM.h @@ -4,6 +4,8 @@ #ifndef _WIN32 // Building for a Unix/Linux based system + + // TODO: Remove these includes #include // For memcpy ... #include // For uintptr_t ... @@ -70,6 +72,7 @@ typedef unsigned char U_SHORTINT; #endif typedef U_LONGINT SET; +typedef U_LONGINT U_SET; // OS Memory allocation interfaces are in PlatformXXX.Mod diff --git a/bootstrap/windows-48/Strings.c b/bootstrap/windows-48/Strings.c index c85628da..d944f9bc 100644 --- a/bootstrap/windows-48/Strings.c +++ b/bootstrap/windows-48/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" diff --git a/bootstrap/windows-48/Strings.h b/bootstrap/windows-48/Strings.h index 788bc149..43c4284d 100644 --- a/bootstrap/windows-48/Strings.h +++ b/bootstrap/windows-48/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 df56b9da..9df4e8d1 100644 --- a/bootstrap/windows-48/Texts.c +++ b/bootstrap/windows-48/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 ea5c22e0..a2e8c7d0 100644 --- a/bootstrap/windows-48/Texts.h +++ b/bootstrap/windows-48/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 acd3d9fa..c2ec4928 100644 --- a/bootstrap/windows-48/Vishap.c +++ b/bootstrap/windows-48/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/08/16] 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 07eb8447..31ec3cc6 100644 --- a/bootstrap/windows-48/errors.c +++ b/bootstrap/windows-48/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #include "SYSTEM.h" typedef @@ -194,5 +194,6 @@ export void *errors__init(void) __MOVE("implicit type cast", errors_errors[301], 19); __MOVE("inappropriate symbol file ignored", errors_errors[306], 34); __MOVE("no ELSE symbol after CASE statement sequence may lead to trap", errors_errors[307], 62); + __MOVE("SYSTEM.VAL result includes memory past end of source variable", errors_errors[308], 62); __ENDMOD; } diff --git a/bootstrap/windows-48/errors.h b/bootstrap/windows-48/errors.h index c1acc3e7..3270e9f8 100644 --- a/bootstrap/windows-48/errors.h +++ b/bootstrap/windows-48/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 f6a31f58..3cad087d 100644 --- a/bootstrap/windows-48/extTools.c +++ b/bootstrap/windows-48/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 2848d260..191d54b2 100644 --- a/bootstrap/windows-48/extTools.h +++ b/bootstrap/windows-48/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 8bb3888c..d8bd7a49 100644 --- a/bootstrap/windows-48/vt100.c +++ b/bootstrap/windows-48/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 1194b358..9d09c058 100644 --- a/bootstrap/windows-48/vt100.h +++ b/bootstrap/windows-48/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 c429cc82..ba9e7098 100644 --- a/bootstrap/windows-88/Configuration.c +++ b/bootstrap/windows-88/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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/13] for gcc LP64 on cygwin", Configuration_versionLong, 41); + __MOVE("1.95 [2016/08/16] for gcc LP64 on cygwin", Configuration_versionLong, 41); __ENDMOD; } diff --git a/bootstrap/windows-88/Configuration.h b/bootstrap/windows-88/Configuration.h index e0354bd7..4657606c 100644 --- a/bootstrap/windows-88/Configuration.h +++ b/bootstrap/windows-88/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 4fd4033a..84d6d43a 100644 --- a/bootstrap/windows-88/Console.c +++ b/bootstrap/windows-88/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 54e28f67..2397393b 100644 --- a/bootstrap/windows-88/Console.h +++ b/bootstrap/windows-88/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 f178375e..fee8c042 100644 --- a/bootstrap/windows-88/Files.c +++ b/bootstrap/windows-88/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/16] 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 5215c315..8ead191e 100644 --- a/bootstrap/windows-88/Files.h +++ b/bootstrap/windows-88/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/16] 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 10533c6b..47408639 100644 --- a/bootstrap/windows-88/Heap.c +++ b/bootstrap/windows-88/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/16] 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 9c7e7409..5e2d316f 100644 --- a/bootstrap/windows-88/Heap.h +++ b/bootstrap/windows-88/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/08/16] 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 6c0090bd..ae712385 100644 --- a/bootstrap/windows-88/Modules.c +++ b/bootstrap/windows-88/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 73046a00..6854654f 100644 --- a/bootstrap/windows-88/Modules.h +++ b/bootstrap/windows-88/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 517d6403..7c386855 100644 --- a/bootstrap/windows-88/OPB.c +++ b/bootstrap/windows-88/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPM.h" @@ -35,6 +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); export void OPB_MOp (SHORTINT op, OPT_Node *x); export OPT_Node OPB_NewBoolConst (BOOLEAN boolval); @@ -52,6 +53,9 @@ 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 INTEGER OPB_SignedByteSize (LONGINT n); +static LONGINT OPB_SignedMaximum (LONGINT bytecount); +static LONGINT OPB_SignedMinimum (LONGINT bytecount); 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); @@ -221,21 +225,46 @@ OPT_Node OPB_EmptySet (void) return _o_result; } +static INTEGER OPB_SignedByteSize (LONGINT n) +{ + INTEGER _o_result; + INTEGER b; + if (n < 0) { + n = -(n + 1); + } + b = 1; + while (b < 8) { + if (__ASH(n, -(__ASHL(b, 3) - 1)) == 0) { + _o_result = b; + return _o_result; + } + b += 1; + } + _o_result = 8; + return _o_result; +} + +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) { - LONGINT v; - v = node->conval->intval; - if ((OPM_MinSInt <= (LONGINT)v && (LONGINT)v <= OPM_MaxSInt)) { - node->typ = OPT_sinttyp; - } else if ((OPM_MinInt <= (LONGINT)v && (LONGINT)v <= OPM_MaxInt)) { - node->typ = OPT_inttyp; - } else if ((OPM_MinLInt <= v && v <= OPM_MaxLInt)) { - node->typ = OPT_linttyp; - } else { - OPB_err(203); - node->typ = OPT_sinttyp; - node->conval->intval = 1; - } + node->typ = OPB_IntType(OPB_SignedByteSize(node->conval->intval)); } OPT_Node OPB_NewIntConst (LONGINT intval) @@ -379,16 +408,16 @@ void OPB_Field (OPT_Node *x, OPT_Object y) } } -static struct TypTest__57 { +static struct TypTest__61 { OPT_Node *x; OPT_Object *obj; BOOLEAN *guard; - struct TypTest__57 *lnk; -} *TypTest__57_s; + struct TypTest__61 *lnk; +} *TypTest__61_s; -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) +static void GTT__62 (OPT_Struct t0, OPT_Struct t1) { OPT_Node node = NIL; OPT_Struct t = NIL; @@ -401,54 +430,54 @@ static void GTT__58 (OPT_Struct t0, OPT_Struct t1) t1 = t1->BaseTyp; } if (t1 == t0 || t0->form == 0) { - if (*TypTest__57_s->guard) { - OPB_BindNodes(5, NIL, &*TypTest__57_s->x, NIL); - (*TypTest__57_s->x)->readonly = (*TypTest__57_s->x)->left->readonly; + if (*TypTest__61_s->guard) { + OPB_BindNodes(5, NIL, &*TypTest__61_s->x, NIL); + (*TypTest__61_s->x)->readonly = (*TypTest__61_s->x)->left->readonly; } else { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__57_s->x; - node->obj = *TypTest__57_s->obj; - *TypTest__57_s->x = node; + node->left = *TypTest__61_s->x; + node->obj = *TypTest__61_s->obj; + *TypTest__61_s->x = node; } } else { OPB_err(85); } } else if (t0 != t1) { OPB_err(85); - } else if (!*TypTest__57_s->guard) { - if ((*TypTest__57_s->x)->class == 5) { + } else if (!*TypTest__61_s->guard) { + if ((*TypTest__61_s->x)->class == 5) { node = OPT_NewNode(11); node->subcl = 16; - node->left = *TypTest__57_s->x; - node->obj = *TypTest__57_s->obj; - *TypTest__57_s->x = node; + node->left = *TypTest__61_s->x; + node->obj = *TypTest__61_s->obj; + *TypTest__61_s->x = node; } else { - *TypTest__57_s->x = OPB_NewBoolConst(1); + *TypTest__61_s->x = OPB_NewBoolConst(1); } } } void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) { - struct TypTest__57 _s; + struct TypTest__61 _s; _s.x = x; _s.obj = &obj; _s.guard = &guard; - _s.lnk = TypTest__57_s; - TypTest__57_s = &_s; + _s.lnk = TypTest__61_s; + TypTest__61_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__58((*x)->typ->BaseTyp, obj->typ->BaseTyp); + GTT__62((*x)->typ->BaseTyp, obj->typ->BaseTyp); } else { OPB_err(86); } } else if (((((*x)->typ->comp == 4 && (*x)->class == 1)) && obj->typ->comp == 4)) { - GTT__58((*x)->typ, obj->typ); + GTT__62((*x)->typ, obj->typ); } else { OPB_err(87); } @@ -457,7 +486,7 @@ void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) } else { (*x)->typ = OPT_booltyp; } - TypTest__57_s = _s.lnk; + TypTest__61_s = _s.lnk; } void OPB_In (OPT_Node *x, OPT_Node y) @@ -523,13 +552,13 @@ static void OPB_CheckRealType (INTEGER f, INTEGER nr, OPT_Const x) x->intval = -1; } -static struct MOp__28 { - struct MOp__28 *lnk; -} *MOp__28_s; +static struct MOp__29 { + struct MOp__29 *lnk; +} *MOp__29_s; -static OPT_Node NewOp__29 (SHORTINT op, OPT_Struct typ, OPT_Node z); +static OPT_Node NewOp__30 (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__30 (SHORTINT op, OPT_Struct typ, OPT_Node z) { OPT_Node _o_result; OPT_Node node = NIL; @@ -546,9 +575,9 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) INTEGER f; OPT_Struct typ = NIL; OPT_Node z = NIL; - struct MOp__28 _s; - _s.lnk = MOp__28_s; - MOp__28_s = &_s; + struct MOp__29 _s; + _s.lnk = MOp__29_s; + MOp__29_s = &_s; z = *x; if (z->class == 8 || z->class == 9) { OPB_err(126); @@ -562,7 +591,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__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(98); @@ -590,7 +619,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } z->obj = NIL; } else { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(97); @@ -611,7 +640,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } z->obj = NIL; } else { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(111); @@ -623,7 +652,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = (int)__CAP((CHAR)z->conval->intval); z->obj = NIL; } else { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(111); @@ -636,7 +665,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) z->conval->intval = OPB_BoolToInt(__ODD(z->conval->intval)); z->obj = NIL; } else { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } } else { OPB_err(111); @@ -649,7 +678,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) f = 10; } if (z->class < 7 || f == 10) { - z = NewOp__29(op, typ, z); + z = NewOp__30(op, typ, z); } else { OPB_err(127); } @@ -658,7 +687,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__29(op, typ, z); + z = NewOp__30(op, typ, z); } else { OPB_err(219); } @@ -675,7 +704,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x) } } *x = z; - MOp__28_s = _s.lnk; + MOp__29_s = _s.lnk; } static void OPB_CheckPtr (OPT_Node x, OPT_Node y) @@ -866,41 +895,13 @@ static void OPB_ConstOp (INTEGER op, OPT_Node x, OPT_Node y) __GUARDEQP(yval, OPT_ConstDesc) = *xval; } break; - case 4: + case 4: case 5: case 6: if (__IN(g, 0x70)) { - x->typ = y->typ; - } else if (g == 7) { - x->typ = OPT_realtyp; - xval->realval = xval->intval; - } else if (g == 8) { - x->typ = OPT_lrltyp; - xval->realval = xval->intval; - } else { - OPB_err(100); - y->typ = x->typ; - __GUARDEQP(yval, OPT_ConstDesc) = *xval; - } - break; - case 5: - if (g == 4) { - y->typ = OPT_inttyp; - } else if (__IN(g, 0x70)) { - x->typ = y->typ; - } else if (g == 7) { - x->typ = OPT_realtyp; - xval->realval = xval->intval; - } else if (g == 8) { - x->typ = OPT_lrltyp; - xval->realval = xval->intval; - } else { - OPB_err(100); - y->typ = x->typ; - __GUARDEQP(yval, OPT_ConstDesc) = *xval; - } - break; - case 6: - if (__IN(g, 0x70)) { - y->typ = OPT_linttyp; + if (x->typ->size <= y->typ->size) { + x->typ = y->typ; + } else { + x->typ = OPB_IntType(x->typ->size); + } } else if (g == 7) { x->typ = OPT_realtyp; xval->realval = xval->intval; @@ -1197,15 +1198,15 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) (*x)->typ = typ; } -static struct Op__38 { +static struct Op__39 { INTEGER *f, *g; - struct Op__38 *lnk; -} *Op__38_s; + struct Op__39 *lnk; +} *Op__39_s; -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__40 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y); +static BOOLEAN strings__42 (OPT_Node *x, OPT_Node *y); -static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) +static void NewOp__40 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) { OPT_Node node = NIL; node = OPT_NewNode(12); @@ -1216,29 +1217,29 @@ static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y) *x = node; } -static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y) +static BOOLEAN strings__42 (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__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)) { + xCharArr = (__IN((*x)->typ->comp, 0x0c) && (*x)->typ->BaseTyp->form == 3) || *Op__39_s->f == 10; + yCharArr = (__IN((*y)->typ->comp, 0x0c) && (*y)->typ->BaseTyp->form == 3) || *Op__39_s->g == 10; + if ((((xCharArr && *Op__39_s->g == 3)) && (*y)->class == 7)) { OPB_CharToString(*y); - *Op__38_s->g = 10; + *Op__39_s->g = 10; yCharArr = 1; } - if ((((yCharArr && *Op__38_s->f == 3)) && (*x)->class == 7)) { + if ((((yCharArr && *Op__39_s->f == 3)) && (*x)->class == 7)) { OPB_CharToString(*x); - *Op__38_s->f = 10; + *Op__39_s->f = 10; xCharArr = 1; } ok = (xCharArr && yCharArr); if (ok) { - if ((*Op__38_s->f == 10 && (*x)->conval->intval2 == 1)) { + if ((*Op__39_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__38_s->g == 10 && (*y)->conval->intval2 == 1)) { + } else if ((*Op__39_s->g == 10 && (*y)->conval->intval2 == 1)) { (*y)->typ = OPT_chartyp; (*y)->conval->intval = 0; OPB_Index(&*x, OPB_NewIntConst(((LONGINT)(0)))); @@ -1255,11 +1256,11 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPT_Struct typ = NIL; BOOLEAN do_; LONGINT val; - struct Op__38 _s; + struct Op__39 _s; _s.f = &f; _s.g = &g; - _s.lnk = Op__38_s; - Op__38_s = &_s; + _s.lnk = Op__39_s; + Op__39_s = &_s; z = *x; if (((z->class == 8 || z->class == 9) || y->class == 8) || y->class == 9) { OPB_err(126); @@ -1277,15 +1278,8 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(100); } break; - case 4: - if (__IN(g, 0x01f0)) { - OPB_Convert(&z, y->typ); - } else { - OPB_err(100); - } - break; - case 5: - if (g == 4) { + case 4: case 5: case 6: + if ((__IN(g, 0x70) && y->typ->size < z->typ->size)) { OPB_Convert(&y, z->typ); } else if (__IN(g, 0x01f0)) { OPB_Convert(&z, y->typ); @@ -1293,15 +1287,6 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(100); } break; - case 6: - if (__IN(g, 0x70)) { - OPB_Convert(&y, z->typ); - } else if (__IN(g, 0x0180)) { - OPB_Convert(&z, y->typ); - } else { - OPB_err(100); - } - break; case 7: if (__IN(g, 0x70)) { OPB_Convert(&y, z->typ); @@ -1387,7 +1372,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if (do_) { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } break; case 2: @@ -1406,7 +1391,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(102); typ = OPT_undftyp; } - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); break; case 3: do_ = 1; @@ -1429,7 +1414,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) typ = OPT_undftyp; } if (do_) { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } break; case 4: @@ -1447,7 +1432,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(104); typ = OPT_undftyp; } - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); break; case 5: if (f == 2) { @@ -1457,7 +1442,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } else if ((y->class == 7 && OPB_IntToBool(y->conval->intval))) { } else { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } } else if (f != 0) { OPB_err(94); @@ -1480,7 +1465,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } if (do_) { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } break; case 7: @@ -1489,7 +1474,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__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } break; case 8: @@ -1500,7 +1485,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } else if ((y->class == 7 && !OPB_IntToBool(y->conval->intval))) { } else { - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); } } else if (f != 0) { OPB_err(95); @@ -1508,16 +1493,16 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } break; case 9: case 10: - if (__IN(f, 0x6bff) || strings__41(&z, &y)) { + if (__IN(f, 0x6bff) || strings__42(&z, &y)) { typ = OPT_booltyp; } else { OPB_err(107); typ = OPT_undftyp; } - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); break; case 11: case 12: case 13: case 14: - if (__IN(f, 0x01f9) || strings__41(&z, &y)) { + if (__IN(f, 0x01f9) || strings__42(&z, &y)) { typ = OPT_booltyp; } else { OPM_LogWLn(); @@ -1526,7 +1511,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) OPB_err(108); typ = OPT_undftyp; } - NewOp__39(op, typ, &z, y); + NewOp__40(op, typ, &z, y); break; default: OPM_LogWStr((CHAR*)"unhandled case in OPB.Op, op = ", (LONGINT)32); @@ -1536,7 +1521,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y) } } *x = z; - Op__38_s = _s.lnk; + Op__39_s = _s.lnk; } void OPB_SetRange (OPT_Node *x, OPT_Node y) @@ -1633,18 +1618,13 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) OPB_err(113); } break; - case 2: case 3: case 4: case 9: + case 2: case 3: case 9: if (g != f) { OPB_err(113); } break; - case 5: - if (!__IN(g, 0x30)) { - OPB_err(113); - } - break; - case 6: - if (!__IN(g, 0x70)) { + case 4: case 5: case 6: + if (!__IN(g, 0x70) || x->size < y->size) { OPB_err(113); } break; @@ -1746,6 +1726,23 @@ static void OPB_CheckLeaf (OPT_Node x, BOOLEAN dynArrToo) { } +static LONGINT OPB_SignedMaximum (LONGINT bytecount) +{ + LONGINT _o_result; + LONGINT result; + result = 1; + result = __LSH(result, __ASHL(bytecount, 3) - 1, LONGINT); + _o_result = result - 1; + return _o_result; +} + +static LONGINT OPB_SignedMinimum (LONGINT bytecount) +{ + LONGINT _o_result; + _o_result = -OPB_SignedMaximum(bytecount) - 1; + return _o_result; +} + void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) { INTEGER f; @@ -1828,14 +1825,8 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) x = OPB_NewIntConst(((LONGINT)(0))); x->typ = OPT_chartyp; break; - case 4: - x = OPB_NewIntConst(OPM_MinSInt); - break; - case 5: - x = OPB_NewIntConst(OPM_MinInt); - break; - case 6: - x = OPB_NewIntConst(OPM_MinLInt); + case 4: case 5: case 6: + x = OPB_NewIntConst(OPB_SignedMinimum(x->typ->size)); break; case 9: x = OPB_NewIntConst(((LONGINT)(0))); @@ -1865,14 +1856,8 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) x = OPB_NewIntConst(((LONGINT)(255))); x->typ = OPT_chartyp; break; - case 4: - x = OPB_NewIntConst(OPM_MaxSInt); - break; - case 5: - x = OPB_NewIntConst(OPM_MaxInt); - break; - case 6: - x = OPB_NewIntConst(OPM_MaxLInt); + case 4: case 5: case 6: + x = OPB_NewIntConst(OPB_SignedMaximum(x->typ->size)); break; case 9: x = OPB_NewIntConst(OPM_MaxSet); @@ -2058,13 +2043,13 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno) *par0 = x; } -static struct StPar1__52 { - struct StPar1__52 *lnk; -} *StPar1__52_s; +static struct StPar1__56 { + struct StPar1__56 *lnk; +} *StPar1__56_s; -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) +static OPT_Node NewOp__57 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right) { OPT_Node _o_result; OPT_Node node = NIL; @@ -2081,9 +2066,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__52 _s; - _s.lnk = StPar1__52_s; - StPar1__52_s = &_s; + struct StPar1__56 _s; + _s.lnk = StPar1__56_s; + StPar1__56_s = &_s; p = *par0; f = x->typ->form; switch (fctno) { @@ -2099,7 +2084,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) OPB_err(111); } } - p = NewOp__53(19, fctno, p, x); + p = NewOp__57(19, fctno, p, x); p->typ = OPT_notyp; } break; @@ -2110,7 +2095,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (LONGINT)OPM_MaxSet))) { OPB_err(202); } - p = NewOp__53(19, fctno, p, x); + p = NewOp__57(19, fctno, p, x); } else { OPB_err(111); } @@ -2119,7 +2104,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) case 17: if (!__IN(f, 0x70) || x->class != 7) { OPB_err(69); - } else if (f == 4) { + } else if (x->typ->size == 1) { L = (int)x->conval->intval; typ = p->typ; while ((L > 0 && __IN(typ->comp, 0x0c))) { @@ -2135,7 +2120,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) p = p->left; x->conval->intval += 1; } - p = NewOp__53(12, 19, p, x); + p = NewOp__57(12, 19, p, x); p->typ = OPT_linttyp; } else { p = x; @@ -2157,7 +2142,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) t = x; x = p; p = t; - p = NewOp__53(19, 18, p, x); + p = NewOp__57(19, 18, p, x); } else { OPB_err(111); } @@ -2183,7 +2168,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) } p->obj = NIL; } else { - p = NewOp__53(12, 17, p, x); + p = NewOp__57(12, 17, p, x); p->typ = OPT_linttyp; } } else { @@ -2214,9 +2199,9 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) OPB_err(111); } else { if (fctno == 22) { - p = NewOp__53(12, 27, p, x); + p = NewOp__57(12, 27, p, x); } else { - p = NewOp__53(12, 28, p, x); + p = NewOp__57(12, 28, p, x); } p->typ = p->left->typ; } @@ -2233,7 +2218,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) x = p; p = t; } - p = NewOp__53(19, fctno, p, x); + p = NewOp__57(19, fctno, p, x); } else { OPB_err(111); } @@ -2243,7 +2228,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__53(12, 26, p, x); + p = NewOp__57(12, 26, p, x); } else { OPB_err(111); } @@ -2264,7 +2249,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__53(19, 30, p, x); + p = NewOp__57(19, 30, p, x); } else { OPB_err(111); } @@ -2310,7 +2295,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno) break; } *par0 = p; - StPar1__52_s = _s.lnk; + StPar1__56_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 07a13133..f5706dd7 100644 --- a/bootstrap/windows-88/OPB.h +++ b/bootstrap/windows-88/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 dc959d54..efe720a3 100644 --- a/bootstrap/windows-88/OPC.c +++ b/bootstrap/windows-88/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 4441a602..eec830f1 100644 --- a/bootstrap/windows-88/OPC.h +++ b/bootstrap/windows-88/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 20c18510..62922f95 100644 --- a/bootstrap/windows-88/OPM.c +++ b/bootstrap/windows-88/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 d14da113..18397e74 100644 --- a/bootstrap/windows-88/OPM.h +++ b/bootstrap/windows-88/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 b9ce6cca..f69a1750 100644 --- a/bootstrap/windows-88/OPP.c +++ b/bootstrap/windows-88/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPB.h" diff --git a/bootstrap/windows-88/OPP.h b/bootstrap/windows-88/OPP.h index 9bafbb94..6e42de59 100644 --- a/bootstrap/windows-88/OPP.h +++ b/bootstrap/windows-88/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 ed021bc6..57b90bad 100644 --- a/bootstrap/windows-88/OPS.c +++ b/bootstrap/windows-88/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/16] 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 716781ca..b2d2cf55 100644 --- a/bootstrap/windows-88/OPS.h +++ b/bootstrap/windows-88/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/08/16] 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 e36ed325..371d31a9 100644 --- a/bootstrap/windows-88/OPT.c +++ b/bootstrap/windows-88/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" #include "OPM.h" diff --git a/bootstrap/windows-88/OPT.h b/bootstrap/windows-88/OPT.h index b7bb82b3..343a6059 100644 --- a/bootstrap/windows-88/OPT.h +++ b/bootstrap/windows-88/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/windows-88/OPV.c b/bootstrap/windows-88/OPV.c index 539569d5..f5d943cd 100644 --- a/bootstrap/windows-88/OPV.c +++ b/bootstrap/windows-88/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 6ade6c8c..b10b4265 100644 --- a/bootstrap/windows-88/OPV.h +++ b/bootstrap/windows-88/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 4aadbd9a..662ebee0 100644 --- a/bootstrap/windows-88/Platform.c +++ b/bootstrap/windows-88/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 c1f6a134..da294adf 100644 --- a/bootstrap/windows-88/Platform.h +++ b/bootstrap/windows-88/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 a9740584..f38e5bd8 100644 --- a/bootstrap/windows-88/Reals.c +++ b/bootstrap/windows-88/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 c8a7d146..0647106c 100644 --- a/bootstrap/windows-88/Reals.h +++ b/bootstrap/windows-88/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 949951ac..2941064e 100644 --- a/bootstrap/windows-88/SYSTEM.h +++ b/bootstrap/windows-88/SYSTEM.h @@ -4,6 +4,8 @@ #ifndef _WIN32 // Building for a Unix/Linux based system + + // TODO: Remove these includes #include // For memcpy ... #include // For uintptr_t ... @@ -70,6 +72,7 @@ typedef unsigned char U_SHORTINT; #endif typedef U_LONGINT SET; +typedef U_LONGINT U_SET; // OS Memory allocation interfaces are in PlatformXXX.Mod diff --git a/bootstrap/windows-88/Strings.c b/bootstrap/windows-88/Strings.c index 03a18d6b..a1b5c956 100644 --- a/bootstrap/windows-88/Strings.c +++ b/bootstrap/windows-88/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 4363c0d4..29cd1c88 100644 --- a/bootstrap/windows-88/Strings.h +++ b/bootstrap/windows-88/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 600c578b..fa9a1311 100644 --- a/bootstrap/windows-88/Texts.c +++ b/bootstrap/windows-88/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 4c196474..240b0acb 100644 --- a/bootstrap/windows-88/Texts.h +++ b/bootstrap/windows-88/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 3e51f987..bc48ed60 100644 --- a/bootstrap/windows-88/Vishap.c +++ b/bootstrap/windows-88/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/08/16] 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 ef82167a..4911b020 100644 --- a/bootstrap/windows-88/errors.c +++ b/bootstrap/windows-88/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] for gcc LP64 on cygwin xtspkaSfF */ #define LARGE #include "SYSTEM.h" @@ -195,5 +195,6 @@ export void *errors__init(void) __MOVE("implicit type cast", errors_errors[301], 19); __MOVE("inappropriate symbol file ignored", errors_errors[306], 34); __MOVE("no ELSE symbol after CASE statement sequence may lead to trap", errors_errors[307], 62); + __MOVE("SYSTEM.VAL result includes memory past end of source variable", errors_errors[308], 62); __ENDMOD; } diff --git a/bootstrap/windows-88/errors.h b/bootstrap/windows-88/errors.h index f9bc34cb..571c65b9 100644 --- a/bootstrap/windows-88/errors.h +++ b/bootstrap/windows-88/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 a2a218d3..6865568d 100644 --- a/bootstrap/windows-88/extTools.c +++ b/bootstrap/windows-88/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 1bce82ff..88620668 100644 --- a/bootstrap/windows-88/extTools.h +++ b/bootstrap/windows-88/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 672f496c..e668fc2c 100644 --- a/bootstrap/windows-88/vt100.c +++ b/bootstrap/windows-88/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 da57987b..15d39b23 100644 --- a/bootstrap/windows-88/vt100.h +++ b/bootstrap/windows-88/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/08/13] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/08/16] 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 1ffa73a2..3f2bf697 100644 --- a/src/compiler/OPB.Mod +++ b/src/compiler/OPB.Mod @@ -105,24 +105,41 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *) x^.conval := OPT.NewConst(); x^.conval^.setval := {}; RETURN x END EmptySet; + + PROCEDURE SignedByteSize(n: LONGINT): INTEGER; + (* Returns number of bytes required to represent signed value n *) + VAR b: INTEGER; + BEGIN + IF n < 0 THEN n := -(n+1) END; (* Positive value in the range 0 - 7F..FF *) + b := 1; + WHILE b < 8 DO + IF ASH(n, -(8*b-1)) = 0 THEN RETURN b END; + INC(b); + END; + RETURN 8 + END SignedByteSize; + + PROCEDURE IntType(size: LONGINT): OPT.Struct; + (* Selects smallest standard integer type for given size in bytes *) + VAR result: OPT.Struct; + BEGIN + IF size <= OPT.sinttyp.size THEN result := OPT.sinttyp + ELSIF size <= OPT.inttyp.size THEN result := OPT.inttyp + ELSE + result := OPT.linttyp + END; + IF size > OPT.linttyp.size THEN err(203) END; (* Number too large *) + RETURN result + END IntType; + PROCEDURE SetIntType(node: OPT.Node); - VAR v: LONGINT(*SYSTEM.INT64*); - BEGIN v := node^.conval^.intval; - (* TODO: XInt set to size based type *) - IF (OPM.MinSInt <= SYSTEM.VAL(LONGINT, v)) & (SYSTEM.VAL(LONGINT, v) <= OPM.MaxSInt) THEN node^.typ := OPT.sinttyp - ELSIF (OPM.MinInt <= SYSTEM.VAL(LONGINT, v)) & (SYSTEM.VAL(LONGINT, v) <= OPM.MaxInt) THEN node^.typ := OPT.inttyp - ELSIF (OPM.MinLInt <= v) & (v <= OPM.MaxLInt) (*bootstrap or cross*) THEN - node^.typ := OPT.linttyp - (*ELSIF (OPM.MinInt64) <= v) & (v <= OPM.MaxInt64) THEN - node^.typ := OPT.int64typ*) - ELSE err(203); node^.typ := OPT.sinttyp; node^.conval^.intval := 1 - END + BEGIN node.typ := IntType(SignedByteSize(node.conval.intval)) END SetIntType; PROCEDURE NewIntConst*(intval: LONGINT): OPT.Node; VAR x: OPT.Node; BEGIN - x := OPT.NewNode(OPM.Nconst); x^.conval := OPT.NewConst(); + x := OPT.NewNode(OPM.Nconst); x^.conval := OPT.NewConst(); x^.conval^.intval := intval; SetIntType(x); RETURN x END NewIntConst; @@ -420,16 +437,6 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *) END END CheckProc; - PROCEDURE IntType(size: LONGINT): OPT.Struct; - VAR result: OPT.Struct; - BEGIN - IF size = OPT.sinttyp.size THEN result := OPT.sinttyp - ELSIF size = OPT.inttyp.size THEN result := OPT.inttyp - ELSIF size = OPT.linttyp.size THEN result := OPT.linttyp END; - ASSERT(result # NIL,1); - RETURN result - END IntType; - PROCEDURE ConstOp(op: INTEGER; x, y: OPT.Node); VAR f, g: INTEGER; xval, yval: OPT.Const; xv, yv: LONGINT; temp: BOOLEAN; (* temp avoids err 215 *) @@ -541,7 +548,7 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *) (xv > 0) & (yv > 0) & (yv <= MAX(LONGINT) DIV xv) OR (xv > 0) & (yv < 0) & (yv >= MIN(LONGINT) DIV xv) OR (xv < 0) & (yv > 0) & (xv >= MIN(LONGINT) DIV yv) OR - (xv < 0) & (yv < 0) & (xv # MIN(LONGINT)) & (yv # MIN(LONGINT)) & (-xv <= MAX(LONGINT) DIV (-yv)) THEN + (xv < 0) & (yv < 0) & (xv # MIN(LONGINT)) & (yv # MIN(LONGINT)) & (-xv <= MAX(LONGINT) DIV (-yv)) THEN xval^.intval := xv * yv; SetIntType(x) ELSE err(204) END @@ -607,7 +614,7 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *) END |OPM.minus: IF f IN OPM.intSet THEN IF (yval^.intval >= 0) & (xval^.intval >= MIN(LONGINT) + yval^.intval) OR - (yval^.intval < 0) & (xval^.intval <= MAX(LONGINT) + yval^.intval) THEN + (yval^.intval < 0) & (xval^.intval <= MAX(LONGINT) + yval^.intval) THEN DEC(xval^.intval, yval^.intval); SetIntType(x) ELSE err(207) END @@ -830,7 +837,7 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *) IF (y^.class = OPM.Nconst) & (y^.conval^.intval = 0) THEN do := FALSE END END ; IF do THEN NewOp(op, typ, z, y) END - |OPM.minus: IF ~(f IN {OPM.Undef, OPM.SInt..OPM.Set(*, Int8..Int64*)}) THEN err(106); typ := OPT.undftyp END ; + |OPM.minus: IF ~(f IN {OPM.Undef, OPM.SInt..OPM.Set}) THEN err(106); typ := OPT.undftyp END ; IF ~(f IN OPM.intSet) OR (y^.class # OPM.Nconst) OR (y^.conval^.intval # 0) THEN NewOp(op, typ, z, y) END |OPM.or: IF f = OPM.Bool THEN IF z^.class = OPM.Nconst THEN @@ -843,14 +850,14 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *) ELSIF f # OPM.Undef THEN err(95); z^.typ := OPT.undftyp END |OPM.eql, - OPM.neq: IF (f IN {OPM.Undef..OPM.Set, OPM.NilTyp, OPM.Pointer, OPM.ProcTyp(*, Int8..Int64*)}) OR strings(z, y) THEN typ := OPT.booltyp + OPM.neq: IF (f IN {OPM.Undef..OPM.Set, OPM.NilTyp, OPM.Pointer, OPM.ProcTyp}) OR strings(z, y) THEN typ := OPT.booltyp ELSE err(107); typ := OPT.undftyp END ; NewOp(op, typ, z, y) |OPM.lss, OPM.leq, OPM.gtr, - OPM.geq: IF (f IN {OPM.Undef, OPM.Char..OPM.LReal(*, Int8..Int64*)}) OR strings(z, y) THEN typ := OPT.booltyp + OPM.geq: IF (f IN {OPM.Undef, OPM.Char..OPM.LReal}) OR strings(z, y) THEN typ := OPT.booltyp ELSE OPM.LogWLn; OPM.LogWStr("ELSE in Op()"); OPM.LogWLn; err(108); typ := OPT.undftyp @@ -1293,9 +1300,14 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *) END ; p^.typ := OPT.booltyp |OPM.valfn: (*SYSTEM.VAL*) (* type is changed without considering the byte ordering on the target machine *) - IF (x^.class = OPM.Ntype) OR (x^.class = OPM.Nproc) OR - (f IN {OPM.Undef, OPM.String, OPM.NoTyp}) OR (x^.typ^.comp = OPM.DynArr) THEN err(126) - END ; + IF (x^.class = OPM.Ntype) + OR (x^.class = OPM.Nproc) + OR (f IN {OPM.Undef, OPM.String, OPM.NoTyp}) + OR (x^.typ^.comp = OPM.DynArr) THEN + err(126) + END; + (* Warn if the result type includes memory past the end of the source variable *) + (* IF x.typ.size < p.typ.size THEN err(-100) END; *) t := OPT.NewNode(OPM.Nmop); t^.subcl := OPM.val; t^.left := x; x := t; (* IF (x^.class >= OPM.Nconst) OR ((f IN OPM.realSet) # (p^.typ^.form IN OPM.realSet)) THEN @@ -1410,7 +1422,7 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *) BEGIN (* ftyp^.comp = OPM.DynArr *) f := atyp^.comp; ftyp := ftyp^.BaseTyp; atyp := atyp^.BaseTyp; IF fvarpar & (ftyp = OPT.bytetyp) THEN (* ok, but ... *) - IF ~(f IN {OPM.Array, OPM.DynArr}) OR ~(atyp^.form IN {OPM.Byte..OPM.SInt(*, Int8..Int64*)}) THEN + IF ~(f IN {OPM.Array, OPM.DynArr}) OR ~(atyp^.form IN {OPM.Byte..OPM.SInt}) THEN IF OPM.verbose IN OPM.opt THEN err(-301) END END ELSIF f IN {OPM.Array, OPM.DynArr} THEN diff --git a/src/compiler/OPV.Mod b/src/compiler/OPV.Mod index 0df0e920..74c00268 100644 --- a/src/compiler/OPV.Mod +++ b/src/compiler/OPV.Mod @@ -576,6 +576,9 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96 END; expr(l, exprPrec) ELSE + (* + OPM.WriteString("__VAL("); + *) IF (n^.typ^.form IN {OPM.Pointer, OPM.ProcTyp}) OR (l^.typ^.form IN {OPM.Pointer, OPM.ProcTyp}) THEN OPM.WriteString("__VALP("); ELSE diff --git a/src/compiler/errors.Mod b/src/compiler/errors.Mod index 02d6b84a..1546aa8c 100644 --- a/src/compiler/errors.Mod +++ b/src/compiler/errors.Mod @@ -188,6 +188,7 @@ errors[245] := "guarded pointer variable may be manipulated by non-local operati errors[301] := "implicit type cast"; errors[306] := "inappropriate symbol file ignored"; errors[307] := "no ELSE symbol after CASE statement sequence may lead to trap"; (* new warning, -- noch *) +errors[308] := "SYSTEM.VAL result includes memory past end of source variable"; (* DCWB *) END errors. (* @@ -196,8 +197,8 @@ Run-time Error Messages 0 silent HALT(0) 1..255 HALT(n), cf. SYSTEM_halt -1 assertion failed, cf. SYSTEM_assert - -2 invalid array index - -3 function procedure without RETURN statement + -2 invalid array index + -3 function procedure without RETURN statement -4 invalid case in CASE statement -5 type guard failed -6 implicit type guard in record assignment failed diff --git a/src/system/SYSTEM.h b/src/system/SYSTEM.h index 949951ac..2941064e 100644 --- a/src/system/SYSTEM.h +++ b/src/system/SYSTEM.h @@ -4,6 +4,8 @@ #ifndef _WIN32 // Building for a Unix/Linux based system + + // TODO: Remove these includes #include // For memcpy ... #include // For uintptr_t ... @@ -70,6 +72,7 @@ typedef unsigned char U_SHORTINT; #endif typedef U_LONGINT SET; +typedef U_LONGINT U_SET; // OS Memory allocation interfaces are in PlatformXXX.Mod