CVS difference for ais/ai-00433.txt

Differences between 1.2 and version 1.3
Log of other versions for file ais/ai-00433.txt

--- ais/ai-00433.txt	2005/06/16 23:47:46	1.2
+++ ais/ai-00433.txt	2005/08/05 04:38:42	1.3
@@ -1,4 +1,4 @@
-!standard 1.1.4(9)                                    05-05-19  AI95-00433/02
+!standard 1.1.4(9)                                    05-07-09  AI95-00433/03
 !standard 2.3(8)
 !standard 2.5(5)
 !standard 2.6(9)
@@ -8,6 +8,7 @@
 !standard 3.3.1(29)
 !standard 3.3.1(31)
 !standard 3.3.1(33)
+!standard 3.3.2(10)
 !standard 3.6(30)
 !standard 3.7(37)
 !standard 3.9.4(1)
@@ -28,18 +29,19 @@
 !standard 9.11(10)
 !standard 10.1.2(8)
 !standard 11.3(6)
+!standard 11.4.3(2)
 !standard 11.4.3(6)
 !standard 12.5.5(5)
 !standard 12.6(18)
 !standard 12.7(11)
 !class amendment 05-05-18
 !status Amendment 200Y 05-05-18
-!comment This AI is in the Amendment, but not yet approved.
+!status ARG Approved 12-0-0  05-06-19
 !status work item 05-05-18
 !status received 05-05-18
 !priority High
 !difficulty Easy
-!subject Examples in the RM
+!subject Examples in the Standard
 
 !summary
 
@@ -209,7 +211,21 @@
 Tolerance : @b<constant> Real := Dispersion(1.15);
 Hello_Msg : @b<constant access> String := Hello'Access; --@ft<@i< see 3.10.2>>>
 
+!corrigendum 3.3.2(10)
+!comment This is just a correction to an existing example.
 
+@drepl
+@xcode<Max           : @b<constant> := 500;                   --@ft<@i< an integer number>>
+Max_Line_Size : @b<constant> := Max/6                  --@ft<@i< the integer 83>>
+Power_16      : @b<constant> := 2**16;                 --@ft<@i< the integer 65_536>>
+One, Un, Eins : @b<constant> := 1;                     --@ft<@i< three different names for 1>>>
+@dby
+@xcode<Max           : @b<constant> := 500;                   --@ft<@i< an integer number>>
+Max_Line_Size : @b<constant> := Max/6;                 --@ft<@i< the integer 83>>
+Power_16      : @b<constant> := 2**16;                 --@ft<@i< the integer 65_536>>
+One, Un, Eins : @b<constant> := 1;                     --@ft<@i< three different names for 1>>>
+
+
 !corrigendum 3.6(30)
 
 @drepl
@@ -261,11 +277,11 @@
 @dinss
 @i<@s8<Examples>>
 
-@i<Example of limited interface and synchronized interface extending it:>
+@i<Example of a limited interface and a synchronized interface extending it:>
 
 @xcode<@b<type> Queue @b<is limited interface>;
-@b<procedure> Append(Q : @b<in out> Queue; Element : @b<in> Person_Name) @b<is abstract>;
-@b<procedure> Remove_First(Q : @b<in out> Queue; Element : @b<out> Person_Name) @b<is abstract>;
+@b<procedure> Append(Q : @b<in out> Queue; Person : @b<in> Person_Name) @b<is abstract>;
+@b<procedure> Remove_First(Q : @b<in out> Queue; Person : @b<out> Person_Name) @b<is abstract>;
 @b<function> Cur_Count(Q : @b<in> Queue) @b<return> Natural @b<is abstract>;
 @b<function> Max_Count(Q : @b<in> Queue) @b<return> Natural @b<is abstract>;
 -- @ft<@i<See 3.10.1 for Person_Name.>>
@@ -275,19 +291,19 @@
 --@ft<@i< Remove_First raises Queue_Error if Count(Q) = 0>>
 
 @b<type> Synchronized_Queue @b<is synchronized interface and> Queue; --@ft<@i< see 9.11>>
-@b<procedure> Append_Wait(Q : @b<in out> Queue; Element : @b<in> Person_Name) @b<is abstract>;
-@b<procedure> Remove_First_Wait(Q : @b<in out> Queue; Element : @b<out> Person_Name) @b<is abstract>;
+@b<procedure> Append_Wait(Q : @b<in out> Synchronized_Queue; Person : @b<in> Person_Name) @b<is abstract>;
+@b<procedure> Remove_First_Wait(Q : @b<in out> Synchronized_Queue; Person : @b<out> Person_Name) @b<is abstract>;
 
 ...
 
