|
|
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: 14336 (0x3800)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Window_Utilities, seg_004703
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦5a81ac88f⟧ »Space Info Vol 1«
└─⟦this⟧
with Window_Io;
with New_Keys;
with Unbounded_String;
package body Window_Utilities is
package Unbounded is new Unbounded_String;
package Raw renames Window_Io.Raw;
function "=" (K1, K2 : Raw.Key) return Boolean renames Raw."=";
Inverse_Bold : constant Window_Io.Font :=
Window_Io.Font'(Window_Io.Plain, (Inverse => True, others => False));
procedure Beginning_Of_Line (Window : Window_Io.File_Type) is
Current_Line : Window_Io.Line_Number;
Current_Column : Window_Io.Column_Number;
begin
Window_Io.Report_Cursor (Window, Current_Line, Current_Column);
Window_Io.Position_Cursor (Window, Current_Line, 1);
end Beginning_Of_Line;
procedure End_Of_Line (Window : Window_Io.File_Type) is
Current_Line : Window_Io.Line_Number;
Current_Column : Window_Io.Column_Number;
begin
Window_Io.Report_Cursor (Window, Current_Line, Current_Column);
Window_Io.Position_Cursor (Window, Current_Line,
Window_Io.Line_Length (Window));
end End_Of_Line;
procedure Next_Line (Window : Window_Io.File_Type) is
Current_Line : Window_Io.Line_Number;
Current_Column : Window_Io.Column_Number;
begin
Window_Io.Report_Cursor (Window, Current_Line, Current_Column);
Window_Io.Position_Cursor (Window, Current_Line + 1, 1);
end Next_Line;
procedure Home (Window : Window_Io.File_Type) is
begin
Window_Io.Position_Cursor (Window);
end Home;
procedure Erase (Window : Window_Io.File_Type) is
begin
Window_Io.Position_Cursor (Window);
Window_Io.Delete_Lines (Window, Window_Io.Last_Line (Window));
end Erase;
function Initialize (Window : Window_Io.File_Type) return Iterator is
Last_Line : Positive := Window_Io.Last_Line (Window);
Return_Iter : Iterator :=
new Node'(Bounded_String.Value ("", Line_Length), null);
This_Line : Bound_String;
begin
Home (Window);
for I in 1 .. Last_Line loop
Bounded_String.Copy (This_Line, Window_Io.Line_Image (Window));
Next_Line (Window);
Return_Iter.Next := new Node'(This_Line, null);
end loop;
return Return_Iter.Next;
end Initialize;
function Done (Iter : Iterator) return Boolean is
begin
return Iter = null;
end Done;
function Value (Iter : Iterator) return String is
begin
return Bounded_String.Image (Iter.Line);
end Value;
procedure Next (Iter : in out Iterator) is
begin
if Iter /= null then
Iter := Iter.Next;
end if;
end Next;
procedure Erase_Column (Window : Window_Io.File_Type;
Offset : Natural;
Width : Positive;
Length : Natural := 0) is
Window_Height : Window_Io.Column_Number;
Window_Width : Window_Io.Line_Number;
Number_Of_Lines : Positive;
Blanks : constant String (1 .. Width) := (others => ' ');
begin
Window_Io.Report_Size (Window, Window_Height, Window_Width);
if Length = 0 then
Number_Of_Lines := Window_Height;
else
Number_Of_Lines := Length;
end if;
for I in 1 .. Number_Of_Lines loop
Window_Io.Position_Cursor (Window, I, Offset + 1);
Window_Io.Delete (Window, 80);
end loop;
end Erase_Column;
function Query (Input_Window : Window_Io.File_Type;
Output_Window : Window_Io.File_Type;
Prompt : String;
Line : Positive;
Column : Positive) return String is
begin
Window_Io.Position_Cursor (Otput_Window, Line, Column);
Window_Io.Overwrite (Output_Window, Prompt,
Window_Io.Normal, Window_Io.Text);
Window_Io.Overwrite (Output_Window, " [INPUT]",
Inverse_Bold, Window_Io.Prompt);
Window_Io.Position_Cursor (Input_Window, Line, Column + Prompt'Length);
return Window_Io.Get_Line (Input_Window, "");
end Query;
procedure Continue (Input_Window : Window_Io.File_Type;
Output_Window : Window_Io.File_Type;
Prompt : String;
Line : Positive;
Column : Positive) is
S : constant String :=
Prompt_Query (Input_Window, Output_Window, Prompt, Line, Column);
begin
null;
end Continue;
function Hidden_Query (Input_Window : Window_Io.File_Type;
Output_Window : Window_Io.File_Type;
Prompt : String;
Line : Positive;
Column : Positive) return String is
Stream : Raw.Stream_Type;
Answer : Unbounded.Variable_String;
Key : Raw.Key;
begin
Window_Io.Position_Cursor (Output_Window, Line, Column);
Window_Io.Overwrite (Output_Window, Prompt,
Inverse_Bold, Window_Io.Text);
Window_Io.Position_Cursor (Output_Window, Line, Column);
Raw.Open (Stream);
loop
Raw.Get (Stream, Key);
exit when Key = New_Keys.Enter;
if Key = New_Keys.Delete_Char_Backward then
Unbounded.Delete (Answer, Unbounded.Length (Answer));
Window_Io.Move_Cursor (Output_Window, 0, -1);
Window_Io.Overwrite (Output_Window, "+",
Window_Io.Normal, Window_Io.Text);
Window_Io.Move_Cursor (Output_Window, 0, -1);
else
declare
C : Character;
begin
C := Raw.Convert (Key);
Window_Io.Overwrite (Output_Window, "*",
Window_Io.Normal, Window_Io.Text);
Window_Io.Move_Cursor (Output_Window, 0, 0);
Unbounded.Append (Answer, C);
exception
when Constraint_Error =>
Window_Io.Bell (Output_Window);
end;
end if;
end loop;
Raw.Close (Stream);
return Unbounded.Image (Answer);
end Hidden_Query;
function Prompt_Query (Input_Window : Window_Io.File_Type;
Output_Window : Window_Io.File_Type;
Prompt : String;
Line : Positive;
Column : Positive) return String is
function Delete_It (S : String) return String is
begin
Window_Io.Position_Cursor (Output_Window, Line, Column);
Window_Io.Delete_Lines (Output_Window, 2);
return S;
end Delete_It;
begin
Window_Io.Position_Cursor (Output_Window, Line, Column);
Window_Io.Overwrite (Output_Window, Prompt,
Inverse_Bold, Window_Io.Prompt);
Window_Io.Position_Cursor (Input_Window, Line, Column);
return Delete_It (Window_Io.Get_Line (Input_Window, ""));
end Prompt_Query;
end Window_Utilities;
nblk1=d
nid=0
hdr6=1a
[0x00] rec0=1d rec1=00 rec2=01 rec3=020
[0x01] rec0=00 rec1=00 rec2=0d rec3=008
[0x02] rec0=1b rec1=00 rec2=02 rec3=02e
[0x03] rec0=00 rec1=00 rec2=0c rec3=008
[0x04] rec0=22 rec1=00 rec2=03 rec3=032
[0x05] rec0=00 rec1=00 rec2=0b rec3=004
[0x06] rec0=1f rec1=00 rec2=04 rec3=048
[0x07] rec0=00 rec1=00 rec2=0a rec3=002
[0x08] rec0=19 rec1=00 rec2=05 rec3=07e
[0x09] rec0=1c rec1=00 rec2=06 rec3=07a
[0x0a] rec0=00 rec1=00 rec2=09 rec3=006
[0x0b] rec0=1c rec1=00 rec2=07 rec3=048
[0x0c] rec0=12 rec1=00 rec2=08 rec3=000
tail 0x215004f42815c67864641 0x42a00088462061e03