INT64 support in the interface browser.

This commit is contained in:
David Brown 2016-09-18 15:52:11 +01:00
parent 08f09a097d
commit 9971e56451
68 changed files with 756 additions and 574 deletions

View file

@ -16,7 +16,7 @@ export void Console_Bool (BOOLEAN b);
export void Console_Char (CHAR ch); export void Console_Char (CHAR ch);
export void Console_Flush (void); export void Console_Flush (void);
export void Console_Hex (int32 i); export void Console_Hex (int32 i);
export void Console_Int (int32 i, int32 n); export void Console_Int (int64 i, int64 n);
export void Console_Ln (void); export void Console_Ln (void);
export void Console_Read (CHAR *ch); export void Console_Read (CHAR *ch);
export void Console_ReadLine (CHAR *line, LONGINT line__len); export void Console_ReadLine (CHAR *line, LONGINT line__len);
@ -54,15 +54,15 @@ void Console_String (CHAR *s, LONGINT s__len)
__DEL(s); __DEL(s);
} }
void Console_Int (int32 i, int32 n) void Console_Int (int64 i, int64 n)
{ {
CHAR s[32]; CHAR s[32];
int32 i1, k; int32 i1, k;
if (i == __LSHL(1, 31, 32)) { if (i == (int64)__LSHL(1, 31, 32)) {
__MOVE("8463847412", s, 11); __MOVE("8463847412", s, 11);
k = 10; k = 10;
} else { } else {
i1 = __ABS(i); i1 = __ABS(__VAL(int32, i));
s[0] = (CHAR)((int)__MOD(i1, 10) + 48); s[0] = (CHAR)((int)__MOD(i1, 10) + 48);
i1 = __DIV(i1, 10); i1 = __DIV(i1, 10);
k = 1; k = 1;
@ -76,7 +76,7 @@ void Console_Int (int32 i, int32 n)
s[__X(k, 32)] = '-'; s[__X(k, 32)] = '-';
k += 1; k += 1;
} }
while (n > k) { while (n > (int64)k) {
Console_Char(' '); Console_Char(' ');
n -= 1; n -= 1;
} }

View file

@ -12,7 +12,7 @@ import void Console_Bool (BOOLEAN b);
import void Console_Char (CHAR ch); import void Console_Char (CHAR ch);
import void Console_Flush (void); import void Console_Flush (void);
import void Console_Hex (int32 i); import void Console_Hex (int32 i);
import void Console_Int (int32 i, int32 n); import void Console_Int (int64 i, int64 n);
import void Console_Ln (void); import void Console_Ln (void);
import void Console_Read (CHAR *ch); import void Console_Read (CHAR *ch);
import void Console_ReadLine (CHAR *line, LONGINT line__len); import void Console_ReadLine (CHAR *line, LONGINT line__len);

View file

@ -90,6 +90,7 @@ export void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, int32 *x);
export void Files_ReadLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL *x); export void Files_ReadLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL *x);
export void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); export void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
export void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int32 *x); export void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int32 *x);
export void Files_ReadNum64 (Files_Rider *R, LONGINT *R__typ, int64 *x);
export void Files_ReadReal (Files_Rider *R, LONGINT *R__typ, REAL *x); export void Files_ReadReal (Files_Rider *R, LONGINT *R__typ, REAL *x);
export void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x); export void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x);
export void Files_ReadString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); export void Files_ReadString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
@ -105,6 +106,7 @@ export void Files_WriteInt (Files_Rider *R, LONGINT *R__typ, int16 x);
export void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int32 x); export void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int32 x);
export void Files_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL x); export void Files_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL x);
export void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int32 x); export void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int32 x);
export void Files_WriteNum64 (Files_Rider *R, LONGINT *R__typ, int64 x);
export void Files_WriteReal (Files_Rider *R, LONGINT *R__typ, REAL x); export void Files_WriteReal (Files_Rider *R, LONGINT *R__typ, REAL x);
export void Files_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x); export void Files_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x);
export void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); export void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
@ -936,6 +938,13 @@ void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int32 *x)
*x = n; *x = n;
} }
void Files_ReadNum64 (Files_Rider *R, LONGINT *R__typ, int64 *x)
{
int32 n;
Files_ReadNum(&*R, R__typ, &n);
*x = n;
}
void Files_WriteBool (Files_Rider *R, LONGINT *R__typ, BOOLEAN x) void Files_WriteBool (Files_Rider *R, LONGINT *R__typ, BOOLEAN x)
{ {
Files_Write(&*R, R__typ, __VAL(CHAR, x)); Files_Write(&*R, R__typ, __VAL(CHAR, x));
@ -1004,6 +1013,15 @@ void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int32 x)
Files_Write(&*R, R__typ, (CHAR)__MASK(x, -128)); Files_Write(&*R, R__typ, (CHAR)__MASK(x, -128));
} }
void Files_WriteNum64 (Files_Rider *R, LONGINT *R__typ, int64 x)
{
while (x < -64 || x > 63) {
Files_Write(&*R, R__typ, (CHAR)(__MASK(x, -128) + 128));
x = __ASHR(x, 7);
}
Files_Write(&*R, R__typ, (CHAR)__MASK(x, -128));
}
void Files_GetName (Files_File f, CHAR *name, LONGINT name__len) void Files_GetName (Files_File f, CHAR *name, LONGINT name__len)
{ {
__COPY(f->workName, name, name__len); __COPY(f->workName, name, name__len);

View file

@ -47,6 +47,7 @@ import void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, int32 *x);
import void Files_ReadLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL *x); import void Files_ReadLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL *x);
import void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); import void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
import void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int32 *x); import void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int32 *x);
import void Files_ReadNum64 (Files_Rider *R, LONGINT *R__typ, int64 *x);
import void Files_ReadReal (Files_Rider *R, LONGINT *R__typ, REAL *x); import void Files_ReadReal (Files_Rider *R, LONGINT *R__typ, REAL *x);
import void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x); import void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x);
import void Files_ReadString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); import void Files_ReadString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
@ -61,6 +62,7 @@ import void Files_WriteInt (Files_Rider *R, LONGINT *R__typ, int16 x);
import void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int32 x); import void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int32 x);
import void Files_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL x); import void Files_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL x);
import void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int32 x); import void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int32 x);
import void Files_WriteNum64 (Files_Rider *R, LONGINT *R__typ, int64 x);
import void Files_WriteReal (Files_Rider *R, LONGINT *R__typ, REAL x); import void Files_WriteReal (Files_Rider *R, LONGINT *R__typ, REAL x);
import void Files_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x); import void Files_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x);
import void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); import void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);

View file

