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

⟦e7b4d4914⟧ Ada Source

    Length: 13312 (0x3400)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Multi_Requests, seg_00f32d

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 Text_Io;
with Profile;
with Calendar;
with String_Utilities;

package body Multi_Requests is

    Time_Baseline : constant Calendar.Time :=
       Calendar.Time_Of (Month => 1, Day => 1, Year => 1970, Seconds => 0.0);

    procedure Process_Output
                 (Text : in String;
                  Severity : in Profile.Msg_Kind;
                  State : in out Natural;
                  Response : in out Remote_Operations.Command_Response) is
        Prompt : constant String := "N? ";
    begin
        Response := Remote_Operations.Nil;
        Text_Io.Put (Text);
        if Text'Length = 0 then
            return;
        end if;  
        if Text (Text'Last) = Ascii.Lf or else Text (Text'Last) = Ascii.Lf then
            return;
        end if;
        if Text'Length < Prompt'Length then
            return;
        end if;
        if String_Utilities.Equal
              (Prompt, Text (Text'Last - (Prompt'Length - 1) .. Text'Last),
               Ignore_Case => True) then
            Response := Remote_Operations.Read_Input;
        end if;
    end Process_Output;

    procedure Read_Input
                 (State : in out Natural;
                  Buffer : out String;
                  Last : out Natural;
                  Response : in out Remote_Operations.Command_Response) is
    begin
        Text_Io.Get_Line (Buffer, Last);
        if Natural'Succ (Last) in Buffer'Range then
            Last := Natural'Succ (Last);
        end if;
        Buffer (Last) := Ascii.Lf;
        Response := Remote_Operations.Nil;
    end Read_Input;

    procedure Timeout_Handler
                 (State : in out Natural;
                  Response : in out Remote_Operations.Command_Response) is
        Line : String (1 .. 100);
        Last : Natural;
    begin
        loop
            Text_Io.Put
               ("Timeout expired: (A)bort, (C)ontinue, (R)ead_Input > ");
            Text_Io.Get_Line (Line, Last);
            if String_Utilities.Equal
                  (Line (Line'First .. Last), "A", Ignore_Case => True) then
                Response := Remote_Operations.Abort_Command;
                return;
            elsif String_Utilities.Equal
                     (Line (Line'First .. Last), "C", Ignore_Case => True) then
                Response := Remote_Operations.Nil;
                return;
            elsif String_Utilities.Equal
                     (Line (Line'First .. Last), "R", Ignore_Case => True) then
                Response := Remote_Operations.Read_Input;
                return;
            end if;
        end loop;
    end Timeout_Handler;

    procedure Remote_Execute is new Remote_Operations.Execution_Generic
                                       (Execution_State => Natural,
                                        Process_Output => Process_Output,
                                        Read_Input => Read_Input,
                                        Timeout_Handler => Timeout_Handler);

    procedure Init_Object (Object : in out Object_Id; Machine : in String) is  
        Errors : Simple_Status.Condition;
    begin
        Simple_Status.Initialize (Object.Open_Error);  
        Remote_Operations.Acquire (A_Context => Object.Connection,
                                   Status => Errors,
                                   Machine => Machine,
                                   Instance => "");
    end Init_Object;

    procedure Disconnect (C : in out Object_Id;
                          Status : out Simple_Status.Condition) is
    begin
        Remote_Operations.Release
           (A_Context => C.Connection,
            Status => Status,
            Idle_Timeout => Remote_Operations.Connection_Timeout
                               (Idle_Time_Out));
    end Disconnect;

    procedure Shut_Down is
    begin
        null;
        --Connection_Manager.Close_All_Connections;
        --Connection_Manager.Shutdown;
    end Shut_Down;

    procedure Create (Object : in Object_Id;
                      Remote_File : in String;
                      Is_Directory : in Boolean := False;
                      Status : out Simple_Status.Condition) is
        S : Simple_Status.Condition;
    begin
        if Is_Directory then
            Remote_Operations.Create_Directory (In_Context => Object.Connection,
                                                With_Name => Remote_File,
                                                Status => S);
        else
            Remote_Operations.Create_File (In_Context => Object.Connection,
                                           With_Name => Remote_File,
                                           Status => S);
        end if;

        Status := S;
    end Create;


    procedure Put (Object : in Object_Id;
                   From_Local_File : in String;
                   To_Remote_File : in String;
                   Status : out Simple_Status.Condition) is
        S : Simple_Status.Condition;
    begin
        Remote_Operations.Put (From_File => From_Local_File,
                               To_File => To_Remote_File,
                               In_Context => Object.Connection,
                               Status => S);

        Status := S;
    end Put;


    procedure Put (Object : in Object_Id;
                   From_Local_File : in Device_Independent_Io.File_Type;
                   To_Remote_File : in String;
                   Status : out Simple_Status.Condition) is
        S : Simple_Status.Condition;
    begin
        Remote_Operations.Put (From_File => From_Local_File,
                               To_File => To_Remote_File,
                               In_Context => Object.Connection,
                               Status => S);

        Status := S;
    end Put;


    procedure Get (Object : in Object_Id;
                   From_Remote_File : in String;
                   To_Local_File : in String;
                   Append_To_File : in Boolean;
                   Status : out Simple_Status.Condition) is
        S : Simple_Status.Condition;
    begin
        Remote_Operations.Get (From_File => From_Remote_File,
                               In_Context => Object.Connection,
                               To_File => To_Local_File,
                               Status => S,
                               Append => Append_To_File);
        Status := S;
    end Get;

    procedure Get (Object : in Object_Id;
                   From_Remote_File : in String;
                   To_Local_File : in Device_Independent_Io.File_Type;
                   Status : out Simple_Status.Condition) is
        S : Simple_Status.Condition;
    begin
        Remote_Operations.Get (From_File => From_Remote_File,
                               In_Context => Object.Connection,
                               To_File => To_Local_File,
                               Status => S);
        Status := S;
    end Get;


    procedure Last_Update (Object : in Object_Id;
                           Of_Remote_File : in String;
                           In_Seconds : out Integer;
                           Status : out Simple_Status.Condition) is
        The_Time : Calendar.Time;
        S : Simple_Status.Condition;
    begin
        In_Seconds := 0;
        Remote_Operations.Update_Time (Of_File => Of_Remote_File,
                                       In_Context => Object.Connection,
                                       Result => The_Time,
                                       Status => S);
        In_Seconds := Integer (Calendar."-" (The_Time, Time_Baseline));

        Status := S;
    end Last_Update;


    procedure Copy (Object : in Object_Id;
                    From_Remote_File : in String;
                    To_Remote_File : in String;
                    Link : in Boolean := False;
                    Status : out Simple_Status.Condition) is
        S : Simple_Status.Condition;
    begin
        Remote_Operations.Copy (From_File => From_Remote_File,
                                To_File => To_Remote_File,
                                In_Context => Object.Connection,
                                Status => S);

        Status := S;
    end Copy;

    procedure Delete (Object : in Object_Id;
                      Remote_File : in String;
                      Expunge : in Boolean := False;
                      Status : out Simple_Status.Condition) is
        S : Simple_Status.Condition;
    begin
        Remote_Operations.Delete_File (In_Context => Object.Connection,
                                       With_Name => Remote_File,
                                       Status => S);

        Status := S;
    end Delete;

    procedure Move (Object : in Object_Id;
                    From_Remote_File : in String;
                    To_Remote_File : in String;
                    Status : out Simple_Status.Condition) is
        S : Simple_Status.Condition;
    begin
        Remote_Operations.Move (From_File => From_Remote_File,
                                To_File => To_Remote_File,
                                In_Context => Object.Connection,
                                Status => S);

        Status := S;
    end Move;

    -- procedure Ls (Object : in Object_Id;
    --               From_Remote_Directory : in String;
    --               Level : in Natural;
    --               To_Local_File : in String;
    --               Append_To_File : in Boolean;
    --               Status : out Simple_Status.Condition) is
    --     S : Simple_Status.Condition;
    -- begin
    --     Connection_Manager.Operate
    --        (Object => Object, Parms => Parameters, Errors => S);
    --     Status := S;
    -- end Ls;
    --
    --
    -- procedure Ls (Object : in Object_Id;
    --               From_Remote_Directory : in String;
    --               Level : in Natural;
    --               To_Local_File : in Device_Independent_Io.File_Type;
    --               Status : out Simple_Status.Condition) is
    --     S : Simple_Status.Condition;
    -- begin
    --     Connection_Manager.Operate
    --        (Object => Object, Parms => Parameters, Errors => S);
    --     Status := S;
    -- end Ls;

    procedure Input_To_Remote_Shell (Object : in Object_Id;
                                     Input : in String;  
                                     Timeout : in Integer;
                                     Status : out Simple_Status.Condition) is
        S : Simple_Status.Condition;
        N : Natural := 0;
        One_Second : constant Duration := 1.0;
    begin
        Remote_Execute (Command => Input,
                        In_Context => Object.Connection,
                        State => N,
                        Status => S,
                        Timeout => Remote_Operations.Command_Timeout
                                      (Timeout * One_Second));
        Status := S;
    end Input_To_Remote_Shell;

    -- procedure Signal_To_Shell (Object : in Object_Id;
    --                            Signal : in Natural;
    --                            Status : out Simple_Status.Condition) is
    --     Parameters : Operate_Parameters (Request => Signal_To_Shell_R,
    --                                      Local_File_Is_Name => False) :=
    --        (Request => Signal_To_Shell_R,
    --         Local_File_Is_Name => False,
    --         Sts_Signal => Signal);
    --     S : Simple_Status.Condition;
    -- begin
    --     Connection_Manager.Operate
    --        (Object => Object, Parms => Parameters, Errors => S);
    --     Status := S;
    -- end Signal_To_Shell;

end Multi_Requests;

E3 Meta Data

    nblk1=c
    nid=0
    hdr6=18
        [0x00] rec0=1f rec1=00 rec2=01 rec3=096
        [0x01] rec0=1d rec1=00 rec2=02 rec3=02a
        [0x02] rec0=15 rec1=00 rec2=03 rec3=014
        [0x03] rec0=19 rec1=00 rec2=04 rec3=060
        [0x04] rec0=1a rec1=00 rec2=05 rec3=046
        [0x05] rec0=1c rec1=00 rec2=06 rec3=052
        [0x06] rec0=17 rec1=00 rec2=07 rec3=010
        [0x07] rec0=1a rec1=00 rec2=08 rec3=056
        [0x08] rec0=1b rec1=00 rec2=09 rec3=00a
        [0x09] rec0=18 rec1=00 rec2=0a rec3=01c
        [0x0a] rec0=19 rec1=00 rec2=0b rec3=00c
        [0x0b] rec0=17 rec1=00 rec2=0c rec3=000
    tail 0x2170bb95c822a65ca3527 0x42a00088462060003