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

⟦4e54810de⟧ TextFile

    Length: 7063 (0x1b97)
    Types: TextFile
    Names: »B«

Derivation

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

TextFile

with Rpc;
with Rpc_Server;
with Transport_Stream;
with Transport_Interchange;
with Complex_Number_Interchange;
with Interchange;
with Complex_Number;
with Complex_Number;
with Complex_Number;
package body Complex_Number_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_Number_Rpc_Defs.Procedure_Number.Make =>
                declare
                    Real : Float;
                    Imag : Float;
                    Return_Number : Complex_Number.Number;
                begin
                    Transport_Interchange.Get
                       (From => Stream, Data => Interchange.Float (Real));
                    Transport_Interchange.Get
                       (From => Stream, Data => Interchange.Float (Imag));
                    Return_Number := Complex_Number.Make
                                        (Real => Real, Imag => Imag);
                    Rpc_Server.Begin_Response (Stream, Id);
                    Complex_Number_Interchange.Put
                       (Into => Stream, Data => Return_Number);
                end;
            when Complex_Number_Rpc_Defs.Procedure_Number.Real_Part =>
                declare
                    X : Complex_Number.Number;
                    Return_Float : Float;
                begin
                    Complex_Number_Interchange.Get (From => Stream, Data => X);
                    Return_Float := Complex_Number.Real_Part (X => X);
                    Rpc_Server.Begin_Response (Stream, Id);
                    Transport_Interchange.Put
                       (Into => Stream,
                        Data => Interchange.Float (Return_Float));
                end;
            when Complex_Number_Rpc_Defs.Procedure_Number.Imaginary_Part =>
                declare
                    X : Complex_Number.Number;
                    Return_Float : Float;
                begin
                    Complex_Number_Interchange.Get (From => Stream, Data => X);
                    Return_Float := Complex_Number.Imaginary_Part (X => X);
                    Rpc_Server.Begin_Response (Stream, Id);
                    Transport_Interchange.Put
                       (Into => Stream,
                        Data => Interchange.Float (Return_Float));
                end;
            when Complex_Number_Rpc_Defs.Procedure_Number.Plus =>
                declare
                    Left : Complex_Number.Number;
                    Right : Complex_Number.Number;
                    Return_Number : Complex_Number.Number;
                begin
                    Complex_Number_Interchange.Get
                       (From => Stream, Data => Left);
                    Complex_Number_Interchange.Get
                       (From => Stream, Data => Right);
                    Return_Number := Complex_Number.Plus
                                        (Left => Left, Right => Right);
                    Rpc_Server.Begin_Response (Stream, Id);
                    Complex_Number_Interchange.Put
                       (Into => Stream, Data => Return_Number);
                end;
            when Complex_Number_Rpc_Defs.Procedure_Number.Minus =>
                declare
                    Left : Complex_Number.Number;
                    Right : Complex_Number.Number;
                    Return_Number : Complex_Number.Number;
                begin
                    Complex_Number_Interchange.Get
                       (From => Stream, Data => Left);
                    Complex_Number_Interchange.Get
                       (From => Stream, Data => Right);
                    Return_Number := Complex_Number.Minus
                                        (Left => Left, Right => Right);
                    Rpc_Server.Begin_Response (Stream, Id);
                    Complex_Number_Interchange.Put
                       (Into => Stream, Data => Return_Number);
                end;
            when Complex_Number_Rpc_Defs.Procedure_Number.Image =>
                declare
                    X : Complex_Number.Number;
                begin
                    Complex_Number_Interchange.Get (From => Stream, Data => X);
                    declare
                        Return_String : constant String :=
                           Complex_Number.Image (X => X);
                    begin
                        Rpc_Server.Begin_Response (Stream, Id);
                        Transport_Interchange.Put_String
                           (Into => Stream, Data => Return_String);
                    end;
                end;
            when Complex_Number_Rpc_Defs.Procedure_Number.Value =>
                declare
                    S : constant String :=
                       Transport_Interchange.Get_String (From => Stream);
                    Return_Number : Complex_Number.Number;
                begin
                    Return_Number := Complex_Number.Value (S => S);
                    Rpc_Server.Begin_Response (Stream, Id);
                    Complex_Number_Interchange.Put
                       (Into => Stream, Data => Return_Number);
                end;
            when others =>
                raise Rpc.No_Such_Procedure;
        end case;
    exception
        when Constraint_Error =>
            Rpc_Server.Return_Exception
               (Stream, Id, Complex_Number_Rpc_Defs.
                               Exception_Number.Constraint_Error);

        when Numeric_Error =>
            Rpc_Server.Return_Exception
               (Stream, Id, Complex_Number_Rpc_Defs.
                               Exception_Number.Numeric_Error);

        when Program_Error =>
            Rpc_Server.Return_Exception
               (Stream, Id, Complex_Number_Rpc_Defs.
                               Exception_Number.Program_Error);

        when Storage_Error =>
            Rpc_Server.Return_Exception
               (Stream, Id, Complex_Number_Rpc_Defs.
                               Exception_Number.Storage_Error);

        when Tasking_Error =>
            Rpc_Server.Return_Exception
               (Stream, Id, Complex_Number_Rpc_Defs.
                               Exception_Number.Tasking_Error);

        when Complex_Number.Overflow =>
            Rpc_Server.Return_Exception
               (Stream, Id, Complex_Number_Rpc_Defs.Exception_Number.Overflow);

        when Complex_Number.Underflow =>
            Rpc_Server.Return_Exception
               (Stream, Id, Complex_Number_Rpc_Defs.Exception_Number.Underflow);

    end Process_Call;

    procedure Serve_Guts is new Rpc_Server.Serve
                                   (Program => Complex_Number_Rpc_Defs.Program,
                                    Process_Call => Process_Call);

    procedure Serve (Connection : Transport.Connection_Id) is
    begin
        Serve_Guts (Connection);
    end Serve;

end Complex_Number_Server;