|
|
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 - metrics - downloadIndex: B T
Length: 7355 (0x1cbb)
Types: TextFile
Names: »B«
└─⟦180fe333a⟧ Bits:30000405 8mm tape, Rational 1000, SW CATALOG, 10_20_0
└─⟦180fe333a⟧ Bits:30000537 8mm tape, Rational 1000, SW Catalog 10_20_0
└─⟦5cb1d1d7f⟧ »DATA«
└─⟦3b1ee7bd8⟧
└─⟦this⟧
with System_Utilities;
with Text_Io, Io, Io_Exceptions, Operator;
package body Port_Tools is
function Port_Name (Port : R1000_Port) return String is
begin
return "!Machine.Devices.Terminal_" & R1000_Port'Image (Port) (2 .. 3);
end Port_Name;
function Terminal_Name (Port : R1000_Port) return String is
begin
return "Terminal_" & R1000_Port'Image (Port) (2 .. 3);
end Terminal_Name;
procedure Port_Settings (From : R1000_Port := Port_Tools.R1000_Port'First;
To : R1000_Port := Port_Tools.R1000_Port'Last) is
package Op renames Operator;
package Sio renames Io;
package Tio renames Text_Io;
P1, P2 : R1000_Port;
type Port_Status is (In_Use, Enabled);
--- this array will be used to remember the status of the port
--- in order to restore that status. If a port is enabled but not
--- In Use we will disable it and enable it later.
Port_Info : array (R1000_Port, Port_Status) of Boolean;
--- disable any port that is enabled but not in use
procedure Set_Ports (From, To : R1000_Port) is
begin
--- this procedure expects to >= from for a for loop
--- start off with no port being disabled
Port_Info := (others => (others => False));
for Port in From .. To loop
if System_Utilities.Enabled (Port) then
Port_Info (Port, Enabled) := True;
end if;
declare
Flow : constant String := System_Utilities.Flow_Control;
begin
if Port_Info (Port, Enabled) then
Port_Info (Port, In_Use) := True;
end if;
exception
when Io_Exceptions.Status_Error =>
if Port_Info (Port, Enabled) then
Op.Disable_Terminal (Port);
delay 1.0 + 2.0 / (P2 - P1 + 1);
--- remember that we disabled this line
else
--- the port is open by another user
Port_Info (Port, In_Use) := True;
end if;
end;
end loop;
end Set_Ports;
procedure Reset_Ports (From, To : R1000_Port) is
begin
for Port in From .. To loop
if Port_Info (Port, Enabled) and then
not Port_Info (Port, In_Use) then
Op.Enable_Terminal (Port);
end if;
end loop;
end Reset_Ports;
function User (Port : R1000_Port) return String is
Iter : System_Utilities.Session_Iterator;
Id : System_Utilities.Session_Id;
begin
System_Utilities.Init (Iter);
loop
exit when System_Utilities.Done (Iter);
Id := System_Utilities.Value (Iter);
if Port = System_Utilities.Terminal (Id) then
return System_Utilities.User_Name (Id) & '.' &
System_Utilities.Session_Name (Id);
end if;
System_Utilities.Next (Iter);
end loop;
return "";
end User;
function Baud_Image (Port : R1000_Port) return String is
Baud_String : String (1 .. 9) := "****/****";
begin
if Port_Info (Port, In_Use) and then
not Port_Info (Port, Enabled) then
return Baud_String;
else
if System_Utilities.Input_Rate (Port) (6 .. 8) = "300" then
Baud_String (1) := ' ';
Baud_String (2 .. 4) :=
System_Utilities.Input_Rate (Port) (6 .. 8);
else
Baud_String (1 .. 4) :=
System_Utilities.Input_Rate (Port) (6 .. 9);
end if;
if System_Utilities.Output_Rate (Port) (6 .. 8) = "300" then
Baud_String (6) := ' ';
Baud_String (7 .. 9) :=
System_Utilities.Output_Rate (Port) (6 .. 8);
else
Baud_String (6 .. 9) :=
System_Utilities.Output_Rate (Port) (6 .. 9);
end if;
return Baud_String;
end if;
end Baud_Image;
function Term_Type (Port : R1000_Port) return String is
begin
return System_Utilities.Terminal_Type (Port);
end Term_Type;
--- procedure to output line info
procedure Output_Line_Info (Port : R1000_Port) is
begin
Sio.Put (Integer'Image (Port));
Tio.Set_Col (To => 9);
Sio.Put (Boolean'Image (Port_Info (Port, Enabled)));
Tio.Set_Col (To => 16);
Sio.Put (Boolean'Image (Port_Info (Port, In_Use)));
if Port_Info (Port, In_Use) and then
not Port_Info (Port, Enabled) then
null;
else
begin
Tio.Set_Col (To => 23);
Sio.Put (String'(System_Utilities.Flow_Control (Port)));
Tio.Set_Col (To => 30);
Sio.Put (Baud_Image (Port));
Tio.Set_Col (To => 42);
Sio.Put (Integer'Image
(System_Utilities.Character_Size (Port)));
Tio.Set_Col (47);
Sio.Put (System_Utilities.Parity_Kind'Image
(System_Utilities.Parity (Port)));
Tio.Set_Col (54);
Sio.Put (Term_Type (Port));
Tio.Set_Col (64);
Sio.Put (User (Port));
exception
when Io_Exceptions.Status_Error =>
Sio.Put ("***** The line is in an Invalid State *****");
end;
end if;
Sio.New_Line;
end Output_Line_Info;
begin
if From < To then
P1 := From;
P2 := To;
else
P1 := To;
P2 := From;
end if;
--- since we used a constrained type with a range of all the possible
--- R1000 ports we don't have to mke sure that the port parameter is
--- a valid r1000 port, so just loop
--- output the header
Sio.Put_Line
(" Line Enabled In Flow Baud Char Parity Terminal In Use");
Sio.Put_Line
("Number Use Control in/out size Type By");
Sio.Put_Line
("================================================================================");
Sio.New_Line;
--- set the ports so that i can get the info needed
Set_Ports (From => P1, To => P2);
for Port in P1 .. P2 loop
Output_Line_Info (Port);
end loop;
---
--- reset the ports...i.e enable lines that we disabled
Reset_Ports (From => P1, To => P2);
exception
when others =>
Reset_Ports (From => P1, To => P2);
end Port_Settings;
end Port_Tools;