CVS difference for ais/ai-00270.txt

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

--- ais/ai-00270.txt	2002/10/29 20:24:57	1.3
+++ ais/ai-00270.txt	2003/03/04 04:56:22	1.4
@@ -1,5 +1,9 @@
-!standard 13.13.01 (00)                               02-10-24  AI95-00270/03
+!standard 13.13.02 (02)                               03-02-18  AI95-00270/04
+!standard 13.13.02 (09/1)
+!standard 13.13.02 (17)
 !class amendment 01-05-25
+!status Amendment 200Y 03-02-18
+!status ARG Approved 8-0-0  03-02-09
 !status work item 01-05-25
 !status received 01-05-25
 !priority High
@@ -11,7 +15,7 @@
 A Stream_Size (operational) attribute is introduced to support control of
 the size of items when written to a stream.
 
-The default implementation of a stream attribute only needs to write enough
+The default implementation of a stream attribute only reads or writes enough
 bits to represent the first subtype, not the base type.
 
 !problem
@@ -31,7 +35,7 @@
 
 Insert before 13.13.2(2):
 
-For every subtype S of an elementary type T, the following representational
+For every subtype S of an elementary type T, the following operational
 attribute is defined:
 
 S'Stream_Size
@@ -40,7 +44,8 @@
      type T is:
           T'Stream_Size / Ada.Streams.Stream_Element'Size.
 
-     The value of this attribute is type universal_integer.
+     The value of this attribute is type universal_integer and a multiple of
+     Stream_Element'Size.
 
      Stream_Size may be specified for first subtypes via an
      attribute_definition_clause; the expression of such a clause shall
@@ -71,7 +76,8 @@
 
 By default, the predefined stream-oriented attributes for an elementary type
 should only read or write the minimum number of stream elements required by
-the first subtype of the type, rounded up to the nearest factor or multiple of the word size that is also a multiple of the stream element size.
+the first subtype of the type, rounded up to the nearest factor or multiple of
+the word size that is also a multiple of the stream element size.
 
 !discussion
 
@@ -86,20 +92,20 @@
 Based on this rule (and assuming typical hardware), an implementation might
 choose an 8-, 16-, 32- or 64-bit base type for T.
 
-RM95 13.13.2(17) advise the implementation to "use the smaller number of
+RM95 13.13.2(17) advises the implementation to "use the smallest number of
 stream elements needed to represent all values in the base range of the scalar
 type" when reading or writing values of type T.
 
-Clearly this is a portability issue: if two implementation use (as is typical)
+Clearly this is a portability issue: if two implementations use (as is typical)
 8-bit stream elements, but have different rules for selecting base types, the
-number of elements read to or written from a stream will differ.  This makes
+number of elements read to or written from a stream will differ. This makes
 it very hard to write stream operations that comply with an externally defined
 format.
 
 In the above case, it would seem reasonable to read or write only the minimum
-number of stream elements necessary to represent the range 1 .. 10.  This
+number of stream elements necessary to represent the range 1 .. 10. This
 would remove the dependency on the base type selection, and make it easier to
-write portable stream operations.  (There is still the possibility that
+write portable stream operations. (There is still the possibility that
 different implementations would choose different sizes for stream elements,
 but that doesn't seem to happen in practice on typical hardware.)
 
@@ -110,9 +116,9 @@
                          Item : in T'Base);
 
 So one might call T'Write with the value 1000 for the Item parameter, and this
-might exceed the range representable in the stream.  However, this usage is
+might exceed the range representable in the stream. However, this usage is
 non-portable in the first place (because it depends on the choice of base
-range), so it doesn't seem important to preserve it.  In fact any attempt at
+range), so it doesn't seem important to preserve it. In fact any attempt at
 reading or writing a value outside the range of the first subtype is highly
 suspicious.
 
@@ -124,6 +130,74 @@
 
 !example
 
+!corrigendum 13.13.2(2)
+
+@dinsb
+For every subtype S of a specific type @i<T>, the following attributes are
+defined.
+@dinss
+For every subtype S of an elementary type T, the following operational
+attribute is defined:
+
+@xhang<@xterm<S'Stream_Size>
+Denotes the number of bits occupied in a stream by items of subtype S.
+Hence, the number of stream elements required per item of elementary
+type T is:>
+@xcode<        T'Stream_Size / Ada.Streams.Stream_Element'Size>
+
+@xindent<The value of this attribute is type universal_integer and a multiple of
+Stream_Element'Size.>
+
+@xindent<Stream_Size may be specified for first subtypes via an
+attribute_definition_clause; the expression of such a clause shall
+be static, non-negative, and a multiple of Stream_Element'Size.>
+
+@i<@s8<Implementation Advice>>
+
+The recommended level of support for the Stream_Size attribute is:  A
+Stream_Size clause should be supported for an elementary type T if the
+specified Stream_Size is a multiple of Stream_Element'Size and is no less than
+the size of the first subtype of T, and no greater than the size of the largest
+type of the same elementary class (signed integer, modular integer, float,
+ordinary fixed, decimal fixed, or access).
+
+!corrigendum 13.13.2(9/1)
+
+@dinsa
+For elementary types, the representation in terms of stream elements is
+implementation defined. For composite types, the Write or Read attribute for
+each component is called in canonical order, which is last dimension varying
+fastest for an array, and positional aggregate order for a record. Bounds are
+not included in the stream if @i<T> is an array type. If @i<T> is a discriminated type,
+discriminants are included only if they have defaults. If @i<T> is a tagged type,
+the tag is not included. For type extensions, the Write or Read attribute for
+the parent type is called, followed by the Write or Read attribute of each
+component of the extension part, in canonical order. For a limited type
+extension, if the attribute of any ancestor type of @i<T> has been directly
+specified and the attribute of any ancestor type of the type of any of the
+extension components which are of a limited type has not been specified, the
+attribute of @i<T> shall be directly specified.
+@dinst
+Constraint_Error is raised by the predefined Write attribute if the value of
+the elementary item is outside the range of values representable using
+Stream_Size bits. For a signed integer type, an enumeration type, or a
+fixed-point type, the range is unsigned only if the integer code for the first
+subtype low bound is non-negative, and a (symmetric) signed range that covers
+all values of the first subtype would require more than Stream_Size bits;
+otherwise the range is signed.
+
+!corrigendum 13.13.2(17)
+
+@drepl
+If a stream element is the same size as a storage element, then the normal
+in-memory representation should be used by Read and Write for scalar objects.
+Otherwise, Read and Write should use the smallest number of stream elements
+needed to represent all values in the base range of the scalar type.
+@dby
+By default, the predefined stream-oriented attributes for an elementary type
+should only read or write the minimum number of stream elements required by the
+first subtype of the type, rounded up to the nearest factor or multiple of the
+word size that is also a multiple of the stream element size.
 
 !ACATS test
 

Questions? Ask the ACAA Technical Agent