@ -12,7 +12,7 @@
export void (*OPB_typSize)(OPT_Struct); export void (*OPB_typSize)(OPT_Struct);
static int16 OPB_exp; static int16 OPB_exp;
static int32 OPB_maxExp; static int64 OPB_maxExp;
export void OPB_Assign (OPT_Node *x, OPT_Node y); export void OPB_Assign (OPT_Node *x, OPT_Node y);
@ -38,14 +38,14 @@ export void OPB_Field (OPT_Node *x, OPT_Object y);
export void OPB_In (OPT_Node *x, OPT_Node y); export void OPB_In (OPT_Node *x, OPT_Node y);
export void OPB_Index (OPT_Node *x, OPT_Node y); export void OPB_Index (OPT_Node *x, OPT_Node y);
export void OPB_Inittd (OPT_Node *inittd, OPT_Node *last, OPT_Struct typ); export void OPB_Inittd (OPT_Node *inittd, OPT_Node *last, OPT_Struct typ);
static BOOLEAN OPB_IntToBool (int32 i); static BOOLEAN OPB_IntToBool (int64 i);
export void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y); export void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y);
export void OPB_MOp (int8 op, OPT_Node *x); export void OPB_MOp (int8 op, OPT_Node *x);
export OPT_Node OPB_NewBoolConst (BOOLEAN boolval); export OPT_Node OPB_NewBoolConst (BOOLEAN boolval);
export OPT_Node OPB_NewIntConst (int32 intval); export OPT_Node OPB_NewIntConst (int64 intval);
export OPT_Node OPB_NewLeaf (OPT_Object obj); export OPT_Node OPB_NewLeaf (OPT_Object obj);
export OPT_Node OPB_NewRealConst (LONGREAL realval, OPT_Struct typ); export OPT_Node OPB_NewRealConst (LONGREAL realval, OPT_Struct typ);
export OPT_Node OPB_NewString (OPS_String str, int32 len); export OPT_Node OPB_NewString (OPS_String str, int64 len);
export OPT_Node OPB_Nil (void); export OPT_Node OPB_Nil (void);
static BOOLEAN OPB_NotVar (OPT_Node x); static BOOLEAN OPB_NotVar (OPT_Node x);
export void OPB_Op (int8 op, OPT_Node *x, OPT_Node y); export void OPB_Op (int8 op, OPT_Node *x, OPT_Node y);
@ -63,7 +63,7 @@ export void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n);
export void OPB_StaticLink (int8 dlev); export void OPB_StaticLink (int8 dlev);
export void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard); export void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard);
static void OPB_err (int16 n); static void OPB_err (int16 n);
static int32 OPB_log (int32 x); static int64 OPB_log (int64 x);
static void OPB_err (int16 n) static void OPB_err (int16 n)
@ -141,17 +141,11 @@ static int32 OPB_BoolToInt (BOOLEAN b)
__RETCHK; __RETCHK;
} }
static BOOLEAN OPB_IntToBool (int32 i) static BOOLEAN OPB_IntToBool (int64 i)
{ {
BOOLEAN _o_result; BOOLEAN _o_result;
if (i == 0) { _o_result = i != 0;
_o_result = 0;
return _o_result; return _o_result;
} else {
_o_result = 1;
return _o_result;
}
__RETCHK;
} }
OPT_Node OPB_NewBoolConst (BOOLEAN boolval) OPT_Node OPB_NewBoolConst (BOOLEAN boolval)
@ -228,7 +222,7 @@ OPT_Node OPB_EmptySet (void)
static void OPB_SetIntType (OPT_Node node) static void OPB_SetIntType (OPT_Node node)
{ {
int16 b; int16 b;
int32 n; int64 n;
if (node->conval->intval >= 0) { if (node->conval->intval >= 0) {
n = node->conval->intval; n = node->conval->intval;
} else { } else {
@ -241,7 +235,7 @@ static void OPB_SetIntType (OPT_Node node)
node->typ = OPT_IntType(b); node->typ = OPT_IntType(b);
} }
OPT_Node OPB_NewIntConst (int32 intval) OPT_Node OPB_NewIntConst (int64 intval)
{ {
OPT_Node _o_result; OPT_Node _o_result;
OPT_Node x = NIL; OPT_Node x = NIL;
@ -266,7 +260,7 @@ OPT_Node OPB_NewRealConst (LONGREAL realval, OPT_Struct typ)
return _o_result; return _o_result;
} }
OPT_Node OPB_NewString (OPS_String str, int32 len) OPT_Node OPB_NewString (OPS_String str, int64 len)
{ {
OPT_Node _o_result; OPT_Node _o_result;
OPT_Node x = NIL; OPT_Node x = NIL;
@ -274,7 +268,7 @@ OPT_Node OPB_NewString (OPS_String str, int32 len)
x->conval = OPT_NewConst(); x->conval = OPT_NewConst();
x->typ = OPT_stringtyp; x->typ = OPT_stringtyp;
x->conval->intval = -1; x->conval->intval = -1;
x->conval->intval2 = len; x->conval->intval2 = OPM_Longint(len);
x->conval->ext = OPT_NewExt(); x->conval->ext = OPT_NewExt();
__COPY(str, *x->conval->ext, 256); __COPY(str, *x->conval->ext, 256);
_o_result = x; _o_result = x;
@ -351,7 +345,7 @@ void OPB_Index (OPT_Node *x, OPT_Node y)
} }
if ((*x)->typ->comp == 2) { if ((*x)->typ->comp == 2) {
typ = (*x)->typ->BaseTyp; typ = (*x)->typ->BaseTyp;
if ((y->class == 7 && (y->conval->intval < 0 || y->conval->intval >= (*x)->typ->n))) { if ((y->class == 7 && (y->conval->intval < 0 || y->conval->intval >= (int64)(*x)->typ->n))) {
OPB_err(81); OPB_err(81);
} }
} else if ((*x)->typ->comp == 3) { } else if ((*x)->typ->comp == 3) {
@ -466,14 +460,14 @@ void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard)
void OPB_In (OPT_Node *x, OPT_Node y) void OPB_In (OPT_Node *x, OPT_Node y)
{ {
int16 f; int16 f;
int32 k; int64 k;
f = (*x)->typ->form; f = (*x)->typ->form;
if ((((*x)->class == 8 || (*x)->class == 9) || y->class == 8) || y->class == 9) { if ((((*x)->class == 8 || (*x)->class == 9) || y->class == 8) || y->class == 9) {
OPB_err(126); OPB_err(126);
} else if ((f == 4 && y->typ->form == 7)) { } else if ((f == 4 && y->typ->form == 7)) {
if ((*x)->class == 7) { if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if (k < 0 || k > OPM_MaxSet) { if (k < 0 || k > (int64)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} else if (y->class == 7) { } else if (y->class == 7) {
(*x)->conval->intval = OPB_BoolToInt(__IN(k, y->conval->setval, 32)); (*x)->conval->intval = OPB_BoolToInt(__IN(k, y->conval->setval, 32));
@ -492,9 +486,9 @@ void OPB_In (OPT_Node *x, OPT_Node y)
(*x)->typ = OPT_booltyp; (*x)->typ = OPT_booltyp;
} }
static int32 OPB_log (int32 x) static int64 OPB_log (int64 x)
{ {
int32 _o_result; int64 _o_result;
OPB_exp = 0; OPB_exp = 0;
if (x > 0) { if (x > 0) {
while (!__ODD(x)) { while (!__ODD(x)) {
@ -580,7 +574,7 @@ void OPB_MOp (int8 op, OPT_Node *x)
if (__IN(f, 0xf0, 32)) { if (__IN(f, 0xf0, 32)) {
if (z->class == 7) { if (z->class == 7) {
if (f == 4) { if (f == 4) {
if (z->conval->intval == (-2147483647-1)) { if (z->conval->intval == (-9223372036854775807-1)) {
OPB_err(203); OPB_err(203);
} else { } else {
z->conval->intval = -z->conval->intval; z->conval->intval = -z->conval->intval;
@ -603,7 +597,7 @@ void OPB_MOp (int8 op, OPT_Node *x)
if (__IN(f, 0x70, 32)) { if (__IN(f, 0x70, 32)) {
if (z->class == 7) { if (z->class == 7) {
if (f == 4) { if (f == 4) {
if (z->conval->intval == (-2147483647-1)) { if (z->conval->intval == (-9223372036854775807-1)) {
OPB_err(203); OPB_err(203);
} else { } else {
z->conval->intval = __ABS(z->conval->intval); z->conval->intval = __ABS(z->conval->intval);
@ -845,7 +839,7 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y)
{ {
int16 f, g; int16 f, g;
OPT_Const xval = NIL, yval = NIL; OPT_Const xval = NIL, yval = NIL;
int32 xv, yv; int64 xv, yv;
BOOLEAN temp; BOOLEAN temp;
struct ConstOp__13 _s; struct ConstOp__13 _s;
_s.x = &x; _s.x = &x;
@ -1007,7 +1001,7 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y)
case 4: case 4:
if (f == 4) { if (f == 4) {
if (yval->intval != 0) { if (yval->intval != 0) {
xval->intval = (int)__MOD(xval->intval, yval->intval); xval->intval = __MOD(xval->intval, yval->intval);
OPB_SetIntType(x); OPB_SetIntType(x);
} else { } else {
OPB_err(205); OPB_err(205);
@ -1122,7 +1116,7 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ)
{ {
OPT_Node node = NIL; OPT_Node node = NIL;
int16 f, g; int16 f, g;
int32 k; int64 k;
LONGREAL r; LONGREAL r;
f = (*x)->typ->form; f = (*x)->typ->form;
g = typ->form; g = typ->form;
@ -1229,7 +1223,7 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y)
OPT_Node t = NIL, z = NIL; OPT_Node t = NIL, z = NIL;
OPT_Struct typ = NIL; OPT_Struct typ = NIL;
BOOLEAN do_; BOOLEAN do_;
int32 val; int64 val;
struct Op__38 _s; struct Op__38 _s;
_s.f = &f; _s.f = &f;
_s.g = &g; _s.g = &g;
@ -1500,19 +1494,19 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y)
void OPB_SetRange (OPT_Node *x, OPT_Node y) void OPB_SetRange (OPT_Node *x, OPT_Node y)
{ {
int32 k, l; int64 k, l;
if ((((*x)->class == 8 || (*x)->class == 9) || y->class == 8) || y->class == 9) { if ((((*x)->class == 8 || (*x)->class == 9) || y->class == 8) || y->class == 9) {
OPB_err(126); OPB_err(126);
} else if (((*x)->typ->form == 4 && y->typ->form == 4)) { } else if (((*x)->typ->form == 4 && y->typ->form == 4)) {
if ((*x)->class == 7) { if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if (0 > k || k > OPM_MaxSet) { if (0 > k || k > (int64)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} }
} }
if (y->class == 7) { if (y->class == 7) {
l = y->conval->intval; l = y->conval->intval;
if (0 > l || l > OPM_MaxSet) { if (0 > l || l > (int64)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} }
} }
@ -1535,14 +1529,14 @@ void OPB_SetRange (OPT_Node *x, OPT_Node y)
void OPB_SetElem (OPT_Node *x) void OPB_SetElem (OPT_Node *x)
{ {
int32 k; int64 k;
if ((*x)->class == 8 || (*x)->class == 9) { if ((*x)->class == 8 || (*x)->class == 9) {
OPB_err(126); OPB_err(126);
} else if ((*x)->typ->form != 4) { } else if ((*x)->typ->form != 4) {
OPB_err(93); OPB_err(93);
} else if ((*x)->class == 7) { } else if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if ((0 <= k && k <= OPM_MaxSet)) { if ((0 <= k && k <= (int64)OPM_MaxSet)) {
(*x)->conval->setval = __SETOF(k,32); (*x)->conval->setval = __SETOF(k,32);
} else { } else {
OPB_err(202); OPB_err(202);
@ -1917,7 +1911,7 @@ void OPB_StPar0 (OPT_Node *par0, int16 fctno)
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if (f == 4) { } else if (f == 4) {
if (x->typ->size != OPT_linttyp->size) { if (x->typ->size < OPT_linttyp->size) {
OPB_Convert(&x, OPT_linttyp); OPB_Convert(&x, OPT_linttyp);
} }
} else { } else {
@ -2055,7 +2049,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if (f == 4) { } else if (f == 4) {
if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > OPM_MaxSet))) { if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (int64)OPM_MaxSet))) {
OPB_err(202); OPB_err(202);
} }
p = NewOp__53(19, fctno, p, x); p = NewOp__53(19, fctno, p, x);
@ -2068,7 +2062,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
if (!(f == 4) || x->class != 7) { if (!(f == 4) || x->class != 7) {
OPB_err(69); OPB_err(69);
} else if (x->typ->size == 1) { } else if (x->typ->size == 1) {
L = (int16)x->conval->intval; L = OPM_Integer(x->conval->intval);
typ = p->typ; typ = p->typ;
while ((L > 0 && __IN(typ->comp, 0x0c, 32))) { while ((L > 0 && __IN(typ->comp, 0x0c, 32))) {
typ = typ->BaseTyp; typ = typ->BaseTyp;
@ -2120,8 +2114,8 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
OPB_err(208); OPB_err(208);
p->conval->intval = 1; p->conval->intval = 1;
} else if (x->conval->intval >= 0) { } else if (x->conval->intval >= 0) {
if (__ABS(p->conval->intval) <= __DIV(2147483647, __ASH(1, x->conval->intval))) { if (__ABS(p->conval->intval) <= __DIV(9223372036854775807, (int64)__ASH(1, x->conval->intval))) {
p->conval->intval = p->conval->intval * __ASH(1, x->conval->intval); p->conval->intval = p->conval->intval * (int64)__ASH(1, x->conval->intval);
} else { } else {
OPB_err(208); OPB_err(208);
p->conval->intval = 1; p->conval->intval = 1;
@ -2132,7 +2126,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
p->obj = NIL; p->obj = NIL;
} else { } else {
p = NewOp__53(12, 17, p, x); p = NewOp__53(12, 17, p, x);
p->typ = OPT_linttyp; p->typ = p->left->typ;
} }
} else { } else {
OPB_err(111); OPB_err(111);
@ -2143,7 +2137,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 > OPM_MaxIndex))) { if ((x->class == 7 && (x->conval->intval <= 0 || x->conval->intval > (int64)OPM_MaxIndex))) {
OPB_err(63); OPB_err(63);
} }
} else { } else {
@ -2281,7 +2275,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 > OPM_MaxIndex))) { if ((x->class == 7 && (x->conval->intval <= 0 || x->conval->intval > (int64)OPM_MaxIndex))) {
OPB_err(63); OPB_err(63);
} }
node = p->right; node = p->right;
@ -2622,7 +2616,7 @@ export void *OPB__init(void)
__MODULE_IMPORT(OPT); __MODULE_IMPORT(OPT);
__REGMOD("OPB", 0); __REGMOD("OPB", 0);
/* BEGIN */ /* BEGIN */
OPB_maxExp = OPB_log(1073741824); OPB_maxExp = OPB_log(4611686018427387904);
OPB_maxExp = OPB_exp; OPB_maxExp = OPB_exp;
__ENDMOD; __ENDMOD;
} }

View file

@ -25,10 +25,10 @@ import void OPB_Inittd (OPT_Node *inittd, OPT_Node *last, OPT_Struct typ);
import void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y); import void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y);
import void OPB_MOp (int8 op, OPT_Node *x); import void OPB_MOp (int8 op, OPT_Node *x);
import OPT_Node OPB_NewBoolConst (BOOLEAN boolval); import OPT_Node OPB_NewBoolConst (BOOLEAN boolval);
import OPT_Node OPB_NewIntConst (int32 intval); import OPT_Node OPB_NewIntConst (int64 intval);
import OPT_Node OPB_NewLeaf (OPT_Object obj); import OPT_Node OPB_NewLeaf (OPT_Object obj);
import OPT_Node OPB_NewRealConst (LONGREAL realval, OPT_Struct typ); import OPT_Node OPB_NewRealConst (LONGREAL realval, OPT_Struct typ);
import OPT_Node OPB_NewString (OPS_String str, int32 len); import OPT_Node OPB_NewString (OPS_String str, int64 len);
import OPT_Node OPB_Nil (void); import OPT_Node OPB_Nil (void);
import void OPB_Op (int8 op, OPT_Node *x, OPT_Node y); import void OPB_Op (int8 op, OPT_Node *x, OPT_Node y);
import void OPB_OptIf (OPT_Node *x); import void OPB_OptIf (OPT_Node *x);

View file

@ -26,8 +26,8 @@ export OPT_Object OPC_BaseTProc (OPT_Object obj);
export void OPC_BegBlk (void); export void OPC_BegBlk (void);
export void OPC_BegStat (void); export void OPC_BegStat (void);
static void OPC_CProcDefs (OPT_Object obj, int16 vis); static void OPC_CProcDefs (OPT_Object obj, int16 vis);
export void OPC_Case (int32 caseVal, int16 form); export void OPC_Case (int64 caseVal, int16 form);
static void OPC_CharacterLiteral (int32 c); static void OPC_CharacterLiteral (int64 c);
export void OPC_Cmp (int16 rel); export void OPC_Cmp (int16 rel);
export void OPC_CompleteIdent (OPT_Object obj); export void OPC_CompleteIdent (OPT_Object obj);
export void OPC_Constant (OPT_Const con, int16 form); export void OPC_Constant (OPT_Const con, int16 form);
@ -67,8 +67,8 @@ static void OPC_InitImports (OPT_Object obj);
static void OPC_InitKeywords (void); static void OPC_InitKeywords (void);
export void OPC_InitTDesc (OPT_Struct typ); export void OPC_InitTDesc (OPT_Struct typ);
static void OPC_InitTProcs (OPT_Object typ, OPT_Object obj); static void OPC_InitTProcs (OPT_Object typ, OPT_Object obj);
export void OPC_IntLiteral (int32 n, int32 size); export void OPC_IntLiteral (int64 n, int32 size);
export void OPC_Len (OPT_Object obj, OPT_Struct array, int32 dim); export void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim);
static void OPC_LenList (OPT_Object par, BOOLEAN ansiDefine, BOOLEAN showParamName); static void OPC_LenList (OPT_Object par, BOOLEAN ansiDefine, BOOLEAN showParamName);
static int16 OPC_Length (CHAR *s, LONGINT s__len); static int16 OPC_Length (CHAR *s, LONGINT s__len);
export int32 OPC_NofPtrs (OPT_Struct typ); export int32 OPC_NofPtrs (OPT_Struct typ);
@ -1851,7 +1851,7 @@ void OPC_Cmp (int16 rel)
} }
} }
static void OPC_CharacterLiteral (int32 c) static void OPC_CharacterLiteral (int64 c)
{ {
if (c < 32 || c > 126) { if (c < 32 || c > 126) {
OPM_WriteString((CHAR*)"0x", 3); OPM_WriteString((CHAR*)"0x", 3);
@ -1894,7 +1894,7 @@ static void OPC_StringLiteral (CHAR *s, LONGINT s__len, int32 l)
__DEL(s); __DEL(s);
} }
void OPC_Case (int32 caseVal, int16 form) void OPC_Case (int64 caseVal, int16 form)
{ {
CHAR ch; CHAR ch;
OPM_WriteString((CHAR*)"case ", 6); OPM_WriteString((CHAR*)"case ", 6);
@ -1937,7 +1937,7 @@ void OPC_Halt (int32 n)
OPC_Str1((CHAR*)"__HALT(#)", 10, n); OPC_Str1((CHAR*)"__HALT(#)", 10, n);
} }
void OPC_IntLiteral (int32 n, int32 size) void OPC_IntLiteral (int64 n, int32 size)
{ {
if ((((size > 4 && n <= 2147483647)) && n > (-2147483647-1))) { if ((((size > 4 && n <= 2147483647)) && n > (-2147483647-1))) {
OPM_WriteString((CHAR*)"((int", 6); OPM_WriteString((CHAR*)"((int", 6);
@ -1950,7 +1950,7 @@ void OPC_IntLiteral (int32 n, int32 size)
} }
} }
void OPC_Len (OPT_Object obj, OPT_Struct array, int32 dim) void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim)
{ {
if (array->comp == 3) { if (array->comp == 3) {
OPC_CompleteIdent(obj); OPC_CompleteIdent(obj);

View file

@ -15,7 +15,7 @@ import int32 OPC_BaseAlignment (OPT_Struct typ);
import OPT_Object OPC_BaseTProc (OPT_Object obj); import OPT_Object OPC_BaseTProc (OPT_Object obj);
import void OPC_BegBlk (void); import void OPC_BegBlk (void);
import void OPC_BegStat (void); import void OPC_BegStat (void);
import void OPC_Case (int32 caseVal, int16 form); import void OPC_Case (int64 caseVal, int16 form);
import void OPC_Cmp (int16 rel); import void OPC_Cmp (int16 rel);
import void OPC_CompleteIdent (OPT_Object obj); import void OPC_CompleteIdent (OPT_Object obj);
import void OPC_Constant (OPT_Const con, int16 form); import void OPC_Constant (OPT_Const con, int16 form);
@ -37,8 +37,8 @@ import void OPC_Increment (BOOLEAN decrement);
import void OPC_Indent (int16 count); import void OPC_Indent (int16 count);
import void OPC_Init (void); import void OPC_Init (void);
import void OPC_InitTDesc (OPT_Struct typ); import void OPC_InitTDesc (OPT_Struct typ);
import void OPC_IntLiteral (int32 n, int32 size); import void OPC_IntLiteral (int64 n, int32 size);
import void OPC_Len (OPT_Object obj, OPT_Struct array, int32 dim); import void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim);
import int32 OPC_NofPtrs (OPT_Struct typ); import int32 OPC_NofPtrs (OPT_Struct typ);
import void OPC_SetInclude (BOOLEAN exclude); import void OPC_SetInclude (BOOLEAN exclude);
import int32 OPC_SizeAlignment (int32 size); import int32 OPC_SizeAlignment (int32 size);

View file

@ -28,7 +28,8 @@ export int16 OPM_currFile, OPM_level, OPM_pc, OPM_entno;
export CHAR OPM_modName[32]; export CHAR OPM_modName[32];
export CHAR OPM_objname[64]; export CHAR OPM_objname[64];
export SET OPM_opt, OPM_glbopt; export SET OPM_opt, OPM_glbopt;
static int32 OPM_ErrorLineStartPos, OPM_ErrorLineLimitPos, OPM_ErrorLineNumber, OPM_lasterrpos; static int32 OPM_ErrorLineStartPos, OPM_ErrorLineLimitPos, OPM_ErrorLineNumber;
static int64 OPM_lasterrpos;
static Texts_Reader OPM_inR; static Texts_Reader OPM_inR;
static Texts_Text OPM_Log; static Texts_Text OPM_Log;
static Texts_Writer OPM_W; static Texts_Writer OPM_W;
@ -45,46 +46,49 @@ static void OPM_Append (Files_Rider *R, LONGINT *R__typ, Files_File F);
export void OPM_CloseFiles (void); export void OPM_CloseFiles (void);
export void OPM_CloseOldSym (void); export void OPM_CloseOldSym (void);
export void OPM_DeleteNewSym (void); export void OPM_DeleteNewSym (void);
export void OPM_FPrint (int32 *fp, int32 val); export void OPM_FPrint (int32 *fp, int64 val);
export void OPM_FPrintLReal (int32 *fp, LONGREAL lr); export void OPM_FPrintLReal (int32 *fp, LONGREAL lr);
export void OPM_FPrintReal (int32 *fp, REAL real); export void OPM_FPrintReal (int32 *fp, REAL real);
export void OPM_FPrintSet (int32 *fp, SET set); export void OPM_FPrintSet (int32 *fp, SET set);
static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, int32 pos); static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, int64 pos);
export void OPM_Get (CHAR *ch); export void OPM_Get (CHAR *ch);
static void OPM_GetProperties (void); static void OPM_GetProperties (void);
static void OPM_GetProperty (Texts_Scanner *S, LONGINT *S__typ, CHAR *name, LONGINT name__len, int16 *size, int16 *align); static void OPM_GetProperty (Texts_Scanner *S, LONGINT *S__typ, CHAR *name, LONGINT name__len, int16 *size, int16 *align);
export void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); export void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len);
export void OPM_InitOptions (void); export void OPM_InitOptions (void);
export int16 OPM_Integer (int64 n);
static void OPM_LogErrMsg (int16 n); static void OPM_LogErrMsg (int16 n);
export void OPM_LogW (CHAR ch); export void OPM_LogW (CHAR ch);
export void OPM_LogWLn (void); export void OPM_LogWLn (void);
export void OPM_LogWNum (int32 i, int32 len); export void OPM_LogWNum (int64 i, int64 len);
export void OPM_LogWStr (CHAR *s, LONGINT s__len); export void OPM_LogWStr (CHAR *s, LONGINT s__len);
export int32 OPM_Longint (int64 n);
static void OPM_MakeFileName (CHAR *name, LONGINT name__len, CHAR *FName, LONGINT FName__len, CHAR *ext, LONGINT ext__len); static void OPM_MakeFileName (CHAR *name, LONGINT name__len, CHAR *FName, LONGINT FName__len, CHAR *ext, LONGINT ext__len);
export void OPM_Mark (int16 n, int32 pos); export void OPM_Mark (int16 n, int64 pos);
export void OPM_NewSym (CHAR *modName, LONGINT modName__len); export void OPM_NewSym (CHAR *modName, LONGINT modName__len);
export void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done); export void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done);
export void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len); export void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len);
export BOOLEAN OPM_OpenPar (void); 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 (int32 pos); static void OPM_ShowLine (int64 pos);
export int32 OPM_SignedMaximum (int32 bytecount); export int32 OPM_SignedMaximum (int32 bytecount);
export int32 OPM_SignedMinimum (int32 bytecount); export int32 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 void OPM_SymRLReal (LONGREAL *lr); export void OPM_SymRLReal (LONGREAL *lr);
export void OPM_SymRReal (REAL *r); export void OPM_SymRReal (REAL *r);
export void OPM_SymRSet (SET *s); export void OPM_SymRSet (SET *s);
export void OPM_SymWCh (CHAR ch); export void OPM_SymWCh (CHAR ch);
export void OPM_SymWInt (int32 i); export void OPM_SymWInt (int64 i);
export void OPM_SymWLReal (LONGREAL lr); export void OPM_SymWLReal (LONGREAL lr);
export void OPM_SymWReal (REAL r); export void OPM_SymWReal (REAL r);
export void OPM_SymWSet (SET s); export void OPM_SymWSet (SET s);
static void OPM_VerboseListSizes (void); static void OPM_VerboseListSizes (void);
export void OPM_Write (CHAR ch); export void OPM_Write (CHAR ch);
export void OPM_WriteHex (int32 i); export void OPM_WriteHex (int64 i);
export void OPM_WriteInt (int32 i); export void OPM_WriteInt (int64 i);
export void OPM_WriteLn (void); export void OPM_WriteLn (void);
export void OPM_WriteReal (LONGREAL r, CHAR suffx); export void OPM_WriteReal (LONGREAL r, CHAR suffx);
export void OPM_WriteString (CHAR *s, LONGINT s__len); export void OPM_WriteString (CHAR *s, LONGINT s__len);
@ -107,7 +111,7 @@ void OPM_LogWStr (CHAR *s, LONGINT s__len)
__DEL(s); __DEL(s);
} }
void OPM_LogWNum (int32 i, int32 len) void OPM_LogWNum (int64 i, int64 len)
{ {
Console_Int(i, len); Console_Int(i, len);
} }
@ -117,6 +121,20 @@ void OPM_LogWLn (void)
Console_Ln(); Console_Ln();
} }
int32 OPM_Longint (int64 n)
{
int32 _o_result;
_o_result = __VAL(int32, n);
return _o_result;
}
int16 OPM_Integer (int64 n)
{
int16 _o_result;
_o_result = __VAL(int16, n);
return _o_result;
}
static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt)
{ {
int16 i; int16 i;
@ -404,21 +422,21 @@ static void OPM_LogErrMsg (int16 n)
OPM_LogWStr(errors_errors[__X(n, 350)], 128); OPM_LogWStr(errors_errors[__X(n, 350)], 128);
} }
static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, int32 pos) static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, int64 pos)
{ {
CHAR ch, cheol; CHAR ch, cheol;
if (pos < OPM_ErrorLineStartPos) { if (pos < (int64)OPM_ErrorLineStartPos) {
OPM_ErrorLineStartPos = 0; OPM_ErrorLineStartPos = 0;
OPM_ErrorLineLimitPos = 0; OPM_ErrorLineLimitPos = 0;
OPM_ErrorLineNumber = 0; OPM_ErrorLineNumber = 0;
} }
if (pos < OPM_ErrorLineLimitPos) { if (pos < (int64)OPM_ErrorLineLimitPos) {
Files_Set(&*r, r__typ, f, OPM_ErrorLineStartPos); Files_Set(&*r, r__typ, f, OPM_ErrorLineStartPos);
return; return;
} }
Files_Set(&*r, r__typ, f, OPM_ErrorLineLimitPos); Files_Set(&*r, r__typ, f, OPM_ErrorLineLimitPos);
Files_Read(&*r, r__typ, (void*)&ch); Files_Read(&*r, r__typ, (void*)&ch);
while ((OPM_ErrorLineLimitPos < pos && !(*r).eof)) { while (((int64)OPM_ErrorLineLimitPos < pos && !(*r).eof)) {
OPM_ErrorLineStartPos = OPM_ErrorLineLimitPos; OPM_ErrorLineStartPos = OPM_ErrorLineLimitPos;
OPM_ErrorLineNumber += 1; OPM_ErrorLineNumber += 1;
while ((((ch != 0x00 && ch != 0x0d)) && ch != 0x0a)) { while ((((ch != 0x00 && ch != 0x0d)) && ch != 0x0a)) {
@ -436,7 +454,7 @@ static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, int32 p
Files_Set(&*r, r__typ, f, OPM_ErrorLineStartPos); Files_Set(&*r, r__typ, f, OPM_ErrorLineStartPos);
} }
static void OPM_ShowLine (int32 pos) static void OPM_ShowLine (int64 pos)
{ {
Files_File f = NIL; Files_File f = NIL;
Files_Rider r; Files_Rider r;
@ -460,10 +478,10 @@ static void OPM_ShowLine (int32 pos)
OPM_LogWStr(line, 1023); OPM_LogWStr(line, 1023);
OPM_LogWLn(); OPM_LogWLn();
OPM_LogWStr((CHAR*)" ", 7); OPM_LogWStr((CHAR*)" ", 7);
if (pos >= OPM_ErrorLineLimitPos) { if (pos >= (int64)OPM_ErrorLineLimitPos) {
pos = OPM_ErrorLineLimitPos - 1; pos = OPM_ErrorLineLimitPos - 1;
} }
i = (int16)(pos - OPM_ErrorLineStartPos); i = (int16)OPM_Longint(pos - (int64)OPM_ErrorLineStartPos);
while (i > 0) { while (i > 0) {
OPM_LogW(' '); OPM_LogW(' ');
i -= 1; i -= 1;
@ -478,7 +496,7 @@ static void OPM_ShowLine (int32 pos)
Files_Close(f); Files_Close(f);
} }
void OPM_Mark (int16 n, int32 pos) void OPM_Mark (int16 n, int64 pos)
{ {
if (pos == -1) { if (pos == -1) {
pos = 0; pos = 0;
@ -535,9 +553,9 @@ void OPM_err (int16 n)
OPM_Mark(n, OPM_errpos); OPM_Mark(n, OPM_errpos);
} }
void OPM_FPrint (int32 *fp, int32 val) void OPM_FPrint (int32 *fp, int64 val)
{ {
*fp = __ROTL((int32)((SET)*fp ^ (SET)val), 1, 32); *fp = __ROTL((int32)((SET)*fp ^ __VAL(SET, val)), 1, 32);
} }
void OPM_FPrintSet (int32 *fp, SET set) void OPM_FPrintSet (int32 *fp, SET set)
@ -702,6 +720,15 @@ int32 OPM_SymRInt (void)
return _o_result; return _o_result;
} }
int64 OPM_SymRInt64 (void)
{
int64 _o_result;
int64 k;
Files_ReadNum64(&OPM_oldSF, Files_Rider__typ, &k);
_o_result = k;
return _o_result;
}
void OPM_SymRSet (SET *s) void OPM_SymRSet (SET *s)
{ {
Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (int32*)&*s); Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (int32*)&*s);
@ -751,9 +778,9 @@ void OPM_SymWCh (CHAR ch)
Files_Write(&OPM_newSF, Files_Rider__typ, ch); Files_Write(&OPM_newSF, Files_Rider__typ, ch);
} }
void OPM_SymWInt (int32 i) void OPM_SymWInt (int64 i)
{ {
Files_WriteNum(&OPM_newSF, Files_Rider__typ, i); Files_WriteNum64(&OPM_newSF, Files_Rider__typ, i);
} }
void OPM_SymWSet (SET s) void OPM_SymWSet (SET s)
@ -820,17 +847,17 @@ void OPM_WriteStringVar (CHAR *s, LONGINT s__len)
Files_WriteBytes(&OPM_R[__X(OPM_currFile, 3)], Files_Rider__typ, (void*)s, s__len * 1, i); Files_WriteBytes(&OPM_R[__X(OPM_currFile, 3)], Files_Rider__typ, (void*)s, s__len * 1, i);
} }
void OPM_WriteHex (int32 i) void OPM_WriteHex (int64 i)
{ {
CHAR s[3]; CHAR s[3];
int16 digit; int32 digit;
digit = __ASHR((int16)i, 4); digit = __ASHR((int32)i, 4);
if (digit < 10) { if (digit < 10) {
s[0] = (CHAR)(48 + digit); s[0] = (CHAR)(48 + digit);
} else { } else {
s[0] = (CHAR)(87 + digit); s[0] = (CHAR)(87 + digit);
} }
digit = __MASK((int16)i, -16); digit = __MASK((int32)i, -16);
if (digit < 10) { if (digit < 10) {
s[1] = (CHAR)(48 + digit); s[1] = (CHAR)(48 + digit);
} else { } else {
@ -840,31 +867,31 @@ void OPM_WriteHex (int32 i)
OPM_WriteString(s, 3); OPM_WriteString(s, 3);
} }
void OPM_WriteInt (int32 i) void OPM_WriteInt (int64 i)
{ {
CHAR s[20]; CHAR s[24];
int32 i1, k; int64 i1, k;
if (i == OPM_SignedMinimum(OPM_IntSize) || i == OPM_SignedMinimum(OPM_LIntSize)) { if ((i == (int64)OPM_SignedMinimum(OPM_IntSize) || i == (int64)OPM_SignedMinimum(OPM_LIntSize)) || i == (int64)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);
} else { } else {
i1 = __ABS(i); i1 = __ABS(i);
s[0] = (CHAR)((int)__MOD(i1, 10) + 48); s[0] = (CHAR)(__MOD(i1, 10) + 48);
i1 = __DIV(i1, 10); i1 = __DIV(i1, 10);
k = 1; k = 1;
while (i1 > 0) { while (i1 > 0) {
s[__X(k, 20)] = (CHAR)((int)__MOD(i1, 10) + 48); s[__X(k, 24)] = (CHAR)(__MOD(i1, 10) + 48);
i1 = __DIV(i1, 10); i1 = __DIV(i1, 10);
k += 1; k += 1;
} }
if (i < 0) { if (i < 0) {
s[__X(k, 20)] = '-'; s[__X(k, 24)] = '-';
k += 1; k += 1;
} }
while (k > 0) { while (k > 0) {
k -= 1; k -= 1;
OPM_Write(s[__X(k, 20)]); OPM_Write(s[__X(k, 24)]);
} }
} }
} }

View file

@ -21,18 +21,20 @@ import BOOLEAN OPM_dontAsm, OPM_dontLink, OPM_mainProg, OPM_mainLinkStat, OPM_no
import void OPM_CloseFiles (void); import void OPM_CloseFiles (void);
import void OPM_CloseOldSym (void); import void OPM_CloseOldSym (void);
import void OPM_DeleteNewSym (void); import void OPM_DeleteNewSym (void);
import void OPM_FPrint (int32 *fp, int32 val); import void OPM_FPrint (int32 *fp, int64 val);
import void OPM_FPrintLReal (int32 *fp, LONGREAL lr); import void OPM_FPrintLReal (int32 *fp, LONGREAL lr);
import void OPM_FPrintReal (int32 *fp, REAL real); import void OPM_FPrintReal (int32 *fp, REAL real);
import void OPM_FPrintSet (int32 *fp, SET set); import void OPM_FPrintSet (int32 *fp, SET set);
import void OPM_Get (CHAR *ch); import void OPM_Get (CHAR *ch);
import void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); import void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len);
import void OPM_InitOptions (void); import void OPM_InitOptions (void);
import int16 OPM_Integer (int64 n);
import void OPM_LogW (CHAR ch); import void OPM_LogW (CHAR ch);
import void OPM_LogWLn (void); import void OPM_LogWLn (void);
import void OPM_LogWNum (int32 i, int32 len); import void OPM_LogWNum (int64 i, int64 len);
import void OPM_LogWStr (CHAR *s, LONGINT s__len); import void OPM_LogWStr (CHAR *s, LONGINT s__len);
import void OPM_Mark (int16 n, int32 pos); import int32 OPM_Longint (int64 n);
import void OPM_Mark (int16 n, int64 pos);
import void OPM_NewSym (CHAR *modName, LONGINT modName__len); import void OPM_NewSym (CHAR *modName, LONGINT modName__len);
import void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done); 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);
@ -42,17 +44,18 @@ import int32 OPM_SignedMaximum (int32 bytecount);
import int32 OPM_SignedMinimum (int32 bytecount); import int32 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 void OPM_SymRLReal (LONGREAL *lr); import void OPM_SymRLReal (LONGREAL *lr);
import void OPM_SymRReal (REAL *r); import void OPM_SymRReal (REAL *r);
import void OPM_SymRSet (SET *s); import void OPM_SymRSet (SET *s);
import void OPM_SymWCh (CHAR ch); import void OPM_SymWCh (CHAR ch);
import void OPM_SymWInt (int32 i); import void OPM_SymWInt (int64 i);
import void OPM_SymWLReal (LONGREAL lr); import void OPM_SymWLReal (LONGREAL lr);
import void OPM_SymWReal (REAL r); import void OPM_SymWReal (REAL r);
import void OPM_SymWSet (SET s); import void OPM_SymWSet (SET s);
import void OPM_Write (CHAR ch); import void OPM_Write (CHAR ch);
import void OPM_WriteHex (int32 i); import void OPM_WriteHex (int64 i);
import void OPM_WriteInt (int32 i); import void OPM_WriteInt (int64 i);
import void OPM_WriteLn (void); import void OPM_WriteLn (void);
import void OPM_WriteReal (LONGREAL r, CHAR suffx); import void OPM_WriteReal (LONGREAL r, CHAR suffx);
import void OPM_WriteString (CHAR *s, LONGINT s__len); import void OPM_WriteString (CHAR *s, LONGINT s__len);

View file

@ -134,7 +134,7 @@ static void OPP_CheckMark (int8 *vis)
static void OPP_CheckSysFlag (int16 *sysflag, int16 default_) static void OPP_CheckSysFlag (int16 *sysflag, int16 default_)
{ {
OPT_Node x = NIL; OPT_Node x = NIL;
int32 sf; int64 sf;
if (OPP_sym == 31) { if (OPP_sym == 31) {
OPS_Get(&OPP_sym); OPS_Get(&OPP_sym);
if (!OPT_SYSimported) { if (!OPT_SYSimported) {
@ -151,7 +151,7 @@ static void OPP_CheckSysFlag (int16 *sysflag, int16 default_)
OPP_err(51); OPP_err(51);
sf = 0; sf = 0;
} }
*sysflag = (int16)sf; *sysflag = OPM_Integer(sf);
OPP_CheckSym(23); OPP_CheckSym(23);
} else { } else {
*sysflag = default_; *sysflag = default_;
@ -254,7 +254,7 @@ static void OPP_RecordType (OPT_Struct *typ, OPT_Struct *banned)
static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned) static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned)
{ {
OPT_Node x = NIL; OPT_Node x = NIL;
int32 n; int64 n;
int16 sysflag; int16 sysflag;
OPP_CheckSysFlag(&sysflag, 0); OPP_CheckSysFlag(&sysflag, 0);
if (OPP_sym == 25) { if (OPP_sym == 25) {
@ -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 > OPM_MaxIndex) { if (n <= 0 || n > (int64)OPM_MaxIndex) {
OPP_err(63); OPP_err(63);
n = 1; n = 1;
} }
@ -283,7 +283,7 @@ static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned)
OPP_err(51); OPP_err(51);
n = 1; n = 1;
} }
(*typ)->n = n; (*typ)->n = OPM_Longint(n);
if (OPP_sym == 25) { if (OPP_sym == 25) {
OPS_Get(&OPP_sym); OPS_Get(&OPP_sym);
OPP_Type(&(*typ)->BaseTyp, &*banned); OPP_Type(&(*typ)->BaseTyp, &*banned);
@ -932,7 +932,7 @@ static void GetCode__19 (void)
{ {
OPT_ConstExt ext = NIL; OPT_ConstExt ext = NIL;
int16 n; int16 n;
int32 c; int64 c;
ext = OPT_NewExt(); ext = OPT_NewExt();
(*ProcedureDeclaration__16_s->proc)->conval->ext = ext; (*ProcedureDeclaration__16_s->proc)->conval->ext = ext;
n = 0; n = 0;
@ -1179,7 +1179,7 @@ static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int16 *n, OPP
OPP_ConstExpression(&x); OPP_ConstExpression(&x);
f = x->typ->form; f = x->typ->form;
if (__IN(f, 0x18, 32)) { if (__IN(f, 0x18, 32)) {
xval = x->conval->intval; xval = OPM_Longint(x->conval->intval);
} else { } else {
OPP_err(61); OPP_err(61);
xval = 1; xval = 1;
@ -1194,7 +1194,7 @@ static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int16 *n, OPP
if (OPP_sym == 21) { if (OPP_sym == 21) {
OPS_Get(&OPP_sym); OPS_Get(&OPP_sym);
OPP_ConstExpression(&y); OPP_ConstExpression(&y);
yval = y->conval->intval; yval = OPM_Longint(y->conval->intval);
if (((int16)y->typ->form != f && !((f == 4 && y->typ->form == 4)))) { if (((int16)y->typ->form != f && !((f == 4 && y->typ->form == 4)))) {
OPP_err(60); OPP_err(60);
} }

View file

@ -17,7 +17,7 @@ typedef
export OPS_Name OPS_name; export OPS_Name OPS_name;
export OPS_String OPS_str; export OPS_String OPS_str;
export int16 OPS_numtyp; export int16 OPS_numtyp;
export int32 OPS_intval; export int64 OPS_intval;
export REAL OPS_realval; export REAL OPS_realval;
export LONGREAL OPS_lrlval; export LONGREAL OPS_lrlval;
static CHAR OPS_ch; static CHAR OPS_ch;
@ -178,7 +178,7 @@ static void OPS_Number (void)
OPS_numtyp = 1; OPS_numtyp = 1;
if (n <= 2) { if (n <= 2) {
while (i < n) { while (i < n) {
OPS_intval = __ASHL(OPS_intval, 4) + Ord__7(dig[i], 1); OPS_intval = __ASHL(OPS_intval, 4) + (int64)Ord__7(dig[i], 1);
i += 1; i += 1;
} }
} else { } else {
@ -192,7 +192,7 @@ static void OPS_Number (void)
OPS_intval = -1; OPS_intval = -1;
} }
while (i < n) { while (i < n) {
OPS_intval = __ASHL(OPS_intval, 4) + Ord__7(dig[i], 1); OPS_intval = __ASHL(OPS_intval, 4) + (int64)Ord__7(dig[i], 1);
i += 1; i += 1;
} }
} else { } else {
@ -203,8 +203,8 @@ static void OPS_Number (void)
while (i < n) { while (i < n) {
d = Ord__7(dig[i], 0); d = Ord__7(dig[i], 0);
i += 1; i += 1;
if ((int64)OPS_intval <= __DIV(9223372036854775807 - (int64)d, 10)) { if (OPS_intval <= __DIV(9223372036854775807 - (int64)d, 10)) {
OPS_intval = OPS_intval * 10 + d; OPS_intval = OPS_intval * 10 + (int64)d;
} else { } else {
OPS_err(203); OPS_err(203);
} }

View file

@ -15,7 +15,7 @@ typedef
import OPS_Name OPS_name; import OPS_Name OPS_name;
import OPS_String OPS_str; import OPS_String OPS_str;
import int16 OPS_numtyp; import int16 OPS_numtyp;
import int32 OPS_intval; import int64 OPS_intval;
import REAL OPS_realval; import REAL OPS_realval;
import LONGREAL OPS_lrlval; import LONGREAL OPS_lrlval;

View file

@ -17,7 +17,8 @@ typedef
typedef typedef
struct OPT_ConstDesc { struct OPT_ConstDesc {
OPT_ConstExt ext; OPT_ConstExt ext;
int32 intval, intval2; int64 intval;
int32 intval2;
SET setval; SET setval;
LONGREAL realval; LONGREAL realval;
} OPT_ConstDesc; } OPT_ConstDesc;
@ -1838,7 +1839,7 @@ static void EnumPtrs(void (*P)(void*))
__ENUMR(&OPT_impCtxt, OPT_ImpCtxt__typ, 3140, 1, P); __ENUMR(&OPT_impCtxt, OPT_ImpCtxt__typ, 3140, 1, P);
} }
__TDESC(OPT_ConstDesc, 1, 1) = {__TDFLDS("ConstDesc", 24), {0, -8}}; __TDESC(OPT_ConstDesc, 1, 1) = {__TDFLDS("ConstDesc", 28), {0, -8}};
__TDESC(OPT_ObjDesc, 1, 6) = {__TDFLDS("ObjDesc", 304), {0, 4, 8, 12, 284, 288, -28}}; __TDESC(OPT_ObjDesc, 1, 6) = {__TDFLDS("ObjDesc", 304), {0, 4, 8, 12, 284, 288, -28}};
__TDESC(OPT_StrDesc, 1, 3) = {__TDFLDS("StrDesc", 56), {44, 48, 52, -16}}; __TDESC(OPT_StrDesc, 1, 3) = {__TDFLDS("StrDesc", 56), {44, 48, 52, -16}};
__TDESC(OPT_NodeDesc, 1, 6) = {__TDFLDS("NodeDesc", 28), {0, 4, 8, 16, 20, 24, -28}}; __TDESC(OPT_NodeDesc, 1, 6) = {__TDFLDS("NodeDesc", 28), {0, 4, 8, 16, 20, 24, -28}};

View file

@ -15,7 +15,8 @@ typedef
typedef typedef
struct OPT_ConstDesc { struct OPT_ConstDesc {
OPT_ConstExt ext; OPT_ConstExt ext;
int32 intval, intval2; int64 intval;
int32 intval2;
SET setval; SET setval;
LONGREAL realval; LONGREAL realval;
} OPT_ConstDesc; } OPT_ConstDesc;

View file

@ -36,10 +36,10 @@ static BOOLEAN OPV_ImplicitReturn (OPT_Node n);
static void OPV_Index (OPT_Node n, OPT_Node d, int16 prec, int16 dim); static void OPV_Index (OPT_Node n, OPT_Node d, int16 prec, int16 dim);
export void OPV_Init (void); export void OPV_Init (void);
static void OPV_InitTDescs (OPT_Node n); static void OPV_InitTDescs (OPT_Node n);
static void OPV_Len (OPT_Node n, int32 dim); static void OPV_Len (OPT_Node n, int64 dim);
export void OPV_Module (OPT_Node prog); export void OPV_Module (OPT_Node prog);
static void OPV_NewArr (OPT_Node d, OPT_Node x); static void OPV_NewArr (OPT_Node d, OPT_Node x);
static void OPV_ParIntLiteral (int32 n, int32 size); static void OPV_ParIntLiteral (int64 n, int32 size);
static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp); static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp);
static BOOLEAN OPV_SideEffects (OPT_Node n); static BOOLEAN OPV_SideEffects (OPT_Node n);
static void OPV_SizeCast (int32 from, int32 to); static void OPV_SizeCast (int32 from, int32 to);
@ -414,7 +414,7 @@ static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp
__RETCHK; __RETCHK;
} }
static void OPV_Len (OPT_Node n, int32 dim) static void OPV_Len (OPT_Node n, int64 dim)
{ {
while ((n->class == 4 && n->typ->comp == 3)) { while ((n->class == 4 && n->typ->comp == 3)) {
dim += 1; dim += 1;
@ -725,7 +725,7 @@ static void OPV_design (OPT_Node n, int16 prec)
} }
} }
static void OPV_ParIntLiteral (int32 n, int32 size) static void OPV_ParIntLiteral (int64 n, int32 size)
{ {
if (OPV_ansi) { if (OPV_ansi) {
OPM_WriteInt(n); OPM_WriteInt(n);
@ -1210,7 +1210,7 @@ static void OPV_IfStat (OPT_Node n, BOOLEAN withtrap, OPT_Object outerProc)
static void OPV_CaseStat (OPT_Node n, OPT_Object outerProc) static void OPV_CaseStat (OPT_Node n, OPT_Object outerProc)
{ {
OPT_Node switchCase = NIL, label = NIL; OPT_Node switchCase = NIL, label = NIL;
int32 low, high; int64 low, high;
int16 form, i; int16 form, i;
OPM_WriteString((CHAR*)"switch ", 8); OPM_WriteString((CHAR*)"switch ", 8);
OPV_expr(n->left, 12); OPV_expr(n->left, 12);
@ -1351,7 +1351,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc)
OPV_ExitInfo saved; OPV_ExitInfo saved;
OPT_Node l = NIL, r = NIL; OPT_Node l = NIL, r = NIL;
while ((n != NIL && OPM_noerr)) { while ((n != NIL && OPM_noerr)) {
OPM_errpos = n->conval->intval; OPM_errpos = OPM_Longint(n->conval->intval);
if (n->class != 14) { if (n->class != 14) {
OPC_BegStat(); OPC_BegStat();
} }
@ -1625,7 +1625,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc)
OPV_IfStat(n, n->subcl == 0, outerProc); OPV_IfStat(n, n->subcl == 0, outerProc);
break; break;
case 28: case 28:
OPC_Halt(n->right->conval->intval); OPC_Halt(OPM_Longint(n->right->conval->intval));
break; break;
default: default:
OPM_LogWStr((CHAR*)"unhandled case in OPV.expr, n^.class = ", 40); OPM_LogWStr((CHAR*)"unhandled case in OPV.expr, n^.class = ", 40);

View file

@ -16,7 +16,7 @@ export void Console_Bool (BOOLEAN b);
export void Console_Char (CHAR ch); export void Console_Char (CHAR ch);
export void Console_Flush (void); export void Console_Flush (void);
export void Console_Hex (int32 i); export void Console_Hex (int32 i);
export void Console_Int (int32 i, int32 n); export void Console_Int (int64 i, int64 n);
export void Console_Ln (void); export void Console_Ln (void);
export void Console_Read (CHAR *ch); export void Console_Read (CHAR *ch);
export void Console_ReadLine (CHAR *line, LONGINT line__len); export void Console_ReadLine (CHAR *line, LONGINT line__len);
@ -54,15 +54,15 @@ void Console_String (CHAR *s, LONGINT s__len)
__DEL(s); __DEL(s);
} }
void Console_Int (int32 i, int32 n) void Console_Int (int64 i, int64 n)
{ {
CHAR s[32]; CHAR s[32];
int32 i1, k; int32 i1, k;
if (i == __LSHL(1, 31, 32)) { if (i == (int64)__LSHL(1, 31, 32)) {
__MOVE("8463847412", s, 11); __MOVE("8463847412", s, 11);
k = 10; k = 10;
} else { } else {
i1 = __ABS(i); i1 = __ABS(__VAL(int32, i));
s[0] = (CHAR)((int)__MOD(i1, 10) + 48); s[0] = (CHAR)((int)__MOD(i1, 10) + 48);
i1 = __DIV(i1, 10); i1 = __DIV(i1, 10);
k = 1; k = 1;
@ -76,7 +76,7 @@ void Console_Int (int32 i, int32 n)
s[__X(k, 32)] = '-'; s[__X(k, 32)] = '-';
k += 1; k += 1;
} }
while (n > k) { while (n > (int64)k) {
Console_Char(' '); Console_Char(' ');
n -= 1; n -= 1;
} }

View file

@ -12,7 +12,7 @@ import void Console_Bool (BOOLEAN b);
import void Console_Char (CHAR ch); import void Console_Char (CHAR ch);
import void Console_Flush (void); import void Console_Flush (void);
import void Console_Hex (int32 i); import void Console_Hex (int32 i);
import void Console_Int (int32 i, int32 n); import void Console_Int (int64 i, int64 n);
import void Console_Ln (void); import void Console_Ln (void);
import void Console_Read (CHAR *ch); import void Console_Read (CHAR *ch);
import void Console_ReadLine (CHAR *line, LONGINT line__len); import void Console_ReadLine (CHAR *line, LONGINT line__len);

View file

@ -90,6 +90,7 @@ export void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, int32 *x);
export void Files_ReadLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL *x); export void Files_ReadLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL *x);
export void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); export void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
export void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int32 *x); export void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int32 *x);
export void Files_ReadNum64 (Files_Rider *R, LONGINT *R__typ, int64 *x);
export void Files_ReadReal (Files_Rider *R, LONGINT *R__typ, REAL *x); export void Files_ReadReal (Files_Rider *R, LONGINT *R__typ, REAL *x);
export void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x); export void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x);
export void Files_ReadString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); export void Files_ReadString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
@ -105,6 +106,7 @@ export void Files_WriteInt (Files_Rider *R, LONGINT *R__typ, int16 x);
export void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int32 x); export void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int32 x);
export void Files_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL x); export void Files_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL x);
export void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int32 x); export void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int32 x);
export void Files_WriteNum64 (Files_Rider *R, LONGINT *R__typ, int64 x);
export void Files_WriteReal (Files_Rider *R, LONGINT *R__typ, REAL x); export void Files_WriteReal (Files_Rider *R, LONGINT *R__typ, REAL x);
export void Files_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x); export void Files_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x);
export void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); export void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
@ -936,6 +938,13 @@ void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int32 *x)
*x = n; *x = n;
} }
void Files_ReadNum64 (Files_Rider *R, LONGINT *R__typ, int64 *x)
{
int32 n;
Files_ReadNum(&*R, R__typ, &n);
*x = n;
}
void Files_WriteBool (Files_Rider *R, LONGINT *R__typ, BOOLEAN x) void Files_WriteBool (Files_Rider *R, LONGINT *R__typ, BOOLEAN x)
{ {
Files_Write(&*R, R__typ, __VAL(CHAR, x)); Files_Write(&*R, R__typ, __VAL(CHAR, x));
@ -1004,6 +1013,15 @@ void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int32 x)
Files_Write(&*R, R__typ, (CHAR)__MASK(x, -128)); Files_Write(&*R, R__typ, (CHAR)__MASK(x, -128));
} }
void Files_WriteNum64 (Files_Rider *R, LONGINT *R__typ, int64 x)
{
while (x < -64 || x > 63) {
Files_Write(&*R, R__typ, (CHAR)(__MASK(x, -128) + 128));
x = __ASHR(x, 7);
}
Files_Write(&*R, R__typ, (CHAR)__MASK(x, -128));
}
void Files_GetName (Files_File f, CHAR *name, LONGINT name__len) void Files_GetName (Files_File f, CHAR *name, LONGINT name__len)
{ {
__COPY(f->workName, name, name__len); __COPY(f->workName, name, name__len);

View file

@ -47,6 +47,7 @@ import void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, int32 *x);
import void Files_ReadLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL *x); import void Files_ReadLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL *x);
import void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); import void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
import void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int32 *x); import void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int32 *x);
import void Files_ReadNum64 (Files_Rider *R, LONGINT *R__typ, int64 *x);
import void Files_ReadReal (Files_Rider *R, LONGINT *R__typ, REAL *x); import void Files_ReadReal (Files_Rider *R, LONGINT *R__typ, REAL *x);
import void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x); import void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x);
import void Files_ReadString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); import void Files_ReadString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
@ -61,6 +62,7 @@ import void Files_WriteInt (Files_Rider *R, LONGINT *R__typ, int16 x);
import void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int32 x); import void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int32 x);
import void Files_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL x); import void Files_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL x);
import void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int32 x); import void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int32 x);
import void Files_WriteNum64 (Files_Rider *R, LONGINT *R__typ, int64 x);
import void Files_WriteReal (Files_Rider *R, LONGINT *R__typ, REAL x); import void Files_WriteReal (Files_Rider *R, LONGINT *R__typ, REAL x);
import void Files_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x); import void Files_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x);
import void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); import void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);