-@b<procedure> Transfer(From : @b<in out> Queue'Class;
-                   To : @b<in out> Queue'Class;
-                   Number : @b<in> Natural := 1) @b<is>
-   Element : Person_Name_Name;
+@b<procedure> Transfer(From   : @b<in out> Queue'Class;
+                   To     : @b<in out> Queue'Class;
+                   Number : @b<in>     Natural := 1) @b<is>
+   Person : Person_Name;
 @b<begin>
    @b<for> I @b<in> 1..Number @b<loop>
-      Remove_First(From, Element);
-      Append(To, Element);
+      Remove_First(From, Person);
+      Append(To, Person);
    @b<end loop>;
 @b<end> Transfer;>
 
@@ -299,24 +315,24 @@
 operation, Transfer is also shown. Every non-abstract extension
 of Queue must provide implementations for at least its four
 dispatching operations, as they are abstract. Any object of a type
-derived from Queue may be passed to Transfer, as either the From
+derived from Queue may be passed to Transfer as either the From
 or the To operand. The two operands need not be of the same type
 in any given call.
 
 The Synchronized_Queue interface inherits the four dispatching
-operations from Queue, and adds two additional dispatching
+operations from Queue and adds two additional dispatching
 operations, which wait if necessary rather than raising the
 Queue_Error exception. This synchronized interface may only
 be implemented by a task or protected type, and as such
 ensures safe concurrent access.
 
-@i<Example use of an interface:>
+@i<Example use of the interface:>
 
 @b<type> Fast_Food_Queue @b<is new> Queue @b<with record> ...;
-@b<procedure> Append (Q : @b<in out> Fast_Food_Queue; Element : @b<in> Person_Name);
-@b<procedure> Remove_First (Q : @b<in out> Fast_Food_Queue; Element : @b<in> Person_Name);
-@b<function> Cur_Count (Q : @b<in> Fast_Food_Queue) @b<return> Natural;
-@b<function> Max_Count (Q : @b<in> Fast_Food_Queue) @b<return> Natural;
+@b<procedure> Append(Q : @b<in out> Fast_Food_Queue; Person : @b<in> Person_Name);
+@b<procedure> Remove_First(Q : @b<in out> Fast_Food_Queue; Person : @b<in> Person_Name);
+@b<function> Cur_Count(Q : @b<in> Fast_Food_Queue) @b<return> Natural;
+@b<function> Max_Count(Q : @b<in> Fast_Food_Queue) @b<return> Natural;
 
 ...
 
@@ -330,7 +346,7 @@
 ...
 
 An interface such as Queue can be used directly as the parent of a new type
-(as shown here), or can be added when a new type is derived from another type.
+(as shown here), or can be used as a progenitor when a type is derived.
 In either case, the primitive operations of the interface are inherited. For
 Queue, the implementation of the four inherited routines must be provided.
 Inside the call of Transfer, dispatching calls to the implementations of
@@ -343,7 +359,7 @@
 @b<procedure> Write(Dev : @b<in> Serial_Device; C : @b<in>  Character) @b<is abstract>;>
 
 The Serial_Device interface has two dispatching operations
-which are intended to be implemented using task entries (see 9.1).
+which are intended to be implemented by task entries (see 9.1).
 
 
 !corrigendum 3.10(22)
@@ -406,8 +422,8 @@
 F : String(1 .. 1) := (1 =@> 'F');  --@ft<@i< a one component aggregate: same as "F">>>
 
 @dinss
-@i<Example of array aggregate with defaulted others choice, with applicable
-index constraint provided by an enclosing record aggregate:>
+@i<Example of an array aggregate with defaulted others choice and with an
+applicable index constraint provided by an enclosing record aggregate:>
 
 @xcode<Buffer'(Size =@> 50, Pos =@> 1, Value =@> String'('x', @b<others> =@> <@>))  --@ft<@i< see 3.7>>>
 
@@ -491,24 +507,25 @@
 @xcode<@b<type> Security_Queue @b<is new> Queue @b<with record> ...;>
 
 @xcode<@b<overriding>
-@b<procedure> Append (Q : @b<in out> Security_Queue; Element : @b<in> Person_Name);>
+@b<procedure> Append(Q : @b<in out> Security_Queue; Person : @b<in> Person_Name);>
 
 @xcode<@b<overriding>
