[Oberon] Olr: Problem with module Files

Gérard Meunier gemeu at free.fr
Fri May 15 13:48:29 CEST 2015


Hello Peter,

I'm very pleased to see my old programs run again. Thanks a lot for that.
However, something is going wrong with the procedure Files.Close. It
should "flush the changes made to a file to disk", but no change is made
on the disk. Here is a test program that shows this:

MODULE FilesTest;
   
    IMPORT
       
        Files, Out;
   
    CONST
       
        TSI = SIZE(LONGINT);
   
    PROCEDURE Do*;
       
        CONST
           
            nF = "FilesTest.Data";
       
        VAR
           
            f: Files.File;
            r, w: Files.Rider;
            res, n, p: LONGINT;
       
        BEGIN (*Do*)
            f:= Files.New(nF);
            ASSERT(f # NIL);
            Files.Set(w, f, 0);
            Files.WriteLInt(w, 374);
            Files.Register(f);
            n := 0;
            f := NIL;
            f:= Files.Old(nF);
            ASSERT(f # NIL);
            Files.Set(w, f, TSI);
            Files.WriteLInt(w, 875);
            Files.Close(f);
            f := NIL;
            f := Files.Old(nF);
            ASSERT(f # NIL);
            Files.Set(r, f, 0);
            Files.ReadLInt(r, n);
            ASSERT(r.res= 0);
            Out.Int(n, 0); Out.Ln;
            Files.ReadLInt(r, p);
            ASSERT(r.res= 0);
            Out.Int(p, 0); Out.Ln;
        END Do;
   
    END FilesTest.

FilesTest.Do

As you can see, the last ASSERT triggers a trap: the second LONGINT has
never been saved to disk.
(olr150430 used under Ubuntu Gnome 14.04)

Regards.

Gérard



More information about the Oberon mailing list