View file

@ -12,7 +12,7 @@
export void (*OPB_typSize)(OPT_Struct); export void (*OPB_typSize)(OPT_Struct);
static int16 OPB_exp; static int16 OPB_exp;
static int32 OPB_maxExp; static int64 OPB_maxExp;
export void OPB_Assign (OPT_Node *x, OPT_Node y); export void OPB_Assign (OPT_Node *x, OPT_Node y);
@ -38,14 +38,14 @@ export void OPB_Field (OPT_Node *x, OPT_Object y);
export void OPB_In (OPT_Node *x, OPT_Node y); export void OPB_In (OPT_Node *x, OPT_Node y);
export void OPB_Index (OPT_Node *x, OPT_Node y); export void OPB_Index (OPT_Node *x, OPT_Node y);
export void OPB_Inittd (OPT_Node *inittd, OPT_Node *last, OPT_Struct typ); export void OPB_Inittd (OPT_Node *inittd, OPT_Node *last, OPT_Struct typ);
static BOOLEAN OPB_IntToBool (int32 i); static BOOLEAN OPB_IntToBool (int64 i);
export void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y); export void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y);
export void OPB_MOp (int8 op, OPT_Node *x); export void OPB_MOp (int8 op, OPT_Node *x);
export OPT_Node OPB_NewBoolConst (BOOLEAN boolval); export OPT_Node OPB_NewBoolConst (BOOLEAN boolval);
export OPT_Node OPB_NewIntConst (int32 intval); export OPT_Node OPB_NewIntConst (int64 intval);
export OPT_Node OPB_NewLeaf (OPT_Object obj); export OPT_Node OPB_NewLeaf (OPT_Object obj);
export OPT_Node OPB_NewRealConst (LONGREAL realval, OPT_Struct typ); export OPT_Node OPB_NewRealConst (LONGREAL realval, OPT_Struct typ);
export OPT_Node OPB_NewString (OPS_String str, int32 len); export OPT_Node OPB_NewString (OPS_String str, int64 len);
export OPT_Node OPB_Nil (void); export OPT_Node OPB_Nil (void);
static BOOLEAN OPB_NotVar (OPT_Node x); static BOOLEAN OPB_NotVar (OPT_Node x);
export void OPB_Op (int8 op, OPT_Node *x, OPT_Node y); export void OPB_Op (int8 op, OPT_Node *x, OPT_Node y);
@ -63,7 +63,7 @@ export void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n);
export void OPB_StaticLink (int8 dlev); export void OPB_StaticLink (int8 dlev);
export void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard); export void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard);
static void OPB_err (int16 n); static void OPB_err (int16 n);
static int32 OPB_log (int32 x); static int64 OPB_log (int64 x);
static void OPB_err (int16 n) static void OPB_err (int16 n)
@ -141,17 +141,11 @@ static int32 OPB_BoolToInt (BOOLEAN b)
__RETCHK; __RETCHK;
} }
static BOOLEAN OPB_IntToBool (int32 i) static BOOLEAN OPB_IntToBool (int64 i)
{ {
BOOLEAN _o_result; BOOLEAN _o_result;
if (i == 0) { _o_result = i != 0;
_o_result = 0;
return _o_result; return _o_result;
} else {
_o_result = 1;
return _o_result;
}
__RETCHK;
} }
OPT_Node OPB_NewBoolConst (BOOLEAN boolval) OPT_Node OPB_NewBoolConst (BOOLEAN boolval)
@ -228,7 +222,7 @@ OPT_Node OPB_EmptySet (void)
static void OPB_SetIntType (OPT_Node node) static void OPB_SetIntType (OPT_Node node)
{ {
int16 b; int16 b;
int32 n; int64 n;
if (node->conval->intval >= 0) { if (node->conval->intval >= 0) {
n = node->conval->intval; n = node->conval->intval;
} else { } else {
@ -241,7 +235,7 @@ static void OPB_SetIntType (OPT_Node node)
node->typ = OPT_IntType(b); node->typ = OPT_IntType(b);
} }
OPT_Node OPB_NewIntConst (int32 intval) OPT_Node OPB_NewIntConst (int64 intval)
{ {
OPT_Node _o_result; OPT_Node _o_result;
OPT_Node x = NIL; OPT_Node x = NIL;
@ -266,7 +260,7 @@ OPT_Node OPB_NewRealConst (LONGREAL realval, OPT_Struct typ)
return _o_result; return _o_result;
} }
OPT_Node OPB_NewString (OPS_String str, int32 len) OPT_Node OPB_NewString (OPS_String str, int64 len)
{ {
OPT_Node _o_result; OPT_Node _o_result;
OPT_Node x = NIL; OPT_Node x = NIL;
@ -274,7 +268,7 @@ OPT_Node OPB_NewString (OPS_String str, int32 len)
x->conval = OPT_NewConst(); x->conval = OPT_NewConst();
x->typ = OPT_stringtyp; x->typ = OPT_stringtyp;
x->conval->intval = -1; x->conval->intval = -1;
x->conval->intval2 = len; x->conval->intval2 = OPM_Longint(len);
x->conval->ext = OPT_NewExt(); x->conval->ext = OPT_NewExt();
__COPY(str, *x->conval->ext, 256); __COPY(str, *x->conval->ext, 256);
_o_result = x; _o_result = x;
@ -351,7 +345,7 @@ void OPB_Index (OPT_Node *x, OPT_Node y)
} }
if ((*x)->typ->comp == 2) { if ((*x)->typ->comp == 2) {
typ = (*x)->typ->BaseTyp; typ = (*x)->typ->BaseTyp;
if ((y->class == 7 && (y->conval->intval < 0 || y->conval->intval >= (*x)->typ->n))) { if ((y->class == 7 && (y->conval->intval < 0 || y->conval->intval >= (int64)(*x)->typ->n))) {
OPB_err(81); OPB_err(81);
} }
} else if ((*x)->typ->comp == 3) { } else if ((*x)->typ->comp == 3) {
@ -466,14 +460,14 @@ void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard)
void OPB_In (OPT_Node *x, OPT_Node y) void OPB_In (OPT_Node *x, OPT_Node y)
{ {
int16 f; int16 f;
int32 k; int64 k;
f = (*x)->typ->form; f = (*x)->typ->form;
if ((((*x)->class == 8 || (*x)->class == 9) || y->class == 8) || y->class == 9) { if ((((*x)->class == 8 || (*x)->class == 9) || y->class == 8) || y->class == 9) {
OPB_err(126); OPB_err(126);
} else if ((f == 4 && y->typ->form == 7)) { } else if ((f == 4 && y->typ->form == 7)) {
if ((*x)->class == 7) { if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if (k < 0 || k > OPM_MaxSet) { if (k < 0 || k > (int64)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} else if (y->class == 7) { } else if (y->class == 7) {
(*x)->conval->intval = OPB_BoolToInt(__IN(k, y->conval->setval, 32)); (*x)->conval->intval = OPB_BoolToInt(__IN(k, y->conval->setval, 32));
@ -492,9 +486,9 @@ void OPB_In (OPT_Node *x, OPT_Node y)
(*x)->typ = OPT_booltyp; (*x)->typ = OPT_booltyp;
} }
static int32 OPB_log (int32 x) static int64 OPB_log (int64 x)
{ {
int32 _o_result; int64 _o_result;
OPB_exp = 0; OPB_exp = 0;
if (x > 0) { if (x > 0) {
while (!__ODD(x)) { while (!__ODD(x)) {
@ -580,7 +574,7 @@ void OPB_MOp (int8 op, OPT_Node *x)
if (__IN(f, 0xf0, 32)) { if (__IN(f, 0xf0, 32)) {
if (z->class == 7) { if (z->class == 7) {
if (f == 4) { if (f == 4) {
if (z->conval->intval == (-2147483647-1)) { if (z->conval->intval == (-9223372036854775807-1)) {
OPB_err(203); OPB_err(203);
} else { } else {
z->conval->intval = -z->conval->intval; z->conval->intval = -z->conval->intval;
@ -603,7 +597,7 @@ void OPB_MOp (int8 op, OPT_Node *x)
if (__IN(f, 0x70, 32)) { if (__IN(f, 0x70, 32)) {
if (z->class == 7) { if (z->class == 7) {
if (f == 4) { if (f == 4) {
if (z->conval->intval == (-2147483647-1)) { if (z->conval->intval == (-9223372036854775807-1)) {
OPB_err(203); OPB_err(203);
} else { } else {
z->conval->intval = __ABS(z->conval->intval); z->conval->intval = __ABS(z->conval->intval);
@ -845,7 +839,7 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y)
{ {
int16 f, g; int16 f, g;
OPT_Const xval = NIL, yval = NIL; OPT_Const xval = NIL, yval = NIL;
int32 xv, yv; int64 xv, yv;
BOOLEAN temp; BOOLEAN temp;
struct ConstOp__13 _s; struct ConstOp__13 _s;
_s.x = &x; _s.x = &x;
@ -1007,7 +1001,7 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y)
case 4: case 4:
if (f == 4) { if (f == 4) {
if (yval->intval != 0) { if (yval->intval != 0) {
xval->intval = (int)__MOD(xval->intval, yval->intval); xval->intval = __MOD(xval->intval, yval->intval);
OPB_SetIntType(x); OPB_SetIntType(x);
} else { } else {
OPB_err(205); OPB_err(205);
@ -1122,7 +1116,7 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ)
{ {
OPT_Node node = NIL; OPT_Node node = NIL;
int16 f, g; int16 f, g;
int32 k; int64 k;
LONGREAL r; LONGREAL r;
f = (*x)->typ->form; f = (*x)->typ->form;
g = typ->form; g = typ->form;
@ -1229,7 +1223,7 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y)
OPT_Node t = NIL, z = NIL; OPT_Node t = NIL, z = NIL;
OPT_Struct typ = NIL; OPT_Struct typ = NIL;
BOOLEAN do_; BOOLEAN do_;
int32 val; int64 val;
struct Op__38 _s; struct Op__38 _s;
_s.f = &f; _s.f = &f;
_s.g = &g; _s.g = &g;
@ -1500,19 +1494,19 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y)
void OPB_SetRange (OPT_Node *x, OPT_Node y) void OPB_SetRange (OPT_Node *x, OPT_Node y)
{ {
int32 k, l; int64 k, l;
if ((((*x)->class == 8 || (*x)->class == 9) || y->class == 8) || y->class == 9) { if ((((*x)->class == 8 || (*x)->class == 9) || y->class == 8) || y->class == 9) {
OPB_err(126); OPB_err(126);
} else if (((*x)->typ->form == 4 && y->typ->form == 4)) { } else if (((*x)->typ->form == 4 && y->typ->form == 4)) {
if ((*x)->class == 7) { if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if (0 > k || k > OPM_MaxSet) { if (0 > k || k > (int64)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} }
} }
if (y->class == 7) { if (y->class == 7) {
l = y->conval->intval; l = y->conval->intval;
if (0 > l || l > OPM_MaxSet) { if (0 > l || l > (int64)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} }
} }
@ -1535,14 +1529,14 @@ void OPB_SetRange (OPT_Node *x, OPT_Node y)
void OPB_SetElem (OPT_Node *x) void OPB_SetElem (OPT_Node *x)
{ {
int32 k; int64 k;
if ((*x)->class == 8 || (*x)->class == 9) { if ((*x)->class == 8 || (*x)->class == 9) {
OPB_err(126); OPB_err(126);
} else if ((*x)->typ->form != 4) { } else if ((*x)->typ->form != 4) {
OPB_err(93); OPB_err(93);
} else if ((*x)->class == 7) { } else if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if ((0 <= k && k <= OPM_MaxSet)) { if ((0 <= k && k <= (int64)OPM_MaxSet)) {
(*x)->conval->setval = __SETOF(k,32); (*x)->conval->setval = __SETOF(k,32);
} else { } else {
OPB_err(202); OPB_err(202);
@ -1917,7 +1911,7 @@ void OPB_StPar0 (OPT_Node *par0, int16 fctno)
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if (f == 4) { } else if (f == 4) {
if (x->typ->size != OPT_linttyp->size) { if (x->typ->size < OPT_linttyp->size) {
OPB_Convert(&x, OPT_linttyp); OPB_Convert(&x, OPT_linttyp);
} }
} else { } else {
@ -2055,7 +2049,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if (f == 4) { } else if (f == 4) {
if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > OPM_MaxSet))) { if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (int64)OPM_MaxSet))) {
OPB_err(202); OPB_err(202);
} }
p = NewOp__53(19, fctno, p, x); p = NewOp__53(19, fctno, p, x);
@ -2068,7 +2062,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
if (!(f == 4) || x->class != 7) { if (!(f == 4) || x->class != 7) {
OPB_err(69); OPB_err(69);
} else if (x->typ->size == 1) { } else if (x->typ->size == 1) {
L = (int16)x->conval->intval; L = OPM_Integer(x->conval->intval);
typ = p->typ; typ = p->typ;
while ((L > 0 && __IN(typ->comp, 0x0c, 32))) { while ((L > 0 && __IN(typ->comp, 0x0c, 32))) {
typ = typ->BaseTyp; typ = typ->BaseTyp;
@ -2120,8 +2114,8 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
OPB_err(208); OPB_err(208);
p->conval->intval = 1; p->conval->intval = 1;
} else if (x->conval->intval >= 0) { } else if (x->conval->intval >= 0) {
if (__ABS(p->conval->intval) <= __DIV(2147483647, __ASH(1, x->conval->intval))) { if (__ABS(p->conval->intval) <= __DIV(9223372036854775807, (int64)__ASH(1, x->conval->intval))) {
p->conval->intval = p->conval->intval * __ASH(1, x->conval->intval); p->conval->intval = p->conval->intval * (int64)__ASH(1, x->conval->intval);
} else { } else {
OPB_err(208); OPB_err(208);
p->conval->intval = 1; p->conval->intval = 1;
@ -2132,7 +2126,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
p->obj = NIL; p->obj = NIL;
} else { } else {
p = NewOp__53(12, 17, p, x); p = NewOp__53(12, 17, p, x);
p->typ = OPT_linttyp; p->typ = p->left->typ;
} }
} else { } else {
OPB_err(111); OPB_err(111);
@ -2143,7 +2137,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 > OPM_MaxIndex))) { if ((x->class == 7 && (x->conval->intval <= 0 || x->conval->intval > (int64)OPM_MaxIndex))) {
OPB_err(63); OPB_err(63);
} }
} else { } else {
@ -2281,7 +2275,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 > OPM_MaxIndex))) { if ((x->class == 7 && (x->conval->intval <= 0 || x->conval->intval > (int64)OPM_MaxIndex))) {
OPB_err(63); OPB_err(63);
} }
node = p->right; node = p->right;
@ -2622,7 +2616,7 @@ export void *OPB__init(void)
__MODULE_IMPORT(OPT); __MODULE_IMPORT(OPT);
__REGMOD("OPB", 0); __REGMOD("OPB", 0);
/* BEGIN */ /* BEGIN */
OPB_maxExp = OPB_log(1073741824); OPB_maxExp = OPB_log(4611686018427387904);
OPB_maxExp = OPB_exp; OPB_maxExp = OPB_exp;
__ENDMOD; __ENDMOD;
} }

View file

@ -25,10 +25,10 @@ import void OPB_Inittd (OPT_Node *inittd, OPT_Node *last, OPT_Struct typ);
import void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y); import void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y);
import void OPB_MOp (int8 op, OPT_Node *x); import void OPB_MOp (int8 op, OPT_Node *x);
import OPT_Node OPB_NewBoolConst (BOOLEAN boolval); import OPT_Node OPB_NewBoolConst (BOOLEAN boolval);
import OPT_Node OPB_NewIntConst (int32 intval); import OPT_Node OPB_NewIntConst (int64 intval);
import OPT_Node OPB_NewLeaf (OPT_Object obj); import OPT_Node OPB_NewLeaf (OPT_Object obj);
import OPT_Node OPB_NewRealConst (LONGREAL realval, OPT_Struct typ); import OPT_Node OPB_NewRealConst (LONGREAL realval, OPT_Struct typ);
import OPT_Node OPB_NewString (OPS_String str, int32 len); import OPT_Node OPB_NewString (OPS_String str, int64 len);
import OPT_Node OPB_Nil (void); import OPT_Node OPB_Nil (void);
import void OPB_Op (int8 op, OPT_Node *x, OPT_Node y); import void OPB_Op (int8 op, OPT_Node *x, OPT_Node y);
import void OPB_OptIf (OPT_Node *x); import void OPB_OptIf (OPT_Node *x);

View file

@ -26,8 +26,8 @@ export OPT_Object OPC_BaseTProc (OPT_Object obj);
export void OPC_BegBlk (void); export void OPC_BegBlk (void);
export void OPC_BegStat (void); export void OPC_BegStat (void);
static void OPC_CProcDefs (OPT_Object obj, int16 vis); static void OPC_CProcDefs (OPT_Object obj, int16 vis);
export void OPC_Case (int32 caseVal, int16 form); export void OPC_Case (int64 caseVal, int16 form);
static void OPC_CharacterLiteral (int32 c); static void OPC_CharacterLiteral (int64 c);
export void OPC_Cmp (int16 rel); export void OPC_Cmp (int16 rel);
export void OPC_CompleteIdent (OPT_Object obj); export void OPC_CompleteIdent (OPT_Object obj);
export void OPC_Constant (OPT_Const con, int16 form); export void OPC_Constant (OPT_Const con, int16 form);
@ -67,8 +67,8 @@ static void OPC_InitImports (OPT_Object obj);
static void OPC_InitKeywords (void); static void OPC_InitKeywords (void);
export void OPC_InitTDesc (OPT_Struct typ); export void OPC_InitTDesc (OPT_Struct typ);
static void OPC_InitTProcs (OPT_Object typ, OPT_Object obj); static void OPC_InitTProcs (OPT_Object typ, OPT_Object obj);
export void OPC_IntLiteral (int32 n, int32 size); export void OPC_IntLiteral (int64 n, int32 size);
export void OPC_Len (OPT_Object obj, OPT_Struct array, int32 dim); export void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim);
static void OPC_LenList (OPT_Object par, BOOLEAN ansiDefine, BOOLEAN showParamName); static void OPC_LenList (OPT_Object par, BOOLEAN ansiDefine, BOOLEAN showParamName);
static int16 OPC_Length (CHAR *s, LONGINT s__len); static int16 OPC_Length (CHAR *s, LONGINT s__len);
export int32 OPC_NofPtrs (OPT_Struct typ); export int32 OPC_NofPtrs (OPT_Struct typ);
@ -1851,7 +1851,7 @@ void OPC_Cmp (int16 rel)
} }
} }
static void OPC_CharacterLiteral (int32 c) static void OPC_CharacterLiteral (int64 c)
{ {
if (c < 32 || c > 126) { if (c < 32 || c > 126) {
OPM_WriteString((CHAR*)"0x", 3); OPM_WriteString((CHAR*)"0x", 3);
@ -1894,7 +1894,7 @@ static void OPC_StringLiteral (CHAR *s, LONGINT s__len, int32 l)
__DEL(s); __DEL(s);
} }
void OPC_Case (int32 caseVal, int16 form) void OPC_Case (int64 caseVal, int16 form)
{ {
CHAR ch; CHAR ch;
OPM_WriteString((CHAR*)"case ", 6); OPM_WriteString((CHAR*)"case ", 6);
@ -1937,7 +1937,7 @@ void OPC_Halt (int32 n)
OPC_Str1((CHAR*)"__HALT(#)", 10, n); OPC_Str1((CHAR*)"__HALT(#)", 10, n);
} }
void OPC_IntLiteral (int32 n, int32 size) void OPC_IntLiteral (int64 n, int32 size)
{ {
if ((((size > 4 && n <= 2147483647)) && n > (-2147483647-1))) { if ((((size > 4 && n <= 2147483647)) && n > (-2147483647-1))) {
OPM_WriteString((CHAR*)"((int", 6); OPM_WriteString((CHAR*)"((int", 6);
@ -1950,7 +1950,7 @@ void OPC_IntLiteral (int32 n, int32 size)
} }
} }
void OPC_Len (OPT_Object obj, OPT_Struct array, int32 dim) void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim)
{ {
if (array->comp == 3) { if (array->comp == 3) {
OPC_CompleteIdent(obj); OPC_CompleteIdent(obj);

View file

@ -15,7 +15,7 @@ import int32 OPC_BaseAlignment (OPT_Struct typ);
import OPT_Object OPC_BaseTProc (OPT_Object obj); import OPT_Object OPC_BaseTProc (OPT_Object obj);
import void OPC_BegBlk (void); import void OPC_BegBlk (void);
import void OPC_BegStat (void); import void OPC_BegStat (void);
import void OPC_Case (int32 caseVal, int16 form); import void OPC_Case (int64 caseVal, int16 form);
import void OPC_Cmp (int16 rel); import void OPC_Cmp (int16 rel);
import void OPC_CompleteIdent (OPT_Object obj); import void OPC_CompleteIdent (OPT_Object obj);
import void OPC_Constant (OPT_Const con, int16 form); import void OPC_Constant (OPT_Const con, int16 form);
@ -37,8 +37,8 @@ import void OPC_Increment (BOOLEAN decrement);
import void OPC_Indent (int16 count); import void OPC_Indent (int16 count);
import void OPC_Init (void); import void OPC_Init (void);
import void OPC_InitTDesc (OPT_Struct typ); import void OPC_InitTDesc (OPT_Struct typ);
import void OPC_IntLiteral (int32 n, int32 size); import void OPC_IntLiteral (int64 n, int32 size);
import void OPC_Len (OPT_Object obj, OPT_Struct array, int32 dim); import void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim);
import int32 OPC_NofPtrs (OPT_Struct typ); import int32 OPC_NofPtrs (OPT_Struct typ);
import void OPC_SetInclude (BOOLEAN exclude); import void OPC_SetInclude (BOOLEAN exclude);
import int32 OPC_SizeAlignment (int32 size); import int32 OPC_SizeAlignment (int32 size);

View file

@ -28,7 +28,8 @@ export int16 OPM_currFile, OPM_level, OPM_pc, OPM_entno;
export CHAR OPM_modName[32]; export CHAR OPM_modName[32];
export CHAR OPM_objname[64]; export CHAR OPM_objname[64];
export SET OPM_opt, OPM_glbopt; export SET OPM_opt, OPM_glbopt;
static int32 OPM_ErrorLineStartPos, OPM_ErrorLineLimitPos, OPM_ErrorLineNumber, OPM_lasterrpos; static int32 OPM_ErrorLineStartPos, OPM_ErrorLineLimitPos, OPM_ErrorLineNumber;
static int64 OPM_lasterrpos;
static Texts_Reader OPM_inR; static Texts_Reader OPM_inR;
static Texts_Text OPM_Log; static Texts_Text OPM_Log;
static Texts_Writer OPM_W; static Texts_Writer OPM_W;
@ -45,46 +46,49 @@ static void OPM_Append (Files_Rider *R, LONGINT *R__typ, Files_File F);
export void OPM_CloseFiles (void); export void OPM_CloseFiles (void);
export void OPM_CloseOldSym (void); export void OPM_CloseOldSym (void);
export void OPM_DeleteNewSym (void); export void OPM_DeleteNewSym (void);
export void OPM_FPrint (int32 *fp, int32 val); export void OPM_FPrint (int32 *fp, int64 val);
export void OPM_FPrintLReal (int32 *fp, LONGREAL lr); export void OPM_FPrintLReal (int32 *fp, LONGREAL lr);
export void OPM_FPrintReal (int32 *fp, REAL real); export void OPM_FPrintReal (int32 *fp, REAL real);
export void OPM_FPrintSet (int32 *fp, SET set); export void OPM_FPrintSet (int32 *fp, SET set);
static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, int32 pos); static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, int64 pos);
export void OPM_Get (CHAR *ch); export void OPM_Get (CHAR *ch);
static void OPM_GetProperties (void); static void OPM_GetProperties (void);
static void OPM_GetProperty (Texts_Scanner *S, LONGINT *S__typ, CHAR *name, LONGINT name__len, int16 *size, int16 *align); static void OPM_GetProperty (Texts_Scanner *S, LONGINT *S__typ, CHAR *name, LONGINT name__len, int16 *size, int16 *align);
export void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); export void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len);
export void OPM_InitOptions (void); export void OPM_InitOptions (void);
export int16 OPM_Integer (int64 n);
static void OPM_LogErrMsg (int16 n); static void OPM_LogErrMsg (int16 n);
export void OPM_LogW (CHAR ch); export void OPM_LogW (CHAR ch);
export void OPM_LogWLn (void); export void OPM_LogWLn (void);
export void OPM_LogWNum (int32 i, int32 len); export void OPM_LogWNum (int64 i, int64 len);
export void OPM_LogWStr (CHAR *s, LONGINT s__len); export void OPM_LogWStr (CHAR *s, LONGINT s__len);
export int32 OPM_Longint (int64 n);
static void OPM_MakeFileName (CHAR *name, LONGINT name__len, CHAR *FName, LONGINT FName__len, CHAR *ext, LONGINT ext__len); static void OPM_MakeFileName (CHAR *name, LONGINT name__len, CHAR *FName, LONGINT FName__len, CHAR *ext, LONGINT ext__len);
export void OPM_Mark (int16 n, int32 pos); export void OPM_Mark (int16 n, int64 pos);
export void OPM_NewSym (CHAR *modName, LONGINT modName__len); export void OPM_NewSym (CHAR *modName, LONGINT modName__len);
export void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done); export void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done);
export void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len); export void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len);
export BOOLEAN OPM_OpenPar (void); 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 (int32 pos); static void OPM_ShowLine (int64 pos);
export int32 OPM_SignedMaximum (int32 bytecount); export int32 OPM_SignedMaximum (int32 bytecount);
export int32 OPM_SignedMinimum (int32 bytecount); export int32 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 void OPM_SymRLReal (LONGREAL *lr); export void OPM_SymRLReal (LONGREAL *lr);
export void OPM_SymRReal (REAL *r); export void OPM_SymRReal (REAL *r);
export void OPM_SymRSet (SET *s); export void OPM_SymRSet (SET *s);
export void OPM_SymWCh (CHAR ch); export void OPM_SymWCh (CHAR ch);
export void OPM_SymWInt (int32 i); export void OPM_SymWInt (int64 i);
export void OPM_SymWLReal (LONGREAL lr); export void OPM_SymWLReal (LONGREAL lr);
export void OPM_SymWReal (REAL r); export void OPM_SymWReal (REAL r);
export void OPM_SymWSet (SET s); export void OPM_SymWSet (SET s);
static void OPM_VerboseListSizes (void); static void OPM_VerboseListSizes (void);
export void OPM_Write (CHAR ch); export void OPM_Write (CHAR ch);
export void OPM_WriteHex (int32 i); export void OPM_WriteHex (int64 i);
export void OPM_WriteInt (int32 i); export void OPM_WriteInt (int64 i);
export void OPM_WriteLn (void); export void OPM_WriteLn (void);
export void OPM_WriteReal (LONGREAL r, CHAR suffx); export void OPM_WriteReal (LONGREAL r, CHAR suffx);
export void OPM_WriteString (CHAR *s, LONGINT s__len); export void OPM_WriteString (CHAR *s, LONGINT s__len);
@ -107,7 +111,7 @@ void OPM_LogWStr (CHAR *s, LONGINT s__len)
__DEL(s); __DEL(s);
} }
void OPM_LogWNum (int32 i, int32 len) void OPM_LogWNum (int64 i, int64 len)
{ {
Console_Int(i, len); Console_Int(i, len);
} }
@ -117,6 +121,20 @@ void OPM_LogWLn (void)
Console_Ln(); Console_Ln();
} }
int32 OPM_Longint (int64 n)
{
int32 _o_result;
_o_result = __VAL(int32, n);
return _o_result;
}
int16 OPM_Integer (int64 n)
{
int16 _o_result;
_o_result = __VAL(int16, n);
return _o_result;
}
static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt)
{ {
int16 i; int16 i;
@ -404,21 +422,21 @@ static void OPM_LogErrMsg (int16 n)
OPM_LogWStr(errors_errors[__X(n, 350)], 128); OPM_LogWStr(errors_errors[__X(n, 350)], 128);
} }
static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, int32 pos) static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, int64 pos)
{ {
CHAR ch, cheol; CHAR ch, cheol;
if (pos < OPM_ErrorLineStartPos) { if (pos < (int64)OPM_ErrorLineStartPos) {
OPM_ErrorLineStartPos = 0; OPM_ErrorLineStartPos = 0;
OPM_ErrorLineLimitPos = 0; OPM_ErrorLineLimitPos = 0;
OPM_ErrorLineNumber = 0; OPM_ErrorLineNumber = 0;
} }
if (pos < OPM_ErrorLineLimitPos) { if (pos < (int64)OPM_ErrorLineLimitPos) {
Files_Set(&*r, r__typ, f, OPM_ErrorLineStartPos); Files_Set(&*r, r__typ, f, OPM_ErrorLineStartPos);
return; return;
} }
Files_Set(&*r, r__typ, f, OPM_ErrorLineLimitPos); Files_Set(&*r, r__typ, f, OPM_ErrorLineLimitPos);
Files_Read(&*r, r__typ, (void*)&ch); Files_Read(&*r, r__typ, (void*)&ch);
while ((OPM_ErrorLineLimitPos < pos && !(*r).eof)) { while (((int64)OPM_ErrorLineLimitPos < pos && !(*r).eof)) {
OPM_ErrorLineStartPos = OPM_ErrorLineLimitPos; OPM_ErrorLineStartPos = OPM_ErrorLineLimitPos;
OPM_ErrorLineNumber += 1; OPM_ErrorLineNumber += 1;
while ((((ch != 0x00 && ch != 0x0d)) && ch != 0x0a)) { while ((((ch != 0x00 && ch != 0x0d)) && ch != 0x0a)) {
@ -436,7 +454,7 @@ static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, int32 p
Files_Set(&*r, r__typ, f, OPM_ErrorLineStartPos); Files_Set(&*r, r__typ, f, OPM_ErrorLineStartPos);
} }
static void OPM_ShowLine (int32 pos) static void OPM_ShowLine (int64 pos)
{ {
Files_File f = NIL; Files_File f = NIL;
Files_Rider r; Files_Rider r;
@ -460,10 +478,10 @@ static void OPM_ShowLine (int32 pos)
OPM_LogWStr(line, 1023); OPM_LogWStr(line, 1023);
OPM_LogWLn(); OPM_LogWLn();
OPM_LogWStr((CHAR*)" ", 7); OPM_LogWStr((CHAR*)" ", 7);
if (pos >= OPM_ErrorLineLimitPos) { if (pos >= (int64)OPM_ErrorLineLimitPos) {
pos = OPM_ErrorLineLimitPos - 1; pos = OPM_ErrorLineLimitPos - 1;
} }
i = (int16)(pos - OPM_ErrorLineStartPos); i = (int16)OPM_Longint(pos - (int64)OPM_ErrorLineStartPos);
while (i > 0) { while (i > 0) {
OPM_LogW(' '); OPM_LogW(' ');
i -= 1; i -= 1;
@ -478,7 +496,7 @@ static void OPM_ShowLine (int32 pos)
Files_Close(f); Files_Close(f);
} }
void OPM_Mark (int16 n, int32 pos) void OPM_Mark (int16 n, int64 pos)
{ {
if (pos == -1) { if (pos == -1) {
pos = 0; pos = 0;
@ -535,9 +553,9 @@ void OPM_err (int16 n)
OPM_Mark(n, OPM_errpos); OPM_Mark(n, OPM_errpos);
} }
void OPM_FPrint (int32 *fp, int32 val) void OPM_FPrint (int32 *fp, int64 val)
{ {
*fp = __ROTL((int32)((SET)*fp ^ (SET)val), 1, 32); *fp = __ROTL((int32)((SET)*fp ^ __VAL(SET, val)), 1, 32);
} }
void OPM_FPrintSet (int32 *fp, SET set) void OPM_FPrintSet (int32 *fp, SET set)
@ -702,6 +720,15 @@ int32 OPM_SymRInt (void)
return _o_result; return _o_result;
} }
int64 OPM_SymRInt64 (void)
{
int64 _o_result;
int64 k;
Files_ReadNum64(&OPM_oldSF, Files_Rider__typ, &k);
_o_result = k;
return _o_result;
}
void OPM_SymRSet (SET *s) void OPM_SymRSet (SET *s)
{ {
Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (int32*)&*s); Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (int32*)&*s);
@ -751,9 +778,9 @@ void OPM_SymWCh (CHAR ch)
Files_Write(&OPM_newSF, Files_Rider__typ, ch); Files_Write(&OPM_newSF, Files_Rider__typ, ch);
} }
void OPM_SymWInt (int32 i) void OPM_SymWInt (int64 i)
{ {
Files_WriteNum(&OPM_newSF, Files_Rider__typ, i); Files_WriteNum64(&OPM_newSF, Files_Rider__typ, i);
} }
void OPM_SymWSet (SET s) void OPM_SymWSet (SET s)
@ -820,17 +847,17 @@ void OPM_WriteStringVar (CHAR *s, LONGINT s__len)
Files_WriteBytes(&OPM_R[__X(OPM_currFile, 3)], Files_Rider__typ, (void*)s, s__len * 1, i); Files_WriteBytes(&OPM_R[__X(OPM_currFile, 3)], Files_Rider__typ, (void*)s, s__len * 1, i);
} }
void OPM_WriteHex (int32 i) void OPM_WriteHex (int64 i)
{ {
CHAR s[3]; CHAR s[3];
int16 digit; int32 digit;
digit = __ASHR((int16)i, 4); digit = __ASHR((int32)i, 4);
if (digit < 10) { if (digit < 10) {
s[0] = (CHAR)(48 + digit); s[0] = (CHAR)(48 + digit);
} else { } else {
s[0] = (CHAR)(87 + digit); s[0] = (CHAR)(87 + digit);
} }
digit = __MASK((int16)i, -16); digit = __MASK((int32)i, -16);
if (digit < 10) { if (digit < 10) {
s[1] = (CHAR)(48 + digit); s[1] = (CHAR)(48 + digit);
} else { } else {
@ -840,31 +867,31 @@ void OPM_WriteHex (int32 i)
OPM_WriteString(s, 3); OPM_WriteString(s, 3);
} }
void OPM_WriteInt (int32 i) void OPM_WriteInt (int64 i)
{ {
CHAR s[20]; CHAR s[24];
int32 i1, k; int64 i1, k;
if (i == OPM_SignedMinimum(OPM_IntSize) || i == OPM_SignedMinimum(OPM_LIntSize)) { if ((i == (int64)OPM_SignedMinimum(OPM_IntSize) || i == (int64)OPM_SignedMinimum(OPM_LIntSize)) || i == (int64)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);
} else { } else {
i1 = __ABS(i); i1 = __ABS(i);
s[0] = (CHAR)((int)__MOD(i1, 10) + 48); s[0] = (CHAR)(__MOD(i1, 10) + 48);
i1 = __DIV(i1, 10); i1 = __DIV(i1, 10);
k = 1; k = 1;
while (i1 > 0) { while (i1 > 0) {
s[__X(k, 20)] = (CHAR)((int)__MOD(i1, 10) + 48); s[__X(k, 24)] = (CHAR)(__MOD(i1, 10) + 48);
i1 = __DIV(i1, 10); i1 = __DIV(i1, 10);
k += 1; k += 1;
} }
if (i < 0) { if (i < 0) {
s[__X(k, 20)] = '-'; s[__X(k, 24)] = '-';
k += 1; k += 1;
} }
while (k > 0) { while (k > 0) {
k -= 1; k -= 1;
OPM_Write(s[__X(k, 20)]); OPM_Write(s[__X(k, 24)]);
} }
} }
} }

View file

@ -21,18 +21,20 @@ import BOOLEAN OPM_dontAsm, OPM_dontLink, OPM_mainProg, OPM_mainLinkStat, OPM_no
import void OPM_CloseFiles (void); import void OPM_CloseFiles (void);
import void OPM_CloseOldSym (void); import void OPM_CloseOldSym (void);
import void OPM_DeleteNewSym (void); import void OPM_DeleteNewSym (void);
import void OPM_FPrint (int32 *fp, int32 val); import void OPM_FPrint (int32 *fp, int64 val);
import void OPM_FPrintLReal (int32 *fp, LONGREAL lr); import void OPM_FPrintLReal (int32 *fp, LONGREAL lr);
import void OPM_FPrintReal (int32 *fp, REAL real); import void OPM_FPrintReal (int32 *fp, REAL real);
import void OPM_FPrintSet (int32 *fp, SET set); import void OPM_FPrintSet (int32 *fp, SET set);
import void OPM_Get (CHAR *ch); import void OPM_Get (CHAR *ch);
import void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); import void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len);
import void OPM_InitOptions (void); import void OPM_InitOptions (void);
import int16 OPM_Integer (int64 n);
import void OPM_LogW (CHAR ch); import void OPM_LogW (CHAR ch);
import void OPM_LogWLn (void); import void OPM_LogWLn (void);
import void OPM_LogWNum (int32 i, int32 len); import void OPM_LogWNum (int64 i, int64 len);
import void OPM_LogWStr (CHAR *s, LONGINT s__len); import void OPM_LogWStr (CHAR *s, LONGINT s__len);
import void OPM_Mark (int16 n, int32 pos); import int32 OPM_Longint (int64 n);
import void OPM_Mark (int16 n, int64 pos);
import void OPM_NewSym (CHAR *modName, LONGINT modName__len); import void OPM_NewSym (CHAR *modName, LONGINT modName__len);
import void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done); 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);
@ -42,17 +44,18 @@ import int32 OPM_SignedMaximum (int32 bytecount);
import int32 OPM_SignedMinimum (int32 bytecount); import int32 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 void OPM_SymRLReal (LONGREAL *lr); import void OPM_SymRLReal (LONGREAL *lr);
import void OPM_SymRReal (REAL *r); import void OPM_SymRReal (REAL *r);
import void OPM_SymRSet (SET *s); import void OPM_SymRSet (SET *s);
import void OPM_SymWCh (CHAR ch); import void OPM_SymWCh (CHAR ch);
import void OPM_SymWInt (int32 i); import void OPM_SymWInt (int64 i);
import void OPM_SymWLReal (LONGREAL lr); import void OPM_SymWLReal (LONGREAL lr);
import void OPM_SymWReal (REAL r); import void OPM_SymWReal (REAL r);
import void OPM_SymWSet (SET s); import void OPM_SymWSet (SET s);
import void OPM_Write (CHAR ch); import void OPM_Write (CHAR ch);
import void OPM_WriteHex (int32 i); import void OPM_WriteHex (int64 i);
import void OPM_WriteInt (int32 i); import void OPM_WriteInt (int64 i);
import void OPM_WriteLn (void); import void OPM_WriteLn (void);
import void OPM_WriteReal (LONGREAL r, CHAR suffx); import void OPM_WriteReal (LONGREAL r, CHAR suffx);
import void OPM_WriteString (CHAR *s, LONGINT s__len); import void OPM_WriteString (CHAR *s, LONGINT s__len);

View file

@ -134,7 +134,7 @@ static void OPP_CheckMark (int8 *vis)
static void OPP_CheckSysFlag (int16 *sysflag, int16 default_) static void OPP_CheckSysFlag (int16 *sysflag, int16 default_)
{ {
OPT_Node x = NIL; OPT_Node x = NIL;
int32 sf; int64 sf;
if (OPP_sym == 31) { if (OPP_sym == 31) {
OPS_Get(&OPP_sym); OPS_Get(&OPP_sym);
if (!OPT_SYSimported) { if (!OPT_SYSimported) {
@ -151,7 +151,7 @@ static void OPP_CheckSysFlag (int16 *sysflag, int16 default_)
OPP_err(51); OPP_err(51);
sf = 0; sf = 0;
} }
*sysflag = (int16)sf; *sysflag = OPM_Integer(sf);
OPP_CheckSym(23); OPP_CheckSym(23);
} else { } else {
*sysflag = default_; *sysflag = default_;
@ -254,7 +254,7 @@ static void OPP_RecordType (OPT_Struct *typ, OPT_Struct *banned)
static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned) static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned)
{ {
OPT_Node x = NIL; OPT_Node x = NIL;
int32 n; int64 n;
int16 sysflag; int16 sysflag;
OPP_CheckSysFlag(&sysflag, 0); OPP_CheckSysFlag(&sysflag, 0);
if (OPP_sym == 25) { if (OPP_sym == 25) {
@ -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 > OPM_MaxIndex) { if (n <= 0 || n > (int64)OPM_MaxIndex) {
OPP_err(63); OPP_err(63);
n = 1; n = 1;
} }
@ -283,7 +283,7 @@ static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned)
OPP_err(51); OPP_err(51);
n = 1; n = 1;
} }
(*typ)->n = n; (*typ)->n = OPM_Longint(n);
if (OPP_sym == 25) { if (OPP_sym == 25) {
OPS_Get(&OPP_sym); OPS_Get(&OPP_sym);
OPP_Type(&(*typ)->BaseTyp, &*banned); OPP_Type(&(*typ)->BaseTyp, &*banned);
@ -932,7 +932,7 @@ static void GetCode__19 (void)
{ {
OPT_ConstExt ext = NIL; OPT_ConstExt ext = NIL;
int16 n; int16 n;
int32 c; int64 c;
ext = OPT_NewExt(); ext = OPT_NewExt();
(*ProcedureDeclaration__16_s->proc)->conval->ext = ext; (*ProcedureDeclaration__16_s->proc)->conval->ext = ext;
n = 0; n = 0;
@ -1179,7 +1179,7 @@ static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int16 *n, OPP
OPP_ConstExpression(&x); OPP_ConstExpression(&x);
f = x->typ->form; f = x->typ->form;
if (__IN(f, 0x18, 32)) { if (__IN(f, 0x18, 32)) {
xval = x->conval->intval; xval = OPM_Longint(x->conval->intval);
} else { } else {
OPP_err(61); OPP_err(61);
xval = 1; xval = 1;
@ -1194,7 +1194,7 @@ static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int16 *n, OPP
if (OPP_sym == 21) { if (OPP_sym == 21) {
OPS_Get(&OPP_sym); OPS_Get(&OPP_sym);
OPP_ConstExpression(&y); OPP_ConstExpression(&y);
yval = y->conval->intval; yval = OPM_Longint(y->conval->intval);
if (((int16)y->typ->form != f && !((f == 4 && y->typ->form == 4)))) { if (((int16)y->typ->form != f && !((f == 4 && y->typ->form == 4)))) {
OPP_err(60); OPP_err(60);
} }

View file

@ -17,7 +17,7 @@ typedef
export OPS_Name OPS_name; export OPS_Name OPS_name;
export OPS_String OPS_str; export OPS_String OPS_str;
export int16 OPS_numtyp; export int16 OPS_numtyp;
export int32 OPS_intval; export int64 OPS_intval;
export REAL OPS_realval; export REAL OPS_realval;
export LONGREAL OPS_lrlval; export LONGREAL OPS_lrlval;
static CHAR OPS_ch; static CHAR OPS_ch;
@ -178,7 +178,7 @@ static void OPS_Number (void)
OPS_numtyp = 1; OPS_numtyp = 1;
if (n <= 2) { if (n <= 2) {
while (i < n) { while (i < n) {
OPS_intval = __ASHL(OPS_intval, 4) + Ord__7(dig[i], 1); OPS_intval = __ASHL(OPS_intval, 4) + (int64)Ord__7(dig[i], 1);
i += 1; i += 1;
} }
} else { } else {
@ -192,7 +192,7 @@ static void OPS_Number (void)
OPS_intval = -1; OPS_intval = -1;
} }
while (i < n) { while (i < n) {
OPS_intval = __ASHL(OPS_intval, 4) + Ord__7(dig[i], 1); OPS_intval = __ASHL(OPS_intval, 4) + (int64)Ord__7(dig[i], 1);
i += 1; i += 1;
} }
} else { } else {
@ -203,8 +203,8 @@ static void OPS_Number (void)
while (i < n) { while (i < n) {
d = Ord__7(dig[i], 0); d = Ord__7(dig[i], 0);
i += 1; i += 1;
if ((int64)OPS_intval <= __DIV(9223372036854775807 - (int64)d, 10)) { if (OPS_intval <= __DIV(9223372036854775807 - (int64)d, 10)) {
OPS_intval = OPS_intval * 10 + d; OPS_intval = OPS_intval * 10 + (int64)d;
} else { } else {
OPS_err(203); OPS_err(203);
} }

View file

@ -15,7 +15,7 @@ typedef
import OPS_Name OPS_name; import OPS_Name OPS_name;
import OPS_String OPS_str; import OPS_String OPS_str;
import int16 OPS_numtyp; import int16 OPS_numtyp;
import int32 OPS_intval; import int64 OPS_intval;
import REAL OPS_realval; import REAL OPS_realval;
import LONGREAL OPS_lrlval; import LONGREAL OPS_lrlval;

View file

@ -17,7 +17,8 @@ typedef
typedef typedef
struct OPT_ConstDesc { struct OPT_ConstDesc {
OPT_ConstExt ext; OPT_ConstExt ext;
int32 intval, intval2; int64 intval;
int32 intval2;
SET setval; SET setval;
LONGREAL realval; LONGREAL realval;
} OPT_ConstDesc; } OPT_ConstDesc;
@ -1838,7 +1839,7 @@ static void EnumPtrs(void (*P)(void*))
__ENUMR(&OPT_impCtxt, OPT_ImpCtxt__typ, 3140, 1, P); __ENUMR(&OPT_impCtxt, OPT_ImpCtxt__typ, 3140, 1, P);
} }
__TDESC(OPT_ConstDesc, 1, 1) = {__TDFLDS("ConstDesc", 24), {0, -8}}; __TDESC(OPT_ConstDesc, 1, 1) = {__TDFLDS("ConstDesc", 32), {0, -8}};
__TDESC(OPT_ObjDesc, 1, 6) = {__TDFLDS("ObjDesc", 304), {0, 4, 8, 12, 284, 288, -28}}; __TDESC(OPT_ObjDesc, 1, 6) = {__TDFLDS("ObjDesc", 304), {0, 4, 8, 12, 284, 288, -28}};
__TDESC(OPT_StrDesc, 1, 3) = {__TDFLDS("StrDesc", 56), {44, 48, 52, -16}}; __TDESC(OPT_StrDesc, 1, 3) = {__TDFLDS("StrDesc", 56), {44, 48, 52, -16}};
__TDESC(OPT_NodeDesc, 1, 6) = {__TDFLDS("NodeDesc", 28), {0, 4, 8, 16, 20, 24, -28}}; __TDESC(OPT_NodeDesc, 1, 6) = {__TDFLDS("NodeDesc", 28), {0, 4, 8, 16, 20, 24, -28}};

View file

@ -15,7 +15,8 @@ typedef
typedef typedef
struct OPT_ConstDesc { struct OPT_ConstDesc {
OPT_ConstExt ext; OPT_ConstExt ext;
int32 intval, intval2; int64 intval;
int32 intval2;
SET setval; SET setval;
LONGREAL realval; LONGREAL realval;
} OPT_ConstDesc; } OPT_ConstDesc;

View file

@ -36,10 +36,10 @@ static BOOLEAN OPV_ImplicitReturn (OPT_Node n);
static void OPV_Index (OPT_Node n, OPT_Node d, int16 prec, int16 dim); static void OPV_Index (OPT_Node n, OPT_Node d, int16 prec, int16 dim);
export void OPV_Init (void); export void OPV_Init (void);
static void OPV_InitTDescs (OPT_Node n); static void OPV_InitTDescs (OPT_Node n);
static void OPV_Len (OPT_Node n, int32 dim); static void OPV_Len (OPT_Node n, int64 dim);
export void OPV_Module (OPT_Node prog); export void OPV_Module (OPT_Node prog);
static void OPV_NewArr (OPT_Node d, OPT_Node x); static void OPV_NewArr (OPT_Node d, OPT_Node x);
static void OPV_ParIntLiteral (int32 n, int32 size); static void OPV_ParIntLiteral (int64 n, int32 size);
static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp); static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp);
static BOOLEAN OPV_SideEffects (OPT_Node n); static BOOLEAN OPV_SideEffects (OPT_Node n);
static void OPV_SizeCast (int32 from, int32 to); static void OPV_SizeCast (int32 from, int32 to);
@ -414,7 +414,7 @@ static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp
__RETCHK; __RETCHK;
} }
static void OPV_Len (OPT_Node n, int32 dim) static void OPV_Len (OPT_Node n, int64 dim)
{ {
while ((n->class == 4 && n->typ->comp == 3)) { while ((n->class == 4 && n->typ->comp == 3)) {
dim += 1; dim += 1;
@ -725,7 +725,7 @@ static void OPV_design (OPT_Node n, int16 prec)
} }
} }
static void OPV_ParIntLiteral (int32 n, int32 size) static void OPV_ParIntLiteral (int64 n, int32 size)
{ {
if (OPV_ansi) { if (OPV_ansi) {
OPM_WriteInt(n); OPM_WriteInt(n);
@ -1210,7 +1210,7 @@ static void OPV_IfStat (OPT_Node n, BOOLEAN withtrap, OPT_Object outerProc)
static void OPV_CaseStat (OPT_Node n, OPT_Object outerProc) static void OPV_CaseStat (OPT_Node n, OPT_Object outerProc)
{ {
OPT_Node switchCase = NIL, label = NIL; OPT_Node switchCase = NIL, label = NIL;
int32 low, high; int64 low, high;
int16 form, i; int16 form, i;
OPM_WriteString((CHAR*)"switch ", 8); OPM_WriteString((CHAR*)"switch ", 8);
OPV_expr(n->left, 12); OPV_expr(n->left, 12);
@ -1351,7 +1351,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc)
OPV_ExitInfo saved; OPV_ExitInfo saved;
OPT_Node l = NIL, r = NIL; OPT_Node l = NIL, r = NIL;
while ((n != NIL && OPM_noerr)) { while ((n != NIL && OPM_noerr)) {
OPM_errpos = n->conval->intval; OPM_errpos = OPM_Longint(n->conval->intval);
if (n->class != 14) { if (n->class != 14) {
OPC_BegStat(); OPC_BegStat();
} }
@ -1625,7 +1625,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc)
OPV_IfStat(n, n->subcl == 0, outerProc); OPV_IfStat(n, n->subcl == 0, outerProc);
break; break;
case 28: case 28:
OPC_Halt(n->right->conval->intval); OPC_Halt(OPM_Longint(n->right->conval->intval));
break; break;
default: default:
OPM_LogWStr((CHAR*)"unhandled case in OPV.expr, n^.class = ", 40); OPM_LogWStr((CHAR*)"unhandled case in OPV.expr, n^.class = ", 40);

View file

@ -62,7 +62,7 @@ void Console_Int (int64 i, int64 n)
__MOVE("8085774586302733229", s, 20); __MOVE("8085774586302733229", s, 20);
k = 19; k = 19;
} else { } else {
i1 = __ABS(i); i1 = __ABS((int64)i);
s[0] = (CHAR)(__MOD(i1, 10) + 48); s[0] = (CHAR)(__MOD(i1, 10) + 48);
i1 = __DIV(i1, 10); i1 = __DIV(i1, 10);
k = 1; k = 1;

View file

@ -90,6 +90,7 @@ export void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, int64 *x);
export void Files_ReadLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL *x); export void Files_ReadLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL *x);
export void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); export void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
export void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int64 *x); export void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int64 *x);
export void Files_ReadNum64 (Files_Rider *R, LONGINT *R__typ, int64 *x);
export void Files_ReadReal (Files_Rider *R, LONGINT *R__typ, REAL *x); export void Files_ReadReal (Files_Rider *R, LONGINT *R__typ, REAL *x);
export void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x); export void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x);
export void Files_ReadString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); export void Files_ReadString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
@ -105,6 +106,7 @@ export void Files_WriteInt (Files_Rider *R, LONGINT *R__typ, int32 x);
export void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int64 x); export void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int64 x);
export void Files_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL x); export void Files_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL x);
export void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int64 x); export void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int64 x);
export void Files_WriteNum64 (Files_Rider *R, LONGINT *R__typ, int64 x);
export void Files_WriteReal (Files_Rider *R, LONGINT *R__typ, REAL x); export void Files_WriteReal (Files_Rider *R, LONGINT *R__typ, REAL x);
export void Files_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x); export void Files_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x);
export void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); export void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
@ -936,6 +938,13 @@ void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int64 *x)
*x = n; *x = n;
} }
void Files_ReadNum64 (Files_Rider *R, LONGINT *R__typ, int64 *x)
{
int64 n;
Files_ReadNum(&*R, R__typ, &n);
*x = n;
}
void Files_WriteBool (Files_Rider *R, LONGINT *R__typ, BOOLEAN x) void Files_WriteBool (Files_Rider *R, LONGINT *R__typ, BOOLEAN x)
{ {
Files_Write(&*R, R__typ, __VAL(CHAR, x)); Files_Write(&*R, R__typ, __VAL(CHAR, x));
@ -1004,6 +1013,15 @@ void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int64 x)
Files_Write(&*R, R__typ, (CHAR)__MASK(x, -128)); Files_Write(&*R, R__typ, (CHAR)__MASK(x, -128));
} }
void Files_WriteNum64 (Files_Rider *R, LONGINT *R__typ, int64 x)
{
while (x < -64 || x > 63) {
Files_Write(&*R, R__typ, (CHAR)(__MASK(x, -128) + 128));
x = __ASHR(x, 7);
}
Files_Write(&*R, R__typ, (CHAR)__MASK(x, -128));
}
void Files_GetName (Files_File f, CHAR *name, LONGINT name__len) void Files_GetName (Files_File f, CHAR *name, LONGINT name__len)
{ {
__COPY(f->workName, name, name__len); __COPY(f->workName, name, name__len);

View file

@ -47,6 +47,7 @@ import void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, int64 *x);
import void Files_ReadLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL *x); import void Files_ReadLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL *x);
import void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); import void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
import void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int64 *x); import void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int64 *x);
import void Files_ReadNum64 (Files_Rider *R, LONGINT *R__typ, int64 *x);
import void Files_ReadReal (Files_Rider *R, LONGINT *R__typ, REAL *x); import void Files_ReadReal (Files_Rider *R, LONGINT *R__typ, REAL *x);
import void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x); import void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x);
import void Files_ReadString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); import void Files_ReadString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
@ -61,6 +62,7 @@ import void Files_WriteInt (Files_Rider *R, LONGINT *R__typ, int32 x);
import void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int64 x); import void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int64 x);
import void Files_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL x); import void Files_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL x);
import void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int64 x); import void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int64 x);
import void Files_WriteNum64 (Files_Rider *R, LONGINT *R__typ, int64 x);
import void Files_WriteReal (Files_Rider *R, LONGINT *R__typ, REAL x); import void Files_WriteReal (Files_Rider *R, LONGINT *R__typ, REAL x);
import void Files_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x); import void Files_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x);
import void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); import void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);

