CVS difference for ais/ai-00301.txt

Differences between 1.10 and version 1.11
Log of other versions for file ais/ai-00301.txt

--- ais/ai-00301.txt	2004/01/23 04:59:26	1.10
+++ ais/ai-00301.txt	2004/05/29 00:38:37	1.11
@@ -1,4 +1,4 @@
-!standard A.4.3(8)                                   04-01-13  AI95-00301/07
+!standard A.4.3(8)                                   04-05-25  AI95-00301/08
 !standard A.4.3(56)
 !standard A.4.3(58)
 !standard A.4.3(60)
@@ -29,8 +29,9 @@
 
 Additional Index functions are added to Ada.Strings.Fixed, Ada.Strings.Bounded,
 and Ada.Strings.Unbounded with From parameters so that partial string searches
-can be made. Additional operations are added to Ada.Strings.Unbounded and
-Ada.Strings.Bounded. A Get_Line function is added to Text_IO. I/O operations on
+can be made. Additional subprograms are added to Ada.Strings.Unbounded and
+Ada.Strings.Bounded to avoid unecessary conversions to and from other types.
+A Get_Line function is added to Text_IO. I/O operations on
 unbounded strings are provided in a new child package of Ada.Text_IO.
 
 !problem
@@ -68,56 +69,69 @@
 And finally, I/O operations with Unbounded_Strings as parameters are not
 provided. These are commonly needed, and (in the case of Get_Line) are not
 trivial to write. A child package similar to the ones provided for Complex
-types is valuable.
+types is valuable. Function Get_Line is added to Text_IO as well for
+consistency.
 
 !proposal
 
-(See wording.)
+Additional subprograms and a package are added as follows.
 
+Three functions Index and a function Index_Non_Blank with an additional
+parameter  From are added to Strings.Fixed, Strings.Bounded and
+Strings.Unbounded.
+
+A procedure Set_Bounded_String and procedure and function Bounded_Slice are
+added to Strings.Bounded. A procedure Set_Unbounded_String and procedure and
+function Unbounded_Slice are similarly added to Strings.Unbounded.
+
+Two functions Get_Line are added to Text_IO.
+
+A package Text_IO.Unbounded_IO is added.
+
 !wording
 
 Add after A.4.3(8):
 
