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_Flush (void);
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_Read (CHAR *ch);
export void Console_ReadLine (CHAR *line, LONGINT line__len);
@ -54,15 +54,15 @@ void Console_String (CHAR *s, LONGINT s__len)
__DEL(s);
}
void Console_Int (int32 i, int32 n)
void Console_Int (int64 i, int64 n)
{
CHAR s[32];
int32 i1, k;
if (i == __LSHL(1, 31, 32)) {
if (i == (int64)__LSHL(1, 31, 32)) {
__MOVE("8463847412", s, 11);
k = 10;
} else {
i1 = __ABS(i);
i1 = __ABS(__VAL(int32, i));
s[0] = (CHAR)((int)__MOD(i1, 10) + 48);
i1 = __DIV(i1, 10);
k = 1;
@ -76,7 +76,7 @@ void Console_Int (int32 i, int32 n)
s[__X(k, 32)] = '-';
k += 1;
}
while (n > k) {
while (n > (int64)k) {
Console_Char(' ');
n -= 1;
}

View file

@ -12,7 +12,7 @@ import void Console_Bool (BOOLEAN b);
import void Console_Char (CHAR ch);
import void Console_Flush (void);
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_Read (CHAR *ch);
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_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_ReadNum64 (Files_Rider *R, LONGINT *R__typ, int64 *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_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_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL 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_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x);
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;
}
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)
{
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));
}
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)
{
__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_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_ReadNum64 (Files_Rider *R, LONGINT *R__typ, int64 *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_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_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL 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_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x);
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);
static int16 OPB_exp;
static int32 OPB_maxExp;
static int64 OPB_maxExp;
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_Index (OPT_Node *x, OPT_Node y);
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_MOp (int8 op, OPT_Node *x);
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_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);
static BOOLEAN OPB_NotVar (OPT_Node x);
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_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard);
static void OPB_err (int16 n);
static int32 OPB_log (int32 x);
static int64 OPB_log (int64 x);
static void OPB_err (int16 n)
@ -141,17 +141,11 @@ static int32 OPB_BoolToInt (BOOLEAN b)
__RETCHK;
}
static BOOLEAN OPB_IntToBool (int32 i)
static BOOLEAN OPB_IntToBool (int64 i)
{
BOOLEAN _o_result;
if (i == 0) {
_o_result = 0;
return _o_result;
} else {
_o_result = 1;
return _o_result;
}
__RETCHK;
_o_result = i != 0;
return _o_result;
}
OPT_Node OPB_NewBoolConst (BOOLEAN boolval)
@ -228,7 +222,7 @@ OPT_Node OPB_EmptySet (void)
static void OPB_SetIntType (OPT_Node node)
{
int16 b;
int32 n;
int64 n;
if (node->conval->intval >= 0) {
n = node->conval->intval;
} else {
@ -241,7 +235,7 @@ static void OPB_SetIntType (OPT_Node node)
node->typ = OPT_IntType(b);
}
OPT_Node OPB_NewIntConst (int32 intval)
OPT_Node OPB_NewIntConst (int64 intval)
{
OPT_Node _o_result;
OPT_Node x = NIL;
@ -266,7 +260,7 @@ OPT_Node OPB_NewRealConst (LONGREAL realval, OPT_Struct typ)
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 x = NIL;
@ -274,7 +268,7 @@ OPT_Node OPB_NewString (OPS_String str, int32 len)
x->conval = OPT_NewConst();
x->typ = OPT_stringtyp;
x->conval->intval = -1;
x->conval->intval2 = len;
x->conval->intval2 = OPM_Longint(len);
x->conval->ext = OPT_NewExt();
__COPY(str, *x->conval->ext, 256);
_o_result = x;
@ -351,7 +345,7 @@ void OPB_Index (OPT_Node *x, OPT_Node y)
}
if ((*x)->typ->comp == 2) {
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);
}
} 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)
{
int16 f;
int32 k;
int64 k;
f = (*x)->typ->form;
if ((((*x)->class == 8 || (*x)->class == 9) || y->class == 8) || y->class == 9) {
OPB_err(126);
} else if ((f == 4 && y->typ->form == 7)) {
if ((*x)->class == 7) {
k = (*x)->conval->intval;
if (k < 0 || k > OPM_MaxSet) {
if (k < 0 || k > (int64)OPM_MaxSet) {
OPB_err(202);
} else if (y->class == 7) {
(*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;
}
static int32 OPB_log (int32 x)
static int64 OPB_log (int64 x)
{
int32 _o_result;
int64 _o_result;
OPB_exp = 0;
if (x > 0) {
while (!__ODD(x)) {
@ -580,7 +574,7 @@ void OPB_MOp (int8 op, OPT_Node *x)
if (__IN(f, 0xf0, 32)) {
if (z->class == 7) {
if (f == 4) {
if (z->conval->intval == (-2147483647-1)) {
if (z->conval->intval == (-9223372036854775807-1)) {
OPB_err(203);
} else {
z->conval->intval = -z->conval->intval;
@ -603,7 +597,7 @@ void OPB_MOp (int8 op, OPT_Node *x)
if (__IN(f, 0x70, 32)) {
if (z->class == 7) {
if (f == 4) {
if (z->conval->intval == (-2147483647-1)) {
if (z->conval->intval == (-9223372036854775807-1)) {
OPB_err(203);
} else {
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;
OPT_Const xval = NIL, yval = NIL;
int32 xv, yv;
int64 xv, yv;
BOOLEAN temp;
struct ConstOp__13 _s;
_s.x = &x;
@ -1007,7 +1001,7 @@ static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y)
case 4:
if (f == 4) {
if (yval->intval != 0) {
xval->intval = (int)__MOD(xval->intval, yval->intval);
xval->intval = __MOD(xval->intval, yval->intval);
OPB_SetIntType(x);
} else {
OPB_err(205);
@ -1122,7 +1116,7 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ)
{
OPT_Node node = NIL;
int16 f, g;
int32 k;
int64 k;
LONGREAL r;
f = (*x)->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_Struct typ = NIL;
BOOLEAN do_;
int32 val;
int64 val;
struct Op__38 _s;
_s.f = &f;
_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)
{
int32 k, l;
int64 k, l;
if ((((*x)->class == 8 || (*x)->class == 9) || y->class == 8) || y->class == 9) {
OPB_err(126);
} else if (((*x)->typ->form == 4 && y->typ->form == 4)) {
if ((*x)->class == 7) {
k = (*x)->conval->intval;
if (0 > k || k > OPM_MaxSet) {
if (0 > k || k > (int64)OPM_MaxSet) {
OPB_err(202);
}
}
if (y->class == 7) {
l = y->conval->intval;
if (0 > l || l > OPM_MaxSet) {
if (0 > l || l > (int64)OPM_MaxSet) {
OPB_err(202);
}
}
@ -1535,14 +1529,14 @@ void OPB_SetRange (OPT_Node *x, OPT_Node y)
void OPB_SetElem (OPT_Node *x)
{
int32 k;
int64 k;
if ((*x)->class == 8 || (*x)->class == 9) {
OPB_err(126);
} else if ((*x)->typ->form != 4) {
OPB_err(93);
} else if ((*x)->class == 7) {
k = (*x)->conval->intval;
if ((0 <= k && k <= OPM_MaxSet)) {
if ((0 <= k && k <= (int64)OPM_MaxSet)) {
(*x)->conval->setval = __SETOF(k,32);
} else {
OPB_err(202);
@ -1917,7 +1911,7 @@ void OPB_StPar0 (OPT_Node *par0, int16 fctno)
if (x->class == 8 || x->class == 9) {
OPB_err(126);
} else if (f == 4) {
if (x->typ->size != OPT_linttyp->size) {
if (x->typ->size < OPT_linttyp->size) {
OPB_Convert(&x, OPT_linttyp);
}
} else {
@ -2055,7 +2049,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
if (x->class == 8 || x->class == 9) {
OPB_err(126);
} 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);
}
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) {
OPB_err(69);
} else if (x->typ->size == 1) {
L = (int16)x->conval->intval;
L = OPM_Integer(x->conval->intval);
typ = p->typ;
while ((L > 0 && __IN(typ->comp, 0x0c, 32))) {
typ = typ->BaseTyp;
@ -2120,8 +2114,8 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
OPB_err(208);
p->conval->intval = 1;
} else if (x->conval->intval >= 0) {
if (__ABS(p->conval->intval) <= __DIV(2147483647, __ASH(1, x->conval->intval))) {
p->conval->intval = p->conval->intval * __ASH(1, x->conval->intval);
if (__ABS(p->conval->intval) <= __DIV(9223372036854775807, (int64)__ASH(1, x->conval->intval))) {
p->conval->intval = p->conval->intval * (int64)__ASH(1, x->conval->intval);
} else {
OPB_err(208);
p->conval->intval = 1;
@ -2132,7 +2126,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
p->obj = NIL;
} else {
p = NewOp__53(12, 17, p, x);
p->typ = OPT_linttyp;
p->typ = p->left->typ;
}
} else {
OPB_err(111);
@ -2143,7 +2137,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
OPB_err(126);
} else if (p->typ->comp == 3) {
if (f == 4) {
if ((x->class == 7 && (x->conval->intval <= 0 || x->conval->intval > OPM_MaxIndex))) {
if ((x->class == 7 && (x->conval->intval <= 0 || x->conval->intval > (int64)OPM_MaxIndex))) {
OPB_err(63);
}
} else {
@ -2281,7 +2275,7 @@ void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n)
} else if (p->typ->comp != 3) {
OPB_err(64);
} else if (f == 4) {
if ((x->class == 7 && (x->conval->intval <= 0 || x->conval->intval > OPM_MaxIndex))) {
if ((x->class == 7 && (x->conval->intval <= 0 || x->conval->intval > (int64)OPM_MaxIndex))) {
OPB_err(63);
}
node = p->right;
@ -2622,7 +2616,7 @@ export void *OPB__init(void)
__MODULE_IMPORT(OPT);
__REGMOD("OPB", 0);
/* BEGIN */
OPB_maxExp = OPB_log(1073741824);
OPB_maxExp = OPB_log(4611686018427387904);
OPB_maxExp = OPB_exp;
__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_MOp (int8 op, OPT_Node *x);
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_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 void OPB_Op (int8 op, OPT_Node *x, OPT_Node y);
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_BegStat (void);
static void OPC_CProcDefs (OPT_Object obj, int16 vis);
export void OPC_Case (int32 caseVal, int16 form);
static void OPC_CharacterLiteral (int32 c);
export void OPC_Case (int64 caseVal, int16 form);
static void OPC_CharacterLiteral (int64 c);
export void OPC_Cmp (int16 rel);
export void OPC_CompleteIdent (OPT_Object obj);
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);
export void OPC_InitTDesc (OPT_Struct typ);
static void OPC_InitTProcs (OPT_Object typ, OPT_Object obj);
export void OPC_IntLiteral (int32 n, int32 size);
export void OPC_Len (OPT_Object obj, OPT_Struct array, int32 dim);
export void OPC_IntLiteral (int64 n, int32 size);
export void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim);
static void OPC_LenList (OPT_Object par, BOOLEAN ansiDefine, BOOLEAN showParamName);
static int16 OPC_Length (CHAR *s, LONGINT s__len);
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) {
OPM_WriteString((CHAR*)"0x", 3);
@ -1894,7 +1894,7 @@ static void OPC_StringLiteral (CHAR *s, LONGINT s__len, int32 l)
__DEL(s);
}
void OPC_Case (int32 caseVal, int16 form)
void OPC_Case (int64 caseVal, int16 form)
{
CHAR ch;
OPM_WriteString((CHAR*)"case ", 6);
@ -1937,7 +1937,7 @@ void OPC_Halt (int32 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))) {
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) {
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 void OPC_BegBlk (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_CompleteIdent (OPT_Object obj);
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_Init (void);
import void OPC_InitTDesc (OPT_Struct typ);
import void OPC_IntLiteral (int32 n, int32 size);
import void OPC_Len (OPT_Object obj, OPT_Struct array, int32 dim);
import void OPC_IntLiteral (int64 n, int32 size);
import void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim);
import int32 OPC_NofPtrs (OPT_Struct typ);
import void OPC_SetInclude (BOOLEAN exclude);
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_objname[64];
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_Text OPM_Log;
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_CloseOldSym (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_FPrintReal (int32 *fp, REAL real);
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);
static void OPM_GetProperties (void);
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_InitOptions (void);
export int16 OPM_Integer (int64 n);
static void OPM_LogErrMsg (int16 n);
export void OPM_LogW (CHAR ch);
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 int32 OPM_Longint (int64 n);
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_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done);
export void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len);
export BOOLEAN OPM_OpenPar (void);
export void OPM_RegisterNewSym (void);
static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt);
static void OPM_ShowLine (int32 pos);
static void OPM_ShowLine (int64 pos);
export int32 OPM_SignedMaximum (int32 bytecount);
export int32 OPM_SignedMinimum (int32 bytecount);
export void OPM_SymRCh (CHAR *ch);
export int32 OPM_SymRInt (void);
export int64 OPM_SymRInt64 (void);
export void OPM_SymRLReal (LONGREAL *lr);
export void OPM_SymRReal (REAL *r);
export void OPM_SymRSet (SET *s);
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_SymWReal (REAL r);
export void OPM_SymWSet (SET s);
static void OPM_VerboseListSizes (void);
export void OPM_Write (CHAR ch);
export void OPM_WriteHex (int32 i);
export void OPM_WriteInt (int32 i);
export void OPM_WriteHex (int64 i);
export void OPM_WriteInt (int64 i);
export void OPM_WriteLn (void);
export void OPM_WriteReal (LONGREAL r, CHAR suffx);
export void OPM_WriteString (CHAR *s, LONGINT s__len);
@ -107,7 +111,7 @@ void OPM_LogWStr (CHAR *s, LONGINT s__len)
__DEL(s);
}
void OPM_LogWNum (int32 i, int32 len)
void OPM_LogWNum (int64 i, int64 len)
{
Console_Int(i, len);
}
@ -117,6 +121,20 @@ void OPM_LogWLn (void)
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)
{
int16 i;
@ -404,21 +422,21 @@ static void OPM_LogErrMsg (int16 n)
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;
if (pos < OPM_ErrorLineStartPos) {
if (pos < (int64)OPM_ErrorLineStartPos) {
OPM_ErrorLineStartPos = 0;
OPM_ErrorLineLimitPos = 0;
OPM_ErrorLineNumber = 0;
}
if (pos < OPM_ErrorLineLimitPos) {
if (pos < (int64)OPM_ErrorLineLimitPos) {
Files_Set(&*r, r__typ, f, OPM_ErrorLineStartPos);
return;
}
Files_Set(&*r, r__typ, f, OPM_ErrorLineLimitPos);
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_ErrorLineNumber += 1;
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);
}
static void OPM_ShowLine (int32 pos)
static void OPM_ShowLine (int64 pos)
{
Files_File f = NIL;
Files_Rider r;
@ -460,10 +478,10 @@ static void OPM_ShowLine (int32 pos)
OPM_LogWStr(line, 1023);
OPM_LogWLn();
OPM_LogWStr((CHAR*)" ", 7);
if (pos >= OPM_ErrorLineLimitPos) {
if (pos >= (int64)OPM_ErrorLineLimitPos) {
pos = OPM_ErrorLineLimitPos - 1;
}
i = (int16)(pos - OPM_ErrorLineStartPos);
i = (int16)OPM_Longint(pos - (int64)OPM_ErrorLineStartPos);
while (i > 0) {
OPM_LogW(' ');
i -= 1;
@ -478,7 +496,7 @@ static void OPM_ShowLine (int32 pos)
Files_Close(f);
}
void OPM_Mark (int16 n, int32 pos)
void OPM_Mark (int16 n, int64 pos)
{
if (pos == -1) {
pos = 0;
@ -535,9 +553,9 @@ void OPM_err (int16 n)
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)
@ -702,6 +720,15 @@ int32 OPM_SymRInt (void)
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)
{
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);
}
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)
@ -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);
}
void OPM_WriteHex (int32 i)
void OPM_WriteHex (int64 i)
{
CHAR s[3];
int16 digit;
digit = __ASHR((int16)i, 4);
int32 digit;
digit = __ASHR((int32)i, 4);
if (digit < 10) {
s[0] = (CHAR)(48 + digit);
} else {
s[0] = (CHAR)(87 + digit);
}
digit = __MASK((int16)i, -16);
digit = __MASK((int32)i, -16);
if (digit < 10) {
s[1] = (CHAR)(48 + digit);
} else {
@ -840,31 +867,31 @@ void OPM_WriteHex (int32 i)
OPM_WriteString(s, 3);
}
void OPM_WriteInt (int32 i)
void OPM_WriteInt (int64 i)
{
CHAR s[20];
int32 i1, k;
if (i == OPM_SignedMinimum(OPM_IntSize) || i == OPM_SignedMinimum(OPM_LIntSize)) {
CHAR s[24];
int64 i1, k;
if ((i == (int64)OPM_SignedMinimum(OPM_IntSize) || i == (int64)OPM_SignedMinimum(OPM_LIntSize)) || i == (int64)OPM_SignedMinimum(8)) {
OPM_Write('(');
OPM_WriteInt(i + 1);
OPM_WriteString((CHAR*)"-1)", 4);
} else {
i1 = __ABS(i);
s[0] = (CHAR)((int)__MOD(i1, 10) + 48);
s[0] = (CHAR)(__MOD(i1, 10) + 48);
i1 = __DIV(i1, 10);
k = 1;
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);
k += 1;
}
if (i < 0) {
s[__X(k, 20)] = '-';
s[__X(k, 24)] = '-';
k += 1;
}
while (k > 0) {
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_CloseOldSym (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_FPrintReal (int32 *fp, REAL real);
import void OPM_FPrintSet (int32 *fp, SET set);
import void OPM_Get (CHAR *ch);
import void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len);
import void OPM_InitOptions (void);
import int16 OPM_Integer (int64 n);
import void OPM_LogW (CHAR ch);
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_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_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done);
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 void OPM_SymRCh (CHAR *ch);
import int32 OPM_SymRInt (void);
import int64 OPM_SymRInt64 (void);
import void OPM_SymRLReal (LONGREAL *lr);
import void OPM_SymRReal (REAL *r);
import void OPM_SymRSet (SET *s);
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_SymWReal (REAL r);
import void OPM_SymWSet (SET s);
import void OPM_Write (CHAR ch);
import void OPM_WriteHex (int32 i);
import void OPM_WriteInt (int32 i);
import void OPM_WriteHex (int64 i);
import void OPM_WriteInt (int64 i);
import void OPM_WriteLn (void);
import void OPM_WriteReal (LONGREAL r, CHAR suffx);
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_)
{
OPT_Node x = NIL;
int32 sf;
int64 sf;
if (OPP_sym == 31) {
OPS_Get(&OPP_sym);
if (!OPT_SYSimported) {
@ -151,7 +151,7 @@ static void OPP_CheckSysFlag (int16 *sysflag, int16 default_)
OPP_err(51);
sf = 0;
}
*sysflag = (int16)sf;
*sysflag = OPM_Integer(sf);
OPP_CheckSym(23);
} else {
*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)
{
OPT_Node x = NIL;
int32 n;
int64 n;
int16 sysflag;
OPP_CheckSysFlag(&sysflag, 0);
if (OPP_sym == 25) {
@ -275,7 +275,7 @@ static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned)
OPP_ConstExpression(&x);
if (x->typ->form == 4) {
n = x->conval->intval;
if (n <= 0 || n > OPM_MaxIndex) {
if (n <= 0 || n > (int64)OPM_MaxIndex) {
OPP_err(63);
n = 1;
}
@ -283,7 +283,7 @@ static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned)
OPP_err(51);
n = 1;
}
(*typ)->n = n;
(*typ)->n = OPM_Longint(n);
if (OPP_sym == 25) {
OPS_Get(&OPP_sym);
OPP_Type(&(*typ)->BaseTyp, &*banned);
@ -932,7 +932,7 @@ static void GetCode__19 (void)
{
OPT_ConstExt ext = NIL;
int16 n;
int32 c;
int64 c;
ext = OPT_NewExt();
(*ProcedureDeclaration__16_s->proc)->conval->ext = ext;
n = 0;
@ -1179,7 +1179,7 @@ static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int16 *n, OPP
OPP_ConstExpression(&x);
f = x->typ->form;
if (__IN(f, 0x18, 32)) {
xval = x->conval->intval;
xval = OPM_Longint(x->conval->intval);
} else {
OPP_err(61);
xval = 1;
@ -1194,7 +1194,7 @@ static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int16 *n, OPP
if (OPP_sym == 21) {
OPS_Get(&OPP_sym);
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)))) {
OPP_err(60);
}

View file

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

View file

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

View file

@ -17,7 +17,8 @@ typedef
typedef
struct OPT_ConstDesc {
OPT_ConstExt ext;
int32 intval, intval2;
int64 intval;
int32 intval2;
SET setval;
LONGREAL realval;
} OPT_ConstDesc;
@ -1838,7 +1839,7 @@ static void EnumPtrs(void (*P)(void*))
__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_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}};

View file

@ -15,7 +15,8 @@ typedef
typedef
struct OPT_ConstDesc {
OPT_ConstExt ext;
int32 intval, intval2;
int64 intval;
int32 intval2;
SET setval;
LONGREAL realval;
} 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);
export void OPV_Init (void);
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);
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 BOOLEAN OPV_SideEffects (OPT_Node n);
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;
}
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)) {
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) {
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)
{
OPT_Node switchCase = NIL, label = NIL;
int32 low, high;
int64 low, high;
int16 form, i;
OPM_WriteString((CHAR*)"switch ", 8);
OPV_expr(n->left, 12);
@ -1351,7 +1351,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc)
OPV_ExitInfo saved;
OPT_Node l = NIL, r = NIL;
while ((n != NIL && OPM_noerr)) {
OPM_errpos = n->conval->intval;
OPM_errpos = OPM_Longint(n->conval->intval);
if (n->class != 14) {
OPC_BegStat();
}
@ -1625,7 +1625,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc)
OPV_IfStat(n, n->subcl == 0, outerProc);
break;
case 28:
OPC_Halt(n->right->conval->intval);
OPC_Halt(OPM_Longint(n->right->conval->intval));
break;
default:
OPM_LogWStr((CHAR*)"unhandled case in OPV.expr, n^.class = ", 40);