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

⟦a016429b9⟧ Ada Source

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

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



package body Connector_Frames is

    The_Connection : Orb_Defs.Connection_Id;
    -- The connection ID of the connector

    The_Socket_Id : Orb_Defs.Socket_Id;
    -- The socket ID where the connector picks its datas

    The_Status : Transport_Defs.Status_Code;
    -- The current connection status

    procedure Convert (To_Be_Converted : Frame_Defs.Communication_Data;
                       Converted : out Frame_Defs.Frame) is
    begin
        Frame_Defs.Set_Frame (To_Be_Converted, Converted);  
    end Convert;

    task Guru is
        entry Activate;
        entry Dispose;
    end Guru;

    task body Guru is  
        type State is (Not_Connected, Trying_A_Passive_Connect, Connected);

        The_Current_State : State;

        The_Data_From_Socket : Frame_Defs.Communication_Data;
        The_Data_To_Put : Frame_Defs.Frame;  
        The_Count : Natural;

        The_Wait : Duration := 5.0;

        Done : Boolean := False;

    begin
        Text_Io.Put_Line ("Connector launched.");
        The_Current_State := Not_Connected;

        loop  
            select

                accept Activate do
                    The_Current_State := Trying_A_Passive_Connect;
                end Activate;

            or

                accept Dispose do
                    Done := True;
                end Dispose;

            else

                if The_Current_State = Trying_A_Passive_Connect then
                    Text_Io.Put_Line
                       ("Connector waiting for something on the socket...");
                    Transport.Connect (Connection => The_Connection,
                                       Status => The_Status,
                                       Max_Wait => 10.0);
                    if Transport_Defs.Image (The_Status) =
                       Transport_Defs.Image (Transport_Defs.Ok) then
                        Text_Io.Put_Line ("Connection successfull !");
                        The_Current_State := Connected;
                    else
                        The_Current_State := Trying_A_Passive_Connect;
                        Text_Io.Put_Line ("Retry-ing a passive connect.");
                    end if;
                else
                    if The_Current_State = Connected then
                        Transport.Receive (Connection => The_Connection,
                                           Status => The_Status,
                                           Data => The_Data_From_Socket,
                                           Count => The_Count);
                        Text_Io.Put_Line
                           ("Something was received by the connector.");
                        Text_Io.Put_Line ("RECEIVED:");
                        Frame_Defs.Set_Frame
                           (The_Data_From_Socket, The_Data_To_Put);
                        Text_Io.Put_Line (Frame_Defs.Image (The_Data_To_Put));
                        Text_Io.Put_Line ("hey, Jude, guru's going to post !");
                        Letter_Box_Frames.Put (The_Data_To_Put);
                        Transport.Disconnect (The_Connection);
                        The_Current_State := Trying_A_Passive_Connect;
                        Text_Io.Put_Line
                           ("guru's connector is alive and has just posted a mail !");
                    else                       Text_Io.Put_Line
                           ("guru's connector is alive and idles...");
                        delay (3.0);
                    end if;
                end if;
            end select;

            exit when Done = True;

        end loop;
    end Guru;

    procedure Init (The_Initial_Socket : in Orb_Defs.Socket_Id) is
    begin
        -- fixer la valeur initiale de la socket
        The_Socket_Id := The_Initial_Socket;

        -- Demander une socket
        Text_Io.Put_Line ("Opening connection.");
        Transport.Open (Connection => The_Connection,
                        Status => The_Status,
                        Local_Socket => The_Socket_Id,
                        Network => Orb_Defs.Network_Kind);

        The_Socket_Id := Transport.Local_Socket (The_Connection);

        Text_Io.Put_Line ("Connexion STATUS : ");
        Text_Io.Put_Line (Transport_Defs.Image (The_Status));

        Text_Io.Put_Line ("The connnection is opened.");

        Guru.Activate;
    end Init;

    function Get_Current_Socket return Orb_Defs.Socket_Id is
    begin
        return The_Socket_Id;
    end Get_Current_Socket;

    procedure Dispose is
    begin
        Guru.Dispose;
    end Dispose;

end Connector_Frames;

E3 Meta Data

    nblk1=6
    nid=0
    hdr6=c
        [0x00] rec0=23 rec1=00 rec2=01 rec3=040
        [0x01] rec0=1d rec1=00 rec2=06 rec3=070
        [0x02] rec0=09 rec1=00 rec2=04 rec3=018
        [0x03] rec0=10 rec1=00 rec2=05 rec3=002
        [0x04] rec0=1d rec1=00 rec2=02 rec3=022
        [0x05] rec0=10 rec1=00 rec2=03 rec3=000
    tail 0x21761059487c0690d4205 0x42a00088462060003