-function Index (Source : in String;
+function Index (Source  : in String;
                 Pattern : in String;
-                From : in Positive;
-                Going : in Direction := Forward;
+                From    : in Positive;
+                Going   : in Direction := Forward;
                 Mapping : in Maps.Character_Mapping := Maps.Identity)
    return Natural;
 
-function Index (Source : in String;
+function Index (Source  : in String;
                 Pattern : in String;
-                From : in Positive;
-                Going : in Direction := Forward;
+                From    : in Positive;
+                Going   : in Direction := Forward;
                 Mapping : in Maps.Character_Mapping_Function)
    return Natural;
 
-function Index (Source : in String;
-                Set : in Maps.Character_Set;
-                From : in Positive;
-                Test : in Membership := Inside;
-                Going : in Direction := Forward)
+function Index (Source  : in String;
+                Set     : in Maps.Character_Set;
+                From    : in Positive;
+                Test    : in Membership := Inside;
+                Going   : in Direction := Forward)
    return Natural;
 
 function Index_Non_Blank (Source : in String;
-                          From : in Positive;
-                          Going : in Direction := Forward)
+                          From   : in Positive;
+                          Going  : in Direction := Forward)
    return Natural;
 
 
 Add after A.4.3(56):
 
-function Index (Source : in String;
+function Index (Source  : in String;
                 Pattern : in String;
-                From : in Positive;
-                Going : in Direction := Forward;
+                From    : in Positive;
+                Going   : in Direction := Forward;
                 Mapping : in Maps.Character_Mapping := Maps.Identity)
    return Natural;
 
-function Index (Source : in String;
+function Index (Source  : in String;
                 Pattern : in String;
-                From : in Positive;
-                Going : in Direction := Forward;
+                From    : in Positive;
+                Going   : in Direction := Forward;
                 Mapping : in Maps.Character_Mapping_Function)
    return Natural;
 
@@ -147,10 +161,10 @@
       Index (Source, Pattern, Source'Last, Backward, Mapping);
 
 function Index (Source : in String;
-                Set : in Maps.Character_Set;
-                From : in Positive;
-                Test : in Membership := Inside;
-                Going : in Direction := Forward)
+                Set    : in Maps.Character_Set;
+                From   : in Positive;
+                Test   : in Membership := Inside;
+                Going  : in Direction := Forward)
    return Natural;
 
    Index searches for the first or last occurrence of any of a set of
@@ -158,7 +172,7 @@
    characters (when Test=Outside). It returns the smallest index I >= From (if
    Going=Forward) or the largest index I <= From (if Going=Backward) such that
    Source(I) satisfies the Test condition with respect to Set; it returns 0 if
-   there is no such Character in Source.
+   there is no such character in Source.
 
 Replace A.4.3(60) by:
 
@@ -168,8 +182,8 @@
       Index (Source, Set, Source'Last, Test, Backward);
 
 function Index_Non_Blank (Source : in String;
-                          From : in Positive;
-                          Going : in Direction := Forward)
+                          From   : in Positive;
+                          Going  : in Direction := Forward)
    return Natural;
 
     Returns Index (Source, Maps.To_Set(Space), From, Outside, Going);
@@ -189,7 +203,7 @@
     Low    : in Positive;
     High   : in Natural;
     Drop   : in Truncation := Error)
-       return Unbounded_String;
+       return Bounded_String;
 
 procedure Bounded_Slice
    (Source : in     Bounded_String;
@@ -198,39 +212,41 @@
     High   : in     Natural;
     Drop   : in     Truncation := Error)
 
-Add after A.4.4(43):
+Replace A.4.4(43) with all of th following:
 
-function Index (Source : in Bounded_String;
+-- Search subprograms:
+
+function Index (Source  : in Bounded_String;
                 Pattern : in String;
-                From : in Positive;
-                Going : in Direction := Forward;
+                From    : in Positive;
+                Going   : in Direction := Forward;
                 Mapping : in Maps.Character_Mapping := Maps.Identity)
    return Natural;
 
-function Index (Source : in Bounded_String;
+function Index (Source  : in Bounded_String;
                 Pattern : in String;
-                From : in Positive;
-                Going : in Direction := Forward;
+                From    : in Positive;
+                Going   : in Direction := Forward;
                 Mapping : in Maps.Character_Mapping_Function)
    return Natural;
 
-function Index (Source : in Bounded_String;
-                Set : in Maps.Character_Set;
-                From : in Positive;
-                Test : in Membership := Inside;
-                Going : in Direction := Forward)
+function Index (Source  : in Bounded_String;
+                Set     : in Maps.Character_Set;
+                From    : in Positive;
+                Test    : in Membership := Inside;
+                Going   : in Direction := Forward)
    return Natural;
 
 function Index_Non_Blank (Source : in Bounded_String;
-                          From : in Positive;
-                          Going : in Direction := Forward)
+                          From   : in Positive;
+                          Going  : in Direction := Forward)
    return Natural;
 
 Add after A.4.4(92):
 
 procedure Set_Bounded_String
    (Target :    out Bounded_String;
-    Source : in     String);
+    Source : in     String;
     Drop   : in     Truncation := Error);
 
     Equivalent to Target := To_Bounded_String (Source, Drop);
@@ -261,7 +277,7 @@
 
 procedure Set_Unbounded_String
    (Target :    out Unbounded_String;
-    Source : in     String);
+    Source : in     String;
     Drop   : in     Truncation := Error);
 
 Add after A.4.5(22):
@@ -282,41 +298,41 @@
 
 Add after A.4.5(38):
 
-function Index (Source : in Unbounded_String;
+function Index (Source  : in Unbounded_String;
                 Pattern : in String;
-                From : in Positive;
-                Going : in Direction := Forward;
+                From    : in Positive;
+                Going   : in Direction := Forward;
                 Mapping : in Maps.Character_Mapping := Maps.Identity)
    return Natural;
 
-function Index (Source : in Unbounded_String;
+function Index (Source  : in Unbounded_String;
                 Pattern : in String;
-                From : in Positive;
-                Going : in Direction := Forward;
+                From    : in Positive;
+                Going   : in Direction := Forward;
                 Mapping : in Maps.Character_Mapping_Function)
    return Natural;
 
-function Index (Source : in Unbounded_String;
-                Set : in Maps.Character_Set;
-                From : in Positive;
-                Test : in Membership := Inside;
-                Going : in Direction := Forward)
+function Index (Source  : in Unbounded_String;
+                Set     : in Maps.Character_Set;
+                From    : in Positive;
+                Test    : in Membership := Inside;
+                Going   : in Direction := Forward)
    return Natural;
 
 function Index_Non_Blank (Source : in Unbounded_String;
-                          From : in Positive;
-                          Going : in Direction := Forward)
+                          From   : in Positive;
+                          Going  : in Direction := Forward)
    return Natural;
 
 Add after A.4.5(79):
 
-The procedure Set_Unbounded_String set Target to an Unbounded_String that
+The procedure Set_Unbounded_String sets Target to an Unbounded_String that
 represents Source.
 
 Add after A.4.5(82):
 
 The function Unbounded_Slice returns the slice at positions Low through High in
-the string represented by Source as a Unbounded_String. The procedure
+the string represented by Source as an Unbounded_String. The procedure
 Unbounded_Slice sets Target to the Unbounded_String representing the slice at
 positions Low through High in the string represented by Source. Both routines
 propagate Index_Error if Low > Length(Source)+1 or High > Length(Source).
@@ -383,6 +399,8 @@
 
 end Ada.Text_IO.Unbounded_IO;
 
+For an item of type Unbounded_String, the following subprograms are provided:
+
 procedure Put
   (File : in File_Type;
    Item : in Strings.Unbounded.Unbounded_String);
@@ -467,8 +485,8 @@
                     From : in Positive := 1) return Natural;
 
 This has the advantage of not adding new routines. However, there are several
-serious drawbacks. First, this is significantly more incompatable than just
-adding new routines. Adding a parameter like this affects renames and
+serious drawbacks. First, this is significantly more incompatible than just
+adding new routines. Adding a parameter like this affects renamings and
 overridings. One compiler vendor notes that they've seen derivations of
 Unbounded_Strings in their customer's code.
 
@@ -587,30 +605,30 @@
 @dinsa
 @xcode<-- @ft<@i<Search subprograms>>>
 @dinss
-@xcode<   @b<function> Index (Source : @b<in> String;
+@xcode<   @b<function> Index (Source  : @b<in> String;
                    Pattern : @b<in> String;
-                   From : @b<in> Positive;
-                   Going : @b<in> Direction := Forward;
+                   From    : @b<in> Positive;
+                   Going   : @b<in> Direction := Forward;
                    Mapping : @b<in> Maps.Character_Mapping := Maps.Identity)
       @b<return> Natural;
 
-   @b<function> Index (Source : @b<in> String;
+   @b<function> Index (Source  : @b<in> String;
                    Pattern : @b<in> String;
-                   From : @b<in> Positive;
-                   Going : @b<in> Direction := Forward;
+                   From    : @b<in> Positive;
+                   Going   : @b<in> Direction := Forward;
                    Mapping : @b<in> Maps.Character_Mapping_Function)
       @b<return> Natural;
 
-   @b<function> Index (Source : @b<in> String;
-                   Set : @b<in> Maps.Character_Set;
-                   From : @b<in> Positive;
-                   Test : @b<in> Membership := Inside;
-                   Going : @b<in> Direction := Forward)
+   @b<function> Index (Source  : @b<in> String;
+                   Set     : @b<in> Maps.Character_Set;
+                   From    : @b<in> Positive;
+                   Test    : @b<in> Membership := Inside;
+                   Going   : @b<in> Direction := Forward)
       @b<return> Natural;
 
    @b<function> Index_Non_Blank (Source : @b<in> String;
-                             From : @b<in> Positive;
-                             Going : @b<in> Direction := Forward)
+                             From   : @b<in> Positive;
+                             Going  : @b<in> Direction := Forward)
       @b<return> Natural;>
 
 !corrigendum A.4.3(56)
@@ -618,17 +636,17 @@
 @dinsa
 @xinbull<Otherwise, Length_Error is propagated.>
 @dinss
-@xcode<@b<function> Index (Source : @b<in> String;
+@xcode<@b<function> Index (Source  : @b<in> String;
                 Pattern : @b<in> String;
-                From : @b<in> Positive;
-                Going : @b<in> Direction := Forward;
+                From    : @b<in> Positive;
+                Going   : @b<in> Direction := Forward;
                 Mapping : @b<in> Maps.Character_Mapping := Maps.Identity)
    @b<return> Natural;
 
-@b<function> Index (Source : @b<in> String;
+@b<function> Index (Source  : @b<in> String;
                 Pattern : @b<in> String;
-                From : @b<in> Positive;
-                Going : @b<in> Direction := Forward;
+                From    : @b<in> Positive;
+                Going   : @b<in> Direction := Forward;
                 Mapping : @b<in> Maps.Character_Mapping_Function)
    @b<return> Natural;>
 
@@ -659,11 +677,11 @@
 @xindent<otherwise returns>
 @xcode<      Index (Source, Pattern, Source'Last, Backward, Mapping);>
 
-@xcode<@b<function> Index (Source : @b<in> String;
-                Set : @b<in> Maps.Character_Set;
-                From : @b<in> Positive;
-                Test : @b<in> Membership := Inside;
-                Going : @b<in> Direction := Forward)
+@xcode<@b<function> Index (Source  : @b<in> String;
+                Set     : @b<in> Maps.Character_Set;
+                From    : @b<in> Positive;
+                Test    : @b<in> Membership := Inside;
+                Going   : @b<in> Direction := Forward)
    @b<return> Natural;>
 
 @xindent<Index searches for the first or last occurrence of any of a set of
@@ -689,8 +707,8 @@
 @xcode<   Index (Source, Set, Source'Last, Test, Backward);>
 
 @xcode<@b<function> Index_Non_Blank (Source : @b<in> String;
-                          From : @b<in> Positive;
-                          Going : @b<in> Direction := Forward)
+                          From   : @b<in> Positive;
+                          Going  : @b<in> Direction := Forward)
    @b<return> Natural;>
 
 @xindent<Returns Index (Source, Maps.To_Set(Space), From, Outside, Going);>
@@ -703,7 +721,7 @@
 @dinss
 @xcode<      @b<procedure> Set_Bounded_String
          (Target :    @b<out> Bounded_String;
-          Source : @b<in>     String);
+          Source : @b<in>     String;
           Drop   : @b<in>     Truncation := Error);>
 
 !corrigendum A.4.4(28)
@@ -719,7 +737,7 @@
           Low    : @b<in> Positive;
           High   : @b<in> Natural;
           Drop   : @b<in> Truncation := Error)
-             @b<return> Unbounded_String;
+             @b<return> Bounded_String;
 
       @b<procedure> Bounded_Slice
          (Source : @b<in>     Bounded_String;
@@ -730,33 +748,35 @@
 
 !corrigendum A.4.4(43)
 
-@dinsa
-@xcode<   -- @ft<@i<Search subprograms>>>
-@dinss
-@xcode<      @b<function> Index (Source : @b<in> Bounded_String;
+@drepl
+@xcode<   -- @ft<@i<Search functions>>>
+@dby
+@xcode<   -- @ft<@i<Search subprograms>>
+
+      @b<function> Index (Source  : @b<in> Bounded_String;
                       Pattern : @b<in> String;
-                      From : @b<in> Positive;
-                      Going : @b<in> Direction := Forward;
+                      From    : @b<in> Positive;
+                      Going   : @b<in> Direction := Forward;
                       Mapping : @b<in> Maps.Character_Mapping := Maps.Identity)
          @b<return> Natural;
 
-      @b<function> Index (Source : @b<in> Bounded_String;
+      @b<function> Index (Source  : @b<in> Bounded_String;
                       Pattern : @b<in> String;
-                      From : @b<in> Positive;
-                      Going : @b<in> Direction := Forward;
+                      From    : @b<in> Positive;
+                      Going   : @b<in> Direction := Forward;
                       Mapping : @b<in> Maps.Character_Mapping_Function)
          @b<return> Natural;
 
-      @b<function> Index (Source : @b<in> Bounded_String;
-                      Set : @b<in> Maps.Character_Set;
-                      From : @b<in> Positive;
-                      Test : @b<in> Membership := Inside;
-                      Going : @b<in> Direction := Forward)
+      @b<function> Index (Source  : @b<in> Bounded_String;
+                      Set     : @b<in> Maps.Character_Set;
+                      From    : @b<in> Positive;
+                      Test    : @b<in> Membership := Inside;
+                      Going   : @b<in> Direction := Forward)
          @b<return> Natural;
 
       @b<function> Index_Non_Blank (Source : @b<in> Bounded_String;
-                                From : @b<in> Positive;
-                                Going : @b<in> Direction := Forward)
+                                From   : @b<in> Positive;
+                                Going  : @b<in> Direction := Forward)
          @b<return> Natural;>
 
 !corrigendum A.4.4(92)
@@ -806,7 +826,7 @@
 @dinss
 @xcode<   @b<procedure> Set_Unbounded_String
       (Target :    @b<out> Unbounded_String;
-       Source : @b<in>     String);
+       Source : @b<in>     String;
        Drop   : @b<in>     Truncation := Error);>
 
 !corrigendum A.4.5(22)
@@ -836,30 +856,30 @@
 @dinsa
 @xcode<-- @ft<@i<Search subprograms>>>
 @dinss
-@xcode<   @b<function> Index (Source : @b<in> Unbounded_String;
+@xcode<   @b<function> Index (Source  : @b<in> Unbounded_String;
                    Pattern : @b<in> String;
-                   From : @b<in> Positive;
-                   Going : @b<in> Direction := Forward;
+                   From    : @b<in> Positive;
+                   Going   : @b<in> Direction := Forward;
                    Mapping : @b<in> Maps.Character_Mapping := Maps.Identity)
       @b<return> Natural;
 
-   @b<function> Index (Source : @b<in> Unbounded_String;
+   @b<function> Index (Source  : @b<in> Unbounded_String;
                    Pattern : @b<in> String;
-                   From : @b<in> Positive;
-                   Going : @b<in> Direction := Forward;
+                   From    : @b<in> Positive;
+                   Going   : @b<in> Direction := Forward;
                    Mapping : @b<in> Maps.Character_Mapping_Function)
       @b<return> Natural;
 
-   @b<function> Index (Source : @b<in> Unbounded_String;
-                   Set : @b<in> Maps.Character_Set;
-                   From : @b<in> Positive;
-                   Test : @b<in> Membership := Inside;
-                   Going : @b<in> Direction := Forward)
+   @b<function> Index (Source  : @b<in> Unbounded_String;
+                   Set     : @b<in> Maps.Character_Set;
+                   From    : @b<in> Positive;
+                   Test    : @b<in> Membership := Inside;
+                   Going    : @b<in> Direction := Forward)
       @b<return> Natural;
 
    @b<function> Index_Non_Blank (Source : @b<in> Unbounded_String;
-                             From : @b<in> Positive;
-                             Going : @b<in> Direction := Forward)
+                             From   : @b<in> Positive;
+                             Going  : @b<in> Direction := Forward)
       @b<return> Natural;>
 
 !corrigendum A.4.5(79)
@@ -867,7 +887,7 @@
 @dinsa
 @xbullet<If U is an Unbounded_String, then To_Unbounded_String(To_String(U)) = U.>
 @dinst
-The procedure Set_Unbounded_String set Target to an Unbounded_String that
+The procedure Set_Unbounded_String sets Target to an Unbounded_String that
 represents Source.
 
 !corrigendum A.4.5(82)
@@ -877,7 +897,7 @@
 corresponding bounded-length string subprograms.
 @dinst
 The function Unbounded_Slice returns the slice at positions Low through High in
-the string represented by Source as a Unbounded_String. The procedure
+the string represented by Source as an Unbounded_String. The procedure
 Unbounded_Slice sets Target to the Unbounded_String representing the slice at
 positions Low through High in the string represented by Source. Both routines
 propagate Index_Error if Low @> Length(Source)+1 or High @> Length(Source).
@@ -1378,7 +1398,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---    $Revision: 1.10 $                              --
+--                            $Revision: 1.11 $                              --
 --                                                                          --
 --          Copyright (C) 1992-1998, Free Software Foundation, Inc.         --
 --                                                                          --

Questions? Ask the ACAA Technical Agent