mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 04:02:25 +00:00
INT64 support in the interface browser.
This commit is contained in:
parent
08f09a097d
commit
9971e56451
68 changed files with 756 additions and 574 deletions
|
|
@ -62,7 +62,7 @@ void Console_Int (int64 i, int64 n)
|
|||
__MOVE("8085774586302733229", s, 20);
|
||||
k = 19;
|
||||
} else {
|
||||
i1 = __ABS(i);
|
||||
i1 = __ABS((int64)i);
|
||||
s[0] = (CHAR)(__MOD(i1, 10) + 48);
|
||||
i1 = __DIV(i1, 10);
|
||||
k = 1;
|
||||
|
|
|
|||
|
|
@ -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_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_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, int32 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_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_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, int64 *x)
|
|||
*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)
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -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_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_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, int32 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_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_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x);
|
||||
import void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
|
||||
|
|
|
|||
|
|
@ -144,14 +144,8 @@ static int64 OPB_BoolToInt (BOOLEAN b)
|
|||
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)
|
||||
|
|
@ -274,7 +268,7 @@ OPT_Node OPB_NewString (OPS_String str, int64 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;
|
||||
|
|
@ -1917,7 +1911,7 @@ void OPB_StPar0 (OPT_Node *par0, int32 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 {
|
||||
|
|
@ -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 = (int32)x->conval->intval;
|
||||
L = OPM_Integer(x->conval->intval);
|
||||
typ = p->typ;
|
||||
while ((L > 0 && __IN(typ->comp, 0x0c, 64))) {
|
||||
typ = typ->BaseTyp;
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
export void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len);
|
||||
export void OPM_InitOptions (void);
|
||||
export int32 OPM_Integer (int64 n);
|
||||
static void OPM_LogErrMsg (int32 n);
|
||||
export void OPM_LogW (CHAR ch);
|
||||
export void OPM_LogWLn (void);
|
||||
export void OPM_LogWNum (int64 i, int64 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);
|
||||
export void OPM_Mark (int32 n, int64 pos);
|
||||
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 void OPM_SymRCh (CHAR *ch);
|
||||
export int64 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);
|
||||
|
|
@ -117,6 +120,20 @@ void OPM_LogWLn (void)
|
|||
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)
|
||||
{
|
||||
int32 i;
|
||||
|
|
@ -463,7 +480,7 @@ static void OPM_ShowLine (int64 pos)
|
|||
if (pos >= OPM_ErrorLineLimitPos) {
|
||||
pos = OPM_ErrorLineLimitPos - 1;
|
||||
}
|
||||
i = (int32)(pos - OPM_ErrorLineStartPos);
|
||||
i = (int32)OPM_Longint(pos - OPM_ErrorLineStartPos);
|
||||
while (i > 0) {
|
||||
OPM_LogW(' ');
|
||||
i -= 1;
|
||||
|
|
@ -700,6 +717,15 @@ int64 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, (int64*)&*s);
|
||||
|
|
@ -751,7 +777,7 @@ void OPM_SymWCh (CHAR ch)
|
|||
|
||||
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)
|
||||
|
|
@ -840,9 +866,9 @@ void OPM_WriteHex (int64 i)
|
|||
|
||||
void OPM_WriteInt (int64 i)
|
||||
{
|
||||
CHAR s[20];
|
||||
CHAR s[24];
|
||||
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_WriteInt(i + 1);
|
||||
OPM_WriteString((CHAR*)"-1)", 4);
|
||||
|
|
@ -852,17 +878,17 @@ void OPM_WriteInt (int64 i)
|
|||
i1 = __DIV(i1, 10);
|
||||
k = 1;
|
||||
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);
|
||||
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)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,10 +28,12 @@ import void OPM_FPrintSet (int64 *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 int32 OPM_Integer (int64 n);
|
||||
import void OPM_LogW (CHAR ch);
|
||||
import void OPM_LogWLn (void);
|
||||
import void OPM_LogWNum (int64 i, int64 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_NewSym (CHAR *modName, LONGINT modName__len);
|
||||
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 void OPM_SymRCh (CHAR *ch);
|
||||
import int64 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);
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ static void OPP_CheckSysFlag (int32 *sysflag, int32 default_)
|
|||
OPP_err(51);
|
||||
sf = 0;
|
||||
}
|
||||
*sysflag = (int32)sf;
|
||||
*sysflag = OPM_Integer(sf);
|
||||
OPP_CheckSym(23);
|
||||
} else {
|
||||
*sysflag = default_;
|
||||
|
|
@ -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);
|
||||
|
|
@ -1179,7 +1179,7 @@ static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int32 *n, OPP
|
|||
OPP_ConstExpression(&x);
|
||||
f = x->typ->form;
|
||||
if (__IN(f, 0x18, 64)) {
|
||||
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, int32 *n, OPP
|
|||
if (OPP_sym == 21) {
|
||||
OPS_Get(&OPP_sym);
|
||||
OPP_ConstExpression(&y);
|
||||
yval = y->conval->intval;
|
||||
yval = OPM_Longint(y->conval->intval);
|
||||
if ((y->typ->form != f && !((f == 4 && y->typ->form == 4)))) {
|
||||
OPP_err(60);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue