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

⟦f4f19c967⟧ Ada Source

    Length: 18432 (0x4800)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Little_Orb, seg_05706a

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 Transport_Defs;
with Communication;
with Message;
with Our_Constantes;
use Our_Constantes;
with Our_String;
with Text_Io;
with Run;

package body Little_Orb is
    The_Host_Machine : Transport_Defs.Host_Id (1 .. 4) := (0, 0, 0, 0);
    The_Socket_Machine : Transport_Defs.Socket_Id (1 .. 2) := (0, 0);
    The_Id_Machine : Id_Object.Type_Id := 0;
    The_Connection_Machine : Connection_Data;
    Is_The_End : Boolean := False;
    Exist_A_Machine : Boolean := False;

    -- ========================
    task Is_Publication_Ok is
        entry Publication_Ok;
    end Is_Publication_Ok;

    -- *********************************************
    procedure Registration (The_Id : out Id_Object.Type_Id) is
        The_Message : Message.Type_Of_Message;
        --The_Connection : Connection_Data;

    begin
        if not Exist_A_Machine then
            Text_Io.Put_Line ("envoi une demade de registration a l'orb");

            The_Message.The_Command := The_Registration;

            Communication.Open_Transmit (The_Message, The_Connection_Machine);
            -- recuperation des parametres
            -- ===========================
            The_Host_Machine := The_Message.The_Host_Machine_Send;
            The_Socket_Machine := The_Message.The_Socket_Send;

            Communication.Connect_Transmit
               (The_Message, The_Connection_Machine);
            Communication.Transmitter (The_Message, The_Connection_Machine);
            Communication.Disconnect (The_Connection_Machine);

            The_Message.The_Host_Machine_Receive := The_Host_Machine;
            The_Message.The_Socket_Receive := The_Socket_Machine;

            The_Message.The_Host_Machine_Send := The_Orb.The_Host;
            The_Message.The_Socket_Send := The_Orb.The_Socket;

            -- reception de l'Identificateur de machine
            -- ========================================
            Text_Io.Put ("attente acquittement de l'orb");
            Communication.Connect_Receive (The_Connection_Machine);
            Communication.Receiver (The_Message, The_Connection_Machine);
            Communication.Disconnect (The_Connection_Machine);

            The_Id_Machine := The_Message.The_Id_User_Send;
            The_Id := The_Message.The_Id_User_Send;
            Exist_A_Machine := True;
        end if;
    end Registration;

    -- *********************************************
    procedure Unregistration
                 (The_Id : Id_Object.Type_Id; Is_Ok : out Boolean) is
        The_Message : Message.Type_Of_Message;
        The_Connection : Connection_Data;

    begin
        The_Message.The_Command := The_Unregistration;
        The_Message.The_Id_User_Send := The_Id;

        The_Message.The_Socket_Send := (0, 0);

        -- envoi de la commande a l'orb
        -- ============================
        Text_Io.Put_Line ("envoi d'une demande d'unregistration de l'object ");
        Text_Io.Put (Natural'Image (Natural (The_Id)));
        Text_Io.Put_Line (" a l'orb");
        Communication.Open_Transmit (The_Message, The_Connection);
        Communication.Connect_Transmit (The_Message, The_Connection);
        Communication.Transmitter (The_Message, The_Connection);
        Communication.Disconnect (The_Connection);

        The_Message.The_Host_Machine_Receive :=
           The_Message.The_Host_Machine_Send;
        The_Message.The_Socket_Receive := The_Message.The_Socket_Send;

        -- attente reponse de l'orb
        -- ========================
        Text_Io.Put ("attente acquittement de l'orb");
        Communication.Connect_Receive (The_Connection);
        Communication.Receiver (The_Message, The_Connection);
        Communication.Disconnect (The_Connection);
        Communication.Close (The_Connection);

        if The_Message.Command_Is_Ok then
            Text_Io.Put_Line ("Ok");
        else
            Text_Io.Put_Line ("Erreur");
        end if;

        Is_Ok := The_Message.Command_Is_Ok;

    end Unregistration;


    -- *********************************************
    procedure Publication (The_Name : String;
                           The_Id : Id_Object.Type_Id;
                           Is_Ok : out Boolean) is
        The_Message : Message.Type_Of_Message;
        The_Connection : Connection_Data;

    begin  
        The_Message.The_Command := The_Publication;
        The_Message.Data := Our_String.Value (The_Name);
        The_Message.The_Id_User_Send := The_Id;

        The_Message.The_Host_Machine_Send := The_Host_Machine;
        The_Message.The_Socket_Send := The_Socket_Machine;

        Text_Io.Put_Line ("envoi d'une demande a l'orb de publication de ");
        Text_Io.Put (The_Name);
        Text_Io.Put (" sur l'object ");
        Text_Io.Put (Natural'Image (Natural (The_Id)));
        Text_Io.New_Line;

        Communication.Connect_Transmit (The_Message, The_Connection_Machine);
        Communication.Transmitter (The_Message, The_Connection_Machine);

        Communication.Disconnect (The_Connection_Machine);

        -- acquittement
        -- ============
        Text_Io.Put ("attente acquittement de l'orb");

        Communication.Connect_Receive (The_Connection_Machine);
        Communication.Receiver (The_Message, The_Connection_Machine);
        Communication.Disconnect (The_Connection_Machine);

        if The_Message.Command_Is_Ok then
            Text_Io.Put_Line ("publication ok");
        end if;

        Is_Ok := The_Message.Command_Is_Ok;  
    end Publication;

    -- ***************************************
    procedure End_Of_Publication is
    begin
        Is_Publication_Ok.Publication_Ok;
    end End_Of_Publication;



    -- *********************************************
    procedure Unpublication (Is_Ok : out Boolean;
                             The_Name : String;
                             The_Id : Id_Object.Type_Id := 0) is
        The_Message : Message.Type_Of_Message;
        The_Connection : Connection_Data;

    begin

        The_Message.The_Command := The_Unpublication;
        The_Message.Data := Our_String.Value (The_Name);
        The_Message.The_Id_User_Send := The_Id;
        The_Message.The_Socket_Send := (0, 0);

        Text_Io.Put_Line ("envoi d'une demande a l'orb d'unpublication de ");
        Text_Io.Put (The_Name);
        Text_Io.Put (" sur l'object ");
        Text_Io.Put (Natural'Image (Natural (The_Id)));
        Text_Io.New_Line;
        Communication.Open_Transmit (The_Message, The_Connection);
        Communication.Connect_Transmit (The_Message, The_Connection);
        Communication.Transmitter (The_Message, The_Connection);

        Communication.Disconnect (The_Connection);

        -- acquittement
        -- ============
        Text_Io.Put ("attente acquittement de l'orb");

        Communication.Connect_Receive (The_Connection);
        Communication.Receiver (The_Message, The_Connection);
        Communication.Disconnect (The_Connection);
        Communication.Close (The_Connection);

        Is_Ok := The_Message.Command_Is_Ok;
    end Unpublication;

    -- *********************************************
    procedure Request (The_Answer : out String;
                       Is_Ok : out Boolean;
                       The_Name : String;
                       The_Id : Id_Object.Type_Id := 0) is

        The_Message : Message.Type_Of_Message;
        Do_Exist_Command : Boolean := False;
        The_Connection : Connection_Data;
        --The_Return_Answer : String (1 .. Our_Constantes.Length_Of_A_Line);

    begin
        if not Exist_A_Machine then
            Text_Io.Put ("envoi d'une demande de request sur la fonction ");
            Text_Io.Put (The_Name);
            Text_Io.New_Line;

            Communication.Open_Transmit (The_Message, The_Connection);
            The_Message.Data := Our_String.Value (The_Name);
            The_Message.The_Id_User_Receive := The_Id;
            The_Message.The_Command := The_Request;

            Communication.Connect_Transmit (The_Message, The_Connection);
            Communication.Transmitter (The_Message, The_Connection);

            Communication.Disconnect (The_Connection);

            -- acquittement
            -- ============
            Text_Io.Put ("attente acquittement de l'orb");
            Communication.Connect_Receive (The_Connection);
            Communication.Receiver (The_Message, The_Connection);
            Communication.Disconnect (The_Connection);
            Communication.Close (The_Connection);
            Do_Exist_Command := The_Message.Command_Is_Ok;

            if Do_Exist_Command then
                Text_Io.Put ("la fonction ");
                Text_Io.Put (The_Name);
                Text_Io.Put_Line (" existe");
                The_Answer := Our_String.Image (The_Message.Data)
                                 (The_Answer'First .. The_Answer'Last);
            else
                -- Reponse nulle
                Text_Io.Put ("la fonction ");
                Text_Io.Put (The_Name);
                Text_Io.Put_Line (" n'existe pas");
                for I in The_Answer'First .. The_Answer'Last loop
                    The_Answer (I) := '_';
                end loop;
            end if;

            Is_Ok := Do_Exist_Command;

        end if;
    end Request;

    -- ========================
    task Return_Task is
        entry Ok_Return (A_Message : Message.Type_Of_Message;
                         A_Answer : Our_String.Variable_String);
        entry Ok_End;  
    end Return_Task;

    -- =============================
    task Run_Task is
        entry Ok_Message_Is_Received (A_Message : in Message.Type_Of_Message);
    end Run_Task;

    -- =============================
    task body Is_Publication_Ok is
        The_Message : Message.Type_Of_Message;
    begin
        accept Publication_Ok;
        loop
            Text_Io.Put_Line ("attente demande de fonction");
            Communication.Connect_Receive (The_Connection_Machine);
            Communication.Receiver (The_Message, The_Connection_Machine);
            Communication.Disconnect (The_Connection_Machine);
            Text_Io.Put_Line ("un message est recu");

            Run_Task.Ok_Message_Is_Received (The_Message);

            -- si il n'y a plus de machine on sort
            -- ===================================
            if Is_The_End then
                exit;
            end if;
        end loop;
    end Is_Publication_Ok;

    -- =============================
    task body Run_Task is
        The_Answer : Our_String.Variable_String;
    begin
        loop
            accept Ok_Message_Is_Received
                      (A_Message : in Message.Type_Of_Message) do

                case A_Message.The_Command is
                    when The_Request =>
                        Text_Io.Put_Line ("lancement de la fonction ");
                        Text_Io.Put (Our_String.Image (A_Message.Data)
                                        (1 .. Length_Of_Contract_Name));
                        Text_Io.Put_Line (" en cours");

                        -- appel de la procedure de traitement
                        -- ===================================
                        Run.Treatment
                           (Our_String.Image (A_Message.Data)
                               (1 .. Length_Of_Contract_Name), The_Answer);

                        -- retour de la reponse
                        -- ====================
                        Text_Io.Put_Line ("traitement effectue");
                        Return_Task.Ok_Return (A_Message, The_Answer);

                    when The_Unregistration =>
                        Text_Io.Put ("unregistration en cours de l'object ");
                        Text_Io.Put (Natural'Image (Natural (The_Id_Machine)));

                        Is_The_End := True;
                        Return_Task.Ok_End;
                        Text_Io.Put_Line ("finie");
                    when others =>
                        null;
                end case;
            end Ok_Message_Is_Received;

            -- si il n'y a plus de contract on sort
            -- ====================================
            if Is_The_End then
                exit;
            end if;
        end loop;
    end Run_Task;

    -- =============================
    task body Return_Task is
        The_Message : Message.Type_Of_Message;
    begin
        loop
            select
                accept Ok_Return (A_Message : Message.Type_Of_Message;
                                  A_Answer : Our_String.Variable_String) do
                    Text_Io.Put_Line ("renvoi de la reponse a l'orb");


                    The_Message.Data := A_Answer;
                    The_Message.The_Host_Machine_Receive :=
                       A_Message.The_Host_Machine_Send;
                    The_Message.The_Socket_Receive := A_Message.The_Socket_Send;

                    Communication.Connect_Transmit
                       (The_Message, The_Connection_Machine);
                    Communication.Transmitter
                       (The_Message, The_Connection_Machine);
                    Communication.Disconnect (The_Connection_Machine);

                end Ok_Return;
            or  
                accept Ok_End do
                    null;   --
                end Ok_End;
            end select;
            if Is_The_End then
                exit;
            end if;
        end loop;
    end Return_Task;
end Little_Orb;

E3 Meta Data

    nblk1=11
    nid=f
    hdr6=20
        [0x00] rec0=21 rec1=00 rec2=01 rec3=038
        [0x01] rec0=15 rec1=00 rec2=07 rec3=03e
        [0x02] rec0=19 rec1=00 rec2=03 rec3=07a
        [0x03] rec0=02 rec1=00 rec2=10 rec3=04c
        [0x04] rec0=1a rec1=00 rec2=09 rec3=012
        [0x05] rec0=19 rec1=00 rec2=0a rec3=068
        [0x06] rec0=1f rec1=00 rec2=06 rec3=022
        [0x07] rec0=1a rec1=00 rec2=04 rec3=030
        [0x08] rec0=19 rec1=00 rec2=11 rec3=056
        [0x09] rec0=17 rec1=00 rec2=08 rec3=008
        [0x0a] rec0=1e rec1=00 rec2=0e rec3=01c
        [0x0b] rec0=01 rec1=00 rec2=0c rec3=006
        [0x0c] rec0=1c rec1=00 rec2=05 rec3=022
        [0x0d] rec0=0f rec1=00 rec2=0d rec3=08c
        [0x0e] rec0=1d rec1=00 rec2=0b rec3=054
        [0x0f] rec0=1b rec1=00 rec2=02 rec3=000
        [0x10] rec0=00 rec1=00 rec2=00 rec3=000
    tail 0x21763ab9287c594426c3e 0x42a00088462060003
Free Block Chain:
  0xf: 0000  00 00 00 1e 80 1b 72 69 6e 67 20 28 31 20 2e 2e  ┆      ring (1 ..┆