[Oberon] SystemV- Heap + Module Space

Chris Burrows chris at cfbsoftware.com
Sat Jan 5 13:21:20 CET 2019


> -----Original Message-----
> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
> Tomas Kral
> Sent: Saturday, 5 January 2019 10:30 PM
> To: oberon at lists.inf.ethz.ch
> Subject: Re: [Oberon] SystemV- Heap + Module Space
> 
> On Sat, 5 Jan 2019 22:07:37 +1030
> Chris Burrows <chris at cfbsoftware.com> wrote:
> 
> > IF ch # "O" THEN (*corrupted file*)  mod := NIL; error(4, name) END
> 
> IF ch # "O" THEN (*corrupted file*)  mod := NIL; error(5(*[4]*),
> name) END ???
> 

No - not if you believe TextFrames.Call. 

This calls Oberon.Call which in turn calls Modules.Load. It then displays an
error message according to the value of res set by Modules.Load as follows:

      Oberon.SetPar(F, F.text, pos + S.len); Oberon.Call(S.s, res);
      IF res > 0 THEN
        Texts.WriteString(W, "Call error: "); Texts.WriteString(W,
Modules.importing);
        IF res = 1 THEN Texts.WriteString(W, " module not found")
        ELSIF res = 2 THEN  Texts.WriteString(W, " bad version")
        ELSIF res = 3 THEN Texts.WriteString(W, " imports ");
          Texts.WriteString(W, Modules.imported); Texts.WriteString(W, "
with bad key");
        ELSIF res = 4 THEN Texts.WriteString(W, " corrupted obj file")
        ELSIF res = 5 THEN Texts.WriteString(W, " command not found")
        ELSIF res = 7 THEN Texts.WriteString(W, " insufficient space")
        END;
        Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf)
      END

I would have defined all of those res values as exported named constants in
module Modules. 

Apart from all the other advantages of using named constants that would have
made it easier to eliminate the potentially confusing, missing value, res =
6, which presumably used to exist. 

Chris.



More information about the Oberon mailing list