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

⟦fefabcd0b⟧ Ada Source

    Length: 8192 (0x2000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Daemon, seg_02c8ba

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 Agent;
with Behavior_Defs;
with Calendar;
with Identifier;
with Message;
with Message_Transport;
with Method;
with Parameter;
with Time_Utilities;


with Text_Io;
use Text_Io;
package body Daemon is

    Count : Integer := 0;


    procedure Publish (Self : Identifier.Object) is
        Status : Message_Transport.Status_Code;
    begin
        Behavior_Defs.Send_Message
           (Message => Message.Create
                          (Class => Message.Publication,
                           Addressee => Identifier.Hash
                                           (Id => Identifier.Broker),
                           Sender => Identifier.Hash (Id => Self),
                           Method => "count",
                           Parameter_Name => "count",
                           Parameter_Class => "string",
                           Parameter_Value => Parameter.Void),
            Status => Status);
    end Publish;


    procedure Process_Message
                 (Message : Standard.Message.Object; Handled : out Boolean);


    package A is new Agent (Publish, Process_Message);


    procedure Actor is
        Status : Message_Transport.Status_Code;
        Mes : Message.Object;
        Expired : Boolean;

        use Calendar;

        Interval : constant Duration := 10.0;
        Next_Time : Time := Clock + Interval;
    begin
        loop
            Put_Line ("actor: we delay");
            delay Next_Time - Clock;

            Put_Line ("actor: delay is over");

            Behavior_Defs.Send_Message
               (Message => Message.Create
                              (Class => Message.Request,
                               Addressee => Identifier.Hash
                                               (Id => Identifier.Broker),
                               Sender => Identifier.Hash (Id => A.Get_Identity),
                               Method => "date",
                               Parameter_Name => "date",
                               Parameter_Class => "string",
                               Parameter_Value => Parameter.Void),
                Status => Status);

            Put_Line ("actor: request sent, we wait for reply");
            A.Wait_For_Reply
               (Message => Mes, Time_Out => 5.0, Expired => Expired);

            Put_Line ("actor: we do no more wait");
            if not Expired then
                Put_Line ("actor: received reply => " & Message.Image (Mes));
            else
                Put_Line ("actor: time_out has expired");
            end if;

            Next_Time := Next_Time + Interval;

        end loop;
    end Actor;



    package Core is new A.Core (Actor);


    procedure Process_Message
                 (Message : Standard.Message.Object; Handled : out Boolean) is
        Time : constant String := Time_Utilities.Image
                                     (Date => Time_Utilities.Get_Time,
                                      Date_Style => Time_Utilities.Expanded,
                                      Time_Style => Time_Utilities.Expanded,
                                      Contents => Time_Utilities.Both);

        Status : Message_Transport.Status_Code;

        use Message_Transport;
    begin
        if Method.Get_Name (Standard.Message.Get_Method (Message)) =
           "count" then
            New_Line;
            Put_Line ("+++ satisfying request for count");
            Behavior_Defs.Send_Message
               (Message => Standard.Message.Create
                              (Class => Standard.Message.Forward,
                               Addressee =>
                                  Standard.Message.Get_Sender (Message),
                               Sender => Identifier.Hash (A.Get_Identity),
                               Method => "count",
                               Parameter_Name => "count",
                               Parameter_Class => "string",
                               Parameter_Value => Integer'Image (Count)),
                Status => Status);
            if Status = Ok then
                Put_Line ("--- asking broker to forward");
            else
                Put_Line ("*** failed asking broker to forward");
            end if;

            Handled := True;
        else

            Handled := False;
        end if;

    end Process_Message;


    procedure Start is
    begin
        Put_Line ("+++ Starting Daemon ");
        Core.Start;
    end Start;

end Daemon;

E3 Meta Data

    nblk1=7
    nid=4
    hdr6=c
        [0x00] rec0=25 rec1=00 rec2=01 rec3=012
        [0x01] rec0=1e rec1=00 rec2=05 rec3=006
        [0x02] rec0=1d rec1=00 rec2=03 rec3=03a
        [0x03] rec0=0c rec1=00 rec2=02 rec3=01c
        [0x04] rec0=18 rec1=00 rec2=06 rec3=01c
        [0x05] rec0=0a rec1=00 rec2=07 rec3=000
        [0x06] rec0=0a rec1=00 rec2=07 rec3=001
    tail 0x21524ecda84058055d646 0x42a00088462060003
Free Block Chain:
  0x4: 0000  00 00 01 b5 80 2a 20 20 20 20 44 61 74 65 5f 53  ┆     *    Date_S┆