mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 02:52:24 +00:00
More LONGINT changes to INT64. Hopefully fixes android and pi builds.
This commit is contained in:
parent
1a83167d5a
commit
0ea077814f
18 changed files with 113 additions and 94 deletions
|
|
@ -17,7 +17,7 @@ static int64 OPB_maxExp;
|
||||||
|
|
||||||
export void OPB_Assign (OPT_Node *x, OPT_Node y);
|
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 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);
|
export void OPB_Call (OPT_Node *x, OPT_Node apar, OPT_Object fp);
|
||||||
static void OPB_CharToString (OPT_Node n);
|
static void OPB_CharToString (OPT_Node n);
|
||||||
static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode);
|
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;
|
*last = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 OPB_BoolToInt (BOOLEAN b)
|
static int16 OPB_BoolToInt (BOOLEAN b)
|
||||||
{
|
{
|
||||||
int32 _o_result;
|
int16 _o_result;
|
||||||
if (b) {
|
if (b) {
|
||||||
_o_result = 1;
|
_o_result = 1;
|
||||||
return _o_result;
|
return _o_result;
|
||||||
|
|
@ -931,7 +931,7 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y)
|
||||||
if (f == 4) {
|
if (f == 4) {
|
||||||
xv = xval->intval;
|
xv = xval->intval;
|
||||||
yv = yval->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;
|
xval->intval = xv * yv;
|
||||||
OPB_SetIntType(x);
|
OPB_SetIntType(x);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1008,8 +1008,8 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y)
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
if (f == 4) {
|
if (f == 4) {
|
||||||
temp = (yval->intval >= 0 && xval->intval <= 2147483647 - yval->intval);
|
temp = (yval->intval >= 0 && xval->intval <= 9223372036854775807 - yval->intval);
|
||||||
if (temp || (yval->intval < 0 && xval->intval >= (-2147483647-1) - yval->intval)) {
|
if (temp || (yval->intval < 0 && xval->intval >= (-9223372036854775807-1) - yval->intval)) {
|
||||||
xval->intval += yval->intval;
|
xval->intval += yval->intval;
|
||||||
OPB_SetIntType(x);
|
OPB_SetIntType(x);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1031,7 +1031,7 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y)
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
if (f == 4) {
|
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;
|
xval->intval -= yval->intval;
|
||||||
OPB_SetIntType(x);
|
OPB_SetIntType(x);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1133,7 +1133,7 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ)
|
||||||
OPB_CheckRealType(g, 203, (*x)->conval);
|
OPB_CheckRealType(g, 203, (*x)->conval);
|
||||||
} else {
|
} else {
|
||||||
r = (*x)->conval->realval;
|
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);
|
OPB_err(203);
|
||||||
r = (LONGREAL)1;
|
r = (LONGREAL)1;
|
||||||
}
|
}
|
||||||
|
|
@ -2126,7 +2126,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
|
||||||
OPB_err(126);
|
OPB_err(126);
|
||||||
} else if (p->typ->comp == 3) {
|
} else if (p->typ->comp == 3) {
|
||||||
if (f == 4) {
|
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);
|
OPB_err(63);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2264,7 +2264,7 @@ void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n)
|
||||||
} else if (p->typ->comp != 3) {
|
} else if (p->typ->comp != 3) {
|
||||||
OPB_err(64);
|
OPB_err(64);
|
||||||
} else if (f == 4) {
|
} 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);
|
OPB_err(63);
|
||||||
}
|
}
|
||||||
node = p->right;
|
node = p->right;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ typedef
|
||||||
|
|
||||||
static CHAR OPM_SourceFileName[256];
|
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 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 LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal;
|
||||||
export BOOLEAN OPM_noerr;
|
export BOOLEAN OPM_noerr;
|
||||||
export int32 OPM_curpos, OPM_errpos, OPM_breakpc;
|
export int32 OPM_curpos, OPM_errpos, OPM_breakpc;
|
||||||
|
|
@ -72,8 +72,8 @@ export BOOLEAN OPM_OpenPar (void);
|
||||||
export void OPM_RegisterNewSym (void);
|
export void OPM_RegisterNewSym (void);
|
||||||
static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt);
|
static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt);
|
||||||
static void OPM_ShowLine (int64 pos);
|
static void OPM_ShowLine (int64 pos);
|
||||||
export int32 OPM_SignedMaximum (int32 bytecount);
|
export int64 OPM_SignedMaximum (int32 bytecount);
|
||||||
export int32 OPM_SignedMinimum (int32 bytecount);
|
export int64 OPM_SignedMinimum (int32 bytecount);
|
||||||
export void OPM_SymRCh (CHAR *ch);
|
export void OPM_SymRCh (CHAR *ch);
|
||||||
export int32 OPM_SymRInt (void);
|
export int32 OPM_SymRInt (void);
|
||||||
export int64 OPM_SymRInt64 (void);
|
export int64 OPM_SymRInt64 (void);
|
||||||
|
|
@ -665,19 +665,19 @@ static void OPM_VerboseListSizes (void)
|
||||||
OPM_LogWLn();
|
OPM_LogWLn();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 OPM_SignedMaximum (int32 bytecount)
|
int64 OPM_SignedMaximum (int32 bytecount)
|
||||||
{
|
{
|
||||||
int32 _o_result;
|
int64 _o_result;
|
||||||
int32 result;
|
int64 result;
|
||||||
result = 1;
|
result = 1;
|
||||||
result = __LSH(result, __ASHL(bytecount, 3) - 1, 32);
|
result = __LSH(result, __ASHL(bytecount, 3) - 1, 64);
|
||||||
_o_result = result - 1;
|
_o_result = result - 1;
|
||||||
return _o_result;
|
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;
|
_o_result = -OPM_SignedMaximum(bytecount) - 1;
|
||||||
return _o_result;
|
return _o_result;
|
||||||
}
|
}
|
||||||
|
|
@ -871,7 +871,7 @@ void OPM_WriteInt (int64 i)
|
||||||
{
|
{
|
||||||
CHAR s[24];
|
CHAR s[24];
|
||||||
int64 i1, k;
|
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_Write('(');
|
||||||
OPM_WriteInt(i + 1);
|
OPM_WriteInt(i + 1);
|
||||||
OPM_WriteString((CHAR*)"-1)", 4);
|
OPM_WriteString((CHAR*)"-1)", 4);
|
||||||
|
|
|
||||||
|
|
@ -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 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 LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal;
|
||||||
import BOOLEAN OPM_noerr;
|
import BOOLEAN OPM_noerr;
|
||||||
import int32 OPM_curpos, OPM_errpos, OPM_breakpc;
|
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 void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len);
|
||||||
import BOOLEAN OPM_OpenPar (void);
|
import BOOLEAN OPM_OpenPar (void);
|
||||||
import void OPM_RegisterNewSym (void);
|
import void OPM_RegisterNewSym (void);
|
||||||
import int32 OPM_SignedMaximum (int32 bytecount);
|
import int64 OPM_SignedMaximum (int32 bytecount);
|
||||||
import int32 OPM_SignedMinimum (int32 bytecount);
|
import int64 OPM_SignedMinimum (int32 bytecount);
|
||||||
import void OPM_SymRCh (CHAR *ch);
|
import void OPM_SymRCh (CHAR *ch);
|
||||||
import int32 OPM_SymRInt (void);
|
import int32 OPM_SymRInt (void);
|
||||||
import int64 OPM_SymRInt64 (void);
|
import int64 OPM_SymRInt64 (void);
|
||||||
|
|
|
||||||
|
|
@ -275,7 +275,7 @@ static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned)
|
||||||
OPP_ConstExpression(&x);
|
OPP_ConstExpression(&x);
|
||||||
if (x->typ->form == 4) {
|
if (x->typ->form == 4) {
|
||||||
n = x->conval->intval;
|
n = x->conval->intval;
|
||||||
if (n <= 0 || n > (int64)OPM_MaxIndex) {
|
if (n <= 0 || n > OPM_MaxIndex) {
|
||||||
OPP_err(63);
|
OPP_err(63);
|
||||||
n = 1;
|
n = 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ static int64 OPB_maxExp;
|
||||||
|
|
||||||
export void OPB_Assign (OPT_Node *x, OPT_Node y);
|
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 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);
|
export void OPB_Call (OPT_Node *x, OPT_Node apar, OPT_Object fp);
|
||||||
static void OPB_CharToString (OPT_Node n);
|
static void OPB_CharToString (OPT_Node n);
|
||||||
static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode);
|
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;
|
*last = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 OPB_BoolToInt (BOOLEAN b)
|
static int16 OPB_BoolToInt (BOOLEAN b)
|
||||||
{
|
{
|
||||||
int32 _o_result;
|
int16 _o_result;
|
||||||
if (b) {
|
if (b) {
|
||||||
_o_result = 1;
|
_o_result = 1;
|
||||||
return _o_result;
|
return _o_result;
|
||||||
|
|
@ -931,7 +931,7 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y)
|
||||||
if (f == 4) {
|
if (f == 4) {
|
||||||
xv = xval->intval;
|
xv = xval->intval;
|
||||||
yv = yval->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;
|
xval->intval = xv * yv;
|
||||||
OPB_SetIntType(x);
|
OPB_SetIntType(x);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1008,8 +1008,8 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y)
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
if (f == 4) {
|
if (f == 4) {
|
||||||
temp = (yval->intval >= 0 && xval->intval <= 2147483647 - yval->intval);
|
temp = (yval->intval >= 0 && xval->intval <= 9223372036854775807 - yval->intval);
|
||||||
if (temp || (yval->intval < 0 && xval->intval >= (-2147483647-1) - yval->intval)) {
|
if (temp || (yval->intval < 0 && xval->intval >= (-9223372036854775807-1) - yval->intval)) {
|
||||||
xval->intval += yval->intval;
|
xval->intval += yval->intval;
|
||||||
OPB_SetIntType(x);
|
OPB_SetIntType(x);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1031,7 +1031,7 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y)
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
if (f == 4) {
|
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;
|
xval->intval -= yval->intval;
|
||||||
OPB_SetIntType(x);
|
OPB_SetIntType(x);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1133,7 +1133,7 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ)
|
||||||
OPB_CheckRealType(g, 203, (*x)->conval);
|
OPB_CheckRealType(g, 203, (*x)->conval);
|
||||||
} else {
|
} else {
|
||||||
r = (*x)->conval->realval;
|
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);
|
OPB_err(203);
|
||||||
r = (LONGREAL)1;
|
r = (LONGREAL)1;
|
||||||
}
|
}
|
||||||
|
|
@ -2126,7 +2126,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
|
||||||
OPB_err(126);
|
OPB_err(126);
|
||||||
} else if (p->typ->comp == 3) {
|
} else if (p->typ->comp == 3) {
|
||||||
if (f == 4) {
|
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);
|
OPB_err(63);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2264,7 +2264,7 @@ void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n)
|
||||||
} else if (p->typ->comp != 3) {
|
} else if (p->typ->comp != 3) {
|
||||||
OPB_err(64);
|
OPB_err(64);
|
||||||
} else if (f == 4) {
|
} 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);
|
OPB_err(63);
|
||||||
}
|
}
|
||||||
node = p->right;
|
node = p->right;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ typedef
|
||||||
|
|
||||||
static CHAR OPM_SourceFileName[256];
|
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 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 LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal;
|
||||||
export BOOLEAN OPM_noerr;
|
export BOOLEAN OPM_noerr;
|
||||||
export int32 OPM_curpos, OPM_errpos, OPM_breakpc;
|
export int32 OPM_curpos, OPM_errpos, OPM_breakpc;
|
||||||
|
|
@ -72,8 +72,8 @@ export BOOLEAN OPM_OpenPar (void);
|
||||||
export void OPM_RegisterNewSym (void);
|
export void OPM_RegisterNewSym (void);
|
||||||
static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt);
|
static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt);
|
||||||
static void OPM_ShowLine (int64 pos);
|
static void OPM_ShowLine (int64 pos);
|
||||||
export int32 OPM_SignedMaximum (int32 bytecount);
|
export int64 OPM_SignedMaximum (int32 bytecount);
|
||||||
export int32 OPM_SignedMinimum (int32 bytecount);
|
export int64 OPM_SignedMinimum (int32 bytecount);
|
||||||
export void OPM_SymRCh (CHAR *ch);
|
export void OPM_SymRCh (CHAR *ch);
|
||||||
export int32 OPM_SymRInt (void);
|
export int32 OPM_SymRInt (void);
|
||||||
export int64 OPM_SymRInt64 (void);
|
export int64 OPM_SymRInt64 (void);
|
||||||
|
|
@ -665,19 +665,19 @@ static void OPM_VerboseListSizes (void)
|
||||||
OPM_LogWLn();
|
OPM_LogWLn();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 OPM_SignedMaximum (int32 bytecount)
|
int64 OPM_SignedMaximum (int32 bytecount)
|
||||||
{
|
{
|
||||||
int32 _o_result;
|
int64 _o_result;
|
||||||
int32 result;
|
int64 result;
|
||||||
result = 1;
|
result = 1;
|
||||||
result = __LSH(result, __ASHL(bytecount, 3) - 1, 32);
|
result = __LSH(result, __ASHL(bytecount, 3) - 1, 64);
|
||||||
_o_result = result - 1;
|
_o_result = result - 1;
|
||||||
return _o_result;
|
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;
|
_o_result = -OPM_SignedMaximum(bytecount) - 1;
|
||||||
return _o_result;
|
return _o_result;
|
||||||
}
|
}
|
||||||
|
|
@ -871,7 +871,7 @@ void OPM_WriteInt (int64 i)
|
||||||
{
|
{
|
||||||
CHAR s[24];
|
CHAR s[24];
|
||||||
int64 i1, k;
|
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_Write('(');
|
||||||
OPM_WriteInt(i + 1);
|
OPM_WriteInt(i + 1);
|
||||||
OPM_WriteString((CHAR*)"-1)", 4);
|
OPM_WriteString((CHAR*)"-1)", 4);
|
||||||
|
|
|
||||||
|
|
@ -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 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 LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal;
|
||||||
import BOOLEAN OPM_noerr;
|
import BOOLEAN OPM_noerr;
|
||||||
import int32 OPM_curpos, OPM_errpos, OPM_breakpc;
|
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 void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len);
|
||||||
import BOOLEAN OPM_OpenPar (void);
|
import BOOLEAN OPM_OpenPar (void);
|
||||||
import void OPM_RegisterNewSym (void);
|
import void OPM_RegisterNewSym (void);
|
||||||
import int32 OPM_SignedMaximum (int32 bytecount);
|
import int64 OPM_SignedMaximum (int32 bytecount);
|
||||||
import int32 OPM_SignedMinimum (int32 bytecount);
|
import int64 OPM_SignedMinimum (int32 bytecount);
|
||||||
import void OPM_SymRCh (CHAR *ch);
|
import void OPM_SymRCh (CHAR *ch);
|
||||||
import int32 OPM_SymRInt (void);
|
import int32 OPM_SymRInt (void);
|
||||||
import int64 OPM_SymRInt64 (void);
|
import int64 OPM_SymRInt64 (void);
|
||||||
|
|
|
||||||
|
|
@ -275,7 +275,7 @@ static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned)
|
||||||
OPP_ConstExpression(&x);
|
OPP_ConstExpression(&x);
|
||||||
if (x->typ->form == 4) {
|
if (x->typ->form == 4) {
|
||||||
n = x->conval->intval;
|
n = x->conval->intval;
|
||||||
if (n <= 0 || n > (int64)OPM_MaxIndex) {
|
if (n <= 0 || n > OPM_MaxIndex) {
|
||||||
OPP_err(63);
|
OPP_err(63);
|
||||||
n = 1;
|
n = 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ static int64 OPB_maxExp;
|
||||||
|
|
||||||
export void OPB_Assign (OPT_Node *x, OPT_Node y);
|
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 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);
|
export void OPB_Call (OPT_Node *x, OPT_Node apar, OPT_Object fp);
|
||||||
static void OPB_CharToString (OPT_Node n);
|
static void OPB_CharToString (OPT_Node n);
|
||||||
static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode);
|
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;
|
*last = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int64 OPB_BoolToInt (BOOLEAN b)
|
static int32 OPB_BoolToInt (BOOLEAN b)
|
||||||
{
|
{
|
||||||
int64 _o_result;
|
int32 _o_result;
|
||||||
if (b) {
|
if (b) {
|
||||||
_o_result = 1;
|
_o_result = 1;
|
||||||
return _o_result;
|
return _o_result;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ static int64 OPB_maxExp;
|
||||||
|
|
||||||
export void OPB_Assign (OPT_Node *x, OPT_Node y);
|
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 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);
|
export void OPB_Call (OPT_Node *x, OPT_Node apar, OPT_Object fp);
|
||||||
static void OPB_CharToString (OPT_Node n);
|
static void OPB_CharToString (OPT_Node n);
|
||||||
static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode);
|
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;
|
*last = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 OPB_BoolToInt (BOOLEAN b)
|
static int16 OPB_BoolToInt (BOOLEAN b)
|
||||||
{
|
{
|
||||||
int32 _o_result;
|
int16 _o_result;
|
||||||
if (b) {
|
if (b) {
|
||||||
_o_result = 1;
|
_o_result = 1;
|
||||||
return _o_result;
|
return _o_result;
|
||||||
|
|
@ -931,7 +931,7 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y)
|
||||||
if (f == 4) {
|
if (f == 4) {
|
||||||
xv = xval->intval;
|
xv = xval->intval;
|
||||||
yv = yval->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;
|
xval->intval = xv * yv;
|
||||||
OPB_SetIntType(x);
|
OPB_SetIntType(x);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1008,8 +1008,8 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y)
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
if (f == 4) {
|
if (f == 4) {
|
||||||
temp = (yval->intval >= 0 && xval->intval <= 2147483647 - yval->intval);
|
temp = (yval->intval >= 0 && xval->intval <= 9223372036854775807 - yval->intval);
|
||||||
if (temp || (yval->intval < 0 && xval->intval >= (-2147483647-1) - yval->intval)) {
|
if (temp || (yval->intval < 0 && xval->intval >= (-9223372036854775807-1) - yval->intval)) {
|
||||||
xval->intval += yval->intval;
|
xval->intval += yval->intval;
|
||||||
OPB_SetIntType(x);
|
OPB_SetIntType(x);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1031,7 +1031,7 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y)
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
if (f == 4) {
|
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;
|
xval->intval -= yval->intval;
|
||||||
OPB_SetIntType(x);
|
OPB_SetIntType(x);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1133,7 +1133,7 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ)
|
||||||
OPB_CheckRealType(g, 203, (*x)->conval);
|
OPB_CheckRealType(g, 203, (*x)->conval);
|
||||||
} else {
|
} else {
|
||||||
r = (*x)->conval->realval;
|
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);
|
OPB_err(203);
|
||||||
r = (LONGREAL)1;
|
r = (LONGREAL)1;
|
||||||
}
|
}
|
||||||
|
|
@ -2126,7 +2126,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
|
||||||
OPB_err(126);
|
OPB_err(126);
|
||||||
} else if (p->typ->comp == 3) {
|
} else if (p->typ->comp == 3) {
|
||||||
if (f == 4) {
|
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);
|
OPB_err(63);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2264,7 +2264,7 @@ void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n)
|
||||||
} else if (p->typ->comp != 3) {
|
} else if (p->typ->comp != 3) {
|
||||||
OPB_err(64);
|
OPB_err(64);
|
||||||
} else if (f == 4) {
|
} 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);
|
OPB_err(63);
|
||||||
}
|
}
|
||||||
node = p->right;
|
node = p->right;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ typedef
|
||||||
|
|
||||||
static CHAR OPM_SourceFileName[256];
|
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 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 LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal;
|
||||||
export BOOLEAN OPM_noerr;
|
export BOOLEAN OPM_noerr;
|
||||||
export int32 OPM_curpos, OPM_errpos, OPM_breakpc;
|
export int32 OPM_curpos, OPM_errpos, OPM_breakpc;
|
||||||
|
|
@ -72,8 +72,8 @@ export BOOLEAN OPM_OpenPar (void);
|
||||||
export void OPM_RegisterNewSym (void);
|
export void OPM_RegisterNewSym (void);
|
||||||
static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt);
|
static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt);
|
||||||
static void OPM_ShowLine (int64 pos);
|
static void OPM_ShowLine (int64 pos);
|
||||||
export int32 OPM_SignedMaximum (int32 bytecount);
|
export int64 OPM_SignedMaximum (int32 bytecount);
|
||||||
export int32 OPM_SignedMinimum (int32 bytecount);
|
export int64 OPM_SignedMinimum (int32 bytecount);
|
||||||
export void OPM_SymRCh (CHAR *ch);
|
export void OPM_SymRCh (CHAR *ch);
|
||||||
export int32 OPM_SymRInt (void);
|
export int32 OPM_SymRInt (void);
|
||||||
export int64 OPM_SymRInt64 (void);
|
export int64 OPM_SymRInt64 (void);
|
||||||
|
|
@ -665,19 +665,19 @@ static void OPM_VerboseListSizes (void)
|
||||||
OPM_LogWLn();
|
OPM_LogWLn();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 OPM_SignedMaximum (int32 bytecount)
|
int64 OPM_SignedMaximum (int32 bytecount)
|
||||||
{
|
{
|
||||||
int32 _o_result;
|
int64 _o_result;
|
||||||
int32 result;
|
int64 result;
|
||||||
result = 1;
|
result = 1;
|
||||||
result = __LSH(result, __ASHL(bytecount, 3) - 1, 32);
|
result = __LSH(result, __ASHL(bytecount, 3) - 1, 64);
|
||||||
_o_result = result - 1;
|
_o_result = result - 1;
|
||||||
return _o_result;
|
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;
|
_o_result = -OPM_SignedMaximum(bytecount) - 1;
|
||||||
return _o_result;
|
return _o_result;
|
||||||
}
|
}
|
||||||
|
|
@ -871,7 +871,7 @@ void OPM_WriteInt (int64 i)
|
||||||
{
|
{
|
||||||
CHAR s[24];
|
CHAR s[24];
|
||||||
int64 i1, k;
|
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_Write('(');
|
||||||
OPM_WriteInt(i + 1);
|
OPM_WriteInt(i + 1);
|
||||||
OPM_WriteString((CHAR*)"-1)", 4);
|
OPM_WriteString((CHAR*)"-1)", 4);
|
||||||
|
|
|
||||||
|
|
@ -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 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 LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal;
|
||||||
import BOOLEAN OPM_noerr;
|
import BOOLEAN OPM_noerr;
|
||||||
import int32 OPM_curpos, OPM_errpos, OPM_breakpc;
|
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 void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len);
|
||||||
import BOOLEAN OPM_OpenPar (void);
|
import BOOLEAN OPM_OpenPar (void);
|
||||||
import void OPM_RegisterNewSym (void);
|
import void OPM_RegisterNewSym (void);
|
||||||
import int32 OPM_SignedMaximum (int32 bytecount);
|
import int64 OPM_SignedMaximum (int32 bytecount);
|
||||||
import int32 OPM_SignedMinimum (int32 bytecount);
|
import int64 OPM_SignedMinimum (int32 bytecount);
|
||||||
import void OPM_SymRCh (CHAR *ch);
|
import void OPM_SymRCh (CHAR *ch);
|
||||||
import int32 OPM_SymRInt (void);
|
import int32 OPM_SymRInt (void);
|
||||||
import int64 OPM_SymRInt64 (void);
|
import int64 OPM_SymRInt64 (void);
|
||||||
|
|
|
||||||
|
|
@ -275,7 +275,7 @@ static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned)
|
||||||
OPP_ConstExpression(&x);
|
OPP_ConstExpression(&x);
|
||||||
if (x->typ->form == 4) {
|
if (x->typ->form == 4) {
|
||||||
n = x->conval->intval;
|
n = x->conval->intval;
|
||||||
if (n <= 0 || n > (int64)OPM_MaxIndex) {
|
if (n <= 0 || n > OPM_MaxIndex) {
|
||||||
OPP_err(63);
|
OPP_err(63);
|
||||||
n = 1;
|
n = 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ static int64 OPB_maxExp;
|
||||||
|
|
||||||
export void OPB_Assign (OPT_Node *x, OPT_Node y);
|
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 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);
|
export void OPB_Call (OPT_Node *x, OPT_Node apar, OPT_Object fp);
|
||||||
static void OPB_CharToString (OPT_Node n);
|
static void OPB_CharToString (OPT_Node n);
|
||||||
static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode);
|
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;
|
*last = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int64 OPB_BoolToInt (BOOLEAN b)
|
static int32 OPB_BoolToInt (BOOLEAN b)
|
||||||
{
|
{
|
||||||
int64 _o_result;
|
int32 _o_result;
|
||||||
if (b) {
|
if (b) {
|
||||||
_o_result = 1;
|
_o_result = 1;
|
||||||
return _o_result;
|
return _o_result;
|
||||||
|
|
|
||||||
19
makefile
19
makefile
|
|
@ -157,6 +157,25 @@ full: configuration
|
||||||
@make -f src/tools/make/vishap.make -s showpath
|
@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:
|
assemble:
|
||||||
@make -f src/tools/make/vishap.make -s assemble
|
@make -f src/tools/make/vishap.make -s assemble
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *)
|
||||||
last := y
|
last := y
|
||||||
END Link;
|
END Link;
|
||||||
|
|
||||||
PROCEDURE BoolToInt(b: BOOLEAN): LONGINT;
|
PROCEDURE BoolToInt(b: BOOLEAN): INTEGER;
|
||||||
BEGIN
|
BEGIN
|
||||||
IF b THEN RETURN 1 ELSE RETURN 0 END
|
IF b THEN RETURN 1 ELSE RETURN 0 END
|
||||||
END BoolToInt;
|
END BoolToInt;
|
||||||
|
|
@ -484,10 +484,10 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *)
|
||||||
CASE op OF
|
CASE op OF
|
||||||
|OPS.times: IF f = OPT.Int THEN xv := xval^.intval; yv := yval^.intval;
|
|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 *)
|
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 <= MAX(SYSTEM.INT64) DIV xv) OR
|
||||||
(xv > 0) & (yv < 0) & (yv >= MIN(LONGINT) DIV xv) OR
|
(xv > 0) & (yv < 0) & (yv >= MIN(SYSTEM.INT64) DIV xv) OR
|
||||||
(xv < 0) & (yv > 0) & (xv >= MIN(LONGINT) DIV yv) OR
|
(xv < 0) & (yv > 0) & (xv >= MIN(SYSTEM.INT64) 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(SYSTEM.INT64)) & (yv # MIN(SYSTEM.INT64)) & (-xv <= MAX(SYSTEM.INT64) DIV (-yv)) THEN
|
||||||
xval^.intval := xv * yv; SetIntType(x)
|
xval^.intval := xv * yv; SetIntType(x)
|
||||||
ELSE err(204)
|
ELSE err(204)
|
||||||
END
|
END
|
||||||
|
|
@ -536,8 +536,8 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *)
|
||||||
ELSE err(94)
|
ELSE err(94)
|
||||||
END
|
END
|
||||||
|OPS.plus: IF f = OPT.Int THEN
|
|OPS.plus: IF f = OPT.Int THEN
|
||||||
temp := (yval^.intval >= 0) & (xval^.intval <= MAX(LONGINT) - yval^.intval);
|
temp := (yval^.intval >= 0) & (xval^.intval <= MAX(SYSTEM.INT64) - yval^.intval);
|
||||||
IF temp OR (yval^.intval < 0) & (xval^.intval >= MIN(LONGINT) - yval^.intval) THEN
|
IF temp OR (yval^.intval < 0) & (xval^.intval >= MIN(SYSTEM.INT64) - yval^.intval) THEN
|
||||||
INC(xval^.intval, yval^.intval); SetIntType(x)
|
INC(xval^.intval, yval^.intval); SetIntType(x)
|
||||||
ELSE err(206)
|
ELSE err(206)
|
||||||
END
|
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)
|
ELSIF f # OPT.Undef THEN err(105)
|
||||||
END
|
END
|
||||||
|OPS.minus: IF f = OPT.Int THEN
|
|OPS.minus: IF f = OPT.Int THEN
|
||||||
IF (yval^.intval >= 0) & (xval^.intval >= MIN(LONGINT) + yval^.intval) OR
|
IF (yval^.intval >= 0) & (xval^.intval >= MIN(SYSTEM.INT64) + yval^.intval) OR
|
||||||
(yval^.intval < 0) & (xval^.intval <= MAX(LONGINT) + yval^.intval) THEN
|
(yval^.intval < 0) & (xval^.intval <= MAX(SYSTEM.INT64) + yval^.intval) THEN
|
||||||
DEC(xval^.intval, yval^.intval); SetIntType(x)
|
DEC(xval^.intval, yval^.intval); SetIntType(x)
|
||||||
ELSE err(207)
|
ELSE err(207)
|
||||||
END
|
END
|
||||||
|
|
@ -605,9 +605,9 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *)
|
||||||
END
|
END
|
||||||
ELSIF f IN OPT.realSet THEN
|
ELSIF f IN OPT.realSet THEN
|
||||||
IF g IN OPT.realSet THEN CheckRealType(g, 203, x^.conval)
|
IF g IN OPT.realSet THEN CheckRealType(g, 203, x^.conval)
|
||||||
ELSE (*g = OPT.LInt*)
|
ELSE (* g = OPT.Int *)
|
||||||
r := x^.conval^.realval;
|
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)
|
x^.conval^.intval := ENTIER(r); SetIntType(x)
|
||||||
END
|
END
|
||||||
ELSE (* (f IN {OPT.Char, OPT.Byte}) & (g IN {OPT.Byte} + OPT.intSet) OR (f = OPT.Undef) *)
|
ELSE (* (f IN {OPT.Char, OPT.Byte}) & (g IN {OPT.Byte} + OPT.intSet) OR (f = OPT.Undef) *)
|
||||||
|
|
|
||||||
|
|
@ -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*,
|
LIntSize*, SetSize*, RealSize*, LRealSize*, PointerSize*, ProcSize*, RecSize*,
|
||||||
MaxSet*: INTEGER;
|
MaxSet*: INTEGER;
|
||||||
|
|
||||||
MaxIndex*: LONGINT;
|
MaxIndex*: SYSTEM.INT64;
|
||||||
|
|
||||||
MinReal*, MaxReal*, MinLReal*, MaxLReal*: LONGREAL;
|
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 *)
|
(* Integer size support *)
|
||||||
|
|
||||||
PROCEDURE SignedMaximum*(bytecount: LONGINT): LONGINT;
|
PROCEDURE SignedMaximum*(bytecount: LONGINT): SYSTEM.INT64;
|
||||||
VAR result: LONGINT;
|
VAR result: SYSTEM.INT64;
|
||||||
BEGIN
|
BEGIN
|
||||||
result := 1;
|
result := 1;
|
||||||
result := SYSTEM.LSH(result, bytecount*8-1);
|
result := SYSTEM.LSH(result, bytecount*8-1);
|
||||||
RETURN result - 1;
|
RETURN result - 1;
|
||||||
END SignedMaximum;
|
END SignedMaximum;
|
||||||
|
|
||||||
PROCEDURE SignedMinimum*(bytecount: LONGINT): LONGINT;
|
PROCEDURE SignedMinimum*(bytecount: LONGINT): SYSTEM.INT64;
|
||||||
BEGIN RETURN -SignedMaximum(bytecount) - 1
|
BEGIN RETURN -SignedMaximum(bytecount) - 1
|
||||||
END SignedMinimum;
|
END SignedMinimum;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,7 @@ TODO: Comment disabled lines contain use of VAL that reads beyond source variabl
|
||||||
ooc:
|
ooc:
|
||||||
@printf "\nMaking ooc library\n"
|
@printf "\nMaking ooc library\n"
|
||||||
cd $(BUILDDIR); $(ROOTDIR)/$(VISHAP) -Ffs ../../src/library/ooc/oocLowReal.Mod
|
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/oocRealMath.Mod
|
||||||
# cd $(BUILDDIR); $(ROOTDIR)/$(VISHAP) -Ffs ../../src/library/ooc/oocOakMath.Mod
|
# cd $(BUILDDIR); $(ROOTDIR)/$(VISHAP) -Ffs ../../src/library/ooc/oocOakMath.Mod
|
||||||
# cd $(BUILDDIR); $(ROOTDIR)/$(VISHAP) -Ffs ../../src/library/ooc/oocLRealMath.Mod
|
# cd $(BUILDDIR); $(ROOTDIR)/$(VISHAP) -Ffs ../../src/library/ooc/oocLRealMath.Mod
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue