From 5c5ca01dbc144475eba295db18b3d122c3238dc9 Mon Sep 17 00:00:00 2001 From: David Brown Date: Sun, 18 Dec 2016 16:33:41 +0000 Subject: [PATCH] Fix overenthusiastic deletion of .sym files for -F forcenewym. Whoops. --- src/compiler/Compiler.Mod | 4 ++-- src/compiler/OPM.Mod | 30 ++++++++++++++---------------- src/compiler/OPT.Mod | 8 ++++++-- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/compiler/Compiler.Mod b/src/compiler/Compiler.Mod index c9f454cf..9e44a180 100644 --- a/src/compiler/Compiler.Mod +++ b/src/compiler/Compiler.Mod @@ -22,7 +22,7 @@ MODULE Compiler; (* J. Templ 3.2.95 *) OPV.Module(p); IF OPM.noerr THEN IF (OPM.mainprog IN OPM.Options) & (OPM.modName # "SYSTEM") THEN - OPM.DeleteNewSym(OPT.SelfName); + OPM.DeleteSym(OPT.SelfName); OPM.LogVT100(VT100.Green); OPM.LogWStr(" Main program."); OPM.LogVT100(VT100.ResetAll); ELSE IF new THEN @@ -34,7 +34,7 @@ MODULE Compiler; (* J. Templ 3.2.95 *) END END; ELSE - OPM.DeleteNewSym(OPT.SelfName) + OPM.DeleteSym(OPT.SelfName) END END END; diff --git a/src/compiler/OPM.Mod b/src/compiler/OPM.Mod index eb41b52c..ecfe4ac3 100644 --- a/src/compiler/OPM.Mod +++ b/src/compiler/OPM.Mod @@ -339,8 +339,10 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) IF verbose IN Options THEN VerboseListSizes END; ResourceDir := InstallDir; - Strings.Append("/", ResourceDir); - Strings.Append(Model, ResourceDir); + IF ResourceDir[0] # 0X THEN + Strings.Append("/", ResourceDir); + Strings.Append(Model, ResourceDir); + END; modules := ""; Platform.GetEnv("MODULES", modules); searchpath := "."; Platform.GetEnv("OBERON", searchpath); @@ -592,18 +594,14 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) BEGIN oldSFile := NIL; done := FALSE; MakeFileName(modName, fileName, SFext); - IF forcenewsym IN Options THEN - Files.Delete(fileName, res) - ELSE - oldSFile := Files.Old(fileName); done := oldSFile # NIL; - IF done THEN - Files.Set(oldSF, oldSFile, 0); Files.Read(oldSF, tag); Files.Read(oldSF, ver); - IF (tag # SFtag) OR (ver # SFver) THEN - (* Possibly a symbol file from another Oberon implementation, e.g. HP-Oberon, - or from a symbol incompatible version of this Oberon. *) - IF ~(newsf IN Options) THEN err(-306) END; - CloseOldSym; done := FALSE - END + oldSFile := Files.Old(fileName); done := oldSFile # NIL; + IF done THEN + Files.Set(oldSF, oldSFile, 0); Files.Read(oldSF, tag); Files.Read(oldSF, ver); + IF (tag # SFtag) OR (ver # SFver) THEN + (* Possibly a symbol file from another Oberon implementation, e.g. HP-Oberon, + or from a symbol incompatible version of this Oberon. *) + IF ~(newsf IN Options) THEN err(-306) END; + CloseOldSym; done := FALSE END END END OldSym; @@ -642,10 +640,10 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) IF (modName # "SYSTEM") OR (mainprog IN Options) THEN Files.Register(newSFile) END END RegisterNewSym; - PROCEDURE DeleteNewSym*(VAR modulename: ARRAY OF CHAR); + PROCEDURE DeleteSym*(VAR modulename: ARRAY OF CHAR); VAR fn: FileName; res: INTEGER; BEGIN MakeFileName(modulename, fn, SFext); Files.Delete(fn, res) - END DeleteNewSym; + END DeleteSym; PROCEDURE DeleteObj*(VAR modulename: ARRAY OF CHAR); VAR fn: FileName; res: INTEGER; diff --git a/src/compiler/OPT.Mod b/src/compiler/OPT.Mod index 2c54d11f..2641703e 100644 --- a/src/compiler/OPT.Mod +++ b/src/compiler/OPT.Mod @@ -1047,7 +1047,11 @@ BEGIN ELSE impCtxt.nofr := FirstRef(*Comp+1*); impCtxt.minr := maxStruct; impCtxt.nofm := 0; impCtxt.self := aliasName = "@self"; impCtxt.reffp := 0; - OPM.OldSym(name, done); + IF impCtxt.self & (OPM.forcenewsym IN OPM.Options) THEN + OPM.DeleteSym(name); done := FALSE + ELSE + OPM.OldSym(name, done) + END; IF done THEN InMod(mno); InLinks; impCtxt.nextTag := OPM.SymRInt(); @@ -1282,7 +1286,7 @@ END Import; END; newsf := FALSE; symNew := FALSE; (* because of call to FPrintErr from OPL *) IF ~OPM.noerr OR findpc THEN - OPM.DeleteNewSym(SelfName) + OPM.DeleteSym(SelfName) END (* OPM.RegisterNewSym is called in OP2 after writing the object file *) END