mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 05:12:26 +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);
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue