From 4c7aa1720a2009a634a57564ebcc8d0a3fdb5627 Mon Sep 17 00:00:00 2001 From: David Brown Date: Sun, 18 Dec 2016 13:05:05 +0000 Subject: [PATCH] Update bootstrap C sources. --- bootstrap/unix-44/Compiler.c | 51 +++++++++++++++++++------ bootstrap/unix-44/Configuration.c | 4 +- bootstrap/unix-44/Configuration.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 | 2 +- bootstrap/unix-44/OPB.h | 2 +- bootstrap/unix-44/OPC.c | 2 +- bootstrap/unix-44/OPC.h | 2 +- bootstrap/unix-44/OPM.c | 57 +++++++++++++++++----------- bootstrap/unix-44/OPM.h | 7 ++-- bootstrap/unix-44/OPP.c | 20 +--------- bootstrap/unix-44/OPP.h | 2 +- bootstrap/unix-44/OPS.c | 2 +- bootstrap/unix-44/OPS.h | 2 +- bootstrap/unix-44/OPT.c | 55 ++++++++++++++++++++++++++- bootstrap/unix-44/OPT.h | 13 ++++++- bootstrap/unix-44/OPV.c | 2 +- bootstrap/unix-44/OPV.h | 2 +- bootstrap/unix-44/Out.c | 2 +- bootstrap/unix-44/Out.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/VT100.c | 2 +- bootstrap/unix-44/VT100.h | 2 +- bootstrap/unix-44/extTools.c | 2 +- bootstrap/unix-44/extTools.h | 2 +- bootstrap/unix-48/Compiler.c | 51 +++++++++++++++++++------ bootstrap/unix-48/Configuration.c | 4 +- bootstrap/unix-48/Configuration.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 | 2 +- bootstrap/unix-48/OPB.h | 2 +- bootstrap/unix-48/OPC.c | 2 +- bootstrap/unix-48/OPC.h | 2 +- bootstrap/unix-48/OPM.c | 57 +++++++++++++++++----------- bootstrap/unix-48/OPM.h | 7 ++-- bootstrap/unix-48/OPP.c | 20 +--------- bootstrap/unix-48/OPP.h | 2 +- bootstrap/unix-48/OPS.c | 2 +- bootstrap/unix-48/OPS.h | 2 +- bootstrap/unix-48/OPT.c | 55 ++++++++++++++++++++++++++- bootstrap/unix-48/OPT.h | 13 ++++++- bootstrap/unix-48/OPV.c | 2 +- bootstrap/unix-48/OPV.h | 2 +- bootstrap/unix-48/Out.c | 2 +- bootstrap/unix-48/Out.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/VT100.c | 2 +- bootstrap/unix-48/VT100.h | 2 +- bootstrap/unix-48/extTools.c | 2 +- bootstrap/unix-48/extTools.h | 2 +- bootstrap/unix-88/Compiler.c | 51 +++++++++++++++++++------ bootstrap/unix-88/Configuration.c | 4 +- bootstrap/unix-88/Configuration.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 | 2 +- bootstrap/unix-88/OPB.h | 2 +- bootstrap/unix-88/OPC.c | 2 +- bootstrap/unix-88/OPC.h | 2 +- bootstrap/unix-88/OPM.c | 57 +++++++++++++++++----------- bootstrap/unix-88/OPM.h | 7 ++-- bootstrap/unix-88/OPP.c | 20 +--------- bootstrap/unix-88/OPP.h | 2 +- bootstrap/unix-88/OPS.c | 2 +- bootstrap/unix-88/OPS.h | 2 +- bootstrap/unix-88/OPT.c | 55 ++++++++++++++++++++++++++- bootstrap/unix-88/OPT.h | 13 ++++++- bootstrap/unix-88/OPV.c | 2 +- bootstrap/unix-88/OPV.h | 2 +- bootstrap/unix-88/Out.c | 2 +- bootstrap/unix-88/Out.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/VT100.c | 2 +- bootstrap/unix-88/VT100.h | 2 +- bootstrap/unix-88/extTools.c | 2 +- bootstrap/unix-88/extTools.h | 2 +- bootstrap/windows-48/Compiler.c | 51 +++++++++++++++++++------ bootstrap/windows-48/Configuration.c | 4 +- bootstrap/windows-48/Configuration.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 | 2 +- bootstrap/windows-48/OPB.h | 2 +- bootstrap/windows-48/OPC.c | 2 +- bootstrap/windows-48/OPC.h | 2 +- bootstrap/windows-48/OPM.c | 57 +++++++++++++++++----------- bootstrap/windows-48/OPM.h | 7 ++-- bootstrap/windows-48/OPP.c | 20 +--------- bootstrap/windows-48/OPP.h | 2 +- bootstrap/windows-48/OPS.c | 2 +- bootstrap/windows-48/OPS.h | 2 +- bootstrap/windows-48/OPT.c | 55 ++++++++++++++++++++++++++- bootstrap/windows-48/OPT.h | 13 ++++++- bootstrap/windows-48/OPV.c | 2 +- bootstrap/windows-48/OPV.h | 2 +- bootstrap/windows-48/Out.c | 2 +- bootstrap/windows-48/Out.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/VT100.c | 2 +- bootstrap/windows-48/VT100.h | 2 +- bootstrap/windows-48/extTools.c | 2 +- bootstrap/windows-48/extTools.h | 2 +- bootstrap/windows-88/Compiler.c | 51 +++++++++++++++++++------ bootstrap/windows-88/Configuration.c | 4 +- bootstrap/windows-88/Configuration.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 | 2 +- bootstrap/windows-88/OPB.h | 2 +- bootstrap/windows-88/OPC.c | 2 +- bootstrap/windows-88/OPC.h | 2 +- bootstrap/windows-88/OPM.c | 57 +++++++++++++++++----------- bootstrap/windows-88/OPM.h | 7 ++-- bootstrap/windows-88/OPP.c | 20 +--------- bootstrap/windows-88/OPP.h | 2 +- bootstrap/windows-88/OPS.c | 2 +- bootstrap/windows-88/OPS.h | 2 +- bootstrap/windows-88/OPT.c | 55 ++++++++++++++++++++++++++- bootstrap/windows-88/OPT.h | 13 ++++++- bootstrap/windows-88/OPV.c | 2 +- bootstrap/windows-88/OPV.h | 2 +- bootstrap/windows-88/Out.c | 2 +- bootstrap/windows-88/Out.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/VT100.c | 2 +- bootstrap/windows-88/VT100.h | 2 +- bootstrap/windows-88/extTools.c | 2 +- bootstrap/windows-88/extTools.h | 2 +- 185 files changed, 880 insertions(+), 455 deletions(-) diff --git a/bootstrap/unix-44/Compiler.c b/bootstrap/unix-44/Compiler.c index 454ea490..f26c1a32 100644 --- a/bootstrap/unix-44/Compiler.c +++ b/bootstrap/unix-44/Compiler.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */ #define SHORTINT INT8 #define INTEGER INT16 @@ -20,9 +20,9 @@ #include "extTools.h" -static CHAR Compiler_mname[256]; +static void Compiler_FindLocalObjectFiles (CHAR *objectnames, ADDRESS objectnames__len); export void Compiler_Module (BOOLEAN *done); static void Compiler_PropagateElementaryTypeSizes (void); export void Compiler_Translate (void); @@ -41,11 +41,12 @@ void Compiler_Module (BOOLEAN *done) OPT_Export(&ext, &new); if (OPM_noerr) { OPM_OpenFiles((void*)OPT_SelfName, 256); + OPM_DeleteObj((void*)OPT_SelfName, 256); OPC_Init(); OPV_Module(p); if (OPM_noerr) { if ((__IN(10, OPM_Options, 32) && __STRCMP(OPM_modName, "SYSTEM") != 0)) { - OPM_DeleteNewSym(); + OPM_DeleteNewSym((void*)OPT_SelfName, 256); OPM_LogVT100((CHAR*)"32m", 4); OPM_LogWStr((CHAR*)" Main program.", 16); OPM_LogVT100((CHAR*)"0m", 3); @@ -61,7 +62,7 @@ void Compiler_Module (BOOLEAN *done) } } } else { - OPM_DeleteNewSym(); + OPM_DeleteNewSym((void*)OPT_SelfName, 256); } } } @@ -104,14 +105,44 @@ static void Compiler_PropagateElementaryTypeSizes (void) } } +static void Compiler_FindLocalObjectFiles (CHAR *objectnames, ADDRESS objectnames__len) +{ + OPT_Link l = NIL; + CHAR fn[64]; + Platform_FileIdentity id; + objectnames[0] = 0x00; + l = OPT_Links; + while (l != NIL) { + __COPY(l->name, fn, 64); + Strings_Append((CHAR*)".sym", 5, (void*)fn, 64); + if (Platform_IdentifyByName(fn, 64, &id, Platform_FileIdentity__typ) == 0) { + __COPY(l->name, fn, 64); + Strings_Append((CHAR*)".o", 3, (void*)fn, 64); + if (Platform_IdentifyByName(fn, 64, &id, Platform_FileIdentity__typ) == 0) { + Strings_Append((CHAR*)" ", 2, (void*)objectnames, objectnames__len); + Strings_Append(fn, 64, (void*)objectnames, objectnames__len); + } else { + OPM_LogVT100((CHAR*)"33m", 4); + OPM_LogWStr((CHAR*)"Link warning: a local symbol file is present for module ", 57); + OPM_LogWStr(l->name, 256); + OPM_LogWStr((CHAR*)", but local object file '", 26); + OPM_LogWStr(fn, 64); + OPM_LogWStr((CHAR*)"' is missing.", 14); + OPM_LogVT100((CHAR*)"0m", 3); + OPM_LogWLn(); + } + } + l = l->next; + } +} + void Compiler_Translate (void) { BOOLEAN done; - CHAR modulesobj[2048]; - modulesobj[0] = 0x00; + CHAR linkfiles[2048]; if (OPM_OpenPar()) { for (;;) { - OPM_Init(&done, (void*)Compiler_mname, 256); + OPM_Init(&done); if (!done) { return; } @@ -131,11 +162,9 @@ void Compiler_Translate (void) } else { if (!__IN(10, OPM_Options, 32)) { extTools_Assemble(OPM_modName, 32); - Strings_Append((CHAR*)" ", 2, (void*)modulesobj, 2048); - Strings_Append(OPM_modName, 32, (void*)modulesobj, 2048); - Strings_Append((CHAR*)".o", 3, (void*)modulesobj, 2048); } else { - extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_Options, 32), modulesobj, 2048); + Compiler_FindLocalObjectFiles((void*)linkfiles, 2048); + extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_Options, 32), linkfiles, 2048); } } } diff --git a/bootstrap/unix-44/Configuration.c b/bootstrap/unix-44/Configuration.c index abf165f3..18ec858a 100644 --- a/bootstrap/unix-44/Configuration.c +++ b/bootstrap/unix-44/Configuration.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -19,6 +19,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); + __MOVE("2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); __ENDMOD; } diff --git a/bootstrap/unix-44/Configuration.h b/bootstrap/unix-44/Configuration.h index eb712e53..efd4ae6e 100644 --- a/bootstrap/unix-44/Configuration.h +++ b/bootstrap/unix-44/Configuration.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/unix-44/Files.c b/bootstrap/unix-44/Files.c index d29c5510..dac5c5ff 100644 --- a/bootstrap/unix-44/Files.c +++ b/bootstrap/unix-44/Files.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-44/Files.h b/bootstrap/unix-44/Files.h index e0812a5b..2291d7d8 100644 --- a/bootstrap/unix-44/Files.h +++ b/bootstrap/unix-44/Files.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/unix-44/Heap.c b/bootstrap/unix-44/Heap.c index 495e451c..df3d086b 100644 --- a/bootstrap/unix-44/Heap.c +++ b/bootstrap/unix-44/Heap.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-44/Heap.h b/bootstrap/unix-44/Heap.h index 7429d8c8..7a464dbf 100644 --- a/bootstrap/unix-44/Heap.h +++ b/bootstrap/unix-44/Heap.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/unix-44/Modules.c b/bootstrap/unix-44/Modules.c index 34c15ece..76891be3 100644 --- a/bootstrap/unix-44/Modules.c +++ b/bootstrap/unix-44/Modules.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-44/Modules.h b/bootstrap/unix-44/Modules.h index 42f06075..9f691749 100644 --- a/bootstrap/unix-44/Modules.h +++ b/bootstrap/unix-44/Modules.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/unix-44/OPB.c b/bootstrap/unix-44/OPB.c index c163c77e..3933cee1 100644 --- a/bootstrap/unix-44/OPB.c +++ b/bootstrap/unix-44/OPB.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-44/OPB.h b/bootstrap/unix-44/OPB.h index 7b8e9d38..9f8518b8 100644 --- a/bootstrap/unix-44/OPB.h +++ b/bootstrap/unix-44/OPB.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/unix-44/OPC.c b/bootstrap/unix-44/OPC.c index fef86e9e..24cd4f3f 100644 --- a/bootstrap/unix-44/OPC.c +++ b/bootstrap/unix-44/OPC.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-44/OPC.h b/bootstrap/unix-44/OPC.h index a2b14bdc..99b9afb4 100644 --- a/bootstrap/unix-44/OPC.h +++ b/bootstrap/unix-44/OPC.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/unix-44/OPM.c b/bootstrap/unix-44/OPM.c index d09d6a7a..3411635b 100644 --- a/bootstrap/unix-44/OPM.c +++ b/bootstrap/unix-44/OPM.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -49,7 +49,8 @@ export CHAR OPM_ResourceDir[1024]; static void OPM_Append (Files_Rider *R, ADDRESS *R__typ, Files_File F); export void OPM_CloseFiles (void); export void OPM_CloseOldSym (void); -export void OPM_DeleteNewSym (void); +export void OPM_DeleteNewSym (CHAR *modulename, ADDRESS modulename__len); +export void OPM_DeleteObj (CHAR *modulename, ADDRESS modulename__len); export void OPM_FPrint (INT32 *fp, INT64 val); export void OPM_FPrintLReal (INT32 *fp, LONGREAL val); export void OPM_FPrintReal (INT32 *fp, REAL val); @@ -58,7 +59,7 @@ static void OPM_FindInstallDir (void); static void OPM_FindLine (Files_File f, Files_Rider *r, ADDRESS *r__typ, INT64 pos); static void OPM_FingerprintBytes (INT32 *fp, SYSTEM_BYTE *bytes, ADDRESS bytes__len); export void OPM_Get (CHAR *ch); -export void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len); +export void OPM_Init (BOOLEAN *done); export void OPM_InitOptions (void); export INT16 OPM_Integer (INT64 n); static BOOLEAN OPM_IsProbablyInstallDir (CHAR *s, ADDRESS s__len); @@ -449,7 +450,7 @@ void OPM_InitOptions (void) Files_SetSearchPath(searchpath, 1024); } -void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len) +void OPM_Init (BOOLEAN *done) { Texts_Text T = NIL; INT32 beg, end, time; @@ -465,7 +466,6 @@ void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len) Texts_Open(T, s, 256); OPM_LogWStr(s, 256); OPM_LogWStr((CHAR*)" ", 3); - __COPY(s, mname, mname__len); __COPY(s, OPM_SourceFileName, 256); if (T->len == 0) { OPM_LogWStr(s, 256); @@ -773,7 +773,7 @@ void OPM_OldSym (CHAR *modName, ADDRESS modName__len, BOOLEAN *done) Files_Set(&OPM_oldSF, Files_Rider__typ, OPM_oldSFile, 0); Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&tag); Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&ver); - if (tag != 0xf7 || ver != 0x82) { + if (tag != 0xf7 || ver != 0x83) { OPM_err(-306); OPM_CloseOldSym(); *done = 0; @@ -818,8 +818,20 @@ void OPM_RegisterNewSym (void) } } -void OPM_DeleteNewSym (void) +void OPM_DeleteNewSym (CHAR *modulename, ADDRESS modulename__len) { + OPM_FileName fn; + INT16 res; + OPM_MakeFileName((void*)modulename, modulename__len, (void*)fn, 32, (CHAR*)".sym", 5); + Files_Delete(fn, 32, &res); +} + +void OPM_DeleteObj (CHAR *modulename, ADDRESS modulename__len) +{ + OPM_FileName fn; + INT16 res; + OPM_MakeFileName((void*)modulename, modulename__len, (void*)fn, 32, (CHAR*)".o", 3); + Files_Delete(fn, 32, &res); } void OPM_NewSym (CHAR *modName, ADDRESS modName__len) @@ -830,7 +842,7 @@ void OPM_NewSym (CHAR *modName, ADDRESS modName__len) if (OPM_newSFile != NIL) { Files_Set(&OPM_newSF, Files_Rider__typ, OPM_newSFile, 0); Files_Write(&OPM_newSF, Files_Rider__typ, 0xf7); - Files_Write(&OPM_newSF, Files_Rider__typ, 0x82); + Files_Write(&OPM_newSF, Files_Rider__typ, 0x83); } else { OPM_err(153); } @@ -984,7 +996,7 @@ static void OPM_Append (Files_Rider *R, ADDRESS *R__typ, Files_File F) void OPM_OpenFiles (CHAR *moduleName, ADDRESS moduleName__len) { - CHAR FName[32]; + OPM_FileName FName; __COPY(moduleName, OPM_modName, 32); OPM_HFile = Files_New((CHAR*)"", 1); if (OPM_HFile != NIL) { @@ -1010,7 +1022,7 @@ void OPM_OpenFiles (CHAR *moduleName, ADDRESS moduleName__len) void OPM_CloseFiles (void) { - CHAR FName[32]; + OPM_FileName FName; INT16 res; if (OPM_noerr) { OPM_LogWStr((CHAR*)" ", 3); @@ -1048,26 +1060,26 @@ void OPM_CloseFiles (void) static BOOLEAN OPM_IsProbablyInstallDir (CHAR *s, ADDRESS s__len) { - CHAR testpath[1024]; + CHAR testpath[4096]; Platform_FileIdentity identity; __DUP(s, s__len, CHAR); - __COPY(OPM_InstallDir, testpath, 1024); - Strings_Append((CHAR*)"/lib/lib", 9, (void*)testpath, 1024); - Strings_Append((CHAR*)"voc", 4, (void*)testpath, 1024); - Strings_Append((CHAR*)"-O2.a", 6, (void*)testpath, 1024); - if (Platform_IdentifyByName(testpath, 1024, &identity, Platform_FileIdentity__typ) != 0) { + __COPY(OPM_InstallDir, testpath, 4096); + Strings_Append((CHAR*)"/lib/lib", 9, (void*)testpath, 4096); + Strings_Append((CHAR*)"voc", 4, (void*)testpath, 4096); + Strings_Append((CHAR*)"-O2.a", 6, (void*)testpath, 4096); + if (Platform_IdentifyByName(testpath, 4096, &identity, Platform_FileIdentity__typ) != 0) { __DEL(s); return 0; } - __COPY(OPM_InstallDir, testpath, 1024); - Strings_Append((CHAR*)"/2/include/Oberon.h", 20, (void*)testpath, 1024); - if (Platform_IdentifyByName(testpath, 1024, &identity, Platform_FileIdentity__typ) != 0) { + __COPY(OPM_InstallDir, testpath, 4096); + Strings_Append((CHAR*)"/2/include/Oberon.h", 20, (void*)testpath, 4096); + if (Platform_IdentifyByName(testpath, 4096, &identity, Platform_FileIdentity__typ) != 0) { __DEL(s); return 0; } - __COPY(OPM_InstallDir, testpath, 1024); - Strings_Append((CHAR*)"/2/sym/Files.sym", 17, (void*)testpath, 1024); - if (Platform_IdentifyByName(testpath, 1024, &identity, Platform_FileIdentity__typ) != 0) { + __COPY(OPM_InstallDir, testpath, 4096); + Strings_Append((CHAR*)"/2/sym/Files.sym", 17, (void*)testpath, 4096); + if (Platform_IdentifyByName(testpath, 4096, &identity, Platform_FileIdentity__typ) != 0) { __DEL(s); return 0; } @@ -1129,7 +1141,6 @@ export void *OPM__init(void) __REGMOD("OPM", EnumPtrs); __REGCMD("CloseFiles", OPM_CloseFiles); __REGCMD("CloseOldSym", OPM_CloseOldSym); - __REGCMD("DeleteNewSym", OPM_DeleteNewSym); __REGCMD("InitOptions", OPM_InitOptions); __REGCMD("LogWLn", OPM_LogWLn); __REGCMD("RegisterNewSym", OPM_RegisterNewSym); diff --git a/bootstrap/unix-44/OPM.h b/bootstrap/unix-44/OPM.h index dc86bc49..da0a48ee 100644 --- a/bootstrap/unix-44/OPM.h +++ b/bootstrap/unix-44/OPM.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPM__h #define OPM__h @@ -23,13 +23,14 @@ import CHAR OPM_ResourceDir[1024]; import void OPM_CloseFiles (void); import void OPM_CloseOldSym (void); -import void OPM_DeleteNewSym (void); +import void OPM_DeleteNewSym (CHAR *modulename, ADDRESS modulename__len); +import void OPM_DeleteObj (CHAR *modulename, ADDRESS modulename__len); import void OPM_FPrint (INT32 *fp, INT64 val); import void OPM_FPrintLReal (INT32 *fp, LONGREAL val); import void OPM_FPrintReal (INT32 *fp, REAL val); import void OPM_FPrintSet (INT32 *fp, UINT64 val); import void OPM_Get (CHAR *ch); -import void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len); +import void OPM_Init (BOOLEAN *done); import void OPM_InitOptions (void); import INT16 OPM_Integer (INT64 n); import void OPM_LogVT100 (CHAR *vt100code, ADDRESS vt100code__len); diff --git a/bootstrap/unix-44/OPP.c b/bootstrap/unix-44/OPP.c index 24e6b221..aad8367d 100644 --- a/bootstrap/unix-44/OPP.c +++ b/bootstrap/unix-44/OPP.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -1793,24 +1793,6 @@ void OPP_Module (OPT_Node *prog, UINT32 opt) if (OPP_sym == 63) { OPS_Get(&OPP_sym); } else { - OPM_LogWLn(); - OPM_LogWStr((CHAR*)"Unexpected symbol found when MODULE expected:", 46); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" sym: ", 15); - OPM_LogWNum(OPP_sym, 1); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" OPS.name: ", 15); - OPM_LogWStr(OPS_name, 256); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" OPS.str: ", 15); - OPM_LogWStr(OPS_str, 256); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" OPS.numtyp: ", 15); - OPM_LogWNum(OPS_numtyp, 1); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" OPS.intval: ", 15); - OPM_LogWNum(OPS_intval, 1); - OPM_LogWLn(); OPP_err(16); } if (OPP_sym == 38) { diff --git a/bootstrap/unix-44/OPP.h b/bootstrap/unix-44/OPP.h index bf0f96d7..dc8aa405 100644 --- a/bootstrap/unix-44/OPP.h +++ b/bootstrap/unix-44/OPP.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/unix-44/OPS.c b/bootstrap/unix-44/OPS.c index 807c0ce5..d0a1851a 100644 --- a/bootstrap/unix-44/OPS.c +++ b/bootstrap/unix-44/OPS.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-44/OPS.h b/bootstrap/unix-44/OPS.h index a15d8712..608979a8 100644 --- a/bootstrap/unix-44/OPS.h +++ b/bootstrap/unix-44/OPS.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/unix-44/OPT.c b/bootstrap/unix-44/OPT.c index b028aa53..02532034 100644 --- a/bootstrap/unix-44/OPT.c +++ b/bootstrap/unix-44/OPT.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -49,6 +49,15 @@ typedef INT8 glbmno[64]; } OPT_ImpCtxt; +typedef + struct OPT_LinkDesc *OPT_Link; + +typedef + struct OPT_LinkDesc { + OPS_Name name; + OPT_Link next; + } OPT_LinkDesc; + typedef struct OPT_NodeDesc *OPT_Node; @@ -101,6 +110,7 @@ static OPT_ExpCtxt OPT_expCtxt; static INT32 OPT_nofhdfld; static BOOLEAN OPT_newsf, OPT_findpc, OPT_extsf, OPT_sfpresent, OPT_symExtended, OPT_symNew; static INT32 OPT_recno; +export OPT_Link OPT_Links; export ADDRESS *OPT_ConstDesc__typ; export ADDRESS *OPT_ObjDesc__typ; @@ -108,6 +118,7 @@ export ADDRESS *OPT_StrDesc__typ; export ADDRESS *OPT_NodeDesc__typ; export ADDRESS *OPT_ImpCtxt__typ; export ADDRESS *OPT_ExpCtxt__typ; +export ADDRESS *OPT_LinkDesc__typ; export void OPT_Align (INT32 *adr, INT32 base); export INT32 OPT_BaseAlignment (OPT_Struct typ); @@ -131,6 +142,7 @@ export void OPT_IdFPrint (OPT_Struct typ); export void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done); static void OPT_InConstant (INT32 f, OPT_Const conval); static OPT_Object OPT_InFld (void); +static void OPT_InLinks (void); static void OPT_InMod (INT8 *mno); static void OPT_InName (CHAR *name, ADDRESS name__len); static OPT_Object OPT_InObj (INT8 mno); @@ -154,6 +166,7 @@ export void OPT_OpenScope (INT8 level, OPT_Object owner); static void OPT_OutConstant (OPT_Object obj); static void OPT_OutFlds (OPT_Object fld, INT32 adr, BOOLEAN visible); static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, INT32 adr); +static void OPT_OutLinks (void); static void OPT_OutMod (INT16 mno); static void OPT_OutName (CHAR *name, ADDRESS name__len); static void OPT_OutObj (OPT_Object obj); @@ -442,6 +455,8 @@ void OPT_Init (OPS_Name name, UINT32 opt) OPT_findpc = __IN(8, opt, 32); OPT_extsf = OPT_newsf || __IN(9, opt, 32); OPT_sfpresent = 1; + __NEW(OPT_Links, OPT_LinkDesc); + __MOVE(name, OPT_Links->name, 256); } void OPT_Close (void) @@ -1011,6 +1026,26 @@ static void OPT_InMod (INT8 *mno) } } +static void OPT_InLinks (void) +{ + OPS_Name linkname; + OPT_Link l = NIL; + OPT_InName((void*)linkname, 256); + while (linkname[0] != 0x00) { + l = OPT_Links; + while ((l != NIL && __STRCMP(l->name, linkname) != 0)) { + l = l->next; + } + if (l == NIL) { + l = OPT_Links; + __NEW(OPT_Links, OPT_LinkDesc); + OPT_Links->next = l; + __MOVE(linkname, OPT_Links->name, 256); + } + OPT_InName((void*)linkname, 256); + } +} + static void OPT_InConstant (INT32 f, OPT_Const conval) { CHAR ch; @@ -1461,6 +1496,7 @@ void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done) OPM_OldSym((void*)name, 256, &*done); if (*done) { OPT_InMod(&mno); + OPT_InLinks(); OPT_impCtxt.nextTag = OPM_SymRInt(); while (!OPM_eofSF()) { obj = OPT_InObj(mno); @@ -1507,6 +1543,17 @@ static void OPT_OutMod (INT16 mno) } } +static void OPT_OutLinks (void) +{ + OPT_Link l = NIL; + l = OPT_Links; + while (l != NIL) { + OPT_OutName((void*)l->name, 256); + l = l->next; + } + OPM_SymWCh(0x00); +} + static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, INT32 adr) { INT32 i, j, n; @@ -1833,6 +1880,7 @@ void OPT_Export (BOOLEAN *ext, BOOLEAN *new) if (OPM_noerr) { OPM_SymWInt(16); OPT_OutName((void*)OPT_SelfName, 256); + OPT_OutLinks(); OPT_expCtxt.reffp = 0; OPT_expCtxt.ref = 14; OPT_expCtxt.nofm = 1; @@ -1854,7 +1902,7 @@ void OPT_Export (BOOLEAN *ext, BOOLEAN *new) OPT_newsf = 0; OPT_symNew = 0; if (!OPM_noerr || OPT_findpc) { - OPM_DeleteNewSym(); + OPM_DeleteNewSym((void*)OPT_SelfName, 256); } } } @@ -1969,6 +2017,7 @@ static void EnumPtrs(void (*P)(void*)) P(OPT_universe); P(OPT_syslink); __ENUMR(&OPT_impCtxt, OPT_ImpCtxt__typ, 3140, 1, P); + P(OPT_Links); } __TDESC(OPT_ConstDesc, 1, 1) = {__TDFLDS("ConstDesc", 32), {0, -8}}; @@ -2008,6 +2057,7 @@ __TDESC(OPT_ImpCtxt, 1, 510) = {__TDFLDS("ImpCtxt", 3140), {16, 20, 24, 28, 32, 1936, 1940, 1944, 1948, 1952, 1956, 1960, 1964, 1968, 1972, 1976, 1980, 1984, 1988, 1992, 1996, 2000, 2004, 2008, 2012, 2016, 2020, 2024, 2028, 2032, 2036, 2040, 2044, 2048, 2052, -2044}}; __TDESC(OPT_ExpCtxt, 1, 0) = {__TDFLDS("ExpCtxt", 72), {-4}}; +__TDESC(OPT_LinkDesc, 1, 1) = {__TDFLDS("LinkDesc", 260), {256, -8}}; export void *OPT__init(void) { @@ -2024,6 +2074,7 @@ export void *OPT__init(void) __INITYP(OPT_NodeDesc, OPT_NodeDesc, 0); __INITYP(OPT_ImpCtxt, OPT_ImpCtxt, 0); __INITYP(OPT_ExpCtxt, OPT_ExpCtxt, 0); + __INITYP(OPT_LinkDesc, OPT_LinkDesc, 0); /* BEGIN */ OPT_topScope = NIL; OPT_OpenScope(0, NIL); diff --git a/bootstrap/unix-44/OPT.h b/bootstrap/unix-44/OPT.h index 9a187fc7..7483f169 100644 --- a/bootstrap/unix-44/OPT.h +++ b/bootstrap/unix-44/OPT.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPT__h #define OPT__h @@ -21,6 +21,15 @@ typedef LONGREAL realval; } OPT_ConstDesc; +typedef + struct OPT_LinkDesc *OPT_Link; + +typedef + struct OPT_LinkDesc { + OPS_Name name; + OPT_Link next; + } OPT_LinkDesc; + typedef struct OPT_NodeDesc *OPT_Node; @@ -75,11 +84,13 @@ import INT8 OPT_nofGmod; import OPT_Object OPT_GlbMod[64]; import OPS_Name OPT_SelfName; import BOOLEAN OPT_SYSimported; +import OPT_Link OPT_Links; import ADDRESS *OPT_ConstDesc__typ; import ADDRESS *OPT_ObjDesc__typ; import ADDRESS *OPT_StrDesc__typ; import ADDRESS *OPT_NodeDesc__typ; +import ADDRESS *OPT_LinkDesc__typ; import void OPT_Align (INT32 *adr, INT32 base); import INT32 OPT_BaseAlignment (OPT_Struct typ); diff --git a/bootstrap/unix-44/OPV.c b/bootstrap/unix-44/OPV.c index 96252046..152db225 100644 --- a/bootstrap/unix-44/OPV.c +++ b/bootstrap/unix-44/OPV.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-44/OPV.h b/bootstrap/unix-44/OPV.h index 5654d36e..7c94fced 100644 --- a/bootstrap/unix-44/OPV.h +++ b/bootstrap/unix-44/OPV.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/unix-44/Out.c b/bootstrap/unix-44/Out.c index 9248cfc5..d1fba01a 100644 --- a/bootstrap/unix-44/Out.c +++ b/bootstrap/unix-44/Out.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-44/Out.h b/bootstrap/unix-44/Out.h index ffbd6894..a7195e3a 100644 --- a/bootstrap/unix-44/Out.h +++ b/bootstrap/unix-44/Out.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Out__h #define Out__h diff --git a/bootstrap/unix-44/Platform.c b/bootstrap/unix-44/Platform.c index 027176ed..6117b38b 100644 --- a/bootstrap/unix-44/Platform.c +++ b/bootstrap/unix-44/Platform.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-44/Platform.h b/bootstrap/unix-44/Platform.h index 79d88e9d..521594dc 100644 --- a/bootstrap/unix-44/Platform.h +++ b/bootstrap/unix-44/Platform.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/unix-44/Reals.c b/bootstrap/unix-44/Reals.c index 2ecd8371..11ad01bd 100644 --- a/bootstrap/unix-44/Reals.c +++ b/bootstrap/unix-44/Reals.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-44/Reals.h b/bootstrap/unix-44/Reals.h index 570e7d72..bf708519 100644 --- a/bootstrap/unix-44/Reals.h +++ b/bootstrap/unix-44/Reals.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/unix-44/Strings.c b/bootstrap/unix-44/Strings.c index f911a688..06972c90 100644 --- a/bootstrap/unix-44/Strings.c +++ b/bootstrap/unix-44/Strings.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-44/Strings.h b/bootstrap/unix-44/Strings.h index 7645aa6e..fd7f283d 100644 --- a/bootstrap/unix-44/Strings.h +++ b/bootstrap/unix-44/Strings.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/unix-44/Texts.c b/bootstrap/unix-44/Texts.c index f73006a8..fe342ae1 100644 --- a/bootstrap/unix-44/Texts.c +++ b/bootstrap/unix-44/Texts.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-44/Texts.h b/bootstrap/unix-44/Texts.h index d1e65c70..a8edeb78 100644 --- a/bootstrap/unix-44/Texts.h +++ b/bootstrap/unix-44/Texts.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/unix-44/VT100.c b/bootstrap/unix-44/VT100.c index 1e0fffa9..baa92092 100644 --- a/bootstrap/unix-44/VT100.c +++ b/bootstrap/unix-44/VT100.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-44/VT100.h b/bootstrap/unix-44/VT100.h index 7522f9d1..4c0087ac 100644 --- a/bootstrap/unix-44/VT100.h +++ b/bootstrap/unix-44/VT100.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef VT100__h #define VT100__h diff --git a/bootstrap/unix-44/extTools.c b/bootstrap/unix-44/extTools.c index d2c67400..75768aca 100644 --- a/bootstrap/unix-44/extTools.c +++ b/bootstrap/unix-44/extTools.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-44/extTools.h b/bootstrap/unix-44/extTools.h index fb167591..fb870961 100644 --- a/bootstrap/unix-44/extTools.h +++ b/bootstrap/unix-44/extTools.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/unix-48/Compiler.c b/bootstrap/unix-48/Compiler.c index 454ea490..f26c1a32 100644 --- a/bootstrap/unix-48/Compiler.c +++ b/bootstrap/unix-48/Compiler.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */ #define SHORTINT INT8 #define INTEGER INT16 @@ -20,9 +20,9 @@ #include "extTools.h" -static CHAR Compiler_mname[256]; +static void Compiler_FindLocalObjectFiles (CHAR *objectnames, ADDRESS objectnames__len); export void Compiler_Module (BOOLEAN *done); static void Compiler_PropagateElementaryTypeSizes (void); export void Compiler_Translate (void); @@ -41,11 +41,12 @@ void Compiler_Module (BOOLEAN *done) OPT_Export(&ext, &new); if (OPM_noerr) { OPM_OpenFiles((void*)OPT_SelfName, 256); + OPM_DeleteObj((void*)OPT_SelfName, 256); OPC_Init(); OPV_Module(p); if (OPM_noerr) { if ((__IN(10, OPM_Options, 32) && __STRCMP(OPM_modName, "SYSTEM") != 0)) { - OPM_DeleteNewSym(); + OPM_DeleteNewSym((void*)OPT_SelfName, 256); OPM_LogVT100((CHAR*)"32m", 4); OPM_LogWStr((CHAR*)" Main program.", 16); OPM_LogVT100((CHAR*)"0m", 3); @@ -61,7 +62,7 @@ void Compiler_Module (BOOLEAN *done) } } } else { - OPM_DeleteNewSym(); + OPM_DeleteNewSym((void*)OPT_SelfName, 256); } } } @@ -104,14 +105,44 @@ static void Compiler_PropagateElementaryTypeSizes (void) } } +static void Compiler_FindLocalObjectFiles (CHAR *objectnames, ADDRESS objectnames__len) +{ + OPT_Link l = NIL; + CHAR fn[64]; + Platform_FileIdentity id; + objectnames[0] = 0x00; + l = OPT_Links; + while (l != NIL) { + __COPY(l->name, fn, 64); + Strings_Append((CHAR*)".sym", 5, (void*)fn, 64); + if (Platform_IdentifyByName(fn, 64, &id, Platform_FileIdentity__typ) == 0) { + __COPY(l->name, fn, 64); + Strings_Append((CHAR*)".o", 3, (void*)fn, 64); + if (Platform_IdentifyByName(fn, 64, &id, Platform_FileIdentity__typ) == 0) { + Strings_Append((CHAR*)" ", 2, (void*)objectnames, objectnames__len); + Strings_Append(fn, 64, (void*)objectnames, objectnames__len); + } else { + OPM_LogVT100((CHAR*)"33m", 4); + OPM_LogWStr((CHAR*)"Link warning: a local symbol file is present for module ", 57); + OPM_LogWStr(l->name, 256); + OPM_LogWStr((CHAR*)", but local object file '", 26); + OPM_LogWStr(fn, 64); + OPM_LogWStr((CHAR*)"' is missing.", 14); + OPM_LogVT100((CHAR*)"0m", 3); + OPM_LogWLn(); + } + } + l = l->next; + } +} + void Compiler_Translate (void) { BOOLEAN done; - CHAR modulesobj[2048]; - modulesobj[0] = 0x00; + CHAR linkfiles[2048]; if (OPM_OpenPar()) { for (;;) { - OPM_Init(&done, (void*)Compiler_mname, 256); + OPM_Init(&done); if (!done) { return; } @@ -131,11 +162,9 @@ void Compiler_Translate (void) } else { if (!__IN(10, OPM_Options, 32)) { extTools_Assemble(OPM_modName, 32); - Strings_Append((CHAR*)" ", 2, (void*)modulesobj, 2048); - Strings_Append(OPM_modName, 32, (void*)modulesobj, 2048); - Strings_Append((CHAR*)".o", 3, (void*)modulesobj, 2048); } else { - extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_Options, 32), modulesobj, 2048); + Compiler_FindLocalObjectFiles((void*)linkfiles, 2048); + extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_Options, 32), linkfiles, 2048); } } } diff --git a/bootstrap/unix-48/Configuration.c b/bootstrap/unix-48/Configuration.c index abf165f3..18ec858a 100644 --- a/bootstrap/unix-48/Configuration.c +++ b/bootstrap/unix-48/Configuration.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -19,6 +19,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); + __MOVE("2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); __ENDMOD; } diff --git a/bootstrap/unix-48/Configuration.h b/bootstrap/unix-48/Configuration.h index eb712e53..efd4ae6e 100644 --- a/bootstrap/unix-48/Configuration.h +++ b/bootstrap/unix-48/Configuration.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/unix-48/Files.c b/bootstrap/unix-48/Files.c index d29c5510..dac5c5ff 100644 --- a/bootstrap/unix-48/Files.c +++ b/bootstrap/unix-48/Files.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-48/Files.h b/bootstrap/unix-48/Files.h index e0812a5b..2291d7d8 100644 --- a/bootstrap/unix-48/Files.h +++ b/bootstrap/unix-48/Files.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/unix-48/Heap.c b/bootstrap/unix-48/Heap.c index 495e451c..df3d086b 100644 --- a/bootstrap/unix-48/Heap.c +++ b/bootstrap/unix-48/Heap.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-48/Heap.h b/bootstrap/unix-48/Heap.h index 7429d8c8..7a464dbf 100644 --- a/bootstrap/unix-48/Heap.h +++ b/bootstrap/unix-48/Heap.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/unix-48/Modules.c b/bootstrap/unix-48/Modules.c index 34c15ece..76891be3 100644 --- a/bootstrap/unix-48/Modules.c +++ b/bootstrap/unix-48/Modules.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-48/Modules.h b/bootstrap/unix-48/Modules.h index 42f06075..9f691749 100644 --- a/bootstrap/unix-48/Modules.h +++ b/bootstrap/unix-48/Modules.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/unix-48/OPB.c b/bootstrap/unix-48/OPB.c index c163c77e..3933cee1 100644 --- a/bootstrap/unix-48/OPB.c +++ b/bootstrap/unix-48/OPB.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-48/OPB.h b/bootstrap/unix-48/OPB.h index 7b8e9d38..9f8518b8 100644 --- a/bootstrap/unix-48/OPB.h +++ b/bootstrap/unix-48/OPB.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/unix-48/OPC.c b/bootstrap/unix-48/OPC.c index fef86e9e..24cd4f3f 100644 --- a/bootstrap/unix-48/OPC.c +++ b/bootstrap/unix-48/OPC.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-48/OPC.h b/bootstrap/unix-48/OPC.h index a2b14bdc..99b9afb4 100644 --- a/bootstrap/unix-48/OPC.h +++ b/bootstrap/unix-48/OPC.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/unix-48/OPM.c b/bootstrap/unix-48/OPM.c index d09d6a7a..3411635b 100644 --- a/bootstrap/unix-48/OPM.c +++ b/bootstrap/unix-48/OPM.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -49,7 +49,8 @@ export CHAR OPM_ResourceDir[1024]; static void OPM_Append (Files_Rider *R, ADDRESS *R__typ, Files_File F); export void OPM_CloseFiles (void); export void OPM_CloseOldSym (void); -export void OPM_DeleteNewSym (void); +export void OPM_DeleteNewSym (CHAR *modulename, ADDRESS modulename__len); +export void OPM_DeleteObj (CHAR *modulename, ADDRESS modulename__len); export void OPM_FPrint (INT32 *fp, INT64 val); export void OPM_FPrintLReal (INT32 *fp, LONGREAL val); export void OPM_FPrintReal (INT32 *fp, REAL val); @@ -58,7 +59,7 @@ static void OPM_FindInstallDir (void); static void OPM_FindLine (Files_File f, Files_Rider *r, ADDRESS *r__typ, INT64 pos); static void OPM_FingerprintBytes (INT32 *fp, SYSTEM_BYTE *bytes, ADDRESS bytes__len); export void OPM_Get (CHAR *ch); -export void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len); +export void OPM_Init (BOOLEAN *done); export void OPM_InitOptions (void); export INT16 OPM_Integer (INT64 n); static BOOLEAN OPM_IsProbablyInstallDir (CHAR *s, ADDRESS s__len); @@ -449,7 +450,7 @@ void OPM_InitOptions (void) Files_SetSearchPath(searchpath, 1024); } -void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len) +void OPM_Init (BOOLEAN *done) { Texts_Text T = NIL; INT32 beg, end, time; @@ -465,7 +466,6 @@ void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len) Texts_Open(T, s, 256); OPM_LogWStr(s, 256); OPM_LogWStr((CHAR*)" ", 3); - __COPY(s, mname, mname__len); __COPY(s, OPM_SourceFileName, 256); if (T->len == 0) { OPM_LogWStr(s, 256); @@ -773,7 +773,7 @@ void OPM_OldSym (CHAR *modName, ADDRESS modName__len, BOOLEAN *done) Files_Set(&OPM_oldSF, Files_Rider__typ, OPM_oldSFile, 0); Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&tag); Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&ver); - if (tag != 0xf7 || ver != 0x82) { + if (tag != 0xf7 || ver != 0x83) { OPM_err(-306); OPM_CloseOldSym(); *done = 0; @@ -818,8 +818,20 @@ void OPM_RegisterNewSym (void) } } -void OPM_DeleteNewSym (void) +void OPM_DeleteNewSym (CHAR *modulename, ADDRESS modulename__len) { + OPM_FileName fn; + INT16 res; + OPM_MakeFileName((void*)modulename, modulename__len, (void*)fn, 32, (CHAR*)".sym", 5); + Files_Delete(fn, 32, &res); +} + +void OPM_DeleteObj (CHAR *modulename, ADDRESS modulename__len) +{ + OPM_FileName fn; + INT16 res; + OPM_MakeFileName((void*)modulename, modulename__len, (void*)fn, 32, (CHAR*)".o", 3); + Files_Delete(fn, 32, &res); } void OPM_NewSym (CHAR *modName, ADDRESS modName__len) @@ -830,7 +842,7 @@ void OPM_NewSym (CHAR *modName, ADDRESS modName__len) if (OPM_newSFile != NIL) { Files_Set(&OPM_newSF, Files_Rider__typ, OPM_newSFile, 0); Files_Write(&OPM_newSF, Files_Rider__typ, 0xf7); - Files_Write(&OPM_newSF, Files_Rider__typ, 0x82); + Files_Write(&OPM_newSF, Files_Rider__typ, 0x83); } else { OPM_err(153); } @@ -984,7 +996,7 @@ static void OPM_Append (Files_Rider *R, ADDRESS *R__typ, Files_File F) void OPM_OpenFiles (CHAR *moduleName, ADDRESS moduleName__len) { - CHAR FName[32]; + OPM_FileName FName; __COPY(moduleName, OPM_modName, 32); OPM_HFile = Files_New((CHAR*)"", 1); if (OPM_HFile != NIL) { @@ -1010,7 +1022,7 @@ void OPM_OpenFiles (CHAR *moduleName, ADDRESS moduleName__len) void OPM_CloseFiles (void) { - CHAR FName[32]; + OPM_FileName FName; INT16 res; if (OPM_noerr) { OPM_LogWStr((CHAR*)" ", 3); @@ -1048,26 +1060,26 @@ void OPM_CloseFiles (void) static BOOLEAN OPM_IsProbablyInstallDir (CHAR *s, ADDRESS s__len) { - CHAR testpath[1024]; + CHAR testpath[4096]; Platform_FileIdentity identity; __DUP(s, s__len, CHAR); - __COPY(OPM_InstallDir, testpath, 1024); - Strings_Append((CHAR*)"/lib/lib", 9, (void*)testpath, 1024); - Strings_Append((CHAR*)"voc", 4, (void*)testpath, 1024); - Strings_Append((CHAR*)"-O2.a", 6, (void*)testpath, 1024); - if (Platform_IdentifyByName(testpath, 1024, &identity, Platform_FileIdentity__typ) != 0) { + __COPY(OPM_InstallDir, testpath, 4096); + Strings_Append((CHAR*)"/lib/lib", 9, (void*)testpath, 4096); + Strings_Append((CHAR*)"voc", 4, (void*)testpath, 4096); + Strings_Append((CHAR*)"-O2.a", 6, (void*)testpath, 4096); + if (Platform_IdentifyByName(testpath, 4096, &identity, Platform_FileIdentity__typ) != 0) { __DEL(s); return 0; } - __COPY(OPM_InstallDir, testpath, 1024); - Strings_Append((CHAR*)"/2/include/Oberon.h", 20, (void*)testpath, 1024); - if (Platform_IdentifyByName(testpath, 1024, &identity, Platform_FileIdentity__typ) != 0) { + __COPY(OPM_InstallDir, testpath, 4096); + Strings_Append((CHAR*)"/2/include/Oberon.h", 20, (void*)testpath, 4096); + if (Platform_IdentifyByName(testpath, 4096, &identity, Platform_FileIdentity__typ) != 0) { __DEL(s); return 0; } - __COPY(OPM_InstallDir, testpath, 1024); - Strings_Append((CHAR*)"/2/sym/Files.sym", 17, (void*)testpath, 1024); - if (Platform_IdentifyByName(testpath, 1024, &identity, Platform_FileIdentity__typ) != 0) { + __COPY(OPM_InstallDir, testpath, 4096); + Strings_Append((CHAR*)"/2/sym/Files.sym", 17, (void*)testpath, 4096); + if (Platform_IdentifyByName(testpath, 4096, &identity, Platform_FileIdentity__typ) != 0) { __DEL(s); return 0; } @@ -1129,7 +1141,6 @@ export void *OPM__init(void) __REGMOD("OPM", EnumPtrs); __REGCMD("CloseFiles", OPM_CloseFiles); __REGCMD("CloseOldSym", OPM_CloseOldSym); - __REGCMD("DeleteNewSym", OPM_DeleteNewSym); __REGCMD("InitOptions", OPM_InitOptions); __REGCMD("LogWLn", OPM_LogWLn); __REGCMD("RegisterNewSym", OPM_RegisterNewSym); diff --git a/bootstrap/unix-48/OPM.h b/bootstrap/unix-48/OPM.h index dc86bc49..da0a48ee 100644 --- a/bootstrap/unix-48/OPM.h +++ b/bootstrap/unix-48/OPM.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPM__h #define OPM__h @@ -23,13 +23,14 @@ import CHAR OPM_ResourceDir[1024]; import void OPM_CloseFiles (void); import void OPM_CloseOldSym (void); -import void OPM_DeleteNewSym (void); +import void OPM_DeleteNewSym (CHAR *modulename, ADDRESS modulename__len); +import void OPM_DeleteObj (CHAR *modulename, ADDRESS modulename__len); import void OPM_FPrint (INT32 *fp, INT64 val); import void OPM_FPrintLReal (INT32 *fp, LONGREAL val); import void OPM_FPrintReal (INT32 *fp, REAL val); import void OPM_FPrintSet (INT32 *fp, UINT64 val); import void OPM_Get (CHAR *ch); -import void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len); +import void OPM_Init (BOOLEAN *done); import void OPM_InitOptions (void); import INT16 OPM_Integer (INT64 n); import void OPM_LogVT100 (CHAR *vt100code, ADDRESS vt100code__len); diff --git a/bootstrap/unix-48/OPP.c b/bootstrap/unix-48/OPP.c index 24e6b221..aad8367d 100644 --- a/bootstrap/unix-48/OPP.c +++ b/bootstrap/unix-48/OPP.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -1793,24 +1793,6 @@ void OPP_Module (OPT_Node *prog, UINT32 opt) if (OPP_sym == 63) { OPS_Get(&OPP_sym); } else { - OPM_LogWLn(); - OPM_LogWStr((CHAR*)"Unexpected symbol found when MODULE expected:", 46); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" sym: ", 15); - OPM_LogWNum(OPP_sym, 1); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" OPS.name: ", 15); - OPM_LogWStr(OPS_name, 256); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" OPS.str: ", 15); - OPM_LogWStr(OPS_str, 256); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" OPS.numtyp: ", 15); - OPM_LogWNum(OPS_numtyp, 1); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" OPS.intval: ", 15); - OPM_LogWNum(OPS_intval, 1); - OPM_LogWLn(); OPP_err(16); } if (OPP_sym == 38) { diff --git a/bootstrap/unix-48/OPP.h b/bootstrap/unix-48/OPP.h index bf0f96d7..dc8aa405 100644 --- a/bootstrap/unix-48/OPP.h +++ b/bootstrap/unix-48/OPP.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/unix-48/OPS.c b/bootstrap/unix-48/OPS.c index 807c0ce5..d0a1851a 100644 --- a/bootstrap/unix-48/OPS.c +++ b/bootstrap/unix-48/OPS.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-48/OPS.h b/bootstrap/unix-48/OPS.h index a15d8712..608979a8 100644 --- a/bootstrap/unix-48/OPS.h +++ b/bootstrap/unix-48/OPS.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/unix-48/OPT.c b/bootstrap/unix-48/OPT.c index e9db362e..b95c2810 100644 --- a/bootstrap/unix-48/OPT.c +++ b/bootstrap/unix-48/OPT.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -49,6 +49,15 @@ typedef INT8 glbmno[64]; } OPT_ImpCtxt; +typedef + struct OPT_LinkDesc *OPT_Link; + +typedef + struct OPT_LinkDesc { + OPS_Name name; + OPT_Link next; + } OPT_LinkDesc; + typedef struct OPT_NodeDesc *OPT_Node; @@ -101,6 +110,7 @@ static OPT_ExpCtxt OPT_expCtxt; static INT32 OPT_nofhdfld; static BOOLEAN OPT_newsf, OPT_findpc, OPT_extsf, OPT_sfpresent, OPT_symExtended, OPT_symNew; static INT32 OPT_recno; +export OPT_Link OPT_Links; export ADDRESS *OPT_ConstDesc__typ; export ADDRESS *OPT_ObjDesc__typ; @@ -108,6 +118,7 @@ export ADDRESS *OPT_StrDesc__typ; export ADDRESS *OPT_NodeDesc__typ; export ADDRESS *OPT_ImpCtxt__typ; export ADDRESS *OPT_ExpCtxt__typ; +export ADDRESS *OPT_LinkDesc__typ; export void OPT_Align (INT32 *adr, INT32 base); export INT32 OPT_BaseAlignment (OPT_Struct typ); @@ -131,6 +142,7 @@ export void OPT_IdFPrint (OPT_Struct typ); export void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done); static void OPT_InConstant (INT32 f, OPT_Const conval); static OPT_Object OPT_InFld (void); +static void OPT_InLinks (void); static void OPT_InMod (INT8 *mno); static void OPT_InName (CHAR *name, ADDRESS name__len); static OPT_Object OPT_InObj (INT8 mno); @@ -154,6 +166,7 @@ export void OPT_OpenScope (INT8 level, OPT_Object owner); static void OPT_OutConstant (OPT_Object obj); static void OPT_OutFlds (OPT_Object fld, INT32 adr, BOOLEAN visible); static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, INT32 adr); +static void OPT_OutLinks (void); static void OPT_OutMod (INT16 mno); static void OPT_OutName (CHAR *name, ADDRESS name__len); static void OPT_OutObj (OPT_Object obj); @@ -442,6 +455,8 @@ void OPT_Init (OPS_Name name, UINT32 opt) OPT_findpc = __IN(8, opt, 32); OPT_extsf = OPT_newsf || __IN(9, opt, 32); OPT_sfpresent = 1; + __NEW(OPT_Links, OPT_LinkDesc); + __MOVE(name, OPT_Links->name, 256); } void OPT_Close (void) @@ -1011,6 +1026,26 @@ static void OPT_InMod (INT8 *mno) } } +static void OPT_InLinks (void) +{ + OPS_Name linkname; + OPT_Link l = NIL; + OPT_InName((void*)linkname, 256); + while (linkname[0] != 0x00) { + l = OPT_Links; + while ((l != NIL && __STRCMP(l->name, linkname) != 0)) { + l = l->next; + } + if (l == NIL) { + l = OPT_Links; + __NEW(OPT_Links, OPT_LinkDesc); + OPT_Links->next = l; + __MOVE(linkname, OPT_Links->name, 256); + } + OPT_InName((void*)linkname, 256); + } +} + static void OPT_InConstant (INT32 f, OPT_Const conval) { CHAR ch; @@ -1461,6 +1496,7 @@ void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done) OPM_OldSym((void*)name, 256, &*done); if (*done) { OPT_InMod(&mno); + OPT_InLinks(); OPT_impCtxt.nextTag = OPM_SymRInt(); while (!OPM_eofSF()) { obj = OPT_InObj(mno); @@ -1507,6 +1543,17 @@ static void OPT_OutMod (INT16 mno) } } +static void OPT_OutLinks (void) +{ + OPT_Link l = NIL; + l = OPT_Links; + while (l != NIL) { + OPT_OutName((void*)l->name, 256); + l = l->next; + } + OPM_SymWCh(0x00); +} + static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, INT32 adr) { INT32 i, j, n; @@ -1833,6 +1880,7 @@ void OPT_Export (BOOLEAN *ext, BOOLEAN *new) if (OPM_noerr) { OPM_SymWInt(16); OPT_OutName((void*)OPT_SelfName, 256); + OPT_OutLinks(); OPT_expCtxt.reffp = 0; OPT_expCtxt.ref = 14; OPT_expCtxt.nofm = 1; @@ -1854,7 +1902,7 @@ void OPT_Export (BOOLEAN *ext, BOOLEAN *new) OPT_newsf = 0; OPT_symNew = 0; if (!OPM_noerr || OPT_findpc) { - OPM_DeleteNewSym(); + OPM_DeleteNewSym((void*)OPT_SelfName, 256); } } } @@ -1969,6 +2017,7 @@ static void EnumPtrs(void (*P)(void*)) P(OPT_universe); P(OPT_syslink); __ENUMR(&OPT_impCtxt, OPT_ImpCtxt__typ, 3140, 1, P); + P(OPT_Links); } __TDESC(OPT_ConstDesc, 1, 1) = {__TDFLDS("ConstDesc", 40), {0, -8}}; @@ -2008,6 +2057,7 @@ __TDESC(OPT_ImpCtxt, 1, 510) = {__TDFLDS("ImpCtxt", 3140), {16, 20, 24, 28, 32, 1936, 1940, 1944, 1948, 1952, 1956, 1960, 1964, 1968, 1972, 1976, 1980, 1984, 1988, 1992, 1996, 2000, 2004, 2008, 2012, 2016, 2020, 2024, 2028, 2032, 2036, 2040, 2044, 2048, 2052, -2044}}; __TDESC(OPT_ExpCtxt, 1, 0) = {__TDFLDS("ExpCtxt", 72), {-4}}; +__TDESC(OPT_LinkDesc, 1, 1) = {__TDFLDS("LinkDesc", 260), {256, -8}}; export void *OPT__init(void) { @@ -2024,6 +2074,7 @@ export void *OPT__init(void) __INITYP(OPT_NodeDesc, OPT_NodeDesc, 0); __INITYP(OPT_ImpCtxt, OPT_ImpCtxt, 0); __INITYP(OPT_ExpCtxt, OPT_ExpCtxt, 0); + __INITYP(OPT_LinkDesc, OPT_LinkDesc, 0); /* BEGIN */ OPT_topScope = NIL; OPT_OpenScope(0, NIL); diff --git a/bootstrap/unix-48/OPT.h b/bootstrap/unix-48/OPT.h index 9a187fc7..7483f169 100644 --- a/bootstrap/unix-48/OPT.h +++ b/bootstrap/unix-48/OPT.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPT__h #define OPT__h @@ -21,6 +21,15 @@ typedef LONGREAL realval; } OPT_ConstDesc; +typedef + struct OPT_LinkDesc *OPT_Link; + +typedef + struct OPT_LinkDesc { + OPS_Name name; + OPT_Link next; + } OPT_LinkDesc; + typedef struct OPT_NodeDesc *OPT_Node; @@ -75,11 +84,13 @@ import INT8 OPT_nofGmod; import OPT_Object OPT_GlbMod[64]; import OPS_Name OPT_SelfName; import BOOLEAN OPT_SYSimported; +import OPT_Link OPT_Links; import ADDRESS *OPT_ConstDesc__typ; import ADDRESS *OPT_ObjDesc__typ; import ADDRESS *OPT_StrDesc__typ; import ADDRESS *OPT_NodeDesc__typ; +import ADDRESS *OPT_LinkDesc__typ; import void OPT_Align (INT32 *adr, INT32 base); import INT32 OPT_BaseAlignment (OPT_Struct typ); diff --git a/bootstrap/unix-48/OPV.c b/bootstrap/unix-48/OPV.c index 96252046..152db225 100644 --- a/bootstrap/unix-48/OPV.c +++ b/bootstrap/unix-48/OPV.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-48/OPV.h b/bootstrap/unix-48/OPV.h index 5654d36e..7c94fced 100644 --- a/bootstrap/unix-48/OPV.h +++ b/bootstrap/unix-48/OPV.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/unix-48/Out.c b/bootstrap/unix-48/Out.c index 9248cfc5..d1fba01a 100644 --- a/bootstrap/unix-48/Out.c +++ b/bootstrap/unix-48/Out.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-48/Out.h b/bootstrap/unix-48/Out.h index ffbd6894..a7195e3a 100644 --- a/bootstrap/unix-48/Out.h +++ b/bootstrap/unix-48/Out.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Out__h #define Out__h diff --git a/bootstrap/unix-48/Platform.c b/bootstrap/unix-48/Platform.c index 027176ed..6117b38b 100644 --- a/bootstrap/unix-48/Platform.c +++ b/bootstrap/unix-48/Platform.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-48/Platform.h b/bootstrap/unix-48/Platform.h index 79d88e9d..521594dc 100644 --- a/bootstrap/unix-48/Platform.h +++ b/bootstrap/unix-48/Platform.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/unix-48/Reals.c b/bootstrap/unix-48/Reals.c index 2ecd8371..11ad01bd 100644 --- a/bootstrap/unix-48/Reals.c +++ b/bootstrap/unix-48/Reals.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-48/Reals.h b/bootstrap/unix-48/Reals.h index 570e7d72..bf708519 100644 --- a/bootstrap/unix-48/Reals.h +++ b/bootstrap/unix-48/Reals.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/unix-48/Strings.c b/bootstrap/unix-48/Strings.c index f911a688..06972c90 100644 --- a/bootstrap/unix-48/Strings.c +++ b/bootstrap/unix-48/Strings.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-48/Strings.h b/bootstrap/unix-48/Strings.h index 7645aa6e..fd7f283d 100644 --- a/bootstrap/unix-48/Strings.h +++ b/bootstrap/unix-48/Strings.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/unix-48/Texts.c b/bootstrap/unix-48/Texts.c index c0bfc16a..285e7ac0 100644 --- a/bootstrap/unix-48/Texts.c +++ b/bootstrap/unix-48/Texts.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-48/Texts.h b/bootstrap/unix-48/Texts.h index cd0f72ee..7f7d6562 100644 --- a/bootstrap/unix-48/Texts.h +++ b/bootstrap/unix-48/Texts.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/unix-48/VT100.c b/bootstrap/unix-48/VT100.c index 1e0fffa9..baa92092 100644 --- a/bootstrap/unix-48/VT100.c +++ b/bootstrap/unix-48/VT100.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-48/VT100.h b/bootstrap/unix-48/VT100.h index 7522f9d1..4c0087ac 100644 --- a/bootstrap/unix-48/VT100.h +++ b/bootstrap/unix-48/VT100.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef VT100__h #define VT100__h diff --git a/bootstrap/unix-48/extTools.c b/bootstrap/unix-48/extTools.c index d2c67400..75768aca 100644 --- a/bootstrap/unix-48/extTools.c +++ b/bootstrap/unix-48/extTools.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-48/extTools.h b/bootstrap/unix-48/extTools.h index fb167591..fb870961 100644 --- a/bootstrap/unix-48/extTools.h +++ b/bootstrap/unix-48/extTools.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/unix-88/Compiler.c b/bootstrap/unix-88/Compiler.c index 454ea490..f26c1a32 100644 --- a/bootstrap/unix-88/Compiler.c +++ b/bootstrap/unix-88/Compiler.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */ #define SHORTINT INT8 #define INTEGER INT16 @@ -20,9 +20,9 @@ #include "extTools.h" -static CHAR Compiler_mname[256]; +static void Compiler_FindLocalObjectFiles (CHAR *objectnames, ADDRESS objectnames__len); export void Compiler_Module (BOOLEAN *done); static void Compiler_PropagateElementaryTypeSizes (void); export void Compiler_Translate (void); @@ -41,11 +41,12 @@ void Compiler_Module (BOOLEAN *done) OPT_Export(&ext, &new); if (OPM_noerr) { OPM_OpenFiles((void*)OPT_SelfName, 256); + OPM_DeleteObj((void*)OPT_SelfName, 256); OPC_Init(); OPV_Module(p); if (OPM_noerr) { if ((__IN(10, OPM_Options, 32) && __STRCMP(OPM_modName, "SYSTEM") != 0)) { - OPM_DeleteNewSym(); + OPM_DeleteNewSym((void*)OPT_SelfName, 256); OPM_LogVT100((CHAR*)"32m", 4); OPM_LogWStr((CHAR*)" Main program.", 16); OPM_LogVT100((CHAR*)"0m", 3); @@ -61,7 +62,7 @@ void Compiler_Module (BOOLEAN *done) } } } else { - OPM_DeleteNewSym(); + OPM_DeleteNewSym((void*)OPT_SelfName, 256); } } } @@ -104,14 +105,44 @@ static void Compiler_PropagateElementaryTypeSizes (void) } } +static void Compiler_FindLocalObjectFiles (CHAR *objectnames, ADDRESS objectnames__len) +{ + OPT_Link l = NIL; + CHAR fn[64]; + Platform_FileIdentity id; + objectnames[0] = 0x00; + l = OPT_Links; + while (l != NIL) { + __COPY(l->name, fn, 64); + Strings_Append((CHAR*)".sym", 5, (void*)fn, 64); + if (Platform_IdentifyByName(fn, 64, &id, Platform_FileIdentity__typ) == 0) { + __COPY(l->name, fn, 64); + Strings_Append((CHAR*)".o", 3, (void*)fn, 64); + if (Platform_IdentifyByName(fn, 64, &id, Platform_FileIdentity__typ) == 0) { + Strings_Append((CHAR*)" ", 2, (void*)objectnames, objectnames__len); + Strings_Append(fn, 64, (void*)objectnames, objectnames__len); + } else { + OPM_LogVT100((CHAR*)"33m", 4); + OPM_LogWStr((CHAR*)"Link warning: a local symbol file is present for module ", 57); + OPM_LogWStr(l->name, 256); + OPM_LogWStr((CHAR*)", but local object file '", 26); + OPM_LogWStr(fn, 64); + OPM_LogWStr((CHAR*)"' is missing.", 14); + OPM_LogVT100((CHAR*)"0m", 3); + OPM_LogWLn(); + } + } + l = l->next; + } +} + void Compiler_Translate (void) { BOOLEAN done; - CHAR modulesobj[2048]; - modulesobj[0] = 0x00; + CHAR linkfiles[2048]; if (OPM_OpenPar()) { for (;;) { - OPM_Init(&done, (void*)Compiler_mname, 256); + OPM_Init(&done); if (!done) { return; } @@ -131,11 +162,9 @@ void Compiler_Translate (void) } else { if (!__IN(10, OPM_Options, 32)) { extTools_Assemble(OPM_modName, 32); - Strings_Append((CHAR*)" ", 2, (void*)modulesobj, 2048); - Strings_Append(OPM_modName, 32, (void*)modulesobj, 2048); - Strings_Append((CHAR*)".o", 3, (void*)modulesobj, 2048); } else { - extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_Options, 32), modulesobj, 2048); + Compiler_FindLocalObjectFiles((void*)linkfiles, 2048); + extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_Options, 32), linkfiles, 2048); } } } diff --git a/bootstrap/unix-88/Configuration.c b/bootstrap/unix-88/Configuration.c index abf165f3..18ec858a 100644 --- a/bootstrap/unix-88/Configuration.c +++ b/bootstrap/unix-88/Configuration.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -19,6 +19,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); + __MOVE("2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); __ENDMOD; } diff --git a/bootstrap/unix-88/Configuration.h b/bootstrap/unix-88/Configuration.h index eb712e53..efd4ae6e 100644 --- a/bootstrap/unix-88/Configuration.h +++ b/bootstrap/unix-88/Configuration.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/unix-88/Files.c b/bootstrap/unix-88/Files.c index 3aeb5911..4a5cec7c 100644 --- a/bootstrap/unix-88/Files.c +++ b/bootstrap/unix-88/Files.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-88/Files.h b/bootstrap/unix-88/Files.h index b67b65f7..987ffaf2 100644 --- a/bootstrap/unix-88/Files.h +++ b/bootstrap/unix-88/Files.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/unix-88/Heap.c b/bootstrap/unix-88/Heap.c index 3f4e96ee..ba215672 100644 --- a/bootstrap/unix-88/Heap.c +++ b/bootstrap/unix-88/Heap.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-88/Heap.h b/bootstrap/unix-88/Heap.h index aac7c8fe..bbd83594 100644 --- a/bootstrap/unix-88/Heap.h +++ b/bootstrap/unix-88/Heap.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/unix-88/Modules.c b/bootstrap/unix-88/Modules.c index 821e6801..037d74d0 100644 --- a/bootstrap/unix-88/Modules.c +++ b/bootstrap/unix-88/Modules.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-88/Modules.h b/bootstrap/unix-88/Modules.h index c7f011df..be3fd68b 100644 --- a/bootstrap/unix-88/Modules.h +++ b/bootstrap/unix-88/Modules.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/unix-88/OPB.c b/bootstrap/unix-88/OPB.c index c163c77e..3933cee1 100644 --- a/bootstrap/unix-88/OPB.c +++ b/bootstrap/unix-88/OPB.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-88/OPB.h b/bootstrap/unix-88/OPB.h index 7b8e9d38..9f8518b8 100644 --- a/bootstrap/unix-88/OPB.h +++ b/bootstrap/unix-88/OPB.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/unix-88/OPC.c b/bootstrap/unix-88/OPC.c index fef86e9e..24cd4f3f 100644 --- a/bootstrap/unix-88/OPC.c +++ b/bootstrap/unix-88/OPC.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-88/OPC.h b/bootstrap/unix-88/OPC.h index a2b14bdc..99b9afb4 100644 --- a/bootstrap/unix-88/OPC.h +++ b/bootstrap/unix-88/OPC.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/unix-88/OPM.c b/bootstrap/unix-88/OPM.c index cb39afd5..2bc2c145 100644 --- a/bootstrap/unix-88/OPM.c +++ b/bootstrap/unix-88/OPM.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -49,7 +49,8 @@ export CHAR OPM_ResourceDir[1024]; static void OPM_Append (Files_Rider *R, ADDRESS *R__typ, Files_File F); export void OPM_CloseFiles (void); export void OPM_CloseOldSym (void); -export void OPM_DeleteNewSym (void); +export void OPM_DeleteNewSym (CHAR *modulename, ADDRESS modulename__len); +export void OPM_DeleteObj (CHAR *modulename, ADDRESS modulename__len); export void OPM_FPrint (INT32 *fp, INT64 val); export void OPM_FPrintLReal (INT32 *fp, LONGREAL val); export void OPM_FPrintReal (INT32 *fp, REAL val); @@ -58,7 +59,7 @@ static void OPM_FindInstallDir (void); static void OPM_FindLine (Files_File f, Files_Rider *r, ADDRESS *r__typ, INT64 pos); static void OPM_FingerprintBytes (INT32 *fp, SYSTEM_BYTE *bytes, ADDRESS bytes__len); export void OPM_Get (CHAR *ch); -export void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len); +export void OPM_Init (BOOLEAN *done); export void OPM_InitOptions (void); export INT16 OPM_Integer (INT64 n); static BOOLEAN OPM_IsProbablyInstallDir (CHAR *s, ADDRESS s__len); @@ -449,7 +450,7 @@ void OPM_InitOptions (void) Files_SetSearchPath(searchpath, 1024); } -void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len) +void OPM_Init (BOOLEAN *done) { Texts_Text T = NIL; INT32 beg, end, time; @@ -465,7 +466,6 @@ void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len) Texts_Open(T, s, 256); OPM_LogWStr(s, 256); OPM_LogWStr((CHAR*)" ", 3); - __COPY(s, mname, mname__len); __COPY(s, OPM_SourceFileName, 256); if (T->len == 0) { OPM_LogWStr(s, 256); @@ -773,7 +773,7 @@ void OPM_OldSym (CHAR *modName, ADDRESS modName__len, BOOLEAN *done) Files_Set(&OPM_oldSF, Files_Rider__typ, OPM_oldSFile, 0); Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&tag); Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&ver); - if (tag != 0xf7 || ver != 0x82) { + if (tag != 0xf7 || ver != 0x83) { OPM_err(-306); OPM_CloseOldSym(); *done = 0; @@ -818,8 +818,20 @@ void OPM_RegisterNewSym (void) } } -void OPM_DeleteNewSym (void) +void OPM_DeleteNewSym (CHAR *modulename, ADDRESS modulename__len) { + OPM_FileName fn; + INT16 res; + OPM_MakeFileName((void*)modulename, modulename__len, (void*)fn, 32, (CHAR*)".sym", 5); + Files_Delete(fn, 32, &res); +} + +void OPM_DeleteObj (CHAR *modulename, ADDRESS modulename__len) +{ + OPM_FileName fn; + INT16 res; + OPM_MakeFileName((void*)modulename, modulename__len, (void*)fn, 32, (CHAR*)".o", 3); + Files_Delete(fn, 32, &res); } void OPM_NewSym (CHAR *modName, ADDRESS modName__len) @@ -830,7 +842,7 @@ void OPM_NewSym (CHAR *modName, ADDRESS modName__len) if (OPM_newSFile != NIL) { Files_Set(&OPM_newSF, Files_Rider__typ, OPM_newSFile, 0); Files_Write(&OPM_newSF, Files_Rider__typ, 0xf7); - Files_Write(&OPM_newSF, Files_Rider__typ, 0x82); + Files_Write(&OPM_newSF, Files_Rider__typ, 0x83); } else { OPM_err(153); } @@ -984,7 +996,7 @@ static void OPM_Append (Files_Rider *R, ADDRESS *R__typ, Files_File F) void OPM_OpenFiles (CHAR *moduleName, ADDRESS moduleName__len) { - CHAR FName[32]; + OPM_FileName FName; __COPY(moduleName, OPM_modName, 32); OPM_HFile = Files_New((CHAR*)"", 1); if (OPM_HFile != NIL) { @@ -1010,7 +1022,7 @@ void OPM_OpenFiles (CHAR *moduleName, ADDRESS moduleName__len) void OPM_CloseFiles (void) { - CHAR FName[32]; + OPM_FileName FName; INT16 res; if (OPM_noerr) { OPM_LogWStr((CHAR*)" ", 3); @@ -1048,26 +1060,26 @@ void OPM_CloseFiles (void) static BOOLEAN OPM_IsProbablyInstallDir (CHAR *s, ADDRESS s__len) { - CHAR testpath[1024]; + CHAR testpath[4096]; Platform_FileIdentity identity; __DUP(s, s__len, CHAR); - __COPY(OPM_InstallDir, testpath, 1024); - Strings_Append((CHAR*)"/lib/lib", 9, (void*)testpath, 1024); - Strings_Append((CHAR*)"voc", 4, (void*)testpath, 1024); - Strings_Append((CHAR*)"-O2.a", 6, (void*)testpath, 1024); - if (Platform_IdentifyByName(testpath, 1024, &identity, Platform_FileIdentity__typ) != 0) { + __COPY(OPM_InstallDir, testpath, 4096); + Strings_Append((CHAR*)"/lib/lib", 9, (void*)testpath, 4096); + Strings_Append((CHAR*)"voc", 4, (void*)testpath, 4096); + Strings_Append((CHAR*)"-O2.a", 6, (void*)testpath, 4096); + if (Platform_IdentifyByName(testpath, 4096, &identity, Platform_FileIdentity__typ) != 0) { __DEL(s); return 0; } - __COPY(OPM_InstallDir, testpath, 1024); - Strings_Append((CHAR*)"/2/include/Oberon.h", 20, (void*)testpath, 1024); - if (Platform_IdentifyByName(testpath, 1024, &identity, Platform_FileIdentity__typ) != 0) { + __COPY(OPM_InstallDir, testpath, 4096); + Strings_Append((CHAR*)"/2/include/Oberon.h", 20, (void*)testpath, 4096); + if (Platform_IdentifyByName(testpath, 4096, &identity, Platform_FileIdentity__typ) != 0) { __DEL(s); return 0; } - __COPY(OPM_InstallDir, testpath, 1024); - Strings_Append((CHAR*)"/2/sym/Files.sym", 17, (void*)testpath, 1024); - if (Platform_IdentifyByName(testpath, 1024, &identity, Platform_FileIdentity__typ) != 0) { + __COPY(OPM_InstallDir, testpath, 4096); + Strings_Append((CHAR*)"/2/sym/Files.sym", 17, (void*)testpath, 4096); + if (Platform_IdentifyByName(testpath, 4096, &identity, Platform_FileIdentity__typ) != 0) { __DEL(s); return 0; } @@ -1129,7 +1141,6 @@ export void *OPM__init(void) __REGMOD("OPM", EnumPtrs); __REGCMD("CloseFiles", OPM_CloseFiles); __REGCMD("CloseOldSym", OPM_CloseOldSym); - __REGCMD("DeleteNewSym", OPM_DeleteNewSym); __REGCMD("InitOptions", OPM_InitOptions); __REGCMD("LogWLn", OPM_LogWLn); __REGCMD("RegisterNewSym", OPM_RegisterNewSym); diff --git a/bootstrap/unix-88/OPM.h b/bootstrap/unix-88/OPM.h index dc86bc49..da0a48ee 100644 --- a/bootstrap/unix-88/OPM.h +++ b/bootstrap/unix-88/OPM.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPM__h #define OPM__h @@ -23,13 +23,14 @@ import CHAR OPM_ResourceDir[1024]; import void OPM_CloseFiles (void); import void OPM_CloseOldSym (void); -import void OPM_DeleteNewSym (void); +import void OPM_DeleteNewSym (CHAR *modulename, ADDRESS modulename__len); +import void OPM_DeleteObj (CHAR *modulename, ADDRESS modulename__len); import void OPM_FPrint (INT32 *fp, INT64 val); import void OPM_FPrintLReal (INT32 *fp, LONGREAL val); import void OPM_FPrintReal (INT32 *fp, REAL val); import void OPM_FPrintSet (INT32 *fp, UINT64 val); import void OPM_Get (CHAR *ch); -import void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len); +import void OPM_Init (BOOLEAN *done); import void OPM_InitOptions (void); import INT16 OPM_Integer (INT64 n); import void OPM_LogVT100 (CHAR *vt100code, ADDRESS vt100code__len); diff --git a/bootstrap/unix-88/OPP.c b/bootstrap/unix-88/OPP.c index 25c453d1..0a6a6796 100644 --- a/bootstrap/unix-88/OPP.c +++ b/bootstrap/unix-88/OPP.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -1793,24 +1793,6 @@ void OPP_Module (OPT_Node *prog, UINT32 opt) if (OPP_sym == 63) { OPS_Get(&OPP_sym); } else { - OPM_LogWLn(); - OPM_LogWStr((CHAR*)"Unexpected symbol found when MODULE expected:", 46); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" sym: ", 15); - OPM_LogWNum(OPP_sym, 1); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" OPS.name: ", 15); - OPM_LogWStr(OPS_name, 256); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" OPS.str: ", 15); - OPM_LogWStr(OPS_str, 256); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" OPS.numtyp: ", 15); - OPM_LogWNum(OPS_numtyp, 1); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" OPS.intval: ", 15); - OPM_LogWNum(OPS_intval, 1); - OPM_LogWLn(); OPP_err(16); } if (OPP_sym == 38) { diff --git a/bootstrap/unix-88/OPP.h b/bootstrap/unix-88/OPP.h index bf0f96d7..dc8aa405 100644 --- a/bootstrap/unix-88/OPP.h +++ b/bootstrap/unix-88/OPP.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/unix-88/OPS.c b/bootstrap/unix-88/OPS.c index 807c0ce5..d0a1851a 100644 --- a/bootstrap/unix-88/OPS.c +++ b/bootstrap/unix-88/OPS.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-88/OPS.h b/bootstrap/unix-88/OPS.h index a15d8712..608979a8 100644 --- a/bootstrap/unix-88/OPS.h +++ b/bootstrap/unix-88/OPS.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/unix-88/OPT.c b/bootstrap/unix-88/OPT.c index 8fb5d86e..1a106cda 100644 --- a/bootstrap/unix-88/OPT.c +++ b/bootstrap/unix-88/OPT.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -49,6 +49,15 @@ typedef INT8 glbmno[64]; } OPT_ImpCtxt; +typedef + struct OPT_LinkDesc *OPT_Link; + +typedef + struct OPT_LinkDesc { + OPS_Name name; + OPT_Link next; + } OPT_LinkDesc; + typedef struct OPT_NodeDesc *OPT_Node; @@ -101,6 +110,7 @@ static OPT_ExpCtxt OPT_expCtxt; static INT32 OPT_nofhdfld; static BOOLEAN OPT_newsf, OPT_findpc, OPT_extsf, OPT_sfpresent, OPT_symExtended, OPT_symNew; static INT32 OPT_recno; +export OPT_Link OPT_Links; export ADDRESS *OPT_ConstDesc__typ; export ADDRESS *OPT_ObjDesc__typ; @@ -108,6 +118,7 @@ export ADDRESS *OPT_StrDesc__typ; export ADDRESS *OPT_NodeDesc__typ; export ADDRESS *OPT_ImpCtxt__typ; export ADDRESS *OPT_ExpCtxt__typ; +export ADDRESS *OPT_LinkDesc__typ; export void OPT_Align (INT32 *adr, INT32 base); export INT32 OPT_BaseAlignment (OPT_Struct typ); @@ -131,6 +142,7 @@ export void OPT_IdFPrint (OPT_Struct typ); export void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done); static void OPT_InConstant (INT32 f, OPT_Const conval); static OPT_Object OPT_InFld (void); +static void OPT_InLinks (void); static void OPT_InMod (INT8 *mno); static void OPT_InName (CHAR *name, ADDRESS name__len); static OPT_Object OPT_InObj (INT8 mno); @@ -154,6 +166,7 @@ export void OPT_OpenScope (INT8 level, OPT_Object owner); static void OPT_OutConstant (OPT_Object obj); static void OPT_OutFlds (OPT_Object fld, INT32 adr, BOOLEAN visible); static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, INT32 adr); +static void OPT_OutLinks (void); static void OPT_OutMod (INT16 mno); static void OPT_OutName (CHAR *name, ADDRESS name__len); static void OPT_OutObj (OPT_Object obj); @@ -442,6 +455,8 @@ void OPT_Init (OPS_Name name, UINT32 opt) OPT_findpc = __IN(8, opt, 32); OPT_extsf = OPT_newsf || __IN(9, opt, 32); OPT_sfpresent = 1; + __NEW(OPT_Links, OPT_LinkDesc); + __MOVE(name, OPT_Links->name, 256); } void OPT_Close (void) @@ -1011,6 +1026,26 @@ static void OPT_InMod (INT8 *mno) } } +static void OPT_InLinks (void) +{ + OPS_Name linkname; + OPT_Link l = NIL; + OPT_InName((void*)linkname, 256); + while (linkname[0] != 0x00) { + l = OPT_Links; + while ((l != NIL && __STRCMP(l->name, linkname) != 0)) { + l = l->next; + } + if (l == NIL) { + l = OPT_Links; + __NEW(OPT_Links, OPT_LinkDesc); + OPT_Links->next = l; + __MOVE(linkname, OPT_Links->name, 256); + } + OPT_InName((void*)linkname, 256); + } +} + static void OPT_InConstant (INT32 f, OPT_Const conval) { CHAR ch; @@ -1461,6 +1496,7 @@ void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done) OPM_OldSym((void*)name, 256, &*done); if (*done) { OPT_InMod(&mno); + OPT_InLinks(); OPT_impCtxt.nextTag = OPM_SymRInt(); while (!OPM_eofSF()) { obj = OPT_InObj(mno); @@ -1507,6 +1543,17 @@ static void OPT_OutMod (INT16 mno) } } +static void OPT_OutLinks (void) +{ + OPT_Link l = NIL; + l = OPT_Links; + while (l != NIL) { + OPT_OutName((void*)l->name, 256); + l = l->next; + } + OPM_SymWCh(0x00); +} + static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, INT32 adr) { INT32 i, j, n; @@ -1833,6 +1880,7 @@ void OPT_Export (BOOLEAN *ext, BOOLEAN *new) if (OPM_noerr) { OPM_SymWInt(16); OPT_OutName((void*)OPT_SelfName, 256); + OPT_OutLinks(); OPT_expCtxt.reffp = 0; OPT_expCtxt.ref = 14; OPT_expCtxt.nofm = 1; @@ -1854,7 +1902,7 @@ void OPT_Export (BOOLEAN *ext, BOOLEAN *new) OPT_newsf = 0; OPT_symNew = 0; if (!OPM_noerr || OPT_findpc) { - OPM_DeleteNewSym(); + OPM_DeleteNewSym((void*)OPT_SelfName, 256); } } } @@ -1969,6 +2017,7 @@ static void EnumPtrs(void (*P)(void*)) P(OPT_universe); P(OPT_syslink); __ENUMR(&OPT_impCtxt, OPT_ImpCtxt__typ, 5184, 1, P); + P(OPT_Links); } __TDESC(OPT_ConstDesc, 1, 1) = {__TDFLDS("ConstDesc", 40), {0, -16}}; @@ -2008,6 +2057,7 @@ __TDESC(OPT_ImpCtxt, 1, 510) = {__TDFLDS("ImpCtxt", 5184), {16, 24, 32, 40, 48, 3856, 3864, 3872, 3880, 3888, 3896, 3904, 3912, 3920, 3928, 3936, 3944, 3952, 3960, 3968, 3976, 3984, 3992, 4000, 4008, 4016, 4024, 4032, 4040, 4048, 4056, 4064, 4072, 4080, 4088, -4088}}; __TDESC(OPT_ExpCtxt, 1, 0) = {__TDFLDS("ExpCtxt", 72), {-8}}; +__TDESC(OPT_LinkDesc, 1, 1) = {__TDFLDS("LinkDesc", 264), {256, -16}}; export void *OPT__init(void) { @@ -2024,6 +2074,7 @@ export void *OPT__init(void) __INITYP(OPT_NodeDesc, OPT_NodeDesc, 0); __INITYP(OPT_ImpCtxt, OPT_ImpCtxt, 0); __INITYP(OPT_ExpCtxt, OPT_ExpCtxt, 0); + __INITYP(OPT_LinkDesc, OPT_LinkDesc, 0); /* BEGIN */ OPT_topScope = NIL; OPT_OpenScope(0, NIL); diff --git a/bootstrap/unix-88/OPT.h b/bootstrap/unix-88/OPT.h index 9a187fc7..7483f169 100644 --- a/bootstrap/unix-88/OPT.h +++ b/bootstrap/unix-88/OPT.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPT__h #define OPT__h @@ -21,6 +21,15 @@ typedef LONGREAL realval; } OPT_ConstDesc; +typedef + struct OPT_LinkDesc *OPT_Link; + +typedef + struct OPT_LinkDesc { + OPS_Name name; + OPT_Link next; + } OPT_LinkDesc; + typedef struct OPT_NodeDesc *OPT_Node; @@ -75,11 +84,13 @@ import INT8 OPT_nofGmod; import OPT_Object OPT_GlbMod[64]; import OPS_Name OPT_SelfName; import BOOLEAN OPT_SYSimported; +import OPT_Link OPT_Links; import ADDRESS *OPT_ConstDesc__typ; import ADDRESS *OPT_ObjDesc__typ; import ADDRESS *OPT_StrDesc__typ; import ADDRESS *OPT_NodeDesc__typ; +import ADDRESS *OPT_LinkDesc__typ; import void OPT_Align (INT32 *adr, INT32 base); import INT32 OPT_BaseAlignment (OPT_Struct typ); diff --git a/bootstrap/unix-88/OPV.c b/bootstrap/unix-88/OPV.c index ab98ed73..4d29b076 100644 --- a/bootstrap/unix-88/OPV.c +++ b/bootstrap/unix-88/OPV.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-88/OPV.h b/bootstrap/unix-88/OPV.h index 5654d36e..7c94fced 100644 --- a/bootstrap/unix-88/OPV.h +++ b/bootstrap/unix-88/OPV.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/unix-88/Out.c b/bootstrap/unix-88/Out.c index a55f91eb..e24a77fc 100644 --- a/bootstrap/unix-88/Out.c +++ b/bootstrap/unix-88/Out.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-88/Out.h b/bootstrap/unix-88/Out.h index b846b299..311e737d 100644 --- a/bootstrap/unix-88/Out.h +++ b/bootstrap/unix-88/Out.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Out__h #define Out__h diff --git a/bootstrap/unix-88/Platform.c b/bootstrap/unix-88/Platform.c index 56d7144c..7ed88d75 100644 --- a/bootstrap/unix-88/Platform.c +++ b/bootstrap/unix-88/Platform.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-88/Platform.h b/bootstrap/unix-88/Platform.h index 000bcc79..9b911314 100644 --- a/bootstrap/unix-88/Platform.h +++ b/bootstrap/unix-88/Platform.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/unix-88/Reals.c b/bootstrap/unix-88/Reals.c index 2ecd8371..11ad01bd 100644 --- a/bootstrap/unix-88/Reals.c +++ b/bootstrap/unix-88/Reals.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-88/Reals.h b/bootstrap/unix-88/Reals.h index 570e7d72..bf708519 100644 --- a/bootstrap/unix-88/Reals.h +++ b/bootstrap/unix-88/Reals.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/unix-88/Strings.c b/bootstrap/unix-88/Strings.c index f911a688..06972c90 100644 --- a/bootstrap/unix-88/Strings.c +++ b/bootstrap/unix-88/Strings.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-88/Strings.h b/bootstrap/unix-88/Strings.h index 7645aa6e..fd7f283d 100644 --- a/bootstrap/unix-88/Strings.h +++ b/bootstrap/unix-88/Strings.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/unix-88/Texts.c b/bootstrap/unix-88/Texts.c index 74cd62c7..2bfa4511 100644 --- a/bootstrap/unix-88/Texts.c +++ b/bootstrap/unix-88/Texts.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-88/Texts.h b/bootstrap/unix-88/Texts.h index be7b64a2..21401f61 100644 --- a/bootstrap/unix-88/Texts.h +++ b/bootstrap/unix-88/Texts.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/unix-88/VT100.c b/bootstrap/unix-88/VT100.c index 1e0fffa9..baa92092 100644 --- a/bootstrap/unix-88/VT100.c +++ b/bootstrap/unix-88/VT100.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-88/VT100.h b/bootstrap/unix-88/VT100.h index 7522f9d1..4c0087ac 100644 --- a/bootstrap/unix-88/VT100.h +++ b/bootstrap/unix-88/VT100.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef VT100__h #define VT100__h diff --git a/bootstrap/unix-88/extTools.c b/bootstrap/unix-88/extTools.c index d2c67400..75768aca 100644 --- a/bootstrap/unix-88/extTools.c +++ b/bootstrap/unix-88/extTools.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-88/extTools.h b/bootstrap/unix-88/extTools.h index fb167591..fb870961 100644 --- a/bootstrap/unix-88/extTools.h +++ b/bootstrap/unix-88/extTools.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/windows-48/Compiler.c b/bootstrap/windows-48/Compiler.c index 454ea490..f26c1a32 100644 --- a/bootstrap/windows-48/Compiler.c +++ b/bootstrap/windows-48/Compiler.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */ #define SHORTINT INT8 #define INTEGER INT16 @@ -20,9 +20,9 @@ #include "extTools.h" -static CHAR Compiler_mname[256]; +static void Compiler_FindLocalObjectFiles (CHAR *objectnames, ADDRESS objectnames__len); export void Compiler_Module (BOOLEAN *done); static void Compiler_PropagateElementaryTypeSizes (void); export void Compiler_Translate (void); @@ -41,11 +41,12 @@ void Compiler_Module (BOOLEAN *done) OPT_Export(&ext, &new); if (OPM_noerr) { OPM_OpenFiles((void*)OPT_SelfName, 256); + OPM_DeleteObj((void*)OPT_SelfName, 256); OPC_Init(); OPV_Module(p); if (OPM_noerr) { if ((__IN(10, OPM_Options, 32) && __STRCMP(OPM_modName, "SYSTEM") != 0)) { - OPM_DeleteNewSym(); + OPM_DeleteNewSym((void*)OPT_SelfName, 256); OPM_LogVT100((CHAR*)"32m", 4); OPM_LogWStr((CHAR*)" Main program.", 16); OPM_LogVT100((CHAR*)"0m", 3); @@ -61,7 +62,7 @@ void Compiler_Module (BOOLEAN *done) } } } else { - OPM_DeleteNewSym(); + OPM_DeleteNewSym((void*)OPT_SelfName, 256); } } } @@ -104,14 +105,44 @@ static void Compiler_PropagateElementaryTypeSizes (void) } } +static void Compiler_FindLocalObjectFiles (CHAR *objectnames, ADDRESS objectnames__len) +{ + OPT_Link l = NIL; + CHAR fn[64]; + Platform_FileIdentity id; + objectnames[0] = 0x00; + l = OPT_Links; + while (l != NIL) { + __COPY(l->name, fn, 64); + Strings_Append((CHAR*)".sym", 5, (void*)fn, 64); + if (Platform_IdentifyByName(fn, 64, &id, Platform_FileIdentity__typ) == 0) { + __COPY(l->name, fn, 64); + Strings_Append((CHAR*)".o", 3, (void*)fn, 64); + if (Platform_IdentifyByName(fn, 64, &id, Platform_FileIdentity__typ) == 0) { + Strings_Append((CHAR*)" ", 2, (void*)objectnames, objectnames__len); + Strings_Append(fn, 64, (void*)objectnames, objectnames__len); + } else { + OPM_LogVT100((CHAR*)"33m", 4); + OPM_LogWStr((CHAR*)"Link warning: a local symbol file is present for module ", 57); + OPM_LogWStr(l->name, 256); + OPM_LogWStr((CHAR*)", but local object file '", 26); + OPM_LogWStr(fn, 64); + OPM_LogWStr((CHAR*)"' is missing.", 14); + OPM_LogVT100((CHAR*)"0m", 3); + OPM_LogWLn(); + } + } + l = l->next; + } +} + void Compiler_Translate (void) { BOOLEAN done; - CHAR modulesobj[2048]; - modulesobj[0] = 0x00; + CHAR linkfiles[2048]; if (OPM_OpenPar()) { for (;;) { - OPM_Init(&done, (void*)Compiler_mname, 256); + OPM_Init(&done); if (!done) { return; } @@ -131,11 +162,9 @@ void Compiler_Translate (void) } else { if (!__IN(10, OPM_Options, 32)) { extTools_Assemble(OPM_modName, 32); - Strings_Append((CHAR*)" ", 2, (void*)modulesobj, 2048); - Strings_Append(OPM_modName, 32, (void*)modulesobj, 2048); - Strings_Append((CHAR*)".o", 3, (void*)modulesobj, 2048); } else { - extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_Options, 32), modulesobj, 2048); + Compiler_FindLocalObjectFiles((void*)linkfiles, 2048); + extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_Options, 32), linkfiles, 2048); } } } diff --git a/bootstrap/windows-48/Configuration.c b/bootstrap/windows-48/Configuration.c index abf165f3..18ec858a 100644 --- a/bootstrap/windows-48/Configuration.c +++ b/bootstrap/windows-48/Configuration.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -19,6 +19,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); + __MOVE("2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); __ENDMOD; } diff --git a/bootstrap/windows-48/Configuration.h b/bootstrap/windows-48/Configuration.h index eb712e53..efd4ae6e 100644 --- a/bootstrap/windows-48/Configuration.h +++ b/bootstrap/windows-48/Configuration.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/windows-48/Files.c b/bootstrap/windows-48/Files.c index 38d67ccf..a5c597ca 100644 --- a/bootstrap/windows-48/Files.c +++ b/bootstrap/windows-48/Files.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-48/Files.h b/bootstrap/windows-48/Files.h index e1da6139..63eaa089 100644 --- a/bootstrap/windows-48/Files.h +++ b/bootstrap/windows-48/Files.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/windows-48/Heap.c b/bootstrap/windows-48/Heap.c index 495e451c..df3d086b 100644 --- a/bootstrap/windows-48/Heap.c +++ b/bootstrap/windows-48/Heap.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-48/Heap.h b/bootstrap/windows-48/Heap.h index 7429d8c8..7a464dbf 100644 --- a/bootstrap/windows-48/Heap.h +++ b/bootstrap/windows-48/Heap.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/windows-48/Modules.c b/bootstrap/windows-48/Modules.c index 9cd53060..859d31ba 100644 --- a/bootstrap/windows-48/Modules.c +++ b/bootstrap/windows-48/Modules.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-48/Modules.h b/bootstrap/windows-48/Modules.h index 42f06075..9f691749 100644 --- a/bootstrap/windows-48/Modules.h +++ b/bootstrap/windows-48/Modules.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/windows-48/OPB.c b/bootstrap/windows-48/OPB.c index c163c77e..3933cee1 100644 --- a/bootstrap/windows-48/OPB.c +++ b/bootstrap/windows-48/OPB.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-48/OPB.h b/bootstrap/windows-48/OPB.h index 7b8e9d38..9f8518b8 100644 --- a/bootstrap/windows-48/OPB.h +++ b/bootstrap/windows-48/OPB.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/windows-48/OPC.c b/bootstrap/windows-48/OPC.c index fef86e9e..24cd4f3f 100644 --- a/bootstrap/windows-48/OPC.c +++ b/bootstrap/windows-48/OPC.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-48/OPC.h b/bootstrap/windows-48/OPC.h index a2b14bdc..99b9afb4 100644 --- a/bootstrap/windows-48/OPC.h +++ b/bootstrap/windows-48/OPC.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/windows-48/OPM.c b/bootstrap/windows-48/OPM.c index d09d6a7a..3411635b 100644 --- a/bootstrap/windows-48/OPM.c +++ b/bootstrap/windows-48/OPM.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -49,7 +49,8 @@ export CHAR OPM_ResourceDir[1024]; static void OPM_Append (Files_Rider *R, ADDRESS *R__typ, Files_File F); export void OPM_CloseFiles (void); export void OPM_CloseOldSym (void); -export void OPM_DeleteNewSym (void); +export void OPM_DeleteNewSym (CHAR *modulename, ADDRESS modulename__len); +export void OPM_DeleteObj (CHAR *modulename, ADDRESS modulename__len); export void OPM_FPrint (INT32 *fp, INT64 val); export void OPM_FPrintLReal (INT32 *fp, LONGREAL val); export void OPM_FPrintReal (INT32 *fp, REAL val); @@ -58,7 +59,7 @@ static void OPM_FindInstallDir (void); static void OPM_FindLine (Files_File f, Files_Rider *r, ADDRESS *r__typ, INT64 pos); static void OPM_FingerprintBytes (INT32 *fp, SYSTEM_BYTE *bytes, ADDRESS bytes__len); export void OPM_Get (CHAR *ch); -export void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len); +export void OPM_Init (BOOLEAN *done); export void OPM_InitOptions (void); export INT16 OPM_Integer (INT64 n); static BOOLEAN OPM_IsProbablyInstallDir (CHAR *s, ADDRESS s__len); @@ -449,7 +450,7 @@ void OPM_InitOptions (void) Files_SetSearchPath(searchpath, 1024); } -void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len) +void OPM_Init (BOOLEAN *done) { Texts_Text T = NIL; INT32 beg, end, time; @@ -465,7 +466,6 @@ void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len) Texts_Open(T, s, 256); OPM_LogWStr(s, 256); OPM_LogWStr((CHAR*)" ", 3); - __COPY(s, mname, mname__len); __COPY(s, OPM_SourceFileName, 256); if (T->len == 0) { OPM_LogWStr(s, 256); @@ -773,7 +773,7 @@ void OPM_OldSym (CHAR *modName, ADDRESS modName__len, BOOLEAN *done) Files_Set(&OPM_oldSF, Files_Rider__typ, OPM_oldSFile, 0); Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&tag); Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&ver); - if (tag != 0xf7 || ver != 0x82) { + if (tag != 0xf7 || ver != 0x83) { OPM_err(-306); OPM_CloseOldSym(); *done = 0; @@ -818,8 +818,20 @@ void OPM_RegisterNewSym (void) } } -void OPM_DeleteNewSym (void) +void OPM_DeleteNewSym (CHAR *modulename, ADDRESS modulename__len) { + OPM_FileName fn; + INT16 res; + OPM_MakeFileName((void*)modulename, modulename__len, (void*)fn, 32, (CHAR*)".sym", 5); + Files_Delete(fn, 32, &res); +} + +void OPM_DeleteObj (CHAR *modulename, ADDRESS modulename__len) +{ + OPM_FileName fn; + INT16 res; + OPM_MakeFileName((void*)modulename, modulename__len, (void*)fn, 32, (CHAR*)".o", 3); + Files_Delete(fn, 32, &res); } void OPM_NewSym (CHAR *modName, ADDRESS modName__len) @@ -830,7 +842,7 @@ void OPM_NewSym (CHAR *modName, ADDRESS modName__len) if (OPM_newSFile != NIL) { Files_Set(&OPM_newSF, Files_Rider__typ, OPM_newSFile, 0); Files_Write(&OPM_newSF, Files_Rider__typ, 0xf7); - Files_Write(&OPM_newSF, Files_Rider__typ, 0x82); + Files_Write(&OPM_newSF, Files_Rider__typ, 0x83); } else { OPM_err(153); } @@ -984,7 +996,7 @@ static void OPM_Append (Files_Rider *R, ADDRESS *R__typ, Files_File F) void OPM_OpenFiles (CHAR *moduleName, ADDRESS moduleName__len) { - CHAR FName[32]; + OPM_FileName FName; __COPY(moduleName, OPM_modName, 32); OPM_HFile = Files_New((CHAR*)"", 1); if (OPM_HFile != NIL) { @@ -1010,7 +1022,7 @@ void OPM_OpenFiles (CHAR *moduleName, ADDRESS moduleName__len) void OPM_CloseFiles (void) { - CHAR FName[32]; + OPM_FileName FName; INT16 res; if (OPM_noerr) { OPM_LogWStr((CHAR*)" ", 3); @@ -1048,26 +1060,26 @@ void OPM_CloseFiles (void) static BOOLEAN OPM_IsProbablyInstallDir (CHAR *s, ADDRESS s__len) { - CHAR testpath[1024]; + CHAR testpath[4096]; Platform_FileIdentity identity; __DUP(s, s__len, CHAR); - __COPY(OPM_InstallDir, testpath, 1024); - Strings_Append((CHAR*)"/lib/lib", 9, (void*)testpath, 1024); - Strings_Append((CHAR*)"voc", 4, (void*)testpath, 1024); - Strings_Append((CHAR*)"-O2.a", 6, (void*)testpath, 1024); - if (Platform_IdentifyByName(testpath, 1024, &identity, Platform_FileIdentity__typ) != 0) { + __COPY(OPM_InstallDir, testpath, 4096); + Strings_Append((CHAR*)"/lib/lib", 9, (void*)testpath, 4096); + Strings_Append((CHAR*)"voc", 4, (void*)testpath, 4096); + Strings_Append((CHAR*)"-O2.a", 6, (void*)testpath, 4096); + if (Platform_IdentifyByName(testpath, 4096, &identity, Platform_FileIdentity__typ) != 0) { __DEL(s); return 0; } - __COPY(OPM_InstallDir, testpath, 1024); - Strings_Append((CHAR*)"/2/include/Oberon.h", 20, (void*)testpath, 1024); - if (Platform_IdentifyByName(testpath, 1024, &identity, Platform_FileIdentity__typ) != 0) { + __COPY(OPM_InstallDir, testpath, 4096); + Strings_Append((CHAR*)"/2/include/Oberon.h", 20, (void*)testpath, 4096); + if (Platform_IdentifyByName(testpath, 4096, &identity, Platform_FileIdentity__typ) != 0) { __DEL(s); return 0; } - __COPY(OPM_InstallDir, testpath, 1024); - Strings_Append((CHAR*)"/2/sym/Files.sym", 17, (void*)testpath, 1024); - if (Platform_IdentifyByName(testpath, 1024, &identity, Platform_FileIdentity__typ) != 0) { + __COPY(OPM_InstallDir, testpath, 4096); + Strings_Append((CHAR*)"/2/sym/Files.sym", 17, (void*)testpath, 4096); + if (Platform_IdentifyByName(testpath, 4096, &identity, Platform_FileIdentity__typ) != 0) { __DEL(s); return 0; } @@ -1129,7 +1141,6 @@ export void *OPM__init(void) __REGMOD("OPM", EnumPtrs); __REGCMD("CloseFiles", OPM_CloseFiles); __REGCMD("CloseOldSym", OPM_CloseOldSym); - __REGCMD("DeleteNewSym", OPM_DeleteNewSym); __REGCMD("InitOptions", OPM_InitOptions); __REGCMD("LogWLn", OPM_LogWLn); __REGCMD("RegisterNewSym", OPM_RegisterNewSym); diff --git a/bootstrap/windows-48/OPM.h b/bootstrap/windows-48/OPM.h index dc86bc49..da0a48ee 100644 --- a/bootstrap/windows-48/OPM.h +++ b/bootstrap/windows-48/OPM.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPM__h #define OPM__h @@ -23,13 +23,14 @@ import CHAR OPM_ResourceDir[1024]; import void OPM_CloseFiles (void); import void OPM_CloseOldSym (void); -import void OPM_DeleteNewSym (void); +import void OPM_DeleteNewSym (CHAR *modulename, ADDRESS modulename__len); +import void OPM_DeleteObj (CHAR *modulename, ADDRESS modulename__len); import void OPM_FPrint (INT32 *fp, INT64 val); import void OPM_FPrintLReal (INT32 *fp, LONGREAL val); import void OPM_FPrintReal (INT32 *fp, REAL val); import void OPM_FPrintSet (INT32 *fp, UINT64 val); import void OPM_Get (CHAR *ch); -import void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len); +import void OPM_Init (BOOLEAN *done); import void OPM_InitOptions (void); import INT16 OPM_Integer (INT64 n); import void OPM_LogVT100 (CHAR *vt100code, ADDRESS vt100code__len); diff --git a/bootstrap/windows-48/OPP.c b/bootstrap/windows-48/OPP.c index 24e6b221..aad8367d 100644 --- a/bootstrap/windows-48/OPP.c +++ b/bootstrap/windows-48/OPP.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -1793,24 +1793,6 @@ void OPP_Module (OPT_Node *prog, UINT32 opt) if (OPP_sym == 63) { OPS_Get(&OPP_sym); } else { - OPM_LogWLn(); - OPM_LogWStr((CHAR*)"Unexpected symbol found when MODULE expected:", 46); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" sym: ", 15); - OPM_LogWNum(OPP_sym, 1); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" OPS.name: ", 15); - OPM_LogWStr(OPS_name, 256); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" OPS.str: ", 15); - OPM_LogWStr(OPS_str, 256); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" OPS.numtyp: ", 15); - OPM_LogWNum(OPS_numtyp, 1); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" OPS.intval: ", 15); - OPM_LogWNum(OPS_intval, 1); - OPM_LogWLn(); OPP_err(16); } if (OPP_sym == 38) { diff --git a/bootstrap/windows-48/OPP.h b/bootstrap/windows-48/OPP.h index bf0f96d7..dc8aa405 100644 --- a/bootstrap/windows-48/OPP.h +++ b/bootstrap/windows-48/OPP.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/windows-48/OPS.c b/bootstrap/windows-48/OPS.c index 807c0ce5..d0a1851a 100644 --- a/bootstrap/windows-48/OPS.c +++ b/bootstrap/windows-48/OPS.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-48/OPS.h b/bootstrap/windows-48/OPS.h index a15d8712..608979a8 100644 --- a/bootstrap/windows-48/OPS.h +++ b/bootstrap/windows-48/OPS.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/windows-48/OPT.c b/bootstrap/windows-48/OPT.c index e9db362e..b95c2810 100644 --- a/bootstrap/windows-48/OPT.c +++ b/bootstrap/windows-48/OPT.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -49,6 +49,15 @@ typedef INT8 glbmno[64]; } OPT_ImpCtxt; +typedef + struct OPT_LinkDesc *OPT_Link; + +typedef + struct OPT_LinkDesc { + OPS_Name name; + OPT_Link next; + } OPT_LinkDesc; + typedef struct OPT_NodeDesc *OPT_Node; @@ -101,6 +110,7 @@ static OPT_ExpCtxt OPT_expCtxt; static INT32 OPT_nofhdfld; static BOOLEAN OPT_newsf, OPT_findpc, OPT_extsf, OPT_sfpresent, OPT_symExtended, OPT_symNew; static INT32 OPT_recno; +export OPT_Link OPT_Links; export ADDRESS *OPT_ConstDesc__typ; export ADDRESS *OPT_ObjDesc__typ; @@ -108,6 +118,7 @@ export ADDRESS *OPT_StrDesc__typ; export ADDRESS *OPT_NodeDesc__typ; export ADDRESS *OPT_ImpCtxt__typ; export ADDRESS *OPT_ExpCtxt__typ; +export ADDRESS *OPT_LinkDesc__typ; export void OPT_Align (INT32 *adr, INT32 base); export INT32 OPT_BaseAlignment (OPT_Struct typ); @@ -131,6 +142,7 @@ export void OPT_IdFPrint (OPT_Struct typ); export void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done); static void OPT_InConstant (INT32 f, OPT_Const conval); static OPT_Object OPT_InFld (void); +static void OPT_InLinks (void); static void OPT_InMod (INT8 *mno); static void OPT_InName (CHAR *name, ADDRESS name__len); static OPT_Object OPT_InObj (INT8 mno); @@ -154,6 +166,7 @@ export void OPT_OpenScope (INT8 level, OPT_Object owner); static void OPT_OutConstant (OPT_Object obj); static void OPT_OutFlds (OPT_Object fld, INT32 adr, BOOLEAN visible); static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, INT32 adr); +static void OPT_OutLinks (void); static void OPT_OutMod (INT16 mno); static void OPT_OutName (CHAR *name, ADDRESS name__len); static void OPT_OutObj (OPT_Object obj); @@ -442,6 +455,8 @@ void OPT_Init (OPS_Name name, UINT32 opt) OPT_findpc = __IN(8, opt, 32); OPT_extsf = OPT_newsf || __IN(9, opt, 32); OPT_sfpresent = 1; + __NEW(OPT_Links, OPT_LinkDesc); + __MOVE(name, OPT_Links->name, 256); } void OPT_Close (void) @@ -1011,6 +1026,26 @@ static void OPT_InMod (INT8 *mno) } } +static void OPT_InLinks (void) +{ + OPS_Name linkname; + OPT_Link l = NIL; + OPT_InName((void*)linkname, 256); + while (linkname[0] != 0x00) { + l = OPT_Links; + while ((l != NIL && __STRCMP(l->name, linkname) != 0)) { + l = l->next; + } + if (l == NIL) { + l = OPT_Links; + __NEW(OPT_Links, OPT_LinkDesc); + OPT_Links->next = l; + __MOVE(linkname, OPT_Links->name, 256); + } + OPT_InName((void*)linkname, 256); + } +} + static void OPT_InConstant (INT32 f, OPT_Const conval) { CHAR ch; @@ -1461,6 +1496,7 @@ void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done) OPM_OldSym((void*)name, 256, &*done); if (*done) { OPT_InMod(&mno); + OPT_InLinks(); OPT_impCtxt.nextTag = OPM_SymRInt(); while (!OPM_eofSF()) { obj = OPT_InObj(mno); @@ -1507,6 +1543,17 @@ static void OPT_OutMod (INT16 mno) } } +static void OPT_OutLinks (void) +{ + OPT_Link l = NIL; + l = OPT_Links; + while (l != NIL) { + OPT_OutName((void*)l->name, 256); + l = l->next; + } + OPM_SymWCh(0x00); +} + static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, INT32 adr) { INT32 i, j, n; @@ -1833,6 +1880,7 @@ void OPT_Export (BOOLEAN *ext, BOOLEAN *new) if (OPM_noerr) { OPM_SymWInt(16); OPT_OutName((void*)OPT_SelfName, 256); + OPT_OutLinks(); OPT_expCtxt.reffp = 0; OPT_expCtxt.ref = 14; OPT_expCtxt.nofm = 1; @@ -1854,7 +1902,7 @@ void OPT_Export (BOOLEAN *ext, BOOLEAN *new) OPT_newsf = 0; OPT_symNew = 0; if (!OPM_noerr || OPT_findpc) { - OPM_DeleteNewSym(); + OPM_DeleteNewSym((void*)OPT_SelfName, 256); } } } @@ -1969,6 +2017,7 @@ static void EnumPtrs(void (*P)(void*)) P(OPT_universe); P(OPT_syslink); __ENUMR(&OPT_impCtxt, OPT_ImpCtxt__typ, 3140, 1, P); + P(OPT_Links); } __TDESC(OPT_ConstDesc, 1, 1) = {__TDFLDS("ConstDesc", 40), {0, -8}}; @@ -2008,6 +2057,7 @@ __TDESC(OPT_ImpCtxt, 1, 510) = {__TDFLDS("ImpCtxt", 3140), {16, 20, 24, 28, 32, 1936, 1940, 1944, 1948, 1952, 1956, 1960, 1964, 1968, 1972, 1976, 1980, 1984, 1988, 1992, 1996, 2000, 2004, 2008, 2012, 2016, 2020, 2024, 2028, 2032, 2036, 2040, 2044, 2048, 2052, -2044}}; __TDESC(OPT_ExpCtxt, 1, 0) = {__TDFLDS("ExpCtxt", 72), {-4}}; +__TDESC(OPT_LinkDesc, 1, 1) = {__TDFLDS("LinkDesc", 260), {256, -8}}; export void *OPT__init(void) { @@ -2024,6 +2074,7 @@ export void *OPT__init(void) __INITYP(OPT_NodeDesc, OPT_NodeDesc, 0); __INITYP(OPT_ImpCtxt, OPT_ImpCtxt, 0); __INITYP(OPT_ExpCtxt, OPT_ExpCtxt, 0); + __INITYP(OPT_LinkDesc, OPT_LinkDesc, 0); /* BEGIN */ OPT_topScope = NIL; OPT_OpenScope(0, NIL); diff --git a/bootstrap/windows-48/OPT.h b/bootstrap/windows-48/OPT.h index 9a187fc7..7483f169 100644 --- a/bootstrap/windows-48/OPT.h +++ b/bootstrap/windows-48/OPT.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPT__h #define OPT__h @@ -21,6 +21,15 @@ typedef LONGREAL realval; } OPT_ConstDesc; +typedef + struct OPT_LinkDesc *OPT_Link; + +typedef + struct OPT_LinkDesc { + OPS_Name name; + OPT_Link next; + } OPT_LinkDesc; + typedef struct OPT_NodeDesc *OPT_Node; @@ -75,11 +84,13 @@ import INT8 OPT_nofGmod; import OPT_Object OPT_GlbMod[64]; import OPS_Name OPT_SelfName; import BOOLEAN OPT_SYSimported; +import OPT_Link OPT_Links; import ADDRESS *OPT_ConstDesc__typ; import ADDRESS *OPT_ObjDesc__typ; import ADDRESS *OPT_StrDesc__typ; import ADDRESS *OPT_NodeDesc__typ; +import ADDRESS *OPT_LinkDesc__typ; import void OPT_Align (INT32 *adr, INT32 base); import INT32 OPT_BaseAlignment (OPT_Struct typ); diff --git a/bootstrap/windows-48/OPV.c b/bootstrap/windows-48/OPV.c index 96252046..152db225 100644 --- a/bootstrap/windows-48/OPV.c +++ b/bootstrap/windows-48/OPV.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-48/OPV.h b/bootstrap/windows-48/OPV.h index 5654d36e..7c94fced 100644 --- a/bootstrap/windows-48/OPV.h +++ b/bootstrap/windows-48/OPV.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/windows-48/Out.c b/bootstrap/windows-48/Out.c index 932297a3..b5ffb6ae 100644 --- a/bootstrap/windows-48/Out.c +++ b/bootstrap/windows-48/Out.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-48/Out.h b/bootstrap/windows-48/Out.h index ffbd6894..a7195e3a 100644 --- a/bootstrap/windows-48/Out.h +++ b/bootstrap/windows-48/Out.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Out__h #define Out__h diff --git a/bootstrap/windows-48/Platform.c b/bootstrap/windows-48/Platform.c index cc0bd221..73b65c9d 100644 --- a/bootstrap/windows-48/Platform.c +++ b/bootstrap/windows-48/Platform.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-48/Platform.h b/bootstrap/windows-48/Platform.h index f74a75bf..95a1066e 100644 --- a/bootstrap/windows-48/Platform.h +++ b/bootstrap/windows-48/Platform.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/windows-48/Reals.c b/bootstrap/windows-48/Reals.c index 2ecd8371..11ad01bd 100644 --- a/bootstrap/windows-48/Reals.c +++ b/bootstrap/windows-48/Reals.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-48/Reals.h b/bootstrap/windows-48/Reals.h index 570e7d72..bf708519 100644 --- a/bootstrap/windows-48/Reals.h +++ b/bootstrap/windows-48/Reals.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/windows-48/Strings.c b/bootstrap/windows-48/Strings.c index f911a688..06972c90 100644 --- a/bootstrap/windows-48/Strings.c +++ b/bootstrap/windows-48/Strings.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-48/Strings.h b/bootstrap/windows-48/Strings.h index 7645aa6e..fd7f283d 100644 --- a/bootstrap/windows-48/Strings.h +++ b/bootstrap/windows-48/Strings.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/windows-48/Texts.c b/bootstrap/windows-48/Texts.c index c0bfc16a..285e7ac0 100644 --- a/bootstrap/windows-48/Texts.c +++ b/bootstrap/windows-48/Texts.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-48/Texts.h b/bootstrap/windows-48/Texts.h index cd0f72ee..7f7d6562 100644 --- a/bootstrap/windows-48/Texts.h +++ b/bootstrap/windows-48/Texts.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/windows-48/VT100.c b/bootstrap/windows-48/VT100.c index 1e0fffa9..baa92092 100644 --- a/bootstrap/windows-48/VT100.c +++ b/bootstrap/windows-48/VT100.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-48/VT100.h b/bootstrap/windows-48/VT100.h index 7522f9d1..4c0087ac 100644 --- a/bootstrap/windows-48/VT100.h +++ b/bootstrap/windows-48/VT100.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef VT100__h #define VT100__h diff --git a/bootstrap/windows-48/extTools.c b/bootstrap/windows-48/extTools.c index d2c67400..75768aca 100644 --- a/bootstrap/windows-48/extTools.c +++ b/bootstrap/windows-48/extTools.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-48/extTools.h b/bootstrap/windows-48/extTools.h index fb167591..fb870961 100644 --- a/bootstrap/windows-48/extTools.h +++ b/bootstrap/windows-48/extTools.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/windows-88/Compiler.c b/bootstrap/windows-88/Compiler.c index 454ea490..f26c1a32 100644 --- a/bootstrap/windows-88/Compiler.c +++ b/bootstrap/windows-88/Compiler.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */ #define SHORTINT INT8 #define INTEGER INT16 @@ -20,9 +20,9 @@ #include "extTools.h" -static CHAR Compiler_mname[256]; +static void Compiler_FindLocalObjectFiles (CHAR *objectnames, ADDRESS objectnames__len); export void Compiler_Module (BOOLEAN *done); static void Compiler_PropagateElementaryTypeSizes (void); export void Compiler_Translate (void); @@ -41,11 +41,12 @@ void Compiler_Module (BOOLEAN *done) OPT_Export(&ext, &new); if (OPM_noerr) { OPM_OpenFiles((void*)OPT_SelfName, 256); + OPM_DeleteObj((void*)OPT_SelfName, 256); OPC_Init(); OPV_Module(p); if (OPM_noerr) { if ((__IN(10, OPM_Options, 32) && __STRCMP(OPM_modName, "SYSTEM") != 0)) { - OPM_DeleteNewSym(); + OPM_DeleteNewSym((void*)OPT_SelfName, 256); OPM_LogVT100((CHAR*)"32m", 4); OPM_LogWStr((CHAR*)" Main program.", 16); OPM_LogVT100((CHAR*)"0m", 3); @@ -61,7 +62,7 @@ void Compiler_Module (BOOLEAN *done) } } } else { - OPM_DeleteNewSym(); + OPM_DeleteNewSym((void*)OPT_SelfName, 256); } } } @@ -104,14 +105,44 @@ static void Compiler_PropagateElementaryTypeSizes (void) } } +static void Compiler_FindLocalObjectFiles (CHAR *objectnames, ADDRESS objectnames__len) +{ + OPT_Link l = NIL; + CHAR fn[64]; + Platform_FileIdentity id; + objectnames[0] = 0x00; + l = OPT_Links; + while (l != NIL) { + __COPY(l->name, fn, 64); + Strings_Append((CHAR*)".sym", 5, (void*)fn, 64); + if (Platform_IdentifyByName(fn, 64, &id, Platform_FileIdentity__typ) == 0) { + __COPY(l->name, fn, 64); + Strings_Append((CHAR*)".o", 3, (void*)fn, 64); + if (Platform_IdentifyByName(fn, 64, &id, Platform_FileIdentity__typ) == 0) { + Strings_Append((CHAR*)" ", 2, (void*)objectnames, objectnames__len); + Strings_Append(fn, 64, (void*)objectnames, objectnames__len); + } else { + OPM_LogVT100((CHAR*)"33m", 4); + OPM_LogWStr((CHAR*)"Link warning: a local symbol file is present for module ", 57); + OPM_LogWStr(l->name, 256); + OPM_LogWStr((CHAR*)", but local object file '", 26); + OPM_LogWStr(fn, 64); + OPM_LogWStr((CHAR*)"' is missing.", 14); + OPM_LogVT100((CHAR*)"0m", 3); + OPM_LogWLn(); + } + } + l = l->next; + } +} + void Compiler_Translate (void) { BOOLEAN done; - CHAR modulesobj[2048]; - modulesobj[0] = 0x00; + CHAR linkfiles[2048]; if (OPM_OpenPar()) { for (;;) { - OPM_Init(&done, (void*)Compiler_mname, 256); + OPM_Init(&done); if (!done) { return; } @@ -131,11 +162,9 @@ void Compiler_Translate (void) } else { if (!__IN(10, OPM_Options, 32)) { extTools_Assemble(OPM_modName, 32); - Strings_Append((CHAR*)" ", 2, (void*)modulesobj, 2048); - Strings_Append(OPM_modName, 32, (void*)modulesobj, 2048); - Strings_Append((CHAR*)".o", 3, (void*)modulesobj, 2048); } else { - extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_Options, 32), modulesobj, 2048); + Compiler_FindLocalObjectFiles((void*)linkfiles, 2048); + extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_Options, 32), linkfiles, 2048); } } } diff --git a/bootstrap/windows-88/Configuration.c b/bootstrap/windows-88/Configuration.c index abf165f3..18ec858a 100644 --- a/bootstrap/windows-88/Configuration.c +++ b/bootstrap/windows-88/Configuration.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -19,6 +19,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); + __MOVE("2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); __ENDMOD; } diff --git a/bootstrap/windows-88/Configuration.h b/bootstrap/windows-88/Configuration.h index eb712e53..efd4ae6e 100644 --- a/bootstrap/windows-88/Configuration.h +++ b/bootstrap/windows-88/Configuration.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/windows-88/Files.c b/bootstrap/windows-88/Files.c index b9056935..206de2b2 100644 --- a/bootstrap/windows-88/Files.c +++ b/bootstrap/windows-88/Files.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-88/Files.h b/bootstrap/windows-88/Files.h index 616c3fe1..ef890edf 100644 --- a/bootstrap/windows-88/Files.h +++ b/bootstrap/windows-88/Files.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/windows-88/Heap.c b/bootstrap/windows-88/Heap.c index 3f4e96ee..ba215672 100644 --- a/bootstrap/windows-88/Heap.c +++ b/bootstrap/windows-88/Heap.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-88/Heap.h b/bootstrap/windows-88/Heap.h index aac7c8fe..bbd83594 100644 --- a/bootstrap/windows-88/Heap.h +++ b/bootstrap/windows-88/Heap.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/windows-88/Modules.c b/bootstrap/windows-88/Modules.c index 50348111..16daab43 100644 --- a/bootstrap/windows-88/Modules.c +++ b/bootstrap/windows-88/Modules.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-88/Modules.h b/bootstrap/windows-88/Modules.h index c7f011df..be3fd68b 100644 --- a/bootstrap/windows-88/Modules.h +++ b/bootstrap/windows-88/Modules.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Modules__h #define Modules__h diff --git a/bootstrap/windows-88/OPB.c b/bootstrap/windows-88/OPB.c index c163c77e..3933cee1 100644 --- a/bootstrap/windows-88/OPB.c +++ b/bootstrap/windows-88/OPB.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-88/OPB.h b/bootstrap/windows-88/OPB.h index 7b8e9d38..9f8518b8 100644 --- a/bootstrap/windows-88/OPB.h +++ b/bootstrap/windows-88/OPB.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/windows-88/OPC.c b/bootstrap/windows-88/OPC.c index fef86e9e..24cd4f3f 100644 --- a/bootstrap/windows-88/OPC.c +++ b/bootstrap/windows-88/OPC.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-88/OPC.h b/bootstrap/windows-88/OPC.h index a2b14bdc..99b9afb4 100644 --- a/bootstrap/windows-88/OPC.h +++ b/bootstrap/windows-88/OPC.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/windows-88/OPM.c b/bootstrap/windows-88/OPM.c index cb39afd5..2bc2c145 100644 --- a/bootstrap/windows-88/OPM.c +++ b/bootstrap/windows-88/OPM.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -49,7 +49,8 @@ export CHAR OPM_ResourceDir[1024]; static void OPM_Append (Files_Rider *R, ADDRESS *R__typ, Files_File F); export void OPM_CloseFiles (void); export void OPM_CloseOldSym (void); -export void OPM_DeleteNewSym (void); +export void OPM_DeleteNewSym (CHAR *modulename, ADDRESS modulename__len); +export void OPM_DeleteObj (CHAR *modulename, ADDRESS modulename__len); export void OPM_FPrint (INT32 *fp, INT64 val); export void OPM_FPrintLReal (INT32 *fp, LONGREAL val); export void OPM_FPrintReal (INT32 *fp, REAL val); @@ -58,7 +59,7 @@ static void OPM_FindInstallDir (void); static void OPM_FindLine (Files_File f, Files_Rider *r, ADDRESS *r__typ, INT64 pos); static void OPM_FingerprintBytes (INT32 *fp, SYSTEM_BYTE *bytes, ADDRESS bytes__len); export void OPM_Get (CHAR *ch); -export void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len); +export void OPM_Init (BOOLEAN *done); export void OPM_InitOptions (void); export INT16 OPM_Integer (INT64 n); static BOOLEAN OPM_IsProbablyInstallDir (CHAR *s, ADDRESS s__len); @@ -449,7 +450,7 @@ void OPM_InitOptions (void) Files_SetSearchPath(searchpath, 1024); } -void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len) +void OPM_Init (BOOLEAN *done) { Texts_Text T = NIL; INT32 beg, end, time; @@ -465,7 +466,6 @@ void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len) Texts_Open(T, s, 256); OPM_LogWStr(s, 256); OPM_LogWStr((CHAR*)" ", 3); - __COPY(s, mname, mname__len); __COPY(s, OPM_SourceFileName, 256); if (T->len == 0) { OPM_LogWStr(s, 256); @@ -773,7 +773,7 @@ void OPM_OldSym (CHAR *modName, ADDRESS modName__len, BOOLEAN *done) Files_Set(&OPM_oldSF, Files_Rider__typ, OPM_oldSFile, 0); Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&tag); Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&ver); - if (tag != 0xf7 || ver != 0x82) { + if (tag != 0xf7 || ver != 0x83) { OPM_err(-306); OPM_CloseOldSym(); *done = 0; @@ -818,8 +818,20 @@ void OPM_RegisterNewSym (void) } } -void OPM_DeleteNewSym (void) +void OPM_DeleteNewSym (CHAR *modulename, ADDRESS modulename__len) { + OPM_FileName fn; + INT16 res; + OPM_MakeFileName((void*)modulename, modulename__len, (void*)fn, 32, (CHAR*)".sym", 5); + Files_Delete(fn, 32, &res); +} + +void OPM_DeleteObj (CHAR *modulename, ADDRESS modulename__len) +{ + OPM_FileName fn; + INT16 res; + OPM_MakeFileName((void*)modulename, modulename__len, (void*)fn, 32, (CHAR*)".o", 3); + Files_Delete(fn, 32, &res); } void OPM_NewSym (CHAR *modName, ADDRESS modName__len) @@ -830,7 +842,7 @@ void OPM_NewSym (CHAR *modName, ADDRESS modName__len) if (OPM_newSFile != NIL) { Files_Set(&OPM_newSF, Files_Rider__typ, OPM_newSFile, 0); Files_Write(&OPM_newSF, Files_Rider__typ, 0xf7); - Files_Write(&OPM_newSF, Files_Rider__typ, 0x82); + Files_Write(&OPM_newSF, Files_Rider__typ, 0x83); } else { OPM_err(153); } @@ -984,7 +996,7 @@ static void OPM_Append (Files_Rider *R, ADDRESS *R__typ, Files_File F) void OPM_OpenFiles (CHAR *moduleName, ADDRESS moduleName__len) { - CHAR FName[32]; + OPM_FileName FName; __COPY(moduleName, OPM_modName, 32); OPM_HFile = Files_New((CHAR*)"", 1); if (OPM_HFile != NIL) { @@ -1010,7 +1022,7 @@ void OPM_OpenFiles (CHAR *moduleName, ADDRESS moduleName__len) void OPM_CloseFiles (void) { - CHAR FName[32]; + OPM_FileName FName; INT16 res; if (OPM_noerr) { OPM_LogWStr((CHAR*)" ", 3); @@ -1048,26 +1060,26 @@ void OPM_CloseFiles (void) static BOOLEAN OPM_IsProbablyInstallDir (CHAR *s, ADDRESS s__len) { - CHAR testpath[1024]; + CHAR testpath[4096]; Platform_FileIdentity identity; __DUP(s, s__len, CHAR); - __COPY(OPM_InstallDir, testpath, 1024); - Strings_Append((CHAR*)"/lib/lib", 9, (void*)testpath, 1024); - Strings_Append((CHAR*)"voc", 4, (void*)testpath, 1024); - Strings_Append((CHAR*)"-O2.a", 6, (void*)testpath, 1024); - if (Platform_IdentifyByName(testpath, 1024, &identity, Platform_FileIdentity__typ) != 0) { + __COPY(OPM_InstallDir, testpath, 4096); + Strings_Append((CHAR*)"/lib/lib", 9, (void*)testpath, 4096); + Strings_Append((CHAR*)"voc", 4, (void*)testpath, 4096); + Strings_Append((CHAR*)"-O2.a", 6, (void*)testpath, 4096); + if (Platform_IdentifyByName(testpath, 4096, &identity, Platform_FileIdentity__typ) != 0) { __DEL(s); return 0; } - __COPY(OPM_InstallDir, testpath, 1024); - Strings_Append((CHAR*)"/2/include/Oberon.h", 20, (void*)testpath, 1024); - if (Platform_IdentifyByName(testpath, 1024, &identity, Platform_FileIdentity__typ) != 0) { + __COPY(OPM_InstallDir, testpath, 4096); + Strings_Append((CHAR*)"/2/include/Oberon.h", 20, (void*)testpath, 4096); + if (Platform_IdentifyByName(testpath, 4096, &identity, Platform_FileIdentity__typ) != 0) { __DEL(s); return 0; } - __COPY(OPM_InstallDir, testpath, 1024); - Strings_Append((CHAR*)"/2/sym/Files.sym", 17, (void*)testpath, 1024); - if (Platform_IdentifyByName(testpath, 1024, &identity, Platform_FileIdentity__typ) != 0) { + __COPY(OPM_InstallDir, testpath, 4096); + Strings_Append((CHAR*)"/2/sym/Files.sym", 17, (void*)testpath, 4096); + if (Platform_IdentifyByName(testpath, 4096, &identity, Platform_FileIdentity__typ) != 0) { __DEL(s); return 0; } @@ -1129,7 +1141,6 @@ export void *OPM__init(void) __REGMOD("OPM", EnumPtrs); __REGCMD("CloseFiles", OPM_CloseFiles); __REGCMD("CloseOldSym", OPM_CloseOldSym); - __REGCMD("DeleteNewSym", OPM_DeleteNewSym); __REGCMD("InitOptions", OPM_InitOptions); __REGCMD("LogWLn", OPM_LogWLn); __REGCMD("RegisterNewSym", OPM_RegisterNewSym); diff --git a/bootstrap/windows-88/OPM.h b/bootstrap/windows-88/OPM.h index dc86bc49..da0a48ee 100644 --- a/bootstrap/windows-88/OPM.h +++ b/bootstrap/windows-88/OPM.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPM__h #define OPM__h @@ -23,13 +23,14 @@ import CHAR OPM_ResourceDir[1024]; import void OPM_CloseFiles (void); import void OPM_CloseOldSym (void); -import void OPM_DeleteNewSym (void); +import void OPM_DeleteNewSym (CHAR *modulename, ADDRESS modulename__len); +import void OPM_DeleteObj (CHAR *modulename, ADDRESS modulename__len); import void OPM_FPrint (INT32 *fp, INT64 val); import void OPM_FPrintLReal (INT32 *fp, LONGREAL val); import void OPM_FPrintReal (INT32 *fp, REAL val); import void OPM_FPrintSet (INT32 *fp, UINT64 val); import void OPM_Get (CHAR *ch); -import void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len); +import void OPM_Init (BOOLEAN *done); import void OPM_InitOptions (void); import INT16 OPM_Integer (INT64 n); import void OPM_LogVT100 (CHAR *vt100code, ADDRESS vt100code__len); diff --git a/bootstrap/windows-88/OPP.c b/bootstrap/windows-88/OPP.c index 25c453d1..0a6a6796 100644 --- a/bootstrap/windows-88/OPP.c +++ b/bootstrap/windows-88/OPP.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -1793,24 +1793,6 @@ void OPP_Module (OPT_Node *prog, UINT32 opt) if (OPP_sym == 63) { OPS_Get(&OPP_sym); } else { - OPM_LogWLn(); - OPM_LogWStr((CHAR*)"Unexpected symbol found when MODULE expected:", 46); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" sym: ", 15); - OPM_LogWNum(OPP_sym, 1); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" OPS.name: ", 15); - OPM_LogWStr(OPS_name, 256); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" OPS.str: ", 15); - OPM_LogWStr(OPS_str, 256); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" OPS.numtyp: ", 15); - OPM_LogWNum(OPS_numtyp, 1); - OPM_LogWLn(); - OPM_LogWStr((CHAR*)" OPS.intval: ", 15); - OPM_LogWNum(OPS_intval, 1); - OPM_LogWLn(); OPP_err(16); } if (OPP_sym == 38) { diff --git a/bootstrap/windows-88/OPP.h b/bootstrap/windows-88/OPP.h index bf0f96d7..dc8aa405 100644 --- a/bootstrap/windows-88/OPP.h +++ b/bootstrap/windows-88/OPP.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/windows-88/OPS.c b/bootstrap/windows-88/OPS.c index 807c0ce5..d0a1851a 100644 --- a/bootstrap/windows-88/OPS.c +++ b/bootstrap/windows-88/OPS.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-88/OPS.h b/bootstrap/windows-88/OPS.h index a15d8712..608979a8 100644 --- a/bootstrap/windows-88/OPS.h +++ b/bootstrap/windows-88/OPS.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/windows-88/OPT.c b/bootstrap/windows-88/OPT.c index 8fb5d86e..1a106cda 100644 --- a/bootstrap/windows-88/OPT.c +++ b/bootstrap/windows-88/OPT.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -49,6 +49,15 @@ typedef INT8 glbmno[64]; } OPT_ImpCtxt; +typedef + struct OPT_LinkDesc *OPT_Link; + +typedef + struct OPT_LinkDesc { + OPS_Name name; + OPT_Link next; + } OPT_LinkDesc; + typedef struct OPT_NodeDesc *OPT_Node; @@ -101,6 +110,7 @@ static OPT_ExpCtxt OPT_expCtxt; static INT32 OPT_nofhdfld; static BOOLEAN OPT_newsf, OPT_findpc, OPT_extsf, OPT_sfpresent, OPT_symExtended, OPT_symNew; static INT32 OPT_recno; +export OPT_Link OPT_Links; export ADDRESS *OPT_ConstDesc__typ; export ADDRESS *OPT_ObjDesc__typ; @@ -108,6 +118,7 @@ export ADDRESS *OPT_StrDesc__typ; export ADDRESS *OPT_NodeDesc__typ; export ADDRESS *OPT_ImpCtxt__typ; export ADDRESS *OPT_ExpCtxt__typ; +export ADDRESS *OPT_LinkDesc__typ; export void OPT_Align (INT32 *adr, INT32 base); export INT32 OPT_BaseAlignment (OPT_Struct typ); @@ -131,6 +142,7 @@ export void OPT_IdFPrint (OPT_Struct typ); export void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done); static void OPT_InConstant (INT32 f, OPT_Const conval); static OPT_Object OPT_InFld (void); +static void OPT_InLinks (void); static void OPT_InMod (INT8 *mno); static void OPT_InName (CHAR *name, ADDRESS name__len); static OPT_Object OPT_InObj (INT8 mno); @@ -154,6 +166,7 @@ export void OPT_OpenScope (INT8 level, OPT_Object owner); static void OPT_OutConstant (OPT_Object obj); static void OPT_OutFlds (OPT_Object fld, INT32 adr, BOOLEAN visible); static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, INT32 adr); +static void OPT_OutLinks (void); static void OPT_OutMod (INT16 mno); static void OPT_OutName (CHAR *name, ADDRESS name__len); static void OPT_OutObj (OPT_Object obj); @@ -442,6 +455,8 @@ void OPT_Init (OPS_Name name, UINT32 opt) OPT_findpc = __IN(8, opt, 32); OPT_extsf = OPT_newsf || __IN(9, opt, 32); OPT_sfpresent = 1; + __NEW(OPT_Links, OPT_LinkDesc); + __MOVE(name, OPT_Links->name, 256); } void OPT_Close (void) @@ -1011,6 +1026,26 @@ static void OPT_InMod (INT8 *mno) } } +static void OPT_InLinks (void) +{ + OPS_Name linkname; + OPT_Link l = NIL; + OPT_InName((void*)linkname, 256); + while (linkname[0] != 0x00) { + l = OPT_Links; + while ((l != NIL && __STRCMP(l->name, linkname) != 0)) { + l = l->next; + } + if (l == NIL) { + l = OPT_Links; + __NEW(OPT_Links, OPT_LinkDesc); + OPT_Links->next = l; + __MOVE(linkname, OPT_Links->name, 256); + } + OPT_InName((void*)linkname, 256); + } +} + static void OPT_InConstant (INT32 f, OPT_Const conval) { CHAR ch; @@ -1461,6 +1496,7 @@ void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done) OPM_OldSym((void*)name, 256, &*done); if (*done) { OPT_InMod(&mno); + OPT_InLinks(); OPT_impCtxt.nextTag = OPM_SymRInt(); while (!OPM_eofSF()) { obj = OPT_InObj(mno); @@ -1507,6 +1543,17 @@ static void OPT_OutMod (INT16 mno) } } +static void OPT_OutLinks (void) +{ + OPT_Link l = NIL; + l = OPT_Links; + while (l != NIL) { + OPT_OutName((void*)l->name, 256); + l = l->next; + } + OPM_SymWCh(0x00); +} + static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, INT32 adr) { INT32 i, j, n; @@ -1833,6 +1880,7 @@ void OPT_Export (BOOLEAN *ext, BOOLEAN *new) if (OPM_noerr) { OPM_SymWInt(16); OPT_OutName((void*)OPT_SelfName, 256); + OPT_OutLinks(); OPT_expCtxt.reffp = 0; OPT_expCtxt.ref = 14; OPT_expCtxt.nofm = 1; @@ -1854,7 +1902,7 @@ void OPT_Export (BOOLEAN *ext, BOOLEAN *new) OPT_newsf = 0; OPT_symNew = 0; if (!OPM_noerr || OPT_findpc) { - OPM_DeleteNewSym(); + OPM_DeleteNewSym((void*)OPT_SelfName, 256); } } } @@ -1969,6 +2017,7 @@ static void EnumPtrs(void (*P)(void*)) P(OPT_universe); P(OPT_syslink); __ENUMR(&OPT_impCtxt, OPT_ImpCtxt__typ, 5184, 1, P); + P(OPT_Links); } __TDESC(OPT_ConstDesc, 1, 1) = {__TDFLDS("ConstDesc", 40), {0, -16}}; @@ -2008,6 +2057,7 @@ __TDESC(OPT_ImpCtxt, 1, 510) = {__TDFLDS("ImpCtxt", 5184), {16, 24, 32, 40, 48, 3856, 3864, 3872, 3880, 3888, 3896, 3904, 3912, 3920, 3928, 3936, 3944, 3952, 3960, 3968, 3976, 3984, 3992, 4000, 4008, 4016, 4024, 4032, 4040, 4048, 4056, 4064, 4072, 4080, 4088, -4088}}; __TDESC(OPT_ExpCtxt, 1, 0) = {__TDFLDS("ExpCtxt", 72), {-8}}; +__TDESC(OPT_LinkDesc, 1, 1) = {__TDFLDS("LinkDesc", 264), {256, -16}}; export void *OPT__init(void) { @@ -2024,6 +2074,7 @@ export void *OPT__init(void) __INITYP(OPT_NodeDesc, OPT_NodeDesc, 0); __INITYP(OPT_ImpCtxt, OPT_ImpCtxt, 0); __INITYP(OPT_ExpCtxt, OPT_ExpCtxt, 0); + __INITYP(OPT_LinkDesc, OPT_LinkDesc, 0); /* BEGIN */ OPT_topScope = NIL; OPT_OpenScope(0, NIL); diff --git a/bootstrap/windows-88/OPT.h b/bootstrap/windows-88/OPT.h index 9a187fc7..7483f169 100644 --- a/bootstrap/windows-88/OPT.h +++ b/bootstrap/windows-88/OPT.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPT__h #define OPT__h @@ -21,6 +21,15 @@ typedef LONGREAL realval; } OPT_ConstDesc; +typedef + struct OPT_LinkDesc *OPT_Link; + +typedef + struct OPT_LinkDesc { + OPS_Name name; + OPT_Link next; + } OPT_LinkDesc; + typedef struct OPT_NodeDesc *OPT_Node; @@ -75,11 +84,13 @@ import INT8 OPT_nofGmod; import OPT_Object OPT_GlbMod[64]; import OPS_Name OPT_SelfName; import BOOLEAN OPT_SYSimported; +import OPT_Link OPT_Links; import ADDRESS *OPT_ConstDesc__typ; import ADDRESS *OPT_ObjDesc__typ; import ADDRESS *OPT_StrDesc__typ; import ADDRESS *OPT_NodeDesc__typ; +import ADDRESS *OPT_LinkDesc__typ; import void OPT_Align (INT32 *adr, INT32 base); import INT32 OPT_BaseAlignment (OPT_Struct typ); diff --git a/bootstrap/windows-88/OPV.c b/bootstrap/windows-88/OPV.c index ab98ed73..4d29b076 100644 --- a/bootstrap/windows-88/OPV.c +++ b/bootstrap/windows-88/OPV.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-88/OPV.h b/bootstrap/windows-88/OPV.h index 5654d36e..7c94fced 100644 --- a/bootstrap/windows-88/OPV.h +++ b/bootstrap/windows-88/OPV.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/windows-88/Out.c b/bootstrap/windows-88/Out.c index 87f59955..01c22546 100644 --- a/bootstrap/windows-88/Out.c +++ b/bootstrap/windows-88/Out.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-88/Out.h b/bootstrap/windows-88/Out.h index b846b299..311e737d 100644 --- a/bootstrap/windows-88/Out.h +++ b/bootstrap/windows-88/Out.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Out__h #define Out__h diff --git a/bootstrap/windows-88/Platform.c b/bootstrap/windows-88/Platform.c index b47b0d82..944c4407 100644 --- a/bootstrap/windows-88/Platform.c +++ b/bootstrap/windows-88/Platform.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-88/Platform.h b/bootstrap/windows-88/Platform.h index 76ed0ffb..4311c64a 100644 --- a/bootstrap/windows-88/Platform.h +++ b/bootstrap/windows-88/Platform.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Platform__h #define Platform__h diff --git a/bootstrap/windows-88/Reals.c b/bootstrap/windows-88/Reals.c index 2ecd8371..11ad01bd 100644 --- a/bootstrap/windows-88/Reals.c +++ b/bootstrap/windows-88/Reals.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-88/Reals.h b/bootstrap/windows-88/Reals.h index 570e7d72..bf708519 100644 --- a/bootstrap/windows-88/Reals.h +++ b/bootstrap/windows-88/Reals.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/windows-88/Strings.c b/bootstrap/windows-88/Strings.c index f911a688..06972c90 100644 --- a/bootstrap/windows-88/Strings.c +++ b/bootstrap/windows-88/Strings.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-88/Strings.h b/bootstrap/windows-88/Strings.h index 7645aa6e..fd7f283d 100644 --- a/bootstrap/windows-88/Strings.h +++ b/bootstrap/windows-88/Strings.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/windows-88/Texts.c b/bootstrap/windows-88/Texts.c index 74cd62c7..2bfa4511 100644 --- a/bootstrap/windows-88/Texts.c +++ b/bootstrap/windows-88/Texts.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-88/Texts.h b/bootstrap/windows-88/Texts.h index be7b64a2..21401f61 100644 --- a/bootstrap/windows-88/Texts.h +++ b/bootstrap/windows-88/Texts.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/windows-88/VT100.c b/bootstrap/windows-88/VT100.c index 1e0fffa9..baa92092 100644 --- a/bootstrap/windows-88/VT100.c +++ b/bootstrap/windows-88/VT100.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-88/VT100.h b/bootstrap/windows-88/VT100.h index 7522f9d1..4c0087ac 100644 --- a/bootstrap/windows-88/VT100.h +++ b/bootstrap/windows-88/VT100.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef VT100__h #define VT100__h diff --git a/bootstrap/windows-88/extTools.c b/bootstrap/windows-88/extTools.c index d2c67400..75768aca 100644 --- a/bootstrap/windows-88/extTools.c +++ b/bootstrap/windows-88/extTools.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-88/extTools.h b/bootstrap/windows-88/extTools.h index fb167591..fb870961 100644 --- a/bootstrap/windows-88/extTools.h +++ b/bootstrap/windows-88/extTools.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/12/14]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/18]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef extTools__h #define extTools__h