DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

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

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦cb09f925e⟧ Ada Source

    Length: 5120 (0x1400)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Low_Level_File_Operations, seg_0046e0

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« 
        └─⟦this⟧ 

E3 Source Code



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
            begin
                Io.Create (New_File, Io.Out_File, This_File);
                Io.Close (New_File);

            exception
                when others =>
                    raise Io_Failure;
            end;
        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;

E3 Meta Data

    nblk1=4
    nid=0
    hdr6=8
        [0x00] rec0=28 rec1=00 rec2=01 rec3=008
        [0x01] rec0=24 rec1=00 rec2=02 rec3=000
        [0x02] rec0=2a rec1=00 rec2=03 rec3=016
        [0x03] rec0=27 rec1=00 rec2=04 rec3=001
    tail 0x217002a44815c673f44c9 0x42a00088462061e03