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

⟦527bb1d5f⟧ Ada Source

    Length: 6144 (0x1800)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Safe_Support, seg_04b963

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 System;
with File_Support;
with Text_Io;
with V_I_Mutex;
with V_I_Tasks;
with Unchecked_Conversion;
package body Safe_Support is

    -- Ada tasking and abort safe file I/O support.

    Text_Io_Mutex : V_I_Mutex.Safe_Mutex_T;
    File_Support_Mutex : V_I_Mutex.Safe_Mutex_T;
    Os_Files_Mutex : V_I_Mutex.Safe_Mutex_T;

    function To_File_Ptr is new Unchecked_Conversion
                                   (Text_Io.File_Type, File_Support.File_Ptr);

    function "=" (Left, Right : File_Support.File_Ptr) return Boolean
        renames File_Support."=";

    function File_Mutex_Init (File : File_Support.File_Ptr) return Boolean is
    begin
        return V_I_Mutex.Ts_Mutex_Init
                  (V_I_Mutex.To_A_Safe_Mutex_T (File.Mutex'Address),
                   V_I_Mutex.To_A_Safe_Mutex_Attr_T
                      (V_I_Tasks.Get_Configuration_Table.
                       Ada_Io_Mutex_Attr_Address));
    end File_Mutex_Init;
    procedure File_Mutex_Destroy (File : File_Support.File_Ptr) is
    begin
        V_I_Mutex.Ts_Mutex_Destroy
           (V_I_Mutex.To_A_Safe_Mutex_T (File.Mutex'Address));
    end File_Mutex_Destroy;

    procedure File_Lock (File : File_Support.File_Ptr) is
    begin
        if File /= null then
            V_I_Mutex.Ts_Mutex_Lock
               (V_I_Mutex.To_A_Safe_Mutex_T (File.Mutex'Address));
        end if;
    end File_Lock;
    procedure File_Unlock (File : File_Support.File_Ptr) is
    begin
        if File /= null then
            V_I_Mutex.Ts_Mutex_Unlock
               (V_I_Mutex.To_A_Safe_Mutex_T (File.Mutex'Address));
        end if;
    end File_Unlock;

    procedure File_Lock (File : Text_Io.File_Type) is
        File_Ptr : File_Support.File_Ptr := To_File_Ptr (File);
    begin
        if File_Ptr /= null then
            V_I_Mutex.Ts_Mutex_Lock (V_I_Mutex.To_A_Safe_Mutex_T
                                        (File_Ptr.Mutex'Address));
        end if;
    end File_Lock;
    procedure File_Unlock (File : Text_Io.File_Type) is
        File_Ptr : File_Support.File_Ptr := To_File_Ptr (File);
    begin
        if File_Ptr /= null then
            V_I_Mutex.Ts_Mutex_Unlock (V_I_Mutex.To_A_Safe_Mutex_T
                                          (File_Ptr.Mutex'Address));
        end if;
    end File_Unlock;


    procedure Text_Io_Lock is
    begin
        V_I_Mutex.Ts_Mutex_Lock (V_I_Mutex.To_A_Safe_Mutex_T
                                    (Text_Io_Mutex'Address));
    end Text_Io_Lock;
    procedure Text_Io_Unlock is
    begin
        V_I_Mutex.Ts_Mutex_Unlock
           (V_I_Mutex.To_A_Safe_Mutex_T (Text_Io_Mutex'Address));
    end Text_Io_Unlock;

    procedure File_Support_Lock is
    begin
        V_I_Mutex.Ts_Mutex_Lock (V_I_Mutex.To_A_Safe_Mutex_T
                                    (File_Support_Mutex'Address));
    end File_Support_Lock;
    procedure File_Support_Unlock is
    begin
        V_I_Mutex.Ts_Mutex_Unlock (V_I_Mutex.To_A_Safe_Mutex_T
                                      (File_Support_Mutex'Address));
    end File_Support_Unlock;

    procedure Os_Files_Lock is
    begin
        V_I_Mutex.Ts_Mutex_Lock (V_I_Mutex.To_A_Safe_Mutex_T
                                    (Os_Files_Mutex'Address));
    end Os_Files_Lock;
    procedure Os_Files_Unlock is
    begin
        V_I_Mutex.Ts_Mutex_Unlock (V_I_Mutex.To_A_Safe_Mutex_T
                                      (Os_Files_Mutex'Address));
    end Os_Files_Unlock;

begin
    declare
        Result : Boolean;
        Mutex_Attr : V_I_Mutex.A_Safe_Mutex_Attr_T :=
           V_I_Mutex.To_A_Safe_Mutex_Attr_T
              (V_I_Tasks.Get_Configuration_Table.Ada_Io_Mutex_Attr_Address);
    begin
        Result := V_I_Mutex.Ts_Mutex_Init
                     (V_I_Mutex.To_A_Safe_Mutex_T (Text_Io_Mutex'Address),
                      Mutex_Attr);
        Result := Result or V_I_Mutex.Ts_Mutex_Init
                               (V_I_Mutex.To_A_Safe_Mutex_T
                                   (File_Support_Mutex'Address), Mutex_Attr);
        Result := Result or
                     V_I_Mutex.Ts_Mutex_Init
                        (V_I_Mutex.To_A_Safe_Mutex_T (Os_Files_Mutex'Address),
                         Mutex_Attr);
        if not Result then
            raise Storage_Error;
        end if;
    end;
end Safe_Support;

E3 Meta Data

    nblk1=5
    nid=0
    hdr6=a
        [0x00] rec0=1e rec1=00 rec2=01 rec3=014
        [0x01] rec0=1a rec1=00 rec2=02 rec3=084
        [0x02] rec0=1d rec1=00 rec2=03 rec3=048
        [0x03] rec0=1b rec1=00 rec2=04 rec3=036
        [0x04] rec0=0c rec1=00 rec2=05 rec3=000
    tail 0x21750ba6a868435f1f2f7 0x42a00088462060003