|
|
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: 7307 (0x1c8b)
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 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 (Output_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 Quiet_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 Quiet_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;