View file

@ -144,14 +144,8 @@ static int64 OPB_BoolToInt (BOOLEAN b)
static BOOLEAN OPB_IntToBool (int64 i) static BOOLEAN OPB_IntToBool (int64 i)
{ {
BOOLEAN _o_result; BOOLEAN _o_result;
if (i == 0) { _o_result = i != 0;
_o_result = 0;
return _o_result; return _o_result;
} else {
_o_result = 1;
return _o_result;
}
__RETCHK;
} }
OPT_Node OPB_NewBoolConst (BOOLEAN boolval) OPT_Node OPB_NewBoolConst (BOOLEAN boolval)
@ -274,7 +268,7 @@ OPT_Node OPB_NewString (OPS_String str, int64 len)
x->conval = OPT_NewConst(); x->conval = OPT_NewConst();
x->typ = OPT_stringtyp; x->typ = OPT_stringtyp;
x->conval->intval = -1; x->conval->intval = -1;
x->conval->intval2 = len; x->conval->intval2 = OPM_Longint(len);
x->conval->ext = OPT_NewExt(); x->conval->ext = OPT_NewExt();
__COPY(str, *x->conval->ext, 256); __COPY(str, *x->conval->ext, 256);
_o_result = x; _o_result = x;
@ -1917,7 +1911,7 @@ void OPB_StPar0 (OPT_Node *par0, int32 fctno)
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if (f == 4) { } else if (f == 4) {
if (x->typ->size != OPT_linttyp->size) { if (x->typ->size < OPT_linttyp->size) {
OPB_Convert(&x, OPT_linttyp); OPB_Convert(&x, OPT_linttyp);
} }
} else { } else {
@ -2068,7 +2062,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
if (!(f == 4) || x->class != 7) { if (!(f == 4) || x->class != 7) {
OPB_err(69); OPB_err(69);
} else if (x->typ->size == 1) { } else if (x->typ->size == 1) {
L = (int32)x->conval->intval; L = OPM_Integer(x->conval->intval);
typ = p->typ; typ = p->typ;
while ((L > 0 && __IN(typ->comp, 0x0c, 64))) { while ((L > 0 && __IN(typ->comp, 0x0c, 64))) {
typ = typ->BaseTyp; typ = typ->BaseTyp;
@ -2132,7 +2126,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
p->obj = NIL; p->obj = NIL;
} else { } else {
p = NewOp__53(12, 17, p, x); p = NewOp__53(12, 17, p, x);
p->typ = OPT_linttyp; p->typ = p->left->typ;
} }
} else { } else {
OPB_err(111); OPB_err(111);

View file

@ -55,11 +55,13 @@ static void OPM_GetProperties (void);
static void OPM_GetProperty (Texts_Scanner *S, LONGINT *S__typ, CHAR *name, LONGINT name__len, int32 *size, int32 *align); static void OPM_GetProperty (Texts_Scanner *S, LONGINT *S__typ, CHAR *name, LONGINT name__len, int32 *size, int32 *align);
export void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); export void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len);
export void OPM_InitOptions (void); export void OPM_InitOptions (void);
export int32 OPM_Integer (int64 n);
static void OPM_LogErrMsg (int32 n); static void OPM_LogErrMsg (int32 n);
export void OPM_LogW (CHAR ch); export void OPM_LogW (CHAR ch);
export void OPM_LogWLn (void); export void OPM_LogWLn (void);
export void OPM_LogWNum (int64 i, int64 len); export void OPM_LogWNum (int64 i, int64 len);
export void OPM_LogWStr (CHAR *s, LONGINT s__len); export void OPM_LogWStr (CHAR *s, LONGINT s__len);
export int64 OPM_Longint (int64 n);
static void OPM_MakeFileName (CHAR *name, LONGINT name__len, CHAR *FName, LONGINT FName__len, CHAR *ext, LONGINT ext__len); static void OPM_MakeFileName (CHAR *name, LONGINT name__len, CHAR *FName, LONGINT FName__len, CHAR *ext, LONGINT ext__len);
export void OPM_Mark (int32 n, int64 pos); export void OPM_Mark (int32 n, int64 pos);
export void OPM_NewSym (CHAR *modName, LONGINT modName__len); export void OPM_NewSym (CHAR *modName, LONGINT modName__len);
@ -73,6 +75,7 @@ export int64 OPM_SignedMaximum (int64 bytecount);
export int64 OPM_SignedMinimum (int64 bytecount); export int64 OPM_SignedMinimum (int64 bytecount);
export void OPM_SymRCh (CHAR *ch); export void OPM_SymRCh (CHAR *ch);
export int64 OPM_SymRInt (void); export int64 OPM_SymRInt (void);
export int64 OPM_SymRInt64 (void);
export void OPM_SymRLReal (LONGREAL *lr); export void OPM_SymRLReal (LONGREAL *lr);
export void OPM_SymRReal (REAL *r); export void OPM_SymRReal (REAL *r);
export void OPM_SymRSet (SET *s); export void OPM_SymRSet (SET *s);
@ -117,6 +120,20 @@ void OPM_LogWLn (void)
Console_Ln(); Console_Ln();
} }
int64 OPM_Longint (int64 n)
{
int64 _o_result;
_o_result = (int64)n;
return _o_result;
}
int32 OPM_Integer (int64 n)
{
int32 _o_result;
_o_result = __VAL(int32, n);
return _o_result;
}
static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt)
{ {
int32 i; int32 i;
@ -463,7 +480,7 @@ static void OPM_ShowLine (int64 pos)
if (pos >= OPM_ErrorLineLimitPos) { if (pos >= OPM_ErrorLineLimitPos) {
pos = OPM_ErrorLineLimitPos - 1; pos = OPM_ErrorLineLimitPos - 1;
} }
i = (int32)(pos - OPM_ErrorLineStartPos); i = (int32)OPM_Longint(pos - OPM_ErrorLineStartPos);
while (i > 0) { while (i > 0) {
OPM_LogW(' '); OPM_LogW(' ');
i -= 1; i -= 1;
@ -700,6 +717,15 @@ int64 OPM_SymRInt (void)
return _o_result; return _o_result;
} }
int64 OPM_SymRInt64 (void)
{
int64 _o_result;
int64 k;
Files_ReadNum64(&OPM_oldSF, Files_Rider__typ, &k);
_o_result = k;
return _o_result;
}
void OPM_SymRSet (SET *s) void OPM_SymRSet (SET *s)
{ {
Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (int64*)&*s); Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (int64*)&*s);
@ -751,7 +777,7 @@ void OPM_SymWCh (CHAR ch)
void OPM_SymWInt (int64 i) void OPM_SymWInt (int64 i)
{ {
Files_WriteNum(&OPM_newSF, Files_Rider__typ, i); Files_WriteNum64(&OPM_newSF, Files_Rider__typ, i);
} }
void OPM_SymWSet (SET s) void OPM_SymWSet (SET s)
@ -840,9 +866,9 @@ void OPM_WriteHex (int64 i)
void OPM_WriteInt (int64 i) void OPM_WriteInt (int64 i)
{ {
CHAR s[20]; CHAR s[24];
int64 i1, k; int64 i1, k;
if (i == OPM_SignedMinimum(OPM_IntSize) || i == OPM_SignedMinimum(OPM_LIntSize)) { 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);
@ -852,17 +878,17 @@ void OPM_WriteInt (int64 i)
i1 = __DIV(i1, 10); i1 = __DIV(i1, 10);
k = 1; k = 1;
while (i1 > 0) { while (i1 > 0) {
s[__X(k, 20)] = (CHAR)(__MOD(i1, 10) + 48); s[__X(k, 24)] = (CHAR)(__MOD(i1, 10) + 48);
i1 = __DIV(i1, 10); i1 = __DIV(i1, 10);
k += 1; k += 1;
} }
if (i < 0) { if (i < 0) {
s[__X(k, 20)] = '-'; s[__X(k, 24)] = '-';
k += 1; k += 1;
} }
while (k > 0) { while (k > 0) {
k -= 1; k -= 1;
OPM_Write(s[__X(k, 20)]); OPM_Write(s[__X(k, 24)]);
} }
} }
} }

