with TextAKD; use TextAKD; package body IOInAKD is ---------------------------------------------------------------------- ---------------------------------------------------------------------- procedure Ask ( Item : out Num; Prompt : in string := ""; Default : in Num := Num'first; Minimum : in Num := Num'first; Maximum : in Num := Num'last; Width : in Field := Default_Width ) is ---------------------------------------------------------------------- Temp_Str : string ( 1..Width ) := ( others => ASCII.Nul ); Last : natural; Temp : Num ; begin loop Put ( Prompt & "(" & Num'image ( Minimum ) & ".." & Num'image ( Maximum ) & ") [" & Num'image ( Default ) & "]: " ); Get_Line ( Temp_Str, Last ); begin if Last = 0 then Temp := Default; else Temp := Num'value ( Temp_Str ( 1..Last ) ); end if; if Temp < Minimum then Put_Line ( "Please enter a value greater than or equal to " & Num'image ( Minimum ) & "." ); elsif Temp > Maximum then Put_Line ( "Please enter a value less than or equal to " & Num'image ( Maximum ) & "." ); else exit; end if; exception when others => Put_Line ( "Please enter an integer number between " & Num'image ( Minimum ) & " and " & Num'image ( Maximum ) & " inclusive." ); end; end loop; Item := Temp; end Ask; procedure Put_Line ( File : in File_Type; Item : in Num; Width : in Field := Default_Width; Base : in Number_Base := Default_Base ) is ---------------------------------------------------------------------- begin Num_IO.Put ( File, Item, Width, Base ); Put_Line ( File, "" ); end Put_Line; procedure Put_Line ( Item : in Num; Width : in Field := Default_Width; Base : in Number_Base := Default_Base ) is ---------------------------------------------------------------------- begin Num_IO.Put ( Item, Width, Base ); Put_Line ( "" ); end Put_Line; ---------------------------------------------------------------------- ---------------------------------------------------------------------- end IOInAKD;