!standard A.10.12(1) 05-04-10 AI95-00428/01 !class amendment 05-04-10 !status work item 05-04-10 !status received 05-04-10 !priority High !difficulty Easy !subject Input-output for bounded strings !summary A package for the input and output of bounded strings is added as a generic child of Text_IO. !problem AI-301 adds a package for the input-output of unbounded strings. It claims that it is hard for bounded strings but it was probably the case that the ARG was too idle to do it. Probably because it was too hot in Vienna. The asymmetry of providing the facility for unbounded strings but not for bounded strings is offensive. !proposal (See summary.) !wording Add a new clause: A.10.12 Input-output for Bounded Strings The package Text_IO.Bounded_IO provides input-output in human-readable form for Bounded_Strings. Static Semantics The generic library package Text_IO.Bounded_IO has the following declaration: with Ada.Strings.Bounded.Generic_Bounded_Length; generic with package Bounded is new Ada.Strings.Bounded.Generic_Bounded_Length (<>); package Ada.Text_IO.Bounded_IO is procedure Put (File : in File_Type; Item : in Bounded.Bounded_String); procedure Put (Item : in Bounded.Bounded_String); procedure Put_Line (File : in Text_IO.File_Type; Item : in Bounded.Bounded_String); procedure Put_Line (Item : in Bounded.Bounded_String); function Get_Line (File : in File_Type) return Bounded.Bounded_String; function Get_Line return Bounded.Bounded_String; procedure Get_Line (File : in File_Type; Item : out Bounded.Bounded_String); procedure Get_Line (Item : out Bounded.Bounded_String); end Ada.Text_IO.Bounded_IO; For an item of type Bounded_String exported from a package Bounded being an instantiation of Strings.Bounded.Generic_Bounded_Length, the following subprograms are provided: procedure Put (File : in File_Type; Item : in Bounded.Bounded_String); Equivalent to Text_IO.Put (File, Bounded.To_String(Item)); procedure Put (Item : in Bounded.Bounded_String); Equivalent to Text_IO.Put (Bounded.To_String(Item)); procedure Put_Line (File : in Text_IO.File_Type; Item : in Bounded.Bounded_String); Equivalent to Text_IO.Put_Line (File, Bounded.To_String(Item)); procedure Put_Line (Item : in Bounded.Bounded_String); Equivalent to Text_IO.Put_Line (Bounded.To_String(Item)); function Get_Line (File : in File_Type) return Bounded.Bounded_String; Returns Bounded.To_Bounded_String(Text_IO.Get_Line(File)); function Get_Line return Bounded.Bounded_String; Returns Bounded.To_Bounded_String(Text_IO.Get_Line); procedure Get_Line (File : in File_Type; Item : out Bounded.Bounded_String); Equivalent to Item := Get_Line (File); procedure Get_Line (Item : out Bounded.Bounded_String); Equivalent to Item := Get_Line; Add after A.11(4): The specification of package Wide_Text_IO.Wide_Bounded_IO is the same as that for Text_IO.Bounded_IO, except that any occurrence of Bounded_String is replaced by Wide_Bounded_String, and any occurrence of package Bounded is replaced by Wide_Bounded. The specification of package Wide_Wide_Text_IO.Wide_Wide_Bounded_IO is the same as that for Text_IO.Bounded_IO, except that any occurrence of Bounded_String is replaced by Wide_Wide_Bounded_String, and any occurrence of package Bounded is replaced by Wide_Wide_Bounded. Amend the AARM notes immediately following accordingly and change their number to A.11(5.a) etc. !discussion This follows the pattern of Unbounded_IO with obvious changes because of the genericity of bounded strings. Poor Old John was asked to write this as a punishment for mentioning that it was missing from Ada 2005 in the rationale. !example (See discussion.) --!corrigendum !ACATS test !appendix *************************************************************