View file

@ -28,10 +28,12 @@ import void OPM_FPrintSet (int64 *fp, SET set);
import void OPM_Get (CHAR *ch); import void OPM_Get (CHAR *ch);
import void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); import void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len);
import void OPM_InitOptions (void); import void OPM_InitOptions (void);
import int32 OPM_Integer (int64 n);
import void OPM_LogW (CHAR ch); import void OPM_LogW (CHAR ch);
import void OPM_LogWLn (void); import void OPM_LogWLn (void);
import void OPM_LogWNum (int64 i, int64 len); import void OPM_LogWNum (int64 i, int64 len);
import void OPM_LogWStr (CHAR *s, LONGINT s__len); import void OPM_LogWStr (CHAR *s, LONGINT s__len);
import int64 OPM_Longint (int64 n);
import void OPM_Mark (int32 n, int64 pos); import void OPM_Mark (int32 n, int64 pos);
import void OPM_NewSym (CHAR *modName, LONGINT modName__len); import void OPM_NewSym (CHAR *modName, LONGINT modName__len);
import void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done); import void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done);
@ -42,6 +44,7 @@ import int64 OPM_SignedMaximum (int64 bytecount);
import int64 OPM_SignedMinimum (int64 bytecount); import int64 OPM_SignedMinimum (int64 bytecount);
import void OPM_SymRCh (CHAR *ch); import void OPM_SymRCh (CHAR *ch);
import int64 OPM_SymRInt (void); import int64 OPM_SymRInt (void);
import int64 OPM_SymRInt64 (void);
import void OPM_SymRLReal (LONGREAL *lr); import void OPM_SymRLReal (LONGREAL *lr);
import void OPM_SymRReal (REAL *r); import void OPM_SymRReal (REAL *r);
import void OPM_SymRSet (SET *s); import void OPM_SymRSet (SET *s);

View file

@ -151,7 +151,7 @@ static void OPP_CheckSysFlag (int32 *sysflag, int32 default_)
OPP_err(51); OPP_err(51);
sf = 0; sf = 0;
} }
*sysflag = (int32)sf; *sysflag = OPM_Integer(sf);
OPP_CheckSym(23); OPP_CheckSym(23);
} else { } else {
*sysflag = default_; *sysflag = default_;
@ -283,7 +283,7 @@ static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned)
OPP_err(51); OPP_err(51);
n = 1; n = 1;
} }
(*typ)->n = n; (*typ)->n = OPM_Longint(n);
if (OPP_sym == 25) { if (OPP_sym == 25) {
OPS_Get(&OPP_sym); OPS_Get(&OPP_sym);
OPP_Type(&(*typ)->BaseTyp, &*banned); OPP_Type(&(*typ)->BaseTyp, &*banned);
@ -1179,7 +1179,7 @@ static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int32 *n, OPP
OPP_ConstExpression(&x); OPP_ConstExpression(&x);
f = x->typ->form; f = x->typ->form;
if (__IN(f, 0x18, 64)) { if (__IN(f, 0x18, 64)) {
xval = x->conval->intval; xval = OPM_Longint(x->conval->intval);
} else { } else {
OPP_err(61); OPP_err(61);
xval = 1; xval = 1;
@ -1194,7 +1194,7 @@ static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int32 *n, OPP
if (OPP_sym == 21) { if (OPP_sym == 21) {
OPS_Get(&OPP_sym); OPS_Get(&OPP_sym);
OPP_ConstExpression(&y); OPP_ConstExpression(&y);
yval = y->conval->intval; yval = OPM_Longint(y->conval->intval);
if ((y->typ->form != f && !((f == 4 && y->typ->form == 4)))) { if ((y->typ->form != f && !((f == 4 && y->typ->form == 4)))) {
OPP_err(60); OPP_err(60);
} }

View file

@ -1351,7 +1351,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc)
OPV_ExitInfo saved; OPV_ExitInfo saved;
OPT_Node l = NIL, r = NIL; OPT_Node l = NIL, r = NIL;
while ((n != NIL && OPM_noerr)) { while ((n != NIL && OPM_noerr)) {
OPM_errpos = n->conval->intval; OPM_errpos = OPM_Longint(n->conval->intval);
if (n->class != 14) { if (n->class != 14) {
OPC_BegStat(); OPC_BegStat();
} }
@ -1625,7 +1625,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc)
OPV_IfStat(n, n->subcl == 0, outerProc); OPV_IfStat(n, n->subcl == 0, outerProc);
break; break;
case 28: case 28:
OPC_Halt(n->right->conval->intval); OPC_Halt(OPM_Longint(n->right->conval->intval));
break; break;
default: default:
OPM_LogWStr((CHAR*)"unhandled case in OPV.expr, n^.class = ", 40); OPM_LogWStr((CHAR*)"unhandled case in OPV.expr, n^.class = ", 40);

View file

@ -16,7 +16,7 @@ export void Console_Bool (BOOLEAN b);
export void Console_Char (CHAR ch); export void Console_Char (CHAR ch);
export void Console_Flush (void); export void Console_Flush (void);
export void Console_Hex (int32 i); export void Console_Hex (int32 i);
export void Console_Int (int32 i, int32 n); export void Console_Int (int64 i, int64 n);
export void Console_Ln (void); export void Console_Ln (void);
export void Console_Read (CHAR *ch); export void Console_Read (CHAR *ch);
export void Console_ReadLine (CHAR *line, LONGINT line__len); export void Console_ReadLine (CHAR *line, LONGINT line__len);
@ -54,15 +54,15 @@ void Console_String (CHAR *s, LONGINT s__len)
__DEL(s); __DEL(s);
} }
void Console_Int (int32 i, int32 n) void Console_Int (int64 i, int64 n)
{ {
CHAR s[32]; CHAR s[32];
int32 i1, k; int32 i1, k;
if (i == __LSHL(1, 31, 32)) { if (i == (int64)__LSHL(1, 31, 32)) {
__MOVE("8463847412", s, 11); __MOVE("8463847412", s, 11);
k = 10; k = 10;
} else { } else {
i1 = __ABS(i); i1 = __ABS(__VAL(int32, i));
s[0] = (CHAR)((int)__MOD(i1, 10) + 48); s[0] = (CHAR)((int)__MOD(i1, 10) + 48);
i1 = __DIV(i1, 10); i1 = __DIV(i1, 10);
k = 1; k = 1;
@ -76,7 +76,7 @@ void Console_Int (int32 i, int32 n)
s[__X(k, 32)] = '-'; s[__X(k, 32)] = '-';
k += 1; k += 1;
} }
while (n > k) { while (n > (int64)k) {
Console_Char(' '); Console_Char(' ');
n -= 1; n -= 1;
} }

View file

@ -12,7 +12,7 @@ import void Console_Bool (BOOLEAN b);
import void Console_Char (CHAR ch); import void Console_Char (CHAR ch);
import void Console_Flush (void); import void Console_Flush (void);
import void Console_Hex (int32 i); import void Console_Hex (int32 i);
import void Console_Int (int32 i, int32 n); import void Console_Int (int64 i, int64 n);
import void Console_Ln (void); import void Console_Ln (void);
import void Console_Read (CHAR *ch); import void Console_Read (CHAR *ch);
import void Console_ReadLine (CHAR *line, LONGINT line__len); import void Console_ReadLine (CHAR *line, LONGINT line__len);

View file

@ -90,6 +90,7 @@ export void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, int32 *x);
export void Files_ReadLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL *x); export void Files_ReadLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL *x);
export void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); export void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
export void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int32 *x); export void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int32 *x);
export void Files_ReadNum64 (Files_Rider *R, LONGINT *R__typ, int64 *x);
export void Files_ReadReal (Files_Rider *R, LONGINT *R__typ, REAL *x); export void Files_ReadReal (Files_Rider *R, LONGINT *R__typ, REAL *x);
export void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x); export void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x);
export void Files_ReadString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); export void Files_ReadString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
@ -105,6 +106,7 @@ export void Files_WriteInt (Files_Rider *R, LONGINT *R__typ, int16 x);
export void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int32 x); export void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int32 x);
export void Files_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL x); export void Files_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL x);
export void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int32 x); export void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int32 x);
export void Files_WriteNum64 (Files_Rider *R, LONGINT *R__typ, int64 x);
export void Files_WriteReal (Files_Rider *R, LONGINT *R__typ, REAL x); export void Files_WriteReal (Files_Rider *R, LONGINT *R__typ, REAL x);
export void Files_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x); export void Files_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x);
export void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); export void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
@ -936,6 +938,13 @@ void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int32 *x)
*x = n; *x = n;
} }
void Files_ReadNum64 (Files_Rider *R, LONGINT *R__typ, int64 *x)
{
int32 n;
Files_ReadNum(&*R, R__typ, &n);
*x = n;
}
void Files_WriteBool (Files_Rider *R, LONGINT *R__typ, BOOLEAN x) void Files_WriteBool (Files_Rider *R, LONGINT *R__typ, BOOLEAN x)
{ {
Files_Write(&*R, R__typ, __VAL(CHAR, x)); Files_Write(&*R, R__typ, __VAL(CHAR, x));
@ -1004,6 +1013,15 @@ void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int32 x)
Files_Write(&*R, R__typ, (CHAR)__MASK(x, -128)); Files_Write(&*R, R__typ, (CHAR)__MASK(x, -128));
} }
void Files_WriteNum64 (Files_Rider *R, LONGINT *R__typ, int64 x)
{
while (x < -64 || x > 63) {
Files_Write(&*R, R__typ, (CHAR)(__MASK(x, -128) + 128));
x = __ASHR(x, 7);
}
Files_Write(&*R, R__typ, (CHAR)__MASK(x, -128));
}
void Files_GetName (Files_File f, CHAR *name, LONGINT name__len) void Files_GetName (Files_File f, CHAR *name, LONGINT name__len)
{ {
__COPY(f->workName, name, name__len); __COPY(f->workName, name, name__len);

View file

@ -47,6 +47,7 @@ import void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, int32 *x);
import void Files_ReadLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL *x); import void Files_ReadLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL *x);
import void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); import void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
import void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int32 *x); import void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int32 *x);
import void Files_ReadNum64 (Files_Rider *R, LONGINT *R__typ, int64 *x);
import void Files_ReadReal (Files_Rider *R, LONGINT *R__typ, REAL *x); import void Files_ReadReal (Files_Rider *R, LONGINT *R__typ, REAL *x);
import void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x); import void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x);
import void Files_ReadString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); import void Files_ReadString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
@ -61,6 +62,7 @@ import void Files_WriteInt (Files_Rider *R, LONGINT *R__typ, int16 x);
import void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int32 x); import void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int32 x);
import void Files_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL x); import void Files_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL x);
import void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int32 x); import void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int32 x);
import void Files_WriteNum64 (Files_Rider *R, LONGINT *R__typ, int64 x);
import void Files_WriteReal (Files_Rider *R, LONGINT *R__typ, REAL x); import void Files_WriteReal (Files_Rider *R, LONGINT *R__typ, REAL x);
import void Files_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x); import void Files_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x);
import void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); import void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);

View file

