Base expression casting on C int size, remove dependencies on form=LInt.

This commit is contained in:
David Brown 2016-08-31 17:15:44 +01:00
parent b3c71fb2f0
commit 0508097ffe
199 changed files with 6800 additions and 6540 deletions

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/30] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/31] for gcc LP64 on cygwin xtspkaSfF */
#include "SYSTEM.h"
#include "OPM.h"
#include "OPS.h"
@ -271,7 +271,7 @@ OPT_Node OPB_NewString (OPS_String str, LONGINT len)
x->conval->intval = -1;
x->conval->intval2 = len;
x->conval->ext = OPT_NewExt();
__COPY(str, *x->conval->ext, ((LONGINT)(256)));
__COPY(str, *x->conval->ext, 256);
_o_result = x;
return _o_result;
}
@ -468,7 +468,7 @@ void OPB_In (OPT_Node *x, OPT_Node y)
} else if ((__IN(f, 0x70) && y->typ->form == 9)) {
if ((*x)->class == 7) {
k = (*x)->conval->intval;
if (k < 0 || k > (int)OPM_MaxSet) {
if (k < 0 || k > OPM_MaxSet) {
OPB_err(202);
} else if (y->class == 7) {
(*x)->conval->intval = OPB_BoolToInt(__IN(k, y->conval->setval));
@ -618,7 +618,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x)
case 22:
if (f == 3) {
if (z->class == 7) {
z->conval->intval = (int)__CAP((CHAR)z->conval->intval);
z->conval->intval = __CAP((CHAR)z->conval->intval);
z->obj = NIL;
} else {
z = NewOp__29(op, typ, z);
@ -666,8 +666,8 @@ void OPB_MOp (SHORTINT op, OPT_Node *x)
z->typ = OPT_booltyp;
break;
default:
OPM_LogWStr((CHAR*)"unhandled case in OPB.MOp, op = ", (LONGINT)33);
OPM_LogWNum(op, ((LONGINT)(0)));
OPM_LogWStr((CHAR*)"unhandled case in OPB.MOp, op = ", 33);
OPM_LogWNum(op, 0);
OPM_LogWLn();
break;
}
@ -826,8 +826,8 @@ static INTEGER ConstCmp__14 (void)
}
break;
default:
OPM_LogWStr((CHAR*)"unhandled case in OPB.ConstCmp, f = ", (LONGINT)37);
OPM_LogWNum(*ConstOp__13_s->f, ((LONGINT)(0)));
OPM_LogWStr((CHAR*)"unhandled case in OPB.ConstCmp, f = ", 37);
OPM_LogWNum(*ConstOp__13_s->f, 0);
OPM_LogWLn();
break;
}
@ -1002,7 +1002,7 @@ static void OPB_ConstOp (INTEGER op, OPT_Node x, OPT_Node y)
case 4:
if (__IN(f, 0x70)) {
if (yval->intval != 0) {
xval->intval = __MOD(xval->intval, yval->intval);
xval->intval = (int)__MOD(xval->intval, yval->intval);
OPB_SetIntType(x);
} else {
OPB_err(205);
@ -1105,8 +1105,8 @@ static void OPB_ConstOp (INTEGER op, OPT_Node x, OPT_Node y)
}
break;
default:
OPM_LogWStr((CHAR*)"unhandled case in OPB.ConstOp, op = ", (LONGINT)37);
OPM_LogWNum(op, ((LONGINT)(0)));
OPM_LogWStr((CHAR*)"unhandled case in OPB.ConstOp, op = ", 37);
OPM_LogWNum(op, 0);
OPM_LogWLn();
break;
}
@ -1149,12 +1149,12 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ)
OPB_err(203);
r = (LONGREAL)1;
}
(*x)->conval->intval = (int)__ENTIER(r);
(*x)->conval->intval = (SYSTEM_INT32)__ENTIER(r);
OPB_SetIntType(*x);
}
}
(*x)->obj = NIL;
} else if (((((*x)->class == 11 && (*x)->subcl == 20)) && ((int)(*x)->left->typ->form < f || f > g))) {
} else if (((((*x)->class == 11 && (*x)->subcl == 20)) && ((*x)->left->typ->form < f || f > g))) {
if ((*x)->left->typ == typ) {
*x = (*x)->left;
}
@ -1207,11 +1207,11 @@ static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y)
if ((*Op__38_s->f == 10 && (*x)->conval->intval2 == 1)) {
(*x)->typ = OPT_chartyp;
(*x)->conval->intval = 0;
OPB_Index(&*y, OPB_NewIntConst(((LONGINT)(0))));
OPB_Index(&*y, OPB_NewIntConst(0));
} else if ((*Op__38_s->g == 10 && (*y)->conval->intval2 == 1)) {
(*y)->typ = OPT_chartyp;
(*y)->conval->intval = 0;
OPB_Index(&*x, OPB_NewIntConst(((LONGINT)(0))));
OPB_Index(&*x, OPB_NewIntConst(0));
}
}
_o_result = ok;
@ -1475,7 +1475,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y)
typ = OPT_booltyp;
} else {
OPM_LogWLn();
OPM_LogWStr((CHAR*)"ELSE in Op()", (LONGINT)13);
OPM_LogWStr((CHAR*)"ELSE in Op()", 13);
OPM_LogWLn();
OPB_err(108);
typ = OPT_undftyp;
@ -1483,8 +1483,8 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y)
NewOp__39(op, typ, &z, y);
break;
default:
OPM_LogWStr((CHAR*)"unhandled case in OPB.Op, op = ", (LONGINT)32);
OPM_LogWNum(op, ((LONGINT)(0)));
OPM_LogWStr((CHAR*)"unhandled case in OPB.Op, op = ", 32);
OPM_LogWNum(op, 0);
OPM_LogWLn();
break;
}
@ -1501,13 +1501,13 @@ void OPB_SetRange (OPT_Node *x, OPT_Node y)
} else if ((__IN((*x)->typ->form, 0x70) && __IN(y->typ->form, 0x70))) {
if ((*x)->class == 7) {
k = (*x)->conval->intval;
if (0 > k || k > (int)OPM_MaxSet) {
if (0 > k || k > OPM_MaxSet) {
OPB_err(202);
}
}
if (y->class == 7) {
l = y->conval->intval;
if (0 > l || l > (int)OPM_MaxSet) {
if (0 > l || l > OPM_MaxSet) {
OPB_err(202);
}
}
@ -1537,7 +1537,7 @@ void OPB_SetElem (OPT_Node *x)
OPB_err(93);
} else if ((*x)->class == 7) {
k = (*x)->conval->intval;
if ((0 <= k && k <= (int)OPM_MaxSet)) {
if ((0 <= k && k <= OPM_MaxSet)) {
(*x)->conval->setval = __SETOF(k);
} else {
OPB_err(202);
@ -1556,24 +1556,24 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode)
OPT_Struct p = NIL, q = NIL;
if (OPM_Verbose) {
OPM_LogWLn();
OPM_LogWStr((CHAR*)"PROCEDURE CheckAssign", (LONGINT)22);
OPM_LogWStr((CHAR*)"PROCEDURE CheckAssign", 22);
OPM_LogWLn();
}
y = ynode->typ;
f = x->form;
g = y->form;
if (OPM_Verbose) {
OPM_LogWStr((CHAR*)"y.form = ", (LONGINT)10);
OPM_LogWNum(y->form, ((LONGINT)(0)));
OPM_LogWStr((CHAR*)"y.form = ", 10);
OPM_LogWNum(y->form, 0);
OPM_LogWLn();
OPM_LogWStr((CHAR*)"f = ", (LONGINT)5);
OPM_LogWNum(f, ((LONGINT)(0)));
OPM_LogWStr((CHAR*)"f = ", 5);
OPM_LogWNum(f, 0);
OPM_LogWLn();
OPM_LogWStr((CHAR*)"g = ", (LONGINT)5);
OPM_LogWNum(g, ((LONGINT)(0)));
OPM_LogWStr((CHAR*)"g = ", 5);
OPM_LogWNum(g, 0);
OPM_LogWLn();
OPM_LogWStr((CHAR*)"ynode.typ.syze = ", (LONGINT)18);
OPM_LogWNum(ynode->typ->size, ((LONGINT)(0)));
OPM_LogWStr((CHAR*)"ynode.typ.syze = ", 18);
OPM_LogWNum(ynode->typ->size, 0);
OPM_LogWLn();
}
if (ynode->class == 8 || (ynode->class == 9 && f != 14)) {
@ -1681,8 +1681,8 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode)
}
break;
default:
OPM_LogWStr((CHAR*)"unhandled case in OPB.CheckAssign, f = ", (LONGINT)40);
OPM_LogWNum(f, ((LONGINT)(0)));
OPM_LogWStr((CHAR*)"unhandled case in OPB.CheckAssign, f = ", 40);
OPM_LogWNum(f, 0);
OPM_LogWLn();
break;
}
@ -1774,14 +1774,14 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
x = OPB_NewBoolConst(0);
break;
case 3:
x = OPB_NewIntConst(((LONGINT)(0)));
x = OPB_NewIntConst(0);
x->typ = OPT_chartyp;
break;
case 4: case 5: case 6:
x = OPB_NewIntConst(OPM_SignedMinimum(x->typ->size));
break;
case 9:
x = OPB_NewIntConst(((LONGINT)(0)));
x = OPB_NewIntConst(0);
x->typ = OPT_inttyp;
break;
case 7:
@ -1805,7 +1805,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
x = OPB_NewBoolConst(1);
break;
case 3:
x = OPB_NewIntConst(((LONGINT)(255)));
x = OPB_NewIntConst(255);
x->typ = OPT_chartyp;
break;
case 4: case 5: case 6:
@ -1912,7 +1912,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
if (x->class == 8 || x->class == 9) {
OPB_err(126);
} else if (__IN(f, 0x70)) {
if (x->typ->size != (int)OPM_LIntSize) {
if (x->typ->size != OPM_LIntSize) {
OPB_Convert(&x, OPT_linttyp);
}
} else {
@ -1927,14 +1927,14 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
case 12:
if (x->class != 8) {
OPB_err(110);
x = OPB_NewIntConst(((LONGINT)(1)));
x = OPB_NewIntConst(1);
} else if (__IN(f, 0x63fe) || __IN(x->typ->comp, 0x14)) {
(*OPB_typSize)(x->typ);
x->typ->pvused = 1;
x = OPB_NewIntConst(x->typ->size);
} else {
OPB_err(111);
x = OPB_NewIntConst(((LONGINT)(1)));
x = OPB_NewIntConst(1);
}
break;
case 21:
@ -1952,7 +1952,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
OPB_err(126);
} else if ((((x->class == 7 && __IN(f, 0x70))) && x->typ->size < OPT_linttyp->size)) {
OPB_Convert(&x, OPT_linttyp);
} else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == (int)OPM_PointerSize))) {
} else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == OPM_PointerSize))) {
OPB_err(111);
x->typ = OPT_linttyp;
}
@ -1993,8 +1993,8 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
}
break;
default:
OPM_LogWStr((CHAR*)"unhandled case in OPB.StPar0, fctno = ", (LONGINT)39);
OPM_LogWNum(fctno, ((LONGINT)(0)));
OPM_LogWStr((CHAR*)"unhandled case in OPB.StPar0, fctno = ", 39);
OPM_LogWNum(fctno, 0);
OPM_LogWLn();
break;
}
@ -2050,7 +2050,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)) {
if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (int)OPM_MaxSet))) {
if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > OPM_MaxSet))) {
OPB_err(202);
}
p = NewOp__53(19, fctno, p, x);
@ -2063,7 +2063,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno)
if (!__IN(f, 0x70) || x->class != 7) {
OPB_err(69);
} else if (x->typ->size == 1) {
L = (int)x->conval->intval;
L = x->conval->intval;
typ = p->typ;
while ((L > 0 && __IN(typ->comp, 0x0c))) {
typ = typ->BaseTyp;
@ -2221,7 +2221,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno)
OPB_err(126);
} else if ((((x->class == 7 && __IN(f, 0x70))) && x->typ->size < OPT_linttyp->size)) {
OPB_Convert(&x, OPT_linttyp);
} else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == (int)OPM_PointerSize))) {
} else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == OPM_PointerSize))) {
OPB_err(111);
x->typ = OPT_linttyp;
}
@ -2321,7 +2321,7 @@ void OPB_StFct (OPT_Node *par0, SHORTINT fctno, INTEGER parno)
}
} else {
if (((fctno == 13 || fctno == 14) && parno == 1)) {
OPB_BindNodes(19, OPT_notyp, &p, OPB_NewIntConst(((LONGINT)(1))));
OPB_BindNodes(19, OPT_notyp, &p, OPB_NewIntConst(1));
p->subcl = fctno;
p->right->typ = p->left->typ;
} else if ((fctno == 17 && parno == 1)) {
@ -2343,7 +2343,7 @@ void OPB_StFct (OPT_Node *par0, SHORTINT fctno, INTEGER parno)
} else if (fctno == 32) {
if (parno == 1) {
x = NIL;
OPB_BindNodes(28, OPT_notyp, &x, OPB_NewIntConst(((LONGINT)(0))));
OPB_BindNodes(28, OPT_notyp, &x, OPB_NewIntConst(0));
x->conval = OPT_NewConst();
x->conval->intval = OPM_errpos;
OPB_Construct(15, &p, x);
@ -2578,7 +2578,7 @@ void OPB_Assign (OPT_Node *x, OPT_Node y)
} else if (((((((*x)->typ->comp == 2 && (*x)->typ->BaseTyp == OPT_chartyp)) && y->typ->form == 10)) && y->conval->intval2 == 1)) {
y->typ = OPT_chartyp;
y->conval->intval = 0;
OPB_Index(&*x, OPB_NewIntConst(((LONGINT)(0))));
OPB_Index(&*x, OPB_NewIntConst(0));
}
if ((((((__IN((*x)->typ->comp, 0x0c) && (*x)->typ->BaseTyp == OPT_chartyp)) && __IN(y->typ->comp, 0x0c))) && y->typ->BaseTyp == OPT_chartyp)) {
subcl = 18;