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

⟦cb00c1718⟧ TextFile

    Length: 4516 (0x11a4)
    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 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;