@ -12,7 +12,7 @@
export void (*OPB_typSize)(OPT_Struct); export void (*OPB_typSize)(OPT_Struct);
static int16 OPB_exp; static int16 OPB_exp;
static int32 OPB_maxExp; static int64 OPB_maxExp;
export void OPB_Assign (OPT_Node *x, OPT_Node y); export void OPB_Assign (OPT_Node *x, OPT_Node y);
@ -38,14 +38,14 @@ export void OPB_Field (OPT_Node *x, OPT_Object y);
export void OPB_In (OPT_Node *x, OPT_Node y); export void OPB_In (OPT_Node *x, OPT_Node y);
export void OPB_Index (OPT_Node *x, OPT_Node y); export void OPB_Index (OPT_Node *x, OPT_Node y);
export void OPB_Inittd (OPT_Node *inittd, OPT_Node *last, OPT_Struct typ); export void OPB_Inittd (OPT_Node *inittd, OPT_Node *last, OPT_Struct typ);
static BOOLEAN OPB_IntToBool (int32 i); static BOOLEAN OPB_IntToBool (int64 i);
export void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y); export void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y);
export void OPB_MOp (int8 op, OPT_Node *x); export void OPB_MOp (int8 op, OPT_Node *x);
export OPT_Node OPB_NewBoolConst (BOOLEAN boolval); export OPT_Node OPB_NewBoolConst (BOOLEAN boolval);
export OPT_Node OPB_NewIntConst (int32 intval); export OPT_Node OPB_NewIntConst (int64 intval);
export OPT_Node OPB_NewLeaf (OPT_Object obj); export OPT_Node OPB_NewLeaf (OPT_Object obj);
export OPT_Node OPB_NewRealConst (LONGREAL realval, OPT_Struct typ); export OPT_Node OPB_NewRealConst (LONGREAL realval, OPT_Struct typ);
export OPT_Node OPB_NewString (OPS_String str, int32 len); export OPT_Node OPB_NewString (OPS_String str, int64 len);
export OPT_Node OPB_Nil (void); export OPT_Node OPB_Nil (void);
static BOOLEAN OPB_NotVar (OPT_Node x); static BOOLEAN OPB_NotVar (OPT_Node x);
export void OPB_Op (int8 op, OPT_Node *x, OPT_Node y); export void OPB_Op (int8 op, OPT_Node *x, OPT_Node y);
@ -63,7 +63,7 @@ export void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n);
export void OPB_StaticLink (int8 dlev); export void OPB_StaticLink (int8 dlev);
export void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard); export void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard);
static void OPB_err (int16 n); static void OPB_err (int16 n);
static int32 OPB_log (int32 x); static int64 OPB_log (int64 x);
static void OPB_err (int16 n) static void OPB_err (int16 n)
@ -141,17 +141,11 @@ static int32 OPB_BoolToInt (BOOLEAN b)
__RETCHK; __RETCHK;
} }
static BOOLEAN OPB_IntToBool (int32 i) static BOOLEAN OPB_IntToBool (int64 i)
{ {
BOOLEAN _o_result; BOOLEAN _o_result;
if (i == 0) { _o_result = i != 0;
_o_result = 0;
return _o_result; return _o_result;
} else {
_o_result = 1;
return _o_result;
}
__RETCHK;
} }
OPT_Node OPB_NewBoolConst (BOOLEAN boolval) OPT_Node OPB_NewBoolConst (BOOLEAN boolval)
@ -228,7 +222,7 @@ OPT_Node OPB_EmptySet (void)
static void OPB_SetIntType (OPT_Node node) static void OPB_SetIntType (OPT_Node node)
{ {
int16 b; int16 b;
int32 n; int64 n;
if (node->conval->intval >= 0) { if (node->conval->intval >= 0) {
n = node->conval->intval; n = node->conval->intval;
} else { } else {
@ -241,7 +235,7 @@ static void OPB_SetIntType (OPT_Node node)
node->typ = OPT_IntType(b); node->typ = OPT_IntType(b);
} }
OPT_Node OPB_NewIntConst (int32 intval) OPT_Node OPB_NewIntConst (int64 intval)
{ {
OPT_Node _o_result; OPT_Node _o_result;
OPT_Node x = NIL; OPT_Node x = NIL;
@ -266,7 +260,7 @@ OPT_Node OPB_NewRealConst (LONGREAL realval, OPT_Struct typ)
return _o_result; return _o_result;
} }
OPT_Node OPB_NewString (OPS_String str, int32 len) OPT_Node OPB_NewString (OPS_String str, int64 len)
{ {
OPT_Node _o_result; OPT_Node _o_result;
OPT_Node x = NIL; OPT_Node x = NIL;
@ -274,7 +268,7 @@ OPT_Node OPB_NewString (OPS_String str, int32 len)
x->conval = OPT_NewConst(); x->conval = OPT_NewConst();
x->typ = OPT_stringtyp; x->typ = OPT_stringtyp;
x->conval->intval = -1; x->conval->intval = -1;
x->conval->intval2 = len; x->conval->intval2 = OPM_Longint(len);
x->conval->ext = OPT_NewExt(); x->conval->ext = OPT_NewExt();
__COPY(str, *x->conval->ext, 256); __COPY(str, *x->conval->ext, 256);
_o_result = x; _o_result = x;
@ -351,7 +345,7 @@ void OPB_Index (OPT_Node *x, OPT_Node y)
} }
if ((*x)->typ->comp == 2) { if ((*x)->typ->comp == 2) {
typ = (*x)->typ->BaseTyp; typ = (*x)->typ->BaseTyp;
if ((y->class == 7 && (y->conval->intval < 0 || y->conval->intval >= (*x)->typ->n))) { if ((y->class == 7 && (y->conval->intval < 0 || y->conval->intval >= (int64)(*x)->typ->n))) {
OPB_err(81); OPB_err(81);
} }
} else if ((*x)->typ->comp == 3) { } else if ((*x)->typ->comp == 3) {
@ -466,14 +460,14 @@ void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard)
void OPB_In (OPT_Node *x, OPT_Node y) void OPB_In (OPT_Node *x, OPT_Node y)
{ {
int16 f; int16 f;
int32 k; int64 k;
f = (*x)->typ->form; f = (*x)->typ->form;
if ((((*x)->class == 8 || (*x)->class == 9) || y->class == 8) || y->class == 9) { if ((((*x)->class == 8 || (*x)->class == 9) || y->class == 8) || y->class == 9) {
OPB_err(126); OPB_err(126);
} else if ((f == 4 && y->typ->form == 7)) { } else if ((f == 4 && y->typ->form == 7)) {
if ((*x)->class == 7) { if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if (k < 0 || k > OPM_MaxSet) { if (k < 0 || k > (int64)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} else if (y->class == 7) { } else if (y->class == 7) {
(*x)->conval->intval = OPB_BoolToInt(__IN(k, y->conval->setval, 32)); (*x)->conval->intval = OPB_BoolToInt(__IN(k, y->conval->setval, 32));
@ -492,9 +486,9 @@ void OPB_In (OPT_Node *x, OPT_Node y)
(*x)->typ = OPT_booltyp; (*x)->typ = OPT_booltyp;
} }
static int32 OPB_log (int32 x) static int64 OPB_log (int64 x)
{ {
int32 _o_result; int64 _o_result;
OPB_exp = 0; OPB_exp = 0;
if (x > 0) { if (x > 0) {
while (!__ODD(x)) { while (!__ODD(x)) {
@ -580,7 +574,7 @@ void OPB_MOp (int8 op, OPT_Node *x)
if (__IN(f, 0xf0, 32)) { if (__IN(f, 0xf0, 32)) {
if (z->class == 7) { if (z->class == 7) {
if (f == 4) { if (f == 4) {
if (z->conval->intval == (-2147483647-1)) { if (z->conval->intval == (-9223372036854775807-1)) {
OPB_err(203); OPB_err(203);
} else { } else {
z->conval->intval = -z->conval->intval; z->conval->intval = -z->conval->intval;
@ -603,7 +597,7 @@ void OPB_MOp (int8 op, OPT_Node *x)
if (__IN(f, 0x70, 32)) { if (__IN(f, 0x70, 32)) {
if (z->class == 7) { if (z->class == 7) {
if (f == 4) { if (f == 4) {
if (z->conval->intval == (-2147483647-1)) { if (z->conval->intval == (-9223372036854775807-1)) {
OPB_err(203); OPB_err(203);
} else { } else {
z->conval->intval = __ABS(z->conval->intval); z->conval->intval = __ABS(z->conval->intval);
@ -845,7 +839,7 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y)
{ {
int16 f, g; int16 f, g;
OPT_Const xval = NIL, yval = NIL; OPT_Const xval = NIL, yval = NIL;
int32 xv, yv; int64 xv, yv;
BOOLEAN temp; BOOLEAN temp;
struct ConstOp__13 _s; struct ConstOp__13 _s;
_s.x = &x; _s.x = &x;
@ -1007,7 +1001,7 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y)
case 4: case 4:
if (f == 4) { if (f == 4) {
if (yval->intval != 0) { if (yval->intval != 0) {
xval->intval = (int)__MOD(xval->intval, yval->intval); xval->intval = __MOD(xval->intval, yval->intval);
OPB_SetIntType(x); OPB_SetIntType(x);
} else { } else {
OPB_err(205); OPB_err(205);
@ -1122,7 +1116,7 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ)
{ {
OPT_Node node = NIL; OPT_Node node = NIL;
int16 f, g; int16 f, g;
int32 k; int64 k;
LONGREAL r; LONGREAL r;
f = (*x)->typ->form; f = (*x)->typ->form;
g = typ->form; g = typ->form;
@ -1229,7 +1223,7 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y)
OPT_Node t = NIL, z = NIL; OPT_Node t = NIL, z = NIL;
OPT_Struct typ = NIL; OPT_Struct typ = NIL;
BOOLEAN do_; BOOLEAN do_;
int32 val; int64 val;
struct Op__38 _s; struct Op__38 _s;
_s.f = &f; _s.f = &f;
_s.g = &g; _s.g = &g;
@ -1500,19 +1494,19 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y)
void OPB_SetRange (OPT_Node *x, OPT_Node y) void OPB_SetRange (OPT_Node *x, OPT_Node y)
{ {
int32 k, l; int64 k, l;
if ((((*x)->class == 8 || (*x)->class == 9) || y->class == 8) || y->class == 9) { if ((((*x)->class == 8 || (*x)->class == 9) || y->class == 8) || y->class == 9) {
OPB_err(126); OPB_err(126);
} else if (((*x)->typ->form == 4 && y->typ->form == 4)) { } else if (((*x)->typ->form == 4 && y->typ->form == 4)) {
if ((*x)->class == 7) { if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if (0 > k || k > OPM_MaxSet) { if (0 > k || k > (int64)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} }
} }
if (y->class == 7) { if (y->class == 7) {
l = y->conval->intval; l = y->conval->intval;
if (0 > l || l > OPM_MaxSet) { if (0 > l || l > (int64)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} }
} }
@ -1535,14 +1529,14 @@ void OPB_SetRange (OPT_Node *x, OPT_Node y)
void OPB_SetElem (OPT_Node *x) void OPB_SetElem (OPT_Node *x)
{ {
int32 k; int64 k;
if ((*x)->class == 8 || (*x)->class == 9) { if ((*x)->class == 8 || (*x)->class == 9) {
OPB_err(126); OPB_err(126);
} else if ((*x)->typ->form != 4) { } else if ((*x)->typ->form != 4) {
OPB_err(93); OPB_err(93);
} else if ((*x)->class == 7) { } else if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if ((0 <= k && k <= OPM_MaxSet)) { if ((0 <= k && k <= (int64)OPM_MaxSet)) {
(*x)->conval->setval = __SETOF(k,32); (*x)->conval->setval = __SETOF(k,32);
} else { } else {
OPB_err(202); OPB_err(202);
@ -1917,7 +1911,7 @@ void OPB_StPar0 (OPT_Node *par0, int16 fctno)
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if (f == 4) { } else if (f == 4) {
if (x->typ->size != OPT_linttyp->size) { if (x->typ->size < OPT_linttyp->size) {
OPB_Convert(&x, OPT_linttyp); OPB_Convert(&x, OPT_linttyp);
} }
} else { } else {
@ -2055,7 +2049,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if (f == 4) { } else if (f == 4) {
if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > OPM_MaxSet))) { if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (int64)OPM_MaxSet))) {
OPB_err(202); OPB_err(202);
} }
p = NewOp__53(19, fctno, p, x); p = NewOp__53(19, fctno, p, x);
@ -2068,7 +2062,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
if (!(f == 4) || x->class != 7) { if (!(f == 4) || x->class != 7) {
OPB_err(69); OPB_err(69);
} else if (x->typ->size == 1) { } else if (x->typ->size == 1) {
L = (int16)x->conval->intval; L = OPM_Integer(x->conval->intval);
typ = p->typ; typ = p->typ;
while ((L > 0 && __IN(typ->comp, 0x0c, 32))) { while ((L > 0 && __IN(typ->comp, 0x0c, 32))) {
typ = typ->BaseTyp; typ = typ->BaseTyp;
@ -2120,8 +2114,8 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
OPB_err(208); OPB_err(208);
p->conval->intval = 1; p->conval->intval = 1;
} else if (x->conval->intval >= 0) { } else if (x->conval->intval >= 0) {
if (__ABS(p->conval->intval) <= __DIV(2147483647, __ASH(1, x->conval->intval))) { if (__ABS(p->conval->intval) <= __DIV(9223372036854775807, (int64)__ASH(1, x->conval->intval))) {
p->conval->intval = p->conval->intval * __ASH(1, x->conval->intval); p->conval->intval = p->conval->intval * (int64)__ASH(1, x->conval->intval);
} else { } else {
OPB_err(208); OPB_err(208);
p->conval->intval = 1; p->conval->intval = 1;
@ -2132,7 +2126,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
p->obj = NIL; p->obj = NIL;
} else { } else {
p = NewOp__53(12, 17, p, x); p = NewOp__53(12, 17, p, x);
p->typ = OPT_linttyp; p->typ = p->left->typ;
} }
} else { } else {
OPB_err(111); OPB_err(111);
@ -2143,7 +2137,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 > OPM_MaxIndex))) { if ((x->class == 7 && (x->conval->intval <= 0 || x->conval->intval > (int64)OPM_MaxIndex))) {
OPB_err(63); OPB_err(63);
} }
} else { } else {
@ -2281,7 +2275,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 > OPM_MaxIndex))) { if ((x->class == 7 && (x->conval->intval <= 0 || x->conval->intval > (int64)OPM_MaxIndex))) {
OPB_err(63); OPB_err(63);
} }
node = p->right; node = p->right;
@ -2622,7 +2616,7 @@ export void *OPB__init(void)
__MODULE_IMPORT(OPT); __MODULE_IMPORT(OPT);
__REGMOD("OPB", 0); __REGMOD("OPB", 0);
/* BEGIN */ /* BEGIN */
OPB_maxExp = OPB_log(1073741824); OPB_maxExp = OPB_log(4611686018427387904);
OPB_maxExp = OPB_exp; OPB_maxExp = OPB_exp;
__ENDMOD; __ENDMOD;
} }

View file

@ -25,10 +25,10 @@ import void OPB_Inittd (OPT_Node *inittd, OPT_Node *last, OPT_Struct typ);
import void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y); import void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y);
import void OPB_MOp (int8 op, OPT_Node *x); import void OPB_MOp (int8 op, OPT_Node *x);
import OPT_Node OPB_NewBoolConst (BOOLEAN boolval); import OPT_Node OPB_NewBoolConst (BOOLEAN boolval);
import OPT_Node OPB_NewIntConst (int32 intval); import OPT_Node OPB_NewIntConst (int64 intval);
import OPT_Node OPB_NewLeaf (OPT_Object obj); import OPT_Node OPB_NewLeaf (OPT_Object obj);
import OPT_Node OPB_NewRealConst (LONGREAL realval, OPT_Struct typ); import OPT_Node OPB_NewRealConst (LONGREAL realval, OPT_Struct typ);
import OPT_Node OPB_NewString (OPS_String str, int32 len); import OPT_Node OPB_NewString (OPS_String str, int64 len);
import OPT_Node OPB_Nil (void); import OPT_Node OPB_Nil (void);
import void OPB_Op (int8 op, OPT_Node *x, OPT_Node y); import void OPB_Op (int8 op, OPT_Node *x, OPT_Node y);
import void OPB_OptIf (OPT_Node *x); import void OPB_OptIf (OPT_Node *x);

View file

@ -26,8 +26,8 @@ export OPT_Object OPC_BaseTProc (OPT_Object obj);
export void OPC_BegBlk (void); export void OPC_BegBlk (void);
export void OPC_BegStat (void); export void OPC_BegStat (void);
static void OPC_CProcDefs (OPT_Object obj, int16 vis); static void OPC_CProcDefs (OPT_Object obj, int16 vis);
export void OPC_Case (int32 caseVal, int16 form); export void OPC_Case (int64 caseVal, int16 form);
static void OPC_CharacterLiteral (int32 c); static void OPC_CharacterLiteral (int64 c);
export void OPC_Cmp (int16 rel); export void OPC_Cmp (int16 rel);
export void OPC_CompleteIdent (OPT_Object obj); export void OPC_CompleteIdent (OPT_Object obj);
export void OPC_Constant (OPT_Const con, int16 form); export void OPC_Constant (OPT_Const con, int16 form);
@ -67,8 +67,8 @@ static void OPC_InitImports (OPT_Object obj);
static void OPC_InitKeywords (void); static void OPC_InitKeywords (void);
export void OPC_InitTDesc (OPT_Struct typ); export void OPC_InitTDesc (OPT_Struct typ);
static void OPC_InitTProcs (OPT_Object typ, OPT_Object obj); static void OPC_InitTProcs (OPT_Object typ, OPT_Object obj);
export void OPC_IntLiteral (int32 n, int32 size); export void OPC_IntLiteral (int64 n, int32 size);
export void OPC_Len (OPT_Object obj, OPT_Struct array, int32 dim); export void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim);
static void OPC_LenList (OPT_Object par, BOOLEAN ansiDefine, BOOLEAN showParamName); static void OPC_LenList (OPT_Object par, BOOLEAN ansiDefine, BOOLEAN showParamName);
static int16 OPC_Length (CHAR *s, LONGINT s__len); static int16 OPC_Length (CHAR *s, LONGINT s__len);
export int32 OPC_NofPtrs (OPT_Struct typ); export int32 OPC_NofPtrs (OPT_Struct typ);
@ -1851,7 +1851,7 @@ void OPC_Cmp (int16 rel)
} }
} }
static void OPC_CharacterLiteral (int32 c) static void OPC_CharacterLiteral (int64 c)
{ {
if (c < 32 || c > 126) { if (c < 32 || c > 126) {
OPM_WriteString((CHAR*)"0x", 3); OPM_WriteString((CHAR*)"0x", 3);
@ -1894,7 +1894,7 @@ static void OPC_StringLiteral (CHAR *s, LONGINT s__len, int32 l)
__DEL(s); __DEL(s);
} }
void OPC_Case (int32 caseVal, int16 form) void OPC_Case (int64 caseVal, int16 form)
{ {
CHAR ch; CHAR ch;
OPM_WriteString((CHAR*)"case ", 6); OPM_WriteString((CHAR*)"case ", 6);
@ -1937,7 +1937,7 @@ void OPC_Halt (int32 n)
OPC_Str1((CHAR*)"__HALT(#)", 10, n); OPC_Str1((CHAR*)"__HALT(#)", 10, n);
} }
void OPC_IntLiteral (int32 n, int32 size) void OPC_IntLiteral (int64 n, int32 size)
{ {
if ((((size > 4 && n <= 2147483647)) && n > (-2147483647-1))) { if ((((size > 4 && n <= 2147483647)) && n > (-2147483647-1))) {
OPM_WriteString((CHAR*)"((int", 6); OPM_WriteString((CHAR*)"((int", 6);
@ -1950,7 +1950,7 @@ void OPC_IntLiteral (int32 n, int32 size)
} }
} }
void OPC_Len (OPT_Object obj, OPT_Struct array, int32 dim) void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim)
{ {
if (array->comp == 3) { if (array->comp == 3) {
OPC_CompleteIdent(obj); OPC_CompleteIdent(obj);

View file

@ -15,7 +15,7 @@ import int32 OPC_BaseAlignment (OPT_Struct typ);
import OPT_Object OPC_BaseTProc (OPT_Object obj); import OPT_Object OPC_BaseTProc (OPT_Object obj);
import void OPC_BegBlk (void); import void OPC_BegBlk (void);
import void OPC_BegStat (void); import void OPC_BegStat (void);
import void OPC_Case (int32 caseVal, int16 form); import void OPC_Case (int64 caseVal, int16 form);
import void OPC_Cmp (int16 rel); import void OPC_Cmp (int16 rel);
import void OPC_CompleteIdent (OPT_Object obj); import void OPC_CompleteIdent (OPT_Object obj);
import void OPC_Constant (OPT_Const con, int16 form); import void OPC_Constant (OPT_Const con, int16 form);
@ -37,8 +37,8 @@ import void OPC_Increment (BOOLEAN decrement);
import void OPC_Indent (int16 count); import void OPC_Indent (int16 count);
import void OPC_Init (void); import void OPC_Init (void);
import void OPC_InitTDesc (OPT_Struct typ); import void OPC_InitTDesc (OPT_Struct typ);
import void OPC_IntLiteral (int32 n, int32 size); import void OPC_IntLiteral (int64 n, int32 size);
import void OPC_Len (OPT_Object obj, OPT_Struct array, int32 dim); import void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim);
import int32 OPC_NofPtrs (OPT_Struct typ); import int32 OPC_NofPtrs (OPT_Struct typ);
import void OPC_SetInclude (BOOLEAN exclude); import void OPC_SetInclude (BOOLEAN exclude);
import int32 OPC_SizeAlignment (int32 size); import int32 OPC_SizeAlignment (int32 size);

View file

@ -28,7 +28,8 @@ export int16 OPM_currFile, OPM_level, OPM_pc, OPM_entno;
export CHAR OPM_modName[32]; export CHAR OPM_modName[32];
export CHAR OPM_objname[64]; export CHAR OPM_objname[64];
export SET OPM_opt, OPM_glbopt; export SET OPM_opt, OPM_glbopt;
static int32 OPM_ErrorLineStartPos, OPM_ErrorLineLimitPos, OPM_ErrorLineNumber, OPM_lasterrpos; static int32 OPM_ErrorLineStartPos, OPM_ErrorLineLimitPos, OPM_ErrorLineNumber;
static int64 OPM_lasterrpos;
static Texts_Reader OPM_inR; static Texts_Reader OPM_inR;
static Texts_Text OPM_Log; static Texts_Text OPM_Log;
static Texts_Writer OPM_W; static Texts_Writer OPM_W;
@ -45,46 +46,49 @@ static void OPM_Append (Files_Rider *R, LONGINT *R__typ, Files_File F);
export void OPM_CloseFiles (void); export void OPM_CloseFiles (void);
export void OPM_CloseOldSym (void); export void OPM_CloseOldSym (void);
export void OPM_DeleteNewSym (void); export void OPM_DeleteNewSym (void);
export void OPM_FPrint (int32 *fp, int32 val); export void OPM_FPrint (int32 *fp, int64 val);
export void OPM_FPrintLReal (int32 *fp, LONGREAL lr); export void OPM_FPrintLReal (int32 *fp, LONGREAL lr);
export void OPM_FPrintReal (int32 *fp, REAL real); export void OPM_FPrintReal (int32 *fp, REAL real);
export void OPM_FPrintSet (int32 *fp, SET set); export void OPM_FPrintSet (int32 *fp, SET set);
static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, int32 pos); static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, int64 pos);
export void OPM_Get (CHAR *ch); export void OPM_Get (CHAR *ch);
static void OPM_GetProperties (void); static void OPM_GetProperties (void);
static void OPM_GetProperty (Texts_Scanner *S, LONGINT *S__typ, CHAR *name, LONGINT name__len, int16 *size, int16 *align); static void OPM_GetProperty (Texts_Scanner *S, LONGINT *S__typ, CHAR *name, LONGINT name__len, int16 *size, int16 *align);
export void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); export void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len);
export void OPM_InitOptions (void); export void OPM_InitOptions (void);
export int16 OPM_Integer (int64 n);
static void OPM_LogErrMsg (int16 n); static void OPM_LogErrMsg (int16 n);
export void OPM_LogW (CHAR ch); export void OPM_LogW (CHAR ch);
export void OPM_LogWLn (void); export void OPM_LogWLn (void);
export void OPM_LogWNum (int32 i, int32 len); export void OPM_LogWNum (int64 i, int64 len);
export void OPM_LogWStr (CHAR *s, LONGINT s__len); export void OPM_LogWStr (CHAR *s, LONGINT s__len);
export int32 OPM_Longint (int64 n);
static void OPM_MakeFileName (CHAR *name, LONGINT name__len, CHAR *FName, LONGINT FName__len, CHAR *ext, LONGINT ext__len); static void OPM_MakeFileName (CHAR *name, LONGINT name__len, CHAR *FName, LONGINT FName__len, CHAR *ext, LONGINT ext__len);
export void OPM_Mark (int16 n, int32 pos); export void OPM_Mark (int16 n, int64 pos);
export void OPM_NewSym (CHAR *modName, LONGINT modName__len); export void OPM_NewSym (CHAR *modName, LONGINT modName__len);
export void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done); export void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done);
export void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len); export void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len);
export BOOLEAN OPM_OpenPar (void); 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 (int32 pos); static void OPM_ShowLine (int64 pos);
export int32 OPM_SignedMaximum (int32 bytecount); export int32 OPM_SignedMaximum (int32 bytecount);
export int32 OPM_SignedMinimum (int32 bytecount); export int32 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 void OPM_SymRLReal (LONGREAL *lr); export void OPM_SymRLReal (LONGREAL *lr);
export void OPM_SymRReal (REAL *r); export void OPM_SymRReal (REAL *r);
export void OPM_SymRSet (SET *s); export void OPM_SymRSet (SET *s);
export void OPM_SymWCh (CHAR ch); export void OPM_SymWCh (CHAR ch);
export void OPM_SymWInt (int32 i); export void OPM_SymWInt (int64 i);
export void OPM_SymWLReal (LONGREAL lr); export void OPM_SymWLReal (LONGREAL lr);
export void OPM_SymWReal (REAL r); export void OPM_SymWReal (REAL r);
export void OPM_SymWSet (SET s); export void OPM_SymWSet (SET s);
static void OPM_VerboseListSizes (void); static void OPM_VerboseListSizes (void);
export void OPM_Write (CHAR ch); export void OPM_Write (CHAR ch);
export void OPM_WriteHex (int32 i); export void OPM_WriteHex (int64 i);
export void OPM_WriteInt (int32 i); export void OPM_WriteInt (int64 i);
export void OPM_WriteLn (void); export void OPM_WriteLn (void);
export void OPM_WriteReal (LONGREAL r, CHAR suffx); export void OPM_WriteReal (LONGREAL r, CHAR suffx);
export void OPM_WriteString (CHAR *s, LONGINT s__len); export void OPM_WriteString (CHAR *s, LONGINT s__len);
@ -107,7 +111,7 @@ void OPM_LogWStr (CHAR *s, LONGINT s__len)
__DEL(s); __DEL(s);
} }
void OPM_LogWNum (int32 i, int32 len) void OPM_LogWNum (int64 i, int64 len)
{ {
Console_Int(i, len); Console_Int(i, len);
} }
@ -117,6 +121,20 @@ void OPM_LogWLn (void)
Console_Ln(); Console_Ln();
} }
int32 OPM_Longint (int64 n)
{
int32 _o_result;
_o_result = __VAL(int32, n);
return _o_result;
}
int16 OPM_Integer (int64 n)
{
int16 _o_result;
_o_result = __VAL(int16, n);
return _o_result;
}
static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt)
{ {
int16 i; int16 i;
@ -404,21 +422,21 @@ static void OPM_LogErrMsg (int16 n)
OPM_LogWStr(errors_errors[__X(n, 350)], 128); OPM_LogWStr(errors_errors[__X(n, 350)], 128);
} }
static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, int32 pos) static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, int64 pos)
{ {
CHAR ch, cheol; CHAR ch, cheol;
if (pos < OPM_ErrorLineStartPos) { if (pos < (int64)OPM_ErrorLineStartPos) {
OPM_ErrorLineStartPos = 0; OPM_ErrorLineStartPos = 0;
OPM_ErrorLineLimitPos = 0; OPM_ErrorLineLimitPos = 0;
OPM_ErrorLineNumber = 0; OPM_ErrorLineNumber = 0;
} }
if (pos < OPM_ErrorLineLimitPos) { if (pos < (int64)OPM_ErrorLineLimitPos) {
Files_Set(&*r, r__typ, f, OPM_ErrorLineStartPos); Files_Set(&*r, r__typ, f, OPM_ErrorLineStartPos);
return; return;
} }
Files_Set(&*r, r__typ, f, OPM_ErrorLineLimitPos); Files_Set(&*r, r__typ, f, OPM_ErrorLineLimitPos);
Files_Read(&*r, r__typ, (void*)&ch); Files_Read(&*r, r__typ, (void*)&ch);
while ((OPM_ErrorLineLimitPos < pos && !(*r).eof)) { while (((int64)OPM_ErrorLineLimitPos < pos && !(*r).eof)) {
OPM_ErrorLineStartPos = OPM_ErrorLineLimitPos; OPM_ErrorLineStartPos = OPM_ErrorLineLimitPos;
OPM_ErrorLineNumber += 1; OPM_ErrorLineNumber += 1;
while ((((ch != 0x00 && ch != 0x0d)) && ch != 0x0a)) { while ((((ch != 0x00 && ch != 0x0d)) && ch != 0x0a)) {
@ -436,7 +454,7 @@ static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, int32 p
Files_Set(&*r, r__typ, f, OPM_ErrorLineStartPos); Files_Set(&*r, r__typ, f, OPM_ErrorLineStartPos);
} }
static void OPM_ShowLine (int32 pos) static void OPM_ShowLine (int64 pos)
{ {
Files_File f = NIL; Files_File f = NIL;
Files_Rider r; Files_Rider r;
@ -460,10 +478,10 @@ static void OPM_ShowLine (int32 pos)
OPM_LogWStr(line, 1023); OPM_LogWStr(line, 1023);
OPM_LogWLn(); OPM_LogWLn();
OPM_LogWStr((CHAR*)" ", 7); OPM_LogWStr((CHAR*)" ", 7);
if (pos >= OPM_ErrorLineLimitPos) { if (pos >= (int64)OPM_ErrorLineLimitPos) {
pos = OPM_ErrorLineLimitPos - 1; pos = OPM_ErrorLineLimitPos - 1;
} }
i = (int16)(pos - OPM_ErrorLineStartPos); i = (int16)OPM_Longint(pos - (int64)OPM_ErrorLineStartPos);
while (i > 0) { while (i > 0) {
OPM_LogW(' '); OPM_LogW(' ');
i -= 1; i -= 1;
@ -478,7 +496,7 @@ static void OPM_ShowLine (int32 pos)
Files_Close(f); Files_Close(f);
} }
void OPM_Mark (int16 n, int32 pos) void OPM_Mark (int16 n, int64 pos)
{ {
if (pos == -1) { if (pos == -1) {
pos = 0; pos = 0;
@ -535,9 +553,9 @@ void OPM_err (int16 n)
OPM_Mark(n, OPM_errpos); OPM_Mark(n, OPM_errpos);
} }
void OPM_FPrint (int32 *fp, int32 val) void OPM_FPrint (int32 *fp, int64 val)
{ {
*fp = __ROTL((int32)((SET)*fp ^ (SET)val), 1, 32); *fp = __ROTL((int32)((SET)*fp ^ __VAL(SET, val)), 1, 32);
} }
void OPM_FPrintSet (int32 *fp, SET set) void OPM_FPrintSet (int32 *fp, SET set)
@ -702,6 +720,15 @@ int32 OPM_SymRInt (void)
return _o_result; return _o_result;
} }
int64 OPM_SymRInt64 (void)
{
int64 _o_result;
int64 k;
Files_ReadNum64(&OPM_oldSF, Files_Rider__typ, &k);
_o_result = k;
return _o_result;
}
void OPM_SymRSet (SET *s) void OPM_SymRSet (SET *s)
{ {
Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (int32*)&*s); Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (int32*)&*s);
@ -751,9 +778,9 @@ void OPM_SymWCh (CHAR ch)
Files_Write(&OPM_newSF, Files_Rider__typ, ch); Files_Write(&OPM_newSF, Files_Rider__typ, ch);
} }
void OPM_SymWInt (int32 i) void OPM_SymWInt (int64 i)
{ {
Files_WriteNum(&OPM_newSF, Files_Rider__typ, i); Files_WriteNum64(&OPM_newSF, Files_Rider__typ, i);
} }
void OPM_SymWSet (SET s) void OPM_SymWSet (SET s)
@ -820,17 +847,17 @@ void OPM_WriteStringVar (CHAR *s, LONGINT s__len)
Files_WriteBytes(&OPM_R[__X(OPM_currFile, 3)], Files_Rider__typ, (void*)s, s__len * 1, i); Files_WriteBytes(&OPM_R[__X(OPM_currFile, 3)], Files_Rider__typ, (void*)s, s__len * 1, i);
} }
void OPM_WriteHex (int32 i) void OPM_WriteHex (int64 i)
{ {
CHAR s[3]; CHAR s[3];
int16 digit; int32 digit;
digit = __ASHR((int16)i, 4); digit = __ASHR((int32)i, 4);
if (digit < 10) { if (digit < 10) {
s[0] = (CHAR)(48 + digit); s[0] = (CHAR)(48 + digit);
} else { } else {
s[0] = (CHAR)(87 + digit); s[0] = (CHAR)(87 + digit);
} }
digit = __MASK((int16)i, -16); digit = __MASK((int32)i, -16);
if (digit < 10) { if (digit < 10) {
s[1] = (CHAR)(48 + digit); s[1] = (CHAR)(48 + digit);
} else { } else {
@ -840,31 +867,31 @@ void OPM_WriteHex (int32 i)
OPM_WriteString(s, 3); OPM_WriteString(s, 3);
} }
void OPM_WriteInt (int32 i) void OPM_WriteInt (int64 i)
{ {
CHAR s[20]; CHAR s[24];
int32 i1, k; int64 i1, k;
if (i == OPM_SignedMinimum(OPM_IntSize) || i == OPM_SignedMinimum(OPM_LIntSize)) { if ((i == (int64)OPM_SignedMinimum(OPM_IntSize) || i == (int64)OPM_SignedMinimum(OPM_LIntSize)) || i == (int64)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);
} else { } else {
i1 = __ABS(i); i1 = __ABS(i);
s[0] = (CHAR)((int)__MOD(i1, 10) + 48); s[0] = (CHAR)(__MOD(i1, 10) + 48);
i1 = __DIV(i1, 10); i1 = __DIV(i1, 10);
k = 1; k = 1;
while (i1 > 0) { while (i1 > 0) {
s[__X(k, 20)] = (CHAR)((int)__MOD(i1, 10) + 48); s[__X(k, 24)] = (CHAR)(__MOD(i1, 10) + 48);
i1 = __DIV(i1, 10); i1 = __DIV(i1, 10);
k += 1; k += 1;
} }
if (i < 0) { if (i < 0) {
s[__X(k, 20)] = '-'; s[__X(k, 24)] = '-';
k += 1; k += 1;
} }
while (k > 0) { while (k > 0) {
k -= 1; k -= 1;
OPM_Write(s[__X(k, 20)]); OPM_Write(s[__X(k, 24)]);
} }
} }
} }

View file

@ -21,18 +21,20 @@ import BOOLEAN OPM_dontAsm, OPM_dontLink, OPM_mainProg, OPM_mainLinkStat, OPM_no
import void OPM_CloseFiles (void); import void OPM_CloseFiles (void);
import void OPM_CloseOldSym (void); import void OPM_CloseOldSym (void);
import void OPM_DeleteNewSym (void); import void OPM_DeleteNewSym (void);
import void OPM_FPrint (int32 *fp, int32 val); import void OPM_FPrint (int32 *fp, int64 val);
import void OPM_FPrintLReal (int32 *fp, LONGREAL lr); import void OPM_FPrintLReal (int32 *fp, LONGREAL lr);
import void OPM_FPrintReal (int32 *fp, REAL real); import void OPM_FPrintReal (int32 *fp, REAL real);
import void OPM_FPrintSet (int32 *fp, SET set); import void OPM_FPrintSet (int32 *fp, SET set);
import void OPM_Get (CHAR *ch); import void OPM_Get (CHAR *ch);
import void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); import void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len);
import void OPM_InitOptions (void); import void OPM_InitOptions (void);
import int16 OPM_Integer (int64 n);
import void OPM_LogW (CHAR ch); import void OPM_LogW (CHAR ch);
import void OPM_LogWLn (void); import void OPM_LogWLn (void);
import void OPM_LogWNum (int32 i, int32 len); import void OPM_LogWNum (int64 i, int64 len);
import void OPM_LogWStr (CHAR *s, LONGINT s__len); import void OPM_LogWStr (CHAR *s, LONGINT s__len);
import void OPM_Mark (int16 n, int32 pos); import int32 OPM_Longint (int64 n);
import void OPM_Mark (int16 n, int64 pos);
import void OPM_NewSym (CHAR *modName, LONGINT modName__len); import void OPM_NewSym (CHAR *modName, LONGINT modName__len);
import void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done); 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);
@ -42,17 +44,18 @@ import int32 OPM_SignedMaximum (int32 bytecount);
import int32 OPM_SignedMinimum (int32 bytecount); import int32 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 void OPM_SymRLReal (LONGREAL *lr); import void OPM_SymRLReal (LONGREAL *lr);
import void OPM_SymRReal (REAL *r); import void OPM_SymRReal (REAL *r);
import void OPM_SymRSet (SET *s); import void OPM_SymRSet (SET *s);
import void OPM_SymWCh (CHAR ch); import void OPM_SymWCh (CHAR ch);
import void OPM_SymWInt (int32 i); import void OPM_SymWInt (int64 i);
import void OPM_SymWLReal (LONGREAL lr); import void OPM_SymWLReal (LONGREAL lr);
import void OPM_SymWReal (REAL r); import void OPM_SymWReal (REAL r);
import void OPM_SymWSet (SET s); import void OPM_SymWSet (SET s);
import void OPM_Write (CHAR ch); import void OPM_Write (CHAR ch);
import void OPM_WriteHex (int32 i); import void OPM_WriteHex (int64 i);
import void OPM_WriteInt (int32 i); import void OPM_WriteInt (int64 i);
import void OPM_WriteLn (void); import void OPM_WriteLn (void);
import void OPM_WriteReal (LONGREAL r, CHAR suffx); import void OPM_WriteReal (LONGREAL r, CHAR suffx);
import void OPM_WriteString (CHAR *s, LONGINT s__len); import void OPM_WriteString (CHAR *s, LONGINT s__len);

View file

@ -134,7 +134,7 @@ static void OPP_CheckMark (int8 *vis)
static void OPP_CheckSysFlag (int16 *sysflag, int16 default_) static void OPP_CheckSysFlag (int16 *sysflag, int16 default_)
{ {
OPT_Node x = NIL; OPT_Node x = NIL;
int32 sf; int64 sf;
if (OPP_sym == 31) { if (OPP_sym == 31) {
OPS_Get(&OPP_sym); OPS_Get(&OPP_sym);
if (!OPT_SYSimported) { if (!OPT_SYSimported) {
@ -151,7 +151,7 @@ static void OPP_CheckSysFlag (int16 *sysflag, int16 default_)
OPP_err(51); OPP_err(51);
sf = 0; sf = 0;
} }
*sysflag = (int16)sf; *sysflag = OPM_Integer(sf);
OPP_CheckSym(23); OPP_CheckSym(23);
} else { } else {
*sysflag = default_; *sysflag = default_;
@ -254,7 +254,7 @@ static void OPP_RecordType (OPT_Struct *typ, OPT_Struct *banned)
static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned) static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned)
{ {
OPT_Node x = NIL; OPT_Node x = NIL;
int32 n; int64 n;
int16 sysflag; int16 sysflag;
OPP_CheckSysFlag(&sysflag, 0); OPP_CheckSysFlag(&sysflag, 0);
if (OPP_sym == 25) { if (OPP_sym == 25) {
@ -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 > OPM_MaxIndex) { if (n <= 0 || n > (int64)OPM_MaxIndex) {
OPP_err(63); OPP_err(63);
n = 1; n = 1;
} }
@ -283,7 +283,7 @@ static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned)
OPP_err(51); OPP_err(51);
n = 1; n = 1;
} }
(*typ)->n = n; (*typ)->n = OPM_Longint(n);
if (OPP_sym == 25) { if (OPP_sym == 25) {
OPS_Get(&OPP_sym); OPS_Get(&OPP_sym);
OPP_Type(&(*typ)->BaseTyp, &*banned); OPP_Type(&(*typ)->BaseTyp, &*banned);
@ -932,7 +932,7 @@ static void GetCode__19 (void)
{ {
OPT_ConstExt ext = NIL; OPT_ConstExt ext = NIL;
int16 n; int16 n;
int32 c; int64 c;
ext = OPT_NewExt(); ext = OPT_NewExt();
(*ProcedureDeclaration__16_s->proc)->conval->ext = ext; (*ProcedureDeclaration__16_s->proc)->conval->ext = ext;
n = 0; n = 0;
@ -1179,7 +1179,7 @@ static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int16 *n, OPP
OPP_ConstExpression(&x); OPP_ConstExpression(&x);
f = x->typ->form; f = x->typ->form;
if (__IN(f, 0x18, 32)) { if (__IN(f, 0x18, 32)) {
xval = x->conval->intval; xval = OPM_Longint(x->conval->intval);
} else { } else {
OPP_err(61); OPP_err(61);
xval = 1; xval = 1;
@ -1194,7 +1194,7 @@ static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int16 *n, OPP
if (OPP_sym == 21) { if (OPP_sym == 21) {
OPS_Get(&OPP_sym); OPS_Get(&OPP_sym);
OPP_ConstExpression(&y); OPP_ConstExpression(&y);
yval = y->conval->intval; yval = OPM_Longint(y->conval->intval);
if (((int16)y->typ->form != f && !((f == 4 && y->typ->form == 4)))) { if (((int16)y->typ->form != f && !((f == 4 && y->typ->form == 4)))) {
OPP_err(60); OPP_err(60);
} }

View file

@ -17,7 +17,7 @@ typedef
export OPS_Name OPS_name; export OPS_Name OPS_name;
export OPS_String OPS_str; export OPS_String OPS_str;
export int16 OPS_numtyp; export int16 OPS_numtyp;
export int32 OPS_intval; export int64 OPS_intval;
export REAL OPS_realval; export REAL OPS_realval;
export LONGREAL OPS_lrlval; export LONGREAL OPS_lrlval;
static CHAR OPS_ch; static CHAR OPS_ch;
@ -178,7 +178,7 @@ static void OPS_Number (void)
OPS_numtyp = 1; OPS_numtyp = 1;
if (n <= 2) { if (n <= 2) {
while (i < n) { while (i < n) {
OPS_intval = __ASHL(OPS_intval, 4) + Ord__7(dig[i], 1); OPS_intval = __ASHL(OPS_intval, 4) + (int64)Ord__7(dig[i], 1);
i += 1; i += 1;
} }
} else { } else {
@ -192,7 +192,7 @@ static void OPS_Number (void)
OPS_intval = -1; OPS_intval = -1;
} }
while (i < n) { while (i < n) {
OPS_intval = __ASHL(OPS_intval, 4) + Ord__7(dig[i], 1); OPS_intval = __ASHL(OPS_intval, 4) + (int64)Ord__7(dig[i], 1);
i += 1; i += 1;
} }
} else { } else {
@ -203,8 +203,8 @@ static void OPS_Number (void)
while (i < n) { while (i < n) {
d = Ord__7(dig[i], 0); d = Ord__7(dig[i], 0);
i += 1; i += 1;
if ((int64)OPS_intval <= __DIV(9223372036854775807 - (int64)d, 10)) { if (OPS_intval <= __DIV(9223372036854775807 - (int64)d, 10)) {
OPS_intval = OPS_intval * 10 + d; OPS_intval = OPS_intval * 10 + (int64)d;
} else { } else {
OPS_err(203); OPS_err(203);
} }

View file

@ -15,7 +15,7 @@ typedef
import OPS_Name OPS_name; import OPS_Name OPS_name;
import OPS_String OPS_str; import OPS_String OPS_str;
import int16 OPS_numtyp; import int16 OPS_numtyp;
import int32 OPS_intval; import int64 OPS_intval;
import REAL OPS_realval; import REAL OPS_realval;
import LONGREAL OPS_lrlval; import LONGREAL OPS_lrlval;

View file

@ -17,7 +17,8 @@ typedef
typedef typedef
struct OPT_ConstDesc { struct OPT_ConstDesc {
OPT_ConstExt ext; OPT_ConstExt ext;
int32 intval, intval2; int64 intval;
int32 intval2;
SET setval; SET setval;
LONGREAL realval; LONGREAL realval;
} OPT_ConstDesc; } OPT_ConstDesc;
@ -1838,7 +1839,7 @@ static void EnumPtrs(void (*P)(void*))
__ENUMR(&OPT_impCtxt, OPT_ImpCtxt__typ, 3140, 1, P); __ENUMR(&OPT_impCtxt, OPT_ImpCtxt__typ, 3140, 1, P);
} }
__TDESC(OPT_ConstDesc, 1, 1) = {__TDFLDS("ConstDesc", 24), {0, -8}}; __TDESC(OPT_ConstDesc, 1, 1) = {__TDFLDS("ConstDesc", 32), {0, -8}};
__TDESC(OPT_ObjDesc, 1, 6) = {__TDFLDS("ObjDesc", 304), {0, 4, 8, 12, 284, 288, -28}}; __TDESC(OPT_ObjDesc, 1, 6) = {__TDFLDS("ObjDesc", 304), {0, 4, 8, 12, 284, 288, -28}};
__TDESC(OPT_StrDesc, 1, 3) = {__TDFLDS("StrDesc", 56), {44, 48, 52, -16}}; __TDESC(OPT_StrDesc, 1, 3) = {__TDFLDS("StrDesc", 56), {44, 48, 52, -16}};
__TDESC(OPT_NodeDesc, 1, 6) = {__TDFLDS("NodeDesc", 28), {0, 4, 8, 16, 20, 24, -28}}; __TDESC(OPT_NodeDesc, 1, 6) = {__TDFLDS("NodeDesc", 28), {0, 4, 8, 16, 20, 24, -28}};

View file

@ -15,7 +15,8 @@ typedef
typedef typedef
struct OPT_ConstDesc { struct OPT_ConstDesc {
OPT_ConstExt ext; OPT_ConstExt ext;
int32 intval, intval2; int64 intval;
int32 intval2;
SET setval; SET setval;
LONGREAL realval; LONGREAL realval;
} OPT_ConstDesc; } OPT_ConstDesc;

View file

@ -36,10 +36,10 @@ static BOOLEAN OPV_ImplicitReturn (OPT_Node n);
static void OPV_Index (OPT_Node n, OPT_Node d, int16 prec, int16 dim); static void OPV_Index (OPT_Node n, OPT_Node d, int16 prec, int16 dim);
export void OPV_Init (void); export void OPV_Init (void);
static void OPV_InitTDescs (OPT_Node n); static void OPV_InitTDescs (OPT_Node n);
static void OPV_Len (OPT_Node n, int32 dim); static void OPV_Len (OPT_Node n, int64 dim);
export void OPV_Module (OPT_Node prog); export void OPV_Module (OPT_Node prog);
static void OPV_NewArr (OPT_Node d, OPT_Node x); static void OPV_NewArr (OPT_Node d, OPT_Node x);
static void OPV_ParIntLiteral (int32 n, int32 size); static void OPV_ParIntLiteral (int64 n, int32 size);
static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp); static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp);
static BOOLEAN OPV_SideEffects (OPT_Node n); static BOOLEAN OPV_SideEffects (OPT_Node n);
static void OPV_SizeCast (int32 from, int32 to); static void OPV_SizeCast (int32 from, int32 to);
@ -414,7 +414,7 @@ static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp
__RETCHK; __RETCHK;
} }
static void OPV_Len (OPT_Node n, int32 dim) static void OPV_Len (OPT_Node n, int64 dim)
{ {
while ((n->class == 4 && n->typ->comp == 3)) { while ((n->class == 4 && n->typ->comp == 3)) {
dim += 1; dim += 1;
@ -725,7 +725,7 @@ static void OPV_design (OPT_Node n, int16 prec)
} }
} }
static void OPV_ParIntLiteral (int32 n, int32 size) static void OPV_ParIntLiteral (int64 n, int32 size)
{ {
if (OPV_ansi) { if (OPV_ansi) {
OPM_WriteInt(n); OPM_WriteInt(n);
@ -1210,7 +1210,7 @@ static void OPV_IfStat (OPT_Node n, BOOLEAN withtrap, OPT_Object outerProc)
static void OPV_CaseStat (OPT_Node n, OPT_Object outerProc) static void OPV_CaseStat (OPT_Node n, OPT_Object outerProc)
{ {
OPT_Node switchCase = NIL, label = NIL; OPT_Node switchCase = NIL, label = NIL;
int32 low, high; int64 low, high;
int16 form, i; int16 form, i;
OPM_WriteString((CHAR*)"switch ", 8); OPM_WriteString((CHAR*)"switch ", 8);
OPV_expr(n->left, 12); OPV_expr(n->left, 12);
@ -1351,7 +1351,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc)
OPV_ExitInfo saved; OPV_ExitInfo saved;
OPT_Node l = NIL, r = NIL; OPT_Node l = NIL, r = NIL;
while ((n != NIL && OPM_noerr)) { while ((n != NIL && OPM_noerr)) {
OPM_errpos = n->conval->intval; OPM_errpos = OPM_Longint(n->conval->intval);
if (n->class != 14) { if (n->class != 14) {
OPC_BegStat(); OPC_BegStat();
} }
@ -1625,7 +1625,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc)
OPV_IfStat(n, n->subcl == 0, outerProc); OPV_IfStat(n, n->subcl == 0, outerProc);
break; break;
case 28: case 28:
OPC_Halt(n->right->conval->intval); OPC_Halt(OPM_Longint(n->right->conval->intval));
break; break;
default: default:
OPM_LogWStr((CHAR*)"unhandled case in OPV.expr, n^.class = ", 40); OPM_LogWStr((CHAR*)"unhandled case in OPV.expr, n^.class = ", 40);

View file

@ -62,7 +62,7 @@ void Console_Int (int64 i, int64 n)
__MOVE("8085774586302733229", s, 20); __MOVE("8085774586302733229", s, 20);
k = 19; k = 19;
} else { } else {
i1 = __ABS(i); i1 = __ABS((int64)i);
s[0] = (CHAR)(__MOD(i1, 10) + 48); s[0] = (CHAR)(__MOD(i1, 10) + 48);
i1 = __DIV(i1, 10); i1 = __DIV(i1, 10);
k = 1; k = 1;

View file

@ -90,6 +90,7 @@ export void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, int64 *x);
export void Files_ReadLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL *x); export void Files_ReadLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL *x);
export void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); export void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
export void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int64 *x); export void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int64 *x);
export void Files_ReadNum64 (Files_Rider *R, LONGINT *R__typ, int64 *x);
export void Files_ReadReal (Files_Rider *R, LONGINT *R__typ, REAL *x); export void Files_ReadReal (Files_Rider *R, LONGINT *R__typ, REAL *x);
export void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x); export void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x);
export void Files_ReadString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); export void Files_ReadString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
@ -105,6 +106,7 @@ export void Files_WriteInt (Files_Rider *R, LONGINT *R__typ, int32 x);
export void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int64 x); export void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int64 x);
export void Files_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL x); export void Files_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL x);
export void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int64 x); export void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int64 x);
export void Files_WriteNum64 (Files_Rider *R, LONGINT *R__typ, int64 x);
export void Files_WriteReal (Files_Rider *R, LONGINT *R__typ, REAL x); export void Files_WriteReal (Files_Rider *R, LONGINT *R__typ, REAL x);
export void Files_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x); export void Files_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x);
export void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); export void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
@ -936,6 +938,13 @@ void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int64 *x)
*x = n; *x = n;
} }
void Files_ReadNum64 (Files_Rider *R, LONGINT *R__typ, int64 *x)
{
int64 n;
Files_ReadNum(&*R, R__typ, &n);
*x = n;
}
void Files_WriteBool (Files_Rider *R, LONGINT *R__typ, BOOLEAN x) void Files_WriteBool (Files_Rider *R, LONGINT *R__typ, BOOLEAN x)
{ {
Files_Write(&*R, R__typ, __VAL(CHAR, x)); Files_Write(&*R, R__typ, __VAL(CHAR, x));
@ -1004,6 +1013,15 @@ void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int64 x)
Files_Write(&*R, R__typ, (CHAR)__MASK(x, -128)); Files_Write(&*R, R__typ, (CHAR)__MASK(x, -128));
} }
void Files_WriteNum64 (Files_Rider *R, LONGINT *R__typ, int64 x)
{
while (x < -64 || x > 63) {
Files_Write(&*R, R__typ, (CHAR)(__MASK(x, -128) + 128));
x = __ASHR(x, 7);
}
Files_Write(&*R, R__typ, (CHAR)__MASK(x, -128));
}
void Files_GetName (Files_File f, CHAR *name, LONGINT name__len) void Files_GetName (Files_File f, CHAR *name, LONGINT name__len)
{ {
__COPY(f->workName, name, name__len); __COPY(f->workName, name, name__len);

View file

@ -47,6 +47,7 @@ import void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, int64 *x);
import void Files_ReadLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL *x); import void Files_ReadLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL *x);
import void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); import void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
import void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int64 *x); import void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int64 *x);
import void Files_ReadNum64 (Files_Rider *R, LONGINT *R__typ, int64 *x);
import void Files_ReadReal (Files_Rider *R, LONGINT *R__typ, REAL *x); import void Files_ReadReal (Files_Rider *R, LONGINT *R__typ, REAL *x);
import void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x); import void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x);
import void Files_ReadString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); import void Files_ReadString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
@ -61,6 +62,7 @@ import void Files_WriteInt (Files_Rider *R, LONGINT *R__typ, int32 x);
import void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int64 x); import void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int64 x);
import void Files_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL x); import void Files_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL x);
import void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int64 x); import void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int64 x);
import void Files_WriteNum64 (Files_Rider *R, LONGINT *R__typ, int64 x);
import void Files_WriteReal (Files_Rider *R, LONGINT *R__typ, REAL x); import void Files_WriteReal (Files_Rider *R, LONGINT *R__typ, REAL x);
import void Files_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x); import void Files_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x);
import void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len); import void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);

