1. with Ada.Text_IO, Ada.Exceptions; 
  2.  
  3. package body Command_Line_Generic is 
  4.  
  5.    use Ada.Text_IO, Ada.Exceptions; 
  6.  
  7.    package Command_Type_Io is new Enumeration_IO (Command_Type); 
  8.    use Command_Type_Io; 
  9.  
  10.    procedure Get_Command is 
  11.       Command          : Command_Type := Command_Type'first; 
  12.       Continue_Reading : Boolean      := True; 
  13.    begin 
  14.       Main : 
  15.       loop 
  16.          for index in Command_Type'range loop 
  17.             Put (index); 
  18.             New_Line; 
  19.          end loop; 
  20.          New_Line; 
  21.  
  22.          Read_Block : declare 
  23.             Input_Text : String (1 .. 200) := (others => ' '); 
  24.             Length     : Integer           := 0; 
  25.          begin 
  26.             Put ("Enter: "); 
  27.             Flush; 
  28.             Get_Line (Input_Text, Length); 
  29.             New_Line; 
  30.             Command          := Command_Type'value (Input_Text (1 .. Length)); 
  31.             Continue_Reading := Handle_Command (Command); 
  32.          exception 
  33.             when Constraint_Error => 
  34.                Put_Line ("Wrong Input!"); 
  35.                New_Line; 
  36.  
  37.             when others => 
  38.                raise; 
  39.          end Read_Block; 
  40.  
  41.          exit Main when Continue_Reading = False; 
  42.       end loop Main; 
  43.  
  44.    exception 
  45.       when Error : others => 
  46.          Put_Line ("Exception_Name:        " & Ada.Exceptions.Exception_Name (Error)); 
  47.          Put_Line ("Exception_Message:     " & Ada.Exceptions.Exception_Message (Error)); 
  48.          Put_Line ("Exception_Information: " & Ada.Exceptions.Exception_Information (Error)); 
  49.    end Get_Command; 
  50.  
  51. end Command_Line_Generic;