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

⟦2117addc9⟧ TextFile

    Length: 6544 (0x1990)
    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;