View file

@ -144,14 +144,8 @@ static int64 OPB_BoolToInt (BOOLEAN b)
static BOOLEAN OPB_IntToBool (int64 i) static BOOLEAN OPB_IntToBool (int64 i)
{ {
BOOLEAN _o_result; BOOLEAN _o_result;
if (i == 0) { _o_result = i != 0;
_o_result = 0;
return _o_result; return _o_result;
} else {
_o_result = 1;
return _o_result;
}
__RETCHK;
} }
OPT_Node OPB_NewBoolConst (BOOLEAN boolval) OPT_Node OPB_NewBoolConst (BOOLEAN boolval)
@ -274,7 +268,7 @@ OPT_Node OPB_NewString (OPS_String str, int64 len)
x->conval = OPT_NewConst(); x->conval = OPT_NewConst();
x->typ = OPT_stringtyp; x->typ = OPT_stringtyp;
x->conval->intval = -1; x->conval->intval = -1;
x->conval->intval2 = len; x->conval->intval2 = OPM_Longint(len);
x->conval->ext = OPT_NewExt(); x->conval->ext = OPT_NewExt();
__COPY(str, *x->conval->ext, 256); __COPY(str, *x->conval->ext, 256);
_o_result = x; _o_result = x;
@ -1917,7 +1911,7 @@ void OPB_StPar0 (OPT_Node *par0, int32 fctno)
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if (f == 4) { } else if (f == 4) {
if (x->typ->size != OPT_linttyp->size) { if (x->typ->size < OPT_linttyp->size) {
OPB_Convert(&x, OPT_linttyp); OPB_Convert(&x, OPT_linttyp);
} }
} else { } else {
@ -2068,7 +2062,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
if (!(f == 4) || x->class != 7) { if (!(f == 4) || x->class != 7) {
OPB_err(69); OPB_err(69);
} else if (x->typ->size == 1) { } else if (x->typ->size == 1) {
L = (int32)x->conval->intval; L = OPM_Integer(x->conval->intval);
typ = p->typ; typ = p->typ;
while ((L > 0 && __IN(typ->comp, 0x0c, 64))) { while ((L > 0 && __IN(typ->comp, 0x0c, 64))) {
typ = typ->BaseTyp; typ = typ->BaseTyp;
@ -2132,7 +2126,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
p->obj = NIL; p->obj = NIL;
} else { } else {
p = NewOp__53(12, 17, p, x); p = NewOp__53(12, 17, p, x);
p->typ = OPT_linttyp; p->typ = p->left->typ;
} }
} else { } else {
OPB_err(111); OPB_err(111);

View file

@ -55,11 +55,13 @@ static void OPM_GetProperties (void);
static void OPM_GetProperty (Texts_Scanner *S, LONGINT *S__typ, CHAR *name, LONGINT name__len, int32 *size, int32 *align); static void OPM_GetProperty (Texts_Scanner *S, LONGINT *S__typ, CHAR *name, LONGINT name__len, int32 *size, int32 *align);
export void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); export void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len);
export void OPM_InitOptions (void); export void OPM_InitOptions (void);
export int32 OPM_Integer (int64 n);
static void OPM_LogErrMsg (int32 n); static void OPM_LogErrMsg (int32 n);
export void OPM_LogW (CHAR ch); export void OPM_LogW (CHAR ch);
export void OPM_LogWLn (void); export void OPM_LogWLn (void);
export void OPM_LogWNum (int64 i, int64 len); export void OPM_LogWNum (int64 i, int64 len);
export void OPM_LogWStr (CHAR *s, LONGINT s__len); export void OPM_LogWStr (CHAR *s, LONGINT s__len);
export int64 OPM_Longint (int64 n);
static void OPM_MakeFileName (CHAR *name, LONGINT name__len, CHAR *FName, LONGINT FName__len, CHAR *ext, LONGINT ext__len); static void OPM_MakeFileName (CHAR *name, LONGINT name__len, CHAR *FName, LONGINT FName__len, CHAR *ext, LONGINT ext__len);
export void OPM_Mark (int32 n, int64 pos); export void OPM_Mark (int32 n, int64 pos);
export void OPM_NewSym (CHAR *modName, LONGINT modName__len); export void OPM_NewSym (CHAR *modName, LONGINT modName__len);
@ -73,6 +75,7 @@ export int64 OPM_SignedMaximum (int64 bytecount);
export int64 OPM_SignedMinimum (int64 bytecount); export int64 OPM_SignedMinimum (int64 bytecount);
export void OPM_SymRCh (CHAR *ch); export void OPM_SymRCh (CHAR *ch);
export int64 OPM_SymRInt (void); export int64 OPM_SymRInt (void);
export int64 OPM_SymRInt64 (void);
export void OPM_SymRLReal (LONGREAL *lr); export void OPM_SymRLReal (LONGREAL *lr);
export void OPM_SymRReal (REAL *r); export void OPM_SymRReal (REAL *r);
export void OPM_SymRSet (SET *s); export void OPM_SymRSet (SET *s);
@ -117,6 +120,20 @@ void OPM_LogWLn (void)
Console_Ln(); Console_Ln();
} }
int64 OPM_Longint (int64 n)
{
int64 _o_result;
_o_result = (int64)n;
return _o_result;
}
int32 OPM_Integer (int64 n)
{
int32 _o_result;
_o_result = __VAL(int32, n);
return _o_result;
}
static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt)
{ {
int32 i; int32 i;
@ -463,7 +480,7 @@ static void OPM_ShowLine (int64 pos)
if (pos >= OPM_ErrorLineLimitPos) { if (pos >= OPM_ErrorLineLimitPos) {
pos = OPM_ErrorLineLimitPos - 1; pos = OPM_ErrorLineLimitPos - 1;
} }
i = (int32)(pos - OPM_ErrorLineStartPos); i = (int32)OPM_Longint(pos - OPM_ErrorLineStartPos);
while (i > 0) { while (i > 0) {
OPM_LogW(' '); OPM_LogW(' ');
i -= 1; i -= 1;
@ -700,6 +717,15 @@ int64 OPM_SymRInt (void)
return _o_result; return _o_result;
} }
int64 OPM_SymRInt64 (void)
{
int64 _o_result;
int64 k;
Files_ReadNum64(&OPM_oldSF, Files_Rider__typ, &k);
_o_result = k;
return _o_result;
}
void OPM_SymRSet (SET *s) void OPM_SymRSet (SET *s)
{ {
Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (int64*)&*s); Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (int64*)&*s);
@ -751,7 +777,7 @@ void OPM_SymWCh (CHAR ch)
void OPM_SymWInt (int64 i) void OPM_SymWInt (int64 i)
{ {
Files_WriteNum(&OPM_newSF, Files_Rider__typ, i); Files_WriteNum64(&OPM_newSF, Files_Rider__typ, i);
} }
void OPM_SymWSet (SET s) void OPM_SymWSet (SET s)
@ -840,9 +866,9 @@ void OPM_WriteHex (int64 i)
void OPM_WriteInt (int64 i) void OPM_WriteInt (int64 i)
{ {
CHAR s[20]; CHAR s[24];
int64 i1, k; int64 i1, k;
if (i == OPM_SignedMinimum(OPM_IntSize) || i == OPM_SignedMinimum(OPM_LIntSize)) { 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);
@ -852,17 +878,17 @@ void OPM_WriteInt (int64 i)
i1 = __DIV(i1, 10); i1 = __DIV(i1, 10);
k = 1; k = 1;
while (i1 > 0) { while (i1 > 0) {
s[__X(k, 20)] = (CHAR)(__MOD(i1, 10) + 48); s[__X(k, 24)] = (CHAR)(__MOD(i1, 10) + 48);
i1 = __DIV(i1, 10); i1 = __DIV(i1, 10);
k += 1; k += 1;
} }
if (i < 0) { if (i < 0) {
s[__X(k, 20)] = '-'; s[__X(k, 24)] = '-';
k += 1; k += 1;
} }
while (k > 0) { while (k > 0) {
k -= 1; k -= 1;
OPM_Write(s[__X(k, 20)]); OPM_Write(s[__X(k, 24)]);
} }
} }
} }

