DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: B T

⟦16910caa7⟧ TextFile

    Length: 1807 (0x70f)
    Types: TextFile
    Names: »B«

Derivation

└─⟦180fe333a⟧ Bits:30000405 8mm tape, Rational 1000, SW CATALOG, 10_20_0
└─⟦180fe333a⟧ Bits:30000537 8mm tape, Rational 1000, SW Catalog 10_20_0
    └─⟦5cb1d1d7f⟧ »DATA« 
        └─⟦3b1ee7bd8⟧ 
            └─⟦this⟧ 

TextFile

with Io;
with Low_Level_File_Operations;
package body Files is

    function Create (From_File : in String) return Iterator is
        --
        The_File : Io.File_Type;
        --
        New_Iterator : Iterator;
        --
    begin
        New_Iterator := Lines.Create;
        Low_Level_File_Operations.Open_To_Read (From_File, The_File);
        while (not Io.End_Of_File (The_File)) loop
            Lines.Add (New_Iterator, Lines.Create (Io.Get_Line (The_File)));
        end loop;
        Low_Level_File_Operations.Close (The_File);
        Lines.Reset (New_Iterator);
        return (New_Iterator);
        --
    exception  
        when Low_Level_File_Operations.Io_Failure =>  
            Low_Level_File_Operations.Close (The_File);
            raise Io_Failure;  
        when others =>
            Low_Level_File_Operations.Close (The_File);
            raise;
    end Create;

    procedure Save (To_File : in String; This_Iterator : in out Iterator) is
        --
        The_File : Io.File_Type;
        --
    begin
        Low_Level_File_Operations.Open_To_Write (To_File, The_File);
        Lines.Reset (This_Iterator);
        while (not Lines.Done (This_Iterator)) loop
            Io.Put_Line (The_File, Lines.Image (Lines.Current (This_Iterator)));
            Lines.Next (This_Iterator);
        end loop;
        Low_Level_File_Operations.Close (The_File);
        --
    exception
        when Lines.Not_Initialized =>  
            Low_Level_File_Operations.Close (The_File);
            raise Not_Initialized;
        when Low_Level_File_Operations.Io_Failure =>  
            Low_Level_File_Operations.Close (The_File);
            raise Io_Failure;  
        when others =>
            Low_Level_File_Operations.Close (The_File);
            raise;
    end Save;

end Files;