|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 6144 (0x1800)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Tty, seg_0509a2
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦cfc2e13cd⟧ »Space Info Vol 2«
└─⟦this⟧
with Ioctl;
use Ioctl;
with V_I_Bits;
use V_I_Bits;
with File_Support;
with Unix;
with Termio;
use Termio;
with Machine_Types;
package body Tty is
procedure Sys_Err (Msg : String) is
begin
File_Support.Write_To_Stderr (Msg);
Unix.Sys_Exit (2);
end Sys_Err;
procedure Catch_Hup is
begin
null; -- file_support.write_to_stderr("caught hangup");
end Catch_Hup;
procedure Show_Tty_State (Fd : Os_Files.File_Descriptor) is
State : Total_State;
begin
File_Support.Write_To_Stderr ("show fd: " &
Integer'Image (Integer (Fd)));
Get_Tty_State (Fd, State);
end Show_Tty_State;
procedure Get_Tty_State (Fd : Os_Files.File_Descriptor;
State : out Total_State) is
begin
if Ioctl.Ioctl (Fd, Tcgeta, State.U_Tty_Termio'Address) = -1 then
Sys_Err ("in TCGETA save");
end if;
end Get_Tty_State;
-----------------------------------------------------
--\x09set_tty_state
--\x09\x09used for master & slave
--\x09\x09note: this flushes the buffer. use with caution
--\x09\x09for UNIX 4.3, can't set process group
----------------------------------------------------
procedure Set_Tty_State
(Fd : Os_Files.File_Descriptor; State : Total_State) is
Ldisc : Integer;
begin
if not Os_Files.Is_Interactive (Fd) then
return;
end if;
if Ioctl.Ioctl (Fd, Tcseta, State.U_Tty_Termio'Address) = -1 then
Sys_Err ("in TCSETA save");
end if;
end Set_Tty_State;
procedure Condition_Port (Fd : Os_Files.File_Descriptor) is
State : Total_State;
use Termio;
use Machine_Types;
Input_Modes_Wanted_Off : constant :=
Ignbrk + Brkint + Ignpar + Parmrk + Inpck + Istrip +
Inlcr + Igncr + Icrnl + Ixon + Ixoff + Iuclc + Imaxbel;
Input_Modes_Wanted_On : constant := Ixany;
Output_Modes_Wanted_Off : constant :=
Opost + Olcuc + Onlcr + Ocrnl + Onocr + Ofill + Ofdel +
Crdly + Bsdly + Ffdly + Nldly + Vtdly + Tabdly;
Output_Modes_Wanted_On : constant := Onlret;
Control_Modes_Wanted_Off : constant :=
Csize + Cstopb + Parenb + Parodd + Clocal + Cibaud + Parext;
Control_Modes_Wanted_On : constant := Cs8 + Cread + Hupcl;
Line_Modes_Wanted_Off : constant :=
Isig + Icanon + Xcase + Termio.Echo + Echoe + Echok +
Echonl + Termio.Noflsh + Termio.Tostop + Echoctl +
Echoprt + Echoke + Termio.Flusho + Iexten + Pending;
Line_Modes_Wanted_On : constant := 0;
begin
Get_Tty_State (Fd, State);
-- input modes
State.U_Tty_Termio.C_Iflag :=
Word (Bit_And (Integer (State.U_Tty_Termio.C_Iflag),
Bit_Neg (Input_Modes_Wanted_Off)));
State.U_Tty_Termio.C_Iflag :=
Word (Bit_Or (Integer (State.U_Tty_Termio.C_Iflag),
Input_Modes_Wanted_On));
-- output modes
State.U_Tty_Termio.C_Oflag :=
Word (Bit_And (Integer (State.U_Tty_Termio.C_Oflag),
Bit_Neg (Output_Modes_Wanted_Off)));
State.U_Tty_Termio.C_Oflag :=
Word (Bit_Or (Integer (State.U_Tty_Termio.C_Oflag),
Output_Modes_Wanted_On));
-- control modes (NOTE: baud rate is left as is)
State.U_Tty_Termio.C_Cflag :=
Word (Bit_And (Integer (State.U_Tty_Termio.C_Cflag),
Bit_Neg (Control_Modes_Wanted_Off)));
State.U_Tty_Termio.C_Cflag :=
Word (Bit_Or (Integer (State.U_Tty_Termio.C_Cflag),
Control_Modes_Wanted_On));
-- line modes
State.U_Tty_Termio.C_Lflag :=
Word (Bit_And (Integer (State.U_Tty_Termio.C_Lflag),
Bit_Neg (Line_Modes_Wanted_Off)));
State.U_Tty_Termio.C_Lflag :=
Word (Bit_Or (Integer (State.U_Tty_Termio.C_Lflag),
Line_Modes_Wanted_On));
State.U_Tty_Termio.C_Cc (Vmin) := 1;
State.U_Tty_Termio.C_Cc (Vtime) := 1;
State.U_Tty_Termio.C_Line := 16#000#;
Set_Tty_State (Fd, State);
end Condition_Port;
end Tty;
nblk1=5
nid=0
hdr6=a
[0x00] rec0=27 rec1=00 rec2=01 rec3=00a
[0x01] rec0=1c rec1=00 rec2=02 rec3=03e
[0x02] rec0=14 rec1=00 rec2=03 rec3=01e
[0x03] rec0=16 rec1=00 rec2=04 rec3=042
[0x04] rec0=0e rec1=00 rec2=05 rec3=000
tail 0x217580336878e7976961b 0x42a00088462060003