CVS difference for ais/ai-00260.txt

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

--- ais/ai-00260.txt	2002/03/13 00:48:28	1.9
+++ ais/ai-00260.txt	2002/05/25 03:42:18	1.10
@@ -1,6 +1,9 @@
-!standard 13.13.2  (31)                               02-02-25  AI95-00260/03
+!standard 13.13.2  (28)                               02-05-10  AI95-00260/04
+!standard 13.13.2  (31)
 !standard 13.13.2  (34)
+!standard 13.13.2  (38)
 !class amendment 01-02-13
+!status Amendment 200Y 02-05-10
 !status ARG Approved 7-0-0  02-02-11
 !status work item 01-06-02
 !status received 01-02-13
@@ -10,7 +13,7 @@
 
 !summary
 
-Two new stream attributes are proposed for tagged types. These attributes
+Two new stream attributes are introduced for tagged types. These attributes
 can be used to redefine the stream format of tags.
 
 !problem
@@ -19,7 +22,7 @@
 cannot be replaced, so it is not possible to write the tag in an arbitrary
 user-defined format (to match an external standard, for example).
 
-Consider, for example, XML objects, which are a text format. With the current
+Consider, for example, XML, which is a text format. With the current
 language definition, it is not possible to redefine the 'Read and 'Write
 attribute to have the object streamed as an XML object. This is surprising,
 as external tags are defined as strings. It is possible to change the external
@@ -31,8 +34,9 @@
 
 !proposal
 
-Two new operational attributes are defined for reading and writing tags.
-These attributes are used in S'Class'Input and S'Class'Output.
+Two new operational attributes, S'Class'Tag_Read and S'Class'Tag_Write, are
+defined for reading and writing tags. These attributes are used in the default
+implementation of S'Class'Input and S'Class'Output.
 
 See wording for the detailed proposal.
 
@@ -57,7 +61,7 @@
 String'Output, and it is missing the Stream parameter. But this paragraph will
 be replaced anyway in this proposal.
 
-!wording:
+!wording
 
 Add after 13.13.2(28):
 
@@ -67,7 +71,7 @@
                 Stream : access Streams.Root_Stream_Type'Class;
                 Tag : Ada.Tags.Tag);
 
-	S'Class'Tag_Write writes the value of Tag to Stream.
+        S'Class'Tag_Write writes the value of Tag to Stream.
 
    S'Class'Tag_Read
 
@@ -75,13 +79,13 @@
                 Stream : access Streams.Root_Stream_Type'Class)
                 return Ada.Tags.Tag;
 
-	S'Class'Tag_Read reads a tag from Stream, and returns its value.
+        S'Class'Tag_Read reads a tag from Stream, and returns its value.
 
 The default implementations of the Tag_Write and Tag_Read operate as follows:
-  * If T is type derived from type P, the default implementation of Tag_Write
-    calls P'Class'Tag_Write, and the default implementation of Tag_Read
-    calls P'Class'Tag_Read;
-  * Otherwise,  the default implementation of Tag_Write calls
+  * If T is a derived type with parent type P, the default implementation of
+    Tag_Write calls P'Class'Tag_Write, and the default implementation of
+    Tag_Read calls P'Class'Tag_Read;
+  * Otherwise, the default implementation of Tag_Write calls
     String'Output(Stream, Tags.External_Tag(Tag)) -- see 3.9. The default
     implementation of Tag_Read returns the value of
     Tags.Internal_Tag(String'Input(Stream)).
@@ -106,7 +110,7 @@
 
 !example
 
-Here is an example that illustrates the problem. Let's say that we want to
+Here is an example that illustrates the problem. Suppose that we want to
 stream an object with an XML encoding:
 
 with Ada.Streams;
@@ -157,7 +161,8 @@
 there is no way to stream an object with an XML representation.
 
 Using the new 'Tag_Read and 'Tag_Write attributes it is
-possible to control the tag input/output. By changing the Class spec to read:
+possible to control the tag input/output. By changing the Class specification
+to read:
 
 with Ada.Streams, Ada.Tags;
 package Class is
@@ -169,7 +174,7 @@
    for Object'External_Tag use "object";
 
    procedure Write (S : access Ada.Streams.Root_Stream_Type'Class;
-		    O : Object);
+                    O : Object);
    for Object'Write use Write;
 
    procedure Write (S : access Ada.Streams.Root_Stream_Type'Class;
@@ -234,6 +239,68 @@
    <object><v> 2</v></object>
 
 which is what we need to write XML.
+
+!corrigendum 13.13.2(28)
+
+@dinsa
+For every subtype S'Class of a class-wide type @i<T>'Class:
+@dinss
+S'Class'Tag_Write
+@xindent<S'Class'Tag_Write denotes a procedure with the following specification:>
+@xcode<        @b<procedure> S'Class'Tag_Write (
+            Stream : @b<access> Streams.Root_Stream_Type'Class;
+            Tag : Ada.Tags.Tag);>
+@xindent<S'Class'Tag_Write writes the value of Tag to Stream.>
+
+S'Class'Tag_Read
+@xindent<S'Class'Tag_Read denotes a function with the following specification:>
+@xcode<        @b<function> S'Class'Tag_Write (
+             Stream : @b<access> Streams.Root_Stream_Type'Class)
+             @b<return> Ada.Tags.Tag;>
+@xindent<S'Class'Tag_Read reads a tag from Stream, and returns its value.>
+
+The default implementations of the Tag_Write and Tag_Read operate as follows:
+@xbullet<If @i<T> is a derived type with parent type @i<P>, the default
+implementation of Tag_Write calls @i<P>'Class'Tag_Write, and the default
+implementation of Tag_Read calls @i<P>'Class'Tag_Read;>
+@xbullet<Otherwise, the default implementation of Tag_Write calls
+String'Output(@i<Stream>, Tags.External_Tag(@i<Tag>)) -- see 3.9. The default
+implementation of Tag_Read returns the value of
+Tags.Internal_Tag(String'Input(@i<Stream>)).>
+
+!corrigendum 13.13.2(31)
+
+@drepl
+First writes the external tag of @i<Item> to @i<Stream> (by calling
+String'Output(Tags.External_Tag(@i<Item>'Tag) -- see 3.9) and then dispatches
+to the subprogram denoted by the Output attribute of the specific type
+identified by the tag.
+@dby
+First writes the external tag of @i<Item> to @i<Stream> (by calling
+S'Tag_Write(@i<Stream>, @i<Item>'Tag)) and then dispatches to the subprogram
+denoted by the Output attribute of the specific type identified by the tag.
+
+!corrigendum 13.13.2(34)
+
+@drepl
+First reads the external tag from @i<Stream> and determines the corresponding
+internal tag (by calling Tags.Internal_Tag(String'Input(@i<Stream>)) -- see 3.9)
+and then dispatches to the subprogram denoted by the Input attribute of the
+specific type identified by the internal tag; returns that result.
+@dby
+First reads the external tag from @i<Stream> and determines the corresponding
+internal tag (by calling S'Tag_Read(@i<Stream>)) and then dispatches to the
+subprogram denoted by the Input attribute of the specific type identified by
+the internal tag; converts that result to S'Class and returns it.
+
+!corrigendum 13.13.2(38)
+
+@dinsa
+User-specified attributes of S'Class are not inherited by other class-wide
+types descended from S.
+@dinst
+User-specified Tag_Read and Tag_Write attributes should raise an exception if
+presented with a tag value not in S'Class.
 
 !ACATS test
 

Questions? Ask the ACAA Technical Agent