Moving to config independent types stage 1 - generate intxx types.

This commit is contained in:
David Brown 2016-09-01 14:14:06 +01:00
parent 159f5a3d80
commit ee8342ef0d
168 changed files with 6673 additions and 6565 deletions

View file

@ -6,13 +6,13 @@
export void (*OPB_typSize)(OPT_Struct);
static INTEGER OPB_exp;
static LONGINT OPB_maxExp;
static int16 OPB_exp;
static int32 OPB_maxExp;
export void OPB_Assign (OPT_Node *x, OPT_Node y);
static void OPB_BindNodes (SHORTINT class, OPT_Struct typ, OPT_Node *x, OPT_Node y);
static LONGINT OPB_BoolToInt (BOOLEAN b);
static void OPB_BindNodes (int8 class, OPT_Struct typ, OPT_Node *x, OPT_Node y);
static int32 OPB_BoolToInt (BOOLEAN b);
export void OPB_Call (OPT_Node *x, OPT_Node apar, OPT_Object fp);
static void OPB_CharToString (OPT_Node n);
static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode);
@ -20,10 +20,10 @@ static void OPB_CheckLeaf (OPT_Node x, BOOLEAN dynArrToo);
export void OPB_CheckParameters (OPT_Object fp, OPT_Object ap, BOOLEAN checkNames);
static void OPB_CheckProc (OPT_Struct x, OPT_Object y);
static void OPB_CheckPtr (OPT_Node x, OPT_Node y);
static void OPB_CheckRealType (INTEGER f, INTEGER nr, OPT_Const x);
static void OPB_CheckRealType (int16 f, int16 nr, OPT_Const x);
static void OPB_CheckReceiver (OPT_Node *x, OPT_Object fp);
static void OPB_ConstOp (INTEGER op, OPT_Node x, OPT_Node y);
export void OPB_Construct (SHORTINT class, OPT_Node *x, OPT_Node y);
static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y);
export void OPB_Construct (int8 class, OPT_Node *x, OPT_Node y);
static void OPB_Convert (OPT_Node *x, OPT_Struct typ);
export void OPB_DeRef (OPT_Node *x);
static void OPB_DynArrParCheck (OPT_Struct ftyp, OPT_Struct atyp, BOOLEAN fvarpar);
@ -33,17 +33,17 @@ export void OPB_Field (OPT_Node *x, OPT_Object y);
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 BOOLEAN OPB_IntToBool (int32 i);
export void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y);
export void OPB_MOp (SHORTINT op, OPT_Node *x);
export void OPB_MOp (int8 op, OPT_Node *x);
export OPT_Node OPB_NewBoolConst (BOOLEAN boolval);
export OPT_Node OPB_NewIntConst (LONGINT intval);
export OPT_Node OPB_NewIntConst (int32 intval);
export OPT_Node OPB_NewLeaf (OPT_Object obj);
export OPT_Node OPB_NewRealConst (LONGREAL realval, OPT_Struct typ);
export OPT_Node OPB_NewString (OPS_String str, LONGINT len);
export OPT_Node OPB_NewString (OPS_String str, int32 len);
export OPT_Node OPB_Nil (void);
static BOOLEAN OPB_NotVar (OPT_Node x);
export void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y);
export void OPB_Op (int8 op, OPT_Node *x, OPT_Node y);
export void OPB_OptIf (OPT_Node *x);
export void OPB_Param (OPT_Node ap, OPT_Object fp);
export void OPB_PrepCall (OPT_Node *x, OPT_Object *fpar);
@ -51,17 +51,17 @@ 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);
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);
export void OPB_StParN (OPT_Node *par0, OPT_Node x, INTEGER fctno, INTEGER n);
export void OPB_StaticLink (SHORTINT dlev);
export void OPB_StFct (OPT_Node *par0, int8 fctno, int16 parno);
export void OPB_StPar0 (OPT_Node *par0, int16 fctno);
export void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno);
export void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n);
export void OPB_StaticLink (int8 dlev);
export void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard);
static void OPB_err (INTEGER n);
static LONGINT OPB_log (LONGINT x);
static void OPB_err (int16 n);
static int32 OPB_log (int32 x);
static void OPB_err (INTEGER n)
static void OPB_err (int16 n)
{
OPM_err(n);
}
@ -100,7 +100,7 @@ OPT_Node OPB_NewLeaf (OPT_Object obj)
return _o_result;
}
void OPB_Construct (SHORTINT class, OPT_Node *x, OPT_Node y)
void OPB_Construct (int8 class, OPT_Node *x, OPT_Node y)
{
OPT_Node node = NIL;
node = OPT_NewNode(class);
@ -123,9 +123,9 @@ void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y)
*last = y;
}
static LONGINT OPB_BoolToInt (BOOLEAN b)
static int32 OPB_BoolToInt (BOOLEAN b)
{
LONGINT _o_result;
int32 _o_result;
if (b) {
_o_result = 1;
return _o_result;
@ -136,7 +136,7 @@ static LONGINT OPB_BoolToInt (BOOLEAN b)
__RETCHK;
}
static BOOLEAN OPB_IntToBool (LONGINT i)
static BOOLEAN OPB_IntToBool (int32 i)
{
BOOLEAN _o_result;
if (i == 0) {
@ -222,8 +222,8 @@ OPT_Node OPB_EmptySet (void)
static void OPB_SetIntType (OPT_Node node)
{
INTEGER b;
LONGINT n;
int16 b;
int32 n;
if (node->conval->intval >= 0) {
n = node->conval->intval;
} else {
@ -236,7 +236,7 @@ static void OPB_SetIntType (OPT_Node node)
node->typ = OPT_IntType(b);
}
OPT_Node OPB_NewIntConst (LONGINT intval)
OPT_Node OPB_NewIntConst (int32 intval)
{
OPT_Node _o_result;
OPT_Node x = NIL;
@ -261,7 +261,7 @@ OPT_Node OPB_NewRealConst (LONGREAL realval, OPT_Struct typ)
return _o_result;
}
OPT_Node OPB_NewString (OPS_String str, LONGINT len)
OPT_Node OPB_NewString (OPS_String str, int32 len)
{
OPT_Node _o_result;
OPT_Node x = NIL;
@ -293,7 +293,7 @@ static void OPB_CharToString (OPT_Node n)
n->obj = NIL;
}
static void OPB_BindNodes (SHORTINT class, OPT_Struct typ, OPT_Node *x, OPT_Node y)
static void OPB_BindNodes (int8 class, OPT_Struct typ, OPT_Node *x, OPT_Node y)
{
OPT_Node node = NIL;
node = OPT_NewNode(class);
@ -335,7 +335,7 @@ void OPB_DeRef (OPT_Node *x)
void OPB_Index (OPT_Node *x, OPT_Node y)
{
INTEGER f;
int16 f;
OPT_Struct typ = NIL;
f = y->typ->form;
if ((*x)->class >= 7) {
@ -460,8 +460,8 @@ void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard)
void OPB_In (OPT_Node *x, OPT_Node y)
{
INTEGER f;
LONGINT k;
int16 f;
int32 k;
f = (*x)->typ->form;
if ((((*x)->class == 8 || (*x)->class == 9) || y->class == 8) || y->class == 9) {
OPB_err(126);
@ -487,9 +487,9 @@ void OPB_In (OPT_Node *x, OPT_Node y)
(*x)->typ = OPT_booltyp;
}
static LONGINT OPB_log (LONGINT x)
static int32 OPB_log (int32 x)
{
LONGINT _o_result;
int32 _o_result;
OPB_exp = 0;
if (x > 0) {
while (!__ODD(x)) {
@ -501,7 +501,7 @@ static LONGINT OPB_log (LONGINT x)
return _o_result;
}
static void OPB_CheckRealType (INTEGER f, INTEGER nr, OPT_Const x)
static void OPB_CheckRealType (int16 f, int16 nr, OPT_Const x)
{
LONGREAL min, max, r;
if (f == 5) {
@ -525,9 +525,9 @@ static struct MOp__28 {
struct MOp__28 *lnk;
} *MOp__28_s;
static OPT_Node NewOp__29 (SHORTINT op, OPT_Struct typ, OPT_Node z);
static OPT_Node NewOp__29 (int8 op, OPT_Struct typ, OPT_Node z);
static OPT_Node NewOp__29 (SHORTINT op, OPT_Struct typ, OPT_Node z)
static OPT_Node NewOp__29 (int8 op, OPT_Struct typ, OPT_Node z)
{
OPT_Node _o_result;
OPT_Node node = NIL;
@ -539,9 +539,9 @@ static OPT_Node NewOp__29 (SHORTINT op, OPT_Struct typ, OPT_Node z)
return _o_result;
}
void OPB_MOp (SHORTINT op, OPT_Node *x)
void OPB_MOp (int8 op, OPT_Node *x)
{
INTEGER f;
int16 f;
OPT_Struct typ = NIL;
OPT_Node z = NIL;
struct MOp__28 _s;
@ -618,7 +618,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x)
case 22:
if (f == 3) {
if (z->class == 7) {
z->conval->intval = (SYSTEM_INT16)__CAP((CHAR)z->conval->intval);
z->conval->intval = (int16)__CAP((CHAR)z->conval->intval);
z->obj = NIL;
} else {
z = NewOp__29(op, typ, z);
@ -678,7 +678,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x)
static void OPB_CheckPtr (OPT_Node x, OPT_Node y)
{
INTEGER g;
int16 g;
OPT_Struct p = NIL, q = NIL, t = NIL;
g = y->typ->form;
if (g == 11) {
@ -762,17 +762,17 @@ static void OPB_CheckProc (OPT_Struct x, OPT_Object y)
static struct ConstOp__13 {
OPT_Node *x;
INTEGER *f;
int16 *f;
OPT_Const *xval, *yval;
struct ConstOp__13 *lnk;
} *ConstOp__13_s;
static INTEGER ConstCmp__14 (void);
static int16 ConstCmp__14 (void);
static INTEGER ConstCmp__14 (void)
static int16 ConstCmp__14 (void)
{
INTEGER _o_result;
INTEGER res;
int16 _o_result;
int16 res;
switch (*ConstOp__13_s->f) {
case 0:
res = 9;
@ -836,11 +836,11 @@ static INTEGER ConstCmp__14 (void)
return _o_result;
}
static void OPB_ConstOp (INTEGER op, OPT_Node x, OPT_Node y)
static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y)
{
INTEGER f, g;
int16 f, g;
OPT_Const xval = NIL, yval = NIL;
LONGINT xv, yv;
int32 xv, yv;
BOOLEAN temp;
struct ConstOp__13 _s;
_s.x = &x;
@ -1116,8 +1116,8 @@ static void OPB_ConstOp (INTEGER op, OPT_Node x, OPT_Node y)
static void OPB_Convert (OPT_Node *x, OPT_Struct typ)
{
OPT_Node node = NIL;
INTEGER f, g;
LONGINT k;
int16 f, g;
int32 k;
LONGREAL r;
f = (*x)->typ->form;
g = typ->form;
@ -1149,12 +1149,12 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ)
OPB_err(203);
r = (LONGREAL)1;
}
(*x)->conval->intval = (SYSTEM_INT32)__ENTIER(r);
(*x)->conval->intval = (int32)__ENTIER(r);
OPB_SetIntType(*x);
}
}
(*x)->obj = NIL;
} else if (((((*x)->class == 11 && (*x)->subcl == 20)) && ((SYSTEM_INT16)(*x)->left->typ->form < f || f > g))) {
} else if (((((*x)->class == 11 && (*x)->subcl == 20)) && ((int16)(*x)->left->typ->form < f || f > g))) {
if ((*x)->left->typ == typ) {
*x = (*x)->left;
}
@ -1168,14 +1168,14 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ)
}
static struct Op__38 {
INTEGER *f, *g;
int16 *f, *g;
struct Op__38 *lnk;
} *Op__38_s;
static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y);
static void NewOp__39 (int8 op, OPT_Struct typ, OPT_Node *x, OPT_Node y);
static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y);
static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y)
static void NewOp__39 (int8 op, OPT_Struct typ, OPT_Node *x, OPT_Node y)
{
OPT_Node node = NIL;
node = OPT_NewNode(12);
@ -1218,13 +1218,13 @@ static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y)
return _o_result;
}
void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y)
void OPB_Op (int8 op, OPT_Node *x, OPT_Node y)
{
INTEGER f, g;
int16 f, g;
OPT_Node t = NIL, z = NIL;
OPT_Struct typ = NIL;
BOOLEAN do_;
LONGINT val;
int32 val;
struct Op__38 _s;
_s.f = &f;
_s.g = &g;
@ -1495,7 +1495,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y)
void OPB_SetRange (OPT_Node *x, OPT_Node y)
{
LONGINT k, l;
int32 k, l;
if ((((*x)->class == 8 || (*x)->class == 9) || y->class == 8) || y->class == 9) {
OPB_err(126);
} else if (((*x)->typ->form == 4 && y->typ->form == 4)) {
@ -1530,7 +1530,7 @@ void OPB_SetRange (OPT_Node *x, OPT_Node y)
void OPB_SetElem (OPT_Node *x)
{
LONGINT k;
int32 k;
if ((*x)->class == 8 || (*x)->class == 9) {
OPB_err(126);
} else if ((*x)->typ->form != 4) {
@ -1552,7 +1552,7 @@ void OPB_SetElem (OPT_Node *x)
static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode)
{
OPT_Struct y = NIL;
INTEGER f, g;
int16 f, g;
OPT_Struct p = NIL, q = NIL;
if (OPM_Verbose) {
OPM_LogWLn();
@ -1695,9 +1695,9 @@ static void OPB_CheckLeaf (OPT_Node x, BOOLEAN dynArrToo)
{
}
void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
void OPB_StPar0 (OPT_Node *par0, int16 fctno)
{
INTEGER f;
int16 f;
OPT_Struct typ = NIL;
OPT_Node x = NIL;
x = *par0;
@ -2005,9 +2005,9 @@ static struct StPar1__52 {
struct StPar1__52 *lnk;
} *StPar1__52_s;
static OPT_Node NewOp__53 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right);
static OPT_Node NewOp__53 (int8 class, int8 subcl, OPT_Node left, OPT_Node right);
static OPT_Node NewOp__53 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right)
static OPT_Node NewOp__53 (int8 class, int8 subcl, OPT_Node left, OPT_Node right)
{
OPT_Node _o_result;
OPT_Node node = NIL;
@ -2019,9 +2019,9 @@ static OPT_Node NewOp__53 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_No
return _o_result;
}
void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno)
void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
{
INTEGER f, L;
int16 f, L;
OPT_Struct typ = NIL;
OPT_Node p = NIL, t = NIL;
struct StPar1__52 _s;
@ -2063,7 +2063,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno)
if (!(f == 4) || x->class != 7) {
OPB_err(69);
} else if (x->typ->size == 1) {
L = (SYSTEM_INT16)x->conval->intval;
L = (int16)x->conval->intval;
typ = p->typ;
while ((L > 0 && __IN(typ->comp, 0x0c))) {
typ = typ->BaseTyp;
@ -2259,10 +2259,10 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno)
StPar1__52_s = _s.lnk;
}
void OPB_StParN (OPT_Node *par0, OPT_Node x, INTEGER fctno, INTEGER n)
void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n)
{
OPT_Node node = NIL;
INTEGER f;
int16 f;
OPT_Node p = NIL;
p = *par0;
f = x->typ->form;
@ -2304,9 +2304,9 @@ void OPB_StParN (OPT_Node *par0, OPT_Node x, INTEGER fctno, INTEGER n)
*par0 = p;
}
void OPB_StFct (OPT_Node *par0, SHORTINT fctno, INTEGER parno)
void OPB_StFct (OPT_Node *par0, int8 fctno, int16 parno)
{
INTEGER dim;
int16 dim;
OPT_Node x = NIL, p = NIL;
p = *par0;
if (fctno <= 19) {
@ -2370,7 +2370,7 @@ void OPB_StFct (OPT_Node *par0, SHORTINT fctno, INTEGER parno)
static void OPB_DynArrParCheck (OPT_Struct ftyp, OPT_Struct atyp, BOOLEAN fvarpar)
{
INTEGER f;
int16 f;
f = atyp->comp;
ftyp = ftyp->BaseTyp;
atyp = atyp->BaseTyp;
@ -2479,7 +2479,7 @@ void OPB_Param (OPT_Node ap, OPT_Object fp)
}
}
void OPB_StaticLink (SHORTINT dlev)
void OPB_StaticLink (int8 dlev)
{
OPT_Object scope = NIL;
scope = OPT_topScope;
@ -2494,7 +2494,7 @@ void OPB_Call (OPT_Node *x, OPT_Node apar, OPT_Object fp)
{
OPT_Struct typ = NIL;
OPT_Node p = NIL;
SHORTINT lev;
int8 lev;
if ((*x)->class == 9) {
typ = (*x)->typ;
lev = (*x)->obj->mnolev;
@ -2554,7 +2554,7 @@ void OPB_Return (OPT_Node *x, OPT_Object proc)
void OPB_Assign (OPT_Node *x, OPT_Node y)
{
OPT_Node z = NIL;
SHORTINT subcl;
int8 subcl;
if ((*x)->class >= 7) {
OPB_err(56);
}