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

⟦1bd760d9d⟧ Ada Source

    Length: 4096 (0x1000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Low_Level_File_Utilities, seg_0046e2

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;
with Low_Level_File_Operations;
package body Low_Level_File_Utilities is

    procedure Append (This_File      : in String;
                      To_This_File   : in String;
                      Add_Page_Break : in Boolean := False) is

        Source : Io.File_Type;
        Target : Io.File_Type;

        The_Target : Directory_Tools.Object.Handle :=
           Directory_Tools.Naming.Resolution (To_This_File);

        Target_Is_Nonexistent : Boolean := False;

    begin  
        if Directory_Tools.Object.Is_Bad (The_Target) then
            Target_Is_Nonexistent := True;
        end if;
        Low_Level_File_Operations.Open_To_Append (To_This_File, Target);
        Low_Level_File_Operations.Open_To_Read (This_File, Source);
        -- If the target already has some contents, then add a page
        -- break, otherwise don't, since this is the first entry in
        -- the target file.
        if Add_Page_Break and then not Target_Is_Nonexistent then
            Io.New_Page (Target);
        end if;
        while not Io.End_Of_File (Source) loop
            Io.Put_Line (Target, Io.Get_Line (Source));
        end loop;
        Low_Level_File_Operations.Close (Target);
        Low_Level_File_Operations.Close (Source);

    exception
        when others =>
            Low_Level_File_Operations.Close (Target);
            Low_Level_File_Operations.Close (Source);
            raise Io_Failure;

    end Append;

    function Flattened_Text
                (This_File : in Io.File_Type; Current_Text : in String)
                return String is

        The_File : Io.File_Type := This_File;

    begin
        if Io.End_Of_File (The_File) then
            return Current_Text;
        else
            return Flattened_Text (The_File, Current_Text & Ascii.Lf &
                                                Io.Get_Line (The_File));
        end if;
    end Flattened_Text;

    function Flattened_Text (This_File : in String) return String is

        The_File : Io.File_Type;

    begin  
        Low_Level_File_Operations.Open_To_Read (This_File, The_File);
        declare
            The_Text : constant String := Flattened_Text (The_File, "");
        begin
            Low_Level_File_Operations.Close (The_File);
            return The_Text;
        end;

    exception
        when others =>
            Low_Level_File_Operations.Close (The_File);
            raise Io_Failure;

    end Flattened_Text;

end Low_Level_File_Utilities;

E3 Meta Data

    nblk1=3
    nid=0
    hdr6=6
        [0x00] rec0=1c rec1=00 rec2=01 rec3=038
        [0x01] rec0=1e rec1=00 rec2=02 rec3=01e
        [0x02] rec0=17 rec1=00 rec2=03 rec3=000
    tail 0x217002a48815c67427293 0x42a00088462061e03