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

⟦580afd80f⟧ TextFile

    Length: 3904 (0xf40)
    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 Directory_Tools;
package body Low_Level_File_Operations is

    procedure Create (This_File : in String) is
        --
        Test_File : Directory_Tools.Object.Handle :=
           Directory_Tools.Naming.Resolution (This_File);
        --
        New_File : Io.File_Type;
        --
    begin
        if (Directory_Tools.Object.Is_Bad (Test_File)) then
            Io.Create (New_File, Io.Out_File, This_File);
            Io.Close (New_File);
        end if;
    end Create;

    function Open_To_Read  
                (This_File : in String) return Io.File_Type is
        --
        The_File : Io.File_Type;
        --
    begin  
        Io.Open (The_File, Io.In_File, This_File);
        return (The_File);
        --
    exception
        when others =>
            -- Couldn't open the file for some reason.
            raise Io_Failure;
            --
    end Open_To_Read;

    procedure Open_To_Read  
                 (This_File : in String; The_File : out Io.File_Type) is
    begin  
        The_File := Open_To_Read (This_File);
        --
    exception
        when others =>
            -- Couldn't open the file for some reason.
            raise Io_Failure;
            --
    end Open_To_Read;

    function Open_To_Write  
                (This_File : in String) return Io.File_Type is
        --
        The_File : Io.File_Type;
        --
    begin
        -- Try to open the file.
        Io.Open (The_File, Io.Out_File, This_File);
        return (The_File);
        --
    exception
        when others =>  
            begin
                -- Opening the file didn't work, so try to create it.
                Io.Create (The_File, Io.Out_File, This_File);
                return (The_File);
                --
            exception
                when others =>
                    -- Nothing worked.
                    raise Io_Failure;
            end;
            --
    end Open_To_Write;

    procedure Open_To_Write  
                 (This_File : in String; The_File : out Io.File_Type) is
    begin
        The_File := Open_To_Write (This_File);
        --
    exception
        when others =>
            raise Io_Failure;
            --
    end Open_To_Write;

    function Open_To_Append  
                (This_File : in String) return Io.File_Type is
        --
        The_File : Io.File_Type;
        --
    begin
        -- Try to open the file for appending.
        Io.Append (The_File, This_File);
        return (The_File);
        --
    exception
        when others =>
            -- Append failed for some reason.
            raise Io_Failure;
            --
    end Open_To_Append;

    procedure Open_To_Append  
                 (This_File : in String; The_File : out Io.File_Type) is
    begin
        The_File := Open_To_Append (This_File);
        --
    exception
        when others =>
            raise Io_Failure;
            --
    end Open_To_Append;

    procedure Close  
                 (This_File : in out Io.File_Type) is  
    begin  
        Io.Close (This_File);
        --
    exception
        when others =>
            -- Couldn't close the file for some reason: assume is closed.
            null;
            --
    end Close;

    procedure Destroy (This_File : in out Io.File_Type) is
    begin
        Io.Delete (This_File);
        --
    exception
        when others =>
            -- Couldn't destroy the file for some reason: assume is destroyed.
            null;
            --
    end Destroy;

    procedure Destroy (This_File : in String) is
        --
        The_File : Io.File_Type;
        --
    begin  
        The_File := Open_To_Write (This_File);
        Io.Delete (The_File);
        --
    exception
        when others =>
            -- Couldn't destroy the file for some reason: assume is destroyed.
            null;
            --
    end Destroy;

end Low_Level_File_Operations;