--  Ada.Text_IO.Unbounded_IO (RM A.10.12): Text_IO's Put, Put_Line and Get_Line of
--  Unbounded_String values, with Text_IO's contracts for the String forms.
with Ada.Strings.Unbounded;

package Ada.Text_IO.Unbounded_IO is
   procedure Put (File : File_Type; Item : Strings.Unbounded.Unbounded_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 : Strings.Unbounded.Unbounded_String)
     with Global => (In_Out => File_System);

   procedure Put_Line (File : File_Type; Item : Strings.Unbounded.Unbounded_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 : Strings.Unbounded.Unbounded_String)
     with Global => (In_Out => File_System);

   --  the next line of any length (a function with side effects, as Text_IO's Get_Line, so a
   --  line must be left to read)
   function Get_Line (File : File_Type) return Strings.Unbounded.Unbounded_String
     with Side_Effects, Pre => Is_Open (File) and then Mode (File) = In_File and then not End_Of_File (File),
          Global => (In_Out => File_System);

   function Get_Line return Strings.Unbounded.Unbounded_String
     with Side_Effects, Pre => not End_Of_File, Global => (In_Out => File_System);

   procedure Get_Line (File : File_Type; Item : out Strings.Unbounded.Unbounded_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);

   procedure Get_Line (Item : out Strings.Unbounded.Unbounded_String)
     with Pre => not End_Of_File,
          Global => (In_Out => File_System);
end Ada.Text_IO.Unbounded_IO;
