Fix overenthusiastic deletion of .sym files for -F forcenewym. Whoops.

This commit is contained in:
David Brown 2016-12-18 16:33:41 +00:00
parent 28d4bc8219
commit 5c5ca01dbc
3 changed files with 22 additions and 20 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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