|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - downloadIndex: ┃ B T ┃
Length: 16155 (0x3f1b) Types: TextFile Names: »B«
└─⟦85b835f43⟧ Bits:30000549 8mm tape, Rational 1000, Xlib rev 6.00 └─ ⟦0c20f784e⟧ »DATA« └─⟦1abbe589f⟧ └─⟦059497ac5⟧ └─⟦this⟧
--/ if R1000 then with Transport; --/ elsif Cdf_Hpux then --// with System_Interface; --/ elsif TeleGen2 and then Unix then --// with Error_Messages; --/ end if; with Xlbt_Arithmetic; use Xlbt_Arithmetic; with Xlbmt_Network_Types; use Xlbmt_Network_Types; --/ if Cdf_Hpux then --// with Xlbmt_Transport_Defs; --// use Xlbmt_Transport_Defs; --/ elsif TeleGen2 and then Unix then --// with Xlbmt_Transport_Defs; --// use Xlbmt_Transport_Defs; --/ end if; package body Xlbmp_Network_Interface is ------------------------------------------------------------------------------ -- X Library Machine Network Interfaces -- -- Xlbmp_Network_Interface - Machine/Compiler dependent network interfaces. ------------------------------------------------------------------------------ -- Copyright 1989 - 1991 by Rational, Santa Clara, California. -- -- All Rights Reserved. -- -- Permission to use, copy, modify, and distribute this software and its -- documentation for any purpose and without fee is hereby granted, -- provided that the above copyright notice(s) appear in all copies and that -- both that copyright notice(s) and this permission notice appear in -- supporting documentation, and that the name of Rational not be used in -- advertising or publicity pertaining to distribution of the software -- without specific, written prior permission. -- -- Rational disclaims all warranties with regard to this software, including -- all implied warranties of merchantability and fitness, in no event shall -- Rational be liable for any special, indirect or consequential damages or -- any damages whatsoever resulting from loss of use, data or profits, whether -- in an action of contract, negligence or other tortious action, arising out -- of or in connection with the use or performance of this software. ------------------------------------------------------------------------------ --/ if Cdf_Hpux then --// use System_Interface.Error; -- Eintr and friends --/ end if; --\f procedure Receive_Maybe (Connection : Connection_Id; Status : out Status_Code; Data : in out X_Raw_Data_Array; Count : out X_Raw_Data_Index) is ------------------------------------------------------------------------------ -- Connection - Specifies the connection to use for reading -- Status - Receives the final status of the operation -- Data - Receives the data -- Count - Receives the length of the data -- -- Called when we are ready to receive something from the network connection -- but we won't be upset if there isn't anything to receive. ------------------------------------------------------------------------------ --/ if R1000 and R1000_Xlib_Only then --// --// begin --// --// Transport.Receive (Connection => Connection, --// Status => Status, --// Data => Data, --// Count => Count, --// Max_Wait => 0.0); --// --// --/ elsif R1000 and not R1000_Xlib_Only then begin select Connection.Reader.Receive_Maybe (Status => Status, Data => Data, Count => Count); else Status := Timed_Out; Count := 0; end select; --/ elsif Unix then --// --// Result : S_Long; --// Timeout : Timeval := (0, 0); --// Fdset : Fd_Set_Rec; --// Lstatus : Status_Code; --// begin --// --// ----See if there is something to receive. --// --// Fd_Clr( Fdset ); --// Fd_Set( Fdset, Connection ); --// Result := Unix_Select (Fdset'Size, --// Fdset(Fdset'First)'Address, --// None_System_Address, --// None_System_Address, --// Timeout'Address); --// if Result = 0 then --// Status := Ok; --// Count := 0; --// return; --// elsif Result < 0 then --// Status := Get_Errno; --// Count := 0; --// return; --// end if; --// --// ----Read whatever we can get; we know something is out there. --// --// Result := Read (Connection, Data (Data'First)'Address, Data'Length); --// if Result = -1 then --// Count := 0; --// Lstatus := Get_Errno; --// if Lstatus = Eintr then --// Status := Timed_Out; --// else --// Status := Lstatus; --// end if; --// else --// Count := X_Raw_Data_Index (Result); --// Status := Ok; --// end if; --// --/ else --// begin --// Something_Needed_Here; --/ end if; end Receive_Maybe; --\f --/ if R1000 and not R1000_Xlib_Only then procedure Receive_Queue (Connection : Connection_Id; Status : out Status_Code; Data : in out X_Raw_Data_Array; Count : out X_Raw_Data_Index; Notify : Notify_Complete) is ------------------------------------------------------------------------------ -- Connection - Specifies the connection to use for reading -- Status - Receives the final status of the operation -- Data - Receives the data -- Count - Receives the length of the data -- Notify - Specifies the notification task to use -- -- Called when we are ready to receive something from the network connection -- but we won't be upset if there isn't anything to receive. ------------------------------------------------------------------------------ begin Connection.Reader.Receive_Queue (Status => Status, Data => Data, Count => Count, Notify => Notify); end Receive_Queue; --/ end if; --\f --/ if R1000 and R1000_Xlib_Only then --// --// procedure Receive_Must (Connection : Connection_Id; --// Status : out Status_Code; --// Data : in out X_Raw_Data_Array; --// Count : out X_Raw_Data_Index) is --// ------------------------------------------------------------------------------ --// -- Connection - Specifies the connection to use for reading --// -- Status - Receives the final status of the operation --// -- Data - Receives the data --// -- Count - Receives the length of the data --// -- --// -- Called when we are ready to receive some specific number of bytes from the --// -- network connection and we will wait forever if necessary in order to get --// -- exactly that many bytes. --// ------------------------------------------------------------------------------ --// Need_Count : constant X_Raw_Data_Index := Data'Length; --// Tmp_Status : Transport_Defs.Status_Code; --// Tmp_Count : X_Raw_Data_Index; --// Total : X_Raw_Data_Index; --// First : X_Raw_Data_Index; --// begin --// --// ----Do an initial receive. See if we get what we wanted without further --// -- effort. --// --// Transport.Receive (Connection => Connection, --// Status => Tmp_Status, --// Data => Data, --// Count => Tmp_Count, --// Max_Wait => Duration'Last); --// --// ----If we got it then return it all to the caller. --// --// if Tmp_Count = Need_Count or else --// Tmp_Status /= Transport_Defs.Ok then --// Status := Tmp_Status; --// Count := Tmp_Count; --// return; --// end if; --// --// ----Set up to loop until we get what we wanted. --// --// Total := Tmp_Count; --// First := Data'First + Tmp_Count; --// loop --// --// ----Receive what we can this time. --// --// Transport.Receive (Connection => Connection, --// Status => Tmp_Status, --// Data => Data (First .. Data'Last), --// Count => Tmp_Count, --// Max_Wait => Duration'Last); --// --// ----If we got all we asked for then return to the caller. --// --// Total := Total + Tmp_Count; --// if Total = Need_Count or else --// Tmp_Status /= Transport_Defs.Ok then --// Status := Tmp_Status; --// Count := Total; --// return; --// end if; --// --// ----Record what we got and continue trying. --// --// First := First + Tmp_Count; --// end loop; --// --// end Receive_Must; --// --/ elsif R1000 and not R1000_Xlib_Only then procedure Receive_Must (Connection : Connection_Id; Status : out Status_Code; Data : in out X_Raw_Data_Array; Count : out X_Raw_Data_Index) is ------------------------------------------------------------------------------ -- Connection - Specifies the connection to use for reading -- Status - Receives the final status of the operation -- Data - Receives the data -- Count - Receives the length of the data -- -- Called when we are ready to receive some specific number of bytes from the -- network connection and we will wait forever if necessary in order to get -- exactly that many bytes. ------------------------------------------------------------------------------ begin Connection.Reader.Receive_Must (Status => Status, Data => Data, Count => Count); end Receive_Must; --/ end if; -- R1000 --\f --/ if Unix then --// --// procedure Receive_Must (Connection : Connection_Id; --// Status : out Status_Code; --// Data : in out X_Raw_Data_Array; --// Count : out X_Raw_Data_Index) is --// ------------------------------------------------------------------------------ --// -- Connection - Specifies the connection to use for reading --// -- Status - Receives the final status of the operation --// -- Data - Receives the data --// -- Count - Receives the length of the data --// -- --// -- Called when we are ready to receive some specific number of bytes from the --// -- network connection and we will wait forever if necessary in order to get --// -- exactly that many bytes. --// ------------------------------------------------------------------------------ --// Result : S_Long; --// Need_Count : constant X_Raw_Data_Index := Data'Length; --// Tmp_Count : X_Raw_Data_Index; --// Total : X_Raw_Data_Index; --// First : X_Raw_Data_Index; --// Fdset : Fd_Set_Rec; --// begin --// --// ----Do an initial receive. See if we get what we wanted without further --// -- effort. --// --// Result := Read (Connection, Data (Data'First)'Address, Data'Length); --// --// ----If we got it then return it all to the caller. --// --// if Result = -1 then --// Count := 0; --// Status := Get_Errno; --// elsif X_Raw_Data_Index (Result) = Need_Count then --// Count := X_Raw_Data_Index (Result); --// Status := Ok; --// return; --// end if; --// --// ----Set up to loop until we get what we wanted. --// --// Total := X_Raw_Data_Index (Result); --// First := Data'First + Total; --// Fd_Clr( Fdset ); --// Fd_Set( Fdset, Connection ); --// loop --// --// ----Wait until there is something to receive. --// --// Result := Unix_Select (Fdset'Size, --// Fdset (Fdset'First)'Address, --// None_System_Address, --// None_System_Address, --// None_System_Address); --// if Result <= 0 and then --// Get_Errno /= Eintr then --// Status := Get_Errno; --// Count := Total; --// return; --// end if; --// --// ----Receive what we can this time. --// --// Result := Read (Connection, Data (First)'Address, --// Data'Last - First + 1); --// --// ----If we got all we asked for then return to the caller. --// --// if Result = -1 then --// Status := Get_Errno; --// Count := Total; --// end if; --// Total := Total + X_Raw_Data_Index (Result); --// if Total = Need_Count then --// Status := Ok; --// Count := Total; --// return; --// end if; --// --// ----Record what we got and continue trying. --// --// First := First + X_Raw_Data_Index (Result); --// end loop; --// --// end Receive_Must; --// --/ end if; -- TeleGen2 and Unix --\f procedure Transmit_Maybe (Connection : Connection_Id; Status : out Status_Code; Data : X_Raw_Data_Array; Count : out X_Raw_Data_Index) is ------------------------------------------------------------------------------ -- Connection - Specifies the connection to use for writing -- Status - Receives the final status of operation -- Data - Specifies the data -- Count - Receives the length of the data actually sent -- -- Called when we want to transmit something on the network and we have other -- things we could be doing if the transmit would block for some reason. We -- send out as much as possible and return. ------------------------------------------------------------------------------ --/ if R1000 and R1000_Xlib_Only then --// --// begin --// --// Transport.Transmit (Connection => Connection, --// Status => Status, --// Data => Data, --// Count => Count, --// Max_Wait => 0.25, --// More => False); --// --/ elsif R1000 and not R1000_Xlib_Only then begin Transport.Transmit (Connection => Connection.Connection, Status => Status, Data => Data, Count => Count, Max_Wait => 0.25, More => False); --/ elsif Unix then --// --// Result : S_Long; --// Lstatus : Status_Code; --// begin --// --// loop --// Result := Write (Connection, --// Data (Data'First)'Address, --// Data'Length); --// if Result = -1 then --// Lstatus := Get_Errno; --// if Lstatus /= Eintr then --// Count := 0; --// Status := Lstatus; --// return; --// end if; --// else --// Count := X_Raw_Data_Index (Result); --// Status := Ok; --// return; --// end if; --// end loop; --// --/ else --// begin --// Something_Needed_Here; --/ end if; end Transmit_Maybe; --\f end Xlbmp_Network_Interface;