mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 02:52:24 +00:00
Moving to config independent types stage 1 - generate intxx types.
This commit is contained in:
parent
159f5a3d80
commit
ee8342ef0d
168 changed files with 6673 additions and 6565 deletions
|
|
@ -15,23 +15,23 @@ typedef
|
|||
|
||||
|
||||
static CHAR OPM_SourceFileName[256];
|
||||
export INTEGER OPM_Alignment, OPM_ByteSize, OPM_CharSize, OPM_BoolSize, OPM_SIntSize, OPM_IntSize, OPM_LIntSize, OPM_SetSize, OPM_RealSize, OPM_LRealSize, OPM_PointerSize, OPM_ProcSize, OPM_RecSize, OPM_MaxSet;
|
||||
export LONGINT OPM_MaxIndex;
|
||||
export int32 OPM_Alignment, OPM_ByteSize, OPM_CharSize, OPM_BoolSize, OPM_SIntSize, OPM_IntSize, OPM_LIntSize, OPM_SetSize, OPM_RealSize, OPM_LRealSize, OPM_PointerSize, OPM_ProcSize, OPM_RecSize, OPM_MaxSet;
|
||||
export int64 OPM_MaxIndex;
|
||||
export LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal;
|
||||
export BOOLEAN OPM_noerr;
|
||||
export LONGINT OPM_curpos, OPM_errpos, OPM_breakpc;
|
||||
export INTEGER OPM_currFile, OPM_level, OPM_pc, OPM_entno;
|
||||
export int64 OPM_curpos, OPM_errpos, OPM_breakpc;
|
||||
export int32 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 LONGINT OPM_ErrorLineStartPos, OPM_ErrorLineLimitPos, OPM_ErrorLineNumber, OPM_lasterrpos;
|
||||
static int64 OPM_ErrorLineStartPos, OPM_ErrorLineLimitPos, OPM_ErrorLineNumber, OPM_lasterrpos;
|
||||
static Texts_Reader OPM_inR;
|
||||
static Texts_Text OPM_Log;
|
||||
static Texts_Writer OPM_W;
|
||||
static Files_Rider OPM_oldSF, OPM_newSF;
|
||||
static Files_Rider OPM_R[3];
|
||||
static Files_File OPM_oldSFile, OPM_newSFile, OPM_HFile, OPM_BFile, OPM_HIFile;
|
||||
static INTEGER OPM_S;
|
||||
static int32 OPM_S;
|
||||
export BOOLEAN OPM_dontAsm, OPM_dontLink, OPM_mainProg, OPM_mainLinkStat, OPM_notColorOutput, OPM_forceNewSym, OPM_Verbose;
|
||||
static CHAR OPM_OBERON[1024];
|
||||
static CHAR OPM_MODULES[1024];
|
||||
|
|
@ -41,54 +41,54 @@ 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 (LONGINT *fp, LONGINT val);
|
||||
export void OPM_FPrintLReal (LONGINT *fp, LONGREAL lr);
|
||||
export void OPM_FPrintReal (LONGINT *fp, REAL real);
|
||||
export void OPM_FPrintSet (LONGINT *fp, SET set);
|
||||
static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, LONGINT pos);
|
||||
export void OPM_FPrint (int64 *fp, int64 val);
|
||||
export void OPM_FPrintLReal (int64 *fp, LONGREAL lr);
|
||||
export void OPM_FPrintReal (int64 *fp, REAL real);
|
||||
export void OPM_FPrintSet (int64 *fp, SET set);
|
||||
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, INTEGER *size, INTEGER *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_InitOptions (void);
|
||||
static void OPM_LogErrMsg (INTEGER n);
|
||||
static void OPM_LogErrMsg (int32 n);
|
||||
export void OPM_LogW (CHAR ch);
|
||||
export void OPM_LogWLn (void);
|
||||
export void OPM_LogWNum (LONGINT i, LONGINT len);
|
||||
export void OPM_LogWNum (int64 i, int64 len);
|
||||
export void OPM_LogWStr (CHAR *s, LONGINT s__len);
|
||||
static void OPM_MakeFileName (CHAR *name, LONGINT name__len, CHAR *FName, LONGINT FName__len, CHAR *ext, LONGINT ext__len);
|
||||
export void OPM_Mark (INTEGER n, LONGINT pos);
|
||||
export void OPM_Mark (int32 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 (LONGINT pos);
|
||||
export LONGINT OPM_SignedMaximum (LONGINT bytecount);
|
||||
export LONGINT OPM_SignedMinimum (LONGINT bytecount);
|
||||
static void OPM_ShowLine (int64 pos);
|
||||
export int64 OPM_SignedMaximum (int64 bytecount);
|
||||
export int64 OPM_SignedMinimum (int64 bytecount);
|
||||
export void OPM_SymRCh (CHAR *ch);
|
||||
export LONGINT OPM_SymRInt (void);
|
||||
export int64 OPM_SymRInt (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 (LONGINT 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 (LONGINT i);
|
||||
export void OPM_WriteInt (LONGINT 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);
|
||||
export void OPM_WriteStringVar (CHAR *s, LONGINT s__len);
|
||||
export BOOLEAN OPM_eofSF (void);
|
||||
export void OPM_err (INTEGER n);
|
||||
static LONGINT OPM_minusop (LONGINT i);
|
||||
static LONGINT OPM_power0 (LONGINT i, LONGINT j);
|
||||
export void OPM_err (int32 n);
|
||||
static int64 OPM_minusop (int64 i);
|
||||
static int64 OPM_power0 (int64 i, int64 j);
|
||||
|
||||
|
||||
void OPM_LogW (CHAR ch)
|
||||
|
|
@ -103,7 +103,7 @@ void OPM_LogWStr (CHAR *s, LONGINT s__len)
|
|||
__DEL(s);
|
||||
}
|
||||
|
||||
void OPM_LogWNum (LONGINT i, LONGINT len)
|
||||
void OPM_LogWNum (int64 i, int64 len)
|
||||
{
|
||||
Console_Int(i, len);
|
||||
}
|
||||
|
|
@ -115,7 +115,7 @@ void OPM_LogWLn (void)
|
|||
|
||||
static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt)
|
||||
{
|
||||
INTEGER i;
|
||||
int32 i;
|
||||
i = 1;
|
||||
while (s[__X(i, s__len)] != 0x00) {
|
||||
switch (s[__X(i, s__len)]) {
|
||||
|
|
@ -300,7 +300,7 @@ void OPM_InitOptions (void)
|
|||
void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len)
|
||||
{
|
||||
Texts_Text T = NIL;
|
||||
LONGINT beg, end, time;
|
||||
int64 beg, end, time;
|
||||
CHAR s[256];
|
||||
*done = 0;
|
||||
OPM_curpos = 0;
|
||||
|
|
@ -348,7 +348,7 @@ void OPM_Get (CHAR *ch)
|
|||
|
||||
static void OPM_MakeFileName (CHAR *name, LONGINT name__len, CHAR *FName, LONGINT FName__len, CHAR *ext, LONGINT ext__len)
|
||||
{
|
||||
INTEGER i, j;
|
||||
int32 i, j;
|
||||
CHAR ch;
|
||||
__DUP(ext, ext__len, CHAR);
|
||||
i = 0;
|
||||
|
|
@ -370,12 +370,12 @@ static void OPM_MakeFileName (CHAR *name, LONGINT name__len, CHAR *FName, LONGIN
|
|||
__DEL(ext);
|
||||
}
|
||||
|
||||
static void OPM_LogErrMsg (INTEGER n)
|
||||
static void OPM_LogErrMsg (int32 n)
|
||||
{
|
||||
Texts_Scanner S;
|
||||
Texts_Text T = NIL;
|
||||
CHAR ch;
|
||||
INTEGER i;
|
||||
int32 i;
|
||||
CHAR buf[1024];
|
||||
if (n >= 0) {
|
||||
if (!OPM_notColorOutput) {
|
||||
|
|
@ -400,7 +400,7 @@ static void OPM_LogErrMsg (INTEGER n)
|
|||
OPM_LogWStr(errors_errors[__X(n, 350)], 128);
|
||||
}
|
||||
|
||||
static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, LONGINT pos)
|
||||
static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, int64 pos)
|
||||
{
|
||||
CHAR ch, cheol;
|
||||
if (pos < OPM_ErrorLineStartPos) {
|
||||
|
|
@ -432,12 +432,12 @@ static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, LONGINT
|
|||
Files_Set(&*r, r__typ, f, OPM_ErrorLineStartPos);
|
||||
}
|
||||
|
||||
static void OPM_ShowLine (LONGINT pos)
|
||||
static void OPM_ShowLine (int64 pos)
|
||||
{
|
||||
Files_File f = NIL;
|
||||
Files_Rider r;
|
||||
CHAR line[1023];
|
||||
INTEGER i;
|
||||
int32 i;
|
||||
CHAR ch;
|
||||
f = Files_Old(OPM_SourceFileName, 256);
|
||||
OPM_FindLine(f, &r, Files_Rider__typ, pos);
|
||||
|
|
@ -459,7 +459,7 @@ static void OPM_ShowLine (LONGINT pos)
|
|||
if (pos >= OPM_ErrorLineLimitPos) {
|
||||
pos = OPM_ErrorLineLimitPos - 1;
|
||||
}
|
||||
i = (SYSTEM_INT32)(pos - OPM_ErrorLineStartPos);
|
||||
i = (int32)(pos - OPM_ErrorLineStartPos);
|
||||
while (i > 0) {
|
||||
OPM_LogW(' ');
|
||||
i -= 1;
|
||||
|
|
@ -474,7 +474,7 @@ static void OPM_ShowLine (LONGINT pos)
|
|||
Files_Close(f);
|
||||
}
|
||||
|
||||
void OPM_Mark (INTEGER n, LONGINT pos)
|
||||
void OPM_Mark (int32 n, int64 pos)
|
||||
{
|
||||
if (pos == -1) {
|
||||
pos = 0;
|
||||
|
|
@ -526,49 +526,49 @@ void OPM_Mark (INTEGER n, LONGINT pos)
|
|||
}
|
||||
}
|
||||
|
||||
void OPM_err (INTEGER n)
|
||||
void OPM_err (int32 n)
|
||||
{
|
||||
OPM_Mark(n, OPM_errpos);
|
||||
}
|
||||
|
||||
void OPM_FPrint (LONGINT *fp, LONGINT val)
|
||||
void OPM_FPrint (int64 *fp, int64 val)
|
||||
{
|
||||
*fp = __ROTL((LONGINT)((SET)*fp ^ (SET)val), 1, LONGINT);
|
||||
*fp = __ROTL((int64)((SET)*fp ^ (SET)val), 1, int64);
|
||||
}
|
||||
|
||||
void OPM_FPrintSet (LONGINT *fp, SET set)
|
||||
void OPM_FPrintSet (int64 *fp, SET set)
|
||||
{
|
||||
OPM_FPrint(&*fp, (LONGINT)set);
|
||||
OPM_FPrint(&*fp, (int64)set);
|
||||
}
|
||||
|
||||
void OPM_FPrintReal (LONGINT *fp, REAL real)
|
||||
void OPM_FPrintReal (int64 *fp, REAL real)
|
||||
{
|
||||
INTEGER i;
|
||||
LONGINT l;
|
||||
__GET((SYSTEM_ADRINT)&real, i, INTEGER);
|
||||
int32 i;
|
||||
int64 l;
|
||||
__GET((SYSTEM_ADRINT)&real, i, int32);
|
||||
l = i;
|
||||
OPM_FPrint(&*fp, l);
|
||||
}
|
||||
|
||||
void OPM_FPrintLReal (LONGINT *fp, LONGREAL lr)
|
||||
void OPM_FPrintLReal (int64 *fp, LONGREAL lr)
|
||||
{
|
||||
LONGINT l, h;
|
||||
OPM_FPrint(&*fp, __VAL(LONGINT, lr));
|
||||
int64 l, h;
|
||||
OPM_FPrint(&*fp, __VAL(int64, lr));
|
||||
}
|
||||
|
||||
static void OPM_GetProperty (Texts_Scanner *S, LONGINT *S__typ, CHAR *name, LONGINT name__len, INTEGER *size, INTEGER *align)
|
||||
static void OPM_GetProperty (Texts_Scanner *S, LONGINT *S__typ, CHAR *name, LONGINT name__len, int32 *size, int32 *align)
|
||||
{
|
||||
__DUP(name, name__len, CHAR);
|
||||
if (((*S).class == 1 && __STRCMP((*S).s, name) == 0)) {
|
||||
Texts_Scan(&*S, S__typ);
|
||||
if ((*S).class == 3) {
|
||||
*size = (SYSTEM_INT32)(*S).i;
|
||||
*size = (int32)(*S).i;
|
||||
Texts_Scan(&*S, S__typ);
|
||||
} else {
|
||||
OPM_Mark(-157, -1);
|
||||
}
|
||||
if ((*S).class == 3) {
|
||||
*align = (SYSTEM_INT32)(*S).i;
|
||||
*align = (int32)(*S).i;
|
||||
Texts_Scan(&*S, S__typ);
|
||||
} else {
|
||||
OPM_Mark(-157, -1);
|
||||
|
|
@ -579,17 +579,17 @@ static void OPM_GetProperty (Texts_Scanner *S, LONGINT *S__typ, CHAR *name, LONG
|
|||
__DEL(name);
|
||||
}
|
||||
|
||||
static LONGINT OPM_minusop (LONGINT i)
|
||||
static int64 OPM_minusop (int64 i)
|
||||
{
|
||||
LONGINT _o_result;
|
||||
int64 _o_result;
|
||||
_o_result = -i;
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
static LONGINT OPM_power0 (LONGINT i, LONGINT j)
|
||||
static int64 OPM_power0 (int64 i, int64 j)
|
||||
{
|
||||
LONGINT _o_result;
|
||||
LONGINT k, p;
|
||||
int64 _o_result;
|
||||
int64 k, p;
|
||||
k = 1;
|
||||
p = i;
|
||||
do {
|
||||
|
|
@ -641,19 +641,19 @@ static void OPM_VerboseListSizes (void)
|
|||
OPM_LogWLn();
|
||||
}
|
||||
|
||||
LONGINT OPM_SignedMaximum (LONGINT bytecount)
|
||||
int64 OPM_SignedMaximum (int64 bytecount)
|
||||
{
|
||||
LONGINT _o_result;
|
||||
LONGINT result;
|
||||
int64 _o_result;
|
||||
int64 result;
|
||||
result = 1;
|
||||
result = __LSH(result, __ASHL(bytecount, 3) - 1, LONGINT);
|
||||
result = __LSH(result, __ASHL(bytecount, 3) - 1, int64);
|
||||
_o_result = result - 1;
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
LONGINT OPM_SignedMinimum (LONGINT bytecount)
|
||||
int64 OPM_SignedMinimum (int64 bytecount)
|
||||
{
|
||||
LONGINT _o_result;
|
||||
int64 _o_result;
|
||||
_o_result = -OPM_SignedMaximum(bytecount) - 1;
|
||||
return _o_result;
|
||||
}
|
||||
|
|
@ -687,10 +687,10 @@ void OPM_SymRCh (CHAR *ch)
|
|||
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&*ch);
|
||||
}
|
||||
|
||||
LONGINT OPM_SymRInt (void)
|
||||
int64 OPM_SymRInt (void)
|
||||
{
|
||||
LONGINT _o_result;
|
||||
LONGINT k;
|
||||
int64 _o_result;
|
||||
int64 k;
|
||||
Files_ReadNum(&OPM_oldSF, Files_Rider__typ, &k);
|
||||
_o_result = k;
|
||||
return _o_result;
|
||||
|
|
@ -698,7 +698,7 @@ LONGINT OPM_SymRInt (void)
|
|||
|
||||
void OPM_SymRSet (SET *s)
|
||||
{
|
||||
Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (LONGINT*)&*s);
|
||||
Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (int64*)&*s);
|
||||
}
|
||||
|
||||
void OPM_SymRReal (REAL *r)
|
||||
|
|
@ -745,14 +745,14 @@ void OPM_SymWCh (CHAR ch)
|
|||
Files_Write(&OPM_newSF, Files_Rider__typ, ch);
|
||||
}
|
||||
|
||||
void OPM_SymWInt (LONGINT i)
|
||||
void OPM_SymWInt (int64 i)
|
||||
{
|
||||
Files_WriteNum(&OPM_newSF, Files_Rider__typ, i);
|
||||
}
|
||||
|
||||
void OPM_SymWSet (SET s)
|
||||
{
|
||||
Files_WriteNum(&OPM_newSF, Files_Rider__typ, (LONGINT)s);
|
||||
Files_WriteNum(&OPM_newSF, Files_Rider__typ, (int64)s);
|
||||
}
|
||||
|
||||
void OPM_SymWReal (REAL r)
|
||||
|
|
@ -796,7 +796,7 @@ void OPM_Write (CHAR ch)
|
|||
|
||||
void OPM_WriteString (CHAR *s, LONGINT s__len)
|
||||
{
|
||||
INTEGER i;
|
||||
int32 i;
|
||||
i = 0;
|
||||
while (s[__X(i, s__len)] != 0x00) {
|
||||
i += 1;
|
||||
|
|
@ -806,7 +806,7 @@ void OPM_WriteString (CHAR *s, LONGINT s__len)
|
|||
|
||||
void OPM_WriteStringVar (CHAR *s, LONGINT s__len)
|
||||
{
|
||||
INTEGER i;
|
||||
int32 i;
|
||||
i = 0;
|
||||
while (s[__X(i, s__len)] != 0x00) {
|
||||
i += 1;
|
||||
|
|
@ -814,17 +814,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 (LONGINT i)
|
||||
void OPM_WriteHex (int64 i)
|
||||
{
|
||||
CHAR s[3];
|
||||
INTEGER digit;
|
||||
digit = __ASHR((SYSTEM_INT32)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((SYSTEM_INT32)i, -16);
|
||||
digit = __MASK((int32)i, -16);
|
||||
if (digit < 10) {
|
||||
s[1] = (CHAR)(48 + digit);
|
||||
} else {
|
||||
|
|
@ -834,10 +834,10 @@ void OPM_WriteHex (LONGINT i)
|
|||
OPM_WriteString(s, 3);
|
||||
}
|
||||
|
||||
void OPM_WriteInt (LONGINT i)
|
||||
void OPM_WriteInt (int64 i)
|
||||
{
|
||||
CHAR s[20];
|
||||
LONGINT i1, k;
|
||||
int64 i1, k;
|
||||
if (i == OPM_SignedMinimum(OPM_IntSize) || i == OPM_SignedMinimum(OPM_LIntSize)) {
|
||||
OPM_Write('(');
|
||||
OPM_WriteInt(i + 1);
|
||||
|
|
@ -870,7 +870,7 @@ void OPM_WriteReal (LONGREAL r, CHAR suffx)
|
|||
Texts_Reader R;
|
||||
CHAR s[32];
|
||||
CHAR ch;
|
||||
INTEGER i;
|
||||
int32 i;
|
||||
if ((((r < OPM_SignedMaximum(OPM_LIntSize) && r > OPM_SignedMinimum(OPM_LIntSize))) && r == (__ENTIER(r)))) {
|
||||
if (suffx == 'f') {
|
||||
OPM_WriteString((CHAR*)"(REAL)", 7);
|
||||
|
|
@ -958,7 +958,7 @@ void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len)
|
|||
void OPM_CloseFiles (void)
|
||||
{
|
||||
CHAR FName[32];
|
||||
INTEGER res;
|
||||
int32 res;
|
||||
if (OPM_noerr) {
|
||||
OPM_LogWStr((CHAR*)" ", 3);
|
||||
OPM_LogWNum(Files_Pos(&OPM_R[1], Files_Rider__typ), 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue