with TTY; -- from Meridian OpenAda for DOS package body TextAKD is ---------------------------------------------------------------------- ---------------------------------------------------------------------- -- Copyright (C) 1994 David Wallace Croft. All rights reserved. ---------------------------------------------------------------------- ---------------------------------------------------------------------- -- procedure Set_Line_Length ( -- To : in Count ) is -- ---------------------------------------------------------------------- -- begin -- null; -- end Set_Line_Length; -- procedure Set_Page_Length ( -- To : in Count ) is -- ---------------------------------------------------------------------- -- begin -- null; -- end Set_Page_Length; -- function Line_Length -- return Count is -- ---------------------------------------------------------------------- -- begin -- null; -- end Line_Length; -- function Page_Length -- return Count is -- ---------------------------------------------------------------------- -- begin -- null; -- end Page_Length; procedure New_Line ( Spacing : in Positive_Count := 1 ) is ---------------------------------------------------------------------- begin for index in 1..Spacing loop Put_Line ( "" ); end loop; end New_Line; -- procedure Skip_Line ( -- Spacing : in Positive_Count := 1 ) is -- ---------------------------------------------------------------------- -- begin -- end Skip_Line; -- function End_Of_Line -- return boolean is -- ---------------------------------------------------------------------- -- begin -- null; -- end End_Of_Line; -- procedure New_Page is -- ---------------------------------------------------------------------- -- begin -- null; -- end New_Page; -- procedure Skip_Page is -- ---------------------------------------------------------------------- -- begin -- null; -- end Skip_Page; -- function End_Of_Page -- return boolean is -- ---------------------------------------------------------------------- -- begin -- null; -- end End_Of_Page; -- function End_Of_File -- return boolean is -- ---------------------------------------------------------------------- -- begin -- null; -- end End_Of_File; -- procedure Set_Col ( -- To : in Positive_Count ) is -- ---------------------------------------------------------------------- -- begin -- null; -- end Set_Col; -- procedure Set_Line ( -- To : in Positive_Count ) is -- ---------------------------------------------------------------------- -- begin -- null; -- end Set_Line; -- function Col -- return Positive_Count is -- ---------------------------------------------------------------------- -- begin -- null; -- end Col; -- function Line -- return Positive_Count is -- ---------------------------------------------------------------------- -- begin -- null; -- end Line; -- function Page -- return Positive_Count is -- ---------------------------------------------------------------------- -- begin -- null; -- end Page; procedure Get ( Item : out character ) is ---------------------------------------------------------------------- begin Item := TTY.Get; end Get; procedure Put ( Item : in character ) is ---------------------------------------------------------------------- begin TTY.Put ( Item ); end Put; procedure Get ( Item : out string ) is ---------------------------------------------------------------------- begin for index in Item'range loop Get ( Item ( index ) ); end loop; end Get; procedure Put ( Item : in string ) is ---------------------------------------------------------------------- begin TTY.Put ( Item ); end Put; procedure Get_Line ( Item : out string; Last : out natural ) is ---------------------------------------------------------------------- begin TTY.Get ( Item, Last ); New_Line; end Get_Line; procedure Put_Line ( Item : in string ) is ---------------------------------------------------------------------- begin TTY.Put_Line ( Item ); end Put_Line; ---------------------------------------------------------------------- ---------------------------------------------------------------------- package body Integer_IO_AKD is ---------------------------------------------------------------------- ---------------------------------------------------------------------- procedure Get ( Item : out Num; Width : in Field := 0 ) is ---------------------------------------------------------------------- Temp_Str_1 : string ( 1..Num'width ); Temp_Str_2 : string ( 1..Width ); Last : natural; Temp : Num; begin if Width = 0 then Get_Line ( Temp_Str_1, Last ); Get ( Temp_Str_1 ( 1..Last ), Item, Last ); else Get ( Temp_Str_2 ); Get ( Temp_Str_2, Item, Last ); end if; end Get; procedure Put ( Item : in Num; Width : in Field := Default_Width; Base : in Number_Base := Default_Base ) is ---------------------------------------------------------------------- Temp_Str : string ( 1..Width ); begin Put ( Temp_Str, Item, Base ); Put ( Temp_Str ); end Put; end Integer_IO_AKD; ---------------------------------------------------------------------- ---------------------------------------------------------------------- package body Float_IO_AKD is ---------------------------------------------------------------------- ---------------------------------------------------------------------- procedure Get ( Item : out Num; Width : in Field := 0 ) is ---------------------------------------------------------------------- Temp_Str_1 : string ( 1..Num'digits ); Temp_Str_2 : string ( 1..Width ); Last : natural; begin if Width = 0 then Get_Line ( Temp_Str_1, Last ); Get ( Temp_Str_1 ( 1..Last ), Item, Last ); else Get ( Temp_Str_2 ); Get ( Temp_Str_2, Item, Last ); end if; end Get; procedure Put ( Item : in Num; Fore : in Field := Default_Fore; Aft : in Field := Default_Aft; Exp : in Field := Default_Exp ) is ---------------------------------------------------------------------- -- Could be taking unnecessary loops continuously... ---------------------------------------------------------------------- Extra : natural; Too_Big : boolean; begin if Exp = 0 then Extra := 1; else Extra := 2; end if; loop Too_Big := false; declare Temp_Str : string ( 1..( Fore + Aft + Exp + Extra ) ); begin Put ( Temp_Str, Item, Aft, Exp ); Put ( Temp_Str ); exception when Layout_Error => Too_Big := true; Extra := Extra + 1; when others => raise; end; exit when not Too_Big; end loop; end Put; end Float_IO_AKD; ---------------------------------------------------------------------- ---------------------------------------------------------------------- package body Fixed_IO_AKD is ---------------------------------------------------------------------- ---------------------------------------------------------------------- procedure Get ( Item : out Num; Width : in Field := 0 ) is ---------------------------------------------------------------------- Temp_Str_1 : string ( 1..( Num'fore + Num'aft + 2 ) ); Temp_Str_2 : string ( 1..Width ); Last : natural; begin if Width = 0 then Get_Line ( Temp_Str_1, Last ); Get ( Temp_Str_1 ( 1..Last ), Item, Last ); else Get ( Temp_Str_2 ); Get ( Temp_Str_2, Item, Last ); end if; end Get; procedure Put ( Item : in Num; Fore : in Field := Default_Fore; Aft : in Field := Default_Aft; Exp : in Field := Default_Exp ) is ---------------------------------------------------------------------- Temp_Str : string ( 1..( Fore + Aft + Exp - 2 ) ); begin Put ( Temp_Str, Item, Aft, Exp ); Put ( Temp_Str ); end Put; end Fixed_IO_AKD; ---------------------------------------------------------------------- ---------------------------------------------------------------------- package body Enumeration_IO_AKD is ---------------------------------------------------------------------- ---------------------------------------------------------------------- procedure Get ( Item : out Enum ) is ---------------------------------------------------------------------- -- Needs to be modified to skip leading white space such as -- blanks, line terminators, and page terminators. ---------------------------------------------------------------------- Temp_Str : string ( 1..Enum'width ); Last : positive; begin Get_Line ( Temp_Str, Last ); Get ( Temp_Str, Item, Last ); end Get; procedure Put ( Item : in Enum; Width : in Field := Default_Width; Set : in Type_Set := Default_Setting ) is ---------------------------------------------------------------------- Temp_Str : string ( 1..Width ); begin Put ( Temp_Str, Item, Set ); Put ( Temp_Str ); end Put; end Enumeration_IO_AKD; ---------------------------------------------------------------------- ---------------------------------------------------------------------- end TextAKD;