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

⟦b621c21b9⟧ TextFile

    Length: 4942 (0x134e)
    Types: TextFile
    Names: »B«

Derivation

└─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13
    └─ ⟦124ff5788⟧ »DATA« 
        └─⟦this⟧ 
└─⟦bad92a95e⟧ Bits:30000535 8mm tape, Rational 1000, RPC 1_0_2
    └─ ⟦bb34fe6e2⟧ »DATA« 
        └─⟦15d8b76c6⟧ 
            └─⟦this⟧ 
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
    └─ ⟦6f12a12be⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Transport_Complex;
with Text_Io;
with Complex_Service;
with Interchange;
with Transport_Interchange;
package body Complex_Server is

    procedure Process_Call (Stream : Transport_Stream.Stream_Id;
                            Id : Rpc.Transaction_Id;
                            Version : Rpc.Version_Number;
                            Proc : Rpc.Procedure_Number) is
    begin
        case Proc is
            when Complex_Defs.Proc_Number.Make =>
                declare
                    Real, Imag : Float;
                    Answer : Complex_Defs.Number;
                begin
                    Transport_Interchange.Get (Stream,
                                               Interchange.Float (Real));
                    Transport_Interchange.Get (Stream,
                                               Interchange.Float (Imag));
                    Answer := Complex_Service.Make (Real, Imag);
                    Rpc_Server.Begin_Response (Stream, Id);
                    Transport_Complex.Put (Stream, Answer);
                end;
            when Complex_Defs.Proc_Number.Real_Part =>
                declare
                    X : Complex_Defs.Number;
                    Answer : Float;
                begin
                    Transport_Complex.Get (Stream, X);
                    Answer := Complex_Service.Real_Part (X);
                    Rpc_Server.Begin_Response (Stream, Id);
                    Transport_Interchange.Put (Stream,
                                               Interchange.Float (Answer));
                end;
            when Complex_Defs.Proc_Number.Imaginary_Part =>
                declare
                    X : Complex_Defs.Number;
                    Answer : Float;
                begin
                    Transport_Complex.Get (Stream, X);
                    Answer := Complex_Service.Imaginary_Part (X);
                    Rpc_Server.Begin_Response (Stream, Id);
                    Transport_Interchange.Put (Stream,
                                               Interchange.Float (Answer));
                end;

            when Complex_Defs.Proc_Number.Plus =>
                declare
                    Left, Right : Complex_Defs.Number;
                    Answer : Complex_Defs.Number;
                begin
                    Transport_Complex.Get (Stream, Left);
                    Transport_Complex.Get (Stream, Right);
                    Answer := Complex_Service.Plus (Left, Right);
                    Rpc_Server.Begin_Response (Stream, Id);
                    Transport_Complex.Put (Stream, Answer);
                end;
            when Complex_Defs.Proc_Number.Minus =>
                declare
                    Left, Right : Complex_Defs.Number;
                    Answer : Complex_Defs.Number;
                begin
                    Transport_Complex.Get (Stream, Left);
                    Transport_Complex.Get (Stream, Right);
                    Answer := Complex_Service.Minus (Left, Right);
                    Rpc_Server.Begin_Response (Stream, Id);
                    Transport_Complex.Put (Stream, (Answer));
                end;

            when Complex_Defs.Proc_Number.Image =>
                declare
                    X : Complex_Defs.Number;
                begin
                    Transport_Complex.Get (Stream, X);
                    declare
                        Answer : constant String := Complex_Service.Image (X);
                    begin
                        Rpc_Server.Begin_Response (Stream, Id);
                        Transport_Interchange.Put_String (Stream, Answer);
                    end;
                end;
            when Complex_Defs.Proc_Number.Value =>
                declare
                    X : constant String :=
                       Transport_Interchange.Get_String (Stream);
                    Answer : Complex_Defs.Number;
                begin
                    Answer := Complex_Service.Value (X);
                    Rpc_Server.Begin_Response (Stream, Id);
                    Transport_Complex.Put (Stream, Answer);
                end;
            when others =>
                raise Rpc.No_Such_Procedure;
        end case;
    exception
        when Complex_Service.Overflow =>
            Rpc_Server.Return_Exception
               (Stream, Id, Complex_Defs.Exception_Number.Overflow);
        when Complex_Service.Underflow =>
            Rpc_Server.Return_Exception
               (Stream, Id, Complex_Defs.Exception_Number.Underflow);
    end Process_Call;

    procedure Serve_Gets is new Rpc_Server.Serve
                                   (Program => Complex_Defs.Program,
                                    Supported => (0, Rpc.Version_Number'Last),
                                    Process_Call => Process_Call);
    procedure Serve (Connection : Transport.Connection_Id) is
    begin
        Serve_Gets (Connection);
    end Serve;
end Complex_Server;