--  Ada.Text_IO.Bounded_IO (RM A.10.11): Text_IO's Put, Put_Line and Get_Line of an instance's
--  Bounded_String values, with Text_IO's contracts for the String forms. Get_Line of a line
--  longer than the bound raises Ada.Strings.Length_Error, as the RM's To_Bounded_String does;
--  so Get_Line is the procedure only, as a Verada function propagates no exception.
with Ada.Strings.Bounded;

generic
   with package Bounded is new Ada.Strings.Bounded.Generic_Bounded_Length (<>);
package Ada.Text_IO.Bounded_IO is
   procedure Put (File : File_Type; Item : Bounded.Bounded_String)
     with Global => (In_Out => File_System),
          Exceptional_Cases => (Status_Error => not Is_Open (File),
                                Mode_Error => Is_Open (File) and then Mode (File) = In_File);

   procedure Put (Item : Bounded.Bounded_String)
     with Global => (In_Out => File_System);

   procedure Put_Line (File : File_Type; Item : Bounded.Bounded_String)
     with Global => (In_Out => File_System),
          Exceptional_Cases => (Status_Error => not Is_Open (File),
                                Mode_Error => Is_Open (File) and then Mode (File) = In_File);

   procedure Put_Line (Item : Bounded.Bounded_String)
     with Global => (In_Out => File_System);

   procedure Get_Line (File : File_Type; Item : out Bounded.Bounded_String)
     with Pre => (if Is_Open (File) and then Mode (File) = In_File then not End_Of_File (File)),
          Global => (In_Out => File_System),
          Exceptional_Cases => (Status_Error => not Is_Open (File),
                                Mode_Error => Is_Open (File) and then Mode (File) /= In_File,
                                Ada.Strings.Length_Error => True);

   procedure Get_Line (Item : out Bounded.Bounded_String)
     with Pre => not End_Of_File,
          Global => (In_Out => File_System),
          Exceptional_Cases => (Ada.Strings.Length_Error => True);
end Ada.Text_IO.Bounded_IO;
