mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-05 23:22:25 +00:00
Reenable library files, fix LONGREAL constants and type casts.
This commit is contained in:
parent
ef0a447a68
commit
9ffafc59b4
229 changed files with 11147 additions and 11288 deletions
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -32,7 +32,7 @@ void Compiler_Module (BOOLEAN *done)
|
|||
{
|
||||
BOOLEAN ext, new;
|
||||
OPT_Node p = NIL;
|
||||
OPP_Module(&p, OPM_opt);
|
||||
OPP_Module(&p, OPM_Options);
|
||||
if (OPM_noerr) {
|
||||
OPV_Init();
|
||||
OPT_InitRecno();
|
||||
|
|
@ -43,22 +43,22 @@ void Compiler_Module (BOOLEAN *done)
|
|||
OPC_Init();
|
||||
OPV_Module(p);
|
||||
if (OPM_noerr) {
|
||||
if ((__IN(10, OPM_opt, 32) && __STRCMP(OPM_modName, "SYSTEM") != 0)) {
|
||||
if ((__IN(10, OPM_Options, 32) && __STRCMP(OPM_modName, "SYSTEM") != 0)) {
|
||||
OPM_DeleteNewSym();
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"32m", 4);
|
||||
}
|
||||
OPM_LogWStr((CHAR*)" Main program.", 16);
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"0m", 3);
|
||||
}
|
||||
} else {
|
||||
if (new) {
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"32m", 4);
|
||||
}
|
||||
OPM_LogWStr((CHAR*)" New symbol file.", 19);
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"0m", 3);
|
||||
}
|
||||
OPM_RegisterNewSym();
|
||||
|
|
@ -115,17 +115,17 @@ void Compiler_Translate (void)
|
|||
OPM_LogWLn();
|
||||
Platform_Exit(1);
|
||||
}
|
||||
if (!__IN(13, OPM_opt, 32)) {
|
||||
if (__IN(14, OPM_opt, 32)) {
|
||||
if (!__IN(13, OPM_Options, 32)) {
|
||||
if (__IN(14, OPM_Options, 32)) {
|
||||
extTools_Assemble(OPM_modName, 32);
|
||||
} else {
|
||||
if (!__IN(10, OPM_opt, 32)) {
|
||||
if (!__IN(10, OPM_Options, 32)) {
|
||||
extTools_Assemble(OPM_modName, 32);
|
||||
Strings_Append((CHAR*)" ", 2, (void*)modulesobj, 2048);
|
||||
Strings_Append(OPM_modName, 32, (void*)modulesobj, 2048);
|
||||
Strings_Append((CHAR*)".o", 3, (void*)modulesobj, 2048);
|
||||
} else {
|
||||
extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_opt, 32), modulesobj, 2048);
|
||||
extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_Options, 32), modulesobj, 2048);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -18,6 +18,6 @@ export void *Configuration__init(void)
|
|||
__DEFMOD;
|
||||
__REGMOD("Configuration", 0);
|
||||
/* BEGIN */
|
||||
__MOVE("1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75);
|
||||
__MOVE("1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75);
|
||||
__ENDMOD;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef Configuration__h
|
||||
#define Configuration__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef Console__h
|
||||
#define Console__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
|
||||
#ifndef Files__h
|
||||
#define Files__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
|
||||
|
||||
#ifndef Heap__h
|
||||
#define Heap__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef Modules__h
|
||||
#define Modules__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -1541,28 +1541,9 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode)
|
|||
OPT_Struct y = NIL;
|
||||
int16 f, g;
|
||||
OPT_Struct p = NIL, q = NIL;
|
||||
if (__IN(18, OPM_opt, 32)) {
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"PROCEDURE CheckAssign", 22);
|
||||
OPM_LogWLn();
|
||||
}
|
||||
y = ynode->typ;
|
||||
f = x->form;
|
||||
g = y->form;
|
||||
if (__IN(18, OPM_opt, 32)) {
|
||||
OPM_LogWStr((CHAR*)"y.form = ", 10);
|
||||
OPM_LogWNum(y->form, 0);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"f = ", 5);
|
||||
OPM_LogWNum(f, 0);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"g = ", 5);
|
||||
OPM_LogWNum(g, 0);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"ynode.typ.syze = ", 18);
|
||||
OPM_LogWNum(ynode->typ->size, 0);
|
||||
OPM_LogWLn();
|
||||
}
|
||||
if (ynode->class == 8 || (ynode->class == 9 && f != 12)) {
|
||||
OPB_err(126);
|
||||
}
|
||||
|
|
@ -2367,7 +2348,7 @@ static void OPB_DynArrParCheck (OPT_Struct ftyp, OPT_Struct atyp, BOOLEAN fvarpa
|
|||
atyp = atyp->BaseTyp;
|
||||
if ((fvarpar && ftyp == OPT_bytetyp)) {
|
||||
if (!__IN(f, 0x0c, 32) || !((__IN(atyp->form, 0x1e, 32) && atyp->size == 1))) {
|
||||
if (__IN(18, OPM_opt, 32)) {
|
||||
if (__IN(18, OPM_Options, 32)) {
|
||||
OPB_err(-301);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef OPB__h
|
||||
#define OPB__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -989,7 +989,7 @@ static void OPC_IdentList (OPT_Object obj, int16 vis)
|
|||
OPC_Ident(obj);
|
||||
OPM_WriteString((CHAR*)"__typ", 6);
|
||||
base = NIL;
|
||||
} else if ((((((__IN(5, OPM_opt, 32) && vis == 0)) && obj->mnolev > 0)) && obj->typ->form == 11)) {
|
||||
} else if ((((((__IN(5, OPM_Options, 32) && vis == 0)) && obj->mnolev > 0)) && obj->typ->form == 11)) {
|
||||
OPM_WriteString((CHAR*)" = NIL", 7);
|
||||
}
|
||||
}
|
||||
|
|
@ -1153,7 +1153,7 @@ static void OPC_GenHeaderMsg (void)
|
|||
OPM_Write(' ');
|
||||
i = 0;
|
||||
while (i <= 31) {
|
||||
if (__IN(i, OPM_glbopt, 32)) {
|
||||
if (__IN(i, OPM_Options, 32)) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
OPM_Write('x');
|
||||
|
|
@ -1355,7 +1355,7 @@ void OPC_EnterBody (void)
|
|||
{
|
||||
OPM_WriteLn();
|
||||
OPM_WriteString((CHAR*)"export ", 8);
|
||||
if (__IN(10, OPM_opt, 32)) {
|
||||
if (__IN(10, OPM_Options, 32)) {
|
||||
OPM_WriteString((CHAR*)"int main(int argc, char **argv)", 32);
|
||||
OPM_WriteLn();
|
||||
} else {
|
||||
|
|
@ -1366,20 +1366,20 @@ void OPC_EnterBody (void)
|
|||
}
|
||||
OPC_BegBlk();
|
||||
OPC_BegStat();
|
||||
if (__IN(10, OPM_opt, 32)) {
|
||||
if (__IN(10, OPM_Options, 32)) {
|
||||
OPM_WriteString((CHAR*)"__INIT(argc, argv)", 19);
|
||||
} else {
|
||||
OPM_WriteString((CHAR*)"__DEFMOD", 9);
|
||||
}
|
||||
OPC_EndStat();
|
||||
if ((__IN(10, OPM_opt, 32) && 0)) {
|
||||
if ((__IN(10, OPM_Options, 32) && 0)) {
|
||||
OPC_BegStat();
|
||||
OPM_WriteString((CHAR*)"/*don`t do it!*/ printf(\"DEMO VERSION: DO NOT USE THIS PROGRAM FOR ANY COMMERCIAL PURPOSE\\n\")", 94);
|
||||
OPC_EndStat();
|
||||
}
|
||||
OPC_InitImports(OPT_topScope->right);
|
||||
OPC_BegStat();
|
||||
if (__IN(10, OPM_opt, 32)) {
|
||||
if (__IN(10, OPM_Options, 32)) {
|
||||
OPM_WriteString((CHAR*)"__REGMAIN(\"", 12);
|
||||
} else {
|
||||
OPM_WriteString((CHAR*)"__REGMOD(\"", 11);
|
||||
|
|
@ -1399,7 +1399,7 @@ void OPC_EnterBody (void)
|
|||
void OPC_ExitBody (void)
|
||||
{
|
||||
OPC_BegStat();
|
||||
if (__IN(10, OPM_opt, 32)) {
|
||||
if (__IN(10, OPM_Options, 32)) {
|
||||
OPM_WriteString((CHAR*)"__FINI;", 8);
|
||||
} else {
|
||||
OPM_WriteString((CHAR*)"__ENDMOD;", 10);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef OPC__h
|
||||
#define OPC__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -19,7 +19,14 @@ typedef
|
|||
|
||||
|
||||
static CHAR OPM_SourceFileName[256];
|
||||
export int16 OPM_AddressSize, OPM_Alignment, OPM_SetSize, OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_MaxSet;
|
||||
static CHAR OPM_GlobalModel[10];
|
||||
export CHAR OPM_Model[10];
|
||||
static int16 OPM_GlobalAddressSize;
|
||||
export int16 OPM_AddressSize;
|
||||
static int16 OPM_GlobalAlignment;
|
||||
export int16 OPM_Alignment;
|
||||
export SET OPM_GlobalOptions, OPM_Options;
|
||||
export int16 OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_SetSize, OPM_MaxSet;
|
||||
export int64 OPM_MaxIndex;
|
||||
export LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal;
|
||||
export BOOLEAN OPM_noerr;
|
||||
|
|
@ -27,7 +34,6 @@ export int32 OPM_curpos, OPM_errpos, OPM_breakpc;
|
|||
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 Texts_Reader OPM_inR;
|
||||
static Texts_Text OPM_Log;
|
||||
|
|
@ -36,8 +42,7 @@ 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 int16 OPM_S;
|
||||
static CHAR OPM_OBERON[1024];
|
||||
static CHAR OPM_MODULES[1024];
|
||||
export CHAR OPM_ResourceDir[1024];
|
||||
|
||||
|
||||
static void OPM_Append (Files_Rider *R, address *R__typ, Files_File F);
|
||||
|
|
@ -50,8 +55,6 @@ 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, address *r__typ, int64 pos);
|
||||
export void OPM_Get (CHAR *ch);
|
||||
static void OPM_GetProperties (void);
|
||||
static void OPM_GetProperty (Texts_Scanner *S, address *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);
|
||||
|
|
@ -68,7 +71,7 @@ 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_ScanOptions (CHAR *s, LONGINT s__len);
|
||||
static void OPM_ShowLine (int64 pos);
|
||||
export int64 OPM_SignedMaximum (int32 bytecount);
|
||||
export int64 OPM_SignedMinimum (int32 bytecount);
|
||||
|
|
@ -93,10 +96,8 @@ 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 (int16 n);
|
||||
static int32 OPM_minusop (int32 i);
|
||||
static int32 OPM_power0 (int32 i, int32 j);
|
||||
|
||||
#define OPM_GetAlignment(a) struct {char c; long long l;} s; *a = (char*)&s.l - (char*)&s
|
||||
#define OPM_GetAlignment(a) struct {char c; long long l;} _s; *a = (char*)&_s.l - (char*)&_s
|
||||
|
||||
void OPM_LogW (CHAR ch)
|
||||
{
|
||||
|
|
@ -120,6 +121,23 @@ void OPM_LogWLn (void)
|
|||
Console_Ln();
|
||||
}
|
||||
|
||||
int64 OPM_SignedMaximum (int32 bytecount)
|
||||
{
|
||||
int64 _o_result;
|
||||
int64 result;
|
||||
result = 1;
|
||||
result = __LSH(result, __ASHL(bytecount, 3) - 1, 64);
|
||||
_o_result = result - 1;
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
int64 OPM_SignedMinimum (int32 bytecount)
|
||||
{
|
||||
int64 _o_result;
|
||||
_o_result = -OPM_SignedMaximum(bytecount) - 1;
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
int32 OPM_Longint (int64 n)
|
||||
{
|
||||
int32 _o_result;
|
||||
|
|
@ -134,7 +152,7 @@ int16 OPM_Integer (int64 n)
|
|||
return _o_result;
|
||||
}
|
||||
|
||||
static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt)
|
||||
static void OPM_ScanOptions (CHAR *s, LONGINT s__len)
|
||||
{
|
||||
int16 i;
|
||||
__DUP(s, s__len, CHAR);
|
||||
|
|
@ -142,75 +160,57 @@ static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt)
|
|||
while (s[__X(i, s__len)] != 0x00) {
|
||||
switch (s[__X(i, s__len)]) {
|
||||
case 'p':
|
||||
*opt = *opt ^ 0x20;
|
||||
OPM_Options = OPM_Options ^ 0x20;
|
||||
break;
|
||||
case 'a':
|
||||
*opt = *opt ^ 0x80;
|
||||
OPM_Options = OPM_Options ^ 0x80;
|
||||
break;
|
||||
case 'r':
|
||||
*opt = *opt ^ 0x04;
|
||||
OPM_Options = OPM_Options ^ 0x04;
|
||||
break;
|
||||
case 't':
|
||||
*opt = *opt ^ 0x08;
|
||||
OPM_Options = OPM_Options ^ 0x08;
|
||||
break;
|
||||
case 'x':
|
||||
*opt = *opt ^ 0x01;
|
||||
OPM_Options = OPM_Options ^ 0x01;
|
||||
break;
|
||||
case 'e':
|
||||
*opt = *opt ^ 0x0200;
|
||||
OPM_Options = OPM_Options ^ 0x0200;
|
||||
break;
|
||||
case 's':
|
||||
*opt = *opt ^ 0x10;
|
||||
OPM_Options = OPM_Options ^ 0x10;
|
||||
break;
|
||||
case 'F':
|
||||
*opt = *opt ^ 0x020000;
|
||||
OPM_Options = OPM_Options ^ 0x020000;
|
||||
break;
|
||||
case 'm':
|
||||
*opt = *opt ^ 0x0400;
|
||||
OPM_Options = OPM_Options ^ 0x0400;
|
||||
break;
|
||||
case 'M':
|
||||
*opt = *opt ^ 0x8000;
|
||||
OPM_Options = OPM_Options ^ 0x8000;
|
||||
break;
|
||||
case 'S':
|
||||
*opt = *opt ^ 0x2000;
|
||||
OPM_Options = OPM_Options ^ 0x2000;
|
||||
break;
|
||||
case 'c':
|
||||
*opt = *opt ^ 0x4000;
|
||||
OPM_Options = OPM_Options ^ 0x4000;
|
||||
break;
|
||||
case 'f':
|
||||
*opt = *opt ^ 0x010000;
|
||||
OPM_Options = OPM_Options ^ 0x010000;
|
||||
break;
|
||||
case 'V':
|
||||
*opt = *opt ^ 0x040000;
|
||||
OPM_Options = OPM_Options ^ 0x040000;
|
||||
break;
|
||||
case 'O':
|
||||
if (i + 1 >= Strings_Length(s, s__len)) {
|
||||
OPM_LogWStr((CHAR*)"-O option requires following size model character.", 51);
|
||||
OPM_LogWLn();
|
||||
} else {
|
||||
switch (s[__X(i + 1, s__len)]) {
|
||||
case '2':
|
||||
OPM_ShortintSize = 1;
|
||||
OPM_IntegerSize = 2;
|
||||
OPM_LongintSize = 4;
|
||||
OPM_SetSize = 4;
|
||||
break;
|
||||
case 'V':
|
||||
OPM_ShortintSize = 1;
|
||||
OPM_IntegerSize = 4;
|
||||
OPM_LongintSize = 8;
|
||||
OPM_SetSize = 8;
|
||||
break;
|
||||
case 'C':
|
||||
OPM_ShortintSize = 2;
|
||||
OPM_IntegerSize = 4;
|
||||
OPM_LongintSize = 8;
|
||||
OPM_SetSize = 8;
|
||||
break;
|
||||
default:
|
||||
OPM_LogWStr((CHAR*)"Unrecognised size model character following -O.", 48);
|
||||
OPM_LogWLn();
|
||||
break;
|
||||
OPM_Model[0] = s[__X(i + 1, s__len)];
|
||||
OPM_Model[1] = 0x00;
|
||||
if ((((OPM_Model[0] != '2' && OPM_Model[0] != 'C')) && OPM_Model[0] != 'V')) {
|
||||
OPM_LogWStr((CHAR*)"Unrecognised size model character following -O.", 48);
|
||||
OPM_LogWLn();
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
|
|
@ -358,39 +358,119 @@ BOOLEAN OPM_OpenPar (void)
|
|||
_o_result = 0;
|
||||
return _o_result;
|
||||
} else {
|
||||
OPM_AddressSize = 4;
|
||||
OPM_GetAlignment(&OPM_Alignment);
|
||||
__MOVE("2", OPM_Model, 2);
|
||||
OPM_Options = 0xa9;
|
||||
OPM_S = 1;
|
||||
s[0] = 0x00;
|
||||
Platform_GetArg(OPM_S, (void*)s, 256);
|
||||
OPM_glbopt = 0xa9;
|
||||
while (s[0] == '-') {
|
||||
OPM_ScanOptions(s, 256, &OPM_glbopt);
|
||||
OPM_ScanOptions(s, 256);
|
||||
OPM_S += 1;
|
||||
s[0] = 0x00;
|
||||
Platform_GetArg(OPM_S, (void*)s, 256);
|
||||
}
|
||||
OPM_GlobalAddressSize = OPM_AddressSize;
|
||||
OPM_GlobalAlignment = OPM_Alignment;
|
||||
__COPY(OPM_Model, OPM_GlobalModel, 10);
|
||||
OPM_GlobalOptions = OPM_Options;
|
||||
_o_result = 1;
|
||||
return _o_result;
|
||||
}
|
||||
__RETCHK;
|
||||
}
|
||||
|
||||
static void OPM_VerboseListSizes (void)
|
||||
{
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"Type Size", 15);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"SHORTINT ", 12);
|
||||
OPM_LogWNum(OPM_ShortintSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"INTEGER ", 12);
|
||||
OPM_LogWNum(OPM_IntegerSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"LONGINT ", 12);
|
||||
OPM_LogWNum(OPM_LongintSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"SET ", 12);
|
||||
OPM_LogWNum(OPM_SetSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"ADDRESS ", 12);
|
||||
OPM_LogWNum(OPM_AddressSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"Alignment: ", 12);
|
||||
OPM_LogWNum(OPM_Alignment, 4);
|
||||
OPM_LogWLn();
|
||||
}
|
||||
|
||||
void OPM_InitOptions (void)
|
||||
{
|
||||
CHAR s[256];
|
||||
OPM_opt = OPM_glbopt;
|
||||
CHAR searchpath[1024], modules[1024];
|
||||
CHAR MODULES[1024];
|
||||
OPM_Options = OPM_GlobalOptions;
|
||||
__COPY(OPM_GlobalModel, OPM_Model, 10);
|
||||
OPM_Alignment = OPM_GlobalAlignment;
|
||||
OPM_AddressSize = OPM_GlobalAddressSize;
|
||||
s[0] = 0x00;
|
||||
Platform_GetArg(OPM_S, (void*)s, 256);
|
||||
while (s[0] == '-') {
|
||||
OPM_ScanOptions(s, 256, &OPM_opt);
|
||||
OPM_ScanOptions(s, 256);
|
||||
OPM_S += 1;
|
||||
s[0] = 0x00;
|
||||
Platform_GetArg(OPM_S, (void*)s, 256);
|
||||
}
|
||||
if (__IN(15, OPM_opt, 32)) {
|
||||
OPM_glbopt |= __SETOF(10,32);
|
||||
OPM_opt |= __SETOF(10,32);
|
||||
if (__IN(15, OPM_Options, 32)) {
|
||||
OPM_Options |= __SETOF(10,32);
|
||||
}
|
||||
OPM_GetProperties();
|
||||
OPM_MaxIndex = OPM_SignedMaximum(OPM_AddressSize);
|
||||
switch (OPM_Model[0]) {
|
||||
case '2':
|
||||
OPM_ShortintSize = 1;
|
||||
OPM_IntegerSize = 2;
|
||||
OPM_LongintSize = 4;
|
||||
OPM_SetSize = 4;
|
||||
break;
|
||||
case 'C':
|
||||
OPM_ShortintSize = 2;
|
||||
OPM_IntegerSize = 4;
|
||||
OPM_LongintSize = 8;
|
||||
OPM_SetSize = 8;
|
||||
break;
|
||||
case 'V':
|
||||
OPM_ShortintSize = 1;
|
||||
OPM_IntegerSize = 4;
|
||||
OPM_LongintSize = 8;
|
||||
OPM_SetSize = 8;
|
||||
break;
|
||||
default:
|
||||
OPM_ShortintSize = 1;
|
||||
OPM_IntegerSize = 2;
|
||||
OPM_LongintSize = 4;
|
||||
OPM_SetSize = 4;
|
||||
break;
|
||||
}
|
||||
OPM_MaxSet = __ASHL(OPM_SetSize, 3) - 1;
|
||||
if (__IN(18, OPM_Options, 32)) {
|
||||
OPM_VerboseListSizes();
|
||||
}
|
||||
OPM_ResourceDir[0] = 0x00;
|
||||
Strings_Append((CHAR*)"/", 2, (void*)OPM_ResourceDir, 1024);
|
||||
Strings_Append(OPM_Model, 10, (void*)OPM_ResourceDir, 1024);
|
||||
modules[0] = 0x00;
|
||||
Platform_GetEnv((CHAR*)"MODULES", 8, (void*)modules, 1024);
|
||||
__MOVE(".", searchpath, 2);
|
||||
Platform_GetEnv((CHAR*)"OBERON", 7, (void*)searchpath, 1024);
|
||||
Strings_Append((CHAR*)";.;", 4, (void*)searchpath, 1024);
|
||||
Strings_Append(modules, 1024, (void*)searchpath, 1024);
|
||||
Strings_Append((CHAR*)";", 2, (void*)searchpath, 1024);
|
||||
Strings_Append(OPM_ResourceDir, 1024, (void*)searchpath, 1024);
|
||||
Strings_Append((CHAR*)"/sym;", 6, (void*)searchpath, 1024);
|
||||
Files_SetSearchPath(searchpath, 1024);
|
||||
}
|
||||
|
||||
void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len)
|
||||
|
|
@ -474,20 +554,20 @@ static void OPM_LogErrMsg (int16 n)
|
|||
int16 i;
|
||||
CHAR buf[1024];
|
||||
if (n >= 0) {
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"31m", 4);
|
||||
}
|
||||
OPM_LogWStr((CHAR*)" err ", 7);
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"0m", 3);
|
||||
}
|
||||
} else {
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"35m", 4);
|
||||
}
|
||||
OPM_LogWStr((CHAR*)" warning ", 11);
|
||||
n = -n;
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"0m", 3);
|
||||
}
|
||||
}
|
||||
|
|
@ -560,11 +640,11 @@ static void OPM_ShowLine (int64 pos)
|
|||
OPM_LogW(' ');
|
||||
i -= 1;
|
||||
}
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"32m", 4);
|
||||
}
|
||||
OPM_LogW('^');
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"0m", 3);
|
||||
}
|
||||
Files_Close(f);
|
||||
|
|
@ -654,106 +734,6 @@ void OPM_FPrintLReal (int32 *fp, LONGREAL lr)
|
|||
OPM_FPrint(&*fp, h);
|
||||
}
|
||||
|
||||
static void OPM_GetProperty (Texts_Scanner *S, address *S__typ, CHAR *name, LONGINT name__len, int16 *size, int16 *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 = (int16)(*S).i;
|
||||
Texts_Scan(&*S, S__typ);
|
||||
} else {
|
||||
OPM_Mark(-157, -1);
|
||||
}
|
||||
if ((*S).class == 3) {
|
||||
*align = (int16)(*S).i;
|
||||
Texts_Scan(&*S, S__typ);
|
||||
} else {
|
||||
OPM_Mark(-157, -1);
|
||||
}
|
||||
} else {
|
||||
OPM_Mark(-157, -1);
|
||||
}
|
||||
__DEL(name);
|
||||
}
|
||||
|
||||
static int32 OPM_minusop (int32 i)
|
||||
{
|
||||
int32 _o_result;
|
||||
_o_result = -i;
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
static int32 OPM_power0 (int32 i, int32 j)
|
||||
{
|
||||
int32 _o_result;
|
||||
int32 k, p;
|
||||
k = 1;
|
||||
p = i;
|
||||
do {
|
||||
p = p * i;
|
||||
k += 1;
|
||||
} while (!(k == j));
|
||||
_o_result = p;
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
static void OPM_VerboseListSizes (void)
|
||||
{
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"Type Size", 17);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"SHORTINT ", 14);
|
||||
OPM_LogWNum(OPM_ShortintSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"INTEGER ", 14);
|
||||
OPM_LogWNum(OPM_IntegerSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"LONGINT ", 14);
|
||||
OPM_LogWNum(OPM_LongintSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"SET ", 14);
|
||||
OPM_LogWNum(OPM_SetSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"ADDRESS ", 14);
|
||||
OPM_LogWNum(OPM_AddressSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"Alignment: ", 12);
|
||||
OPM_LogWNum(OPM_Alignment, 4);
|
||||
OPM_LogWLn();
|
||||
}
|
||||
|
||||
int64 OPM_SignedMaximum (int32 bytecount)
|
||||
{
|
||||
int64 _o_result;
|
||||
int64 result;
|
||||
result = 1;
|
||||
result = __LSH(result, __ASHL(bytecount, 3) - 1, 64);
|
||||
_o_result = result - 1;
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
int64 OPM_SignedMinimum (int32 bytecount)
|
||||
{
|
||||
int64 _o_result;
|
||||
_o_result = -OPM_SignedMaximum(bytecount) - 1;
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
static void OPM_GetProperties (void)
|
||||
{
|
||||
OPM_MaxReal = 3.40282346000000e+038;
|
||||
OPM_MaxLReal = 1.79769296342094e+308;
|
||||
OPM_MinReal = -OPM_MaxReal;
|
||||
OPM_MinLReal = -OPM_MaxLReal;
|
||||
OPM_MaxSet = __ASHL(OPM_SetSize, 3) - 1;
|
||||
OPM_MaxIndex = OPM_SignedMaximum(OPM_AddressSize);
|
||||
if (__IN(18, OPM_opt, 32)) {
|
||||
OPM_VerboseListSizes();
|
||||
}
|
||||
}
|
||||
|
||||
void OPM_SymRCh (CHAR *ch)
|
||||
{
|
||||
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&*ch);
|
||||
|
|
@ -848,7 +828,7 @@ void OPM_SymWLReal (LONGREAL lr)
|
|||
|
||||
void OPM_RegisterNewSym (void)
|
||||
{
|
||||
if (__STRCMP(OPM_modName, "SYSTEM") != 0 || __IN(10, OPM_opt, 32)) {
|
||||
if (__STRCMP(OPM_modName, "SYSTEM") != 0 || __IN(10, OPM_Options, 32)) {
|
||||
Files_Register(OPM_newSFile);
|
||||
}
|
||||
}
|
||||
|
|
@ -1047,10 +1027,10 @@ void OPM_CloseFiles (void)
|
|||
}
|
||||
if (OPM_noerr) {
|
||||
if (__STRCMP(OPM_modName, "SYSTEM") == 0) {
|
||||
if (!__IN(10, OPM_opt, 32)) {
|
||||
if (!__IN(10, OPM_Options, 32)) {
|
||||
Files_Register(OPM_BFile);
|
||||
}
|
||||
} else if (!__IN(10, OPM_opt, 32)) {
|
||||
} else if (!__IN(10, OPM_Options, 32)) {
|
||||
OPM_Append(&OPM_R[2], Files_Rider__typ, OPM_HFile);
|
||||
Files_Register(OPM_HIFile);
|
||||
Files_Register(OPM_BFile);
|
||||
|
|
@ -1110,22 +1090,10 @@ export void *OPM__init(void)
|
|||
__REGCMD("RegisterNewSym", OPM_RegisterNewSym);
|
||||
__REGCMD("WriteLn", OPM_WriteLn);
|
||||
/* BEGIN */
|
||||
OPM_MaxReal = 3.40282346000000e+038;
|
||||
OPM_MaxLReal = 1.79769296342094e+308;
|
||||
OPM_MinReal = -OPM_MaxReal;
|
||||
OPM_MinLReal = -OPM_MaxLReal;
|
||||
Texts_OpenWriter(&OPM_W, Texts_Writer__typ);
|
||||
OPM_MODULES[0] = 0x00;
|
||||
Platform_GetEnv((CHAR*)"MODULES", 8, (void*)OPM_MODULES, 1024);
|
||||
__MOVE(".", OPM_OBERON, 2);
|
||||
Platform_GetEnv((CHAR*)"OBERON", 7, (void*)OPM_OBERON, 1024);
|
||||
Strings_Append((CHAR*)";.;", 4, (void*)OPM_OBERON, 1024);
|
||||
Strings_Append(OPM_MODULES, 1024, (void*)OPM_OBERON, 1024);
|
||||
Strings_Append((CHAR*)";", 2, (void*)OPM_OBERON, 1024);
|
||||
Strings_Append((CHAR*)"", 1, (void*)OPM_OBERON, 1024);
|
||||
Strings_Append((CHAR*)"/sym;", 6, (void*)OPM_OBERON, 1024);
|
||||
Files_SetSearchPath(OPM_OBERON, 1024);
|
||||
OPM_AddressSize = 4;
|
||||
OPM_GetAlignment(&OPM_Alignment);
|
||||
OPM_ShortintSize = 1;
|
||||
OPM_IntegerSize = 2;
|
||||
OPM_LongintSize = 4;
|
||||
OPM_SetSize = 4;
|
||||
__ENDMOD;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef OPM__h
|
||||
#define OPM__h
|
||||
|
|
@ -6,7 +6,10 @@
|
|||
#include "SYSTEM.h"
|
||||
|
||||
|
||||
import int16 OPM_AddressSize, OPM_Alignment, OPM_SetSize, OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_MaxSet;
|
||||
import CHAR OPM_Model[10];
|
||||
import int16 OPM_AddressSize, OPM_Alignment;
|
||||
import SET OPM_GlobalOptions, OPM_Options;
|
||||
import int16 OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_SetSize, OPM_MaxSet;
|
||||
import int64 OPM_MaxIndex;
|
||||
import LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal;
|
||||
import BOOLEAN OPM_noerr;
|
||||
|
|
@ -14,7 +17,7 @@ import int32 OPM_curpos, OPM_errpos, OPM_breakpc;
|
|||
import int16 OPM_currFile, OPM_level, OPM_pc, OPM_entno;
|
||||
import CHAR OPM_modName[32];
|
||||
import CHAR OPM_objname[64];
|
||||
import SET OPM_opt, OPM_glbopt;
|
||||
import CHAR OPM_ResourceDir[1024];
|
||||
|
||||
|
||||
import void OPM_CloseFiles (void);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef OPP__h
|
||||
#define OPP__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
|
||||
#ifndef OPS__h
|
||||
#define OPS__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -1867,7 +1867,7 @@ void OPT_Export (BOOLEAN *ext, BOOLEAN *new)
|
|||
}
|
||||
OPT_OutObj(OPT_topScope->right);
|
||||
*ext = (OPT_sfpresent && OPT_symExtended);
|
||||
*new = (!OPT_sfpresent || OPT_symNew) || __IN(17, OPM_opt, 32);
|
||||
*new = (!OPT_sfpresent || OPT_symNew) || __IN(17, OPM_Options, 32);
|
||||
if ((((OPM_noerr && OPT_sfpresent)) && OPT_impCtxt.reffp != OPT_expCtxt.reffp)) {
|
||||
*new = 1;
|
||||
if (!OPT_extsf) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef OPT__h
|
||||
#define OPT__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -211,7 +211,7 @@ static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp
|
|||
return _o_result;
|
||||
break;
|
||||
case 5:
|
||||
if (__IN(3, OPM_opt, 32)) {
|
||||
if (__IN(3, OPM_Options, 32)) {
|
||||
_o_result = 10;
|
||||
return _o_result;
|
||||
} else {
|
||||
|
|
@ -397,7 +397,7 @@ static void OPV_Convert (OPT_Node n, OPT_Struct newtype, int16 prec)
|
|||
OPM_WriteInt(__ASHL(newtype->size, 3));
|
||||
OPM_Write(')');
|
||||
} else if (to == 4) {
|
||||
if ((newtype->size < n->typ->size && __IN(2, OPM_opt, 32))) {
|
||||
if ((newtype->size < n->typ->size && __IN(2, OPM_Options, 32))) {
|
||||
OPM_WriteString((CHAR*)"__SHORT", 8);
|
||||
if (OPV_SideEffects(n)) {
|
||||
OPM_Write('F');
|
||||
|
|
@ -412,7 +412,7 @@ static void OPV_Convert (OPT_Node n, OPT_Struct newtype, int16 prec)
|
|||
OPV_Entier(n, 9);
|
||||
}
|
||||
} else if (to == 3) {
|
||||
if (__IN(2, OPM_opt, 32)) {
|
||||
if (__IN(2, OPM_Options, 32)) {
|
||||
OPM_WriteString((CHAR*)"__CHR", 6);
|
||||
if (OPV_SideEffects(n)) {
|
||||
OPM_Write('F');
|
||||
|
|
@ -453,7 +453,7 @@ static void OPV_TypeOf (OPT_Node n)
|
|||
|
||||
static void OPV_Index (OPT_Node n, OPT_Node d, int16 prec, int16 dim)
|
||||
{
|
||||
if (!__IN(0, OPM_opt, 32) || (n->right->class == 7 && (n->right->conval->intval == 0 || n->left->typ->comp != 3))) {
|
||||
if (!__IN(0, OPM_Options, 32) || (n->right->class == 7 && (n->right->conval->intval == 0 || n->left->typ->comp != 3))) {
|
||||
OPV_expr(n->right, prec);
|
||||
} else {
|
||||
if (OPV_SideEffects(n->right)) {
|
||||
|
|
@ -575,7 +575,7 @@ static void OPV_design (OPT_Node n, int16 prec)
|
|||
case 5:
|
||||
typ = n->typ;
|
||||
obj = n->left->obj;
|
||||
if (__IN(3, OPM_opt, 32)) {
|
||||
if (__IN(3, OPM_Options, 32)) {
|
||||
if (typ->comp == 4) {
|
||||
OPM_WriteString((CHAR*)"__GUARDR(", 10);
|
||||
if ((int16)obj->mnolev != OPM_level) {
|
||||
|
|
@ -614,7 +614,7 @@ static void OPV_design (OPT_Node n, int16 prec)
|
|||
}
|
||||
break;
|
||||
case 6:
|
||||
if (__IN(3, OPM_opt, 32)) {
|
||||
if (__IN(3, OPM_Options, 32)) {
|
||||
if (n->left->class == 1) {
|
||||
OPM_WriteString((CHAR*)"__GUARDEQR(", 12);
|
||||
OPC_CompleteIdent(n->left->obj);
|
||||
|
|
@ -1442,7 +1442,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc)
|
|||
case 20:
|
||||
if (n->subcl != 32) {
|
||||
OPV_IfStat(n, 0, outerProc);
|
||||
} else if (__IN(7, OPM_opt, 32)) {
|
||||
} else if (__IN(7, OPM_Options, 32)) {
|
||||
OPM_WriteString((CHAR*)"__ASSERT(", 10);
|
||||
OPV_expr(n->left->left->left, -1);
|
||||
OPM_WriteString((CHAR*)", ", 3);
|
||||
|
|
@ -1508,7 +1508,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc)
|
|||
break;
|
||||
case 26:
|
||||
if (OPM_level == 0) {
|
||||
if (__IN(10, OPM_opt, 32)) {
|
||||
if (__IN(10, OPM_Options, 32)) {
|
||||
OPM_WriteString((CHAR*)"__FINI", 7);
|
||||
} else {
|
||||
OPM_WriteString((CHAR*)"__ENDMOD", 9);
|
||||
|
|
@ -1553,7 +1553,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc)
|
|||
|
||||
void OPV_Module (OPT_Node prog)
|
||||
{
|
||||
if (!__IN(10, OPM_opt, 32)) {
|
||||
if (!__IN(10, OPM_Options, 32)) {
|
||||
OPC_GenHdr(prog->right);
|
||||
OPC_GenHdrIncludes();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef OPV__h
|
||||
#define OPV__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -65,6 +65,7 @@ export int16 Platform_Identify (int32 h, Platform_FileIdentity *identity, addres
|
|||
export int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ);
|
||||
export BOOLEAN Platform_Inaccessible (int16 e);
|
||||
export void Platform_Init (int16 argc, int32 argvadr);
|
||||
export BOOLEAN Platform_Interrupted (int16 e);
|
||||
export void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d);
|
||||
export int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h);
|
||||
export BOOLEAN Platform_NoSuchDirectory (int16 e);
|
||||
|
|
@ -115,6 +116,7 @@ export BOOLEAN Platform_getEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT
|
|||
#define Platform_ECONNABORTED() ECONNABORTED
|
||||
#define Platform_ECONNREFUSED() ECONNREFUSED
|
||||
#define Platform_EHOSTUNREACH() EHOSTUNREACH
|
||||
#define Platform_EINTR() EINTR
|
||||
#define Platform_EMFILE() EMFILE
|
||||
#define Platform_ENETUNREACH() ENETUNREACH
|
||||
#define Platform_ENFILE() ENFILE
|
||||
|
|
@ -218,6 +220,13 @@ BOOLEAN Platform_ConnectionFailed (int16 e)
|
|||
return _o_result;
|
||||
}
|
||||
|
||||
BOOLEAN Platform_Interrupted (int16 e)
|
||||
{
|
||||
BOOLEAN _o_result;
|
||||
_o_result = e == Platform_EINTR();
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
int32 Platform_OSAllocate (int32 size)
|
||||
{
|
||||
int32 _o_result;
|
||||
|
|
@ -618,13 +627,11 @@ int16 Platform_Chdir (CHAR *n, LONGINT n__len)
|
|||
{
|
||||
int16 _o_result;
|
||||
int16 r;
|
||||
r = Platform_chdir(n, n__len);
|
||||
Platform_getcwd((void*)Platform_CWD, 256);
|
||||
if (r < 0) {
|
||||
_o_result = Platform_err();
|
||||
if ((Platform_chdir(n, n__len) >= 0 && Platform_getcwd((void*)Platform_CWD, 256) != NIL)) {
|
||||
_o_result = 0;
|
||||
return _o_result;
|
||||
} else {
|
||||
_o_result = 0;
|
||||
_o_result = Platform_err();
|
||||
return _o_result;
|
||||
}
|
||||
__RETCHK;
|
||||
|
|
@ -784,9 +791,10 @@ export void *Platform__init(void)
|
|||
Platform_HaltHandler = NIL;
|
||||
Platform_TimeStart = 0;
|
||||
Platform_TimeStart = Platform_Time();
|
||||
Platform_CWD[0] = 0x00;
|
||||
Platform_getcwd((void*)Platform_CWD, 256);
|
||||
Platform_PID = Platform_getpid();
|
||||
if (Platform_getcwd((void*)Platform_CWD, 256) == NIL) {
|
||||
Platform_CWD[0] = 0x00;
|
||||
}
|
||||
Platform_SeekSet = Platform_seekset();
|
||||
Platform_SeekCur = Platform_seekcur();
|
||||
Platform_SeekEnd = Platform_seekend();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef Platform__h
|
||||
#define Platform__h
|
||||
|
|
@ -50,6 +50,7 @@ import int16 Platform_Identify (int32 h, Platform_FileIdentity *identity, addres
|
|||
import int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ);
|
||||
import BOOLEAN Platform_Inaccessible (int16 e);
|
||||
import void Platform_Init (int16 argc, int32 argvadr);
|
||||
import BOOLEAN Platform_Interrupted (int16 e);
|
||||
import void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d);
|
||||
import int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h);
|
||||
import BOOLEAN Platform_NoSuchDirectory (int16 e);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef Reals__h
|
||||
#define Reals__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef Strings__h
|
||||
#define Strings__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef Texts__h
|
||||
#define Texts__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef errors__h
|
||||
#define errors__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -12,10 +12,11 @@
|
|||
#include "Strings.h"
|
||||
|
||||
|
||||
static CHAR extTools_compilationOptions[1023], extTools_CFLAGS[1023];
|
||||
static CHAR extTools_CFLAGS[1023];
|
||||
|
||||
|
||||
export void extTools_Assemble (CHAR *moduleName, LONGINT moduleName__len);
|
||||
static void extTools_InitialiseCompilerCommand (CHAR *s, LONGINT s__len);
|
||||
export void extTools_LinkMain (CHAR *moduleName, LONGINT moduleName__len, BOOLEAN statically, CHAR *additionalopts, LONGINT additionalopts__len);
|
||||
static void extTools_execute (CHAR *title, LONGINT title__len, CHAR *cmd, LONGINT cmd__len);
|
||||
|
||||
|
|
@ -25,7 +26,7 @@ static void extTools_execute (CHAR *title, LONGINT title__len, CHAR *cmd, LONGIN
|
|||
int16 r, status, exitcode;
|
||||
__DUP(title, title__len, CHAR);
|
||||
__DUP(cmd, cmd__len, CHAR);
|
||||
if (__IN(18, OPM_opt, 32)) {
|
||||
if (__IN(18, OPM_Options, 32)) {
|
||||
Console_String(title, title__len);
|
||||
Console_String(cmd, cmd__len);
|
||||
Console_Ln();
|
||||
|
|
@ -60,12 +61,22 @@ static void extTools_execute (CHAR *title, LONGINT title__len, CHAR *cmd, LONGIN
|
|||
__DEL(cmd);
|
||||
}
|
||||
|
||||
static void extTools_InitialiseCompilerCommand (CHAR *s, LONGINT s__len)
|
||||
{
|
||||
__COPY("gcc -g -O1", s, s__len);
|
||||
Strings_Append((CHAR*)" -I \"", 6, (void*)s, s__len);
|
||||
Strings_Append(OPM_ResourceDir, 1024, (void*)s, s__len);
|
||||
Strings_Append((CHAR*)"/include\" ", 11, (void*)s, s__len);
|
||||
Platform_GetEnv((CHAR*)"CFLAGS", 7, (void*)extTools_CFLAGS, 1023);
|
||||
Strings_Append(extTools_CFLAGS, 1023, (void*)s, s__len);
|
||||
Strings_Append((CHAR*)" ", 2, (void*)s, s__len);
|
||||
}
|
||||
|
||||
void extTools_Assemble (CHAR *moduleName, LONGINT moduleName__len)
|
||||
{
|
||||
CHAR cmd[1023];
|
||||
__DUP(moduleName, moduleName__len, CHAR);
|
||||
__MOVE("gcc -g -O1", cmd, 11);
|
||||
Strings_Append(extTools_compilationOptions, 1023, (void*)cmd, 1023);
|
||||
extTools_InitialiseCompilerCommand((void*)cmd, 1023);
|
||||
Strings_Append((CHAR*)"-c ", 4, (void*)cmd, 1023);
|
||||
Strings_Append(moduleName, moduleName__len, (void*)cmd, 1023);
|
||||
Strings_Append((CHAR*)".c", 3, (void*)cmd, 1023);
|
||||
|
|
@ -77,9 +88,7 @@ void extTools_LinkMain (CHAR *moduleName, LONGINT moduleName__len, BOOLEAN stati
|
|||
{
|
||||
CHAR cmd[1023];
|
||||
__DUP(additionalopts, additionalopts__len, CHAR);
|
||||
__MOVE("gcc -g -O1", cmd, 11);
|
||||
Strings_Append((CHAR*)" ", 2, (void*)cmd, 1023);
|
||||
Strings_Append(extTools_compilationOptions, 1023, (void*)cmd, 1023);
|
||||
extTools_InitialiseCompilerCommand((void*)cmd, 1023);
|
||||
Strings_Append(moduleName, moduleName__len, (void*)cmd, 1023);
|
||||
Strings_Append((CHAR*)".c ", 4, (void*)cmd, 1023);
|
||||
Strings_Append(additionalopts, additionalopts__len, (void*)cmd, 1023);
|
||||
|
|
@ -92,6 +101,7 @@ void extTools_LinkMain (CHAR *moduleName, LONGINT moduleName__len, BOOLEAN stati
|
|||
Strings_Append((CHAR*)"", 1, (void*)cmd, 1023);
|
||||
Strings_Append((CHAR*)"/lib\"", 6, (void*)cmd, 1023);
|
||||
Strings_Append((CHAR*)" -l voc", 8, (void*)cmd, 1023);
|
||||
Strings_Append(OPM_Model, 10, (void*)cmd, 1023);
|
||||
extTools_execute((CHAR*)"Assemble and link: ", 20, cmd, 1023);
|
||||
__DEL(additionalopts);
|
||||
}
|
||||
|
|
@ -107,11 +117,5 @@ export void *extTools__init(void)
|
|||
__MODULE_IMPORT(Strings);
|
||||
__REGMOD("extTools", 0);
|
||||
/* BEGIN */
|
||||
Strings_Append((CHAR*)" -I \"", 6, (void*)extTools_compilationOptions, 1023);
|
||||
Strings_Append((CHAR*)"", 1, (void*)extTools_compilationOptions, 1023);
|
||||
Strings_Append((CHAR*)"/include\" ", 11, (void*)extTools_compilationOptions, 1023);
|
||||
Platform_GetEnv((CHAR*)"CFLAGS", 7, (void*)extTools_CFLAGS, 1023);
|
||||
Strings_Append(extTools_CFLAGS, 1023, (void*)extTools_compilationOptions, 1023);
|
||||
Strings_Append((CHAR*)" ", 2, (void*)extTools_compilationOptions, 1023);
|
||||
__ENDMOD;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef extTools__h
|
||||
#define extTools__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef vt100__h
|
||||
#define vt100__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -32,7 +32,7 @@ void Compiler_Module (BOOLEAN *done)
|
|||
{
|
||||
BOOLEAN ext, new;
|
||||
OPT_Node p = NIL;
|
||||
OPP_Module(&p, OPM_opt);
|
||||
OPP_Module(&p, OPM_Options);
|
||||
if (OPM_noerr) {
|
||||
OPV_Init();
|
||||
OPT_InitRecno();
|
||||
|
|
@ -43,22 +43,22 @@ void Compiler_Module (BOOLEAN *done)
|
|||
OPC_Init();
|
||||
OPV_Module(p);
|
||||
if (OPM_noerr) {
|
||||
if ((__IN(10, OPM_opt, 32) && __STRCMP(OPM_modName, "SYSTEM") != 0)) {
|
||||
if ((__IN(10, OPM_Options, 32) && __STRCMP(OPM_modName, "SYSTEM") != 0)) {
|
||||
OPM_DeleteNewSym();
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"32m", 4);
|
||||
}
|
||||
OPM_LogWStr((CHAR*)" Main program.", 16);
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"0m", 3);
|
||||
}
|
||||
} else {
|
||||
if (new) {
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"32m", 4);
|
||||
}
|
||||
OPM_LogWStr((CHAR*)" New symbol file.", 19);
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"0m", 3);
|
||||
}
|
||||
OPM_RegisterNewSym();
|
||||
|
|
@ -115,17 +115,17 @@ void Compiler_Translate (void)
|
|||
OPM_LogWLn();
|
||||
Platform_Exit(1);
|
||||
}
|
||||
if (!__IN(13, OPM_opt, 32)) {
|
||||
if (__IN(14, OPM_opt, 32)) {
|
||||
if (!__IN(13, OPM_Options, 32)) {
|
||||
if (__IN(14, OPM_Options, 32)) {
|
||||
extTools_Assemble(OPM_modName, 32);
|
||||
} else {
|
||||
if (!__IN(10, OPM_opt, 32)) {
|
||||
if (!__IN(10, OPM_Options, 32)) {
|
||||
extTools_Assemble(OPM_modName, 32);
|
||||
Strings_Append((CHAR*)" ", 2, (void*)modulesobj, 2048);
|
||||
Strings_Append(OPM_modName, 32, (void*)modulesobj, 2048);
|
||||
Strings_Append((CHAR*)".o", 3, (void*)modulesobj, 2048);
|
||||
} else {
|
||||
extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_opt, 32), modulesobj, 2048);
|
||||
extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_Options, 32), modulesobj, 2048);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -18,6 +18,6 @@ export void *Configuration__init(void)
|
|||
__DEFMOD;
|
||||
__REGMOD("Configuration", 0);
|
||||
/* BEGIN */
|
||||
__MOVE("1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75);
|
||||
__MOVE("1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75);
|
||||
__ENDMOD;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef Configuration__h
|
||||
#define Configuration__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef Console__h
|
||||
#define Console__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
|
||||
#ifndef Files__h
|
||||
#define Files__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
|
||||
|
||||
#ifndef Heap__h
|
||||
#define Heap__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef Modules__h
|
||||
#define Modules__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -1541,28 +1541,9 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode)
|
|||
OPT_Struct y = NIL;
|
||||
int16 f, g;
|
||||
OPT_Struct p = NIL, q = NIL;
|
||||
if (__IN(18, OPM_opt, 32)) {
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"PROCEDURE CheckAssign", 22);
|
||||
OPM_LogWLn();
|
||||
}
|
||||
y = ynode->typ;
|
||||
f = x->form;
|
||||
g = y->form;
|
||||
if (__IN(18, OPM_opt, 32)) {
|
||||
OPM_LogWStr((CHAR*)"y.form = ", 10);
|
||||
OPM_LogWNum(y->form, 0);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"f = ", 5);
|
||||
OPM_LogWNum(f, 0);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"g = ", 5);
|
||||
OPM_LogWNum(g, 0);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"ynode.typ.syze = ", 18);
|
||||
OPM_LogWNum(ynode->typ->size, 0);
|
||||
OPM_LogWLn();
|
||||
}
|
||||
if (ynode->class == 8 || (ynode->class == 9 && f != 12)) {
|
||||
OPB_err(126);
|
||||
}
|
||||
|
|
@ -2367,7 +2348,7 @@ static void OPB_DynArrParCheck (OPT_Struct ftyp, OPT_Struct atyp, BOOLEAN fvarpa
|
|||
atyp = atyp->BaseTyp;
|
||||
if ((fvarpar && ftyp == OPT_bytetyp)) {
|
||||
if (!__IN(f, 0x0c, 32) || !((__IN(atyp->form, 0x1e, 32) && atyp->size == 1))) {
|
||||
if (__IN(18, OPM_opt, 32)) {
|
||||
if (__IN(18, OPM_Options, 32)) {
|
||||
OPB_err(-301);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef OPB__h
|
||||
#define OPB__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -989,7 +989,7 @@ static void OPC_IdentList (OPT_Object obj, int16 vis)
|
|||
OPC_Ident(obj);
|
||||
OPM_WriteString((CHAR*)"__typ", 6);
|
||||
base = NIL;
|
||||
} else if ((((((__IN(5, OPM_opt, 32) && vis == 0)) && obj->mnolev > 0)) && obj->typ->form == 11)) {
|
||||
} else if ((((((__IN(5, OPM_Options, 32) && vis == 0)) && obj->mnolev > 0)) && obj->typ->form == 11)) {
|
||||
OPM_WriteString((CHAR*)" = NIL", 7);
|
||||
}
|
||||
}
|
||||
|
|
@ -1153,7 +1153,7 @@ static void OPC_GenHeaderMsg (void)
|
|||
OPM_Write(' ');
|
||||
i = 0;
|
||||
while (i <= 31) {
|
||||
if (__IN(i, OPM_glbopt, 32)) {
|
||||
if (__IN(i, OPM_Options, 32)) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
OPM_Write('x');
|
||||
|
|
@ -1355,7 +1355,7 @@ void OPC_EnterBody (void)
|
|||
{
|
||||
OPM_WriteLn();
|
||||
OPM_WriteString((CHAR*)"export ", 8);
|
||||
if (__IN(10, OPM_opt, 32)) {
|
||||
if (__IN(10, OPM_Options, 32)) {
|
||||
OPM_WriteString((CHAR*)"int main(int argc, char **argv)", 32);
|
||||
OPM_WriteLn();
|
||||
} else {
|
||||
|
|
@ -1366,20 +1366,20 @@ void OPC_EnterBody (void)
|
|||
}
|
||||
OPC_BegBlk();
|
||||
OPC_BegStat();
|
||||
if (__IN(10, OPM_opt, 32)) {
|
||||
if (__IN(10, OPM_Options, 32)) {
|
||||
OPM_WriteString((CHAR*)"__INIT(argc, argv)", 19);
|
||||
} else {
|
||||
OPM_WriteString((CHAR*)"__DEFMOD", 9);
|
||||
}
|
||||
OPC_EndStat();
|
||||
if ((__IN(10, OPM_opt, 32) && 0)) {
|
||||
if ((__IN(10, OPM_Options, 32) && 0)) {
|
||||
OPC_BegStat();
|
||||
OPM_WriteString((CHAR*)"/*don`t do it!*/ printf(\"DEMO VERSION: DO NOT USE THIS PROGRAM FOR ANY COMMERCIAL PURPOSE\\n\")", 94);
|
||||
OPC_EndStat();
|
||||
}
|
||||
OPC_InitImports(OPT_topScope->right);
|
||||
OPC_BegStat();
|
||||
if (__IN(10, OPM_opt, 32)) {
|
||||
if (__IN(10, OPM_Options, 32)) {
|
||||
OPM_WriteString((CHAR*)"__REGMAIN(\"", 12);
|
||||
} else {
|
||||
OPM_WriteString((CHAR*)"__REGMOD(\"", 11);
|
||||
|
|
@ -1399,7 +1399,7 @@ void OPC_EnterBody (void)
|
|||
void OPC_ExitBody (void)
|
||||
{
|
||||
OPC_BegStat();
|
||||
if (__IN(10, OPM_opt, 32)) {
|
||||
if (__IN(10, OPM_Options, 32)) {
|
||||
OPM_WriteString((CHAR*)"__FINI;", 8);
|
||||
} else {
|
||||
OPM_WriteString((CHAR*)"__ENDMOD;", 10);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef OPC__h
|
||||
#define OPC__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -19,7 +19,14 @@ typedef
|
|||
|
||||
|
||||
static CHAR OPM_SourceFileName[256];
|
||||
export int16 OPM_AddressSize, OPM_Alignment, OPM_SetSize, OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_MaxSet;
|
||||
static CHAR OPM_GlobalModel[10];
|
||||
export CHAR OPM_Model[10];
|
||||
static int16 OPM_GlobalAddressSize;
|
||||
export int16 OPM_AddressSize;
|
||||
static int16 OPM_GlobalAlignment;
|
||||
export int16 OPM_Alignment;
|
||||
export SET OPM_GlobalOptions, OPM_Options;
|
||||
export int16 OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_SetSize, OPM_MaxSet;
|
||||
export int64 OPM_MaxIndex;
|
||||
export LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal;
|
||||
export BOOLEAN OPM_noerr;
|
||||
|
|
@ -27,7 +34,6 @@ export int32 OPM_curpos, OPM_errpos, OPM_breakpc;
|
|||
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 Texts_Reader OPM_inR;
|
||||
static Texts_Text OPM_Log;
|
||||
|
|
@ -36,8 +42,7 @@ 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 int16 OPM_S;
|
||||
static CHAR OPM_OBERON[1024];
|
||||
static CHAR OPM_MODULES[1024];
|
||||
export CHAR OPM_ResourceDir[1024];
|
||||
|
||||
|
||||
static void OPM_Append (Files_Rider *R, address *R__typ, Files_File F);
|
||||
|
|
@ -50,8 +55,6 @@ 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, address *r__typ, int64 pos);
|
||||
export void OPM_Get (CHAR *ch);
|
||||
static void OPM_GetProperties (void);
|
||||
static void OPM_GetProperty (Texts_Scanner *S, address *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);
|
||||
|
|
@ -68,7 +71,7 @@ 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_ScanOptions (CHAR *s, LONGINT s__len);
|
||||
static void OPM_ShowLine (int64 pos);
|
||||
export int64 OPM_SignedMaximum (int32 bytecount);
|
||||
export int64 OPM_SignedMinimum (int32 bytecount);
|
||||
|
|
@ -93,10 +96,8 @@ 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 (int16 n);
|
||||
static int32 OPM_minusop (int32 i);
|
||||
static int32 OPM_power0 (int32 i, int32 j);
|
||||
|
||||
#define OPM_GetAlignment(a) struct {char c; long long l;} s; *a = (char*)&s.l - (char*)&s
|
||||
#define OPM_GetAlignment(a) struct {char c; long long l;} _s; *a = (char*)&_s.l - (char*)&_s
|
||||
|
||||
void OPM_LogW (CHAR ch)
|
||||
{
|
||||
|
|
@ -120,6 +121,23 @@ void OPM_LogWLn (void)
|
|||
Console_Ln();
|
||||
}
|
||||
|
||||
int64 OPM_SignedMaximum (int32 bytecount)
|
||||
{
|
||||
int64 _o_result;
|
||||
int64 result;
|
||||
result = 1;
|
||||
result = __LSH(result, __ASHL(bytecount, 3) - 1, 64);
|
||||
_o_result = result - 1;
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
int64 OPM_SignedMinimum (int32 bytecount)
|
||||
{
|
||||
int64 _o_result;
|
||||
_o_result = -OPM_SignedMaximum(bytecount) - 1;
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
int32 OPM_Longint (int64 n)
|
||||
{
|
||||
int32 _o_result;
|
||||
|
|
@ -134,7 +152,7 @@ int16 OPM_Integer (int64 n)
|
|||
return _o_result;
|
||||
}
|
||||
|
||||
static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt)
|
||||
static void OPM_ScanOptions (CHAR *s, LONGINT s__len)
|
||||
{
|
||||
int16 i;
|
||||
__DUP(s, s__len, CHAR);
|
||||
|
|
@ -142,75 +160,57 @@ static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt)
|
|||
while (s[__X(i, s__len)] != 0x00) {
|
||||
switch (s[__X(i, s__len)]) {
|
||||
case 'p':
|
||||
*opt = *opt ^ 0x20;
|
||||
OPM_Options = OPM_Options ^ 0x20;
|
||||
break;
|
||||
case 'a':
|
||||
*opt = *opt ^ 0x80;
|
||||
OPM_Options = OPM_Options ^ 0x80;
|
||||
break;
|
||||
case 'r':
|
||||
*opt = *opt ^ 0x04;
|
||||
OPM_Options = OPM_Options ^ 0x04;
|
||||
break;
|
||||
case 't':
|
||||
*opt = *opt ^ 0x08;
|
||||
OPM_Options = OPM_Options ^ 0x08;
|
||||
break;
|
||||
case 'x':
|
||||
*opt = *opt ^ 0x01;
|
||||
OPM_Options = OPM_Options ^ 0x01;
|
||||
break;
|
||||
case 'e':
|
||||
*opt = *opt ^ 0x0200;
|
||||
OPM_Options = OPM_Options ^ 0x0200;
|
||||
break;
|
||||
case 's':
|
||||
*opt = *opt ^ 0x10;
|
||||
OPM_Options = OPM_Options ^ 0x10;
|
||||
break;
|
||||
case 'F':
|
||||
*opt = *opt ^ 0x020000;
|
||||
OPM_Options = OPM_Options ^ 0x020000;
|
||||
break;
|
||||
case 'm':
|
||||
*opt = *opt ^ 0x0400;
|
||||
OPM_Options = OPM_Options ^ 0x0400;
|
||||
break;
|
||||
case 'M':
|
||||
*opt = *opt ^ 0x8000;
|
||||
OPM_Options = OPM_Options ^ 0x8000;
|
||||
break;
|
||||
case 'S':
|
||||
*opt = *opt ^ 0x2000;
|
||||
OPM_Options = OPM_Options ^ 0x2000;
|
||||
break;
|
||||
case 'c':
|
||||
*opt = *opt ^ 0x4000;
|
||||
OPM_Options = OPM_Options ^ 0x4000;
|
||||
break;
|
||||
case 'f':
|
||||
*opt = *opt ^ 0x010000;
|
||||
OPM_Options = OPM_Options ^ 0x010000;
|
||||
break;
|
||||
case 'V':
|
||||
*opt = *opt ^ 0x040000;
|
||||
OPM_Options = OPM_Options ^ 0x040000;
|
||||
break;
|
||||
case 'O':
|
||||
if (i + 1 >= Strings_Length(s, s__len)) {
|
||||
OPM_LogWStr((CHAR*)"-O option requires following size model character.", 51);
|
||||
OPM_LogWLn();
|
||||
} else {
|
||||
switch (s[__X(i + 1, s__len)]) {
|
||||
case '2':
|
||||
OPM_ShortintSize = 1;
|
||||
OPM_IntegerSize = 2;
|
||||
OPM_LongintSize = 4;
|
||||
OPM_SetSize = 4;
|
||||
break;
|
||||
case 'V':
|
||||
OPM_ShortintSize = 1;
|
||||
OPM_IntegerSize = 4;
|
||||
OPM_LongintSize = 8;
|
||||
OPM_SetSize = 8;
|
||||
break;
|
||||
case 'C':
|
||||
OPM_ShortintSize = 2;
|
||||
OPM_IntegerSize = 4;
|
||||
OPM_LongintSize = 8;
|
||||
OPM_SetSize = 8;
|
||||
break;
|
||||
default:
|
||||
OPM_LogWStr((CHAR*)"Unrecognised size model character following -O.", 48);
|
||||
OPM_LogWLn();
|
||||
break;
|
||||
OPM_Model[0] = s[__X(i + 1, s__len)];
|
||||
OPM_Model[1] = 0x00;
|
||||
if ((((OPM_Model[0] != '2' && OPM_Model[0] != 'C')) && OPM_Model[0] != 'V')) {
|
||||
OPM_LogWStr((CHAR*)"Unrecognised size model character following -O.", 48);
|
||||
OPM_LogWLn();
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
|
|
@ -358,39 +358,119 @@ BOOLEAN OPM_OpenPar (void)
|
|||
_o_result = 0;
|
||||
return _o_result;
|
||||
} else {
|
||||
OPM_AddressSize = 4;
|
||||
OPM_GetAlignment(&OPM_Alignment);
|
||||
__MOVE("2", OPM_Model, 2);
|
||||
OPM_Options = 0xa9;
|
||||
OPM_S = 1;
|
||||
s[0] = 0x00;
|
||||
Platform_GetArg(OPM_S, (void*)s, 256);
|
||||
OPM_glbopt = 0xa9;
|
||||
while (s[0] == '-') {
|
||||
OPM_ScanOptions(s, 256, &OPM_glbopt);
|
||||
OPM_ScanOptions(s, 256);
|
||||
OPM_S += 1;
|
||||
s[0] = 0x00;
|
||||
Platform_GetArg(OPM_S, (void*)s, 256);
|
||||
}
|
||||
OPM_GlobalAddressSize = OPM_AddressSize;
|
||||
OPM_GlobalAlignment = OPM_Alignment;
|
||||
__COPY(OPM_Model, OPM_GlobalModel, 10);
|
||||
OPM_GlobalOptions = OPM_Options;
|
||||
_o_result = 1;
|
||||
return _o_result;
|
||||
}
|
||||
__RETCHK;
|
||||
}
|
||||
|
||||
static void OPM_VerboseListSizes (void)
|
||||
{
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"Type Size", 15);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"SHORTINT ", 12);
|
||||
OPM_LogWNum(OPM_ShortintSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"INTEGER ", 12);
|
||||
OPM_LogWNum(OPM_IntegerSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"LONGINT ", 12);
|
||||
OPM_LogWNum(OPM_LongintSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"SET ", 12);
|
||||
OPM_LogWNum(OPM_SetSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"ADDRESS ", 12);
|
||||
OPM_LogWNum(OPM_AddressSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"Alignment: ", 12);
|
||||
OPM_LogWNum(OPM_Alignment, 4);
|
||||
OPM_LogWLn();
|
||||
}
|
||||
|
||||
void OPM_InitOptions (void)
|
||||
{
|
||||
CHAR s[256];
|
||||
OPM_opt = OPM_glbopt;
|
||||
CHAR searchpath[1024], modules[1024];
|
||||
CHAR MODULES[1024];
|
||||
OPM_Options = OPM_GlobalOptions;
|
||||
__COPY(OPM_GlobalModel, OPM_Model, 10);
|
||||
OPM_Alignment = OPM_GlobalAlignment;
|
||||
OPM_AddressSize = OPM_GlobalAddressSize;
|
||||
s[0] = 0x00;
|
||||
Platform_GetArg(OPM_S, (void*)s, 256);
|
||||
while (s[0] == '-') {
|
||||
OPM_ScanOptions(s, 256, &OPM_opt);
|
||||
OPM_ScanOptions(s, 256);
|
||||
OPM_S += 1;
|
||||
s[0] = 0x00;
|
||||
Platform_GetArg(OPM_S, (void*)s, 256);
|
||||
}
|
||||
if (__IN(15, OPM_opt, 32)) {
|
||||
OPM_glbopt |= __SETOF(10,32);
|
||||
OPM_opt |= __SETOF(10,32);
|
||||
if (__IN(15, OPM_Options, 32)) {
|
||||
OPM_Options |= __SETOF(10,32);
|
||||
}
|
||||
OPM_GetProperties();
|
||||
OPM_MaxIndex = OPM_SignedMaximum(OPM_AddressSize);
|
||||
switch (OPM_Model[0]) {
|
||||
case '2':
|
||||
OPM_ShortintSize = 1;
|
||||
OPM_IntegerSize = 2;
|
||||
OPM_LongintSize = 4;
|
||||
OPM_SetSize = 4;
|
||||
break;
|
||||
case 'C':
|
||||
OPM_ShortintSize = 2;
|
||||
OPM_IntegerSize = 4;
|
||||
OPM_LongintSize = 8;
|
||||
OPM_SetSize = 8;
|
||||
break;
|
||||
case 'V':
|
||||
OPM_ShortintSize = 1;
|
||||
OPM_IntegerSize = 4;
|
||||
OPM_LongintSize = 8;
|
||||
OPM_SetSize = 8;
|
||||
break;
|
||||
default:
|
||||
OPM_ShortintSize = 1;
|
||||
OPM_IntegerSize = 2;
|
||||
OPM_LongintSize = 4;
|
||||
OPM_SetSize = 4;
|
||||
break;
|
||||
}
|
||||
OPM_MaxSet = __ASHL(OPM_SetSize, 3) - 1;
|
||||
if (__IN(18, OPM_Options, 32)) {
|
||||
OPM_VerboseListSizes();
|
||||
}
|
||||
OPM_ResourceDir[0] = 0x00;
|
||||
Strings_Append((CHAR*)"/", 2, (void*)OPM_ResourceDir, 1024);
|
||||
Strings_Append(OPM_Model, 10, (void*)OPM_ResourceDir, 1024);
|
||||
modules[0] = 0x00;
|
||||
Platform_GetEnv((CHAR*)"MODULES", 8, (void*)modules, 1024);
|
||||
__MOVE(".", searchpath, 2);
|
||||
Platform_GetEnv((CHAR*)"OBERON", 7, (void*)searchpath, 1024);
|
||||
Strings_Append((CHAR*)";.;", 4, (void*)searchpath, 1024);
|
||||
Strings_Append(modules, 1024, (void*)searchpath, 1024);
|
||||
Strings_Append((CHAR*)";", 2, (void*)searchpath, 1024);
|
||||
Strings_Append(OPM_ResourceDir, 1024, (void*)searchpath, 1024);
|
||||
Strings_Append((CHAR*)"/sym;", 6, (void*)searchpath, 1024);
|
||||
Files_SetSearchPath(searchpath, 1024);
|
||||
}
|
||||
|
||||
void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len)
|
||||
|
|
@ -474,20 +554,20 @@ static void OPM_LogErrMsg (int16 n)
|
|||
int16 i;
|
||||
CHAR buf[1024];
|
||||
if (n >= 0) {
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"31m", 4);
|
||||
}
|
||||
OPM_LogWStr((CHAR*)" err ", 7);
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"0m", 3);
|
||||
}
|
||||
} else {
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"35m", 4);
|
||||
}
|
||||
OPM_LogWStr((CHAR*)" warning ", 11);
|
||||
n = -n;
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"0m", 3);
|
||||
}
|
||||
}
|
||||
|
|
@ -560,11 +640,11 @@ static void OPM_ShowLine (int64 pos)
|
|||
OPM_LogW(' ');
|
||||
i -= 1;
|
||||
}
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"32m", 4);
|
||||
}
|
||||
OPM_LogW('^');
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"0m", 3);
|
||||
}
|
||||
Files_Close(f);
|
||||
|
|
@ -654,106 +734,6 @@ void OPM_FPrintLReal (int32 *fp, LONGREAL lr)
|
|||
OPM_FPrint(&*fp, h);
|
||||
}
|
||||
|
||||
static void OPM_GetProperty (Texts_Scanner *S, address *S__typ, CHAR *name, LONGINT name__len, int16 *size, int16 *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 = (int16)(*S).i;
|
||||
Texts_Scan(&*S, S__typ);
|
||||
} else {
|
||||
OPM_Mark(-157, -1);
|
||||
}
|
||||
if ((*S).class == 3) {
|
||||
*align = (int16)(*S).i;
|
||||
Texts_Scan(&*S, S__typ);
|
||||
} else {
|
||||
OPM_Mark(-157, -1);
|
||||
}
|
||||
} else {
|
||||
OPM_Mark(-157, -1);
|
||||
}
|
||||
__DEL(name);
|
||||
}
|
||||
|
||||
static int32 OPM_minusop (int32 i)
|
||||
{
|
||||
int32 _o_result;
|
||||
_o_result = -i;
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
static int32 OPM_power0 (int32 i, int32 j)
|
||||
{
|
||||
int32 _o_result;
|
||||
int32 k, p;
|
||||
k = 1;
|
||||
p = i;
|
||||
do {
|
||||
p = p * i;
|
||||
k += 1;
|
||||
} while (!(k == j));
|
||||
_o_result = p;
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
static void OPM_VerboseListSizes (void)
|
||||
{
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"Type Size", 17);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"SHORTINT ", 14);
|
||||
OPM_LogWNum(OPM_ShortintSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"INTEGER ", 14);
|
||||
OPM_LogWNum(OPM_IntegerSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"LONGINT ", 14);
|
||||
OPM_LogWNum(OPM_LongintSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"SET ", 14);
|
||||
OPM_LogWNum(OPM_SetSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"ADDRESS ", 14);
|
||||
OPM_LogWNum(OPM_AddressSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"Alignment: ", 12);
|
||||
OPM_LogWNum(OPM_Alignment, 4);
|
||||
OPM_LogWLn();
|
||||
}
|
||||
|
||||
int64 OPM_SignedMaximum (int32 bytecount)
|
||||
{
|
||||
int64 _o_result;
|
||||
int64 result;
|
||||
result = 1;
|
||||
result = __LSH(result, __ASHL(bytecount, 3) - 1, 64);
|
||||
_o_result = result - 1;
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
int64 OPM_SignedMinimum (int32 bytecount)
|
||||
{
|
||||
int64 _o_result;
|
||||
_o_result = -OPM_SignedMaximum(bytecount) - 1;
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
static void OPM_GetProperties (void)
|
||||
{
|
||||
OPM_MaxReal = 3.40282346000000e+038;
|
||||
OPM_MaxLReal = 1.79769296342094e+308;
|
||||
OPM_MinReal = -OPM_MaxReal;
|
||||
OPM_MinLReal = -OPM_MaxLReal;
|
||||
OPM_MaxSet = __ASHL(OPM_SetSize, 3) - 1;
|
||||
OPM_MaxIndex = OPM_SignedMaximum(OPM_AddressSize);
|
||||
if (__IN(18, OPM_opt, 32)) {
|
||||
OPM_VerboseListSizes();
|
||||
}
|
||||
}
|
||||
|
||||
void OPM_SymRCh (CHAR *ch)
|
||||
{
|
||||
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&*ch);
|
||||
|
|
@ -848,7 +828,7 @@ void OPM_SymWLReal (LONGREAL lr)
|
|||
|
||||
void OPM_RegisterNewSym (void)
|
||||
{
|
||||
if (__STRCMP(OPM_modName, "SYSTEM") != 0 || __IN(10, OPM_opt, 32)) {
|
||||
if (__STRCMP(OPM_modName, "SYSTEM") != 0 || __IN(10, OPM_Options, 32)) {
|
||||
Files_Register(OPM_newSFile);
|
||||
}
|
||||
}
|
||||
|
|
@ -1047,10 +1027,10 @@ void OPM_CloseFiles (void)
|
|||
}
|
||||
if (OPM_noerr) {
|
||||
if (__STRCMP(OPM_modName, "SYSTEM") == 0) {
|
||||
if (!__IN(10, OPM_opt, 32)) {
|
||||
if (!__IN(10, OPM_Options, 32)) {
|
||||
Files_Register(OPM_BFile);
|
||||
}
|
||||
} else if (!__IN(10, OPM_opt, 32)) {
|
||||
} else if (!__IN(10, OPM_Options, 32)) {
|
||||
OPM_Append(&OPM_R[2], Files_Rider__typ, OPM_HFile);
|
||||
Files_Register(OPM_HIFile);
|
||||
Files_Register(OPM_BFile);
|
||||
|
|
@ -1110,22 +1090,10 @@ export void *OPM__init(void)
|
|||
__REGCMD("RegisterNewSym", OPM_RegisterNewSym);
|
||||
__REGCMD("WriteLn", OPM_WriteLn);
|
||||
/* BEGIN */
|
||||
OPM_MaxReal = 3.40282346000000e+038;
|
||||
OPM_MaxLReal = 1.79769296342094e+308;
|
||||
OPM_MinReal = -OPM_MaxReal;
|
||||
OPM_MinLReal = -OPM_MaxLReal;
|
||||
Texts_OpenWriter(&OPM_W, Texts_Writer__typ);
|
||||
OPM_MODULES[0] = 0x00;
|
||||
Platform_GetEnv((CHAR*)"MODULES", 8, (void*)OPM_MODULES, 1024);
|
||||
__MOVE(".", OPM_OBERON, 2);
|
||||
Platform_GetEnv((CHAR*)"OBERON", 7, (void*)OPM_OBERON, 1024);
|
||||
Strings_Append((CHAR*)";.;", 4, (void*)OPM_OBERON, 1024);
|
||||
Strings_Append(OPM_MODULES, 1024, (void*)OPM_OBERON, 1024);
|
||||
Strings_Append((CHAR*)";", 2, (void*)OPM_OBERON, 1024);
|
||||
Strings_Append((CHAR*)"", 1, (void*)OPM_OBERON, 1024);
|
||||
Strings_Append((CHAR*)"/sym;", 6, (void*)OPM_OBERON, 1024);
|
||||
Files_SetSearchPath(OPM_OBERON, 1024);
|
||||
OPM_AddressSize = 4;
|
||||
OPM_GetAlignment(&OPM_Alignment);
|
||||
OPM_ShortintSize = 1;
|
||||
OPM_IntegerSize = 2;
|
||||
OPM_LongintSize = 4;
|
||||
OPM_SetSize = 4;
|
||||
__ENDMOD;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef OPM__h
|
||||
#define OPM__h
|
||||
|
|
@ -6,7 +6,10 @@
|
|||
#include "SYSTEM.h"
|
||||
|
||||
|
||||
import int16 OPM_AddressSize, OPM_Alignment, OPM_SetSize, OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_MaxSet;
|
||||
import CHAR OPM_Model[10];
|
||||
import int16 OPM_AddressSize, OPM_Alignment;
|
||||
import SET OPM_GlobalOptions, OPM_Options;
|
||||
import int16 OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_SetSize, OPM_MaxSet;
|
||||
import int64 OPM_MaxIndex;
|
||||
import LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal;
|
||||
import BOOLEAN OPM_noerr;
|
||||
|
|
@ -14,7 +17,7 @@ import int32 OPM_curpos, OPM_errpos, OPM_breakpc;
|
|||
import int16 OPM_currFile, OPM_level, OPM_pc, OPM_entno;
|
||||
import CHAR OPM_modName[32];
|
||||
import CHAR OPM_objname[64];
|
||||
import SET OPM_opt, OPM_glbopt;
|
||||
import CHAR OPM_ResourceDir[1024];
|
||||
|
||||
|
||||
import void OPM_CloseFiles (void);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef OPP__h
|
||||
#define OPP__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
|
||||
#ifndef OPS__h
|
||||
#define OPS__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -1867,7 +1867,7 @@ void OPT_Export (BOOLEAN *ext, BOOLEAN *new)
|
|||
}
|
||||
OPT_OutObj(OPT_topScope->right);
|
||||
*ext = (OPT_sfpresent && OPT_symExtended);
|
||||
*new = (!OPT_sfpresent || OPT_symNew) || __IN(17, OPM_opt, 32);
|
||||
*new = (!OPT_sfpresent || OPT_symNew) || __IN(17, OPM_Options, 32);
|
||||
if ((((OPM_noerr && OPT_sfpresent)) && OPT_impCtxt.reffp != OPT_expCtxt.reffp)) {
|
||||
*new = 1;
|
||||
if (!OPT_extsf) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef OPT__h
|
||||
#define OPT__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -211,7 +211,7 @@ static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp
|
|||
return _o_result;
|
||||
break;
|
||||
case 5:
|
||||
if (__IN(3, OPM_opt, 32)) {
|
||||
if (__IN(3, OPM_Options, 32)) {
|
||||
_o_result = 10;
|
||||
return _o_result;
|
||||
} else {
|
||||
|
|
@ -397,7 +397,7 @@ static void OPV_Convert (OPT_Node n, OPT_Struct newtype, int16 prec)
|
|||
OPM_WriteInt(__ASHL(newtype->size, 3));
|
||||
OPM_Write(')');
|
||||
} else if (to == 4) {
|
||||
if ((newtype->size < n->typ->size && __IN(2, OPM_opt, 32))) {
|
||||
if ((newtype->size < n->typ->size && __IN(2, OPM_Options, 32))) {
|
||||
OPM_WriteString((CHAR*)"__SHORT", 8);
|
||||
if (OPV_SideEffects(n)) {
|
||||
OPM_Write('F');
|
||||
|
|
@ -412,7 +412,7 @@ static void OPV_Convert (OPT_Node n, OPT_Struct newtype, int16 prec)
|
|||
OPV_Entier(n, 9);
|
||||
}
|
||||
} else if (to == 3) {
|
||||
if (__IN(2, OPM_opt, 32)) {
|
||||
if (__IN(2, OPM_Options, 32)) {
|
||||
OPM_WriteString((CHAR*)"__CHR", 6);
|
||||
if (OPV_SideEffects(n)) {
|
||||
OPM_Write('F');
|
||||
|
|
@ -453,7 +453,7 @@ static void OPV_TypeOf (OPT_Node n)
|
|||
|
||||
static void OPV_Index (OPT_Node n, OPT_Node d, int16 prec, int16 dim)
|
||||
{
|
||||
if (!__IN(0, OPM_opt, 32) || (n->right->class == 7 && (n->right->conval->intval == 0 || n->left->typ->comp != 3))) {
|
||||
if (!__IN(0, OPM_Options, 32) || (n->right->class == 7 && (n->right->conval->intval == 0 || n->left->typ->comp != 3))) {
|
||||
OPV_expr(n->right, prec);
|
||||
} else {
|
||||
if (OPV_SideEffects(n->right)) {
|
||||
|
|
@ -575,7 +575,7 @@ static void OPV_design (OPT_Node n, int16 prec)
|
|||
case 5:
|
||||
typ = n->typ;
|
||||
obj = n->left->obj;
|
||||
if (__IN(3, OPM_opt, 32)) {
|
||||
if (__IN(3, OPM_Options, 32)) {
|
||||
if (typ->comp == 4) {
|
||||
OPM_WriteString((CHAR*)"__GUARDR(", 10);
|
||||
if ((int16)obj->mnolev != OPM_level) {
|
||||
|
|
@ -614,7 +614,7 @@ static void OPV_design (OPT_Node n, int16 prec)
|
|||
}
|
||||
break;
|
||||
case 6:
|
||||
if (__IN(3, OPM_opt, 32)) {
|
||||
if (__IN(3, OPM_Options, 32)) {
|
||||
if (n->left->class == 1) {
|
||||
OPM_WriteString((CHAR*)"__GUARDEQR(", 12);
|
||||
OPC_CompleteIdent(n->left->obj);
|
||||
|
|
@ -1442,7 +1442,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc)
|
|||
case 20:
|
||||
if (n->subcl != 32) {
|
||||
OPV_IfStat(n, 0, outerProc);
|
||||
} else if (__IN(7, OPM_opt, 32)) {
|
||||
} else if (__IN(7, OPM_Options, 32)) {
|
||||
OPM_WriteString((CHAR*)"__ASSERT(", 10);
|
||||
OPV_expr(n->left->left->left, -1);
|
||||
OPM_WriteString((CHAR*)", ", 3);
|
||||
|
|
@ -1508,7 +1508,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc)
|
|||
break;
|
||||
case 26:
|
||||
if (OPM_level == 0) {
|
||||
if (__IN(10, OPM_opt, 32)) {
|
||||
if (__IN(10, OPM_Options, 32)) {
|
||||
OPM_WriteString((CHAR*)"__FINI", 7);
|
||||
} else {
|
||||
OPM_WriteString((CHAR*)"__ENDMOD", 9);
|
||||
|
|
@ -1553,7 +1553,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc)
|
|||
|
||||
void OPV_Module (OPT_Node prog)
|
||||
{
|
||||
if (!__IN(10, OPM_opt, 32)) {
|
||||
if (!__IN(10, OPM_Options, 32)) {
|
||||
OPC_GenHdr(prog->right);
|
||||
OPC_GenHdrIncludes();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef OPV__h
|
||||
#define OPV__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -65,6 +65,7 @@ export int16 Platform_Identify (int32 h, Platform_FileIdentity *identity, addres
|
|||
export int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ);
|
||||
export BOOLEAN Platform_Inaccessible (int16 e);
|
||||
export void Platform_Init (int16 argc, int32 argvadr);
|
||||
export BOOLEAN Platform_Interrupted (int16 e);
|
||||
export void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d);
|
||||
export int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h);
|
||||
export BOOLEAN Platform_NoSuchDirectory (int16 e);
|
||||
|
|
@ -115,6 +116,7 @@ export BOOLEAN Platform_getEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT
|
|||
#define Platform_ECONNABORTED() ECONNABORTED
|
||||
#define Platform_ECONNREFUSED() ECONNREFUSED
|
||||
#define Platform_EHOSTUNREACH() EHOSTUNREACH
|
||||
#define Platform_EINTR() EINTR
|
||||
#define Platform_EMFILE() EMFILE
|
||||
#define Platform_ENETUNREACH() ENETUNREACH
|
||||
#define Platform_ENFILE() ENFILE
|
||||
|
|
@ -218,6 +220,13 @@ BOOLEAN Platform_ConnectionFailed (int16 e)
|
|||
return _o_result;
|
||||
}
|
||||
|
||||
BOOLEAN Platform_Interrupted (int16 e)
|
||||
{
|
||||
BOOLEAN _o_result;
|
||||
_o_result = e == Platform_EINTR();
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
int32 Platform_OSAllocate (int32 size)
|
||||
{
|
||||
int32 _o_result;
|
||||
|
|
@ -618,13 +627,11 @@ int16 Platform_Chdir (CHAR *n, LONGINT n__len)
|
|||
{
|
||||
int16 _o_result;
|
||||
int16 r;
|
||||
r = Platform_chdir(n, n__len);
|
||||
Platform_getcwd((void*)Platform_CWD, 256);
|
||||
if (r < 0) {
|
||||
_o_result = Platform_err();
|
||||
if ((Platform_chdir(n, n__len) >= 0 && Platform_getcwd((void*)Platform_CWD, 256) != NIL)) {
|
||||
_o_result = 0;
|
||||
return _o_result;
|
||||
} else {
|
||||
_o_result = 0;
|
||||
_o_result = Platform_err();
|
||||
return _o_result;
|
||||
}
|
||||
__RETCHK;
|
||||
|
|
@ -784,9 +791,10 @@ export void *Platform__init(void)
|
|||
Platform_HaltHandler = NIL;
|
||||
Platform_TimeStart = 0;
|
||||
Platform_TimeStart = Platform_Time();
|
||||
Platform_CWD[0] = 0x00;
|
||||
Platform_getcwd((void*)Platform_CWD, 256);
|
||||
Platform_PID = Platform_getpid();
|
||||
if (Platform_getcwd((void*)Platform_CWD, 256) == NIL) {
|
||||
Platform_CWD[0] = 0x00;
|
||||
}
|
||||
Platform_SeekSet = Platform_seekset();
|
||||
Platform_SeekCur = Platform_seekcur();
|
||||
Platform_SeekEnd = Platform_seekend();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef Platform__h
|
||||
#define Platform__h
|
||||
|
|
@ -50,6 +50,7 @@ import int16 Platform_Identify (int32 h, Platform_FileIdentity *identity, addres
|
|||
import int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ);
|
||||
import BOOLEAN Platform_Inaccessible (int16 e);
|
||||
import void Platform_Init (int16 argc, int32 argvadr);
|
||||
import BOOLEAN Platform_Interrupted (int16 e);
|
||||
import void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d);
|
||||
import int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h);
|
||||
import BOOLEAN Platform_NoSuchDirectory (int16 e);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef Reals__h
|
||||
#define Reals__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef Strings__h
|
||||
#define Strings__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef Texts__h
|
||||
#define Texts__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef errors__h
|
||||
#define errors__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -12,10 +12,11 @@
|
|||
#include "Strings.h"
|
||||
|
||||
|
||||
static CHAR extTools_compilationOptions[1023], extTools_CFLAGS[1023];
|
||||
static CHAR extTools_CFLAGS[1023];
|
||||
|
||||
|
||||
export void extTools_Assemble (CHAR *moduleName, LONGINT moduleName__len);
|
||||
static void extTools_InitialiseCompilerCommand (CHAR *s, LONGINT s__len);
|
||||
export void extTools_LinkMain (CHAR *moduleName, LONGINT moduleName__len, BOOLEAN statically, CHAR *additionalopts, LONGINT additionalopts__len);
|
||||
static void extTools_execute (CHAR *title, LONGINT title__len, CHAR *cmd, LONGINT cmd__len);
|
||||
|
||||
|
|
@ -25,7 +26,7 @@ static void extTools_execute (CHAR *title, LONGINT title__len, CHAR *cmd, LONGIN
|
|||
int16 r, status, exitcode;
|
||||
__DUP(title, title__len, CHAR);
|
||||
__DUP(cmd, cmd__len, CHAR);
|
||||
if (__IN(18, OPM_opt, 32)) {
|
||||
if (__IN(18, OPM_Options, 32)) {
|
||||
Console_String(title, title__len);
|
||||
Console_String(cmd, cmd__len);
|
||||
Console_Ln();
|
||||
|
|
@ -60,12 +61,22 @@ static void extTools_execute (CHAR *title, LONGINT title__len, CHAR *cmd, LONGIN
|
|||
__DEL(cmd);
|
||||
}
|
||||
|
||||
static void extTools_InitialiseCompilerCommand (CHAR *s, LONGINT s__len)
|
||||
{
|
||||
__COPY("gcc -g -O1", s, s__len);
|
||||
Strings_Append((CHAR*)" -I \"", 6, (void*)s, s__len);
|
||||
Strings_Append(OPM_ResourceDir, 1024, (void*)s, s__len);
|
||||
Strings_Append((CHAR*)"/include\" ", 11, (void*)s, s__len);
|
||||
Platform_GetEnv((CHAR*)"CFLAGS", 7, (void*)extTools_CFLAGS, 1023);
|
||||
Strings_Append(extTools_CFLAGS, 1023, (void*)s, s__len);
|
||||
Strings_Append((CHAR*)" ", 2, (void*)s, s__len);
|
||||
}
|
||||
|
||||
void extTools_Assemble (CHAR *moduleName, LONGINT moduleName__len)
|
||||
{
|
||||
CHAR cmd[1023];
|
||||
__DUP(moduleName, moduleName__len, CHAR);
|
||||
__MOVE("gcc -g -O1", cmd, 11);
|
||||
Strings_Append(extTools_compilationOptions, 1023, (void*)cmd, 1023);
|
||||
extTools_InitialiseCompilerCommand((void*)cmd, 1023);
|
||||
Strings_Append((CHAR*)"-c ", 4, (void*)cmd, 1023);
|
||||
Strings_Append(moduleName, moduleName__len, (void*)cmd, 1023);
|
||||
Strings_Append((CHAR*)".c", 3, (void*)cmd, 1023);
|
||||
|
|
@ -77,9 +88,7 @@ void extTools_LinkMain (CHAR *moduleName, LONGINT moduleName__len, BOOLEAN stati
|
|||
{
|
||||
CHAR cmd[1023];
|
||||
__DUP(additionalopts, additionalopts__len, CHAR);
|
||||
__MOVE("gcc -g -O1", cmd, 11);
|
||||
Strings_Append((CHAR*)" ", 2, (void*)cmd, 1023);
|
||||
Strings_Append(extTools_compilationOptions, 1023, (void*)cmd, 1023);
|
||||
extTools_InitialiseCompilerCommand((void*)cmd, 1023);
|
||||
Strings_Append(moduleName, moduleName__len, (void*)cmd, 1023);
|
||||
Strings_Append((CHAR*)".c ", 4, (void*)cmd, 1023);
|
||||
Strings_Append(additionalopts, additionalopts__len, (void*)cmd, 1023);
|
||||
|
|
@ -92,6 +101,7 @@ void extTools_LinkMain (CHAR *moduleName, LONGINT moduleName__len, BOOLEAN stati
|
|||
Strings_Append((CHAR*)"", 1, (void*)cmd, 1023);
|
||||
Strings_Append((CHAR*)"/lib\"", 6, (void*)cmd, 1023);
|
||||
Strings_Append((CHAR*)" -l voc", 8, (void*)cmd, 1023);
|
||||
Strings_Append(OPM_Model, 10, (void*)cmd, 1023);
|
||||
extTools_execute((CHAR*)"Assemble and link: ", 20, cmd, 1023);
|
||||
__DEL(additionalopts);
|
||||
}
|
||||
|
|
@ -107,11 +117,5 @@ export void *extTools__init(void)
|
|||
__MODULE_IMPORT(Strings);
|
||||
__REGMOD("extTools", 0);
|
||||
/* BEGIN */
|
||||
Strings_Append((CHAR*)" -I \"", 6, (void*)extTools_compilationOptions, 1023);
|
||||
Strings_Append((CHAR*)"", 1, (void*)extTools_compilationOptions, 1023);
|
||||
Strings_Append((CHAR*)"/include\" ", 11, (void*)extTools_compilationOptions, 1023);
|
||||
Platform_GetEnv((CHAR*)"CFLAGS", 7, (void*)extTools_CFLAGS, 1023);
|
||||
Strings_Append(extTools_CFLAGS, 1023, (void*)extTools_compilationOptions, 1023);
|
||||
Strings_Append((CHAR*)" ", 2, (void*)extTools_compilationOptions, 1023);
|
||||
__ENDMOD;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef extTools__h
|
||||
#define extTools__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef vt100__h
|
||||
#define vt100__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -32,7 +32,7 @@ void Compiler_Module (BOOLEAN *done)
|
|||
{
|
||||
BOOLEAN ext, new;
|
||||
OPT_Node p = NIL;
|
||||
OPP_Module(&p, OPM_opt);
|
||||
OPP_Module(&p, OPM_Options);
|
||||
if (OPM_noerr) {
|
||||
OPV_Init();
|
||||
OPT_InitRecno();
|
||||
|
|
@ -43,22 +43,22 @@ void Compiler_Module (BOOLEAN *done)
|
|||
OPC_Init();
|
||||
OPV_Module(p);
|
||||
if (OPM_noerr) {
|
||||
if ((__IN(10, OPM_opt, 32) && __STRCMP(OPM_modName, "SYSTEM") != 0)) {
|
||||
if ((__IN(10, OPM_Options, 32) && __STRCMP(OPM_modName, "SYSTEM") != 0)) {
|
||||
OPM_DeleteNewSym();
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"32m", 4);
|
||||
}
|
||||
OPM_LogWStr((CHAR*)" Main program.", 16);
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"0m", 3);
|
||||
}
|
||||
} else {
|
||||
if (new) {
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"32m", 4);
|
||||
}
|
||||
OPM_LogWStr((CHAR*)" New symbol file.", 19);
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"0m", 3);
|
||||
}
|
||||
OPM_RegisterNewSym();
|
||||
|
|
@ -115,17 +115,17 @@ void Compiler_Translate (void)
|
|||
OPM_LogWLn();
|
||||
Platform_Exit(1);
|
||||
}
|
||||
if (!__IN(13, OPM_opt, 32)) {
|
||||
if (__IN(14, OPM_opt, 32)) {
|
||||
if (!__IN(13, OPM_Options, 32)) {
|
||||
if (__IN(14, OPM_Options, 32)) {
|
||||
extTools_Assemble(OPM_modName, 32);
|
||||
} else {
|
||||
if (!__IN(10, OPM_opt, 32)) {
|
||||
if (!__IN(10, OPM_Options, 32)) {
|
||||
extTools_Assemble(OPM_modName, 32);
|
||||
Strings_Append((CHAR*)" ", 2, (void*)modulesobj, 2048);
|
||||
Strings_Append(OPM_modName, 32, (void*)modulesobj, 2048);
|
||||
Strings_Append((CHAR*)".o", 3, (void*)modulesobj, 2048);
|
||||
} else {
|
||||
extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_opt, 32), modulesobj, 2048);
|
||||
extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_Options, 32), modulesobj, 2048);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -18,6 +18,6 @@ export void *Configuration__init(void)
|
|||
__DEFMOD;
|
||||
__REGMOD("Configuration", 0);
|
||||
/* BEGIN */
|
||||
__MOVE("1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75);
|
||||
__MOVE("1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75);
|
||||
__ENDMOD;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef Configuration__h
|
||||
#define Configuration__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef Console__h
|
||||
#define Console__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
|
||||
#ifndef Files__h
|
||||
#define Files__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
|
||||
|
||||
#ifndef Heap__h
|
||||
#define Heap__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef Modules__h
|
||||
#define Modules__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -1541,28 +1541,9 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode)
|
|||
OPT_Struct y = NIL;
|
||||
int16 f, g;
|
||||
OPT_Struct p = NIL, q = NIL;
|
||||
if (__IN(18, OPM_opt, 32)) {
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"PROCEDURE CheckAssign", 22);
|
||||
OPM_LogWLn();
|
||||
}
|
||||
y = ynode->typ;
|
||||
f = x->form;
|
||||
g = y->form;
|
||||
if (__IN(18, OPM_opt, 32)) {
|
||||
OPM_LogWStr((CHAR*)"y.form = ", 10);
|
||||
OPM_LogWNum(y->form, 0);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"f = ", 5);
|
||||
OPM_LogWNum(f, 0);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"g = ", 5);
|
||||
OPM_LogWNum(g, 0);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"ynode.typ.syze = ", 18);
|
||||
OPM_LogWNum(ynode->typ->size, 0);
|
||||
OPM_LogWLn();
|
||||
}
|
||||
if (ynode->class == 8 || (ynode->class == 9 && f != 12)) {
|
||||
OPB_err(126);
|
||||
}
|
||||
|
|
@ -2367,7 +2348,7 @@ static void OPB_DynArrParCheck (OPT_Struct ftyp, OPT_Struct atyp, BOOLEAN fvarpa
|
|||
atyp = atyp->BaseTyp;
|
||||
if ((fvarpar && ftyp == OPT_bytetyp)) {
|
||||
if (!__IN(f, 0x0c, 32) || !((__IN(atyp->form, 0x1e, 32) && atyp->size == 1))) {
|
||||
if (__IN(18, OPM_opt, 32)) {
|
||||
if (__IN(18, OPM_Options, 32)) {
|
||||
OPB_err(-301);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef OPB__h
|
||||
#define OPB__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -989,7 +989,7 @@ static void OPC_IdentList (OPT_Object obj, int16 vis)
|
|||
OPC_Ident(obj);
|
||||
OPM_WriteString((CHAR*)"__typ", 6);
|
||||
base = NIL;
|
||||
} else if ((((((__IN(5, OPM_opt, 32) && vis == 0)) && obj->mnolev > 0)) && obj->typ->form == 11)) {
|
||||
} else if ((((((__IN(5, OPM_Options, 32) && vis == 0)) && obj->mnolev > 0)) && obj->typ->form == 11)) {
|
||||
OPM_WriteString((CHAR*)" = NIL", 7);
|
||||
}
|
||||
}
|
||||
|
|
@ -1153,7 +1153,7 @@ static void OPC_GenHeaderMsg (void)
|
|||
OPM_Write(' ');
|
||||
i = 0;
|
||||
while (i <= 31) {
|
||||
if (__IN(i, OPM_glbopt, 32)) {
|
||||
if (__IN(i, OPM_Options, 32)) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
OPM_Write('x');
|
||||
|
|
@ -1355,7 +1355,7 @@ void OPC_EnterBody (void)
|
|||
{
|
||||
OPM_WriteLn();
|
||||
OPM_WriteString((CHAR*)"export ", 8);
|
||||
if (__IN(10, OPM_opt, 32)) {
|
||||
if (__IN(10, OPM_Options, 32)) {
|
||||
OPM_WriteString((CHAR*)"int main(int argc, char **argv)", 32);
|
||||
OPM_WriteLn();
|
||||
} else {
|
||||
|
|
@ -1366,20 +1366,20 @@ void OPC_EnterBody (void)
|
|||
}
|
||||
OPC_BegBlk();
|
||||
OPC_BegStat();
|
||||
if (__IN(10, OPM_opt, 32)) {
|
||||
if (__IN(10, OPM_Options, 32)) {
|
||||
OPM_WriteString((CHAR*)"__INIT(argc, argv)", 19);
|
||||
} else {
|
||||
OPM_WriteString((CHAR*)"__DEFMOD", 9);
|
||||
}
|
||||
OPC_EndStat();
|
||||
if ((__IN(10, OPM_opt, 32) && 0)) {
|
||||
if ((__IN(10, OPM_Options, 32) && 0)) {
|
||||
OPC_BegStat();
|
||||
OPM_WriteString((CHAR*)"/*don`t do it!*/ printf(\"DEMO VERSION: DO NOT USE THIS PROGRAM FOR ANY COMMERCIAL PURPOSE\\n\")", 94);
|
||||
OPC_EndStat();
|
||||
}
|
||||
OPC_InitImports(OPT_topScope->right);
|
||||
OPC_BegStat();
|
||||
if (__IN(10, OPM_opt, 32)) {
|
||||
if (__IN(10, OPM_Options, 32)) {
|
||||
OPM_WriteString((CHAR*)"__REGMAIN(\"", 12);
|
||||
} else {
|
||||
OPM_WriteString((CHAR*)"__REGMOD(\"", 11);
|
||||
|
|
@ -1399,7 +1399,7 @@ void OPC_EnterBody (void)
|
|||
void OPC_ExitBody (void)
|
||||
{
|
||||
OPC_BegStat();
|
||||
if (__IN(10, OPM_opt, 32)) {
|
||||
if (__IN(10, OPM_Options, 32)) {
|
||||
OPM_WriteString((CHAR*)"__FINI;", 8);
|
||||
} else {
|
||||
OPM_WriteString((CHAR*)"__ENDMOD;", 10);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef OPC__h
|
||||
#define OPC__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -19,7 +19,14 @@ typedef
|
|||
|
||||
|
||||
static CHAR OPM_SourceFileName[256];
|
||||
export int16 OPM_AddressSize, OPM_Alignment, OPM_SetSize, OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_MaxSet;
|
||||
static CHAR OPM_GlobalModel[10];
|
||||
export CHAR OPM_Model[10];
|
||||
static int16 OPM_GlobalAddressSize;
|
||||
export int16 OPM_AddressSize;
|
||||
static int16 OPM_GlobalAlignment;
|
||||
export int16 OPM_Alignment;
|
||||
export SET OPM_GlobalOptions, OPM_Options;
|
||||
export int16 OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_SetSize, OPM_MaxSet;
|
||||
export int64 OPM_MaxIndex;
|
||||
export LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal;
|
||||
export BOOLEAN OPM_noerr;
|
||||
|
|
@ -27,7 +34,6 @@ export int32 OPM_curpos, OPM_errpos, OPM_breakpc;
|
|||
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 Texts_Reader OPM_inR;
|
||||
static Texts_Text OPM_Log;
|
||||
|
|
@ -36,8 +42,7 @@ 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 int16 OPM_S;
|
||||
static CHAR OPM_OBERON[1024];
|
||||
static CHAR OPM_MODULES[1024];
|
||||
export CHAR OPM_ResourceDir[1024];
|
||||
|
||||
|
||||
static void OPM_Append (Files_Rider *R, address *R__typ, Files_File F);
|
||||
|
|
@ -50,8 +55,6 @@ 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, address *r__typ, int64 pos);
|
||||
export void OPM_Get (CHAR *ch);
|
||||
static void OPM_GetProperties (void);
|
||||
static void OPM_GetProperty (Texts_Scanner *S, address *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);
|
||||
|
|
@ -68,7 +71,7 @@ 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_ScanOptions (CHAR *s, LONGINT s__len);
|
||||
static void OPM_ShowLine (int64 pos);
|
||||
export int64 OPM_SignedMaximum (int32 bytecount);
|
||||
export int64 OPM_SignedMinimum (int32 bytecount);
|
||||
|
|
@ -93,10 +96,8 @@ 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 (int16 n);
|
||||
static int32 OPM_minusop (int32 i);
|
||||
static int32 OPM_power0 (int32 i, int32 j);
|
||||
|
||||
#define OPM_GetAlignment(a) struct {char c; long long l;} s; *a = (char*)&s.l - (char*)&s
|
||||
#define OPM_GetAlignment(a) struct {char c; long long l;} _s; *a = (char*)&_s.l - (char*)&_s
|
||||
|
||||
void OPM_LogW (CHAR ch)
|
||||
{
|
||||
|
|
@ -120,6 +121,23 @@ void OPM_LogWLn (void)
|
|||
Console_Ln();
|
||||
}
|
||||
|
||||
int64 OPM_SignedMaximum (int32 bytecount)
|
||||
{
|
||||
int64 _o_result;
|
||||
int64 result;
|
||||
result = 1;
|
||||
result = __LSH(result, __ASHL(bytecount, 3) - 1, 64);
|
||||
_o_result = result - 1;
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
int64 OPM_SignedMinimum (int32 bytecount)
|
||||
{
|
||||
int64 _o_result;
|
||||
_o_result = -OPM_SignedMaximum(bytecount) - 1;
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
int32 OPM_Longint (int64 n)
|
||||
{
|
||||
int32 _o_result;
|
||||
|
|
@ -134,7 +152,7 @@ int16 OPM_Integer (int64 n)
|
|||
return _o_result;
|
||||
}
|
||||
|
||||
static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt)
|
||||
static void OPM_ScanOptions (CHAR *s, LONGINT s__len)
|
||||
{
|
||||
int16 i;
|
||||
__DUP(s, s__len, CHAR);
|
||||
|
|
@ -142,75 +160,57 @@ static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt)
|
|||
while (s[__X(i, s__len)] != 0x00) {
|
||||
switch (s[__X(i, s__len)]) {
|
||||
case 'p':
|
||||
*opt = *opt ^ 0x20;
|
||||
OPM_Options = OPM_Options ^ 0x20;
|
||||
break;
|
||||
case 'a':
|
||||
*opt = *opt ^ 0x80;
|
||||
OPM_Options = OPM_Options ^ 0x80;
|
||||
break;
|
||||
case 'r':
|
||||
*opt = *opt ^ 0x04;
|
||||
OPM_Options = OPM_Options ^ 0x04;
|
||||
break;
|
||||
case 't':
|
||||
*opt = *opt ^ 0x08;
|
||||
OPM_Options = OPM_Options ^ 0x08;
|
||||
break;
|
||||
case 'x':
|
||||
*opt = *opt ^ 0x01;
|
||||
OPM_Options = OPM_Options ^ 0x01;
|
||||
break;
|
||||
case 'e':
|
||||
*opt = *opt ^ 0x0200;
|
||||
OPM_Options = OPM_Options ^ 0x0200;
|
||||
break;
|
||||
case 's':
|
||||
*opt = *opt ^ 0x10;
|
||||
OPM_Options = OPM_Options ^ 0x10;
|
||||
break;
|
||||
case 'F':
|
||||
*opt = *opt ^ 0x020000;
|
||||
OPM_Options = OPM_Options ^ 0x020000;
|
||||
break;
|
||||
case 'm':
|
||||
*opt = *opt ^ 0x0400;
|
||||
OPM_Options = OPM_Options ^ 0x0400;
|
||||
break;
|
||||
case 'M':
|
||||
*opt = *opt ^ 0x8000;
|
||||
OPM_Options = OPM_Options ^ 0x8000;
|
||||
break;
|
||||
case 'S':
|
||||
*opt = *opt ^ 0x2000;
|
||||
OPM_Options = OPM_Options ^ 0x2000;
|
||||
break;
|
||||
case 'c':
|
||||
*opt = *opt ^ 0x4000;
|
||||
OPM_Options = OPM_Options ^ 0x4000;
|
||||
break;
|
||||
case 'f':
|
||||
*opt = *opt ^ 0x010000;
|
||||
OPM_Options = OPM_Options ^ 0x010000;
|
||||
break;
|
||||
case 'V':
|
||||
*opt = *opt ^ 0x040000;
|
||||
OPM_Options = OPM_Options ^ 0x040000;
|
||||
break;
|
||||
case 'O':
|
||||
if (i + 1 >= Strings_Length(s, s__len)) {
|
||||
OPM_LogWStr((CHAR*)"-O option requires following size model character.", 51);
|
||||
OPM_LogWLn();
|
||||
} else {
|
||||
switch (s[__X(i + 1, s__len)]) {
|
||||
case '2':
|
||||
OPM_ShortintSize = 1;
|
||||
OPM_IntegerSize = 2;
|
||||
OPM_LongintSize = 4;
|
||||
OPM_SetSize = 4;
|
||||
break;
|
||||
case 'V':
|
||||
OPM_ShortintSize = 1;
|
||||
OPM_IntegerSize = 4;
|
||||
OPM_LongintSize = 8;
|
||||
OPM_SetSize = 8;
|
||||
break;
|
||||
case 'C':
|
||||
OPM_ShortintSize = 2;
|
||||
OPM_IntegerSize = 4;
|
||||
OPM_LongintSize = 8;
|
||||
OPM_SetSize = 8;
|
||||
break;
|
||||
default:
|
||||
OPM_LogWStr((CHAR*)"Unrecognised size model character following -O.", 48);
|
||||
OPM_LogWLn();
|
||||
break;
|
||||
OPM_Model[0] = s[__X(i + 1, s__len)];
|
||||
OPM_Model[1] = 0x00;
|
||||
if ((((OPM_Model[0] != '2' && OPM_Model[0] != 'C')) && OPM_Model[0] != 'V')) {
|
||||
OPM_LogWStr((CHAR*)"Unrecognised size model character following -O.", 48);
|
||||
OPM_LogWLn();
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
|
|
@ -358,39 +358,119 @@ BOOLEAN OPM_OpenPar (void)
|
|||
_o_result = 0;
|
||||
return _o_result;
|
||||
} else {
|
||||
OPM_AddressSize = 8;
|
||||
OPM_GetAlignment(&OPM_Alignment);
|
||||
__MOVE("2", OPM_Model, 2);
|
||||
OPM_Options = 0xa9;
|
||||
OPM_S = 1;
|
||||
s[0] = 0x00;
|
||||
Platform_GetArg(OPM_S, (void*)s, 256);
|
||||
OPM_glbopt = 0xa9;
|
||||
while (s[0] == '-') {
|
||||
OPM_ScanOptions(s, 256, &OPM_glbopt);
|
||||
OPM_ScanOptions(s, 256);
|
||||
OPM_S += 1;
|
||||
s[0] = 0x00;
|
||||
Platform_GetArg(OPM_S, (void*)s, 256);
|
||||
}
|
||||
OPM_GlobalAddressSize = OPM_AddressSize;
|
||||
OPM_GlobalAlignment = OPM_Alignment;
|
||||
__COPY(OPM_Model, OPM_GlobalModel, 10);
|
||||
OPM_GlobalOptions = OPM_Options;
|
||||
_o_result = 1;
|
||||
return _o_result;
|
||||
}
|
||||
__RETCHK;
|
||||
}
|
||||
|
||||
static void OPM_VerboseListSizes (void)
|
||||
{
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"Type Size", 15);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"SHORTINT ", 12);
|
||||
OPM_LogWNum(OPM_ShortintSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"INTEGER ", 12);
|
||||
OPM_LogWNum(OPM_IntegerSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"LONGINT ", 12);
|
||||
OPM_LogWNum(OPM_LongintSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"SET ", 12);
|
||||
OPM_LogWNum(OPM_SetSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"ADDRESS ", 12);
|
||||
OPM_LogWNum(OPM_AddressSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"Alignment: ", 12);
|
||||
OPM_LogWNum(OPM_Alignment, 4);
|
||||
OPM_LogWLn();
|
||||
}
|
||||
|
||||
void OPM_InitOptions (void)
|
||||
{
|
||||
CHAR s[256];
|
||||
OPM_opt = OPM_glbopt;
|
||||
CHAR searchpath[1024], modules[1024];
|
||||
CHAR MODULES[1024];
|
||||
OPM_Options = OPM_GlobalOptions;
|
||||
__COPY(OPM_GlobalModel, OPM_Model, 10);
|
||||
OPM_Alignment = OPM_GlobalAlignment;
|
||||
OPM_AddressSize = OPM_GlobalAddressSize;
|
||||
s[0] = 0x00;
|
||||
Platform_GetArg(OPM_S, (void*)s, 256);
|
||||
while (s[0] == '-') {
|
||||
OPM_ScanOptions(s, 256, &OPM_opt);
|
||||
OPM_ScanOptions(s, 256);
|
||||
OPM_S += 1;
|
||||
s[0] = 0x00;
|
||||
Platform_GetArg(OPM_S, (void*)s, 256);
|
||||
}
|
||||
if (__IN(15, OPM_opt, 32)) {
|
||||
OPM_glbopt |= __SETOF(10,32);
|
||||
OPM_opt |= __SETOF(10,32);
|
||||
if (__IN(15, OPM_Options, 32)) {
|
||||
OPM_Options |= __SETOF(10,32);
|
||||
}
|
||||
OPM_GetProperties();
|
||||
OPM_MaxIndex = OPM_SignedMaximum(OPM_AddressSize);
|
||||
switch (OPM_Model[0]) {
|
||||
case '2':
|
||||
OPM_ShortintSize = 1;
|
||||
OPM_IntegerSize = 2;
|
||||
OPM_LongintSize = 4;
|
||||
OPM_SetSize = 4;
|
||||
break;
|
||||
case 'C':
|
||||
OPM_ShortintSize = 2;
|
||||
OPM_IntegerSize = 4;
|
||||
OPM_LongintSize = 8;
|
||||
OPM_SetSize = 8;
|
||||
break;
|
||||
case 'V':
|
||||
OPM_ShortintSize = 1;
|
||||
OPM_IntegerSize = 4;
|
||||
OPM_LongintSize = 8;
|
||||
OPM_SetSize = 8;
|
||||
break;
|
||||
default:
|
||||
OPM_ShortintSize = 1;
|
||||
OPM_IntegerSize = 2;
|
||||
OPM_LongintSize = 4;
|
||||
OPM_SetSize = 4;
|
||||
break;
|
||||
}
|
||||
OPM_MaxSet = __ASHL(OPM_SetSize, 3) - 1;
|
||||
if (__IN(18, OPM_Options, 32)) {
|
||||
OPM_VerboseListSizes();
|
||||
}
|
||||
OPM_ResourceDir[0] = 0x00;
|
||||
Strings_Append((CHAR*)"/", 2, (void*)OPM_ResourceDir, 1024);
|
||||
Strings_Append(OPM_Model, 10, (void*)OPM_ResourceDir, 1024);
|
||||
modules[0] = 0x00;
|
||||
Platform_GetEnv((CHAR*)"MODULES", 8, (void*)modules, 1024);
|
||||
__MOVE(".", searchpath, 2);
|
||||
Platform_GetEnv((CHAR*)"OBERON", 7, (void*)searchpath, 1024);
|
||||
Strings_Append((CHAR*)";.;", 4, (void*)searchpath, 1024);
|
||||
Strings_Append(modules, 1024, (void*)searchpath, 1024);
|
||||
Strings_Append((CHAR*)";", 2, (void*)searchpath, 1024);
|
||||
Strings_Append(OPM_ResourceDir, 1024, (void*)searchpath, 1024);
|
||||
Strings_Append((CHAR*)"/sym;", 6, (void*)searchpath, 1024);
|
||||
Files_SetSearchPath(searchpath, 1024);
|
||||
}
|
||||
|
||||
void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len)
|
||||
|
|
@ -474,20 +554,20 @@ static void OPM_LogErrMsg (int16 n)
|
|||
int16 i;
|
||||
CHAR buf[1024];
|
||||
if (n >= 0) {
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"31m", 4);
|
||||
}
|
||||
OPM_LogWStr((CHAR*)" err ", 7);
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"0m", 3);
|
||||
}
|
||||
} else {
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"35m", 4);
|
||||
}
|
||||
OPM_LogWStr((CHAR*)" warning ", 11);
|
||||
n = -n;
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"0m", 3);
|
||||
}
|
||||
}
|
||||
|
|
@ -560,11 +640,11 @@ static void OPM_ShowLine (int64 pos)
|
|||
OPM_LogW(' ');
|
||||
i -= 1;
|
||||
}
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"32m", 4);
|
||||
}
|
||||
OPM_LogW('^');
|
||||
if (!__IN(16, OPM_opt, 32)) {
|
||||
if (!__IN(16, OPM_Options, 32)) {
|
||||
vt100_SetAttr((CHAR*)"0m", 3);
|
||||
}
|
||||
Files_Close(f);
|
||||
|
|
@ -654,106 +734,6 @@ void OPM_FPrintLReal (int32 *fp, LONGREAL lr)
|
|||
OPM_FPrint(&*fp, h);
|
||||
}
|
||||
|
||||
static void OPM_GetProperty (Texts_Scanner *S, address *S__typ, CHAR *name, LONGINT name__len, int16 *size, int16 *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 = (int16)(*S).i;
|
||||
Texts_Scan(&*S, S__typ);
|
||||
} else {
|
||||
OPM_Mark(-157, -1);
|
||||
}
|
||||
if ((*S).class == 3) {
|
||||
*align = (int16)(*S).i;
|
||||
Texts_Scan(&*S, S__typ);
|
||||
} else {
|
||||
OPM_Mark(-157, -1);
|
||||
}
|
||||
} else {
|
||||
OPM_Mark(-157, -1);
|
||||
}
|
||||
__DEL(name);
|
||||
}
|
||||
|
||||
static int32 OPM_minusop (int32 i)
|
||||
{
|
||||
int32 _o_result;
|
||||
_o_result = -i;
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
static int32 OPM_power0 (int32 i, int32 j)
|
||||
{
|
||||
int32 _o_result;
|
||||
int32 k, p;
|
||||
k = 1;
|
||||
p = i;
|
||||
do {
|
||||
p = p * i;
|
||||
k += 1;
|
||||
} while (!(k == j));
|
||||
_o_result = p;
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
static void OPM_VerboseListSizes (void)
|
||||
{
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"Type Size", 17);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"SHORTINT ", 14);
|
||||
OPM_LogWNum(OPM_ShortintSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"INTEGER ", 14);
|
||||
OPM_LogWNum(OPM_IntegerSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"LONGINT ", 14);
|
||||
OPM_LogWNum(OPM_LongintSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"SET ", 14);
|
||||
OPM_LogWNum(OPM_SetSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"ADDRESS ", 14);
|
||||
OPM_LogWNum(OPM_AddressSize, 4);
|
||||
OPM_LogWLn();
|
||||
OPM_LogWLn();
|
||||
OPM_LogWStr((CHAR*)"Alignment: ", 12);
|
||||
OPM_LogWNum(OPM_Alignment, 4);
|
||||
OPM_LogWLn();
|
||||
}
|
||||
|
||||
int64 OPM_SignedMaximum (int32 bytecount)
|
||||
{
|
||||
int64 _o_result;
|
||||
int64 result;
|
||||
result = 1;
|
||||
result = __LSH(result, __ASHL(bytecount, 3) - 1, 64);
|
||||
_o_result = result - 1;
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
int64 OPM_SignedMinimum (int32 bytecount)
|
||||
{
|
||||
int64 _o_result;
|
||||
_o_result = -OPM_SignedMaximum(bytecount) - 1;
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
static void OPM_GetProperties (void)
|
||||
{
|
||||
OPM_MaxReal = 3.40282346000000e+038;
|
||||
OPM_MaxLReal = 1.79769296342094e+308;
|
||||
OPM_MinReal = -OPM_MaxReal;
|
||||
OPM_MinLReal = -OPM_MaxLReal;
|
||||
OPM_MaxSet = __ASHL(OPM_SetSize, 3) - 1;
|
||||
OPM_MaxIndex = OPM_SignedMaximum(OPM_AddressSize);
|
||||
if (__IN(18, OPM_opt, 32)) {
|
||||
OPM_VerboseListSizes();
|
||||
}
|
||||
}
|
||||
|
||||
void OPM_SymRCh (CHAR *ch)
|
||||
{
|
||||
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&*ch);
|
||||
|
|
@ -848,7 +828,7 @@ void OPM_SymWLReal (LONGREAL lr)
|
|||
|
||||
void OPM_RegisterNewSym (void)
|
||||
{
|
||||
if (__STRCMP(OPM_modName, "SYSTEM") != 0 || __IN(10, OPM_opt, 32)) {
|
||||
if (__STRCMP(OPM_modName, "SYSTEM") != 0 || __IN(10, OPM_Options, 32)) {
|
||||
Files_Register(OPM_newSFile);
|
||||
}
|
||||
}
|
||||
|
|
@ -1047,10 +1027,10 @@ void OPM_CloseFiles (void)
|
|||
}
|
||||
if (OPM_noerr) {
|
||||
if (__STRCMP(OPM_modName, "SYSTEM") == 0) {
|
||||
if (!__IN(10, OPM_opt, 32)) {
|
||||
if (!__IN(10, OPM_Options, 32)) {
|
||||
Files_Register(OPM_BFile);
|
||||
}
|
||||
} else if (!__IN(10, OPM_opt, 32)) {
|
||||
} else if (!__IN(10, OPM_Options, 32)) {
|
||||
OPM_Append(&OPM_R[2], Files_Rider__typ, OPM_HFile);
|
||||
Files_Register(OPM_HIFile);
|
||||
Files_Register(OPM_BFile);
|
||||
|
|
@ -1110,22 +1090,10 @@ export void *OPM__init(void)
|
|||
__REGCMD("RegisterNewSym", OPM_RegisterNewSym);
|
||||
__REGCMD("WriteLn", OPM_WriteLn);
|
||||
/* BEGIN */
|
||||
OPM_MaxReal = 3.40282346000000e+038;
|
||||
OPM_MaxLReal = 1.79769296342094e+308;
|
||||
OPM_MinReal = -OPM_MaxReal;
|
||||
OPM_MinLReal = -OPM_MaxLReal;
|
||||
Texts_OpenWriter(&OPM_W, Texts_Writer__typ);
|
||||
OPM_MODULES[0] = 0x00;
|
||||
Platform_GetEnv((CHAR*)"MODULES", 8, (void*)OPM_MODULES, 1024);
|
||||
__MOVE(".", OPM_OBERON, 2);
|
||||
Platform_GetEnv((CHAR*)"OBERON", 7, (void*)OPM_OBERON, 1024);
|
||||
Strings_Append((CHAR*)";.;", 4, (void*)OPM_OBERON, 1024);
|
||||
Strings_Append(OPM_MODULES, 1024, (void*)OPM_OBERON, 1024);
|
||||
Strings_Append((CHAR*)";", 2, (void*)OPM_OBERON, 1024);
|
||||
Strings_Append((CHAR*)"", 1, (void*)OPM_OBERON, 1024);
|
||||
Strings_Append((CHAR*)"/sym;", 6, (void*)OPM_OBERON, 1024);
|
||||
Files_SetSearchPath(OPM_OBERON, 1024);
|
||||
OPM_AddressSize = 8;
|
||||
OPM_GetAlignment(&OPM_Alignment);
|
||||
OPM_ShortintSize = 1;
|
||||
OPM_IntegerSize = 2;
|
||||
OPM_LongintSize = 4;
|
||||
OPM_SetSize = 4;
|
||||
__ENDMOD;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef OPM__h
|
||||
#define OPM__h
|
||||
|
|
@ -6,7 +6,10 @@
|
|||
#include "SYSTEM.h"
|
||||
|
||||
|
||||
import int16 OPM_AddressSize, OPM_Alignment, OPM_SetSize, OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_MaxSet;
|
||||
import CHAR OPM_Model[10];
|
||||
import int16 OPM_AddressSize, OPM_Alignment;
|
||||
import SET OPM_GlobalOptions, OPM_Options;
|
||||
import int16 OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_SetSize, OPM_MaxSet;
|
||||
import int64 OPM_MaxIndex;
|
||||
import LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal;
|
||||
import BOOLEAN OPM_noerr;
|
||||
|
|
@ -14,7 +17,7 @@ import int32 OPM_curpos, OPM_errpos, OPM_breakpc;
|
|||
import int16 OPM_currFile, OPM_level, OPM_pc, OPM_entno;
|
||||
import CHAR OPM_modName[32];
|
||||
import CHAR OPM_objname[64];
|
||||
import SET OPM_opt, OPM_glbopt;
|
||||
import CHAR OPM_ResourceDir[1024];
|
||||
|
||||
|
||||
import void OPM_CloseFiles (void);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#ifndef OPP__h
|
||||
#define OPP__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
|
||||
#ifndef OPS__h
|
||||
#define OPS__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/24]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
/* voc 1.95 [2016/09/26]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
|
||||
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
|
|
@ -1867,7 +1867,7 @@ void OPT_Export (BOOLEAN *ext, BOOLEAN *new)
|
|||
}
|
||||
OPT_OutObj(OPT_topScope->right);
|
||||
*ext = (OPT_sfpresent && OPT_symExtended);
|
||||
*new = (!OPT_sfpresent || OPT_symNew) || __IN(17, OPM_opt, 32);
|
||||
*new = (!OPT_sfpresent || OPT_symNew) || __IN(17, OPM_Options, 32);
|
||||
if ((((OPM_noerr && OPT_sfpresent)) && OPT_impCtxt.reffp != OPT_expCtxt.reffp)) {
|
||||
*new = 1;
|
||||
if (!OPT_extsf) {
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue