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 - download
Index: ┃ B T

⟦7f6f49827⟧ TextFile

    Length: 3561 (0xde9)
    Types: TextFile
    Names: »B«

Derivation

└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Behavior;
with Identifier;
with Method;
with Message;
with Message_Transport;
with Parameter;
with Signature;
with Text_Io;
with Time_Utilities;

use Text_Io;
package body Time is

    procedure Process_Message (M : Message.Object);

    task Tx is  
        entry Start;
        entry Go;  
    end Tx;

    package B is new Behavior (Tx.Go, Process_Message);


    procedure Notification (M : Message.Object) is
    begin
        null;
    end Notification;

    procedure Request (M : Message.Object) 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 (Message.Get_Method (M)) = "DATE" then
            B.Send_Message
               (Message => Message.Create
                              (Class => Message.Forward,
                               Addressee => Message.Get_Sender (M),
                               Sender => Identifier.Hash (B.Get_Identity),
                               Method => "date",
                               Parameter_Name => "date",
                               Parameter_Class => "string",
                               Parameter_Value => Time),
                Status => Status);
            if Status = Ok then
                --Put_Line ("--- asking broker to forward");
                null;
            else
                Put_Line ("*** failed asking broker to forward");
            end if;
        end if;
    end Request;

    task body Tx is  
        Status : Message_Transport.Status_Code;
    begin
        accept Start;

        accept Go; -- we have been registered, and can publish

        declare
        begin
            Message_Transport.Put
               (Message =>
                   Message.Image
                      (Message =>
                          Message.Create
                             (Class => Message.Publication,
                              Addressee =>
                                 Identifier.Hash (Id => Identifier.Broker),
                              Sender => Identifier.Hash (Id => B.Get_Identity),
                              Method => "date",
                              Parameter_Name => "date",
                              Parameter_Class => "string",
                              Parameter_Value => Parameter.Void)),
                Remote_Host => Identifier.Get_Host (Id => Identifier.Broker),
                Remote_Socket =>
                   Identifier.Get_Socket (Id => Identifier.Broker),
                Number_Of_Retry => 10,
                Retry_Delay => 0.1,
                Status => Status);
        exception
            when others =>
                Put_Line ("ca a foire");
        end;

        loop  
            delay Duration'Last;
        end loop;
    end Tx;


    procedure Process_Message (M : Message.Object) is
        use Message;
    begin  
        case Message.Get_Class (M) is
            when Message.Request =>
                Request (M);
            when Message.Notification =>
                Notification (M);
            when others =>
                null;
        end case;
    end Process_Message;


    procedure Start is
    begin
        Tx.Start;
    end Start;

end Time;