From 76b6a8fc2328d000fe32f99dea380287ec956250 Mon Sep 17 00:00:00 2001 From: David Brown Date: Wed, 21 Sep 2016 18:28:17 +0100 Subject: [PATCH] Clean option handling and add size model and target machine options. --- bootstrap/unix-44/Configuration.c | 2 +- bootstrap/unix-44/Configuration.h | 2 +- bootstrap/unix-44/Console.c | 2 +- bootstrap/unix-44/Console.h | 2 +- bootstrap/unix-44/Files.c | 2 +- bootstrap/unix-44/Files.h | 2 +- bootstrap/unix-44/Heap.c | 2 +- bootstrap/unix-44/Heap.h | 2 +- bootstrap/unix-44/Modules.c | 2 +- bootstrap/unix-44/Modules.h | 2 +- bootstrap/unix-44/OPB.c | 6 +- bootstrap/unix-44/OPB.h | 2 +- bootstrap/unix-44/OPC.c | 113 ++++----------- bootstrap/unix-44/OPC.h | 2 +- bootstrap/unix-44/OPM.c | 197 ++++++++++++++++++--------- bootstrap/unix-44/OPM.h | 3 +- bootstrap/unix-44/OPP.c | 2 +- bootstrap/unix-44/OPP.h | 2 +- bootstrap/unix-44/OPS.c | 2 +- bootstrap/unix-44/OPS.h | 2 +- bootstrap/unix-44/OPT.c | 7 +- bootstrap/unix-44/OPT.h | 2 +- bootstrap/unix-44/OPV.c | 34 ++--- bootstrap/unix-44/OPV.h | 2 +- bootstrap/unix-44/Platform.c | 2 +- bootstrap/unix-44/Platform.h | 2 +- bootstrap/unix-44/Reals.c | 2 +- bootstrap/unix-44/Reals.h | 2 +- bootstrap/unix-44/Strings.c | 2 +- bootstrap/unix-44/Strings.h | 2 +- bootstrap/unix-44/Texts.c | 2 +- bootstrap/unix-44/Texts.h | 2 +- bootstrap/unix-44/Vishap.c | 20 +-- bootstrap/unix-44/errors.c | 2 +- bootstrap/unix-44/errors.h | 2 +- bootstrap/unix-44/extTools.c | 4 +- bootstrap/unix-44/extTools.h | 2 +- bootstrap/unix-44/vt100.c | 2 +- bootstrap/unix-44/vt100.h | 2 +- bootstrap/unix-48/Configuration.c | 2 +- bootstrap/unix-48/Configuration.h | 2 +- bootstrap/unix-48/Console.c | 2 +- bootstrap/unix-48/Console.h | 2 +- bootstrap/unix-48/Files.c | 2 +- bootstrap/unix-48/Files.h | 2 +- bootstrap/unix-48/Heap.c | 2 +- bootstrap/unix-48/Heap.h | 2 +- bootstrap/unix-48/Modules.c | 2 +- bootstrap/unix-48/Modules.h | 2 +- bootstrap/unix-48/OPB.c | 6 +- bootstrap/unix-48/OPB.h | 2 +- bootstrap/unix-48/OPC.c | 113 ++++----------- bootstrap/unix-48/OPC.h | 2 +- bootstrap/unix-48/OPM.c | 197 ++++++++++++++++++--------- bootstrap/unix-48/OPM.h | 3 +- bootstrap/unix-48/OPP.c | 2 +- bootstrap/unix-48/OPP.h | 2 +- bootstrap/unix-48/OPS.c | 2 +- bootstrap/unix-48/OPS.h | 2 +- bootstrap/unix-48/OPT.c | 7 +- bootstrap/unix-48/OPT.h | 2 +- bootstrap/unix-48/OPV.c | 34 ++--- bootstrap/unix-48/OPV.h | 2 +- bootstrap/unix-48/Platform.c | 2 +- bootstrap/unix-48/Platform.h | 2 +- bootstrap/unix-48/Reals.c | 2 +- bootstrap/unix-48/Reals.h | 2 +- bootstrap/unix-48/Strings.c | 2 +- bootstrap/unix-48/Strings.h | 2 +- bootstrap/unix-48/Texts.c | 2 +- bootstrap/unix-48/Texts.h | 2 +- bootstrap/unix-48/Vishap.c | 20 +-- bootstrap/unix-48/errors.c | 2 +- bootstrap/unix-48/errors.h | 2 +- bootstrap/unix-48/extTools.c | 4 +- bootstrap/unix-48/extTools.h | 2 +- bootstrap/unix-48/vt100.c | 2 +- bootstrap/unix-48/vt100.h | 2 +- bootstrap/unix-88/Configuration.c | 2 +- bootstrap/unix-88/Configuration.h | 2 +- bootstrap/unix-88/Console.c | 2 +- bootstrap/unix-88/Console.h | 2 +- bootstrap/unix-88/Files.c | 2 +- bootstrap/unix-88/Files.h | 2 +- bootstrap/unix-88/Heap.c | 2 +- bootstrap/unix-88/Heap.h | 2 +- bootstrap/unix-88/Modules.c | 2 +- bootstrap/unix-88/Modules.h | 2 +- bootstrap/unix-88/OPB.c | 6 +- bootstrap/unix-88/OPB.h | 2 +- bootstrap/unix-88/OPC.c | 113 ++++----------- bootstrap/unix-88/OPC.h | 2 +- bootstrap/unix-88/OPM.c | 197 ++++++++++++++++++--------- bootstrap/unix-88/OPM.h | 3 +- bootstrap/unix-88/OPP.c | 2 +- bootstrap/unix-88/OPP.h | 2 +- bootstrap/unix-88/OPS.c | 2 +- bootstrap/unix-88/OPS.h | 2 +- bootstrap/unix-88/OPT.c | 7 +- bootstrap/unix-88/OPT.h | 2 +- bootstrap/unix-88/OPV.c | 34 ++--- bootstrap/unix-88/OPV.h | 2 +- bootstrap/unix-88/Platform.c | 2 +- bootstrap/unix-88/Platform.h | 2 +- bootstrap/unix-88/Reals.c | 2 +- bootstrap/unix-88/Reals.h | 2 +- bootstrap/unix-88/Strings.c | 2 +- bootstrap/unix-88/Strings.h | 2 +- bootstrap/unix-88/Texts.c | 2 +- bootstrap/unix-88/Texts.h | 2 +- bootstrap/unix-88/Vishap.c | 20 +-- bootstrap/unix-88/errors.c | 2 +- bootstrap/unix-88/errors.h | 2 +- bootstrap/unix-88/extTools.c | 4 +- bootstrap/unix-88/extTools.h | 2 +- bootstrap/unix-88/vt100.c | 2 +- bootstrap/unix-88/vt100.h | 2 +- bootstrap/windows-48/Configuration.c | 2 +- bootstrap/windows-48/Configuration.h | 2 +- bootstrap/windows-48/Console.c | 2 +- bootstrap/windows-48/Console.h | 2 +- bootstrap/windows-48/Files.c | 2 +- bootstrap/windows-48/Files.h | 2 +- bootstrap/windows-48/Heap.c | 2 +- bootstrap/windows-48/Heap.h | 2 +- bootstrap/windows-48/Modules.c | 2 +- bootstrap/windows-48/Modules.h | 2 +- bootstrap/windows-48/OPB.c | 6 +- bootstrap/windows-48/OPB.h | 2 +- bootstrap/windows-48/OPC.c | 113 ++++----------- bootstrap/windows-48/OPC.h | 2 +- bootstrap/windows-48/OPM.c | 197 ++++++++++++++++++--------- bootstrap/windows-48/OPM.h | 3 +- bootstrap/windows-48/OPP.c | 2 +- bootstrap/windows-48/OPP.h | 2 +- bootstrap/windows-48/OPS.c | 2 +- bootstrap/windows-48/OPS.h | 2 +- bootstrap/windows-48/OPT.c | 7 +- bootstrap/windows-48/OPT.h | 2 +- bootstrap/windows-48/OPV.c | 34 ++--- bootstrap/windows-48/OPV.h | 2 +- bootstrap/windows-48/Platform.c | 2 +- bootstrap/windows-48/Platform.h | 2 +- bootstrap/windows-48/Reals.c | 2 +- bootstrap/windows-48/Reals.h | 2 +- bootstrap/windows-48/Strings.c | 2 +- bootstrap/windows-48/Strings.h | 2 +- bootstrap/windows-48/Texts.c | 2 +- bootstrap/windows-48/Texts.h | 2 +- bootstrap/windows-48/Vishap.c | 20 +-- bootstrap/windows-48/errors.c | 2 +- bootstrap/windows-48/errors.h | 2 +- bootstrap/windows-48/extTools.c | 4 +- bootstrap/windows-48/extTools.h | 2 +- bootstrap/windows-48/vt100.c | 2 +- bootstrap/windows-48/vt100.h | 2 +- bootstrap/windows-88/Configuration.c | 2 +- bootstrap/windows-88/Configuration.h | 2 +- bootstrap/windows-88/Console.c | 2 +- bootstrap/windows-88/Console.h | 2 +- bootstrap/windows-88/Files.c | 2 +- bootstrap/windows-88/Files.h | 2 +- bootstrap/windows-88/Heap.c | 2 +- bootstrap/windows-88/Heap.h | 2 +- bootstrap/windows-88/Modules.c | 2 +- bootstrap/windows-88/Modules.h | 2 +- bootstrap/windows-88/OPB.c | 6 +- bootstrap/windows-88/OPB.h | 2 +- bootstrap/windows-88/OPC.c | 113 ++++----------- bootstrap/windows-88/OPC.h | 2 +- bootstrap/windows-88/OPM.c | 197 ++++++++++++++++++--------- bootstrap/windows-88/OPM.h | 3 +- bootstrap/windows-88/OPP.c | 2 +- bootstrap/windows-88/OPP.h | 2 +- bootstrap/windows-88/OPS.c | 2 +- bootstrap/windows-88/OPS.h | 2 +- bootstrap/windows-88/OPT.c | 7 +- bootstrap/windows-88/OPT.h | 2 +- bootstrap/windows-88/OPV.c | 34 ++--- bootstrap/windows-88/OPV.h | 2 +- bootstrap/windows-88/Platform.c | 2 +- bootstrap/windows-88/Platform.h | 2 +- bootstrap/windows-88/Reals.c | 2 +- bootstrap/windows-88/Reals.h | 2 +- bootstrap/windows-88/Strings.c | 2 +- bootstrap/windows-88/Strings.h | 2 +- bootstrap/windows-88/Texts.c | 2 +- bootstrap/windows-88/Texts.h | 2 +- bootstrap/windows-88/Vishap.c | 20 +-- bootstrap/windows-88/errors.c | 2 +- bootstrap/windows-88/errors.h | 2 +- bootstrap/windows-88/extTools.c | 4 +- bootstrap/windows-88/extTools.h | 2 +- bootstrap/windows-88/vt100.c | 2 +- bootstrap/windows-88/vt100.h | 2 +- src/compiler/OPB.Mod | 4 +- src/compiler/OPC.Mod | 76 +++-------- src/compiler/OPM.cmdln.Mod | 125 +++++++++++------ src/compiler/OPT.Mod | 6 +- src/compiler/OPV.Mod | 28 ++-- src/compiler/Vishap.Mod | 18 +-- src/compiler/extTools.Mod | 4 +- 202 files changed, 1178 insertions(+), 1313 deletions(-) diff --git a/bootstrap/unix-44/Configuration.c b/bootstrap/unix-44/Configuration.c index 6db18d8a..c780cc96 100644 --- a/bootstrap/unix-44/Configuration.c +++ b/bootstrap/unix-44/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/Configuration.h b/bootstrap/unix-44/Configuration.h index 831281d6..7fdf5f78 100644 --- a/bootstrap/unix-44/Configuration.h +++ b/bootstrap/unix-44/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/unix-44/Console.c b/bootstrap/unix-44/Console.c index dea5d7a8..eaa862b2 100644 --- a/bootstrap/unix-44/Console.c +++ b/bootstrap/unix-44/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/Console.h b/bootstrap/unix-44/Console.h index b18bf88a..c8de3606 100644 --- a/bootstrap/unix-44/Console.h +++ b/bootstrap/unix-44/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/unix-44/Files.c b/bootstrap/unix-44/Files.c index 3a826a34..6e15e6b7 100644 --- a/bootstrap/unix-44/Files.c +++ b/bootstrap/unix-44/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/Files.h b/bootstrap/unix-44/Files.h index 17077aa8..960fca06 100644 --- a/bootstrap/unix-44/Files.h +++ b/bootstrap/unix-44/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspaSfF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/unix-44/Heap.c b/bootstrap/unix-44/Heap.c index 63b8e488..50823221 100644 --- a/bootstrap/unix-44/Heap.c +++ b/bootstrap/unix-44/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tsSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/Heap.h b/bootstrap/unix-44/Heap.h index d150f1cf..57904466 100644 --- a/bootstrap/unix-44/Heap.h +++ b/bootstrap/unix-44/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tsSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/unix-44/Modules.c b/bootstrap/unix-44/Modules.c index a74b13a3..1c66c8e5 100644 --- a/bootstrap/unix-44/Modules.c +++ b/bootstrap/unix-44/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/Modules.h b/bootstrap/unix-44/Modules.h index d570a488..13b6dbed 100644 --- a/bootstrap/unix-44/Modules.h +++ b/bootstrap/unix-44/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/unix-44/OPB.c b/bootstrap/unix-44/OPB.c index a4070347..c9ebd8f5 100644 --- a/bootstrap/unix-44/OPB.c +++ b/bootstrap/unix-44/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -1542,7 +1542,7 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) OPT_Struct y = NIL; int16 f, g; OPT_Struct p = NIL, q = NIL; - if (OPM_Verbose) { + if (__IN(18, OPM_opt, 32)) { OPM_LogWLn(); OPM_LogWStr((CHAR*)"PROCEDURE CheckAssign", 22); OPM_LogWLn(); @@ -1550,7 +1550,7 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) y = ynode->typ; f = x->form; g = y->form; - if (OPM_Verbose) { + if (__IN(18, OPM_opt, 32)) { OPM_LogWStr((CHAR*)"y.form = ", 10); OPM_LogWNum(y->form, 0); OPM_LogWLn(); diff --git a/bootstrap/unix-44/OPB.h b/bootstrap/unix-44/OPB.h index a39fd352..cdd33f1b 100644 --- a/bootstrap/unix-44/OPB.h +++ b/bootstrap/unix-44/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/unix-44/OPC.c b/bootstrap/unix-44/OPC.c index f3b40759..6b7d1b01 100644 --- a/bootstrap/unix-44/OPC.c +++ b/bootstrap/unix-44/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -11,7 +11,6 @@ static int16 OPC_indentLevel; -static BOOLEAN OPC_ptrinit, OPC_mainprog, OPC_ansi; static int8 OPC_hashtab[105]; static CHAR OPC_keytab[50][9]; static BOOLEAN OPC_GlbPtrs; @@ -93,14 +92,7 @@ static BOOLEAN OPC_Undefined (OPT_Object obj); void OPC_Init (void) { OPC_indentLevel = 0; - OPC_ptrinit = __IN(5, OPM_opt, 32); - OPC_mainprog = OPM_mainProg || OPM_mainLinkStat; - OPC_ansi = __IN(6, OPM_opt, 32); - if (OPC_ansi) { - __MOVE("__init(void)", OPC_BodyNameExt, 13); - } else { - __MOVE("__init()", OPC_BodyNameExt, 9); - } + __MOVE("__init(void)", OPC_BodyNameExt, 13); } void OPC_Indent (int16 count) @@ -299,12 +291,8 @@ static void OPC_DeclareObj (OPT_Object dcl, BOOLEAN scopeDef) openClause = 0; } if (form == 12) { - if (OPC_ansi) { - OPM_Write(')'); - OPC_AnsiParamList(typ->link, 0); - } else { - OPM_WriteString((CHAR*)")()", 4); - } + OPM_Write(')'); + OPC_AnsiParamList(typ->link, 0); break; } else if (comp == 2) { OPM_Write('['); @@ -579,12 +567,10 @@ static void OPC_DefineTProcTypes (OPT_Object obj) if (obj->typ != OPT_notyp) { OPC_DefineType(obj->typ); } - if (OPC_ansi) { - par = obj->link; - while (par != NIL) { - OPC_DefineType(par->typ); - par = par->link; - } + par = obj->link; + while (par != NIL) { + OPC_DefineType(par->typ); + par = par->link; } } @@ -662,11 +648,7 @@ static void OPC_DefineTProcMacros (OPT_Object obj, BOOLEAN *empty) OPC_Ident(obj->typ->strobj); } OPM_WriteString((CHAR*)"(*)", 4); - if (OPC_ansi) { - OPC_AnsiParamList(obj->link, 0); - } else { - OPM_WriteString((CHAR*)"()", 3); - } + OPC_AnsiParamList(obj->link, 0); OPM_WriteString((CHAR*)", ", 3); OPC_DeclareParams(obj->link, 1); OPM_Write(')'); @@ -1063,7 +1045,7 @@ static void OPC_IdentList (OPT_Object obj, int16 vis) OPC_Ident(obj); OPM_WriteString((CHAR*)"__typ", 6); base = NIL; - } else if ((((((OPC_ptrinit && vis == 0)) && obj->mnolev > 0)) && obj->typ->form == 11)) { + } else if ((((((__IN(5, OPM_opt, 32) && vis == 0)) && obj->mnolev > 0)) && obj->typ->form == 11)) { OPM_WriteString((CHAR*)" = NIL", 7); } } @@ -1122,22 +1104,11 @@ static void OPC_ProcHeader (OPT_Object proc, BOOLEAN define) OPM_Write(' '); OPC_Ident(proc); OPM_Write(' '); - if (OPC_ansi) { - OPC_AnsiParamList(proc->link, 1); - if (!define) { - OPM_Write(';'); - } - OPM_WriteLn(); - } else if (define) { - OPC_DeclareParams(proc->link, 0); - OPM_WriteLn(); - OPC_Indent(1); - OPC_IdentList(proc->link, 2); - OPC_Indent(-1); - } else { - OPM_WriteString((CHAR*)"();", 4); - OPM_WriteLn(); + OPC_AnsiParamList(proc->link, 1); + if (!define) { + OPM_Write(';'); } + OPM_WriteLn(); } static void OPC_ProcPredefs (OPT_Object obj, int8 vis) @@ -1255,9 +1226,6 @@ static void OPC_GenHeaderMsg (void) case 5: OPM_Write('p'); break; - case 6: - OPM_Write('k'); - break; case 7: OPM_Write('a'); break; @@ -1391,15 +1359,7 @@ void OPC_GenEnumPtrs (OPT_Object var) if (OPC_NofPtrs(typ) > 0) { if (!OPC_GlbPtrs) { OPC_GlbPtrs = 1; - OPM_WriteString((CHAR*)"static ", 8); - if (OPC_ansi) { - OPM_WriteString((CHAR*)"void EnumPtrs(void (*P)(void*))", 32); - } else { - OPM_WriteString((CHAR*)"void EnumPtrs(P)", 17); - OPM_WriteLn(); - OPM_Write(0x09); - OPM_WriteString((CHAR*)"void (*P)();", 13); - } + OPM_WriteString((CHAR*)"static void EnumPtrs(void (*P)(void*))", 39); OPM_WriteLn(); OPC_BegBlk(); } @@ -1451,17 +1411,9 @@ void OPC_EnterBody (void) { OPM_WriteLn(); OPM_WriteString((CHAR*)"export ", 8); - if (OPC_mainprog) { - if (OPC_ansi) { - OPM_WriteString((CHAR*)"int main(int argc, char **argv)", 32); - OPM_WriteLn(); - } else { - OPM_WriteString((CHAR*)"main(argc, argv)", 17); - OPM_WriteLn(); - OPM_Write(0x09); - OPM_WriteString((CHAR*)"int argc; char **argv;", 23); - OPM_WriteLn(); - } + if (__IN(10, OPM_opt, 32)) { + OPM_WriteString((CHAR*)"int main(int argc, char **argv)", 32); + OPM_WriteLn(); } else { OPM_WriteString((CHAR*)"void *", 7); OPM_WriteString(OPM_modName, 32); @@ -1470,20 +1422,20 @@ void OPC_EnterBody (void) } OPC_BegBlk(); OPC_BegStat(); - if (OPC_mainprog) { + if (__IN(10, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__INIT(argc, argv)", 19); } else { OPM_WriteString((CHAR*)"__DEFMOD", 9); } OPC_EndStat(); - if ((OPC_mainprog && 0)) { + if ((__IN(10, OPM_opt, 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 (OPC_mainprog) { + if (__IN(10, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__REGMAIN(\"", 12); } else { OPM_WriteString((CHAR*)"__REGMOD(\"", 11); @@ -1503,7 +1455,7 @@ void OPC_EnterBody (void) void OPC_ExitBody (void) { OPC_BegStat(); - if (OPC_mainprog) { + if (__IN(10, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__FINI;", 8); } else { OPM_WriteString((CHAR*)"__ENDMOD;", 10); @@ -1583,21 +1535,6 @@ void OPC_EnterProc (OPT_Object proc) } var = var->link; } - if (!OPC_ansi) { - var = proc->link; - while (var != NIL) { - if ((var->typ->form == 5 && var->mode == 1)) { - OPC_BegStat(); - OPC_Ident(var->typ->strobj); - OPM_Write(' '); - OPC_Ident(var); - OPM_WriteString((CHAR*)" = _", 5); - OPC_Ident(var); - OPC_EndStat(); - } - var = var->link; - } - } var = proc->link; while (var != NIL) { if ((((__IN(var->typ->comp, 0x0c, 32) && var->mode == 1)) && var->typ->sysflag == 0)) { @@ -1963,11 +1900,7 @@ void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim) array = array->BaseTyp; dim -= 1; } - if (OPC_ansi) { - OPM_WriteInt(array->n); - } else { - OPC_IntLiteral(array->n, OPM_AddressSize); - } + OPM_WriteInt(array->n); } } diff --git a/bootstrap/unix-44/OPC.h b/bootstrap/unix-44/OPC.h index 1ac87c2d..b398282e 100644 --- a/bootstrap/unix-44/OPC.h +++ b/bootstrap/unix-44/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/unix-44/OPM.c b/bootstrap/unix-44/OPM.c index e5b7fc83..0086ff0f 100644 --- a/bootstrap/unix-44/OPM.c +++ b/bootstrap/unix-44/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -37,7 +37,6 @@ 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; -export BOOLEAN OPM_dontAsm, OPM_dontLink, OPM_mainProg, OPM_mainLinkStat, OPM_notColorOutput, OPM_forceNewSym, OPM_Verbose; static CHAR OPM_OBERON[1024]; static CHAR OPM_MODULES[1024]; @@ -138,42 +137,94 @@ int16 OPM_Integer (int64 n) static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) { int16 i; + __DUP(s, s__len, CHAR); i = 1; while (s[__X(i, s__len)] != 0x00) { switch (s[__X(i, s__len)]) { - case 'a': - *opt = *opt ^ 0x80; - break; - case 'c': - *opt = *opt ^ 0x4000; - break; - case 'e': - *opt = *opt ^ 0x0200; - break; - case 'f': - *opt = *opt ^ 0x010000; - break; - case 'k': - *opt = *opt ^ 0x40; - break; - case 'm': - *opt = *opt ^ 0x0400; - break; case 'p': *opt = *opt ^ 0x20; break; + case 'a': + *opt = *opt ^ 0x80; + break; case 'r': *opt = *opt ^ 0x04; break; - case 's': - *opt = *opt ^ 0x10; - break; case 't': *opt = *opt ^ 0x08; break; case 'x': *opt = *opt ^ 0x01; break; + case 'e': + *opt = *opt ^ 0x0200; + break; + case 's': + *opt = *opt ^ 0x10; + break; + case 'F': + *opt = *opt ^ 0x020000; + break; + case 'm': + *opt = *opt ^ 0x0400; + break; + case 'M': + *opt = *opt ^ 0x8000; + break; + case 'S': + *opt = *opt ^ 0x2000; + break; + case 'c': + *opt = *opt ^ 0x4000; + break; + case 'f': + *opt = *opt ^ 0x010000; + break; + case 'V': + *opt = *opt ^ 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; + } + i += 1; + } + break; + case 'A': + if (i + 2 >= Strings_Length(s, s__len)) { + OPM_LogWStr((CHAR*)"-M option requires two following digits.", 41); + OPM_LogWLn(); + } else { + OPM_AddressSize = (int16)s[__X(i + 1, s__len)] - 48; + OPM_Alignment = (int16)s[__X(i + 2, s__len)] - 48; + i += 2; + } + break; case 'B': if (s[__X(i + 1, s__len)] != 0x00) { i += 1; @@ -199,18 +250,6 @@ static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) } Files_SetSearchPath((CHAR*)"", 1); break; - case 'F': - *opt = *opt ^ 0x020000; - break; - case 'M': - *opt = *opt ^ 0x8000; - break; - case 'S': - *opt = *opt ^ 0x2000; - break; - case 'V': - *opt = *opt ^ 0x040000; - break; default: OPM_LogWStr((CHAR*)" warning: option ", 19); OPM_LogW('-'); @@ -221,6 +260,7 @@ static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) } i += 1; } + __DEL(s); } BOOLEAN OPM_OpenPar (void) @@ -247,33 +287,62 @@ BOOLEAN OPM_OpenPar (void) OPM_LogWStr((CHAR*)"Where options = [\"-\" {option} ].", 33); OPM_LogWLn(); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" m - generate code for main module", 36); + OPM_LogWStr((CHAR*)" Run time safety", 18); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" M - generate code for main module and link object statically", 63); + OPM_LogWStr((CHAR*)" -p Initialise pointers to NIL.", 37); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" s - generate new symbol file", 31); + OPM_LogWStr((CHAR*)" -a Halt on assertion failures.", 37); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" e - allow extending the module interface", 43); + OPM_LogWStr((CHAR*)" -r Halt on range check failures.", 39); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" r - check value ranges", 25); + OPM_LogWStr((CHAR*)" -t Halt on type guad failure.", 36); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" x - turn off array indices check", 35); + OPM_LogWStr((CHAR*)" -x Halt on index out of range.", 37); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" a - don't check ASSERTs at runtime, use this option in tested production code", 80); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" p - turn off automatic pointer initialization", 48); + OPM_LogWStr((CHAR*)" Symbol file management", 25); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" t - don't check type guards (use in rare cases such as low-level modules where every cycle counts)", 101); + OPM_LogWStr((CHAR*)" -e Allow extension of old symbol file.", 45); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" S - don't call external assembler/compiler, only generate C code", 67); + OPM_LogWStr((CHAR*)" -s Allow generation of new symbol file.", 46); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" c - don't call linker", 24); + OPM_LogWStr((CHAR*)" -F Force generation of new symbol file.", 46); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" f - don't use color output", 29); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" F - force writing new symbol file in current directory", 57); + OPM_LogWStr((CHAR*)" C compiler and linker control", 32); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" V - verbose output", 21); + OPM_LogWStr((CHAR*)" -m This module is main. Link dynamically.", 48); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -M This module is main. Link statically.", 47); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -S Don't call C compiler", 31); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -c Don't link.", 21); + OPM_LogWLn(); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" Miscellaneous", 16); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -f Disable vt100 control characters in status output.", 60); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -V Display compiler debugging messages.", 46); + OPM_LogWLn(); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" Size model for elementary types", 34); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -O2 Original Oberon / Oberon-2: 8 bit SHORTINT, 16 bit INTEGER, 32 bit LONGINT and SET.", 94); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -OC Component Pascal: 16 bit SHORTINT, 32 bit INTEGER, 64 bit LONGINT and SET.", 94); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -OV Alternate large model: 8 bit SHORTINT, 32 bit INTEGER, 64 bit LONGINT and SET.", 94); + OPM_LogWLn(); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" Target machine address size and alignment", 44); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -A44 32 bit addresses, 32 bit alignment (e.g. Unix/linux 32 bit on x86).", 79); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -A48 32 bit addresses, 64 bit alignment (e.g. Windows 32 bit on x86, linux 32 bit on arm).", 97); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -A88 66 bit addresses, 64 bit alignment (e.g. 64 bit platforms).", 71); OPM_LogWLn(); OPM_LogWLn(); OPM_LogWStr((CHAR*)"Initial options specify defaults for all files.", 48); @@ -288,9 +357,9 @@ BOOLEAN OPM_OpenPar (void) OPM_S = 1; s[0] = 0x00; Platform_GetArg(OPM_S, (void*)s, 256); - OPM_glbopt = 0xe9; + OPM_glbopt = 0xa9; while (s[0] == '-') { - OPM_ScanOptions((void*)s, 256, &OPM_glbopt); + OPM_ScanOptions(s, 256, &OPM_glbopt); OPM_S += 1; s[0] = 0x00; Platform_GetArg(OPM_S, (void*)s, 256); @@ -308,20 +377,14 @@ void OPM_InitOptions (void) s[0] = 0x00; Platform_GetArg(OPM_S, (void*)s, 256); while (s[0] == '-') { - OPM_ScanOptions((void*)s, 256, &OPM_opt); + OPM_ScanOptions(s, 256, &OPM_opt); OPM_S += 1; s[0] = 0x00; Platform_GetArg(OPM_S, (void*)s, 256); } - OPM_dontAsm = __IN(13, OPM_opt, 32); - OPM_dontLink = __IN(14, OPM_opt, 32); - OPM_mainProg = __IN(10, OPM_opt, 32); - OPM_mainLinkStat = __IN(15, OPM_opt, 32); - OPM_notColorOutput = __IN(16, OPM_opt, 32); - OPM_forceNewSym = __IN(17, OPM_opt, 32); - OPM_Verbose = __IN(18, OPM_opt, 32); - if (OPM_mainLinkStat) { + if (__IN(15, OPM_opt, 32)) { OPM_glbopt |= __SETOF(10,32); + OPM_opt |= __SETOF(10,32); } OPM_GetProperties(); } @@ -407,20 +470,20 @@ static void OPM_LogErrMsg (int16 n) int16 i; CHAR buf[1024]; if (n >= 0) { - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"31m", 4); } OPM_LogWStr((CHAR*)" err ", 7); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } } else { - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"35m", 4); } OPM_LogWStr((CHAR*)" warning ", 11); n = -n; - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } } @@ -493,11 +556,11 @@ static void OPM_ShowLine (int64 pos) OPM_LogW(' '); i -= 1; } - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"32m", 4); } OPM_LogW('^'); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } Files_Close(f); @@ -682,7 +745,7 @@ static void OPM_GetProperties (void) OPM_MinLReal = -OPM_MaxLReal; OPM_MaxSet = __ASHL(OPM_SetSize, 3) - 1; OPM_MaxIndex = OPM_SignedMaximum(OPM_AddressSize); - if (OPM_Verbose) { + if (__IN(18, OPM_opt, 32)) { OPM_VerboseListSizes(); } } diff --git a/bootstrap/unix-44/OPM.h b/bootstrap/unix-44/OPM.h index 1835a2b8..b32da345 100644 --- a/bootstrap/unix-44/OPM.h +++ b/bootstrap/unix-44/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPM__h #define OPM__h @@ -15,7 +15,6 @@ 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 BOOLEAN OPM_dontAsm, OPM_dontLink, OPM_mainProg, OPM_mainLinkStat, OPM_notColorOutput, OPM_forceNewSym, OPM_Verbose; import void OPM_CloseFiles (void); diff --git a/bootstrap/unix-44/OPP.c b/bootstrap/unix-44/OPP.c index f62551cc..af0d37db 100644 --- a/bootstrap/unix-44/OPP.c +++ b/bootstrap/unix-44/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/OPP.h b/bootstrap/unix-44/OPP.h index 9ae7712a..6dd03161 100644 --- a/bootstrap/unix-44/OPP.h +++ b/bootstrap/unix-44/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/unix-44/OPS.c b/bootstrap/unix-44/OPS.c index f04f47ad..f37bbc27 100644 --- a/bootstrap/unix-44/OPS.c +++ b/bootstrap/unix-44/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/OPS.h b/bootstrap/unix-44/OPS.h index 3ff9b0b3..1b60944c 100644 --- a/bootstrap/unix-44/OPS.h +++ b/bootstrap/unix-44/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/unix-44/OPT.c b/bootstrap/unix-44/OPT.c index 693eb714..147fdc5c 100644 --- a/bootstrap/unix-44/OPT.c +++ b/bootstrap/unix-44/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -1733,10 +1733,7 @@ void OPT_Export (BOOLEAN *ext, BOOLEAN *new) } OPT_OutObj(OPT_topScope->right); *ext = (OPT_sfpresent && OPT_symExtended); - *new = !OPT_sfpresent || OPT_symNew; - if (OPM_forceNewSym) { - *new = 1; - } + *new = (!OPT_sfpresent || OPT_symNew) || __IN(17, OPM_opt, 32); if ((((OPM_noerr && OPT_sfpresent)) && OPT_impCtxt.reffp != OPT_expCtxt.reffp)) { *new = 1; if (!OPT_extsf) { diff --git a/bootstrap/unix-44/OPT.h b/bootstrap/unix-44/OPT.h index 9ee5643f..d999d4ec 100644 --- a/bootstrap/unix-44/OPT.h +++ b/bootstrap/unix-44/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/unix-44/OPV.c b/bootstrap/unix-44/OPV.c index 2146d7c2..edb84f81 100644 --- a/bootstrap/unix-44/OPV.c +++ b/bootstrap/unix-44/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -16,7 +16,6 @@ typedef } OPV_ExitInfo; -static BOOLEAN OPV_assert, OPV_inxchk, OPV_mainprog, OPV_ansi; static int16 OPV_stamp; static int32 OPV_recno; static OPV_ExitInfo OPV_exit; @@ -130,10 +129,6 @@ void OPV_Init (void) OPV_stamp = 0; OPV_recno = 0; OPV_nofExitLabels = 0; - OPV_assert = __IN(7, OPM_opt, 32); - OPV_inxchk = __IN(0, OPM_opt, 32); - OPV_mainprog = __IN(10, OPM_opt, 32); - OPV_ansi = __IN(6, OPM_opt, 32); } static void OPV_GetTProcNum (OPT_Object obj) @@ -532,7 +527,7 @@ static void OPV_TypeOf (OPT_Node n) static void OPV_Index (OPT_Node n, OPT_Node d, int16 prec, int16 dim) { - if (!OPV_inxchk || (n->right->class == 7 && (n->right->conval->intval == 0 || n->left->typ->comp != 3))) { + if (!__IN(0, OPM_opt, 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)) { @@ -728,11 +723,7 @@ static void OPV_design (OPT_Node n, int16 prec) static void OPV_ParIntLiteral (int64 n, int32 size) { - if (OPV_ansi) { - OPM_WriteInt(n); - } else { - OPC_IntLiteral(n, size); - } + OPM_WriteInt(n); } static void OPV_ActualPar (OPT_Node n, OPT_Object fp) @@ -754,26 +745,19 @@ static void OPV_ActualPar (OPT_Node n, OPT_Object fp) } if (!__IN(n->typ->comp, 0x0c, 32)) { if (mode == 2) { - if ((OPV_ansi && typ != n->typ)) { + if (typ != n->typ) { OPM_WriteString((CHAR*)"(void*)", 8); } OPM_Write('&'); prec = 9; - } else if (OPV_ansi) { + } else { if ((__IN(comp, 0x0c, 32) && n->class == 7)) { OPM_WriteString((CHAR*)"(CHAR*)", 8); } else if ((((form == 11 && typ != n->typ)) && n->typ != OPT_niltyp)) { OPM_WriteString((CHAR*)"(void*)", 8); } - } else { - if ((__IN(form, 0x60, 32) && n->typ->form == 4)) { - OPM_WriteString((CHAR*)"(double)", 9); - prec = 9; - } else if (form == 4) { - OPV_SizeCast(n->typ->size, typ->size); - } } - } else if (OPV_ansi) { + } else { if ((((mode == 2 && typ != n->typ)) && prec == -1)) { OPM_WriteString((CHAR*)"(void*)", 8); } @@ -1532,7 +1516,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) case 20: if (n->subcl != 32) { OPV_IfStat(n, 0, outerProc); - } else if (OPV_assert) { + } else if (__IN(7, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__ASSERT(", 10); OPV_expr(n->left->left->left, -1); OPM_WriteString((CHAR*)", ", 3); @@ -1598,7 +1582,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) break; case 26: if (OPM_level == 0) { - if (OPV_mainprog) { + if (__IN(10, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__FINI", 7); } else { OPM_WriteString((CHAR*)"__ENDMOD", 9); @@ -1643,7 +1627,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) void OPV_Module (OPT_Node prog) { - if (!OPV_mainprog) { + if (!__IN(10, OPM_opt, 32)) { OPC_GenHdr(prog->right); OPC_GenHdrIncludes(); } diff --git a/bootstrap/unix-44/OPV.h b/bootstrap/unix-44/OPV.h index f78267d0..a89aa61a 100644 --- a/bootstrap/unix-44/OPV.h +++ b/bootstrap/unix-44/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/unix-44/Platform.c b/bootstrap/unix-44/Platform.c index a42034f5..2f652641 100644 --- a/bootstrap/unix-44/Platform.c +++ b/bootstrap/unix-44/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/Platform.h b/bootstrap/unix-44/Platform.h index 99b78a56..adbbe116 100644 --- a/bootstrap/unix-44/Platform.h +++ b/bootstrap/unix-44/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/unix-44/Reals.c b/bootstrap/unix-44/Reals.c index c032a4a5..dec0e0b4 100644 --- a/bootstrap/unix-44/Reals.c +++ b/bootstrap/unix-44/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/Reals.h b/bootstrap/unix-44/Reals.h index b4469c3a..0b779857 100644 --- a/bootstrap/unix-44/Reals.h +++ b/bootstrap/unix-44/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/unix-44/Strings.c b/bootstrap/unix-44/Strings.c index db9dbf02..69612295 100644 --- a/bootstrap/unix-44/Strings.c +++ b/bootstrap/unix-44/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/Strings.h b/bootstrap/unix-44/Strings.h index 9d2d3b44..b4d5f201 100644 --- a/bootstrap/unix-44/Strings.h +++ b/bootstrap/unix-44/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/unix-44/Texts.c b/bootstrap/unix-44/Texts.c index faa47731..df1eacae 100644 --- a/bootstrap/unix-44/Texts.c +++ b/bootstrap/unix-44/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/Texts.h b/bootstrap/unix-44/Texts.h index e0fc1bc4..1702769b 100644 --- a/bootstrap/unix-44/Texts.h +++ b/bootstrap/unix-44/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/unix-44/Vishap.c b/bootstrap/unix-44/Vishap.c index c3405c16..17b498b8 100644 --- a/bootstrap/unix-44/Vishap.c +++ b/bootstrap/unix-44/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspamSf */ #define INTEGER int16 #define LONGINT int32 @@ -42,22 +42,22 @@ void Vishap_Module (BOOLEAN *done) OPC_Init(); OPV_Module(p); if (OPM_noerr) { - if (((OPM_mainProg || OPM_mainLinkStat) && __STRCMP(OPM_modName, "SYSTEM") != 0)) { + if ((__IN(10, OPM_opt, 32) && __STRCMP(OPM_modName, "SYSTEM") != 0)) { OPM_DeleteNewSym(); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"32m", 4); } OPM_LogWStr((CHAR*)" Main program.", 16); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } } else { if (new) { - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"32m", 4); } OPM_LogWStr((CHAR*)" New symbol file.", 19); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } OPM_RegisterNewSym(); @@ -111,17 +111,17 @@ void Vishap_Translate (void) OPM_LogWLn(); Platform_Exit(1); } - if (!OPM_dontAsm) { - if (OPM_dontLink) { + if (!__IN(13, OPM_opt, 32)) { + if (__IN(14, OPM_opt, 32)) { extTools_Assemble(OPM_modName, 32); } else { - if (!(OPM_mainProg || OPM_mainLinkStat)) { + if (!__IN(10, OPM_opt, 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, OPM_mainLinkStat, modulesobj, 2048); + extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_opt, 32), modulesobj, 2048); } } } diff --git a/bootstrap/unix-44/errors.c b/bootstrap/unix-44/errors.c index 2e61c724..95868540 100644 --- a/bootstrap/unix-44/errors.c +++ b/bootstrap/unix-44/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/errors.h b/bootstrap/unix-44/errors.h index 99f4c6b0..d574008d 100644 --- a/bootstrap/unix-44/errors.h +++ b/bootstrap/unix-44/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/unix-44/extTools.c b/bootstrap/unix-44/extTools.c index 8838dd7b..9047ebcc 100644 --- a/bootstrap/unix-44/extTools.c +++ b/bootstrap/unix-44/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -25,7 +25,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 (OPM_Verbose) { + if (__IN(18, OPM_opt, 32)) { Console_String(title, title__len); Console_String(cmd, cmd__len); Console_Ln(); diff --git a/bootstrap/unix-44/extTools.h b/bootstrap/unix-44/extTools.h index d4f0c474..847e440e 100644 --- a/bootstrap/unix-44/extTools.h +++ b/bootstrap/unix-44/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/unix-44/vt100.c b/bootstrap/unix-44/vt100.c index 5d050112..a14f3ee0 100644 --- a/bootstrap/unix-44/vt100.c +++ b/bootstrap/unix-44/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-44/vt100.h b/bootstrap/unix-44/vt100.h index 11aabb2a..1402af8c 100644 --- a/bootstrap/unix-44/vt100.h +++ b/bootstrap/unix-44/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef vt100__h #define vt100__h diff --git a/bootstrap/unix-48/Configuration.c b/bootstrap/unix-48/Configuration.c index 6db18d8a..c780cc96 100644 --- a/bootstrap/unix-48/Configuration.c +++ b/bootstrap/unix-48/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/Configuration.h b/bootstrap/unix-48/Configuration.h index 831281d6..7fdf5f78 100644 --- a/bootstrap/unix-48/Configuration.h +++ b/bootstrap/unix-48/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/unix-48/Console.c b/bootstrap/unix-48/Console.c index dea5d7a8..eaa862b2 100644 --- a/bootstrap/unix-48/Console.c +++ b/bootstrap/unix-48/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/Console.h b/bootstrap/unix-48/Console.h index b18bf88a..c8de3606 100644 --- a/bootstrap/unix-48/Console.h +++ b/bootstrap/unix-48/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/unix-48/Files.c b/bootstrap/unix-48/Files.c index 3a826a34..6e15e6b7 100644 --- a/bootstrap/unix-48/Files.c +++ b/bootstrap/unix-48/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/Files.h b/bootstrap/unix-48/Files.h index 17077aa8..960fca06 100644 --- a/bootstrap/unix-48/Files.h +++ b/bootstrap/unix-48/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspaSfF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/unix-48/Heap.c b/bootstrap/unix-48/Heap.c index 63b8e488..50823221 100644 --- a/bootstrap/unix-48/Heap.c +++ b/bootstrap/unix-48/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tsSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/Heap.h b/bootstrap/unix-48/Heap.h index d150f1cf..57904466 100644 --- a/bootstrap/unix-48/Heap.h +++ b/bootstrap/unix-48/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tsSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/unix-48/Modules.c b/bootstrap/unix-48/Modules.c index a74b13a3..1c66c8e5 100644 --- a/bootstrap/unix-48/Modules.c +++ b/bootstrap/unix-48/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/Modules.h b/bootstrap/unix-48/Modules.h index d570a488..13b6dbed 100644 --- a/bootstrap/unix-48/Modules.h +++ b/bootstrap/unix-48/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/unix-48/OPB.c b/bootstrap/unix-48/OPB.c index a4070347..c9ebd8f5 100644 --- a/bootstrap/unix-48/OPB.c +++ b/bootstrap/unix-48/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -1542,7 +1542,7 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) OPT_Struct y = NIL; int16 f, g; OPT_Struct p = NIL, q = NIL; - if (OPM_Verbose) { + if (__IN(18, OPM_opt, 32)) { OPM_LogWLn(); OPM_LogWStr((CHAR*)"PROCEDURE CheckAssign", 22); OPM_LogWLn(); @@ -1550,7 +1550,7 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) y = ynode->typ; f = x->form; g = y->form; - if (OPM_Verbose) { + if (__IN(18, OPM_opt, 32)) { OPM_LogWStr((CHAR*)"y.form = ", 10); OPM_LogWNum(y->form, 0); OPM_LogWLn(); diff --git a/bootstrap/unix-48/OPB.h b/bootstrap/unix-48/OPB.h index a39fd352..cdd33f1b 100644 --- a/bootstrap/unix-48/OPB.h +++ b/bootstrap/unix-48/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/unix-48/OPC.c b/bootstrap/unix-48/OPC.c index f3b40759..6b7d1b01 100644 --- a/bootstrap/unix-48/OPC.c +++ b/bootstrap/unix-48/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -11,7 +11,6 @@ static int16 OPC_indentLevel; -static BOOLEAN OPC_ptrinit, OPC_mainprog, OPC_ansi; static int8 OPC_hashtab[105]; static CHAR OPC_keytab[50][9]; static BOOLEAN OPC_GlbPtrs; @@ -93,14 +92,7 @@ static BOOLEAN OPC_Undefined (OPT_Object obj); void OPC_Init (void) { OPC_indentLevel = 0; - OPC_ptrinit = __IN(5, OPM_opt, 32); - OPC_mainprog = OPM_mainProg || OPM_mainLinkStat; - OPC_ansi = __IN(6, OPM_opt, 32); - if (OPC_ansi) { - __MOVE("__init(void)", OPC_BodyNameExt, 13); - } else { - __MOVE("__init()", OPC_BodyNameExt, 9); - } + __MOVE("__init(void)", OPC_BodyNameExt, 13); } void OPC_Indent (int16 count) @@ -299,12 +291,8 @@ static void OPC_DeclareObj (OPT_Object dcl, BOOLEAN scopeDef) openClause = 0; } if (form == 12) { - if (OPC_ansi) { - OPM_Write(')'); - OPC_AnsiParamList(typ->link, 0); - } else { - OPM_WriteString((CHAR*)")()", 4); - } + OPM_Write(')'); + OPC_AnsiParamList(typ->link, 0); break; } else if (comp == 2) { OPM_Write('['); @@ -579,12 +567,10 @@ static void OPC_DefineTProcTypes (OPT_Object obj) if (obj->typ != OPT_notyp) { OPC_DefineType(obj->typ); } - if (OPC_ansi) { - par = obj->link; - while (par != NIL) { - OPC_DefineType(par->typ); - par = par->link; - } + par = obj->link; + while (par != NIL) { + OPC_DefineType(par->typ); + par = par->link; } } @@ -662,11 +648,7 @@ static void OPC_DefineTProcMacros (OPT_Object obj, BOOLEAN *empty) OPC_Ident(obj->typ->strobj); } OPM_WriteString((CHAR*)"(*)", 4); - if (OPC_ansi) { - OPC_AnsiParamList(obj->link, 0); - } else { - OPM_WriteString((CHAR*)"()", 3); - } + OPC_AnsiParamList(obj->link, 0); OPM_WriteString((CHAR*)", ", 3); OPC_DeclareParams(obj->link, 1); OPM_Write(')'); @@ -1063,7 +1045,7 @@ static void OPC_IdentList (OPT_Object obj, int16 vis) OPC_Ident(obj); OPM_WriteString((CHAR*)"__typ", 6); base = NIL; - } else if ((((((OPC_ptrinit && vis == 0)) && obj->mnolev > 0)) && obj->typ->form == 11)) { + } else if ((((((__IN(5, OPM_opt, 32) && vis == 0)) && obj->mnolev > 0)) && obj->typ->form == 11)) { OPM_WriteString((CHAR*)" = NIL", 7); } } @@ -1122,22 +1104,11 @@ static void OPC_ProcHeader (OPT_Object proc, BOOLEAN define) OPM_Write(' '); OPC_Ident(proc); OPM_Write(' '); - if (OPC_ansi) { - OPC_AnsiParamList(proc->link, 1); - if (!define) { - OPM_Write(';'); - } - OPM_WriteLn(); - } else if (define) { - OPC_DeclareParams(proc->link, 0); - OPM_WriteLn(); - OPC_Indent(1); - OPC_IdentList(proc->link, 2); - OPC_Indent(-1); - } else { - OPM_WriteString((CHAR*)"();", 4); - OPM_WriteLn(); + OPC_AnsiParamList(proc->link, 1); + if (!define) { + OPM_Write(';'); } + OPM_WriteLn(); } static void OPC_ProcPredefs (OPT_Object obj, int8 vis) @@ -1255,9 +1226,6 @@ static void OPC_GenHeaderMsg (void) case 5: OPM_Write('p'); break; - case 6: - OPM_Write('k'); - break; case 7: OPM_Write('a'); break; @@ -1391,15 +1359,7 @@ void OPC_GenEnumPtrs (OPT_Object var) if (OPC_NofPtrs(typ) > 0) { if (!OPC_GlbPtrs) { OPC_GlbPtrs = 1; - OPM_WriteString((CHAR*)"static ", 8); - if (OPC_ansi) { - OPM_WriteString((CHAR*)"void EnumPtrs(void (*P)(void*))", 32); - } else { - OPM_WriteString((CHAR*)"void EnumPtrs(P)", 17); - OPM_WriteLn(); - OPM_Write(0x09); - OPM_WriteString((CHAR*)"void (*P)();", 13); - } + OPM_WriteString((CHAR*)"static void EnumPtrs(void (*P)(void*))", 39); OPM_WriteLn(); OPC_BegBlk(); } @@ -1451,17 +1411,9 @@ void OPC_EnterBody (void) { OPM_WriteLn(); OPM_WriteString((CHAR*)"export ", 8); - if (OPC_mainprog) { - if (OPC_ansi) { - OPM_WriteString((CHAR*)"int main(int argc, char **argv)", 32); - OPM_WriteLn(); - } else { - OPM_WriteString((CHAR*)"main(argc, argv)", 17); - OPM_WriteLn(); - OPM_Write(0x09); - OPM_WriteString((CHAR*)"int argc; char **argv;", 23); - OPM_WriteLn(); - } + if (__IN(10, OPM_opt, 32)) { + OPM_WriteString((CHAR*)"int main(int argc, char **argv)", 32); + OPM_WriteLn(); } else { OPM_WriteString((CHAR*)"void *", 7); OPM_WriteString(OPM_modName, 32); @@ -1470,20 +1422,20 @@ void OPC_EnterBody (void) } OPC_BegBlk(); OPC_BegStat(); - if (OPC_mainprog) { + if (__IN(10, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__INIT(argc, argv)", 19); } else { OPM_WriteString((CHAR*)"__DEFMOD", 9); } OPC_EndStat(); - if ((OPC_mainprog && 0)) { + if ((__IN(10, OPM_opt, 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 (OPC_mainprog) { + if (__IN(10, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__REGMAIN(\"", 12); } else { OPM_WriteString((CHAR*)"__REGMOD(\"", 11); @@ -1503,7 +1455,7 @@ void OPC_EnterBody (void) void OPC_ExitBody (void) { OPC_BegStat(); - if (OPC_mainprog) { + if (__IN(10, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__FINI;", 8); } else { OPM_WriteString((CHAR*)"__ENDMOD;", 10); @@ -1583,21 +1535,6 @@ void OPC_EnterProc (OPT_Object proc) } var = var->link; } - if (!OPC_ansi) { - var = proc->link; - while (var != NIL) { - if ((var->typ->form == 5 && var->mode == 1)) { - OPC_BegStat(); - OPC_Ident(var->typ->strobj); - OPM_Write(' '); - OPC_Ident(var); - OPM_WriteString((CHAR*)" = _", 5); - OPC_Ident(var); - OPC_EndStat(); - } - var = var->link; - } - } var = proc->link; while (var != NIL) { if ((((__IN(var->typ->comp, 0x0c, 32) && var->mode == 1)) && var->typ->sysflag == 0)) { @@ -1963,11 +1900,7 @@ void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim) array = array->BaseTyp; dim -= 1; } - if (OPC_ansi) { - OPM_WriteInt(array->n); - } else { - OPC_IntLiteral(array->n, OPM_AddressSize); - } + OPM_WriteInt(array->n); } } diff --git a/bootstrap/unix-48/OPC.h b/bootstrap/unix-48/OPC.h index 1ac87c2d..b398282e 100644 --- a/bootstrap/unix-48/OPC.h +++ b/bootstrap/unix-48/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/unix-48/OPM.c b/bootstrap/unix-48/OPM.c index e5b7fc83..0086ff0f 100644 --- a/bootstrap/unix-48/OPM.c +++ b/bootstrap/unix-48/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -37,7 +37,6 @@ 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; -export BOOLEAN OPM_dontAsm, OPM_dontLink, OPM_mainProg, OPM_mainLinkStat, OPM_notColorOutput, OPM_forceNewSym, OPM_Verbose; static CHAR OPM_OBERON[1024]; static CHAR OPM_MODULES[1024]; @@ -138,42 +137,94 @@ int16 OPM_Integer (int64 n) static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) { int16 i; + __DUP(s, s__len, CHAR); i = 1; while (s[__X(i, s__len)] != 0x00) { switch (s[__X(i, s__len)]) { - case 'a': - *opt = *opt ^ 0x80; - break; - case 'c': - *opt = *opt ^ 0x4000; - break; - case 'e': - *opt = *opt ^ 0x0200; - break; - case 'f': - *opt = *opt ^ 0x010000; - break; - case 'k': - *opt = *opt ^ 0x40; - break; - case 'm': - *opt = *opt ^ 0x0400; - break; case 'p': *opt = *opt ^ 0x20; break; + case 'a': + *opt = *opt ^ 0x80; + break; case 'r': *opt = *opt ^ 0x04; break; - case 's': - *opt = *opt ^ 0x10; - break; case 't': *opt = *opt ^ 0x08; break; case 'x': *opt = *opt ^ 0x01; break; + case 'e': + *opt = *opt ^ 0x0200; + break; + case 's': + *opt = *opt ^ 0x10; + break; + case 'F': + *opt = *opt ^ 0x020000; + break; + case 'm': + *opt = *opt ^ 0x0400; + break; + case 'M': + *opt = *opt ^ 0x8000; + break; + case 'S': + *opt = *opt ^ 0x2000; + break; + case 'c': + *opt = *opt ^ 0x4000; + break; + case 'f': + *opt = *opt ^ 0x010000; + break; + case 'V': + *opt = *opt ^ 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; + } + i += 1; + } + break; + case 'A': + if (i + 2 >= Strings_Length(s, s__len)) { + OPM_LogWStr((CHAR*)"-M option requires two following digits.", 41); + OPM_LogWLn(); + } else { + OPM_AddressSize = (int16)s[__X(i + 1, s__len)] - 48; + OPM_Alignment = (int16)s[__X(i + 2, s__len)] - 48; + i += 2; + } + break; case 'B': if (s[__X(i + 1, s__len)] != 0x00) { i += 1; @@ -199,18 +250,6 @@ static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) } Files_SetSearchPath((CHAR*)"", 1); break; - case 'F': - *opt = *opt ^ 0x020000; - break; - case 'M': - *opt = *opt ^ 0x8000; - break; - case 'S': - *opt = *opt ^ 0x2000; - break; - case 'V': - *opt = *opt ^ 0x040000; - break; default: OPM_LogWStr((CHAR*)" warning: option ", 19); OPM_LogW('-'); @@ -221,6 +260,7 @@ static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) } i += 1; } + __DEL(s); } BOOLEAN OPM_OpenPar (void) @@ -247,33 +287,62 @@ BOOLEAN OPM_OpenPar (void) OPM_LogWStr((CHAR*)"Where options = [\"-\" {option} ].", 33); OPM_LogWLn(); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" m - generate code for main module", 36); + OPM_LogWStr((CHAR*)" Run time safety", 18); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" M - generate code for main module and link object statically", 63); + OPM_LogWStr((CHAR*)" -p Initialise pointers to NIL.", 37); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" s - generate new symbol file", 31); + OPM_LogWStr((CHAR*)" -a Halt on assertion failures.", 37); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" e - allow extending the module interface", 43); + OPM_LogWStr((CHAR*)" -r Halt on range check failures.", 39); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" r - check value ranges", 25); + OPM_LogWStr((CHAR*)" -t Halt on type guad failure.", 36); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" x - turn off array indices check", 35); + OPM_LogWStr((CHAR*)" -x Halt on index out of range.", 37); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" a - don't check ASSERTs at runtime, use this option in tested production code", 80); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" p - turn off automatic pointer initialization", 48); + OPM_LogWStr((CHAR*)" Symbol file management", 25); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" t - don't check type guards (use in rare cases such as low-level modules where every cycle counts)", 101); + OPM_LogWStr((CHAR*)" -e Allow extension of old symbol file.", 45); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" S - don't call external assembler/compiler, only generate C code", 67); + OPM_LogWStr((CHAR*)" -s Allow generation of new symbol file.", 46); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" c - don't call linker", 24); + OPM_LogWStr((CHAR*)" -F Force generation of new symbol file.", 46); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" f - don't use color output", 29); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" F - force writing new symbol file in current directory", 57); + OPM_LogWStr((CHAR*)" C compiler and linker control", 32); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" V - verbose output", 21); + OPM_LogWStr((CHAR*)" -m This module is main. Link dynamically.", 48); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -M This module is main. Link statically.", 47); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -S Don't call C compiler", 31); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -c Don't link.", 21); + OPM_LogWLn(); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" Miscellaneous", 16); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -f Disable vt100 control characters in status output.", 60); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -V Display compiler debugging messages.", 46); + OPM_LogWLn(); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" Size model for elementary types", 34); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -O2 Original Oberon / Oberon-2: 8 bit SHORTINT, 16 bit INTEGER, 32 bit LONGINT and SET.", 94); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -OC Component Pascal: 16 bit SHORTINT, 32 bit INTEGER, 64 bit LONGINT and SET.", 94); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -OV Alternate large model: 8 bit SHORTINT, 32 bit INTEGER, 64 bit LONGINT and SET.", 94); + OPM_LogWLn(); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" Target machine address size and alignment", 44); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -A44 32 bit addresses, 32 bit alignment (e.g. Unix/linux 32 bit on x86).", 79); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -A48 32 bit addresses, 64 bit alignment (e.g. Windows 32 bit on x86, linux 32 bit on arm).", 97); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -A88 66 bit addresses, 64 bit alignment (e.g. 64 bit platforms).", 71); OPM_LogWLn(); OPM_LogWLn(); OPM_LogWStr((CHAR*)"Initial options specify defaults for all files.", 48); @@ -288,9 +357,9 @@ BOOLEAN OPM_OpenPar (void) OPM_S = 1; s[0] = 0x00; Platform_GetArg(OPM_S, (void*)s, 256); - OPM_glbopt = 0xe9; + OPM_glbopt = 0xa9; while (s[0] == '-') { - OPM_ScanOptions((void*)s, 256, &OPM_glbopt); + OPM_ScanOptions(s, 256, &OPM_glbopt); OPM_S += 1; s[0] = 0x00; Platform_GetArg(OPM_S, (void*)s, 256); @@ -308,20 +377,14 @@ void OPM_InitOptions (void) s[0] = 0x00; Platform_GetArg(OPM_S, (void*)s, 256); while (s[0] == '-') { - OPM_ScanOptions((void*)s, 256, &OPM_opt); + OPM_ScanOptions(s, 256, &OPM_opt); OPM_S += 1; s[0] = 0x00; Platform_GetArg(OPM_S, (void*)s, 256); } - OPM_dontAsm = __IN(13, OPM_opt, 32); - OPM_dontLink = __IN(14, OPM_opt, 32); - OPM_mainProg = __IN(10, OPM_opt, 32); - OPM_mainLinkStat = __IN(15, OPM_opt, 32); - OPM_notColorOutput = __IN(16, OPM_opt, 32); - OPM_forceNewSym = __IN(17, OPM_opt, 32); - OPM_Verbose = __IN(18, OPM_opt, 32); - if (OPM_mainLinkStat) { + if (__IN(15, OPM_opt, 32)) { OPM_glbopt |= __SETOF(10,32); + OPM_opt |= __SETOF(10,32); } OPM_GetProperties(); } @@ -407,20 +470,20 @@ static void OPM_LogErrMsg (int16 n) int16 i; CHAR buf[1024]; if (n >= 0) { - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"31m", 4); } OPM_LogWStr((CHAR*)" err ", 7); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } } else { - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"35m", 4); } OPM_LogWStr((CHAR*)" warning ", 11); n = -n; - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } } @@ -493,11 +556,11 @@ static void OPM_ShowLine (int64 pos) OPM_LogW(' '); i -= 1; } - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"32m", 4); } OPM_LogW('^'); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } Files_Close(f); @@ -682,7 +745,7 @@ static void OPM_GetProperties (void) OPM_MinLReal = -OPM_MaxLReal; OPM_MaxSet = __ASHL(OPM_SetSize, 3) - 1; OPM_MaxIndex = OPM_SignedMaximum(OPM_AddressSize); - if (OPM_Verbose) { + if (__IN(18, OPM_opt, 32)) { OPM_VerboseListSizes(); } } diff --git a/bootstrap/unix-48/OPM.h b/bootstrap/unix-48/OPM.h index 1835a2b8..b32da345 100644 --- a/bootstrap/unix-48/OPM.h +++ b/bootstrap/unix-48/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPM__h #define OPM__h @@ -15,7 +15,6 @@ 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 BOOLEAN OPM_dontAsm, OPM_dontLink, OPM_mainProg, OPM_mainLinkStat, OPM_notColorOutput, OPM_forceNewSym, OPM_Verbose; import void OPM_CloseFiles (void); diff --git a/bootstrap/unix-48/OPP.c b/bootstrap/unix-48/OPP.c index f62551cc..af0d37db 100644 --- a/bootstrap/unix-48/OPP.c +++ b/bootstrap/unix-48/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/OPP.h b/bootstrap/unix-48/OPP.h index 9ae7712a..6dd03161 100644 --- a/bootstrap/unix-48/OPP.h +++ b/bootstrap/unix-48/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/unix-48/OPS.c b/bootstrap/unix-48/OPS.c index f04f47ad..f37bbc27 100644 --- a/bootstrap/unix-48/OPS.c +++ b/bootstrap/unix-48/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/OPS.h b/bootstrap/unix-48/OPS.h index 3ff9b0b3..1b60944c 100644 --- a/bootstrap/unix-48/OPS.h +++ b/bootstrap/unix-48/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/unix-48/OPT.c b/bootstrap/unix-48/OPT.c index acdca9f2..148fbecb 100644 --- a/bootstrap/unix-48/OPT.c +++ b/bootstrap/unix-48/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -1733,10 +1733,7 @@ void OPT_Export (BOOLEAN *ext, BOOLEAN *new) } OPT_OutObj(OPT_topScope->right); *ext = (OPT_sfpresent && OPT_symExtended); - *new = !OPT_sfpresent || OPT_symNew; - if (OPM_forceNewSym) { - *new = 1; - } + *new = (!OPT_sfpresent || OPT_symNew) || __IN(17, OPM_opt, 32); if ((((OPM_noerr && OPT_sfpresent)) && OPT_impCtxt.reffp != OPT_expCtxt.reffp)) { *new = 1; if (!OPT_extsf) { diff --git a/bootstrap/unix-48/OPT.h b/bootstrap/unix-48/OPT.h index 9ee5643f..d999d4ec 100644 --- a/bootstrap/unix-48/OPT.h +++ b/bootstrap/unix-48/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/unix-48/OPV.c b/bootstrap/unix-48/OPV.c index 2146d7c2..edb84f81 100644 --- a/bootstrap/unix-48/OPV.c +++ b/bootstrap/unix-48/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -16,7 +16,6 @@ typedef } OPV_ExitInfo; -static BOOLEAN OPV_assert, OPV_inxchk, OPV_mainprog, OPV_ansi; static int16 OPV_stamp; static int32 OPV_recno; static OPV_ExitInfo OPV_exit; @@ -130,10 +129,6 @@ void OPV_Init (void) OPV_stamp = 0; OPV_recno = 0; OPV_nofExitLabels = 0; - OPV_assert = __IN(7, OPM_opt, 32); - OPV_inxchk = __IN(0, OPM_opt, 32); - OPV_mainprog = __IN(10, OPM_opt, 32); - OPV_ansi = __IN(6, OPM_opt, 32); } static void OPV_GetTProcNum (OPT_Object obj) @@ -532,7 +527,7 @@ static void OPV_TypeOf (OPT_Node n) static void OPV_Index (OPT_Node n, OPT_Node d, int16 prec, int16 dim) { - if (!OPV_inxchk || (n->right->class == 7 && (n->right->conval->intval == 0 || n->left->typ->comp != 3))) { + if (!__IN(0, OPM_opt, 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)) { @@ -728,11 +723,7 @@ static void OPV_design (OPT_Node n, int16 prec) static void OPV_ParIntLiteral (int64 n, int32 size) { - if (OPV_ansi) { - OPM_WriteInt(n); - } else { - OPC_IntLiteral(n, size); - } + OPM_WriteInt(n); } static void OPV_ActualPar (OPT_Node n, OPT_Object fp) @@ -754,26 +745,19 @@ static void OPV_ActualPar (OPT_Node n, OPT_Object fp) } if (!__IN(n->typ->comp, 0x0c, 32)) { if (mode == 2) { - if ((OPV_ansi && typ != n->typ)) { + if (typ != n->typ) { OPM_WriteString((CHAR*)"(void*)", 8); } OPM_Write('&'); prec = 9; - } else if (OPV_ansi) { + } else { if ((__IN(comp, 0x0c, 32) && n->class == 7)) { OPM_WriteString((CHAR*)"(CHAR*)", 8); } else if ((((form == 11 && typ != n->typ)) && n->typ != OPT_niltyp)) { OPM_WriteString((CHAR*)"(void*)", 8); } - } else { - if ((__IN(form, 0x60, 32) && n->typ->form == 4)) { - OPM_WriteString((CHAR*)"(double)", 9); - prec = 9; - } else if (form == 4) { - OPV_SizeCast(n->typ->size, typ->size); - } } - } else if (OPV_ansi) { + } else { if ((((mode == 2 && typ != n->typ)) && prec == -1)) { OPM_WriteString((CHAR*)"(void*)", 8); } @@ -1532,7 +1516,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) case 20: if (n->subcl != 32) { OPV_IfStat(n, 0, outerProc); - } else if (OPV_assert) { + } else if (__IN(7, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__ASSERT(", 10); OPV_expr(n->left->left->left, -1); OPM_WriteString((CHAR*)", ", 3); @@ -1598,7 +1582,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) break; case 26: if (OPM_level == 0) { - if (OPV_mainprog) { + if (__IN(10, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__FINI", 7); } else { OPM_WriteString((CHAR*)"__ENDMOD", 9); @@ -1643,7 +1627,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) void OPV_Module (OPT_Node prog) { - if (!OPV_mainprog) { + if (!__IN(10, OPM_opt, 32)) { OPC_GenHdr(prog->right); OPC_GenHdrIncludes(); } diff --git a/bootstrap/unix-48/OPV.h b/bootstrap/unix-48/OPV.h index f78267d0..a89aa61a 100644 --- a/bootstrap/unix-48/OPV.h +++ b/bootstrap/unix-48/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/unix-48/Platform.c b/bootstrap/unix-48/Platform.c index a42034f5..2f652641 100644 --- a/bootstrap/unix-48/Platform.c +++ b/bootstrap/unix-48/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/Platform.h b/bootstrap/unix-48/Platform.h index 99b78a56..adbbe116 100644 --- a/bootstrap/unix-48/Platform.h +++ b/bootstrap/unix-48/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/unix-48/Reals.c b/bootstrap/unix-48/Reals.c index c032a4a5..dec0e0b4 100644 --- a/bootstrap/unix-48/Reals.c +++ b/bootstrap/unix-48/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/Reals.h b/bootstrap/unix-48/Reals.h index b4469c3a..0b779857 100644 --- a/bootstrap/unix-48/Reals.h +++ b/bootstrap/unix-48/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/unix-48/Strings.c b/bootstrap/unix-48/Strings.c index db9dbf02..69612295 100644 --- a/bootstrap/unix-48/Strings.c +++ b/bootstrap/unix-48/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/Strings.h b/bootstrap/unix-48/Strings.h index 9d2d3b44..b4d5f201 100644 --- a/bootstrap/unix-48/Strings.h +++ b/bootstrap/unix-48/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/unix-48/Texts.c b/bootstrap/unix-48/Texts.c index 5ae009bd..c02becc4 100644 --- a/bootstrap/unix-48/Texts.c +++ b/bootstrap/unix-48/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/Texts.h b/bootstrap/unix-48/Texts.h index 299cfde9..fbb113f7 100644 --- a/bootstrap/unix-48/Texts.h +++ b/bootstrap/unix-48/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/unix-48/Vishap.c b/bootstrap/unix-48/Vishap.c index c3405c16..17b498b8 100644 --- a/bootstrap/unix-48/Vishap.c +++ b/bootstrap/unix-48/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspamSf */ #define INTEGER int16 #define LONGINT int32 @@ -42,22 +42,22 @@ void Vishap_Module (BOOLEAN *done) OPC_Init(); OPV_Module(p); if (OPM_noerr) { - if (((OPM_mainProg || OPM_mainLinkStat) && __STRCMP(OPM_modName, "SYSTEM") != 0)) { + if ((__IN(10, OPM_opt, 32) && __STRCMP(OPM_modName, "SYSTEM") != 0)) { OPM_DeleteNewSym(); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"32m", 4); } OPM_LogWStr((CHAR*)" Main program.", 16); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } } else { if (new) { - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"32m", 4); } OPM_LogWStr((CHAR*)" New symbol file.", 19); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } OPM_RegisterNewSym(); @@ -111,17 +111,17 @@ void Vishap_Translate (void) OPM_LogWLn(); Platform_Exit(1); } - if (!OPM_dontAsm) { - if (OPM_dontLink) { + if (!__IN(13, OPM_opt, 32)) { + if (__IN(14, OPM_opt, 32)) { extTools_Assemble(OPM_modName, 32); } else { - if (!(OPM_mainProg || OPM_mainLinkStat)) { + if (!__IN(10, OPM_opt, 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, OPM_mainLinkStat, modulesobj, 2048); + extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_opt, 32), modulesobj, 2048); } } } diff --git a/bootstrap/unix-48/errors.c b/bootstrap/unix-48/errors.c index 2e61c724..95868540 100644 --- a/bootstrap/unix-48/errors.c +++ b/bootstrap/unix-48/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/errors.h b/bootstrap/unix-48/errors.h index 99f4c6b0..d574008d 100644 --- a/bootstrap/unix-48/errors.h +++ b/bootstrap/unix-48/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/unix-48/extTools.c b/bootstrap/unix-48/extTools.c index 8838dd7b..9047ebcc 100644 --- a/bootstrap/unix-48/extTools.c +++ b/bootstrap/unix-48/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -25,7 +25,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 (OPM_Verbose) { + if (__IN(18, OPM_opt, 32)) { Console_String(title, title__len); Console_String(cmd, cmd__len); Console_Ln(); diff --git a/bootstrap/unix-48/extTools.h b/bootstrap/unix-48/extTools.h index d4f0c474..847e440e 100644 --- a/bootstrap/unix-48/extTools.h +++ b/bootstrap/unix-48/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/unix-48/vt100.c b/bootstrap/unix-48/vt100.c index 5d050112..a14f3ee0 100644 --- a/bootstrap/unix-48/vt100.c +++ b/bootstrap/unix-48/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/unix-48/vt100.h b/bootstrap/unix-48/vt100.h index 11aabb2a..1402af8c 100644 --- a/bootstrap/unix-48/vt100.h +++ b/bootstrap/unix-48/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef vt100__h #define vt100__h diff --git a/bootstrap/unix-88/Configuration.c b/bootstrap/unix-88/Configuration.c index 9db9e691..122d2b82 100644 --- a/bootstrap/unix-88/Configuration.c +++ b/bootstrap/unix-88/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/Configuration.h b/bootstrap/unix-88/Configuration.h index 831281d6..7fdf5f78 100644 --- a/bootstrap/unix-88/Configuration.h +++ b/bootstrap/unix-88/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/unix-88/Console.c b/bootstrap/unix-88/Console.c index 7e051e81..d489489e 100644 --- a/bootstrap/unix-88/Console.c +++ b/bootstrap/unix-88/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/Console.h b/bootstrap/unix-88/Console.h index be8ab870..255cb17c 100644 --- a/bootstrap/unix-88/Console.h +++ b/bootstrap/unix-88/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/unix-88/Files.c b/bootstrap/unix-88/Files.c index efed2605..1e1dea21 100644 --- a/bootstrap/unix-88/Files.c +++ b/bootstrap/unix-88/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/Files.h b/bootstrap/unix-88/Files.h index 64f39a5b..08a62623 100644 --- a/bootstrap/unix-88/Files.h +++ b/bootstrap/unix-88/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspaSfF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/unix-88/Heap.c b/bootstrap/unix-88/Heap.c index 68a02b24..85664851 100644 --- a/bootstrap/unix-88/Heap.c +++ b/bootstrap/unix-88/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tsSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/Heap.h b/bootstrap/unix-88/Heap.h index 04b1a4f9..b11a81ee 100644 --- a/bootstrap/unix-88/Heap.h +++ b/bootstrap/unix-88/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tsSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/unix-88/Modules.c b/bootstrap/unix-88/Modules.c index 0e60d59f..24319ad6 100644 --- a/bootstrap/unix-88/Modules.c +++ b/bootstrap/unix-88/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/Modules.h b/bootstrap/unix-88/Modules.h index 5fec9a72..4c14134c 100644 --- a/bootstrap/unix-88/Modules.h +++ b/bootstrap/unix-88/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/unix-88/OPB.c b/bootstrap/unix-88/OPB.c index fedc1751..fab97f6a 100644 --- a/bootstrap/unix-88/OPB.c +++ b/bootstrap/unix-88/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 @@ -1542,7 +1542,7 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) OPT_Struct y = NIL; int32 f, g; OPT_Struct p = NIL, q = NIL; - if (OPM_Verbose) { + if (__IN(18, OPM_opt, 64)) { OPM_LogWLn(); OPM_LogWStr((CHAR*)"PROCEDURE CheckAssign", 22); OPM_LogWLn(); @@ -1550,7 +1550,7 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) y = ynode->typ; f = x->form; g = y->form; - if (OPM_Verbose) { + if (__IN(18, OPM_opt, 64)) { OPM_LogWStr((CHAR*)"y.form = ", 10); OPM_LogWNum(y->form, 0); OPM_LogWLn(); diff --git a/bootstrap/unix-88/OPB.h b/bootstrap/unix-88/OPB.h index 72ea3c62..deb651aa 100644 --- a/bootstrap/unix-88/OPB.h +++ b/bootstrap/unix-88/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/unix-88/OPC.c b/bootstrap/unix-88/OPC.c index 2c8127e1..dd9e2a18 100644 --- a/bootstrap/unix-88/OPC.c +++ b/bootstrap/unix-88/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 @@ -11,7 +11,6 @@ static int32 OPC_indentLevel; -static BOOLEAN OPC_ptrinit, OPC_mainprog, OPC_ansi; static int8 OPC_hashtab[105]; static CHAR OPC_keytab[50][9]; static BOOLEAN OPC_GlbPtrs; @@ -93,14 +92,7 @@ static BOOLEAN OPC_Undefined (OPT_Object obj); void OPC_Init (void) { OPC_indentLevel = 0; - OPC_ptrinit = __IN(5, OPM_opt, 64); - OPC_mainprog = OPM_mainProg || OPM_mainLinkStat; - OPC_ansi = __IN(6, OPM_opt, 64); - if (OPC_ansi) { - __MOVE("__init(void)", OPC_BodyNameExt, 13); - } else { - __MOVE("__init()", OPC_BodyNameExt, 9); - } + __MOVE("__init(void)", OPC_BodyNameExt, 13); } void OPC_Indent (int32 count) @@ -299,12 +291,8 @@ static void OPC_DeclareObj (OPT_Object dcl, BOOLEAN scopeDef) openClause = 0; } if (form == 12) { - if (OPC_ansi) { - OPM_Write(')'); - OPC_AnsiParamList(typ->link, 0); - } else { - OPM_WriteString((CHAR*)")()", 4); - } + OPM_Write(')'); + OPC_AnsiParamList(typ->link, 0); break; } else if (comp == 2) { OPM_Write('['); @@ -579,12 +567,10 @@ static void OPC_DefineTProcTypes (OPT_Object obj) if (obj->typ != OPT_notyp) { OPC_DefineType(obj->typ); } - if (OPC_ansi) { - par = obj->link; - while (par != NIL) { - OPC_DefineType(par->typ); - par = par->link; - } + par = obj->link; + while (par != NIL) { + OPC_DefineType(par->typ); + par = par->link; } } @@ -662,11 +648,7 @@ static void OPC_DefineTProcMacros (OPT_Object obj, BOOLEAN *empty) OPC_Ident(obj->typ->strobj); } OPM_WriteString((CHAR*)"(*)", 4); - if (OPC_ansi) { - OPC_AnsiParamList(obj->link, 0); - } else { - OPM_WriteString((CHAR*)"()", 3); - } + OPC_AnsiParamList(obj->link, 0); OPM_WriteString((CHAR*)", ", 3); OPC_DeclareParams(obj->link, 1); OPM_Write(')'); @@ -1063,7 +1045,7 @@ static void OPC_IdentList (OPT_Object obj, int32 vis) OPC_Ident(obj); OPM_WriteString((CHAR*)"__typ", 6); base = NIL; - } else if ((((((OPC_ptrinit && vis == 0)) && obj->mnolev > 0)) && obj->typ->form == 11)) { + } else if ((((((__IN(5, OPM_opt, 64) && vis == 0)) && obj->mnolev > 0)) && obj->typ->form == 11)) { OPM_WriteString((CHAR*)" = NIL", 7); } } @@ -1122,22 +1104,11 @@ static void OPC_ProcHeader (OPT_Object proc, BOOLEAN define) OPM_Write(' '); OPC_Ident(proc); OPM_Write(' '); - if (OPC_ansi) { - OPC_AnsiParamList(proc->link, 1); - if (!define) { - OPM_Write(';'); - } - OPM_WriteLn(); - } else if (define) { - OPC_DeclareParams(proc->link, 0); - OPM_WriteLn(); - OPC_Indent(1); - OPC_IdentList(proc->link, 2); - OPC_Indent(-1); - } else { - OPM_WriteString((CHAR*)"();", 4); - OPM_WriteLn(); + OPC_AnsiParamList(proc->link, 1); + if (!define) { + OPM_Write(';'); } + OPM_WriteLn(); } static void OPC_ProcPredefs (OPT_Object obj, int8 vis) @@ -1255,9 +1226,6 @@ static void OPC_GenHeaderMsg (void) case 5: OPM_Write('p'); break; - case 6: - OPM_Write('k'); - break; case 7: OPM_Write('a'); break; @@ -1391,15 +1359,7 @@ void OPC_GenEnumPtrs (OPT_Object var) if (OPC_NofPtrs(typ) > 0) { if (!OPC_GlbPtrs) { OPC_GlbPtrs = 1; - OPM_WriteString((CHAR*)"static ", 8); - if (OPC_ansi) { - OPM_WriteString((CHAR*)"void EnumPtrs(void (*P)(void*))", 32); - } else { - OPM_WriteString((CHAR*)"void EnumPtrs(P)", 17); - OPM_WriteLn(); - OPM_Write(0x09); - OPM_WriteString((CHAR*)"void (*P)();", 13); - } + OPM_WriteString((CHAR*)"static void EnumPtrs(void (*P)(void*))", 39); OPM_WriteLn(); OPC_BegBlk(); } @@ -1451,17 +1411,9 @@ void OPC_EnterBody (void) { OPM_WriteLn(); OPM_WriteString((CHAR*)"export ", 8); - if (OPC_mainprog) { - if (OPC_ansi) { - OPM_WriteString((CHAR*)"int main(int argc, char **argv)", 32); - OPM_WriteLn(); - } else { - OPM_WriteString((CHAR*)"main(argc, argv)", 17); - OPM_WriteLn(); - OPM_Write(0x09); - OPM_WriteString((CHAR*)"int argc; char **argv;", 23); - OPM_WriteLn(); - } + if (__IN(10, OPM_opt, 64)) { + OPM_WriteString((CHAR*)"int main(int argc, char **argv)", 32); + OPM_WriteLn(); } else { OPM_WriteString((CHAR*)"void *", 7); OPM_WriteString(OPM_modName, 32); @@ -1470,20 +1422,20 @@ void OPC_EnterBody (void) } OPC_BegBlk(); OPC_BegStat(); - if (OPC_mainprog) { + if (__IN(10, OPM_opt, 64)) { OPM_WriteString((CHAR*)"__INIT(argc, argv)", 19); } else { OPM_WriteString((CHAR*)"__DEFMOD", 9); } OPC_EndStat(); - if ((OPC_mainprog && 0)) { + if ((__IN(10, OPM_opt, 64) && 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 (OPC_mainprog) { + if (__IN(10, OPM_opt, 64)) { OPM_WriteString((CHAR*)"__REGMAIN(\"", 12); } else { OPM_WriteString((CHAR*)"__REGMOD(\"", 11); @@ -1503,7 +1455,7 @@ void OPC_EnterBody (void) void OPC_ExitBody (void) { OPC_BegStat(); - if (OPC_mainprog) { + if (__IN(10, OPM_opt, 64)) { OPM_WriteString((CHAR*)"__FINI;", 8); } else { OPM_WriteString((CHAR*)"__ENDMOD;", 10); @@ -1583,21 +1535,6 @@ void OPC_EnterProc (OPT_Object proc) } var = var->link; } - if (!OPC_ansi) { - var = proc->link; - while (var != NIL) { - if ((var->typ->form == 5 && var->mode == 1)) { - OPC_BegStat(); - OPC_Ident(var->typ->strobj); - OPM_Write(' '); - OPC_Ident(var); - OPM_WriteString((CHAR*)" = _", 5); - OPC_Ident(var); - OPC_EndStat(); - } - var = var->link; - } - } var = proc->link; while (var != NIL) { if ((((__IN(var->typ->comp, 0x0c, 64) && var->mode == 1)) && var->typ->sysflag == 0)) { @@ -1963,11 +1900,7 @@ void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim) array = array->BaseTyp; dim -= 1; } - if (OPC_ansi) { - OPM_WriteInt(array->n); - } else { - OPC_IntLiteral(array->n, OPM_AddressSize); - } + OPM_WriteInt(array->n); } } diff --git a/bootstrap/unix-88/OPC.h b/bootstrap/unix-88/OPC.h index 30f3fd48..ae8e7035 100644 --- a/bootstrap/unix-88/OPC.h +++ b/bootstrap/unix-88/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/unix-88/OPM.c b/bootstrap/unix-88/OPM.c index 391613fb..1b8dca0d 100644 --- a/bootstrap/unix-88/OPM.c +++ b/bootstrap/unix-88/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 @@ -36,7 +36,6 @@ 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 int32 OPM_S; -export BOOLEAN OPM_dontAsm, OPM_dontLink, OPM_mainProg, OPM_mainLinkStat, OPM_notColorOutput, OPM_forceNewSym, OPM_Verbose; static CHAR OPM_OBERON[1024]; static CHAR OPM_MODULES[1024]; @@ -137,42 +136,94 @@ int32 OPM_Integer (int64 n) static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) { int32 i; + __DUP(s, s__len, CHAR); i = 1; while (s[__X(i, s__len)] != 0x00) { switch (s[__X(i, s__len)]) { - case 'a': - *opt = *opt ^ 0x80; - break; - case 'c': - *opt = *opt ^ 0x4000; - break; - case 'e': - *opt = *opt ^ 0x0200; - break; - case 'f': - *opt = *opt ^ 0x010000; - break; - case 'k': - *opt = *opt ^ 0x40; - break; - case 'm': - *opt = *opt ^ 0x0400; - break; case 'p': *opt = *opt ^ 0x20; break; + case 'a': + *opt = *opt ^ 0x80; + break; case 'r': *opt = *opt ^ 0x04; break; - case 's': - *opt = *opt ^ 0x10; - break; case 't': *opt = *opt ^ 0x08; break; case 'x': *opt = *opt ^ 0x01; break; + case 'e': + *opt = *opt ^ 0x0200; + break; + case 's': + *opt = *opt ^ 0x10; + break; + case 'F': + *opt = *opt ^ 0x020000; + break; + case 'm': + *opt = *opt ^ 0x0400; + break; + case 'M': + *opt = *opt ^ 0x8000; + break; + case 'S': + *opt = *opt ^ 0x2000; + break; + case 'c': + *opt = *opt ^ 0x4000; + break; + case 'f': + *opt = *opt ^ 0x010000; + break; + case 'V': + *opt = *opt ^ 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; + } + i += 1; + } + break; + case 'A': + if (i + 2 >= Strings_Length(s, s__len)) { + OPM_LogWStr((CHAR*)"-M option requires two following digits.", 41); + OPM_LogWLn(); + } else { + OPM_AddressSize = s[__X(i + 1, s__len)] - 48; + OPM_Alignment = s[__X(i + 2, s__len)] - 48; + i += 2; + } + break; case 'B': if (s[__X(i + 1, s__len)] != 0x00) { i += 1; @@ -198,18 +249,6 @@ static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) } Files_SetSearchPath((CHAR*)"", 1); break; - case 'F': - *opt = *opt ^ 0x020000; - break; - case 'M': - *opt = *opt ^ 0x8000; - break; - case 'S': - *opt = *opt ^ 0x2000; - break; - case 'V': - *opt = *opt ^ 0x040000; - break; default: OPM_LogWStr((CHAR*)" warning: option ", 19); OPM_LogW('-'); @@ -220,6 +259,7 @@ static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) } i += 1; } + __DEL(s); } BOOLEAN OPM_OpenPar (void) @@ -246,33 +286,62 @@ BOOLEAN OPM_OpenPar (void) OPM_LogWStr((CHAR*)"Where options = [\"-\" {option} ].", 33); OPM_LogWLn(); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" m - generate code for main module", 36); + OPM_LogWStr((CHAR*)" Run time safety", 18); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" M - generate code for main module and link object statically", 63); + OPM_LogWStr((CHAR*)" -p Initialise pointers to NIL.", 37); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" s - generate new symbol file", 31); + OPM_LogWStr((CHAR*)" -a Halt on assertion failures.", 37); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" e - allow extending the module interface", 43); + OPM_LogWStr((CHAR*)" -r Halt on range check failures.", 39); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" r - check value ranges", 25); + OPM_LogWStr((CHAR*)" -t Halt on type guad failure.", 36); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" x - turn off array indices check", 35); + OPM_LogWStr((CHAR*)" -x Halt on index out of range.", 37); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" a - don't check ASSERTs at runtime, use this option in tested production code", 80); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" p - turn off automatic pointer initialization", 48); + OPM_LogWStr((CHAR*)" Symbol file management", 25); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" t - don't check type guards (use in rare cases such as low-level modules where every cycle counts)", 101); + OPM_LogWStr((CHAR*)" -e Allow extension of old symbol file.", 45); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" S - don't call external assembler/compiler, only generate C code", 67); + OPM_LogWStr((CHAR*)" -s Allow generation of new symbol file.", 46); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" c - don't call linker", 24); + OPM_LogWStr((CHAR*)" -F Force generation of new symbol file.", 46); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" f - don't use color output", 29); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" F - force writing new symbol file in current directory", 57); + OPM_LogWStr((CHAR*)" C compiler and linker control", 32); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" V - verbose output", 21); + OPM_LogWStr((CHAR*)" -m This module is main. Link dynamically.", 48); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -M This module is main. Link statically.", 47); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -S Don't call C compiler", 31); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -c Don't link.", 21); + OPM_LogWLn(); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" Miscellaneous", 16); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -f Disable vt100 control characters in status output.", 60); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -V Display compiler debugging messages.", 46); + OPM_LogWLn(); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" Size model for elementary types", 34); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -O2 Original Oberon / Oberon-2: 8 bit SHORTINT, 16 bit INTEGER, 32 bit LONGINT and SET.", 94); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -OC Component Pascal: 16 bit SHORTINT, 32 bit INTEGER, 64 bit LONGINT and SET.", 94); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -OV Alternate large model: 8 bit SHORTINT, 32 bit INTEGER, 64 bit LONGINT and SET.", 94); + OPM_LogWLn(); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" Target machine address size and alignment", 44); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -A44 32 bit addresses, 32 bit alignment (e.g. Unix/linux 32 bit on x86).", 79); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -A48 32 bit addresses, 64 bit alignment (e.g. Windows 32 bit on x86, linux 32 bit on arm).", 97); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -A88 66 bit addresses, 64 bit alignment (e.g. 64 bit platforms).", 71); OPM_LogWLn(); OPM_LogWLn(); OPM_LogWStr((CHAR*)"Initial options specify defaults for all files.", 48); @@ -287,9 +356,9 @@ BOOLEAN OPM_OpenPar (void) OPM_S = 1; s[0] = 0x00; Platform_GetArg(OPM_S, (void*)s, 256); - OPM_glbopt = 0xe9; + OPM_glbopt = 0xa9; while (s[0] == '-') { - OPM_ScanOptions((void*)s, 256, &OPM_glbopt); + OPM_ScanOptions(s, 256, &OPM_glbopt); OPM_S += 1; s[0] = 0x00; Platform_GetArg(OPM_S, (void*)s, 256); @@ -307,20 +376,14 @@ void OPM_InitOptions (void) s[0] = 0x00; Platform_GetArg(OPM_S, (void*)s, 256); while (s[0] == '-') { - OPM_ScanOptions((void*)s, 256, &OPM_opt); + OPM_ScanOptions(s, 256, &OPM_opt); OPM_S += 1; s[0] = 0x00; Platform_GetArg(OPM_S, (void*)s, 256); } - OPM_dontAsm = __IN(13, OPM_opt, 64); - OPM_dontLink = __IN(14, OPM_opt, 64); - OPM_mainProg = __IN(10, OPM_opt, 64); - OPM_mainLinkStat = __IN(15, OPM_opt, 64); - OPM_notColorOutput = __IN(16, OPM_opt, 64); - OPM_forceNewSym = __IN(17, OPM_opt, 64); - OPM_Verbose = __IN(18, OPM_opt, 64); - if (OPM_mainLinkStat) { + if (__IN(15, OPM_opt, 64)) { OPM_glbopt |= __SETOF(10,64); + OPM_opt |= __SETOF(10,64); } OPM_GetProperties(); } @@ -406,20 +469,20 @@ static void OPM_LogErrMsg (int32 n) int32 i; CHAR buf[1024]; if (n >= 0) { - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 64)) { vt100_SetAttr((CHAR*)"31m", 4); } OPM_LogWStr((CHAR*)" err ", 7); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 64)) { vt100_SetAttr((CHAR*)"0m", 3); } } else { - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 64)) { vt100_SetAttr((CHAR*)"35m", 4); } OPM_LogWStr((CHAR*)" warning ", 11); n = -n; - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 64)) { vt100_SetAttr((CHAR*)"0m", 3); } } @@ -492,11 +555,11 @@ static void OPM_ShowLine (int64 pos) OPM_LogW(' '); i -= 1; } - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 64)) { vt100_SetAttr((CHAR*)"32m", 4); } OPM_LogW('^'); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 64)) { vt100_SetAttr((CHAR*)"0m", 3); } Files_Close(f); @@ -679,7 +742,7 @@ static void OPM_GetProperties (void) OPM_MinLReal = -OPM_MaxLReal; OPM_MaxSet = __ASHL(OPM_SetSize, 3) - 1; OPM_MaxIndex = OPM_SignedMaximum(OPM_AddressSize); - if (OPM_Verbose) { + if (__IN(18, OPM_opt, 64)) { OPM_VerboseListSizes(); } } diff --git a/bootstrap/unix-88/OPM.h b/bootstrap/unix-88/OPM.h index 4a9253cf..e2737249 100644 --- a/bootstrap/unix-88/OPM.h +++ b/bootstrap/unix-88/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPM__h #define OPM__h @@ -15,7 +15,6 @@ import int32 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 BOOLEAN OPM_dontAsm, OPM_dontLink, OPM_mainProg, OPM_mainLinkStat, OPM_notColorOutput, OPM_forceNewSym, OPM_Verbose; import void OPM_CloseFiles (void); diff --git a/bootstrap/unix-88/OPP.c b/bootstrap/unix-88/OPP.c index ff86118c..e9fcba89 100644 --- a/bootstrap/unix-88/OPP.c +++ b/bootstrap/unix-88/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/OPP.h b/bootstrap/unix-88/OPP.h index 9ae7712a..6dd03161 100644 --- a/bootstrap/unix-88/OPP.h +++ b/bootstrap/unix-88/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/unix-88/OPS.c b/bootstrap/unix-88/OPS.c index c811b3cc..d79e207f 100644 --- a/bootstrap/unix-88/OPS.c +++ b/bootstrap/unix-88/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/OPS.h b/bootstrap/unix-88/OPS.h index 1c9ae6a4..40853589 100644 --- a/bootstrap/unix-88/OPS.h +++ b/bootstrap/unix-88/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/unix-88/OPT.c b/bootstrap/unix-88/OPT.c index 5fbe3b87..63b773cd 100644 --- a/bootstrap/unix-88/OPT.c +++ b/bootstrap/unix-88/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 @@ -1732,10 +1732,7 @@ void OPT_Export (BOOLEAN *ext, BOOLEAN *new) } OPT_OutObj(OPT_topScope->right); *ext = (OPT_sfpresent && OPT_symExtended); - *new = !OPT_sfpresent || OPT_symNew; - if (OPM_forceNewSym) { - *new = 1; - } + *new = (!OPT_sfpresent || OPT_symNew) || __IN(17, OPM_opt, 64); if ((((OPM_noerr && OPT_sfpresent)) && OPT_impCtxt.reffp != OPT_expCtxt.reffp)) { *new = 1; if (!OPT_extsf) { diff --git a/bootstrap/unix-88/OPT.h b/bootstrap/unix-88/OPT.h index 66686a2c..0cc86a01 100644 --- a/bootstrap/unix-88/OPT.h +++ b/bootstrap/unix-88/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/unix-88/OPV.c b/bootstrap/unix-88/OPV.c index 965f7b61..8026831f 100644 --- a/bootstrap/unix-88/OPV.c +++ b/bootstrap/unix-88/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 @@ -16,7 +16,6 @@ typedef } OPV_ExitInfo; -static BOOLEAN OPV_assert, OPV_inxchk, OPV_mainprog, OPV_ansi; static int32 OPV_stamp; static int64 OPV_recno; static OPV_ExitInfo OPV_exit; @@ -130,10 +129,6 @@ void OPV_Init (void) OPV_stamp = 0; OPV_recno = 0; OPV_nofExitLabels = 0; - OPV_assert = __IN(7, OPM_opt, 64); - OPV_inxchk = __IN(0, OPM_opt, 64); - OPV_mainprog = __IN(10, OPM_opt, 64); - OPV_ansi = __IN(6, OPM_opt, 64); } static void OPV_GetTProcNum (OPT_Object obj) @@ -532,7 +527,7 @@ static void OPV_TypeOf (OPT_Node n) static void OPV_Index (OPT_Node n, OPT_Node d, int32 prec, int32 dim) { - if (!OPV_inxchk || (n->right->class == 7 && (n->right->conval->intval == 0 || n->left->typ->comp != 3))) { + if (!__IN(0, OPM_opt, 64) || (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)) { @@ -728,11 +723,7 @@ static void OPV_design (OPT_Node n, int32 prec) static void OPV_ParIntLiteral (int64 n, int64 size) { - if (OPV_ansi) { - OPM_WriteInt(n); - } else { - OPC_IntLiteral(n, size); - } + OPM_WriteInt(n); } static void OPV_ActualPar (OPT_Node n, OPT_Object fp) @@ -754,26 +745,19 @@ static void OPV_ActualPar (OPT_Node n, OPT_Object fp) } if (!__IN(n->typ->comp, 0x0c, 64)) { if (mode == 2) { - if ((OPV_ansi && typ != n->typ)) { + if (typ != n->typ) { OPM_WriteString((CHAR*)"(void*)", 8); } OPM_Write('&'); prec = 9; - } else if (OPV_ansi) { + } else { if ((__IN(comp, 0x0c, 64) && n->class == 7)) { OPM_WriteString((CHAR*)"(CHAR*)", 8); } else if ((((form == 11 && typ != n->typ)) && n->typ != OPT_niltyp)) { OPM_WriteString((CHAR*)"(void*)", 8); } - } else { - if ((__IN(form, 0x60, 64) && n->typ->form == 4)) { - OPM_WriteString((CHAR*)"(double)", 9); - prec = 9; - } else if (form == 4) { - OPV_SizeCast(n->typ->size, typ->size); - } } - } else if (OPV_ansi) { + } else { if ((((mode == 2 && typ != n->typ)) && prec == -1)) { OPM_WriteString((CHAR*)"(void*)", 8); } @@ -1532,7 +1516,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) case 20: if (n->subcl != 32) { OPV_IfStat(n, 0, outerProc); - } else if (OPV_assert) { + } else if (__IN(7, OPM_opt, 64)) { OPM_WriteString((CHAR*)"__ASSERT(", 10); OPV_expr(n->left->left->left, -1); OPM_WriteString((CHAR*)", ", 3); @@ -1598,7 +1582,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) break; case 26: if (OPM_level == 0) { - if (OPV_mainprog) { + if (__IN(10, OPM_opt, 64)) { OPM_WriteString((CHAR*)"__FINI", 7); } else { OPM_WriteString((CHAR*)"__ENDMOD", 9); @@ -1643,7 +1627,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) void OPV_Module (OPT_Node prog) { - if (!OPV_mainprog) { + if (!__IN(10, OPM_opt, 64)) { OPC_GenHdr(prog->right); OPC_GenHdrIncludes(); } diff --git a/bootstrap/unix-88/OPV.h b/bootstrap/unix-88/OPV.h index f78267d0..a89aa61a 100644 --- a/bootstrap/unix-88/OPV.h +++ b/bootstrap/unix-88/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/unix-88/Platform.c b/bootstrap/unix-88/Platform.c index e2180e5d..99577840 100644 --- a/bootstrap/unix-88/Platform.c +++ b/bootstrap/unix-88/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/Platform.h b/bootstrap/unix-88/Platform.h index 6a8cce4b..06414b7c 100644 --- a/bootstrap/unix-88/Platform.h +++ b/bootstrap/unix-88/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/unix-88/Reals.c b/bootstrap/unix-88/Reals.c index e9e84723..f2623b03 100644 --- a/bootstrap/unix-88/Reals.c +++ b/bootstrap/unix-88/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/Reals.h b/bootstrap/unix-88/Reals.h index 116d9c93..05b31bee 100644 --- a/bootstrap/unix-88/Reals.h +++ b/bootstrap/unix-88/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/unix-88/Strings.c b/bootstrap/unix-88/Strings.c index 8dc35935..4226bdb9 100644 --- a/bootstrap/unix-88/Strings.c +++ b/bootstrap/unix-88/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/Strings.h b/bootstrap/unix-88/Strings.h index 0487b70c..b13ba079 100644 --- a/bootstrap/unix-88/Strings.h +++ b/bootstrap/unix-88/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/unix-88/Texts.c b/bootstrap/unix-88/Texts.c index 54254c51..4cdaa6b9 100644 --- a/bootstrap/unix-88/Texts.c +++ b/bootstrap/unix-88/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/Texts.h b/bootstrap/unix-88/Texts.h index 40d02918..10d0a9bb 100644 --- a/bootstrap/unix-88/Texts.h +++ b/bootstrap/unix-88/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/unix-88/Vishap.c b/bootstrap/unix-88/Vishap.c index 7cd188f2..e1d112ec 100644 --- a/bootstrap/unix-88/Vishap.c +++ b/bootstrap/unix-88/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspamSf */ #define INTEGER int32 #define LONGINT int64 @@ -42,22 +42,22 @@ void Vishap_Module (BOOLEAN *done) OPC_Init(); OPV_Module(p); if (OPM_noerr) { - if (((OPM_mainProg || OPM_mainLinkStat) && __STRCMP(OPM_modName, "SYSTEM") != 0)) { + if ((__IN(10, OPM_opt, 64) && __STRCMP(OPM_modName, "SYSTEM") != 0)) { OPM_DeleteNewSym(); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 64)) { vt100_SetAttr((CHAR*)"32m", 4); } OPM_LogWStr((CHAR*)" Main program.", 16); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 64)) { vt100_SetAttr((CHAR*)"0m", 3); } } else { if (new) { - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 64)) { vt100_SetAttr((CHAR*)"32m", 4); } OPM_LogWStr((CHAR*)" New symbol file.", 19); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 64)) { vt100_SetAttr((CHAR*)"0m", 3); } OPM_RegisterNewSym(); @@ -111,17 +111,17 @@ void Vishap_Translate (void) OPM_LogWLn(); Platform_Exit(1); } - if (!OPM_dontAsm) { - if (OPM_dontLink) { + if (!__IN(13, OPM_opt, 64)) { + if (__IN(14, OPM_opt, 64)) { extTools_Assemble(OPM_modName, 32); } else { - if (!(OPM_mainProg || OPM_mainLinkStat)) { + if (!__IN(10, OPM_opt, 64)) { 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, OPM_mainLinkStat, modulesobj, 2048); + extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_opt, 64), modulesobj, 2048); } } } diff --git a/bootstrap/unix-88/errors.c b/bootstrap/unix-88/errors.c index 04b9504d..ca898552 100644 --- a/bootstrap/unix-88/errors.c +++ b/bootstrap/unix-88/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/errors.h b/bootstrap/unix-88/errors.h index 99f4c6b0..d574008d 100644 --- a/bootstrap/unix-88/errors.h +++ b/bootstrap/unix-88/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/unix-88/extTools.c b/bootstrap/unix-88/extTools.c index 2eef1f18..db3aec30 100644 --- a/bootstrap/unix-88/extTools.c +++ b/bootstrap/unix-88/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 @@ -25,7 +25,7 @@ static void extTools_execute (CHAR *title, LONGINT title__len, CHAR *cmd, LONGIN int32 r, status, exitcode; __DUP(title, title__len, CHAR); __DUP(cmd, cmd__len, CHAR); - if (OPM_Verbose) { + if (__IN(18, OPM_opt, 64)) { Console_String(title, title__len); Console_String(cmd, cmd__len); Console_Ln(); diff --git a/bootstrap/unix-88/extTools.h b/bootstrap/unix-88/extTools.h index d4f0c474..847e440e 100644 --- a/bootstrap/unix-88/extTools.h +++ b/bootstrap/unix-88/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/unix-88/vt100.c b/bootstrap/unix-88/vt100.c index 3b56b4b1..ac832261 100644 --- a/bootstrap/unix-88/vt100.c +++ b/bootstrap/unix-88/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/unix-88/vt100.h b/bootstrap/unix-88/vt100.h index b574976e..054f6ddd 100644 --- a/bootstrap/unix-88/vt100.h +++ b/bootstrap/unix-88/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef vt100__h #define vt100__h diff --git a/bootstrap/windows-48/Configuration.c b/bootstrap/windows-48/Configuration.c index 6db18d8a..c780cc96 100644 --- a/bootstrap/windows-48/Configuration.c +++ b/bootstrap/windows-48/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/Configuration.h b/bootstrap/windows-48/Configuration.h index 831281d6..7fdf5f78 100644 --- a/bootstrap/windows-48/Configuration.h +++ b/bootstrap/windows-48/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/windows-48/Console.c b/bootstrap/windows-48/Console.c index 94c1e086..9c3127a1 100644 --- a/bootstrap/windows-48/Console.c +++ b/bootstrap/windows-48/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/Console.h b/bootstrap/windows-48/Console.h index b18bf88a..c8de3606 100644 --- a/bootstrap/windows-48/Console.h +++ b/bootstrap/windows-48/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/windows-48/Files.c b/bootstrap/windows-48/Files.c index 0c320187..80926272 100644 --- a/bootstrap/windows-48/Files.c +++ b/bootstrap/windows-48/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/Files.h b/bootstrap/windows-48/Files.h index febb2814..ade97ac7 100644 --- a/bootstrap/windows-48/Files.h +++ b/bootstrap/windows-48/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspaSfF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/windows-48/Heap.c b/bootstrap/windows-48/Heap.c index 63b8e488..50823221 100644 --- a/bootstrap/windows-48/Heap.c +++ b/bootstrap/windows-48/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tsSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/Heap.h b/bootstrap/windows-48/Heap.h index d150f1cf..57904466 100644 --- a/bootstrap/windows-48/Heap.h +++ b/bootstrap/windows-48/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tsSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/windows-48/Modules.c b/bootstrap/windows-48/Modules.c index a74b13a3..1c66c8e5 100644 --- a/bootstrap/windows-48/Modules.c +++ b/bootstrap/windows-48/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/Modules.h b/bootstrap/windows-48/Modules.h index d570a488..13b6dbed 100644 --- a/bootstrap/windows-48/Modules.h +++ b/bootstrap/windows-48/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/windows-48/OPB.c b/bootstrap/windows-48/OPB.c index a4070347..c9ebd8f5 100644 --- a/bootstrap/windows-48/OPB.c +++ b/bootstrap/windows-48/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -1542,7 +1542,7 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) OPT_Struct y = NIL; int16 f, g; OPT_Struct p = NIL, q = NIL; - if (OPM_Verbose) { + if (__IN(18, OPM_opt, 32)) { OPM_LogWLn(); OPM_LogWStr((CHAR*)"PROCEDURE CheckAssign", 22); OPM_LogWLn(); @@ -1550,7 +1550,7 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) y = ynode->typ; f = x->form; g = y->form; - if (OPM_Verbose) { + if (__IN(18, OPM_opt, 32)) { OPM_LogWStr((CHAR*)"y.form = ", 10); OPM_LogWNum(y->form, 0); OPM_LogWLn(); diff --git a/bootstrap/windows-48/OPB.h b/bootstrap/windows-48/OPB.h index a39fd352..cdd33f1b 100644 --- a/bootstrap/windows-48/OPB.h +++ b/bootstrap/windows-48/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/windows-48/OPC.c b/bootstrap/windows-48/OPC.c index f3b40759..6b7d1b01 100644 --- a/bootstrap/windows-48/OPC.c +++ b/bootstrap/windows-48/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -11,7 +11,6 @@ static int16 OPC_indentLevel; -static BOOLEAN OPC_ptrinit, OPC_mainprog, OPC_ansi; static int8 OPC_hashtab[105]; static CHAR OPC_keytab[50][9]; static BOOLEAN OPC_GlbPtrs; @@ -93,14 +92,7 @@ static BOOLEAN OPC_Undefined (OPT_Object obj); void OPC_Init (void) { OPC_indentLevel = 0; - OPC_ptrinit = __IN(5, OPM_opt, 32); - OPC_mainprog = OPM_mainProg || OPM_mainLinkStat; - OPC_ansi = __IN(6, OPM_opt, 32); - if (OPC_ansi) { - __MOVE("__init(void)", OPC_BodyNameExt, 13); - } else { - __MOVE("__init()", OPC_BodyNameExt, 9); - } + __MOVE("__init(void)", OPC_BodyNameExt, 13); } void OPC_Indent (int16 count) @@ -299,12 +291,8 @@ static void OPC_DeclareObj (OPT_Object dcl, BOOLEAN scopeDef) openClause = 0; } if (form == 12) { - if (OPC_ansi) { - OPM_Write(')'); - OPC_AnsiParamList(typ->link, 0); - } else { - OPM_WriteString((CHAR*)")()", 4); - } + OPM_Write(')'); + OPC_AnsiParamList(typ->link, 0); break; } else if (comp == 2) { OPM_Write('['); @@ -579,12 +567,10 @@ static void OPC_DefineTProcTypes (OPT_Object obj) if (obj->typ != OPT_notyp) { OPC_DefineType(obj->typ); } - if (OPC_ansi) { - par = obj->link; - while (par != NIL) { - OPC_DefineType(par->typ); - par = par->link; - } + par = obj->link; + while (par != NIL) { + OPC_DefineType(par->typ); + par = par->link; } } @@ -662,11 +648,7 @@ static void OPC_DefineTProcMacros (OPT_Object obj, BOOLEAN *empty) OPC_Ident(obj->typ->strobj); } OPM_WriteString((CHAR*)"(*)", 4); - if (OPC_ansi) { - OPC_AnsiParamList(obj->link, 0); - } else { - OPM_WriteString((CHAR*)"()", 3); - } + OPC_AnsiParamList(obj->link, 0); OPM_WriteString((CHAR*)", ", 3); OPC_DeclareParams(obj->link, 1); OPM_Write(')'); @@ -1063,7 +1045,7 @@ static void OPC_IdentList (OPT_Object obj, int16 vis) OPC_Ident(obj); OPM_WriteString((CHAR*)"__typ", 6); base = NIL; - } else if ((((((OPC_ptrinit && vis == 0)) && obj->mnolev > 0)) && obj->typ->form == 11)) { + } else if ((((((__IN(5, OPM_opt, 32) && vis == 0)) && obj->mnolev > 0)) && obj->typ->form == 11)) { OPM_WriteString((CHAR*)" = NIL", 7); } } @@ -1122,22 +1104,11 @@ static void OPC_ProcHeader (OPT_Object proc, BOOLEAN define) OPM_Write(' '); OPC_Ident(proc); OPM_Write(' '); - if (OPC_ansi) { - OPC_AnsiParamList(proc->link, 1); - if (!define) { - OPM_Write(';'); - } - OPM_WriteLn(); - } else if (define) { - OPC_DeclareParams(proc->link, 0); - OPM_WriteLn(); - OPC_Indent(1); - OPC_IdentList(proc->link, 2); - OPC_Indent(-1); - } else { - OPM_WriteString((CHAR*)"();", 4); - OPM_WriteLn(); + OPC_AnsiParamList(proc->link, 1); + if (!define) { + OPM_Write(';'); } + OPM_WriteLn(); } static void OPC_ProcPredefs (OPT_Object obj, int8 vis) @@ -1255,9 +1226,6 @@ static void OPC_GenHeaderMsg (void) case 5: OPM_Write('p'); break; - case 6: - OPM_Write('k'); - break; case 7: OPM_Write('a'); break; @@ -1391,15 +1359,7 @@ void OPC_GenEnumPtrs (OPT_Object var) if (OPC_NofPtrs(typ) > 0) { if (!OPC_GlbPtrs) { OPC_GlbPtrs = 1; - OPM_WriteString((CHAR*)"static ", 8); - if (OPC_ansi) { - OPM_WriteString((CHAR*)"void EnumPtrs(void (*P)(void*))", 32); - } else { - OPM_WriteString((CHAR*)"void EnumPtrs(P)", 17); - OPM_WriteLn(); - OPM_Write(0x09); - OPM_WriteString((CHAR*)"void (*P)();", 13); - } + OPM_WriteString((CHAR*)"static void EnumPtrs(void (*P)(void*))", 39); OPM_WriteLn(); OPC_BegBlk(); } @@ -1451,17 +1411,9 @@ void OPC_EnterBody (void) { OPM_WriteLn(); OPM_WriteString((CHAR*)"export ", 8); - if (OPC_mainprog) { - if (OPC_ansi) { - OPM_WriteString((CHAR*)"int main(int argc, char **argv)", 32); - OPM_WriteLn(); - } else { - OPM_WriteString((CHAR*)"main(argc, argv)", 17); - OPM_WriteLn(); - OPM_Write(0x09); - OPM_WriteString((CHAR*)"int argc; char **argv;", 23); - OPM_WriteLn(); - } + if (__IN(10, OPM_opt, 32)) { + OPM_WriteString((CHAR*)"int main(int argc, char **argv)", 32); + OPM_WriteLn(); } else { OPM_WriteString((CHAR*)"void *", 7); OPM_WriteString(OPM_modName, 32); @@ -1470,20 +1422,20 @@ void OPC_EnterBody (void) } OPC_BegBlk(); OPC_BegStat(); - if (OPC_mainprog) { + if (__IN(10, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__INIT(argc, argv)", 19); } else { OPM_WriteString((CHAR*)"__DEFMOD", 9); } OPC_EndStat(); - if ((OPC_mainprog && 0)) { + if ((__IN(10, OPM_opt, 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 (OPC_mainprog) { + if (__IN(10, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__REGMAIN(\"", 12); } else { OPM_WriteString((CHAR*)"__REGMOD(\"", 11); @@ -1503,7 +1455,7 @@ void OPC_EnterBody (void) void OPC_ExitBody (void) { OPC_BegStat(); - if (OPC_mainprog) { + if (__IN(10, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__FINI;", 8); } else { OPM_WriteString((CHAR*)"__ENDMOD;", 10); @@ -1583,21 +1535,6 @@ void OPC_EnterProc (OPT_Object proc) } var = var->link; } - if (!OPC_ansi) { - var = proc->link; - while (var != NIL) { - if ((var->typ->form == 5 && var->mode == 1)) { - OPC_BegStat(); - OPC_Ident(var->typ->strobj); - OPM_Write(' '); - OPC_Ident(var); - OPM_WriteString((CHAR*)" = _", 5); - OPC_Ident(var); - OPC_EndStat(); - } - var = var->link; - } - } var = proc->link; while (var != NIL) { if ((((__IN(var->typ->comp, 0x0c, 32) && var->mode == 1)) && var->typ->sysflag == 0)) { @@ -1963,11 +1900,7 @@ void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim) array = array->BaseTyp; dim -= 1; } - if (OPC_ansi) { - OPM_WriteInt(array->n); - } else { - OPC_IntLiteral(array->n, OPM_AddressSize); - } + OPM_WriteInt(array->n); } } diff --git a/bootstrap/windows-48/OPC.h b/bootstrap/windows-48/OPC.h index 1ac87c2d..b398282e 100644 --- a/bootstrap/windows-48/OPC.h +++ b/bootstrap/windows-48/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/windows-48/OPM.c b/bootstrap/windows-48/OPM.c index e5b7fc83..0086ff0f 100644 --- a/bootstrap/windows-48/OPM.c +++ b/bootstrap/windows-48/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -37,7 +37,6 @@ 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; -export BOOLEAN OPM_dontAsm, OPM_dontLink, OPM_mainProg, OPM_mainLinkStat, OPM_notColorOutput, OPM_forceNewSym, OPM_Verbose; static CHAR OPM_OBERON[1024]; static CHAR OPM_MODULES[1024]; @@ -138,42 +137,94 @@ int16 OPM_Integer (int64 n) static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) { int16 i; + __DUP(s, s__len, CHAR); i = 1; while (s[__X(i, s__len)] != 0x00) { switch (s[__X(i, s__len)]) { - case 'a': - *opt = *opt ^ 0x80; - break; - case 'c': - *opt = *opt ^ 0x4000; - break; - case 'e': - *opt = *opt ^ 0x0200; - break; - case 'f': - *opt = *opt ^ 0x010000; - break; - case 'k': - *opt = *opt ^ 0x40; - break; - case 'm': - *opt = *opt ^ 0x0400; - break; case 'p': *opt = *opt ^ 0x20; break; + case 'a': + *opt = *opt ^ 0x80; + break; case 'r': *opt = *opt ^ 0x04; break; - case 's': - *opt = *opt ^ 0x10; - break; case 't': *opt = *opt ^ 0x08; break; case 'x': *opt = *opt ^ 0x01; break; + case 'e': + *opt = *opt ^ 0x0200; + break; + case 's': + *opt = *opt ^ 0x10; + break; + case 'F': + *opt = *opt ^ 0x020000; + break; + case 'm': + *opt = *opt ^ 0x0400; + break; + case 'M': + *opt = *opt ^ 0x8000; + break; + case 'S': + *opt = *opt ^ 0x2000; + break; + case 'c': + *opt = *opt ^ 0x4000; + break; + case 'f': + *opt = *opt ^ 0x010000; + break; + case 'V': + *opt = *opt ^ 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; + } + i += 1; + } + break; + case 'A': + if (i + 2 >= Strings_Length(s, s__len)) { + OPM_LogWStr((CHAR*)"-M option requires two following digits.", 41); + OPM_LogWLn(); + } else { + OPM_AddressSize = (int16)s[__X(i + 1, s__len)] - 48; + OPM_Alignment = (int16)s[__X(i + 2, s__len)] - 48; + i += 2; + } + break; case 'B': if (s[__X(i + 1, s__len)] != 0x00) { i += 1; @@ -199,18 +250,6 @@ static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) } Files_SetSearchPath((CHAR*)"", 1); break; - case 'F': - *opt = *opt ^ 0x020000; - break; - case 'M': - *opt = *opt ^ 0x8000; - break; - case 'S': - *opt = *opt ^ 0x2000; - break; - case 'V': - *opt = *opt ^ 0x040000; - break; default: OPM_LogWStr((CHAR*)" warning: option ", 19); OPM_LogW('-'); @@ -221,6 +260,7 @@ static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) } i += 1; } + __DEL(s); } BOOLEAN OPM_OpenPar (void) @@ -247,33 +287,62 @@ BOOLEAN OPM_OpenPar (void) OPM_LogWStr((CHAR*)"Where options = [\"-\" {option} ].", 33); OPM_LogWLn(); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" m - generate code for main module", 36); + OPM_LogWStr((CHAR*)" Run time safety", 18); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" M - generate code for main module and link object statically", 63); + OPM_LogWStr((CHAR*)" -p Initialise pointers to NIL.", 37); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" s - generate new symbol file", 31); + OPM_LogWStr((CHAR*)" -a Halt on assertion failures.", 37); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" e - allow extending the module interface", 43); + OPM_LogWStr((CHAR*)" -r Halt on range check failures.", 39); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" r - check value ranges", 25); + OPM_LogWStr((CHAR*)" -t Halt on type guad failure.", 36); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" x - turn off array indices check", 35); + OPM_LogWStr((CHAR*)" -x Halt on index out of range.", 37); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" a - don't check ASSERTs at runtime, use this option in tested production code", 80); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" p - turn off automatic pointer initialization", 48); + OPM_LogWStr((CHAR*)" Symbol file management", 25); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" t - don't check type guards (use in rare cases such as low-level modules where every cycle counts)", 101); + OPM_LogWStr((CHAR*)" -e Allow extension of old symbol file.", 45); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" S - don't call external assembler/compiler, only generate C code", 67); + OPM_LogWStr((CHAR*)" -s Allow generation of new symbol file.", 46); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" c - don't call linker", 24); + OPM_LogWStr((CHAR*)" -F Force generation of new symbol file.", 46); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" f - don't use color output", 29); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" F - force writing new symbol file in current directory", 57); + OPM_LogWStr((CHAR*)" C compiler and linker control", 32); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" V - verbose output", 21); + OPM_LogWStr((CHAR*)" -m This module is main. Link dynamically.", 48); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -M This module is main. Link statically.", 47); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -S Don't call C compiler", 31); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -c Don't link.", 21); + OPM_LogWLn(); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" Miscellaneous", 16); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -f Disable vt100 control characters in status output.", 60); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -V Display compiler debugging messages.", 46); + OPM_LogWLn(); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" Size model for elementary types", 34); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -O2 Original Oberon / Oberon-2: 8 bit SHORTINT, 16 bit INTEGER, 32 bit LONGINT and SET.", 94); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -OC Component Pascal: 16 bit SHORTINT, 32 bit INTEGER, 64 bit LONGINT and SET.", 94); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -OV Alternate large model: 8 bit SHORTINT, 32 bit INTEGER, 64 bit LONGINT and SET.", 94); + OPM_LogWLn(); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" Target machine address size and alignment", 44); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -A44 32 bit addresses, 32 bit alignment (e.g. Unix/linux 32 bit on x86).", 79); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -A48 32 bit addresses, 64 bit alignment (e.g. Windows 32 bit on x86, linux 32 bit on arm).", 97); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -A88 66 bit addresses, 64 bit alignment (e.g. 64 bit platforms).", 71); OPM_LogWLn(); OPM_LogWLn(); OPM_LogWStr((CHAR*)"Initial options specify defaults for all files.", 48); @@ -288,9 +357,9 @@ BOOLEAN OPM_OpenPar (void) OPM_S = 1; s[0] = 0x00; Platform_GetArg(OPM_S, (void*)s, 256); - OPM_glbopt = 0xe9; + OPM_glbopt = 0xa9; while (s[0] == '-') { - OPM_ScanOptions((void*)s, 256, &OPM_glbopt); + OPM_ScanOptions(s, 256, &OPM_glbopt); OPM_S += 1; s[0] = 0x00; Platform_GetArg(OPM_S, (void*)s, 256); @@ -308,20 +377,14 @@ void OPM_InitOptions (void) s[0] = 0x00; Platform_GetArg(OPM_S, (void*)s, 256); while (s[0] == '-') { - OPM_ScanOptions((void*)s, 256, &OPM_opt); + OPM_ScanOptions(s, 256, &OPM_opt); OPM_S += 1; s[0] = 0x00; Platform_GetArg(OPM_S, (void*)s, 256); } - OPM_dontAsm = __IN(13, OPM_opt, 32); - OPM_dontLink = __IN(14, OPM_opt, 32); - OPM_mainProg = __IN(10, OPM_opt, 32); - OPM_mainLinkStat = __IN(15, OPM_opt, 32); - OPM_notColorOutput = __IN(16, OPM_opt, 32); - OPM_forceNewSym = __IN(17, OPM_opt, 32); - OPM_Verbose = __IN(18, OPM_opt, 32); - if (OPM_mainLinkStat) { + if (__IN(15, OPM_opt, 32)) { OPM_glbopt |= __SETOF(10,32); + OPM_opt |= __SETOF(10,32); } OPM_GetProperties(); } @@ -407,20 +470,20 @@ static void OPM_LogErrMsg (int16 n) int16 i; CHAR buf[1024]; if (n >= 0) { - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"31m", 4); } OPM_LogWStr((CHAR*)" err ", 7); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } } else { - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"35m", 4); } OPM_LogWStr((CHAR*)" warning ", 11); n = -n; - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } } @@ -493,11 +556,11 @@ static void OPM_ShowLine (int64 pos) OPM_LogW(' '); i -= 1; } - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"32m", 4); } OPM_LogW('^'); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } Files_Close(f); @@ -682,7 +745,7 @@ static void OPM_GetProperties (void) OPM_MinLReal = -OPM_MaxLReal; OPM_MaxSet = __ASHL(OPM_SetSize, 3) - 1; OPM_MaxIndex = OPM_SignedMaximum(OPM_AddressSize); - if (OPM_Verbose) { + if (__IN(18, OPM_opt, 32)) { OPM_VerboseListSizes(); } } diff --git a/bootstrap/windows-48/OPM.h b/bootstrap/windows-48/OPM.h index 1835a2b8..b32da345 100644 --- a/bootstrap/windows-48/OPM.h +++ b/bootstrap/windows-48/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPM__h #define OPM__h @@ -15,7 +15,6 @@ 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 BOOLEAN OPM_dontAsm, OPM_dontLink, OPM_mainProg, OPM_mainLinkStat, OPM_notColorOutput, OPM_forceNewSym, OPM_Verbose; import void OPM_CloseFiles (void); diff --git a/bootstrap/windows-48/OPP.c b/bootstrap/windows-48/OPP.c index f62551cc..af0d37db 100644 --- a/bootstrap/windows-48/OPP.c +++ b/bootstrap/windows-48/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/OPP.h b/bootstrap/windows-48/OPP.h index 9ae7712a..6dd03161 100644 --- a/bootstrap/windows-48/OPP.h +++ b/bootstrap/windows-48/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/windows-48/OPS.c b/bootstrap/windows-48/OPS.c index f04f47ad..f37bbc27 100644 --- a/bootstrap/windows-48/OPS.c +++ b/bootstrap/windows-48/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/OPS.h b/bootstrap/windows-48/OPS.h index 3ff9b0b3..1b60944c 100644 --- a/bootstrap/windows-48/OPS.h +++ b/bootstrap/windows-48/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/windows-48/OPT.c b/bootstrap/windows-48/OPT.c index acdca9f2..148fbecb 100644 --- a/bootstrap/windows-48/OPT.c +++ b/bootstrap/windows-48/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -1733,10 +1733,7 @@ void OPT_Export (BOOLEAN *ext, BOOLEAN *new) } OPT_OutObj(OPT_topScope->right); *ext = (OPT_sfpresent && OPT_symExtended); - *new = !OPT_sfpresent || OPT_symNew; - if (OPM_forceNewSym) { - *new = 1; - } + *new = (!OPT_sfpresent || OPT_symNew) || __IN(17, OPM_opt, 32); if ((((OPM_noerr && OPT_sfpresent)) && OPT_impCtxt.reffp != OPT_expCtxt.reffp)) { *new = 1; if (!OPT_extsf) { diff --git a/bootstrap/windows-48/OPT.h b/bootstrap/windows-48/OPT.h index 9ee5643f..d999d4ec 100644 --- a/bootstrap/windows-48/OPT.h +++ b/bootstrap/windows-48/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/windows-48/OPV.c b/bootstrap/windows-48/OPV.c index 2146d7c2..edb84f81 100644 --- a/bootstrap/windows-48/OPV.c +++ b/bootstrap/windows-48/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -16,7 +16,6 @@ typedef } OPV_ExitInfo; -static BOOLEAN OPV_assert, OPV_inxchk, OPV_mainprog, OPV_ansi; static int16 OPV_stamp; static int32 OPV_recno; static OPV_ExitInfo OPV_exit; @@ -130,10 +129,6 @@ void OPV_Init (void) OPV_stamp = 0; OPV_recno = 0; OPV_nofExitLabels = 0; - OPV_assert = __IN(7, OPM_opt, 32); - OPV_inxchk = __IN(0, OPM_opt, 32); - OPV_mainprog = __IN(10, OPM_opt, 32); - OPV_ansi = __IN(6, OPM_opt, 32); } static void OPV_GetTProcNum (OPT_Object obj) @@ -532,7 +527,7 @@ static void OPV_TypeOf (OPT_Node n) static void OPV_Index (OPT_Node n, OPT_Node d, int16 prec, int16 dim) { - if (!OPV_inxchk || (n->right->class == 7 && (n->right->conval->intval == 0 || n->left->typ->comp != 3))) { + if (!__IN(0, OPM_opt, 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)) { @@ -728,11 +723,7 @@ static void OPV_design (OPT_Node n, int16 prec) static void OPV_ParIntLiteral (int64 n, int32 size) { - if (OPV_ansi) { - OPM_WriteInt(n); - } else { - OPC_IntLiteral(n, size); - } + OPM_WriteInt(n); } static void OPV_ActualPar (OPT_Node n, OPT_Object fp) @@ -754,26 +745,19 @@ static void OPV_ActualPar (OPT_Node n, OPT_Object fp) } if (!__IN(n->typ->comp, 0x0c, 32)) { if (mode == 2) { - if ((OPV_ansi && typ != n->typ)) { + if (typ != n->typ) { OPM_WriteString((CHAR*)"(void*)", 8); } OPM_Write('&'); prec = 9; - } else if (OPV_ansi) { + } else { if ((__IN(comp, 0x0c, 32) && n->class == 7)) { OPM_WriteString((CHAR*)"(CHAR*)", 8); } else if ((((form == 11 && typ != n->typ)) && n->typ != OPT_niltyp)) { OPM_WriteString((CHAR*)"(void*)", 8); } - } else { - if ((__IN(form, 0x60, 32) && n->typ->form == 4)) { - OPM_WriteString((CHAR*)"(double)", 9); - prec = 9; - } else if (form == 4) { - OPV_SizeCast(n->typ->size, typ->size); - } } - } else if (OPV_ansi) { + } else { if ((((mode == 2 && typ != n->typ)) && prec == -1)) { OPM_WriteString((CHAR*)"(void*)", 8); } @@ -1532,7 +1516,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) case 20: if (n->subcl != 32) { OPV_IfStat(n, 0, outerProc); - } else if (OPV_assert) { + } else if (__IN(7, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__ASSERT(", 10); OPV_expr(n->left->left->left, -1); OPM_WriteString((CHAR*)", ", 3); @@ -1598,7 +1582,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) break; case 26: if (OPM_level == 0) { - if (OPV_mainprog) { + if (__IN(10, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__FINI", 7); } else { OPM_WriteString((CHAR*)"__ENDMOD", 9); @@ -1643,7 +1627,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) void OPV_Module (OPT_Node prog) { - if (!OPV_mainprog) { + if (!__IN(10, OPM_opt, 32)) { OPC_GenHdr(prog->right); OPC_GenHdrIncludes(); } diff --git a/bootstrap/windows-48/OPV.h b/bootstrap/windows-48/OPV.h index f78267d0..a89aa61a 100644 --- a/bootstrap/windows-48/OPV.h +++ b/bootstrap/windows-48/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/windows-48/Platform.c b/bootstrap/windows-48/Platform.c index 89bc758a..12ced558 100644 --- a/bootstrap/windows-48/Platform.c +++ b/bootstrap/windows-48/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/Platform.h b/bootstrap/windows-48/Platform.h index 9a1147dc..75f53fa0 100644 --- a/bootstrap/windows-48/Platform.h +++ b/bootstrap/windows-48/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/windows-48/Reals.c b/bootstrap/windows-48/Reals.c index c032a4a5..dec0e0b4 100644 --- a/bootstrap/windows-48/Reals.c +++ b/bootstrap/windows-48/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/Reals.h b/bootstrap/windows-48/Reals.h index b4469c3a..0b779857 100644 --- a/bootstrap/windows-48/Reals.h +++ b/bootstrap/windows-48/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/windows-48/Strings.c b/bootstrap/windows-48/Strings.c index db9dbf02..69612295 100644 --- a/bootstrap/windows-48/Strings.c +++ b/bootstrap/windows-48/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/Strings.h b/bootstrap/windows-48/Strings.h index 9d2d3b44..b4d5f201 100644 --- a/bootstrap/windows-48/Strings.h +++ b/bootstrap/windows-48/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/windows-48/Texts.c b/bootstrap/windows-48/Texts.c index 5ae009bd..c02becc4 100644 --- a/bootstrap/windows-48/Texts.c +++ b/bootstrap/windows-48/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/Texts.h b/bootstrap/windows-48/Texts.h index 299cfde9..fbb113f7 100644 --- a/bootstrap/windows-48/Texts.h +++ b/bootstrap/windows-48/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/windows-48/Vishap.c b/bootstrap/windows-48/Vishap.c index c3405c16..17b498b8 100644 --- a/bootstrap/windows-48/Vishap.c +++ b/bootstrap/windows-48/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspamSf */ #define INTEGER int16 #define LONGINT int32 @@ -42,22 +42,22 @@ void Vishap_Module (BOOLEAN *done) OPC_Init(); OPV_Module(p); if (OPM_noerr) { - if (((OPM_mainProg || OPM_mainLinkStat) && __STRCMP(OPM_modName, "SYSTEM") != 0)) { + if ((__IN(10, OPM_opt, 32) && __STRCMP(OPM_modName, "SYSTEM") != 0)) { OPM_DeleteNewSym(); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"32m", 4); } OPM_LogWStr((CHAR*)" Main program.", 16); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } } else { if (new) { - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"32m", 4); } OPM_LogWStr((CHAR*)" New symbol file.", 19); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } OPM_RegisterNewSym(); @@ -111,17 +111,17 @@ void Vishap_Translate (void) OPM_LogWLn(); Platform_Exit(1); } - if (!OPM_dontAsm) { - if (OPM_dontLink) { + if (!__IN(13, OPM_opt, 32)) { + if (__IN(14, OPM_opt, 32)) { extTools_Assemble(OPM_modName, 32); } else { - if (!(OPM_mainProg || OPM_mainLinkStat)) { + if (!__IN(10, OPM_opt, 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, OPM_mainLinkStat, modulesobj, 2048); + extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_opt, 32), modulesobj, 2048); } } } diff --git a/bootstrap/windows-48/errors.c b/bootstrap/windows-48/errors.c index 2e61c724..95868540 100644 --- a/bootstrap/windows-48/errors.c +++ b/bootstrap/windows-48/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/errors.h b/bootstrap/windows-48/errors.h index 99f4c6b0..d574008d 100644 --- a/bootstrap/windows-48/errors.h +++ b/bootstrap/windows-48/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/windows-48/extTools.c b/bootstrap/windows-48/extTools.c index 8838dd7b..9047ebcc 100644 --- a/bootstrap/windows-48/extTools.c +++ b/bootstrap/windows-48/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 @@ -25,7 +25,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 (OPM_Verbose) { + if (__IN(18, OPM_opt, 32)) { Console_String(title, title__len); Console_String(cmd, cmd__len); Console_Ln(); diff --git a/bootstrap/windows-48/extTools.h b/bootstrap/windows-48/extTools.h index d4f0c474..847e440e 100644 --- a/bootstrap/windows-48/extTools.h +++ b/bootstrap/windows-48/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/windows-48/vt100.c b/bootstrap/windows-48/vt100.c index 5d050112..a14f3ee0 100644 --- a/bootstrap/windows-48/vt100.c +++ b/bootstrap/windows-48/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int16 #define LONGINT int32 diff --git a/bootstrap/windows-48/vt100.h b/bootstrap/windows-48/vt100.h index 11aabb2a..1402af8c 100644 --- a/bootstrap/windows-48/vt100.h +++ b/bootstrap/windows-48/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef vt100__h #define vt100__h diff --git a/bootstrap/windows-88/Configuration.c b/bootstrap/windows-88/Configuration.c index 9db9e691..122d2b82 100644 --- a/bootstrap/windows-88/Configuration.c +++ b/bootstrap/windows-88/Configuration.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/Configuration.h b/bootstrap/windows-88/Configuration.h index 831281d6..7fdf5f78 100644 --- a/bootstrap/windows-88/Configuration.h +++ b/bootstrap/windows-88/Configuration.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/windows-88/Console.c b/bootstrap/windows-88/Console.c index b0a79723..6a1cec2c 100644 --- a/bootstrap/windows-88/Console.c +++ b/bootstrap/windows-88/Console.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/Console.h b/bootstrap/windows-88/Console.h index be8ab870..255cb17c 100644 --- a/bootstrap/windows-88/Console.h +++ b/bootstrap/windows-88/Console.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Console__h #define Console__h diff --git a/bootstrap/windows-88/Files.c b/bootstrap/windows-88/Files.c index de0e2164..546f8b08 100644 --- a/bootstrap/windows-88/Files.c +++ b/bootstrap/windows-88/Files.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/Files.h b/bootstrap/windows-88/Files.h index f0ec05c1..0aae236a 100644 --- a/bootstrap/windows-88/Files.h +++ b/bootstrap/windows-88/Files.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspaSfF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/windows-88/Heap.c b/bootstrap/windows-88/Heap.c index 68a02b24..85664851 100644 --- a/bootstrap/windows-88/Heap.c +++ b/bootstrap/windows-88/Heap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tsSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/Heap.h b/bootstrap/windows-88/Heap.h index 04b1a4f9..b11a81ee 100644 --- a/bootstrap/windows-88/Heap.h +++ b/bootstrap/windows-88/Heap.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tskSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tsSfF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/windows-88/Modules.c b/bootstrap/windows-88/Modules.c index 0e60d59f..24319ad6 100644 --- a/bootstrap/windows-88/Modules.c +++ b/bootstrap/windows-88/Modules.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/Modules.h b/bootstrap/windows-88/Modules.h index 5fec9a72..4c14134c 100644 --- a/bootstrap/windows-88/Modules.h +++ b/bootstrap/windows-88/Modules.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/windows-88/OPB.c b/bootstrap/windows-88/OPB.c index fedc1751..fab97f6a 100644 --- a/bootstrap/windows-88/OPB.c +++ b/bootstrap/windows-88/OPB.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 @@ -1542,7 +1542,7 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) OPT_Struct y = NIL; int32 f, g; OPT_Struct p = NIL, q = NIL; - if (OPM_Verbose) { + if (__IN(18, OPM_opt, 64)) { OPM_LogWLn(); OPM_LogWStr((CHAR*)"PROCEDURE CheckAssign", 22); OPM_LogWLn(); @@ -1550,7 +1550,7 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) y = ynode->typ; f = x->form; g = y->form; - if (OPM_Verbose) { + if (__IN(18, OPM_opt, 64)) { OPM_LogWStr((CHAR*)"y.form = ", 10); OPM_LogWNum(y->form, 0); OPM_LogWLn(); diff --git a/bootstrap/windows-88/OPB.h b/bootstrap/windows-88/OPB.h index 72ea3c62..deb651aa 100644 --- a/bootstrap/windows-88/OPB.h +++ b/bootstrap/windows-88/OPB.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/windows-88/OPC.c b/bootstrap/windows-88/OPC.c index 2c8127e1..dd9e2a18 100644 --- a/bootstrap/windows-88/OPC.c +++ b/bootstrap/windows-88/OPC.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 @@ -11,7 +11,6 @@ static int32 OPC_indentLevel; -static BOOLEAN OPC_ptrinit, OPC_mainprog, OPC_ansi; static int8 OPC_hashtab[105]; static CHAR OPC_keytab[50][9]; static BOOLEAN OPC_GlbPtrs; @@ -93,14 +92,7 @@ static BOOLEAN OPC_Undefined (OPT_Object obj); void OPC_Init (void) { OPC_indentLevel = 0; - OPC_ptrinit = __IN(5, OPM_opt, 64); - OPC_mainprog = OPM_mainProg || OPM_mainLinkStat; - OPC_ansi = __IN(6, OPM_opt, 64); - if (OPC_ansi) { - __MOVE("__init(void)", OPC_BodyNameExt, 13); - } else { - __MOVE("__init()", OPC_BodyNameExt, 9); - } + __MOVE("__init(void)", OPC_BodyNameExt, 13); } void OPC_Indent (int32 count) @@ -299,12 +291,8 @@ static void OPC_DeclareObj (OPT_Object dcl, BOOLEAN scopeDef) openClause = 0; } if (form == 12) { - if (OPC_ansi) { - OPM_Write(')'); - OPC_AnsiParamList(typ->link, 0); - } else { - OPM_WriteString((CHAR*)")()", 4); - } + OPM_Write(')'); + OPC_AnsiParamList(typ->link, 0); break; } else if (comp == 2) { OPM_Write('['); @@ -579,12 +567,10 @@ static void OPC_DefineTProcTypes (OPT_Object obj) if (obj->typ != OPT_notyp) { OPC_DefineType(obj->typ); } - if (OPC_ansi) { - par = obj->link; - while (par != NIL) { - OPC_DefineType(par->typ); - par = par->link; - } + par = obj->link; + while (par != NIL) { + OPC_DefineType(par->typ); + par = par->link; } } @@ -662,11 +648,7 @@ static void OPC_DefineTProcMacros (OPT_Object obj, BOOLEAN *empty) OPC_Ident(obj->typ->strobj); } OPM_WriteString((CHAR*)"(*)", 4); - if (OPC_ansi) { - OPC_AnsiParamList(obj->link, 0); - } else { - OPM_WriteString((CHAR*)"()", 3); - } + OPC_AnsiParamList(obj->link, 0); OPM_WriteString((CHAR*)", ", 3); OPC_DeclareParams(obj->link, 1); OPM_Write(')'); @@ -1063,7 +1045,7 @@ static void OPC_IdentList (OPT_Object obj, int32 vis) OPC_Ident(obj); OPM_WriteString((CHAR*)"__typ", 6); base = NIL; - } else if ((((((OPC_ptrinit && vis == 0)) && obj->mnolev > 0)) && obj->typ->form == 11)) { + } else if ((((((__IN(5, OPM_opt, 64) && vis == 0)) && obj->mnolev > 0)) && obj->typ->form == 11)) { OPM_WriteString((CHAR*)" = NIL", 7); } } @@ -1122,22 +1104,11 @@ static void OPC_ProcHeader (OPT_Object proc, BOOLEAN define) OPM_Write(' '); OPC_Ident(proc); OPM_Write(' '); - if (OPC_ansi) { - OPC_AnsiParamList(proc->link, 1); - if (!define) { - OPM_Write(';'); - } - OPM_WriteLn(); - } else if (define) { - OPC_DeclareParams(proc->link, 0); - OPM_WriteLn(); - OPC_Indent(1); - OPC_IdentList(proc->link, 2); - OPC_Indent(-1); - } else { - OPM_WriteString((CHAR*)"();", 4); - OPM_WriteLn(); + OPC_AnsiParamList(proc->link, 1); + if (!define) { + OPM_Write(';'); } + OPM_WriteLn(); } static void OPC_ProcPredefs (OPT_Object obj, int8 vis) @@ -1255,9 +1226,6 @@ static void OPC_GenHeaderMsg (void) case 5: OPM_Write('p'); break; - case 6: - OPM_Write('k'); - break; case 7: OPM_Write('a'); break; @@ -1391,15 +1359,7 @@ void OPC_GenEnumPtrs (OPT_Object var) if (OPC_NofPtrs(typ) > 0) { if (!OPC_GlbPtrs) { OPC_GlbPtrs = 1; - OPM_WriteString((CHAR*)"static ", 8); - if (OPC_ansi) { - OPM_WriteString((CHAR*)"void EnumPtrs(void (*P)(void*))", 32); - } else { - OPM_WriteString((CHAR*)"void EnumPtrs(P)", 17); - OPM_WriteLn(); - OPM_Write(0x09); - OPM_WriteString((CHAR*)"void (*P)();", 13); - } + OPM_WriteString((CHAR*)"static void EnumPtrs(void (*P)(void*))", 39); OPM_WriteLn(); OPC_BegBlk(); } @@ -1451,17 +1411,9 @@ void OPC_EnterBody (void) { OPM_WriteLn(); OPM_WriteString((CHAR*)"export ", 8); - if (OPC_mainprog) { - if (OPC_ansi) { - OPM_WriteString((CHAR*)"int main(int argc, char **argv)", 32); - OPM_WriteLn(); - } else { - OPM_WriteString((CHAR*)"main(argc, argv)", 17); - OPM_WriteLn(); - OPM_Write(0x09); - OPM_WriteString((CHAR*)"int argc; char **argv;", 23); - OPM_WriteLn(); - } + if (__IN(10, OPM_opt, 64)) { + OPM_WriteString((CHAR*)"int main(int argc, char **argv)", 32); + OPM_WriteLn(); } else { OPM_WriteString((CHAR*)"void *", 7); OPM_WriteString(OPM_modName, 32); @@ -1470,20 +1422,20 @@ void OPC_EnterBody (void) } OPC_BegBlk(); OPC_BegStat(); - if (OPC_mainprog) { + if (__IN(10, OPM_opt, 64)) { OPM_WriteString((CHAR*)"__INIT(argc, argv)", 19); } else { OPM_WriteString((CHAR*)"__DEFMOD", 9); } OPC_EndStat(); - if ((OPC_mainprog && 0)) { + if ((__IN(10, OPM_opt, 64) && 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 (OPC_mainprog) { + if (__IN(10, OPM_opt, 64)) { OPM_WriteString((CHAR*)"__REGMAIN(\"", 12); } else { OPM_WriteString((CHAR*)"__REGMOD(\"", 11); @@ -1503,7 +1455,7 @@ void OPC_EnterBody (void) void OPC_ExitBody (void) { OPC_BegStat(); - if (OPC_mainprog) { + if (__IN(10, OPM_opt, 64)) { OPM_WriteString((CHAR*)"__FINI;", 8); } else { OPM_WriteString((CHAR*)"__ENDMOD;", 10); @@ -1583,21 +1535,6 @@ void OPC_EnterProc (OPT_Object proc) } var = var->link; } - if (!OPC_ansi) { - var = proc->link; - while (var != NIL) { - if ((var->typ->form == 5 && var->mode == 1)) { - OPC_BegStat(); - OPC_Ident(var->typ->strobj); - OPM_Write(' '); - OPC_Ident(var); - OPM_WriteString((CHAR*)" = _", 5); - OPC_Ident(var); - OPC_EndStat(); - } - var = var->link; - } - } var = proc->link; while (var != NIL) { if ((((__IN(var->typ->comp, 0x0c, 64) && var->mode == 1)) && var->typ->sysflag == 0)) { @@ -1963,11 +1900,7 @@ void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim) array = array->BaseTyp; dim -= 1; } - if (OPC_ansi) { - OPM_WriteInt(array->n); - } else { - OPC_IntLiteral(array->n, OPM_AddressSize); - } + OPM_WriteInt(array->n); } } diff --git a/bootstrap/windows-88/OPC.h b/bootstrap/windows-88/OPC.h index 30f3fd48..ae8e7035 100644 --- a/bootstrap/windows-88/OPC.h +++ b/bootstrap/windows-88/OPC.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/windows-88/OPM.c b/bootstrap/windows-88/OPM.c index 391613fb..1b8dca0d 100644 --- a/bootstrap/windows-88/OPM.c +++ b/bootstrap/windows-88/OPM.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 @@ -36,7 +36,6 @@ 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 int32 OPM_S; -export BOOLEAN OPM_dontAsm, OPM_dontLink, OPM_mainProg, OPM_mainLinkStat, OPM_notColorOutput, OPM_forceNewSym, OPM_Verbose; static CHAR OPM_OBERON[1024]; static CHAR OPM_MODULES[1024]; @@ -137,42 +136,94 @@ int32 OPM_Integer (int64 n) static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) { int32 i; + __DUP(s, s__len, CHAR); i = 1; while (s[__X(i, s__len)] != 0x00) { switch (s[__X(i, s__len)]) { - case 'a': - *opt = *opt ^ 0x80; - break; - case 'c': - *opt = *opt ^ 0x4000; - break; - case 'e': - *opt = *opt ^ 0x0200; - break; - case 'f': - *opt = *opt ^ 0x010000; - break; - case 'k': - *opt = *opt ^ 0x40; - break; - case 'm': - *opt = *opt ^ 0x0400; - break; case 'p': *opt = *opt ^ 0x20; break; + case 'a': + *opt = *opt ^ 0x80; + break; case 'r': *opt = *opt ^ 0x04; break; - case 's': - *opt = *opt ^ 0x10; - break; case 't': *opt = *opt ^ 0x08; break; case 'x': *opt = *opt ^ 0x01; break; + case 'e': + *opt = *opt ^ 0x0200; + break; + case 's': + *opt = *opt ^ 0x10; + break; + case 'F': + *opt = *opt ^ 0x020000; + break; + case 'm': + *opt = *opt ^ 0x0400; + break; + case 'M': + *opt = *opt ^ 0x8000; + break; + case 'S': + *opt = *opt ^ 0x2000; + break; + case 'c': + *opt = *opt ^ 0x4000; + break; + case 'f': + *opt = *opt ^ 0x010000; + break; + case 'V': + *opt = *opt ^ 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; + } + i += 1; + } + break; + case 'A': + if (i + 2 >= Strings_Length(s, s__len)) { + OPM_LogWStr((CHAR*)"-M option requires two following digits.", 41); + OPM_LogWLn(); + } else { + OPM_AddressSize = s[__X(i + 1, s__len)] - 48; + OPM_Alignment = s[__X(i + 2, s__len)] - 48; + i += 2; + } + break; case 'B': if (s[__X(i + 1, s__len)] != 0x00) { i += 1; @@ -198,18 +249,6 @@ static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) } Files_SetSearchPath((CHAR*)"", 1); break; - case 'F': - *opt = *opt ^ 0x020000; - break; - case 'M': - *opt = *opt ^ 0x8000; - break; - case 'S': - *opt = *opt ^ 0x2000; - break; - case 'V': - *opt = *opt ^ 0x040000; - break; default: OPM_LogWStr((CHAR*)" warning: option ", 19); OPM_LogW('-'); @@ -220,6 +259,7 @@ static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) } i += 1; } + __DEL(s); } BOOLEAN OPM_OpenPar (void) @@ -246,33 +286,62 @@ BOOLEAN OPM_OpenPar (void) OPM_LogWStr((CHAR*)"Where options = [\"-\" {option} ].", 33); OPM_LogWLn(); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" m - generate code for main module", 36); + OPM_LogWStr((CHAR*)" Run time safety", 18); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" M - generate code for main module and link object statically", 63); + OPM_LogWStr((CHAR*)" -p Initialise pointers to NIL.", 37); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" s - generate new symbol file", 31); + OPM_LogWStr((CHAR*)" -a Halt on assertion failures.", 37); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" e - allow extending the module interface", 43); + OPM_LogWStr((CHAR*)" -r Halt on range check failures.", 39); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" r - check value ranges", 25); + OPM_LogWStr((CHAR*)" -t Halt on type guad failure.", 36); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" x - turn off array indices check", 35); + OPM_LogWStr((CHAR*)" -x Halt on index out of range.", 37); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" a - don't check ASSERTs at runtime, use this option in tested production code", 80); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" p - turn off automatic pointer initialization", 48); + OPM_LogWStr((CHAR*)" Symbol file management", 25); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" t - don't check type guards (use in rare cases such as low-level modules where every cycle counts)", 101); + OPM_LogWStr((CHAR*)" -e Allow extension of old symbol file.", 45); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" S - don't call external assembler/compiler, only generate C code", 67); + OPM_LogWStr((CHAR*)" -s Allow generation of new symbol file.", 46); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" c - don't call linker", 24); + OPM_LogWStr((CHAR*)" -F Force generation of new symbol file.", 46); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" f - don't use color output", 29); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" F - force writing new symbol file in current directory", 57); + OPM_LogWStr((CHAR*)" C compiler and linker control", 32); OPM_LogWLn(); - OPM_LogWStr((CHAR*)" V - verbose output", 21); + OPM_LogWStr((CHAR*)" -m This module is main. Link dynamically.", 48); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -M This module is main. Link statically.", 47); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -S Don't call C compiler", 31); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -c Don't link.", 21); + OPM_LogWLn(); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" Miscellaneous", 16); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -f Disable vt100 control characters in status output.", 60); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -V Display compiler debugging messages.", 46); + OPM_LogWLn(); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" Size model for elementary types", 34); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -O2 Original Oberon / Oberon-2: 8 bit SHORTINT, 16 bit INTEGER, 32 bit LONGINT and SET.", 94); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -OC Component Pascal: 16 bit SHORTINT, 32 bit INTEGER, 64 bit LONGINT and SET.", 94); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -OV Alternate large model: 8 bit SHORTINT, 32 bit INTEGER, 64 bit LONGINT and SET.", 94); + OPM_LogWLn(); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" Target machine address size and alignment", 44); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -A44 32 bit addresses, 32 bit alignment (e.g. Unix/linux 32 bit on x86).", 79); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -A48 32 bit addresses, 64 bit alignment (e.g. Windows 32 bit on x86, linux 32 bit on arm).", 97); + OPM_LogWLn(); + OPM_LogWStr((CHAR*)" -A88 66 bit addresses, 64 bit alignment (e.g. 64 bit platforms).", 71); OPM_LogWLn(); OPM_LogWLn(); OPM_LogWStr((CHAR*)"Initial options specify defaults for all files.", 48); @@ -287,9 +356,9 @@ BOOLEAN OPM_OpenPar (void) OPM_S = 1; s[0] = 0x00; Platform_GetArg(OPM_S, (void*)s, 256); - OPM_glbopt = 0xe9; + OPM_glbopt = 0xa9; while (s[0] == '-') { - OPM_ScanOptions((void*)s, 256, &OPM_glbopt); + OPM_ScanOptions(s, 256, &OPM_glbopt); OPM_S += 1; s[0] = 0x00; Platform_GetArg(OPM_S, (void*)s, 256); @@ -307,20 +376,14 @@ void OPM_InitOptions (void) s[0] = 0x00; Platform_GetArg(OPM_S, (void*)s, 256); while (s[0] == '-') { - OPM_ScanOptions((void*)s, 256, &OPM_opt); + OPM_ScanOptions(s, 256, &OPM_opt); OPM_S += 1; s[0] = 0x00; Platform_GetArg(OPM_S, (void*)s, 256); } - OPM_dontAsm = __IN(13, OPM_opt, 64); - OPM_dontLink = __IN(14, OPM_opt, 64); - OPM_mainProg = __IN(10, OPM_opt, 64); - OPM_mainLinkStat = __IN(15, OPM_opt, 64); - OPM_notColorOutput = __IN(16, OPM_opt, 64); - OPM_forceNewSym = __IN(17, OPM_opt, 64); - OPM_Verbose = __IN(18, OPM_opt, 64); - if (OPM_mainLinkStat) { + if (__IN(15, OPM_opt, 64)) { OPM_glbopt |= __SETOF(10,64); + OPM_opt |= __SETOF(10,64); } OPM_GetProperties(); } @@ -406,20 +469,20 @@ static void OPM_LogErrMsg (int32 n) int32 i; CHAR buf[1024]; if (n >= 0) { - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 64)) { vt100_SetAttr((CHAR*)"31m", 4); } OPM_LogWStr((CHAR*)" err ", 7); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 64)) { vt100_SetAttr((CHAR*)"0m", 3); } } else { - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 64)) { vt100_SetAttr((CHAR*)"35m", 4); } OPM_LogWStr((CHAR*)" warning ", 11); n = -n; - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 64)) { vt100_SetAttr((CHAR*)"0m", 3); } } @@ -492,11 +555,11 @@ static void OPM_ShowLine (int64 pos) OPM_LogW(' '); i -= 1; } - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 64)) { vt100_SetAttr((CHAR*)"32m", 4); } OPM_LogW('^'); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 64)) { vt100_SetAttr((CHAR*)"0m", 3); } Files_Close(f); @@ -679,7 +742,7 @@ static void OPM_GetProperties (void) OPM_MinLReal = -OPM_MaxLReal; OPM_MaxSet = __ASHL(OPM_SetSize, 3) - 1; OPM_MaxIndex = OPM_SignedMaximum(OPM_AddressSize); - if (OPM_Verbose) { + if (__IN(18, OPM_opt, 64)) { OPM_VerboseListSizes(); } } diff --git a/bootstrap/windows-88/OPM.h b/bootstrap/windows-88/OPM.h index 4a9253cf..e2737249 100644 --- a/bootstrap/windows-88/OPM.h +++ b/bootstrap/windows-88/OPM.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPM__h #define OPM__h @@ -15,7 +15,6 @@ import int32 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 BOOLEAN OPM_dontAsm, OPM_dontLink, OPM_mainProg, OPM_mainLinkStat, OPM_notColorOutput, OPM_forceNewSym, OPM_Verbose; import void OPM_CloseFiles (void); diff --git a/bootstrap/windows-88/OPP.c b/bootstrap/windows-88/OPP.c index ff86118c..e9fcba89 100644 --- a/bootstrap/windows-88/OPP.c +++ b/bootstrap/windows-88/OPP.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/OPP.h b/bootstrap/windows-88/OPP.h index 9ae7712a..6dd03161 100644 --- a/bootstrap/windows-88/OPP.h +++ b/bootstrap/windows-88/OPP.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/windows-88/OPS.c b/bootstrap/windows-88/OPS.c index c811b3cc..d79e207f 100644 --- a/bootstrap/windows-88/OPS.c +++ b/bootstrap/windows-88/OPS.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/OPS.h b/bootstrap/windows-88/OPS.h index 1c9ae6a4..40853589 100644 --- a/bootstrap/windows-88/OPS.h +++ b/bootstrap/windows-88/OPS.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin tspaSfF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/windows-88/OPT.c b/bootstrap/windows-88/OPT.c index 5fbe3b87..63b773cd 100644 --- a/bootstrap/windows-88/OPT.c +++ b/bootstrap/windows-88/OPT.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 @@ -1732,10 +1732,7 @@ void OPT_Export (BOOLEAN *ext, BOOLEAN *new) } OPT_OutObj(OPT_topScope->right); *ext = (OPT_sfpresent && OPT_symExtended); - *new = !OPT_sfpresent || OPT_symNew; - if (OPM_forceNewSym) { - *new = 1; - } + *new = (!OPT_sfpresent || OPT_symNew) || __IN(17, OPM_opt, 64); if ((((OPM_noerr && OPT_sfpresent)) && OPT_impCtxt.reffp != OPT_expCtxt.reffp)) { *new = 1; if (!OPT_extsf) { diff --git a/bootstrap/windows-88/OPT.h b/bootstrap/windows-88/OPT.h index 66686a2c..0cc86a01 100644 --- a/bootstrap/windows-88/OPT.h +++ b/bootstrap/windows-88/OPT.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/windows-88/OPV.c b/bootstrap/windows-88/OPV.c index 965f7b61..8026831f 100644 --- a/bootstrap/windows-88/OPV.c +++ b/bootstrap/windows-88/OPV.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 @@ -16,7 +16,6 @@ typedef } OPV_ExitInfo; -static BOOLEAN OPV_assert, OPV_inxchk, OPV_mainprog, OPV_ansi; static int32 OPV_stamp; static int64 OPV_recno; static OPV_ExitInfo OPV_exit; @@ -130,10 +129,6 @@ void OPV_Init (void) OPV_stamp = 0; OPV_recno = 0; OPV_nofExitLabels = 0; - OPV_assert = __IN(7, OPM_opt, 64); - OPV_inxchk = __IN(0, OPM_opt, 64); - OPV_mainprog = __IN(10, OPM_opt, 64); - OPV_ansi = __IN(6, OPM_opt, 64); } static void OPV_GetTProcNum (OPT_Object obj) @@ -532,7 +527,7 @@ static void OPV_TypeOf (OPT_Node n) static void OPV_Index (OPT_Node n, OPT_Node d, int32 prec, int32 dim) { - if (!OPV_inxchk || (n->right->class == 7 && (n->right->conval->intval == 0 || n->left->typ->comp != 3))) { + if (!__IN(0, OPM_opt, 64) || (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)) { @@ -728,11 +723,7 @@ static void OPV_design (OPT_Node n, int32 prec) static void OPV_ParIntLiteral (int64 n, int64 size) { - if (OPV_ansi) { - OPM_WriteInt(n); - } else { - OPC_IntLiteral(n, size); - } + OPM_WriteInt(n); } static void OPV_ActualPar (OPT_Node n, OPT_Object fp) @@ -754,26 +745,19 @@ static void OPV_ActualPar (OPT_Node n, OPT_Object fp) } if (!__IN(n->typ->comp, 0x0c, 64)) { if (mode == 2) { - if ((OPV_ansi && typ != n->typ)) { + if (typ != n->typ) { OPM_WriteString((CHAR*)"(void*)", 8); } OPM_Write('&'); prec = 9; - } else if (OPV_ansi) { + } else { if ((__IN(comp, 0x0c, 64) && n->class == 7)) { OPM_WriteString((CHAR*)"(CHAR*)", 8); } else if ((((form == 11 && typ != n->typ)) && n->typ != OPT_niltyp)) { OPM_WriteString((CHAR*)"(void*)", 8); } - } else { - if ((__IN(form, 0x60, 64) && n->typ->form == 4)) { - OPM_WriteString((CHAR*)"(double)", 9); - prec = 9; - } else if (form == 4) { - OPV_SizeCast(n->typ->size, typ->size); - } } - } else if (OPV_ansi) { + } else { if ((((mode == 2 && typ != n->typ)) && prec == -1)) { OPM_WriteString((CHAR*)"(void*)", 8); } @@ -1532,7 +1516,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) case 20: if (n->subcl != 32) { OPV_IfStat(n, 0, outerProc); - } else if (OPV_assert) { + } else if (__IN(7, OPM_opt, 64)) { OPM_WriteString((CHAR*)"__ASSERT(", 10); OPV_expr(n->left->left->left, -1); OPM_WriteString((CHAR*)", ", 3); @@ -1598,7 +1582,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) break; case 26: if (OPM_level == 0) { - if (OPV_mainprog) { + if (__IN(10, OPM_opt, 64)) { OPM_WriteString((CHAR*)"__FINI", 7); } else { OPM_WriteString((CHAR*)"__ENDMOD", 9); @@ -1643,7 +1627,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) void OPV_Module (OPT_Node prog) { - if (!OPV_mainprog) { + if (!__IN(10, OPM_opt, 64)) { OPC_GenHdr(prog->right); OPC_GenHdrIncludes(); } diff --git a/bootstrap/windows-88/OPV.h b/bootstrap/windows-88/OPV.h index f78267d0..a89aa61a 100644 --- a/bootstrap/windows-88/OPV.h +++ b/bootstrap/windows-88/OPV.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/windows-88/Platform.c b/bootstrap/windows-88/Platform.c index 0093f826..0a24d4e9 100644 --- a/bootstrap/windows-88/Platform.c +++ b/bootstrap/windows-88/Platform.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/Platform.h b/bootstrap/windows-88/Platform.h index 7faaa2a6..0c4c2127 100644 --- a/bootstrap/windows-88/Platform.h +++ b/bootstrap/windows-88/Platform.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/windows-88/Reals.c b/bootstrap/windows-88/Reals.c index e9e84723..f2623b03 100644 --- a/bootstrap/windows-88/Reals.c +++ b/bootstrap/windows-88/Reals.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/Reals.h b/bootstrap/windows-88/Reals.h index 116d9c93..05b31bee 100644 --- a/bootstrap/windows-88/Reals.h +++ b/bootstrap/windows-88/Reals.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/windows-88/Strings.c b/bootstrap/windows-88/Strings.c index 8dc35935..4226bdb9 100644 --- a/bootstrap/windows-88/Strings.c +++ b/bootstrap/windows-88/Strings.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/Strings.h b/bootstrap/windows-88/Strings.h index 0487b70c..b13ba079 100644 --- a/bootstrap/windows-88/Strings.h +++ b/bootstrap/windows-88/Strings.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/windows-88/Texts.c b/bootstrap/windows-88/Texts.c index 54254c51..4cdaa6b9 100644 --- a/bootstrap/windows-88/Texts.c +++ b/bootstrap/windows-88/Texts.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/Texts.h b/bootstrap/windows-88/Texts.h index 40d02918..10d0a9bb 100644 --- a/bootstrap/windows-88/Texts.h +++ b/bootstrap/windows-88/Texts.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/windows-88/Vishap.c b/bootstrap/windows-88/Vishap.c index 7cd188f2..e1d112ec 100644 --- a/bootstrap/windows-88/Vishap.c +++ b/bootstrap/windows-88/Vishap.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkamSf */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspamSf */ #define INTEGER int32 #define LONGINT int64 @@ -42,22 +42,22 @@ void Vishap_Module (BOOLEAN *done) OPC_Init(); OPV_Module(p); if (OPM_noerr) { - if (((OPM_mainProg || OPM_mainLinkStat) && __STRCMP(OPM_modName, "SYSTEM") != 0)) { + if ((__IN(10, OPM_opt, 64) && __STRCMP(OPM_modName, "SYSTEM") != 0)) { OPM_DeleteNewSym(); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 64)) { vt100_SetAttr((CHAR*)"32m", 4); } OPM_LogWStr((CHAR*)" Main program.", 16); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 64)) { vt100_SetAttr((CHAR*)"0m", 3); } } else { if (new) { - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 64)) { vt100_SetAttr((CHAR*)"32m", 4); } OPM_LogWStr((CHAR*)" New symbol file.", 19); - if (!OPM_notColorOutput) { + if (!__IN(16, OPM_opt, 64)) { vt100_SetAttr((CHAR*)"0m", 3); } OPM_RegisterNewSym(); @@ -111,17 +111,17 @@ void Vishap_Translate (void) OPM_LogWLn(); Platform_Exit(1); } - if (!OPM_dontAsm) { - if (OPM_dontLink) { + if (!__IN(13, OPM_opt, 64)) { + if (__IN(14, OPM_opt, 64)) { extTools_Assemble(OPM_modName, 32); } else { - if (!(OPM_mainProg || OPM_mainLinkStat)) { + if (!__IN(10, OPM_opt, 64)) { 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, OPM_mainLinkStat, modulesobj, 2048); + extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_opt, 64), modulesobj, 2048); } } } diff --git a/bootstrap/windows-88/errors.c b/bootstrap/windows-88/errors.c index 04b9504d..ca898552 100644 --- a/bootstrap/windows-88/errors.c +++ b/bootstrap/windows-88/errors.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/errors.h b/bootstrap/windows-88/errors.h index 99f4c6b0..d574008d 100644 --- a/bootstrap/windows-88/errors.h +++ b/bootstrap/windows-88/errors.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef errors__h #define errors__h diff --git a/bootstrap/windows-88/extTools.c b/bootstrap/windows-88/extTools.c index 2eef1f18..db3aec30 100644 --- a/bootstrap/windows-88/extTools.c +++ b/bootstrap/windows-88/extTools.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 @@ -25,7 +25,7 @@ static void extTools_execute (CHAR *title, LONGINT title__len, CHAR *cmd, LONGIN int32 r, status, exitcode; __DUP(title, title__len, CHAR); __DUP(cmd, cmd__len, CHAR); - if (OPM_Verbose) { + if (__IN(18, OPM_opt, 64)) { Console_String(title, title__len); Console_String(cmd, cmd__len); Console_Ln(); diff --git a/bootstrap/windows-88/extTools.h b/bootstrap/windows-88/extTools.h index d4f0c474..847e440e 100644 --- a/bootstrap/windows-88/extTools.h +++ b/bootstrap/windows-88/extTools.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/windows-88/vt100.c b/bootstrap/windows-88/vt100.c index 3b56b4b1..ac832261 100644 --- a/bootstrap/windows-88/vt100.c +++ b/bootstrap/windows-88/vt100.c @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #define INTEGER int32 #define LONGINT int64 diff --git a/bootstrap/windows-88/vt100.h b/bootstrap/windows-88/vt100.h index b574976e..054f6ddd 100644 --- a/bootstrap/windows-88/vt100.h +++ b/bootstrap/windows-88/vt100.h @@ -1,4 +1,4 @@ -/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspkaSfF */ +/* voc 1.95 [2016/09/21] for gcc LP64 on cygwin xtspaSfF */ #ifndef vt100__h #define vt100__h diff --git a/src/compiler/OPB.Mod b/src/compiler/OPB.Mod index 6fc81fe1..32520266 100644 --- a/src/compiler/OPB.Mod +++ b/src/compiler/OPB.Mod @@ -830,11 +830,11 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *) g: INTEGER; (* expression (source) form *) p, q: OPT.Struct; BEGIN - IF OPM.Verbose THEN + IF OPM.verbose IN OPM.opt THEN OPM.LogWLn; OPM.LogWStr("PROCEDURE CheckAssign"); OPM.LogWLn; END; y := ynode^.typ; f := x^.form; g := y^.form; - IF OPM.Verbose THEN + IF OPM.verbose IN OPM.opt THEN OPM.LogWStr("y.form = "); OPM.LogWNum(y.form, 0); OPM.LogWLn; OPM.LogWStr("f = "); OPM.LogWNum(f, 0); OPM.LogWLn; OPM.LogWStr("g = "); OPM.LogWNum(g, 0); OPM.LogWLn; diff --git a/src/compiler/OPC.Mod b/src/compiler/OPC.Mod index bc84b8ad..29b8c302 100644 --- a/src/compiler/OPC.Mod +++ b/src/compiler/OPC.Mod @@ -38,7 +38,6 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *) VAR indentLevel: INTEGER; - ptrinit, mainprog, ansi: BOOLEAN; hashtab: ARRAY 105 OF SHORTINT; keytab: ARRAY 50, 9 OF CHAR; GlbPtrs: BOOLEAN; @@ -48,11 +47,7 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *) PROCEDURE Init*; BEGIN indentLevel := 0; - ptrinit := OPM.ptrinit IN OPM.opt; - (*mainprog := OPM.mainprog IN OPM.opt;*) - mainprog := OPM.mainProg OR OPM.mainLinkStat; - ansi := OPM.ansi IN OPM.opt; - IF ansi THEN BodyNameExt := "__init(void)" ELSE BodyNameExt := "__init()" END + BodyNameExt := "__init(void)" END Init; PROCEDURE Indent* (count: INTEGER); @@ -189,9 +184,7 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *) ELSIF (form = OPT.ProcTyp) OR (comp IN {OPT.Array, OPT.DynArr}) THEN IF openClause THEN OPM.Write(')'); openClause := FALSE END ; IF form = OPT.ProcTyp THEN - IF ansi THEN OPM.Write(")"); AnsiParamList(typ^.link, FALSE) - ELSE OPM.WriteString(")()") - END ; + OPM.Write(")"); AnsiParamList(typ^.link, FALSE); EXIT ELSIF comp = OPT.Array THEN OPM.Write('['); OPM.WriteInt(typ^.n); OPM.Write(']') @@ -373,9 +366,7 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *) VAR par: OPT.Object; BEGIN IF obj^.typ # OPT.notyp THEN DefineType(obj^.typ) END ; - IF ansi THEN par := obj^.link; - WHILE par # NIL DO DefineType(par^.typ); par := par^.link END - END + par := obj^.link; WHILE par # NIL DO DefineType(par^.typ); par := par^.link END END DefineTProcTypes; PROCEDURE DeclareTProcs(obj: OPT.Object; VAR empty: BOOLEAN); @@ -428,11 +419,7 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *) Str1(", #, ", obj^.adr DIV 10000H); IF obj^.typ = OPT.notyp THEN OPM.WriteString('void') ELSE Ident(obj^.typ^.strobj) END ; OPM.WriteString("(*)"); - IF ansi THEN - AnsiParamList(obj^.link, FALSE); - ELSE - OPM.WriteString("()"); - END ; + AnsiParamList(obj^.link, FALSE); OPM.WriteString(", "); DeclareParams(obj^.link, TRUE); OPM.Write(")"); OPM.WriteLn @@ -713,7 +700,7 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *) EndStat; BegStat; OPM.WriteString("LONGINT *"); Ident(obj); OPM.WriteString(TagExt); base := NIL - ELSIF ptrinit & (vis = 0) & (obj^.mnolev > 0) & (obj^.typ^.form = OPT.Pointer) THEN + ELSIF (OPM.ptrinit IN OPM.opt) & (vis = 0) & (obj^.mnolev > 0) & (obj^.typ^.form = OPT.Pointer) THEN OPM.WriteString(" = NIL") END END ; @@ -754,16 +741,9 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *) BEGIN IF proc^.typ = OPT.notyp THEN OPM.WriteString('void') ELSE Ident(proc^.typ^.strobj) END ; OPM.Write(' '); Ident(proc); OPM.Write(' '); - IF ansi THEN - AnsiParamList(proc^.link, TRUE); - IF ~define THEN OPM.Write(";") END ; - OPM.WriteLn; - ELSIF define THEN - DeclareParams(proc^.link, FALSE); - OPM.WriteLn; - Indent(1); IdentList(proc^.link, 2(* map REAL to double *)); Indent(-1) - ELSE OPM.WriteString("();"); OPM.WriteLn - END + AnsiParamList(proc^.link, TRUE); + IF ~define THEN OPM.Write(";") END ; + OPM.WriteLn END ProcHeader; PROCEDURE ProcPredefs (obj: OPT.Object; vis: SHORTINT); (* forward declaration of procedures *) @@ -846,7 +826,6 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *) | OPM.typchk: OPM.Write("t") | OPM.newsf: OPM.Write("s") | OPM.ptrinit: OPM.Write("p") - | OPM.ansi: OPM.Write("k") | OPM.assert: OPM.Write("a") | OPM.extsf: OPM.Write("e") | OPM.mainprog: OPM.Write("m") @@ -932,14 +911,7 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *) typ := var^.typ; IF NofPtrs(typ) > 0 THEN IF ~GlbPtrs THEN GlbPtrs := TRUE; - OPM.WriteString('static '); - IF ansi THEN - OPM.WriteString("void EnumPtrs(void (*P)(void*))") - ELSE - OPM.WriteString("void EnumPtrs(P)"); OPM.WriteLn; - OPM.Write(Tab); OPM.WriteString("void (*P)();"); - END ; - OPM.WriteLn; + OPM.WriteString("static void EnumPtrs(void (*P)(void*))"); OPM.WriteLn; BegBlk END ; BegStat; @@ -970,27 +942,22 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *) PROCEDURE EnterBody*; BEGIN OPM.WriteLn; OPM.WriteString(Export); - IF mainprog THEN - IF ansi THEN - OPM.WriteString("int main(int argc, char **argv)"); OPM.WriteLn; - ELSE - OPM.WriteString("main(argc, argv)"); OPM.WriteLn; - OPM.Write(Tab); OPM.WriteString("int argc; char **argv;"); OPM.WriteLn - END + IF OPM.mainprog IN OPM.opt THEN + OPM.WriteString("int main(int argc, char **argv)"); OPM.WriteLn; ELSE OPM.WriteString("void *"); OPM.WriteString(OPM.modName); OPM.WriteString(BodyNameExt); OPM.WriteLn; END ; BegBlk; BegStat; - IF mainprog THEN OPM.WriteString("__INIT(argc, argv)") ELSE OPM.WriteString("__DEFMOD") END ; + IF OPM.mainprog IN OPM.opt THEN OPM.WriteString("__INIT(argc, argv)") ELSE OPM.WriteString("__DEFMOD") END ; EndStat; - IF mainprog & demoVersion THEN BegStat; + IF (OPM.mainprog IN OPM.opt) & demoVersion THEN BegStat; OPM.WriteString('/*don`t do it!*/ printf("DEMO VERSION: DO NOT USE THIS PROGRAM FOR ANY COMMERCIAL PURPOSE\n")'); EndStat END ; InitImports(OPT.topScope^.right); BegStat; - IF mainprog THEN OPM.WriteString('__REGMAIN("') ELSE OPM.WriteString('__REGMOD("') END ; + IF OPM.mainprog IN OPM.opt THEN OPM.WriteString('__REGMAIN("') ELSE OPM.WriteString('__REGMOD("') END ; OPM.WriteString(OPM.modName); IF GlbPtrs THEN OPM.WriteString('", EnumPtrs)') ELSE OPM.WriteString('", 0)') END ; EndStat; @@ -1000,7 +967,7 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *) PROCEDURE ExitBody*; BEGIN BegStat; - IF mainprog THEN OPM.WriteString("__FINI;") ELSE OPM.WriteString("__ENDMOD;") END ; + IF OPM.mainprog IN OPM.opt THEN OPM.WriteString("__FINI;") ELSE OPM.WriteString("__ENDMOD;") END ; OPM.WriteLn; EndBlk END ExitBody; @@ -1052,17 +1019,6 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *) END ; var := var^.link END ; - IF ~ansi THEN - var := proc^.link; - WHILE var # NIL DO (* "unpromote" value real parameters *) - IF (var^.typ^.form = OPT.Real) & (var^.mode = OPT.Var) THEN - BegStat; - Ident(var^.typ^.strobj); OPM.Write(' '); Ident(var); OPM.WriteString(" = _"); Ident(var); - EndStat - END ; - var := var^.link - END - END ; var := proc^.link; WHILE var # NIL DO (* copy value array parameters *) IF (var^.typ^.comp IN {OPT.Array, OPT.DynArr}) & (var^.mode = OPT.Var) & (var^.typ^.sysflag = 0) THEN @@ -1303,7 +1259,7 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *) IF dim # 0 THEN OPM.WriteInt(dim) END ELSE (* array *) WHILE dim > 0 DO array := array^.BaseTyp; DEC(dim) END; - IF ansi THEN OPM.WriteInt(array.n) ELSE IntLiteral(array.n, OPM.AddressSize) END + OPM.WriteInt(array.n) END END Len; diff --git a/src/compiler/OPM.cmdln.Mod b/src/compiler/OPM.cmdln.Mod index 952ea9e5..33965ece 100644 --- a/src/compiler/OPM.cmdln.Mod +++ b/src/compiler/OPM.cmdln.Mod @@ -15,7 +15,6 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) typchk* = 3; (* type check on *) newsf* = 4; (* generation of new symbol file allowed *) ptrinit* = 5; (* pointer initialization *) - ansi* = 6; (* ANSI or K&R style prototypes *) assert* = 7; (* assert evaluation *) extsf* = 9; (* extension of old symbol file allowed *) mainprog* = 10; (* translate module body into C main function *) @@ -25,7 +24,7 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) notcoloroutput* = 16; (* turn off color output *) forcenewsym* = 17; (* force new symbol file *) verbose* = 18; (* verbose *) - defopt* = {inxchk, typchk, ptrinit, ansi, assert}; (* default options *) + defopt* = {inxchk, typchk, ptrinit, assert}; (* default options *) nilval* = 0; @@ -122,8 +121,6 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) S: INTEGER; - dontAsm-, dontLink-, mainProg-, mainLinkStat-, notColorOutput-, forceNewSym-, Verbose-: BOOLEAN; - OBERON: ARRAY 1024 OF CHAR; MODULES: ARRAY 1024 OF CHAR; @@ -143,25 +140,53 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) (* ------------------------- parameter handling -------------------------*) - PROCEDURE ScanOptions(VAR s: ARRAY OF CHAR; VAR opt: SET); + PROCEDURE ScanOptions(s: ARRAY OF CHAR; VAR opt: SET); VAR i: INTEGER; BEGIN i := 1; (* skip - *) WHILE s[i] # 0X DO CASE s[i] OF - | "a": opt := opt / {assert} - | "c": opt := opt / {dontlink} - | "e": opt := opt / {extsf} - | "f": opt := opt / {notcoloroutput} - | "k": opt := opt / {ansi} (* undocumented *) - | "m": opt := opt / {mainprog} - | "p": opt := opt / {ptrinit} - | "r": opt := opt / {ranchk} - | "s": opt := opt / {newsf} - | "t": opt := opt / {typchk} - | "x": opt := opt / {inxchk} + (* Run time safety *) + | "p": opt := opt / {ptrinit} (* Initialise pointers to NIL. *) + | "a": opt := opt / {assert} (* Halt on assertion failures. *) + | "r": opt := opt / {ranchk} (* Halt on range check failures. *) + | "t": opt := opt / {typchk} (* Halt on type guad failure. *) + | "x": opt := opt / {inxchk} (* Halt on index out of range. *) + (* Symbol file management *) + | "e": opt := opt / {extsf} (* Allow extension of old symbol file. *) + | "s": opt := opt / {newsf} (* Allow generation of new symbol file. *) + | "F": opt := opt / {forcenewsym} (* Force generation of new symbol file. *) + + (* C compiler and linker control *) + | "m": opt := opt / {mainprog} (* This module is main. Link dynamically. *) + | "M": opt := opt / {mainlinkstat} (* This module is main. Link statically. *) + | "S": opt := opt / {dontasm} (* Don't call C compiler *) + | "c": opt := opt / {dontlink} (* Don't link. *) + + (* Miscellaneous *) + | "f": opt := opt / {notcoloroutput} (* Disable vt100 control characters in status output. *) + | "V": opt := opt / {verbose} + + (* Elementary type size model *) + | "O": IF i+1 >= Strings.Length(s) THEN LogWStr("-O option requires following size model character."); LogWLn ELSE + CASE s[i+1] OF + |'2': ShortintSize := 1; IntegerSize := 2; LongintSize := 4; SetSize := 4 (* Original Oberon / Oberon 2 *) + |'V': ShortintSize := 1; IntegerSize := 4; LongintSize := 8; SetSize := 8 (* Vishap 64 bit *) + |'C': ShortintSize := 2; IntegerSize := 4; LongintSize := 8; SetSize := 8 (* Component Pascal *) + ELSE LogWStr("Unrecognised size model character following -O."); LogWLn + END; + INC(i) + END + + (* Target machine address size and alignment *) + | "A": IF i+2 >= Strings.Length(s) THEN LogWStr("-M option requires two following digits."); LogWLn ELSE + AddressSize := ORD(s[i+1]) - ORD('0'); Alignment := ORD(s[i+2]) - ORD('0'); + INC(i, 2) + END + + (* Temporary build control option - remove when makefile updated to new options. *) | "B": IF s[i+1] # 0X THEN INC(i); IntegerSize := ORD(s[i]) - ORD('0') END; IF s[i+1] # 0X THEN INC(i); AddressSize := ORD(s[i]) - ORD('0') END; IF s[i+1] # 0X THEN INC(i); Alignment := ORD(s[i]) - ORD('0') END; @@ -176,11 +201,6 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) SetSize := 8; END; Files.SetSearchPath("") - - | "F": opt := opt / {forcenewsym} - | "M": opt := opt / {mainlinkstat} - | "S": opt := opt / {dontasm} - | "V": opt := opt / {verbose} ELSE LogWStr(" warning: option "); LogW(OptionChar); @@ -223,20 +243,37 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) LogWStr(' '); LogWStr(Configuration.name); LogWStr(' options {files {options}}.'); LogWLn; LogWLn; LogWStr('Where options = ["-" {option} ].'); LogWLn; LogWLn; - LogWStr(" m - generate code for main module"); LogWLn; - LogWStr(" M - generate code for main module and link object statically"); LogWLn; - LogWStr(" s - generate new symbol file"); LogWLn; - LogWStr(" e - allow extending the module interface"); LogWLn; - LogWStr(" r - check value ranges"); LogWLn; - LogWStr(" x - turn off array indices check"); LogWLn; - LogWStr(" a - don't check ASSERTs at runtime, use this option in tested production code"); LogWLn; - LogWStr(" p - turn off automatic pointer initialization"); LogWLn; - LogWStr(" t - don't check type guards (use in rare cases such as low-level modules where every cycle counts)"); LogWLn; - LogWStr(" S - don't call external assembler/compiler, only generate C code"); LogWLn; - LogWStr(" c - don't call linker"); LogWLn; - LogWStr(" f - don't use color output"); LogWLn; - LogWStr(" F - force writing new symbol file in current directory"); LogWLn; - LogWStr(" V - verbose output"); LogWLn; + LogWStr(" Run time safety"); LogWLn; + LogWStr(" -p Initialise pointers to NIL."); LogWLn; + LogWStr(" -a Halt on assertion failures."); LogWLn; + LogWStr(" -r Halt on range check failures."); LogWLn; + LogWStr(" -t Halt on type guad failure."); LogWLn; + LogWStr(" -x Halt on index out of range."); LogWLn; + LogWLn; + LogWStr(" Symbol file management"); LogWLn; + LogWStr(" -e Allow extension of old symbol file."); LogWLn; + LogWStr(" -s Allow generation of new symbol file."); LogWLn; + LogWStr(" -F Force generation of new symbol file."); LogWLn; + LogWLn; + LogWStr(" C compiler and linker control"); LogWLn; + LogWStr(" -m This module is main. Link dynamically."); LogWLn; + LogWStr(" -M This module is main. Link statically."); LogWLn; + LogWStr(" -S Don't call C compiler"); LogWLn; + LogWStr(" -c Don't link."); LogWLn; + LogWLn; + LogWStr(" Miscellaneous"); LogWLn; + LogWStr(" -f Disable vt100 control characters in status output."); LogWLn; + LogWStr(" -V Display compiler debugging messages."); LogWLn; + LogWLn; + LogWStr(" Size model for elementary types"); LogWLn; + LogWStr(" -O2 Original Oberon / Oberon-2: 8 bit SHORTINT, 16 bit INTEGER, 32 bit LONGINT and SET."); LogWLn; + LogWStr(" -OC Component Pascal: 16 bit SHORTINT, 32 bit INTEGER, 64 bit LONGINT and SET."); LogWLn; + LogWStr(" -OV Alternate large model: 8 bit SHORTINT, 32 bit INTEGER, 64 bit LONGINT and SET."); LogWLn; + LogWLn; + LogWStr(" Target machine address size and alignment"); LogWLn; + LogWStr(" -A44 32 bit addresses, 32 bit alignment (e.g. Unix/linux 32 bit on x86)."); LogWLn; + LogWStr(" -A48 32 bit addresses, 64 bit alignment (e.g. Windows 32 bit on x86, linux 32 bit on arm)."); LogWLn; + LogWStr(" -A88 66 bit addresses, 64 bit alignment (e.g. 64 bit platforms)."); LogWLn; LogWLn; LogWStr('Initial options specify defaults for all files.'); LogWLn; LogWStr('Options following a filename are specific to that file.'); LogWLn; @@ -267,6 +304,7 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) INC(S); s:=""; Platform.GetArg(S, s) END; + (* dontAsm := dontasm IN opt; dontLink := dontlink IN opt; mainProg := mainprog IN opt; @@ -274,8 +312,9 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) notColorOutput := notcoloroutput IN opt; forceNewSym := forcenewsym IN opt; Verbose := verbose IN opt; + *) - IF mainLinkStat THEN INCL(glbopt, mainprog) END; (* sic *) + IF mainlinkstat IN opt THEN INCL(glbopt, mainprog); INCL(opt, mainprog) END; GetProperties; END InitOptions; @@ -346,13 +385,13 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) buf: ARRAY 1024 OF CHAR; BEGIN IF n >= 0 THEN - IF ~notColorOutput THEN vt100.SetAttr(vt100.Red) END; + IF ~(notcoloroutput IN opt) THEN vt100.SetAttr(vt100.Red) END; LogWStr(" err "); - IF ~notColorOutput THEN vt100.SetAttr(vt100.ResetAll) END; + IF ~(notcoloroutput IN opt) THEN vt100.SetAttr(vt100.ResetAll) END; ELSE - IF ~notColorOutput THEN vt100.SetAttr(vt100.Magenta) END; + IF ~(notcoloroutput IN opt) THEN vt100.SetAttr(vt100.Magenta) END; LogWStr(" warning "); n := -n; - IF ~notColorOutput THEN vt100.SetAttr(vt100.ResetAll) END; + IF ~(notcoloroutput IN opt) THEN vt100.SetAttr(vt100.ResetAll) END; END ; LogWNum(n, 1); LogWStr(" "); @@ -425,9 +464,9 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) i := SHORT(Longint(pos - ErrorLineStartPos)); WHILE i > 0 DO LogW(" "); DEC(i) END; - IF ~notColorOutput THEN vt100.SetAttr(vt100.Green) END; + IF ~(notcoloroutput IN opt) THEN vt100.SetAttr(vt100.Green) END; LogW("^"); - IF ~notColorOutput THEN vt100.SetAttr(vt100.ResetAll) END; + IF ~(notcoloroutput IN opt) THEN vt100.SetAttr(vt100.ResetAll) END; Files.Close(f); END ShowLine; @@ -604,7 +643,7 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) MaxSet := SetSize * 8 - 1; MaxIndex := SignedMaximum(AddressSize); - IF Verbose THEN VerboseListSizes END; + IF verbose IN opt THEN VerboseListSizes END; END GetProperties; (* ------------------------- Read Symbol File ------------------------- *) diff --git a/src/compiler/OPT.Mod b/src/compiler/OPT.Mod index 6793a233..7648fcec 100644 --- a/src/compiler/OPT.Mod +++ b/src/compiler/OPT.Mod @@ -1143,10 +1143,8 @@ END Import; expCtxt.nofm := 1; expCtxt.locmno[0] := 0; i := 1; WHILE i < maxImps DO expCtxt.locmno[i] := -1; INC(i) END; OutObj(topScope^.right); - ext := sfpresent & symExtended; new := ~sfpresent OR symNew; - IF OPM.forceNewSym THEN - new := TRUE - END; (* for bootstrapping -- noch *) + ext := sfpresent & symExtended; + new := ~sfpresent OR symNew OR (OPM.forcenewsym IN OPM.opt); IF OPM.noerr & sfpresent & (impCtxt.reffp # expCtxt.reffp) THEN new := TRUE; IF ~extsf THEN err(155) END diff --git a/src/compiler/OPV.Mod b/src/compiler/OPV.Mod index 7c7e7464..04da5f09 100644 --- a/src/compiler/OPV.Mod +++ b/src/compiler/OPV.Mod @@ -46,7 +46,6 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96 VAR - assert, inxchk, mainprog, ansi: BOOLEAN; stamp: INTEGER; (* unique number for nested objects *) recno: LONGINT; (* number of anonymous record types *) @@ -104,10 +103,6 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96 PROCEDURE Init*; BEGIN stamp := 0; recno := 0; nofExitLabels := 0; - assert := OPM.assert IN OPM.opt; - inxchk := OPM.inxchk IN OPM.opt; - mainprog := OPM.mainprog IN OPM.opt; - ansi := OPM.ansi IN OPM.opt END Init; PROCEDURE ^Traverse (obj, outerScope: OPT.Object; exported: BOOLEAN); @@ -333,7 +328,7 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96 PROCEDURE Index(n, d: OPT.Node; prec, dim: INTEGER); BEGIN - IF ~inxchk + IF ~(OPM.inxchk IN OPM.opt) OR (n^.right^.class = OPT.Nconst) & ((n^.right^.conval^.intval = 0) OR (n^.left^.typ^.comp # OPT.DynArr)) THEN expr(n^.right, prec) ELSE @@ -434,7 +429,7 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96 PROCEDURE ParIntLiteral(n: SYSTEM.INT64; size: LONGINT); BEGIN (* Literal parameters (other than varargs) do not need an explicit size cast on ansi C compilers. *) - IF ansi THEN OPM.WriteInt(n) ELSE OPC.IntLiteral(n, size) END + OPM.WriteInt(n) END ParIntLiteral; PROCEDURE ActualPar(n: OPT.Node; fp: OPT.Object); @@ -448,22 +443,16 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96 END ; IF ~(n^.typ^.comp IN {OPT.Array, OPT.DynArr}) THEN IF mode = OPT.VarPar THEN - IF ansi & (typ # n^.typ) THEN OPM.WriteString("(void*)") END ; + IF typ # n^.typ THEN OPM.WriteString("(void*)") END; OPM.Write("&"); prec := 9 - ELSIF ansi THEN + ELSE IF (comp IN {OPT.Array, OPT.DynArr}) & (n^.class = OPT.Nconst) THEN OPM.WriteString("(CHAR*)") (* force to unsigned char *) ELSIF (form = OPT.Pointer) & (typ # n^.typ) & (n^.typ # OPT.niltyp) THEN OPM.WriteString("(void*)") (* type extension *) END - ELSE - IF (form IN {OPT.Real, OPT.LReal}) & (n^.typ^.form = OPT.Int) THEN (* real promotion *) - OPM.WriteString("(double)"); prec := 9 - ELSIF form = OPT.Int THEN - SizeCast(n.typ.size, typ.size) - END END - ELSIF ansi THEN + ELSE (* casting of params should be simplified eventually *) IF (mode = OPT.VarPar) & (typ # n^.typ) & (prec = MinPrec) THEN OPM.WriteString("(void*)") END END; @@ -903,7 +892,8 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96 END ; ActualPar(n^.right, n^.obj) | OPT.Nifelse: IF n^.subcl # OPT.assertfn THEN IfStat(n, FALSE, outerProc) - ELSIF assert THEN OPM.WriteString("__ASSERT("); expr(n^.left^.left^.left, MinPrec); OPM.WriteString(Comma); + ELSIF OPM.assert IN OPM.opt THEN + OPM.WriteString("__ASSERT("); expr(n^.left^.left^.left, MinPrec); OPM.WriteString(Comma); OPM.WriteInt(n^.left^.right^.right^.conval^.intval); OPM.Write(CloseParen); OPC.EndStat END | OPT.Ncase: INC(exit.level); CaseStat(n, outerProc); DEC(exit.level) @@ -925,7 +915,7 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96 OPM.WriteString("goto exit__"); OPM.WriteInt(exit.label) END | OPT.Nreturn: IF OPM.level = 0 THEN - IF mainprog THEN OPM.WriteString("__FINI") ELSE OPM.WriteString("__ENDMOD") END + IF OPM.mainprog IN OPM.opt THEN OPM.WriteString("__FINI") ELSE OPM.WriteString("__ENDMOD") END ELSE IF n^.left # NIL THEN (* Make local copy of result before ExitProc deletes dynamic vars *) @@ -953,7 +943,7 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96 PROCEDURE Module*(prog: OPT.Node); BEGIN - IF ~mainprog THEN OPC.GenHdr(prog^.right); OPC.GenHdrIncludes END ; + IF ~(OPM.mainprog IN OPM.opt) THEN OPC.GenHdr(prog^.right); OPC.GenHdrIncludes END ; OPC.GenBdy(prog^.right); stat(prog, NIL) END Module; diff --git a/src/compiler/Vishap.Mod b/src/compiler/Vishap.Mod index c4b06e9c..b6ca8bf2 100644 --- a/src/compiler/Vishap.Mod +++ b/src/compiler/Vishap.Mod @@ -22,16 +22,16 @@ MODULE Vishap; (* J. Templ 3.2.95 *) OPC.Init; OPV.Module(p); IF OPM.noerr THEN - IF (OPM.mainProg OR OPM.mainLinkStat) & (OPM.modName # "SYSTEM") THEN + IF (OPM.mainprog IN OPM.opt) & (OPM.modName # "SYSTEM") THEN OPM.DeleteNewSym; - IF ~OPM.notColorOutput THEN vt100.SetAttr(vt100.Green) END; + IF ~(OPM.notcoloroutput IN OPM.opt) THEN vt100.SetAttr(vt100.Green) END; OPM.LogWStr(" Main program."); - IF ~OPM.notColorOutput THEN vt100.SetAttr(vt100.ResetAll) END; + IF ~(OPM.notcoloroutput IN OPM.opt) THEN vt100.SetAttr(vt100.ResetAll) END; ELSE IF new THEN - IF ~OPM.notColorOutput THEN vt100.SetAttr(vt100.Green) END; + IF ~(OPM.notcoloroutput IN OPM.opt) THEN vt100.SetAttr(vt100.Green) END; OPM.LogWStr(" New symbol file."); - IF ~OPM.notColorOutput THEN vt100.SetAttr(vt100.ResetAll) END; + IF ~(OPM.notcoloroutput IN OPM.opt) THEN vt100.SetAttr(vt100.ResetAll) END; OPM.RegisterNewSym ELSIF ext THEN OPM.LogWStr(" Extended symbol file."); @@ -90,12 +90,12 @@ MODULE Vishap; (* J. Templ 3.2.95 *) END; (* 'assemble' (i.e. c compile) .c to object or executable. *) - IF ~OPM.dontAsm THEN - IF OPM.dontLink THEN + IF ~(OPM.dontasm IN OPM.opt) THEN + IF OPM.dontlink IN OPM.opt THEN (* If not linking, just assemble each module. *) extTools.Assemble(OPM.modName) ELSE - IF ~(OPM.mainProg OR OPM.mainLinkStat) THEN + IF ~(OPM.mainprog IN OPM.opt) THEN (* Assemble non main rogram and add object name to link list *) extTools.Assemble(OPM.modName); Strings.Append(" ", modulesobj); @@ -103,7 +103,7 @@ MODULE Vishap; (* J. Templ 3.2.95 *) Strings.Append(Configuration.objext, modulesobj) ELSE (* Assemble and link main program *) - extTools.LinkMain (OPM.modName, OPM.mainLinkStat, modulesobj) + extTools.LinkMain(OPM.modName, OPM.mainlinkstat IN OPM.opt, modulesobj) END END END diff --git a/src/compiler/extTools.Mod b/src/compiler/extTools.Mod index 515c13e4..22752d9b 100644 --- a/src/compiler/extTools.Mod +++ b/src/compiler/extTools.Mod @@ -8,7 +8,9 @@ VAR compilationOptions, CFLAGS: ARRAY 1023 OF CHAR; PROCEDURE execute(title: ARRAY OF CHAR; cmd: ARRAY OF CHAR); VAR r, status, exitcode: INTEGER; BEGIN - IF OPM.Verbose THEN Console.String(title); Console.String(cmd); Console.Ln END; + IF OPM.verbose IN OPM.opt THEN + Console.String(title); Console.String(cmd); Console.Ln + END; r := Platform.System(cmd); status := r MOD 128; exitcode := r DIV 256;