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

⟦f5844691b⟧ Ada Source

    Length: 6144 (0x1800)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, function Hash, seg_020b53, separate Mail

Derivation

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

E3 Source Code



with Queue_Generic;
with Map_Generic;
separate (Mail)
task body Box is

    function Hash (Key : Transaction_Id) return Integer;
    package Id_Map is new Map_Generic (20, Transaction_Id, Response_Ids, Hash);
    package Box_Queue is new Queue_Generic (Message_Pointer);


    type Indicator               is (Allocated, Available);
    type Entry_Family_Pool_Array is array (Response_Ids) of Indicator;


    Entry_Family_Pool : Entry_Family_Pool_Array := (others => Available);
    Ids               : Id_Map.Map;
    Mailbox           : Box_Queue.Queue;


    function Hash (Key : Transaction_Id) return Integer is
    begin
        return Key.Id;
    end Hash;

    function Get_Id return Response_Ids is
    begin
        for I in Entry_Family_Pool'Range loop
            if Entry_Family_Pool (I) = Available then
                Entry_Family_Pool (I) := Allocated;
                return I;
            end if;
        end loop;
    end Get_Id;

    procedure Free_Id (Id : Response_Ids) is
    begin
        Entry_Family_Pool (Id) := Available;
    end Free_Id;

begin
    Id_Map.Initialize (Ids);
    Box_Queue.Initialize (Mailbox);

    loop
        select
            accept Deliver (Message : Raw_Message) do
                Box_Queue.Add (Q => Mailbox, X => new Raw_Message'(Message));
            end Deliver;
        or
            accept Deliver_With_Reply (Message     :     Raw_Message;
                                       Response_Id : out Response_Ids) do
                declare
                    Local_Id : Response_Ids := Get_Id;
                begin
                    Box_Queue.Add (Q => Mailbox,
                                   X => new Raw_Message'(Message));
                    Response_Id := Local_Id;
                    Id_Map.Define (Ids, Message.Msg_Transaction_Id, Local_Id);
                end;
            end Deliver_With_Reply;

        or
            accept Respond (Message : Raw_Message) do
                declare
                    Entry_Id : constant Response_Ids :=
                       Id_Map.Eval (Ids, Message.Msg_Transaction_Id);
                begin
                    accept Accept_Response (Entry_Id)
                              (Message : out Message_Pointer) do
                        Free_Id (Entry_Id);
                        Id_Map.Undefine (Ids,
                                         Respond.Message.Msg_Transaction_Id);
                        Message := new Raw_Message'(Respond.Message);
                    end Accept_Response;
                end;
            end Respond;

        or
            when not Box_Queue.Is_Empty (Mailbox) =>
                accept Retrieve (Message : out Message_Pointer) do
                    Message := Box_Queue.First (Mailbox);
                    Box_Queue.Delete (Mailbox);
                end Retrieve;
        or
            accept Conditional_Retrieve (Message : out Message_Pointer) do
                if Box_Queue.Is_Empty (Mailbox) then
                    Message := null;
                else
                    Message := Box_Queue.First (Mailbox);
                    Box_Queue.Delete (Mailbox);
                end if;
            end Conditional_Retrieve;
        or
            terminate;
        end select;
    end loop;
end Box;

E3 Meta Data

    nblk1=5
    nid=0
    hdr6=a
        [0x00] rec0=22 rec1=00 rec2=01 rec3=01e
        [0x01] rec0=02 rec1=00 rec2=05 rec3=040
        [0x02] rec0=1c rec1=00 rec2=02 rec3=06a
        [0x03] rec0=17 rec1=00 rec2=03 rec3=006
        [0x04] rec0=0c rec1=00 rec2=04 rec3=000
    tail 0x2151c7e22838d44a64363 0x42a00088462061e03