	with Cursor;
	with FloaAKD; use FloaAKD;
	with InteAKD;
	with TextAKD; use TextAKD; -- for standard integer i/o
	with TTY;

	package body ConsAKD is
	----------------------------------------------------------------------
	-- Copyright (C) 1994 David Wallace Croft.  All rights reserved.
	----------------------------------------------------------------------

	procedure Demo is
	----------------------------------------------------------------------
	begin
	  Put_Line ( Copyright );
	  New_Line;
	  Put_Line ( Description );
	  New_Line;
	  Put_Line ( "No demonstration is currently available." );
	  Pause;
	end Demo;

	----------------------------------------------------------------------
	-- Boolean
	----------------------------------------------------------------------

     function Ask_Bool (
       Prompt  : in     string  := "";
       Default : in     boolean := true )
       return boolean is
     ----------------------------------------------------------------------
       Default_Char : character;
       Do_Over : boolean := false;
       Item_Str : string ( 1..2 );
       Last : natural;
     begin
       if Default then
	 Default_Char := 'Y';
       else
	 Default_Char := 'N';
       end if;
       loop
	 Put ( Prompt & "(Y/N) [" & Default_Char & "]: " );
	 Last := 0;
	 Get_Line ( Item_Str, Last );
	 if Last = 0 then
	   return Default;
	 else
	   case Item_Str ( 1 ) is
	     when 'Y'|'T'|'y'|'t' => return true;
	     when 'N'|'F'|'n'|'f' => return false;
	     when others          => Do_Over := true;
	   end case;
	 end if;
	 exit when not ( Do_Over );
	 Put_Line ( "Please enter 'Y' or 'N'." );
       end loop;
     end Ask_Bool;

     procedure Put_Line (
       Item    : in     boolean ) is
     ----------------------------------------------------------------------
     begin
       Put_Line ( boolean'image ( Item ) );
     end Put_Line;

     procedure Put (
       Item    : in     boolean ) is
     ----------------------------------------------------------------------
     begin
       Put ( boolean'image ( Item ) );
     end Put;

     function Ask_Char (
       Prompt  : in     string  := "";
       Default : in     character := ASCII.Nul;
       Answers : in     string    := "";
       Upcased : in     boolean   := true )
       return character is
     ----------------------------------------------------------------------
       Line : string ( 1..2 );
       Last : natural;
       Temp : character;
       Is_Answer : boolean;
     begin
       loop
      Put ( Prompt );
      if Answers /= "" then
	Put ( '(' );
	for Answer in Answers'range loop
	     Put ( Answers ( Answer ) );
	     if Answer /= Answers'last then
	       Put ( '/' );
	     end if;
	end loop;
	Put ( ')' );
	if Default /= ASCII.Nul then
	     Put ( ' ' );
	else
	     Put ( ":  " );
	end if;
      end if;
      if Default /= ASCII.Nul then
	Put ( "[" & Default & "]:  " );
      end if;
      Get_Line ( Line, Last );
      if Last = 0 then
	Temp := Default;
      else
	Temp := Line ( 1 );
      end if;
      if Upcased then
	if ( Temp >= 'a' ) and ( Temp <= 'z' ) then
	     Temp := character'val ( character'pos ( Temp ) - 32 );
	end if;
      end if;
      exit when ( Answers = "" );
      for index in Answers'range loop
	Is_Answer := Temp = Answers ( index );
	exit when Is_Answer;
      end loop;
      exit when Is_Answer;
       end loop;
       return Temp;
     end Ask_Char;

     ----------------------------------------------------------------------
     -- String
     ----------------------------------------------------------------------

     procedure Ask (
       Item    :    out string;
       Prompt  : in     string := "";
       Default : in     string := "" ) is
     ----------------------------------------------------------------------
       Temp : string ( Item'first..( Item'last + 1 ) );
       Last : natural;
     begin
       Put ( Prompt );
       if Default /= "" then
	 Put ( "[" & Default & "]:  " );
       end if;
       Get_Line ( Temp, Last );
       Item ( 1..Last ) := Temp ( 1..Last );
       if Last = 0 then
	 Item ( Default'range ) := Default;
	 Last := Default'last;
       end if;
       for index in ( Last + 1 )..Item'last loop
	 Item ( index ) := ASCII.Nul;
       end loop;
     end Ask;

     procedure Flush is
     ----------------------------------------------------------------------
     -- Flushes input.
     ----------------------------------------------------------------------
     Item : string ( 1..80 );
       Last : natural;
     begin
       Get_Line ( Item, Last );
     end Flush;

     procedure Pause (
       Prompt : in string := "Please press ENTER to continue..." ) is
     ----------------------------------------------------------------------
       Item : string ( 1..1 );
       Last : natural;
     begin
       Put ( Prompt );
       Get_Line ( Item, Last );
     end Pause;

     procedure Clear_Screen (
       Cursor_Move : boolean := true ) is
     ----------------------------------------------------------------------
     begin
       TTY.Clear_Screen;
       if Cursor_Move then
	 Cursor.Move ( 0, 0 );
       end if;
     end Clear_Screen;

     ----------------------------------------------------------------------
     ----------------------------------------------------------------------
     end ConsAKD;