-@b<procedure> Remove_First (Q : @b<in out> Security_Queue; Element : @b<in> Person_Name);>
+@b<procedure> Remove_First(Q : @b<in out> Security_Queue; Person : @b<in> Person_Name);>
 
 @xcode<@b<overriding>
-@b<function> Cur_Count (Q : @b<in> Security_Queue) @b<return> Natural;>
+@b<function> Cur_Count(Q : @b<in> Security_Queue) @b<return> Natural;>
 
 @xcode<@b<overriding>
-@b<function> Max_Count (Q : @b<in> Security_Queue) @b<return> Natural;>
+@b<function> Max_Count(Q : @b<in> Security_Queue) @b<return> Natural;>
 
 @xcode<@b<not overriding>
-@b<procedure> Arrest (Q : @b<in out> Security_Queue; Element : @b<in> Person_Name);>
+@b<procedure> Arrest(Q : @b<in out> Security_Queue; Person : @b<in> Person_Name);>
 
 The first four subprogram declarations guarantee that these subprograms will
-override the four subprograms inherited from the Queue interface. If a spelling
-error occurs in one of these declarations, an error will occur. Similarly, the
-declaration of Arrest guarantees that this is a new operation.
+override the four subprograms inherited from the Queue interface.
+A misspelling in one of these subprograms will be detected by the
+implementation. Conversely, the declaration of Arrest guarantees that this
+is a new operation.
 
 !corrigendum 9.1(24)
 
@@ -541,12 +558,12 @@
 
 @dby
 @xcode<@b<task body> Producer @b<is>
-   Element : Person_Name; --@ft<@i< see 3.10.1>>
+   Person : Person_Name; --@ft<@i< see 3.10.1>>
 @b<begin>
    @b<loop>
-      ... --@ft<@i<  produce the next person (for instance, simulating arrivals)>>
-      Buffer.Append_Wait(Element);
-      @b<exit when> Element = @b<null>;
+      ... --@ft<@i<  simulate arrival of the next customer)>>
+      Buffer.Append_Wait(Person);
+      @b<exit when> Person = @b<null>;
    @b<end loop>;
 @b<end> Producer;>
 
@@ -566,12 +583,12 @@
 
 @dby
 @xcode<@b<task body> Consumer @b<is>
-   Element : Person_Name;
+   Person : Person_Name;
 @b<begin
    loop>
-      Buffer.Remove_First_Wait(Element);
-      @b<exit when> Element = @b<null>;
-      ... --@ft<@i<  consume the person (for instance, simulating serving a customer)>>
+      Buffer.Remove_First_Wait(Person);
+      @b<exit when> Person = @b<null>;
+      ... --@ft<@i<  simulate serving a customer)>>
    @b<end loop>;
 @b<end> Consumer;>
 
@@ -585,13 +602,13 @@
 output character.
 
 @dby
-The buffer object contains an internal pool of people managed in a round-robin
-fashion. The pool has two indices, an In_Index denoting the space for the next
-input element (person) and an Out_Index denoting the space for the next output
-element.
+The buffer object contains an internal array of person names managed in a
+round-robin fashion. The array has two indices, an In_Index denoting the index
+for the next input person name and an Out_Index denoting the index for the next
+output person name.
 
 The Buffer is defined as an extension of the Synchronized_Queue
-interface (see 3.9.4), and as such, is promising to implement the abstraction
+interface (see 3.9.4), and as such promises to implement the abstraction
 defined by that interface. By doing so, the Buffer can be passed to the
 Transfer class-wide operation defined for objects of a type covered by
 Queue'Class.
@@ -611,12 +628,12 @@
 
 @dby
 @xcode<@b<protected> Buffer @b<is new> Synchronized_Queue @b<with>  --@ft<@i< see 3.9.4>>
-   @b<entry> Append_Wait(Element : @b<in> Person_Name);
-   @b<entry> Remove_First_Wait(Element : @b<out> Person_Name);
+   @b<entry> Append_Wait(Person : @b<in> Person_Name);
+   @b<entry> Remove_First_Wait(Person : @b<out> Person_Name);
    @b<function> Cur_Count @b<return> Natural;
    @b<function> Max_Count @b<return> Natural;
