with Common_Display_Types, Cursor, ErroAKD, -- KeybAKD, MathAKD, MemoAKD; with StriAK; -- for Image with Tty; Package body ScrnAKD is --------------------------------------------------------------------------- --------------------------------------------------------------------------- Procedure Beep ( NumTimes: positive := 1 ) is --------------------------------------------------------------------------- begin for index in 1..NumTimes loop Tty.Put ( Ascii.BEL ); end loop; end Beep; procedure Clear is --------------------------------------------------------------------------- begin Tty.Clear_Screen; end Clear; procedure ClrL is --------------------------------------------------------------------------- Row: Common_Display_Types.Row_Range; DumCol: Common_Display_Types.Column_Range; begin Cursor.Get_Position(Row, DumCol); Cursor.Move(Row, 0); for index in 1..Line_Length loop Tty.Put(' '); end loop; Cursor.Up; end ClrL; procedure ClrScr is --------------------------------------------------------------------------- begin Clear; Cursor.Move(0, 0); end ClrScr; procedure Put ( Address: in MemoAKD.Address ) is --------------------------------------------------------------------------- begin Put ( StriAK.Image ( long_integer ( Address ), Signed => false, Base => 2 ) ); exception when others => ErroAKD.Notify ( "ScrnAKD.Put ( address )" ); raise; end Put; Procedure Put ( InChar: in character ) is --------------------------------------------------------------------------- begin Tty.Put ( InChar ); end Put; procedure Put ( Item : in integer; Width : in TextAKD.Field := integer'width; Base : in TextAKD.Number_Base := 10; Signed : in boolean := true; Zeroed : in boolean := false ) is --------------------------------------------------------------------------- begin Tty.Put ( StriAK.Image ( Item, Width, Base, Signed, Zeroed ) ); end Put; procedure Put ( Item : in long_integer; Width : in TextAKD.Field := long_integer'width; Base : in TextAKD.Number_Base := 10; Signed : in boolean := true; Zeroed : in boolean := false ) is --------------------------------------------------------------------------- begin Tty.Put ( StriAK.Image ( Item, Width, Base, Signed, Zeroed ) ); end Put; Procedure Put ( InStr: in string ) is --------------------------------------------------------------------------- begin Tty.Put ( InStr ); end Put; procedure Put_Line ( Address: in MemoAKD.Address ) is --------------------------------------------------------------------------- begin Put ( Address ); Put_Line; end Put_Line; procedure Put_Line ( InBool: in boolean ) is --------------------------------------------------------------------------- begin Tty.Put_Line ( boolean'image ( InBool ) ); end Put_Line; Procedure Put_Line ( InChar: in character ) is --------------------------------------------------------------------------- begin Tty.Put_Line ( character'image ( InChar ) ); end Put_Line; procedure Put_Line ( Item : in integer; Width : in TextAKD.Field := integer'width; Base : in TextAKD.Number_Base := 10; Signed : in boolean := true; Zeroed : in boolean := false ) is --------------------------------------------------------------------------- begin Tty.Put ( StriAK.Image ( Item, Width, Base, Signed, Zeroed ) ); Put_Line ( "" ); end Put_Line; procedure Put_Line ( Item : in long_integer; Width : in TextAKD.Field := long_integer'width; Base : in TextAKD.Number_Base := 10; Signed : in boolean := true; Zeroed : in boolean := false ) is --------------------------------------------------------------------------- begin Tty.Put ( StriAK.Image ( Item, Width, Base, Signed, Zeroed ) ); Put_Line ( "" ); end Put_Line; Procedure Put_Line ( InStr: in string := ""; Justify: JustifyType := Left ) is --------------------------------------------------------------------------- begin case Justify is when Left => null; when Center => for index in 1..(Line_Length - InStr'last)/2 loop Tty.Put(' '); end loop; when Right => for index in 1..(Line_Length - InStr'last) loop Tty.Put(' '); end loop; end case; Tty.Put_Line(InStr); exception when others => ErroAKD.Notify("Scrn.Put_Line"); raise; end Put_Line; Procedure Put_Text(InStr: in string; Word_Wrap: in boolean := true) is --------------------------------------------------------------------------- Column: positive range 1..Line_Length+1 := Line_Length; Index_2: positive range 1..Line_Length; Next_Space: positive range 1..Line_Length; begin for index in InStr'range loop if Word_Wrap then Column := Column + 1; if Column = Line_Length + 1 then Column := 1; end if; if Column = 1 then for Index_2 in reverse 1..Line_Length loop Next_Space := Index_2; if Index_2 + index - 1 <= InStr'last then exit when InStr(Index_2+index-1) = ' '; else Next_Space := Line_Length; exit; end if; end loop; if Next_Space = 1 then Next_Space := Line_Length; end if; end if; if Column = Next_Space then Put_Line; Column := Line_Length; end if; if not((InStr(index) = ' ') and (Column = Line_Length)) then Put(InStr(index)); end if; else Put(InStr(index)); end if; end loop; Put_Line; end Put_Text; --------------------------------------------------------------------------- --------------------------------------------------------------------------- end ScrnAKD;