CVS difference for ais/ai-00270.txt

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

--- ais/ai-00270.txt	2001/05/26 02:55:11	1.1
+++ ais/ai-00270.txt	2002/10/24 17:12:04	1.2
@@ -1,4 +1,4 @@
-!standard 13.13.01 (00)                               01-05-25  AI95-00270/01
+!standard 13.13.01 (00)                               02-10-24  AI95-00270/03
 !class amendment 01-05-25
 !status work item 01-05-25
 !status received 01-05-25
@@ -8,11 +8,11 @@
 
 !summary
 
-A Stream_Size attribute is introduced to support control of the size of
-items when written to a stream.
+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
-bits to represent the subtype, not the base type.
+bits to represent the first subtype, not the base type.
 
 !problem
 
@@ -25,29 +25,54 @@
 
 !proposal
 
-By default, the predefined stream-oriented attributes for a scalar type
-shall 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 number of bits occupied in a stream
-by items of a type are given by the value of the specifiable
-type-related attribute Stream_Size.  Hence, the number of stream elements
-required per item of type T is:
-
-    T'Stream_Size / Ada.Streams.Stream_Element'Size.
-
-If specified, T'Stream_Size shall be a multiple of Stream_Element'Size.
-The recommended level of support for the Stream_Size attribute
-is:  A Stream_Size clause should be supported for a 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.
-
-Constraint_Error is raised by the predefined Write attribute if
-the value of the item is outside the range of values representable
-using Stream_Size bits (the range is unsigned if necessary to cover
-all values of the first subtype or if the type has no negative integer
-codes; otherwise the range is signed).
+(See Wording.)
 
+!wording
+
+Insert before 13.13.2(2):
+
+For every subtype S of an elementary type T, the following representational
+attribute is defined:
+
+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:
+          T'Stream_Size / Ada.Streams.Stream_Element'Size.
+
+     The value of this attribute is type universal_integer.
+
+     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.
+
+AARM Note: Stream_Size is a type-related attribute (see 13.1(8)).
+
+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).
+
+Insert after 13.13.2(9/1):
+
+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.
+
+Replace the Implementation Advice 13.13.2(17) by:
+
+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.
+
 !discussion
 
 Consider the declaration:
@@ -90,24 +115,11 @@
 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.
-
-Based on this reasoning, the following rules are added.  Note that these rules
-are Dynamic Semantics rules, not Implementation Advices:
 
-   - The predefined stream-oriented attributes for a scalar type T shall
-     only read or write the minimum number of stream elements necessary to
-     represent the first subtype.  If S is the first subtype, the number
-     of stream elements read to or written from the stream is exactly:
-
-        (S'Size + Stream_Element'Size - 1) / Stream_Element'Size
-
-   - If Write or Output is called with a value of the Item parameter outside
-     the range of the first subtype, Constraint_Error is raised.  This check
-     is a Range_Check.
-
-   - If the value extracted from the stream by Read or Input is outside the
-     range of the first subtype, Constraint_Error is raised.  This check is a
-     Range_Check.
+Since control of stream representation can be critical for some applications,
+we've also introduced the specifiable Stream_Size attribute. This attribute
+allows a programmer to request a particular stream size for a type. As usual,
+either the size will be used, or a compile-time error will occur.
 
 
 !example
@@ -115,6 +127,8 @@
 
 !ACATS test
 
+An ACATS C-Test needs to be created to test support of the Stream_Size
+attribute. Include specification of the attribute.
 
 !appendix
 

Questions? Ask the ACAA Technical Agent