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

⟦ae6e3f51f⟧ TextFile

    Length: 5074 (0x13d2)
    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 Log;
with Profile;
package body File_Operations is

    procedure Open_To_Read  
                 (File_Name : in String := ">> FULL PATHNAME <<";
                  The_File : out Io.File_Type;  
                  Response : in String := "<PROFILE>") is
        --
        Old_Response_Profile : Profile.Response_Profile := Profile.Get;
        New_Response_Profile : Profile.Response_Profile :=
           Profile.Value (Response);
        --
        Temp_File : Io.File_Type;
        --
    begin
        --
        Profile.Set (New_Response_Profile);
        Log.Put_Line ("[Open_To_Read, File_Name => """ & File_Name &
                      """, The_File => <File_Type>, Response=> """ &
                      Response & """]", Profile.Auxiliary_Msg);
        Io.Open (Temp_File, Io.In_File, File_Name);
        The_File := Temp_File;
        Log.Put_Line ("File """ & File_Name & """ opened for reading",
                      Profile.Positive_Msg);
        Log.Put_Line ("[end of Open_To_Read operation--no error(s) detected]");
        Profile.Set (Old_Response_Profile);
        --
    exception
        when others =>
            -- Couldn't open the file for some reason.
            Log.Put_Line ("Problem encountered opening file """ &
                          File_Name & """ for reading", Profile.Error_Msg);
            Log.Put_Line ("[end of Open_To_Read operation--error(s) detected]");
            Profile.Set (Old_Response_Profile);
            raise File_Problem;
            --
    end Open_To_Read;

    procedure Open_To_Write  
                 (File_Name : in String := ">> FULL PATHNAME <<";
                  The_File : out Io.File_Type;  
                  Response : in String := "<PROFILE>") is
        --
        Old_Response_Profile : Profile.Response_Profile := Profile.Get;
        New_Response_Profile : Profile.Response_Profile :=
           Profile.Value (Response);
        --
        Temp_File : Io.File_Type;
        --
    begin
        --
        Profile.Set (New_Response_Profile);
        Log.Put_Line ("[Open_To_Write, File_Name => """ & File_Name &
                      """, The_File => <File_Type>, Response=> """ &
                      Response & """]", Profile.Auxiliary_Msg);
        begin
            -- Try to open the file.
            Io.Open (Temp_File, Io.Out_File, File_Name);
            The_File := Temp_File;
            Log.Put_Line ("File """ & File_Name & """ opened for writing",
                          Profile.Positive_Msg);
            Log.Put_Line
               ("[end of Open_To_Write operation--no error(s) detected]");
            Profile.Set (Old_Response_Profile);
            --
        exception
            when others =>  
                begin
                    -- Opening the file didn't work, so try to create it.
                    Io.Create (Temp_File, Io.Out_File, File_Name);
                    The_File := Temp_File;
                    Log.Put_Line ("File """ & File_Name &
                                  """ opened for writing",
                                  Profile.Positive_Msg);
                    Log.Put_Line
                       ("[end of Open_To_Write operation--no error(s) detected]");
                    Profile.Set (Old_Response_Profile);
                exception
                    --
                    when others =>
                        -- Nothing worked.
                        Log.Put_Line ("Problem encountered opening file """ &
                                      File_Name & """ for writing",
                                      Profile.Error_Msg);
                        Log.Put_Line
                           ("[end of Open_To_Write operation--error(s) detected]");
                        Profile.Set (Old_Response_Profile);
                        raise File_Problem;
                        --
                end;
        end;
        --
    end Open_To_Write;

    procedure Close  
                 (This_File : in out Io.File_Type;  
                  Response : in String := "<PROFILE>") is
        --
        Old_Response_Profile : Profile.Response_Profile := Profile.Get;
        New_Response_Profile : Profile.Response_Profile :=
           Profile.Value (Response);
        --
    begin
        --
        Profile.Set (New_Response_Profile);
        Log.Put_Line ("[Close, This_File => <File_Type>, Response => """ &
                      Response & """]", Profile.Auxiliary_Msg);
        Io.Close (This_File);
        Log.Put_Line ("File closed", Profile.Positive_Msg);
        Log.Put_Line ("[end of Close operation--no error(s) detected]");
        Profile.Set (Old_Response_Profile);
        --
    exception
        when others =>
            -- Couldn't close the file for some reason.
            Log.Put_Line
               ("Problem encountered closing file--may already be closed",
                Profile.Negative_Msg);
            Log.Put_Line ("[end of Close operation--error(s) detected]");
            Profile.Set (Old_Response_Profile);
            --
    end Close;

end File_Operations;