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

⟦f80b120ed⟧ Ada Source

    Length: 7168 (0x1c00)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Generic_My_Agent, seg_055c8d

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 Bounded_String;
with Const_Orb;
with Queue_Generic;
with Agent_Tools;
with Text_Io;


package body Generic_My_Agent is

    -- Specifications

    task Collecting_Task is
        entry Start;
    end Collecting_Task;

    task Buffering_Task is
        entry Start;
        entry Write_In_Buffering_Fifo (Message : in My_Message.Object);
        entry Read_From_Buffering_Fifo (Message : out My_Message.Object);
    end Buffering_Task;

    task Dispatching_Task is
        entry Start;
    end Dispatching_Task;


    -- Corps

    task body Collecting_Task is

        Message_To_Fifo : My_Message.Object;
    begin  
        accept Start;
        Text_Io.Put_Line ("Collecting_Task has started to run");

        loop  
            My_Message.Receive (Mess => Message_To_Fifo,
                                Local_Id => Local_Socket);
            Buffering_Task.Write_In_Buffering_Fifo (Message_To_Fifo);
            exit when Done;
        end loop;

    end Collecting_Task;


    task body Buffering_Task is

        package My_Fifo is new Queue_Generic (Element => My_Message.Object);
        Buffering_Fifo : My_Fifo.Queue;

    begin
        accept Start;
        Text_Io.Put_Line ("Buffering_Task has started to run");

        loop
            select
                accept Write_In_Buffering_Fifo
                          (Message : in My_Message.Object) do
                    My_Fifo.Add (Buffering_Fifo, Message);
                end Write_In_Buffering_Fifo;
            or
                when not (My_Fifo.Is_Empty (Buffering_Fifo)) =>
                    accept Read_From_Buffering_Fifo
                              (Message : out My_Message.Object) do
                        Message := My_Fifo.First (Buffering_Fifo);
                        My_Fifo.Delete (Buffering_Fifo);
                    end Read_From_Buffering_Fifo;

            end select;
            exit when Done;
        end loop;
    end Buffering_Task;


    task body Dispatching_Task is

        Message_From_Fifo : My_Message.Object;
        Message_Type : My_Message.Kind_Of_Message;

    begin
        accept Start;
        Text_Io.Put_Line ("Dispatching_Task has started to run");

        loop
            Buffering_Task.Read_From_Buffering_Fifo (Message_From_Fifo);  
            Message_Type := My_Message.Get_Operation (Message_From_Fifo);

            case Message_Type is
                when My_Message.Content | My_Message.Notification |
                     My_Message.Reply | My_Message.Forward_Reply |
                     My_Message.Reply_Error |
                     My_Message.Reply_Subscription =>    -- Client
                    Agent_Tools.Print (Message_From_Fifo);
                when
                   My_Message.Forward |
                   My_Message.
                      Forward_Filtration =>                              -- Serveur
                    declare
                        procedure Reply_Of_The_Server is
                           new Agent_Tools.Reply (Service => Service_Server);
                    begin
                        Reply_Of_The_Server
                           (Mess_Received => Message_From_Fifo);
                    end;
                when others =>
                    null;
            end case;
            exit when Done;
        end loop;

    end Dispatching_Task;


    procedure Start_Agent (Agent_Socket : My_Message.My_String) is
    begin  
        Done := False;
        Bounded_String.Copy (Local_Socket, Agent_Socket);
        Collecting_Task.Start;
        Buffering_Task.Start;
        Dispatching_Task.Start;
    end Start_Agent;

    procedure Stop_Agent is
    begin
        delay (5.0);
        Done := True;
        abort Collecting_Task, Buffering_Task, Dispatching_Task;
    end Stop_Agent;

end Generic_My_Agent;

E3 Meta Data

    nblk1=6
    nid=3
    hdr6=8
        [0x00] rec0=29 rec1=00 rec2=01 rec3=02c
        [0x01] rec0=1e rec1=00 rec2=04 rec3=01e
        [0x02] rec0=1b rec1=00 rec2=02 rec3=09c
        [0x03] rec0=22 rec1=00 rec2=06 rec3=000
        [0x04] rec0=1b rec1=00 rec2=03 rec3=000
        [0x05] rec0=0c rec1=00 rec2=04 rec3=001
    tail 0x21760f0de87c05d2f7524 0x42a00088462060003
Free Block Chain:
  0x3: 0000  00 05 02 b6 80 18 20 20 20 20 20 20 20 20 20 20  ┆                ┆
  0x5: 0000  00 00 03 fc 80 3b 20 20 20 20 20 20 20 20 20 20  ┆     ;          ┆