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

⟦ce9d18813⟧ Ada Source

    Length: 12288 (0x3000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Input_To_Shell_F, package body Input_To_Shell_R, seg_02517a

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 Communications;
with Errors;
with Files;
with Files;
with Interchange;
with Mac_Files;  
with Mac_Path;
with Mac_Types;
with Mac_Text;
with Memory;
with Osutils;
with Packages;
with Rational_Error;
with Remote_Shell;
with System;
with Talk_Utils;
with Text_Io;
use Text_Io;
with Unchecked_Conversion;
package body Input_To_Shell_R is

    package Input_To_Shell_F is

        procedure Input_In (T : Mac_Text.Text);
        procedure Timeout_In (Timeout : Mac_Types.Longint);
        procedure End_Input_To_Shell;

    end Input_To_Shell_F;

    package body Input_To_Shell_F is  
        Err : Mac_Types.Oserr := Mac_Types.Noerr;
        Time_Out : Mac_Types.Longint := Mac_Types.Longint'Last;

        procedure Input_In (T : Mac_Text.Text) is
        begin
            Err := Remote_Shell.Execute (T);
        end Input_In;

        procedure Timeout_In (Timeout : Mac_Types.Longint) is
        begin
            Time_Out := Timeout;
        end Timeout_In;

        procedure End_Input_To_Shell is
        begin  
            if Err /= Mac_Types.Noerr then
                Rational_Error.Raise_Mac_Error (Err);
            end if;  
            Err := Remote_Shell.Wait_End_Of_Execution (Time_Out);
            if Err /= Mac_Types.Noerr then
                Rational_Error.Raise_Mac_Error (Err);
            end if;

        end End_Input_To_Shell;

    end Input_To_Shell_F;

    procedure Read (A_Connection : in out Communications.Connection) is
        I : Mac_Types.Longint;
        B : Boolean;
        T : Mac_Text.Text (256);  
    begin
        Put_Line ("input_to_shell_r:read begin");
        Interchange.Get_Int (A_Connection, I);
        if I /= Talk_Utils.F_Input then
            Rational_Error.Raise_Error (Rational_Error.Internal_Error);
        end if;  
        Interchange.Get_Text (A_Connection, T);
        if Mac_Text.Length (T) > 100 then
            Mac_Text.Set_Length (T, 100);
        end if;
        Input_To_Shell_F.Input_In (T);
        Put ("input_to_shell_r:input in '");
        for I in 1 .. Mac_Text.Length (T) loop
            Put (Character'Val (Mac_Types.Char'Pos (Mac_Text.Value (I, T))));
        end loop;
        Put_Line ("'");
        Interchange.Get_Int (A_Connection, I);
        if I /= Talk_Utils.F_Timeout then
            Rational_Error.Raise_Error (Rational_Error.Internal_Error);
        end if;  
        Interchange.Get_Int (A_Connection, I);
        Input_To_Shell_F.Timeout_In (I);
        Interchange.Get_Int (A_Connection, I);
        if I /= Talk_Utils.F_Delimitor then
            Rational_Error.Raise_Error (Rational_Error.Internal_Error);
        end if;
        Interchange.Get_Int (A_Connection, I);
        if I /= Talk_Utils.R_Input_To_Shell then
            Rational_Error.Raise_Error (Rational_Error.Internal_Error);
        end if;
        Put_Line ("input_to_shell_r:read end");
    end Read;

    procedure Write (A_Connection : in out Communications.Connection) is
        Status : Mac_Types.Longint;
    begin
        Put_Line ("input_to_shell_r:write begin");
        begin  
            Input_To_Shell_F.End_Input_To_Shell;
        exception
            when others =>
                Rational_Error.Report
                   (A_Connection, Talk_Utils.R_Input_To_Shell,
                    Rational_Error.Get);
        end;
        Put_Line ("input_to_shell_r:write get status");
        begin
            Remote_Shell.Get_Status (Status);
        exception
            when others =>
                Rational_Error.Report
                   (A_Connection, Talk_Utils.R_Input_To_Shell,
                    Rational_Error.Get);
        end;
        if Status /= 0 then  
            declare
                use Mac_Types;
                Report : constant Mac_Text.String := "Command returned status ";
                Status_String : Str255;
                T : Mac_Text.Text (256);
            begin
                Packages.Numtostring (Status, Status_String);  
                Mac_Text.Set (T, Report);
                Mac_Text.Append (Mac_Text.String (Status_String), T);
                Rational_Error.Report (A_Connection,
                                       Talk_Utils.R_Input_To_Shell,
                                       Rational_Error.Command_Error, T);
            end;
        end if;
        Interchange.Put_Int (A_Connection, Talk_Utils.F_Delimitor);
        Interchange.Put_Int (A_Connection, Talk_Utils.R_Input_To_Shell);
        Put_Line ("input_to_shell_r:write end");
    end Write;

end Input_To_Shell_R;

E3 Meta Data

    nblk1=b
    nid=9
    hdr6=c
        [0x00] rec0=2a rec1=00 rec2=01 rec3=032
        [0x01] rec0=1d rec1=00 rec2=0a rec3=02a
        [0x02] rec0=17 rec1=00 rec2=04 rec3=00a
        [0x03] rec0=0b rec1=00 rec2=05 rec3=00a
        [0x04] rec0=17 rec1=00 rec2=02 rec3=06a
        [0x05] rec0=0a rec1=00 rec2=08 rec3=000
        [0x06] rec0=18 rec1=00 rec2=08 rec3=076
        [0x07] rec0=18 rec1=00 rec2=02 rec3=020
        [0x08] rec0=07 rec1=00 rec2=09 rec3=000
        [0x09] rec0=06 rec1=00 rec2=08 rec3=000
        [0x0a] rec0=da rec1=ea rec2=e0 rec3=000
    tail 0x217200c40839f58674c53 0x42a00088462060003
Free Block Chain:
  0x9: 0000  00 06 00 2d 80 22 20 20 20 20 20 20 20 20 20 20  ┆   - "          ┆
  0x6: 0000  00 03 01 9b 80 18 4e 61 6d 65 20 3a 20 4d 61 63  ┆      Name : Mac┆
  0x3: 0000  00 0b 00 28 80 25 20 20 20 20 20 20 20 20 20 20  ┆   ( %          ┆
  0xb: 0000  00 07 00 0f 00 0c 20 20 20 20 20 20 20 20 20 20  ┆                ┆
  0x7: 0000  00 00 03 f9 80 03 65 29 3b 03 00 35 20 20 20 20  ┆      e);  5    ┆