View file

@ -28,10 +28,12 @@ import void OPM_FPrintSet (int64 *fp, SET set);
import void OPM_Get (CHAR *ch); import void OPM_Get (CHAR *ch);
import void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); import void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len);
import void OPM_InitOptions (void); import void OPM_InitOptions (void);
import int32 OPM_Integer (int64 n);
import void OPM_LogW (CHAR ch); import void OPM_LogW (CHAR ch);
import void OPM_LogWLn (void); import void OPM_LogWLn (void);
import void OPM_LogWNum (int64 i, int64 len); import void OPM_LogWNum (int64 i, int64 len);
import void OPM_LogWStr (CHAR *s, LONGINT s__len); import void OPM_LogWStr (CHAR *s, LONGINT s__len);
import int64 OPM_Longint (int64 n);
import void OPM_Mark (int32 n, int64 pos); import void OPM_Mark (int32 n, int64 pos);
import void OPM_NewSym (CHAR *modName, LONGINT modName__len); import void OPM_NewSym (CHAR *modName, LONGINT modName__len);
import void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done); import void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done);
@ -42,6 +44,7 @@ import int64 OPM_SignedMaximum (int64 bytecount);
import int64 OPM_SignedMinimum (int64 bytecount); import int64 OPM_SignedMinimum (int64 bytecount);
import void OPM_SymRCh (CHAR *ch); import void OPM_SymRCh (CHAR *ch);
import int64 OPM_SymRInt (void); import int64 OPM_SymRInt (void);
import int64 OPM_SymRInt64 (void);
import void OPM_SymRLReal (LONGREAL *lr); import void OPM_SymRLReal (LONGREAL *lr);
import void OPM_SymRReal (REAL *r); import void OPM_SymRReal (REAL *r);
import void OPM_SymRSet (SET *s); import void OPM_SymRSet (SET *s);

View file

@ -151,7 +151,7 @@ static void OPP_CheckSysFlag (int32 *sysflag, int32 default_)
OPP_err(51); OPP_err(51);
sf = 0; sf = 0;
} }
*sysflag = (int32)sf; *sysflag = OPM_Integer(sf);
OPP_CheckSym(23); OPP_CheckSym(23);
} else { } else {
*sysflag = default_; *sysflag = default_;
@ -283,7 +283,7 @@ static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned)
OPP_err(51); OPP_err(51);
n = 1; n = 1;
} }
(*typ)->n = n; (*typ)->n = OPM_Longint(n);
if (OPP_sym == 25) { if (OPP_sym == 25) {
OPS_Get(&OPP_sym); OPS_Get(&OPP_sym);
OPP_Type(&(*typ)->BaseTyp, &*banned); OPP_Type(&(*typ)->BaseTyp, &*banned);
@ -1179,7 +1179,7 @@ static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int32 *n, OPP
OPP_ConstExpression(&x); OPP_ConstExpression(&x);
f = x->typ->form; f = x->typ->form;
if (__IN(f, 0x18, 64)) { if (__IN(f, 0x18, 64)) {
xval = x->conval->intval; xval = OPM_Longint(x->conval->intval);
} else { } else {
OPP_err(61); OPP_err(61);
xval = 1; xval = 1;
@ -1194,7 +1194,7 @@ static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int32 *n, OPP
if (OPP_sym == 21) { if (OPP_sym == 21) {
OPS_Get(&OPP_sym); OPS_Get(&OPP_sym);
OPP_ConstExpression(&y); OPP_ConstExpression(&y);
yval = y->conval->intval; yval = OPM_Longint(y->conval->intval);
if ((y->typ->form != f && !((f == 4 && y->typ->form == 4)))) { if ((y->typ->form != f && !((f == 4 && y->typ->form == 4)))) {
OPP_err(60); OPP_err(60);
} }

View file

@ -1351,7 +1351,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc)
OPV_ExitInfo saved; OPV_ExitInfo saved;
OPT_Node l = NIL, r = NIL; OPT_Node l = NIL, r = NIL;
while ((n != NIL && OPM_noerr)) { while ((n != NIL && OPM_noerr)) {
OPM_errpos = n->conval->intval; OPM_errpos = OPM_Longint(n->conval->intval);
if (n->class != 14) { if (n->class != 14) {
OPC_BegStat(); OPC_BegStat();
} }
@ -1625,7 +1625,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc)
OPV_IfStat(n, n->subcl == 0, outerProc); OPV_IfStat(n, n->subcl == 0, outerProc);
break; break;
case 28: case 28:
OPC_Halt(n->right->conval->intval); OPC_Halt(OPM_Longint(n->right->conval->intval));
break; break;
default: default:
OPM_LogWStr((CHAR*)"unhandled case in OPV.expr, n^.class = ", 40); OPM_LogWStr((CHAR*)"unhandled case in OPV.expr, n^.class = ", 40);

View file

@ -1,6 +1,6 @@
MODULE Texts; (** CAS/HM 23.9.93 -- interface based on Texts by JG/NW 6.12.91**) (* << RC, MB, JT *) MODULE Texts; (** CAS/HM 23.9.93 -- interface based on Texts by JG/NW 6.12.91**) (* << RC, MB, JT *)
IMPORT IMPORT
Files, Modules, Reals; Files, Modules, Reals, SYSTEM;
(*--- insert field e: Elem into Texts.Scanner and change Texts.Scan to set it in case of class=6 *) (*--- insert field e: Elem into Texts.Scanner and change Texts.Scan to set it in case of class=6 *)
@ -545,19 +545,13 @@ MODULE Texts; (** CAS/HM 23.9.93 -- interface based on Texts by JG/NW 6.12.91**
WHILE s[i] >= " " DO Write(W, s[i]); INC(i) END WHILE s[i] >= " " DO Write(W, s[i]); INC(i) END
END WriteString; END WriteString;
PROCEDURE WriteInt* (VAR W: Writer; x, n: LONGINT); PROCEDURE WriteInt* (VAR W: Writer; x, n: SYSTEM.INT64);
VAR VAR
i: INTEGER; x0: LONGINT; i: INTEGER; x0: SYSTEM.INT64;
a: ARRAY 22 OF CHAR; a: ARRAY 24 OF CHAR;
BEGIN i := 0; BEGIN i := 0;
IF x < 0 THEN IF x < 0 THEN
IF x = MIN(LONGINT) THEN IF x = MIN(SYSTEM.INT64) THEN WriteString(W, " -9223372036854775808"); RETURN
IF SIZE(LONGINT) = 4 THEN
WriteString(W, " -2147483648")
ELSE
WriteString(W, " -9223372036854775808")
END;
RETURN
ELSE DEC(n); x0 := -x ELSE DEC(n); x0 := -x
END END
ELSE x0 := x ELSE x0 := x

View file

@ -1,30 +1,11 @@
MODULE BrowserCmd; (* RC 29.10.93 *) (* object model 4.12.93, command line version jt 4.4.95 *) MODULE BrowserCmd; (* RC 29.10.93 *) (* object model 4.12.93, command line version jt 4.4.95 *)
IMPORT IMPORT
OPM, OPS, OPT, OPV, Texts, Console, Platform; OPM, OPS, OPT, OPV, Texts, Console, Platform, SYSTEM;
CONST CONST
OptionChar = "-"; OptionChar = "-";
(* object modes *)
Var = 1; VarPar = 2; Con = 3; Fld = 4; Typ = 5; LProc = 6; XProc = 7;
SProc = 8; CProc = 9; IProc = 10; Mod = 11; Head = 12; TProc = 13;
(* structure forms *)
Undef = 0; Byte = 1; Bool = 2; Char = 3; SInt = 4; Int = 5; LInt = 6;
Real = 7; LReal = 8; Set = 9; String = 10; NilTyp = 11; NoTyp = 12;
Pointer = 13; ProcTyp = 14; Comp = 15;
(* composite structure forms *)
Basic = 1; Array = 2; DynArr = 3; Record = 4;
(* module visibility of objects *)
internal = 0; external = 1; externalR = 2;
(* symbol file items *)
Smname = 16; Send = 18; Stype = 19; Salias = 20; Svar = 21; Srvar = 22;
Svalpar = 23; Svarpar = 24; Sfld = 25; Srfld = 26; Shdptr = 27; Shdpro = 28; Stpro = 29; Shdtpro = 30;
Sxpro = 31; Sipro = 32; Scpro = 33; Sstruct = 34; Ssys = 35; Sptr = 36; Sarr = 37; Sdarr = 38; Srec = 39; Spro = 40;
VAR VAR
W: Texts.Writer; W: Texts.Writer;
@ -32,7 +13,7 @@ MODULE BrowserCmd; (* RC 29.10.93 *) (* object model 4.12.93, command line ver
PROCEDURE Ws(s: ARRAY OF CHAR); BEGIN Texts.WriteString(W, s) END Ws; PROCEDURE Ws(s: ARRAY OF CHAR); BEGIN Texts.WriteString(W, s) END Ws;
PROCEDURE Wch(ch: CHAR); BEGIN Texts.Write(W, ch) END Wch; PROCEDURE Wch(ch: CHAR); BEGIN Texts.Write(W, ch) END Wch;
PROCEDURE Wi(i: LONGINT); BEGIN Texts.WriteInt(W, i, 0) END Wi; PROCEDURE Wi(i: SYSTEM.INT64); BEGIN Texts.WriteInt(W, i, 0) END Wi;
PROCEDURE Wln; BEGIN Texts.WriteLn(W) END Wln; PROCEDURE Wln; BEGIN Texts.WriteLn(W) END Wln;
PROCEDURE Indent(i: INTEGER); PROCEDURE Indent(i: INTEGER);
@ -51,7 +32,7 @@ MODULE BrowserCmd; (* RC 29.10.93 *) (* object model 4.12.93, command line ver
WHILE par # NIL DO WHILE par # NIL DO
IF ~first THEN Ws("; ") ELSE first := FALSE END ; IF ~first THEN Ws("; ") ELSE first := FALSE END ;
IF option = "x" THEN Wi(par^.adr); Wch(" ") END ; IF option = "x" THEN Wi(par^.adr); Wch(" ") END ;
IF par^.mode = VarPar THEN Ws("VAR ") END ; IF par^.mode = OPT.VarPar THEN Ws("VAR ") END ;
Ws(par^.name); Ws(": "); Wtype(par^.typ); Ws(par^.name); Ws(": "); Wtype(par^.typ);
par := par^.link par := par^.link
END ; END ;
@ -60,19 +41,16 @@ MODULE BrowserCmd; (* RC 29.10.93 *) (* object model 4.12.93, command line ver
END Wsign; END Wsign;
PROCEDURE Objects(obj: OPT.Object; mode: SET); PROCEDURE Objects(obj: OPT.Object; mode: SET);
VAR i: LONGINT; m: INTEGER; s: SET; ext: OPT.ConstExt; VAR i: SYSTEM.INT64; m: INTEGER; s: SET; ext: OPT.ConstExt;
BEGIN BEGIN
IF obj # NIL THEN IF obj # NIL THEN
Objects(obj^.left, mode); Objects(obj^.left, mode);
IF obj^.mode IN mode THEN IF obj^.mode IN mode THEN
CASE obj^.mode OF CASE obj^.mode OF
| Con: |OPT.Con: Indent(2); Ws(obj^.name); Ws(" = ");
Indent(2); Ws(obj^.name); Ws(" = ");
CASE obj^.typ^.form OF CASE obj^.typ^.form OF
| Bool: |OPT.Bool: IF obj^.conval^.intval = 1 THEN Ws("TRUE") ELSE Ws("FALSE") END
IF obj^.conval^.intval = 1 THEN Ws("TRUE") ELSE Ws("FALSE") END |OPT.Char: IF (obj^.conval^.intval >= 32) & (obj^.conval^.intval <= 126) THEN
| Char:
IF (obj^.conval^.intval >= 32) & (obj^.conval^.intval <= 126) THEN
Wch(22X); Wch(CHR(obj^.conval^.intval)); Wch(22X) Wch(22X); Wch(CHR(obj^.conval^.intval)); Wch(22X)
ELSE ELSE
i := obj^.conval^.intval DIV 16; i := obj^.conval^.intval DIV 16;
@ -81,10 +59,8 @@ MODULE BrowserCmd; (* RC 29.10.93 *) (* object model 4.12.93, command line ver
IF i > 9 THEN Wch(CHR(55 + i)) ELSE Wch(CHR(48 + i)) END ; IF i > 9 THEN Wch(CHR(55 + i)) ELSE Wch(CHR(48 + i)) END ;
Wch("X") Wch("X")
END END
| SInt, Int, LInt: |OPT.Int: Wi(obj^.conval^.intval)
Wi(obj^.conval^.intval) |OPT.Set: Wch("{"); i := 0; s := obj^.conval^.setval;
| Set:
Wch("{"); i := 0; s := obj^.conval^.setval;
WHILE i <= MAX(SET) DO WHILE i <= MAX(SET) DO
IF i IN s THEN Wi(i); EXCL(s, i); IF i IN s THEN Wi(i); EXCL(s, i);
IF s # {} THEN Ws(", ") END IF s # {} THEN Ws(", ") END
@ -92,19 +68,14 @@ MODULE BrowserCmd; (* RC 29.10.93 *) (* object model 4.12.93, command line ver
INC(i) INC(i)
END ; END ;
Wch("}") Wch("}")
| Real: |OPT.Real: Texts.WriteReal(W, SHORT(obj^.conval^.realval), 16)
Texts.WriteReal(W, SHORT(obj^.conval^.realval), 16) |OPT.LReal: Texts.WriteLongReal(W, obj^.conval^.realval, 23)
| LReal: |OPT.String: Ws(obj^.conval^.ext^)
Texts.WriteLongReal(W, obj^.conval^.realval, 23) |OPT.NilTyp: Ws("NIL")
| String:
Ws(obj^.conval^.ext^)
| NilTyp:
Ws("NIL")
ELSE (* Ignore other forms *) ELSE (* Ignore other forms *)
END ; END ;
Wch(";"); Wln Wch(";"); Wln
| Typ: |OPT.Typ: IF obj^.name # "" THEN Indent(2);
IF obj^.name # "" THEN Indent(2);
IF obj^.typ^.strobj = obj THEN (* canonical name *) IF obj^.typ^.strobj = obj THEN (* canonical name *)
Wtype(obj^.typ); Ws(" = "); Wstruct(obj^.typ) Wtype(obj^.typ); Ws(" = "); Wstruct(obj^.typ)
ELSE (* alias *) ELSE (* alias *)
@ -112,18 +83,18 @@ MODULE BrowserCmd; (* RC 29.10.93 *) (* object model 4.12.93, command line ver
END ; END ;
Wch(";"); Wln Wch(";"); Wln
END END
| Var: |OPT.Var: Indent(2); Ws(obj^.name);
Indent(2); Ws(obj^.name); IF obj^.vis = OPT.externalR THEN Ws("-: ") ELSE Ws(": ") END ;
IF obj^.vis = externalR THEN Ws("-: ") ELSE Ws(": ") END ;
Wtype(obj^.typ); Wch(";"); Wln Wtype(obj^.typ); Wch(";"); Wln
| XProc, CProc, IProc: |OPT.XProc,
Indent(1); Ws("PROCEDURE "); OPT.CProc,
IF obj^.mode = IProc THEN Wch("+") OPT.IProc: Indent(1); Ws("PROCEDURE ");
ELSIF obj^.mode = CProc THEN Wch("-") IF obj^.mode = OPT.IProc THEN Wch("+")
ELSIF obj^.mode = OPT.CProc THEN Wch("-")
END ; END ;
Ws(obj^.name); Ws(obj^.name);
Wsign(obj^.typ, obj^.link); Wsign(obj^.typ, obj^.link);
IF obj^.mode = CProc THEN IF obj^.mode = OPT.CProc THEN
ext := obj^.conval^.ext; m := ORD(ext^[0]); i := 1; Ws(' "'); ext := obj^.conval^.ext; m := ORD(ext^[0]); i := 1; Ws(' "');
WHILE i <= m DO Wch(ext^[i]); INC(i) END ; WHILE i <= m DO Wch(ext^[i]); INC(i) END ;
Wch('"'); Wch('"');
@ -141,10 +112,10 @@ MODULE BrowserCmd; (* RC 29.10.93 *) (* object model 4.12.93, command line ver
BEGIN BEGIN
IF obj # NIL THEN IF obj # NIL THEN
Wmthd(obj^.left); Wmthd(obj^.left);
IF (obj^.mode = TProc) & ((obj^.name # OPM.HdTProcName) OR (option = "x")) THEN IF (obj^.mode = OPT.TProc) & ((obj^.name # OPM.HdTProcName) OR (option = "x")) THEN
Indent(3); Ws("PROCEDURE ("); Indent(3); Ws("PROCEDURE (");
IF obj^.name # OPM.HdTProcName THEN IF obj^.name # OPM.HdTProcName THEN
IF obj^.link^.mode = VarPar THEN Ws("VAR ") END ; IF obj^.link^.mode = OPT.VarPar THEN Ws("VAR ") END ;
Ws(obj^.link^.name); Ws(": "); Wtype(obj^.link^.typ) Ws(obj^.link^.name); Ws(": "); Wtype(obj^.link^.typ)
END ; END ;
Ws(") "); Ws(obj^.name); Ws(") "); Ws(obj^.name);
@ -171,27 +142,20 @@ MODULE BrowserCmd; (* RC 29.10.93 *) (* object model 4.12.93, command line ver
BEGIN BEGIN
CASE typ^.form OF CASE typ^.form OF
| Undef: |OPT.Undef: Ws("Undef")
Ws("Undef") |OPT.Pointer: Ws("POINTER "); SysFlag; Ws("TO "); Wtype(typ^.BaseTyp)
| Pointer: |OPT.ProcTyp: Ws("PROCEDURE "); SysFlag; Wsign(typ^.BaseTyp, typ^.link)
Ws("POINTER "); SysFlag; Ws("TO "); Wtype(typ^.BaseTyp) |OPT.Comp: CASE typ^.comp OF
| ProcTyp: |OPT.Array: Ws("ARRAY "); SysFlag; Wi(typ^.n); Ws(" OF "); Wtype(typ^.BaseTyp)
Ws("PROCEDURE "); SysFlag; Wsign(typ^.BaseTyp, typ^.link) |OPT.DynArr: Ws("ARRAY "); SysFlag; Ws("OF "); Wtype(typ^.BaseTyp)
| Comp: |OPT.Record: Ws("RECORD ");SysFlag;
CASE typ^.comp OF
| Array:
Ws("ARRAY "); SysFlag; Wi(typ^.n); Ws(" OF "); Wtype(typ^.BaseTyp)
| DynArr:
Ws("ARRAY "); SysFlag; Ws("OF "); Wtype(typ^.BaseTyp)
| Record:
Ws("RECORD ");SysFlag;
IF typ^.BaseTyp # NIL THEN Wch("("); Wtype(typ^.BaseTyp); Wch(")") END ; IF typ^.BaseTyp # NIL THEN Wch("("); Wtype(typ^.BaseTyp); Wch(")") END ;
Wln; fld := typ^.link; Wln; fld := typ^.link;
WHILE (fld # NIL) & (fld^.mode = Fld) DO WHILE (fld # NIL) & (fld^.mode = OPT.Fld) DO
IF (option = "x") OR (fld^.name[0] # "@") THEN Indent(3); IF (option = "x") OR (fld^.name[0] # "@") THEN Indent(3);
IF option = "x" THEN Wi(fld^.adr); Wch(" ") END ; IF option = "x" THEN Wi(fld^.adr); Wch(" ") END ;
Ws(fld^.name); Ws(fld^.name);
IF fld^.vis = externalR THEN Wch("-") END ; IF fld^.vis = OPT.externalR THEN Wch("-") END ;
Ws(": "); Wtype(fld^.typ); Wch(";"); Ws(": "); Wtype(fld^.typ); Wch(";");
Wln Wln
END ; END ;
@ -216,7 +180,7 @@ MODULE BrowserCmd; (* RC 29.10.93 *) (* object model 4.12.93, command line ver
IF obj^.name # "" THEN IF obj^.name # "" THEN
IF typ^.mno # 0 THEN Ws(OPT.GlbMod[typ^.mno].name); Wch(".") IF typ^.mno # 0 THEN Ws(OPT.GlbMod[typ^.mno].name); Wch(".")
ELSIF (typ = OPT.bytetyp) OR (typ = OPT.sysptrtyp) THEN Ws("SYSTEM.") ELSIF (typ = OPT.bytetyp) OR (typ = OPT.sysptrtyp) THEN Ws("SYSTEM.")
ELSIF obj^.vis = internal THEN Wch("#") ELSIF obj^.vis = OPT.internal THEN Wch("#")
END ; END ;
Ws(obj^.name) Ws(obj^.name)
ELSE ELSE
@ -255,10 +219,10 @@ MODULE BrowserCmd; (* RC 29.10.93 *) (* object model 4.12.93, command line ver
END ; END ;
IF ~first THEN Wch(";"); Wln END ; IF ~first THEN Wch(";"); Wln END ;
CheckHeader; CheckHeader;
Header("CONST"); Objects(OPT.GlbMod[0].right, {Con}); CheckHeader; Header("CONST"); Objects(OPT.GlbMod[0].right, {OPT.Con}); CheckHeader;
Header("TYPE"); Objects(OPT.GlbMod[0].right, {Typ}); CheckHeader; Header("TYPE"); Objects(OPT.GlbMod[0].right, {OPT.Typ}); CheckHeader;
Header("VAR"); Objects(OPT.GlbMod[0].right, {Var}); CheckHeader; Header("VAR"); Objects(OPT.GlbMod[0].right, {OPT.Var}); CheckHeader;
Objects(OPT.GlbMod[0].right, {XProc, IProc, CProc}); Objects(OPT.GlbMod[0].right, {OPT.XProc, OPT.IProc, OPT.CProc});
Wln; Wln;
Ws("END "); Ws(name); Wch("."); Wln; Texts.Append(T, W.buf) Ws("END "); Ws(name); Wch("."); Wln; Texts.Append(T, W.buf)
ELSE ELSE

View file

@ -335,7 +335,7 @@ misc:
s3: s3:
@printf "\nMaking s3 library\n" @printf "\nMaking s3 library\n"
cd $(BUILDDIR); $(ROOTDIR)/$(VISHAP) -Ffs ../../src/library/s3/ethBTrees.Mod cd $(BUILDDIR); $(ROOTDIR)/$(VISHAP) -Ffs ../../src/library/s3/ethBTrees.Mod
cd $(BUILDDIR); $(ROOTDIR)/$(VISHAP) -Ffs ../../src/library/s3/ethMD5.Mod # cd $(BUILDDIR); $(ROOTDIR)/$(VISHAP) -Ffs ../../src/library/s3/ethMD5.Mod
cd $(BUILDDIR); $(ROOTDIR)/$(VISHAP) -Ffs ../../src/library/s3/ethSets.Mod cd $(BUILDDIR); $(ROOTDIR)/$(VISHAP) -Ffs ../../src/library/s3/ethSets.Mod
cd $(BUILDDIR); $(ROOTDIR)/$(VISHAP) -Ffs ../../src/library/s3/ethZlib.Mod cd $(BUILDDIR); $(ROOTDIR)/$(VISHAP) -Ffs ../../src/library/s3/ethZlib.Mod
cd $(BUILDDIR); $(ROOTDIR)/$(VISHAP) -Ffs ../../src/library/s3/ethZlibBuffers.Mod cd $(BUILDDIR); $(ROOTDIR)/$(VISHAP) -Ffs ../../src/library/s3/ethZlibBuffers.Mod