-   @b<procedure> Append(Element : @b<in> Person_Name);
-   @b<procedure> Remove_First(Element : @b<out> Person_Name);
+   @b<procedure> Append(Person : @b<in> Person_Name);
+   @b<procedure> Remove_First(Person : @b<out> Person_Name);
 @b<private>
    Pool      : Person_Name_Array(1 .. 100);
    Count     : Natural := 0;
@@ -638,20 +655,20 @@
 
 @dby
 @xcode<@b<protected body> Buffer @b<is>
-   @b<entry> Append_Wait(Element : @b<in> Person_Name)
+   @b<entry> Append_Wait(Person : @b<in> Person_Name)
       @b<when> Count < Pool'Length @b<is>
    @b<begin>
-      Append(Element);
+      Append(Person);
    @b<end> Append_Wait;
 
-   @b<procedure> Append(Element : @b<in> Person_Name) @b<is>
+   @b<procedure> Append(Person : @b<in> Person_Name) @b<is>
    @b<begin>
       @b<if> Count = Pool'Length @b<then>
          @b<raise> Queue_Error @b<with> "Buffer Full";  --@ft<@i< see 11.3>>
       @b<end if>;
-      Pool(In_Index) := Element;
-      In_Index := (In_Index @b<mod> Pool'Length) + 1;
-      Count    := Count + 1;
+      Pool(In_Index) := Person;
+      In_Index       := (In_Index @b<mod> Pool'Length) + 1;
+      Count          := Count + 1;
    @b<end> Append;>
 
 
@@ -668,18 +685,18 @@
 @b<end> Buffer;>
 
 @dby
-@xcode<   @b<entry> Remove_First_Wait(Element : @b<out> Person_Name)
+@xcode<   @b<entry> Remove_First_Wait(Person : @b<out> Person_Name)
       @b<when> Count @> 0 @b<is>
    @b<begin>
-      Remove_First(Element);
+      Remove_First(Person);
    @b<end> Remove_First_Wait;
 
-   @b<procedure> Remove_First(Element : @b<out> Person_Name) @b<is>
+   @b<procedure> Remove_First(Person : @b<out> Person_Name) @b<is>
    @b<begin>
       @b<if> Count = 0 @b<then>
          @b<raise> Queue_Error @b<with> "Buffer Empty"; --@ft<@i< see 11.3>>
       @b<end if>;
-      Element := Pool(Out_Index);
+      Person    := Pool(Out_Index);
       Out_Index := (Out_Index @b<mod> Pool'Length) + 1;
       Count     := Count - 1;
    @b<end> Remove_First;
@@ -707,6 +724,14 @@
 @dinss
 @i<@s8<Examples>>
 
+@xcode<@b<package> Office @b<is>
+@b<end> Office;>
+
+@xcode<@b<with> Ada.Strings.Unbounded;
+@b<package> Office.Locations @b<is>
+   @b<type> Location @b<is new> Ada.Strings.Unbounded.Unbounded_String;
+@b<end> Office.Locations;>
+
 @xcode<@b<limited with> Office.Departments;  --@ft<@i< types are incomplete>>
 @b<private with> Office.Locations;    --@ft<@i< only visible in private part>>
 @b<package> Office.Employees @b<is>
@@ -756,32 +781,17 @@
 @xcode<@b<raise> Ada.IO_Exceptions.Name_Error;   --@ft<@i< see A.13>>
 @b<raise> Queue_Error @b<with> "Buffer Full"; --@ft<@i< see 9.11>>>
 
-
-!corrigendum 12.5.5(1)
-!Comment This is a new clause, so this a dummy and the real thing is in the
-!comment conflicts.
-
-@dinsa
-The actual type shall be a limited, task, protected, or synchronized interface
-if and only if the formal type is also, respectively, a limited, task,
-protected, or synchronized interface.
-
-@dinss
-@i<@s8<Examples>>
-
-@xcode<@b<generic>
-   @b<type> Managed_Task @b<is task interface>;
-   @b<type> Work_Item(<@>) @b<is new> Root_Work_Item @b<with private>;
-@b<package> Server_Manager @b<is>
-   @b<task type> Server @b<is new> Managed_Task @b<with>
-      @b<entry> Start(Data : @b<access> Work_Item);
-   @b<end> Server;
-@b<end> Server_Manager;>
 
-This generic allows an application to establish a standard interface
-that all tasks need to implement so they can be managed appropriately
-by an application-specific scheduler.
+!corrigendum 11.4.3(2)
 
+@drepl
+@xcode<@b<with> Ada.Exceptions;
+@b<use> Ada;
+@b<package> File_System @b<is>
+    @b<type> File_Handle @b<is limited private>;>
+@dby
+@xcode<@b<package> File_System @b<is>
+    @b<type> File_Handle @b<is limited private>;>
 
 !corrigendum 11.4.3(6)
 
@@ -808,6 +818,34 @@
     @b<end> Open;>
 
 
+!corrigendum 12.5.5(1)
+!Comment This is a new clause, so this a dummy and the real thing is in the
+!comment conflicts.
+
+@dinsa
+The actual type shall be a limited, task, protected, or synchronized interface
+if and only if the formal type is also, respectively, a limited, task,
+protected, or synchronized interface.
+
+@dinss
+@i<@s8<Examples>>
+
+@xcode<@b<type> Root_Work_Item @b<is tagged private>;>
+
+@xcode<@b<generic>
+   @b<type> Managed_Task @b<is task interface>;
+   @b<type> Work_Item(<@>) @b<is new> Root_Work_Item @b<with private>;
+@b<package> Server_Manager @b<is>
+   @b<task type> Server @b<is new> Managed_Task @b<with>
+      @b<entry> Start(Data : @b<in out> Work_Item);
+   @b<end> Server;
+@b<end> Server_Manager;>
+
+This generic allows an application to establish a standard interface
+that all tasks need to implement so they can be managed appropriately
+by an application-specific scheduler.
+
+
 !corrigendum 12.6(18)
 
 @drepl
@@ -838,14 +876,15 @@
 @dinss
 @i<@s8<Examples>>
 
-@i<Example of generic package with formal package parameters:>
+@i<Example of a generic package with formal package parameters:>
 
-@xcode<@b<generic>
-   @b<with package> Mapping_1 @b<is new> Generic_Mapping(<@>);
-   @b<with package> Mapping_2 @b<is new> Generic_Mapping
+@xcode<@b<with> Ada.Containers.Ordered_Maps; --@ft<@i<  see A.18.6>>
+@b<generic>
+   @b<with package> Mapping_1 @b<is new> Ada.Containers.Ordered_Maps(<@>);
+   @b<with package> Mapping_2 @b<is new> Ada.Containers.Ordered_Maps
                                     (Key_Type =@> Mapping_1.Element_Type,
                                      @b<others> =@> <@>);
-@b<package> Generic_Join @b<is>
+@b<package> Ordered_Join @b<is>
    --@ft<@i< Provide a "join" between two mappings>>
 
    @b<subtype> Key_Type @b<is> Mapping_1.Key_Type;
@@ -854,20 +893,29 @@
    @b<function> Lookup(Key : Key_Type) @b<return> Element_Type;
 
    ...
-@b<end> Generic_Join;>
+@b<end> Ordered_Join;>
+
+@i<Example of an instantiation of a package with formal packages:>
+
+@xcode<@b<with> Ada.Containers.Ordered_Maps;
+@b<package> Symbol_Package @b<is>
+
+   @b<type> String_Id @b<is> ...
+
+   @b<type> Symbol_Info @b<is> ...
 
-@i<Example of instantiation of package with formal packages:>
+   @b<package> String_Table @b<is new> Ada.Containers.Ordered_Maps(Key_Type =@> String,
+                                                           Element_Type =@> String_Id);
 
-@xcode<@b<package> String_Table @b<is new> Generic_Mapping(Key_Type =@> String,
-                                            Element_Type =@> String_ID);
+   @b<package> Symbol_Table @b<is new> Ada.Containers.Ordered_Maps(Key_Type =@> String_Id,
+                                                            Element_Type =@> Symbol_Info);
 
-@b<package> Symbol_Table @b<is new> Generic_Mapping(Key_Type =@> String_ID,
-                                            Element_Type =@> Symbol_Info);
+   @b<package> String_Info @b<is new> Ordered_Join(Mapping_1 =@> String_Table,
+                                            Mapping_2 =@> Symbol_Table);
 
-@b<package> String_Info @b<is new> Generic_Join(Mapping_1 =@> String_Table,
-                                        Mapping_2 =@> Symbol_Table);
+   Apple_Info : @b<constant> Symbol_Info := String_Info.Lookup("Apple");>
 
-Apple_Info : @b<constant> Symbol_Info := String_Info.Lookup("Apple");>
+@b<end> Symbol_Package;
 
 !ACATS test
 

Questions? Ask the ACAA Technical Agent