diff --git a/bootstrap/unix-44/OPB.c b/bootstrap/unix-44/OPB.c index 13c64396..3ec5dfc2 100644 --- a/bootstrap/unix-44/OPB.c +++ b/bootstrap/unix-44/OPB.c @@ -17,7 +17,7 @@ static int64 OPB_maxExp; export void OPB_Assign (OPT_Node *x, OPT_Node y); static void OPB_BindNodes (int8 class, OPT_Struct typ, OPT_Node *x, OPT_Node y); -static int32 OPB_BoolToInt (BOOLEAN b); +static int16 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); @@ -128,9 +128,9 @@ void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y) *last = y; } -static int32 OPB_BoolToInt (BOOLEAN b) +static int16 OPB_BoolToInt (BOOLEAN b) { - int32 _o_result; + int16 _o_result; if (b) { _o_result = 1; return _o_result; @@ -931,7 +931,7 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y) if (f == 4) { xv = xval->intval; yv = yval->intval; - if (((((xv == 0 || yv == 0) || (((xv > 0 && yv > 0)) && yv <= __DIV(2147483647, xv))) || (((xv > 0 && yv < 0)) && yv >= __DIV((-2147483647-1), xv))) || (((xv < 0 && yv > 0)) && xv >= __DIV((-2147483647-1), yv))) || (((((((xv < 0 && yv < 0)) && xv != (-2147483647-1))) && yv != (-2147483647-1))) && -xv <= __DIV(2147483647, -yv))) { + if (((((xv == 0 || yv == 0) || (((xv > 0 && yv > 0)) && yv <= __DIV(9223372036854775807, xv))) || (((xv > 0 && yv < 0)) && yv >= __DIV((-9223372036854775807-1), xv))) || (((xv < 0 && yv > 0)) && xv >= __DIV((-9223372036854775807-1), yv))) || (((((((xv < 0 && yv < 0)) && xv != (-9223372036854775807-1))) && yv != (-9223372036854775807-1))) && -xv <= __DIV(9223372036854775807, -yv))) { xval->intval = xv * yv; OPB_SetIntType(x); } else { @@ -1008,8 +1008,8 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y) break; case 6: if (f == 4) { - temp = (yval->intval >= 0 && xval->intval <= 2147483647 - yval->intval); - if (temp || (yval->intval < 0 && xval->intval >= (-2147483647-1) - yval->intval)) { + temp = (yval->intval >= 0 && xval->intval <= 9223372036854775807 - yval->intval); + if (temp || (yval->intval < 0 && xval->intval >= (-9223372036854775807-1) - yval->intval)) { xval->intval += yval->intval; OPB_SetIntType(x); } else { @@ -1031,7 +1031,7 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y) break; case 7: if (f == 4) { - if ((yval->intval >= 0 && xval->intval >= (-2147483647-1) + yval->intval) || (yval->intval < 0 && xval->intval <= 2147483647 + yval->intval)) { + if ((yval->intval >= 0 && xval->intval >= (-9223372036854775807-1) + yval->intval) || (yval->intval < 0 && xval->intval <= 9223372036854775807 + yval->intval)) { xval->intval -= yval->intval; OPB_SetIntType(x); } else { @@ -1133,7 +1133,7 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) OPB_CheckRealType(g, 203, (*x)->conval); } else { r = (*x)->conval->realval; - if (r < -2.14748364800000e+009 || r > 2.14748364700000e+009) { + if (r < -9.22337203685478e+018 || r > 9.22337203685478e+018) { OPB_err(203); r = (LONGREAL)1; } @@ -2126,7 +2126,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) OPB_err(126); } else if (p->typ->comp == 3) { if (f == 4) { - if ((x->class == 7 && (x->conval->intval <= 0 || x->conval->intval > (int64)OPM_MaxIndex))) { + if ((x->class == 7 && (x->conval->intval <= 0 || x->conval->intval > OPM_MaxIndex))) { OPB_err(63); } } else { @@ -2264,7 +2264,7 @@ void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n) } else if (p->typ->comp != 3) { OPB_err(64); } else if (f == 4) { - if ((x->class == 7 && (x->conval->intval <= 0 || x->conval->intval > (int64)OPM_MaxIndex))) { + if ((x->class == 7 && (x->conval->intval <= 0 || x->conval->intval > OPM_MaxIndex))) { OPB_err(63); } node = p->right; diff --git a/bootstrap/unix-44/OPM.c b/bootstrap/unix-44/OPM.c index 558dde61..775776f4 100644 --- a/bootstrap/unix-44/OPM.c +++ b/bootstrap/unix-44/OPM.c @@ -20,7 +20,7 @@ typedef static CHAR OPM_SourceFileName[256]; export int16 OPM_Alignment, OPM_ByteSize, OPM_CharSize, OPM_BoolSize, OPM_SIntSize, OPM_IntSize, OPM_LIntSize, OPM_SetSize, OPM_RealSize, OPM_LRealSize, OPM_PointerSize, OPM_ProcSize, OPM_RecSize, OPM_MaxSet; -export int32 OPM_MaxIndex; +export int64 OPM_MaxIndex; export LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal; export BOOLEAN OPM_noerr; export int32 OPM_curpos, OPM_errpos, OPM_breakpc; @@ -72,8 +72,8 @@ export BOOLEAN OPM_OpenPar (void); export void OPM_RegisterNewSym (void); static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt); static void OPM_ShowLine (int64 pos); -export int32 OPM_SignedMaximum (int32 bytecount); -export int32 OPM_SignedMinimum (int32 bytecount); +export int64 OPM_SignedMaximum (int32 bytecount); +export int64 OPM_SignedMinimum (int32 bytecount); export void OPM_SymRCh (CHAR *ch); export int32 OPM_SymRInt (void); export int64 OPM_SymRInt64 (void); @@ -665,19 +665,19 @@ static void OPM_VerboseListSizes (void) OPM_LogWLn(); } -int32 OPM_SignedMaximum (int32 bytecount) +int64 OPM_SignedMaximum (int32 bytecount) { - int32 _o_result; - int32 result; + int64 _o_result; + int64 result; result = 1; - result = __LSH(result, __ASHL(bytecount, 3) - 1, 32); + result = __LSH(result, __ASHL(bytecount, 3) - 1, 64); _o_result = result - 1; return _o_result; } -int32 OPM_SignedMinimum (int32 bytecount) +int64 OPM_SignedMinimum (int32 bytecount) { - int32 _o_result; + int64 _o_result; _o_result = -OPM_SignedMaximum(bytecount) - 1; return _o_result; } @@ -871,7 +871,7 @@ void OPM_WriteInt (int64 i) { CHAR s[24]; int64 i1, k; - if ((i == (int64)OPM_SignedMinimum(OPM_IntSize) || i == (int64)OPM_SignedMinimum(OPM_LIntSize)) || i == (int64)OPM_SignedMinimum(8)) { + if ((i == OPM_SignedMinimum(OPM_IntSize) || i == OPM_SignedMinimum(OPM_LIntSize)) || i == OPM_SignedMinimum(8)) { OPM_Write('('); OPM_WriteInt(i + 1); OPM_WriteString((CHAR*)"-1)", 4); diff --git a/bootstrap/unix-44/OPM.h b/bootstrap/unix-44/OPM.h index c5298326..9d7661c6 100644 --- a/bootstrap/unix-44/OPM.h +++ b/bootstrap/unix-44/OPM.h @@ -7,7 +7,7 @@ import int16 OPM_Alignment, OPM_ByteSize, OPM_CharSize, OPM_BoolSize, OPM_SIntSize, OPM_IntSize, OPM_LIntSize, OPM_SetSize, OPM_RealSize, OPM_LRealSize, OPM_PointerSize, OPM_ProcSize, OPM_RecSize, OPM_MaxSet; -import int32 OPM_MaxIndex; +import int64 OPM_MaxIndex; import LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal; import BOOLEAN OPM_noerr; import int32 OPM_curpos, OPM_errpos, OPM_breakpc; @@ -40,8 +40,8 @@ import void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done); import void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len); import BOOLEAN OPM_OpenPar (void); import void OPM_RegisterNewSym (void); -import int32 OPM_SignedMaximum (int32 bytecount); -import int32 OPM_SignedMinimum (int32 bytecount); +import int64 OPM_SignedMaximum (int32 bytecount); +import int64 OPM_SignedMinimum (int32 bytecount); import void OPM_SymRCh (CHAR *ch); import int32 OPM_SymRInt (void); import int64 OPM_SymRInt64 (void); diff --git a/bootstrap/unix-44/OPP.c b/bootstrap/unix-44/OPP.c index 5351781f..86101b2b 100644 --- a/bootstrap/unix-44/OPP.c +++ b/bootstrap/unix-44/OPP.c @@ -275,7 +275,7 @@ static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned) OPP_ConstExpression(&x); if (x->typ->form == 4) { n = x->conval->intval; - if (n <= 0 || n > (int64)OPM_MaxIndex) { + if (n <= 0 || n > OPM_MaxIndex) { OPP_err(63); n = 1; } diff --git a/bootstrap/unix-48/OPB.c b/bootstrap/unix-48/OPB.c index 13c64396..3ec5dfc2 100644 --- a/bootstrap/unix-48/OPB.c +++ b/bootstrap/unix-48/OPB.c @@ -17,7 +17,7 @@ static int64 OPB_maxExp; export void OPB_Assign (OPT_Node *x, OPT_Node y); static void OPB_BindNodes (int8 class, OPT_Struct typ, OPT_Node *x, OPT_Node y); -static int32 OPB_BoolToInt (BOOLEAN b); +static int16 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); @@ -128,9 +128,9 @@ void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y) *last = y; } -static int32 OPB_BoolToInt (BOOLEAN b) +static int16 OPB_BoolToInt (BOOLEAN b) { - int32 _o_result; + int16 _o_result; if (b) { _o_result = 1; return _o_result; @@ -931,7 +931,7 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y) if (f == 4) { xv = xval->intval; yv = yval->intval; - if (((((xv == 0 || yv == 0) || (((xv > 0 && yv > 0)) && yv <= __DIV(2147483647, xv))) || (((xv > 0 && yv < 0)) && yv >= __DIV((-2147483647-1), xv))) || (((xv < 0 && yv > 0)) && xv >= __DIV((-2147483647-1), yv))) || (((((((xv < 0 && yv < 0)) && xv != (-2147483647-1))) && yv != (-2147483647-1))) && -xv <= __DIV(2147483647, -yv))) { + if (((((xv == 0 || yv == 0) || (((xv > 0 && yv > 0)) && yv <= __DIV(9223372036854775807, xv))) || (((xv > 0 && yv < 0)) && yv >= __DIV((-9223372036854775807-1), xv))) || (((xv < 0 && yv > 0)) && xv >= __DIV((-9223372036854775807-1), yv))) || (((((((xv < 0 && yv < 0)) && xv != (-9223372036854775807-1))) && yv != (-9223372036854775807-1))) && -xv <= __DIV(9223372036854775807, -yv))) { xval->intval = xv * yv; OPB_SetIntType(x); } else { @@ -1008,8 +1008,8 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y) break; case 6: if (f == 4) { - temp = (yval->intval >= 0 && xval->intval <= 2147483647 - yval->intval); - if (temp || (yval->intval < 0 && xval->intval >= (-2147483647-1) - yval->intval)) { + temp = (yval->intval >= 0 && xval->intval <= 9223372036854775807 - yval->intval); + if (temp || (yval->intval < 0 && xval->intval >= (-9223372036854775807-1) - yval->intval)) { xval->intval += yval->intval; OPB_SetIntType(x); } else { @@ -1031,7 +1031,7 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y) break; case 7: if (f == 4) { - if ((yval->intval >= 0 && xval->intval >= (-2147483647-1) + yval->intval) || (yval->intval < 0 && xval->intval <= 2147483647 + yval->intval)) { + if ((yval->intval >= 0 && xval->intval >= (-9223372036854775807-1) + yval->intval) || (yval->intval < 0 && xval->intval <= 9223372036854775807 + yval->intval)) { xval->intval -= yval->intval; OPB_SetIntType(x); } else { @@ -1133,7 +1133,7 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) OPB_CheckRealType(g, 203, (*x)->conval); } else { r = (*x)->conval->realval; - if (r < -2.14748364800000e+009 || r > 2.14748364700000e+009) { + if (r < -9.22337203685478e+018 || r > 9.22337203685478e+018) { OPB_err(203); r = (LONGREAL)1; } @@ -2126,7 +2126,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) OPB_err(126); } else if (p->typ->comp == 3) { if (f == 4) { - if ((x->class == 7 && (x->conval->intval <= 0 || x->conval->intval > (int64)OPM_MaxIndex))) { + if ((x->class == 7 && (x->conval->intval <= 0 || x->conval->intval > OPM_MaxIndex))) { OPB_err(63); } } else { @@ -2264,7 +2264,7 @@ void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n) } else if (p->typ->comp != 3) { OPB_err(64); } else if (f == 4) { - if ((x->class == 7 && (x->conval->intval <= 0 || x->conval->intval > (int64)OPM_MaxIndex))) { + if ((x->class == 7 && (x->conval->intval <= 0 || x->conval->intval > OPM_MaxIndex))) { OPB_err(63); } node = p->right; diff --git a/bootstrap/unix-48/OPM.c b/bootstrap/unix-48/OPM.c index 558dde61..775776f4 100644 --- a/bootstrap/unix-48/OPM.c +++ b/bootstrap/unix-48/OPM.c @@ -20,7 +20,7 @@ typedef static CHAR OPM_SourceFileName[256]; export int16 OPM_Alignment, OPM_ByteSize, OPM_CharSize, OPM_BoolSize, OPM_SIntSize, OPM_IntSize, OPM_LIntSize, OPM_SetSize, OPM_RealSize, OPM_LRealSize, OPM_PointerSize, OPM_ProcSize, OPM_RecSize, OPM_MaxSet; -export int32 OPM_MaxIndex; +export int64 OPM_MaxIndex; export LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal; export BOOLEAN OPM_noerr; export int32 OPM_curpos, OPM_errpos, OPM_breakpc; @@ -72,8 +72,8 @@ export BOOLEAN OPM_OpenPar (void); export void OPM_RegisterNewSym (void); static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt); static void OPM_ShowLine (int64 pos); -export int32 OPM_SignedMaximum (int32 bytecount); -export int32 OPM_SignedMinimum (int32 bytecount); +export int64 OPM_SignedMaximum (int32 bytecount); +export int64 OPM_SignedMinimum (int32 bytecount); export void OPM_SymRCh (CHAR *ch); export int32 OPM_SymRInt (void); export int64 OPM_SymRInt64 (void); @@ -665,19 +665,19 @@ static void OPM_VerboseListSizes (void) OPM_LogWLn(); } -int32 OPM_SignedMaximum (int32 bytecount) +int64 OPM_SignedMaximum (int32 bytecount) { - int32 _o_result; - int32 result; + int64 _o_result; + int64 result; result = 1; - result = __LSH(result, __ASHL(bytecount, 3) - 1, 32); + result = __LSH(result, __ASHL(bytecount, 3) - 1, 64); _o_result = result - 1; return _o_result; } -int32 OPM_SignedMinimum (int32 bytecount) +int64 OPM_SignedMinimum (int32 bytecount) { - int32 _o_result; + int64 _o_result; _o_result = -OPM_SignedMaximum(bytecount) - 1; return _o_result; } @@ -871,7 +871,7 @@ void OPM_WriteInt (int64 i) { CHAR s[24]; int64 i1, k; - if ((i == (int64)OPM_SignedMinimum(OPM_IntSize) || i == (int64)OPM_SignedMinimum(OPM_LIntSize)) || i == (int64)OPM_SignedMinimum(8)) { + if ((i == OPM_SignedMinimum(OPM_IntSize) || i == OPM_SignedMinimum(OPM_LIntSize)) || i == OPM_SignedMinimum(8)) { OPM_Write('('); OPM_WriteInt(i + 1); OPM_WriteString((CHAR*)"-1)", 4); diff --git a/bootstrap/unix-48/OPM.h b/bootstrap/unix-48/OPM.h index c5298326..9d7661c6 100644 --- a/bootstrap/unix-48/OPM.h +++ b/bootstrap/unix-48/OPM.h @@ -7,7 +7,7 @@ import int16 OPM_Alignment, OPM_ByteSize, OPM_CharSize, OPM_BoolSize, OPM_SIntSize, OPM_IntSize, OPM_LIntSize, OPM_SetSize, OPM_RealSize, OPM_LRealSize, OPM_PointerSize, OPM_ProcSize, OPM_RecSize, OPM_MaxSet; -import int32 OPM_MaxIndex; +import int64 OPM_MaxIndex; import LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal; import BOOLEAN OPM_noerr; import int32 OPM_curpos, OPM_errpos, OPM_breakpc; @@ -40,8 +40,8 @@ import void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done); import void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len); import BOOLEAN OPM_OpenPar (void); import void OPM_RegisterNewSym (void); -import int32 OPM_SignedMaximum (int32 bytecount); -import int32 OPM_SignedMinimum (int32 bytecount); +import int64 OPM_SignedMaximum (int32 bytecount); +import int64 OPM_SignedMinimum (int32 bytecount); import void OPM_SymRCh (CHAR *ch); import int32 OPM_SymRInt (void); import int64 OPM_SymRInt64 (void); diff --git a/bootstrap/unix-48/OPP.c b/bootstrap/unix-48/OPP.c index 5351781f..86101b2b 100644 --- a/bootstrap/unix-48/OPP.c +++ b/bootstrap/unix-48/OPP.c @@ -275,7 +275,7 @@ static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned) OPP_ConstExpression(&x); if (x->typ->form == 4) { n = x->conval->intval; - if (n <= 0 || n > (int64)OPM_MaxIndex) { + if (n <= 0 || n > OPM_MaxIndex) { OPP_err(63); n = 1; } diff --git a/bootstrap/unix-88/OPB.c b/bootstrap/unix-88/OPB.c index d94f4b29..bd641a09 100644 --- a/bootstrap/unix-88/OPB.c +++ b/bootstrap/unix-88/OPB.c @@ -17,7 +17,7 @@ static int64 OPB_maxExp; export void OPB_Assign (OPT_Node *x, OPT_Node y); static void OPB_BindNodes (int8 class, OPT_Struct typ, OPT_Node *x, OPT_Node y); -static int64 OPB_BoolToInt (BOOLEAN b); +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); @@ -128,9 +128,9 @@ void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y) *last = y; } -static int64 OPB_BoolToInt (BOOLEAN b) +static int32 OPB_BoolToInt (BOOLEAN b) { - int64 _o_result; + int32 _o_result; if (b) { _o_result = 1; return _o_result; diff --git a/bootstrap/windows-48/OPB.c b/bootstrap/windows-48/OPB.c index 13c64396..3ec5dfc2 100644 --- a/bootstrap/windows-48/OPB.c +++ b/bootstrap/windows-48/OPB.c @@ -17,7 +17,7 @@ static int64 OPB_maxExp; export void OPB_Assign (OPT_Node *x, OPT_Node y); static void OPB_BindNodes (int8 class, OPT_Struct typ, OPT_Node *x, OPT_Node y); -static int32 OPB_BoolToInt (BOOLEAN b); +static int16 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); @@ -128,9 +128,9 @@ void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y) *last = y; } -static int32 OPB_BoolToInt (BOOLEAN b) +static int16 OPB_BoolToInt (BOOLEAN b) { - int32 _o_result; + int16 _o_result; if (b) { _o_result = 1; return _o_result; @@ -931,7 +931,7 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y) if (f == 4) { xv = xval->intval; yv = yval->intval; - if (((((xv == 0 || yv == 0) || (((xv > 0 && yv > 0)) && yv <= __DIV(2147483647, xv))) || (((xv > 0 && yv < 0)) && yv >= __DIV((-2147483647-1), xv))) || (((xv < 0 && yv > 0)) && xv >= __DIV((-2147483647-1), yv))) || (((((((xv < 0 && yv < 0)) && xv != (-2147483647-1))) && yv != (-2147483647-1))) && -xv <= __DIV(2147483647, -yv))) { + if (((((xv == 0 || yv == 0) || (((xv > 0 && yv > 0)) && yv <= __DIV(9223372036854775807, xv))) || (((xv > 0 && yv < 0)) && yv >= __DIV((-9223372036854775807-1), xv))) || (((xv < 0 && yv > 0)) && xv >= __DIV((-9223372036854775807-1), yv))) || (((((((xv < 0 && yv < 0)) && xv != (-9223372036854775807-1))) && yv != (-9223372036854775807-1))) && -xv <= __DIV(9223372036854775807, -yv))) { xval->intval = xv * yv; OPB_SetIntType(x); } else { @@ -1008,8 +1008,8 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y) break; case 6: if (f == 4) { - temp = (yval->intval >= 0 && xval->intval <= 2147483647 - yval->intval); - if (temp || (yval->intval < 0 && xval->intval >= (-2147483647-1) - yval->intval)) { + temp = (yval->intval >= 0 && xval->intval <= 9223372036854775807 - yval->intval); + if (temp || (yval->intval < 0 && xval->intval >= (-9223372036854775807-1) - yval->intval)) { xval->intval += yval->intval; OPB_SetIntType(x); } else { @@ -1031,7 +1031,7 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y) break; case 7: if (f == 4) { - if ((yval->intval >= 0 && xval->intval >= (-2147483647-1) + yval->intval) || (yval->intval < 0 && xval->intval <= 2147483647 + yval->intval)) { + if ((yval->intval >= 0 && xval->intval >= (-9223372036854775807-1) + yval->intval) || (yval->intval < 0 && xval->intval <= 9223372036854775807 + yval->intval)) { xval->intval -= yval->intval; OPB_SetIntType(x); } else { @@ -1133,7 +1133,7 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) OPB_CheckRealType(g, 203, (*x)->conval); } else { r = (*x)->conval->realval; - if (r < -2.14748364800000e+009 || r > 2.14748364700000e+009) { + if (r < -9.22337203685478e+018 || r > 9.22337203685478e+018) { OPB_err(203); r = (LONGREAL)1; } @@ -2126,7 +2126,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) OPB_err(126); } else if (p->typ->comp == 3) { if (f == 4) { - if ((x->class == 7 && (x->conval->intval <= 0 || x->conval->intval > (int64)OPM_MaxIndex))) { + if ((x->class == 7 && (x->conval->intval <= 0 || x->conval->intval > OPM_MaxIndex))) { OPB_err(63); } } else { @@ -2264,7 +2264,7 @@ void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n) } else if (p->typ->comp != 3) { OPB_err(64); } else if (f == 4) { - if ((x->class == 7 && (x->conval->intval <= 0 || x->conval->intval > (int64)OPM_MaxIndex))) { + if ((x->class == 7 && (x->conval->intval <= 0 || x->conval->intval > OPM_MaxIndex))) { OPB_err(63); } node = p->right; diff --git a/bootstrap/windows-48/OPM.c b/bootstrap/windows-48/OPM.c index 558dde61..775776f4 100644 --- a/bootstrap/windows-48/OPM.c +++ b/bootstrap/windows-48/OPM.c @@ -20,7 +20,7 @@ typedef static CHAR OPM_SourceFileName[256]; export int16 OPM_Alignment, OPM_ByteSize, OPM_CharSize, OPM_BoolSize, OPM_SIntSize, OPM_IntSize, OPM_LIntSize, OPM_SetSize, OPM_RealSize, OPM_LRealSize, OPM_PointerSize, OPM_ProcSize, OPM_RecSize, OPM_MaxSet; -export int32 OPM_MaxIndex; +export int64 OPM_MaxIndex; export LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal; export BOOLEAN OPM_noerr; export int32 OPM_curpos, OPM_errpos, OPM_breakpc; @@ -72,8 +72,8 @@ export BOOLEAN OPM_OpenPar (void); export void OPM_RegisterNewSym (void); static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt); static void OPM_ShowLine (int64 pos); -export int32 OPM_SignedMaximum (int32 bytecount); -export int32 OPM_SignedMinimum (int32 bytecount); +export int64 OPM_SignedMaximum (int32 bytecount); +export int64 OPM_SignedMinimum (int32 bytecount); export void OPM_SymRCh (CHAR *ch); export int32 OPM_SymRInt (void); export int64 OPM_SymRInt64 (void); @@ -665,19 +665,19 @@ static void OPM_VerboseListSizes (void) OPM_LogWLn(); } -int32 OPM_SignedMaximum (int32 bytecount) +int64 OPM_SignedMaximum (int32 bytecount) { - int32 _o_result; - int32 result; + int64 _o_result; + int64 result; result = 1; - result = __LSH(result, __ASHL(bytecount, 3) - 1, 32); + result = __LSH(result, __ASHL(bytecount, 3) - 1, 64); _o_result = result - 1; return _o_result; } -int32 OPM_SignedMinimum (int32 bytecount) +int64 OPM_SignedMinimum (int32 bytecount) { - int32 _o_result; + int64 _o_result; _o_result = -OPM_SignedMaximum(bytecount) - 1; return _o_result; } @@ -871,7 +871,7 @@ void OPM_WriteInt (int64 i) { CHAR s[24]; int64 i1, k; - if ((i == (int64)OPM_SignedMinimum(OPM_IntSize) || i == (int64)OPM_SignedMinimum(OPM_LIntSize)) || i == (int64)OPM_SignedMinimum(8)) { + if ((i == OPM_SignedMinimum(OPM_IntSize) || i == OPM_SignedMinimum(OPM_LIntSize)) || i == OPM_SignedMinimum(8)) { OPM_Write('('); OPM_WriteInt(i + 1); OPM_WriteString((CHAR*)"-1)", 4); diff --git a/bootstrap/windows-48/OPM.h b/bootstrap/windows-48/OPM.h index c5298326..9d7661c6 100644 --- a/bootstrap/windows-48/OPM.h +++ b/bootstrap/windows-48/OPM.h @@ -7,7 +7,7 @@ import int16 OPM_Alignment, OPM_ByteSize, OPM_CharSize, OPM_BoolSize, OPM_SIntSize, OPM_IntSize, OPM_LIntSize, OPM_SetSize, OPM_RealSize, OPM_LRealSize, OPM_PointerSize, OPM_ProcSize, OPM_RecSize, OPM_MaxSet; -import int32 OPM_MaxIndex; +import int64 OPM_MaxIndex; import LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal; import BOOLEAN OPM_noerr; import int32 OPM_curpos, OPM_errpos, OPM_breakpc; @@ -40,8 +40,8 @@ import void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done); import void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len); import BOOLEAN OPM_OpenPar (void); import void OPM_RegisterNewSym (void); -import int32 OPM_SignedMaximum (int32 bytecount); -import int32 OPM_SignedMinimum (int32 bytecount); +import int64 OPM_SignedMaximum (int32 bytecount); +import int64 OPM_SignedMinimum (int32 bytecount); import void OPM_SymRCh (CHAR *ch); import int32 OPM_SymRInt (void); import int64 OPM_SymRInt64 (void); diff --git a/bootstrap/windows-48/OPP.c b/bootstrap/windows-48/OPP.c index 5351781f..86101b2b 100644 --- a/bootstrap/windows-48/OPP.c +++ b/bootstrap/windows-48/OPP.c @@ -275,7 +275,7 @@ static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned) OPP_ConstExpression(&x); if (x->typ->form == 4) { n = x->conval->intval; - if (n <= 0 || n > (int64)OPM_MaxIndex) { + if (n <= 0 || n > OPM_MaxIndex) { OPP_err(63); n = 1; } diff --git a/bootstrap/windows-88/OPB.c b/bootstrap/windows-88/OPB.c index d94f4b29..bd641a09 100644 --- a/bootstrap/windows-88/OPB.c +++ b/bootstrap/windows-88/OPB.c @@ -17,7 +17,7 @@ static int64 OPB_maxExp; export void OPB_Assign (OPT_Node *x, OPT_Node y); static void OPB_BindNodes (int8 class, OPT_Struct typ, OPT_Node *x, OPT_Node y); -static int64 OPB_BoolToInt (BOOLEAN b); +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); @@ -128,9 +128,9 @@ void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y) *last = y; } -static int64 OPB_BoolToInt (BOOLEAN b) +static int32 OPB_BoolToInt (BOOLEAN b) { - int64 _o_result; + int32 _o_result; if (b) { _o_result = 1; return _o_result; diff --git a/makefile b/makefile index ade812e7..7f335f34 100644 --- a/makefile +++ b/makefile @@ -157,6 +157,25 @@ full: configuration @make -f src/tools/make/vishap.make -s showpath +# short - like make full, but omitting most libraries +# Convenient for testing changes to the compilersource but not a shippable result +short: configuration + @make -f src/tools/make/vishap.make -s installable + @-make -f src/tools/make/vishap.make -s uninstall + @make -f src/tools/make/vishap.make -s clean +# Make bootstrap compiler from source suitable for current data model + @printf "\n\n--- Compiler build started ---\n\n" + @make -f src/tools/make/vishap.make -s compilerfromsavedsource +# Use bootstrap compiler to make compiler binary from latest compiler sources + @make -f src/tools/make/vishap.make -s translate + @make -f src/tools/make/vishap.make -s assemble +# Use latest compiler to make compiler binary from latest compiler sources + @make -f src/tools/make/vishap.make -s translate + @make -f src/tools/make/vishap.make -s assemble + @printf "\n\n--- Compiler build successfull ---\n\n" + @make -f src/tools/make/vishap.make -s v4 + @make -f src/tools/make/vishap.make -s misc + assemble: @make -f src/tools/make/vishap.make -s assemble diff --git a/src/compiler/OPB.Mod b/src/compiler/OPB.Mod index 79c81b1c..0d840821 100644 --- a/src/compiler/OPB.Mod +++ b/src/compiler/OPB.Mod @@ -52,7 +52,7 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *) last := y END Link; - PROCEDURE BoolToInt(b: BOOLEAN): LONGINT; + PROCEDURE BoolToInt(b: BOOLEAN): INTEGER; BEGIN IF b THEN RETURN 1 ELSE RETURN 0 END END BoolToInt; @@ -484,10 +484,10 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *) CASE op OF |OPS.times: IF f = OPT.Int THEN xv := xval^.intval; yv := yval^.intval; IF (xv = 0) OR (yv = 0) OR (* division with negative numbers is not defined *) - (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) & (yv <= MAX(SYSTEM.INT64) DIV xv) OR + (xv > 0) & (yv < 0) & (yv >= MIN(SYSTEM.INT64) DIV xv) OR + (xv < 0) & (yv > 0) & (xv >= MIN(SYSTEM.INT64) DIV yv) OR + (xv < 0) & (yv < 0) & (xv # MIN(SYSTEM.INT64)) & (yv # MIN(SYSTEM.INT64)) & (-xv <= MAX(SYSTEM.INT64) DIV (-yv)) THEN xval^.intval := xv * yv; SetIntType(x) ELSE err(204) END @@ -536,8 +536,8 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *) ELSE err(94) END |OPS.plus: IF f = OPT.Int THEN - temp := (yval^.intval >= 0) & (xval^.intval <= MAX(LONGINT) - yval^.intval); - IF temp OR (yval^.intval < 0) & (xval^.intval >= MIN(LONGINT) - yval^.intval) THEN + temp := (yval^.intval >= 0) & (xval^.intval <= MAX(SYSTEM.INT64) - yval^.intval); + IF temp OR (yval^.intval < 0) & (xval^.intval >= MIN(SYSTEM.INT64) - yval^.intval) THEN INC(xval^.intval, yval^.intval); SetIntType(x) ELSE err(206) END @@ -552,8 +552,8 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *) ELSIF f # OPT.Undef THEN err(105) END |OPS.minus: IF f = OPT.Int THEN - IF (yval^.intval >= 0) & (xval^.intval >= MIN(LONGINT) + yval^.intval) OR - (yval^.intval < 0) & (xval^.intval <= MAX(LONGINT) + yval^.intval) THEN + IF (yval^.intval >= 0) & (xval^.intval >= MIN(SYSTEM.INT64) + yval^.intval) OR + (yval^.intval < 0) & (xval^.intval <= MAX(SYSTEM.INT64) + yval^.intval) THEN DEC(xval^.intval, yval^.intval); SetIntType(x) ELSE err(207) END @@ -605,9 +605,9 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *) END ELSIF f IN OPT.realSet THEN IF g IN OPT.realSet THEN CheckRealType(g, 203, x^.conval) - ELSE (*g = OPT.LInt*) + ELSE (* g = OPT.Int *) r := x^.conval^.realval; - IF (r < MIN(LONGINT)) OR (r > MAX(LONGINT)) THEN err(203); r := 1 END ; + IF (r < MIN(SYSTEM.INT64)) OR (r > MAX(SYSTEM.INT64)) THEN err(203); r := 1 END ; x^.conval^.intval := ENTIER(r); SetIntType(x) END ELSE (* (f IN {OPT.Char, OPT.Byte}) & (g IN {OPT.Byte} + OPT.intSet) OR (f = OPT.Undef) *) diff --git a/src/compiler/OPM.cmdln.Mod b/src/compiler/OPM.cmdln.Mod index b497829f..b70b8474 100644 --- a/src/compiler/OPM.cmdln.Mod +++ b/src/compiler/OPM.cmdln.Mod @@ -94,7 +94,7 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) LIntSize*, SetSize*, RealSize*, LRealSize*, PointerSize*, ProcSize*, RecSize*, MaxSet*: INTEGER; - MaxIndex*: LONGINT; + MaxIndex*: SYSTEM.INT64; MinReal*, MaxReal*, MinLReal*, MaxLReal*: LONGREAL; @@ -557,15 +557,15 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) (* Integer size support *) - PROCEDURE SignedMaximum*(bytecount: LONGINT): LONGINT; - VAR result: LONGINT; + PROCEDURE SignedMaximum*(bytecount: LONGINT): SYSTEM.INT64; + VAR result: SYSTEM.INT64; BEGIN result := 1; result := SYSTEM.LSH(result, bytecount*8-1); RETURN result - 1; END SignedMaximum; - PROCEDURE SignedMinimum*(bytecount: LONGINT): LONGINT; + PROCEDURE SignedMinimum*(bytecount: LONGINT): SYSTEM.INT64; BEGIN RETURN -SignedMaximum(bytecount) - 1 END SignedMinimum; diff --git a/src/tools/make/vishap.make b/src/tools/make/vishap.make index faacf33f..5b854fa2 100644 --- a/src/tools/make/vishap.make +++ b/src/tools/make/vishap.make @@ -225,7 +225,7 @@ TODO: Comment disabled lines contain use of VAL that reads beyond source variabl ooc: @printf "\nMaking ooc library\n" cd $(BUILDDIR); $(ROOTDIR)/$(VISHAP) -Ffs ../../src/library/ooc/oocLowReal.Mod -# cd $(BUILDDIR); $(ROOTDIR)/$(VISHAP) -Ffs ../../src/library/ooc/oocLowLReal.Mod + cd $(BUILDDIR); $(ROOTDIR)/$(VISHAP) -Ffs ../../src/library/ooc/oocLowLReal.Mod # cd $(BUILDDIR); $(ROOTDIR)/$(VISHAP) -Ffs ../../src/library/ooc/oocRealMath.Mod # cd $(BUILDDIR); $(ROOTDIR)/$(VISHAP) -Ffs ../../src/library/ooc/oocOakMath.Mod # cd $(BUILDDIR); $(ROOTDIR)/$(VISHAP) -Ffs ../../src/library/ooc/oocLRealMath.Mod