File: RM-13-13-2.html

package info (click to toggle)
ada-reference-manual 20021112web-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny, sarge
  • size: 18,652 kB
  • ctags: 8,921
  • sloc: makefile: 52; sh: 20
file content (284 lines) | stat: -rw-r--r-- 21,051 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
    <TITLE>Ada95 - Stream-Oriented Attributes</TITLE>
    <META NAME="Author" CONTENT="JTC1/SC22/WG9/ARG, by Randall Brukardt, ARG Editor">
    <META NAME="GENERATOR" CONTENT="Arm_Form.Exe, Ada Reference Manual generator">
    <STYLE type="text/css">
    DIV.paranum {position: absolute; font-family: Arial, Helvetica, sans-serif; left: 0.5 em; top: auto}
    TT {font-family: "Courier New", monospace}
    DT {display: compact}
    DIV.Normal {font-family: "Times New Roman", Times, serif; margin-bottom: 0.6em}
    DIV.Wide {font-family: "Times New Roman", Times, serif; margin-top: 0.6em; margin-bottom: 0.6em}
    DIV.Annotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
    DIV.WideAnnotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0.6em; margin-bottom: 0.6em}
    DIV.Index {font-family: "Times New Roman", Times, serif}
    DIV.SyntaxSummary {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
    DIV.Notes {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.6em}
    DIV.NotesHeader {font-family: "Times New Roman", Times, serif; margin-left: 2.0em}
    DIV.SyntaxIndented {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
    DIV.Indented {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-bottom: 0.6em}
    DIV.CodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
    DIV.SmallIndented {font-family: "Times New Roman", Times, serif; margin-left:  10.0em; margin-bottom: 0.6em}
    DIV.SmallCodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-bottom: 0.6em}
    DIV.Examples {font-family: "Courier New", monospace; margin-left: 2.0em; margin-bottom: 0.6em}
    DIV.SmallExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left: 7.5em; margin-bottom: 0.6em}
    DIV.IndentedExamples {font-family: "Courier New", monospace; margin-left: 8.0em; margin-bottom: 0.6em}
    DIV.SmallIndentedExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left:  15.0em; margin-bottom: 0.6em}
    UL.Bulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SmallBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SmallNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.IndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.CodeIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.CodeIndentedNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SyntaxIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NotesBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NotesNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    DL.Hanging {font-family: "Times New Roman", Times, serif; margin-top: 0em; margin-bottom: 0.6em}
    DD.Hanging {margin-left: 6.0em}
    DL.IndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.IndentedHanging {margin-left: 2.0em}
    DL.HangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.HangingInBulleted {margin-left: 4.0em}
    DL.SmallHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.SmallHanging {margin-left: 7.5em}
    DL.SmallIndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.SmallIndentedHanging {margin-left: 2.0em}
    DL.SmallHangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.SmallHangingInBulleted {margin-left: 5.0em}
    DL.Enumerated {font-family: "Times New Roman", Times, serif; margin-right: 0.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.Enumerated {margin-left: 2.0em}
    DL.SmallEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.SmallEnumerated {margin-left: 2.5em}
    DL.NestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    DL.SmallNestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    </STYLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFF0" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<P><A HREF="RM-TOC.html">Contents</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-0-29.html">Index</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-13-13-1.html">Previous</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-13-14.html">Next</A></P>
<HR>
<H1> 13.13.2 Stream-Oriented Attributes</H1>
<DIV Class="Paranum"><FONT SIZE=-2>1/1</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The operational attributes Write, Read, Output,
and Input convert values to a stream of elements and reconstruct values
from a stream. </DIV>

<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>2</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;For every subtype S of a specific type <I>T</I>,
the following attributes are defined. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT>&nbsp;&nbsp;&nbsp;S'Write<DD Class="Hanging">
<A NAME="I4475"></A><A NAME="I4476"></A>S'Write denotes a procedure with
the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>4</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>procedure</B>&nbsp;S'Write(<BR>
&nbsp;&nbsp;&nbsp;<I>Stream</I>&nbsp;:&nbsp;<B>access</B>&nbsp;Ada.Streams.Root_Stream_Type'Class;<BR>
&nbsp;&nbsp;&nbsp;<I>Item</I>&nbsp;:&nbsp;<B>in</B>&nbsp;<I>T</I>)</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">S'Write writes the value of <I>Item</I> to <I>Stream</I>.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>6</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT>&nbsp;&nbsp;&nbsp;S'Read<DD Class="Hanging">
<A NAME="I4477"></A><A NAME="I4478"></A>S'Read denotes a procedure with
the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>7</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>procedure</B>&nbsp;S'Read(<BR>
&nbsp;&nbsp;&nbsp;<I>Stream</I>&nbsp;:&nbsp;<B>access</B>&nbsp;Ada.Streams.Root_Stream_Type'Class;<BR>
&nbsp;&nbsp;&nbsp;<I>Item</I>&nbsp;:&nbsp;<B>out</B>&nbsp;<I>T</I>)</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">S'Read reads the value of <I>Item</I> from <I>Stream</I>.
</DL>
<DIV Class="Paranum"><FONT SIZE=-2>8.1/1</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;For untagged derived types, the Write and
Read attributes of the parent type are inherited as specified in <A HREF="RM-13-1.html">13.1</A>;
otherwise, the default implementations of these attributes are used.
The default implementations of Write and Read attributes execute as follows:</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9/1</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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</I> is an array type. If <I>T</I> is a discriminated type, discriminants
are included only if they have defaults. If <I>T</I> 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</I> 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</I> shall be directly specified.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;&nbsp;For every subtype
S'Class of a class-wide type <I>T</I>'Class: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT>&nbsp;&nbsp;&nbsp;&nbsp;S'Class'Write<DD Class="Hanging">
<A NAME="I4479"></A><A NAME="I4480"></A>S'Class'Write denotes a procedure
with the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>12</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>procedure</B>&nbsp;S'Class'Write(<BR>
&nbsp;&nbsp;&nbsp;<I>Stream</I>&nbsp;:&nbsp;<B>access</B>&nbsp;Ada.Streams.Root_Stream_Type'Class;<BR>
&nbsp;&nbsp;&nbsp;<I>Item</I>&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;<I>T</I>'Class)</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>13</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">Dispatches to the subprogram denoted by the Write
attribute of the specific type identified by the tag of Item.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>14</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT>&nbsp;&nbsp;&nbsp;&nbsp;S'Class'Read<DD Class="Hanging">
<A NAME="I4481"></A><A NAME="I4482"></A>S'Class'Read denotes a procedure
with the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>15</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>procedure</B>&nbsp;S'Class'Read(<BR>
&nbsp;&nbsp;&nbsp;<I>Stream</I>&nbsp;:&nbsp;<B>access</B>&nbsp;Ada.Streams.Root_Stream_Type'Class;<BR>
&nbsp;&nbsp;&nbsp;<I>Item</I>&nbsp;:&nbsp;<B>out</B>&nbsp;<I>T</I>'Class)</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>16</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">Dispatches to the subprogram denoted by the Read
attribute of the specific type identified by the tag of Item. </DL>

<H4 ALIGN=CENTER>Implementation Advice</H4>
<DIV Class="Paranum"><FONT SIZE=-2>17</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;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.</DIV>

<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>18</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;For every subtype S of a specific type <I>T</I>,
the following attributes are defined. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>19</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT>&nbsp;&nbsp;&nbsp;&nbsp;S'Output<DD Class="Hanging">
<A NAME="I4483"></A><A NAME="I4484"></A>S'Output denotes a procedure
with the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>20</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>procedure</B>&nbsp;S'Output(<BR>
&nbsp;&nbsp;&nbsp;<I>Stream</I>&nbsp;:&nbsp;<B>access</B>&nbsp;Ada.Streams.Root_Stream_Type'Class;<BR>
&nbsp;&nbsp;&nbsp;<I>Item</I>&nbsp;:&nbsp;<B>in</B>&nbsp;<I>T</I>)</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>21</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">S'Output writes the value of <I>Item</I> to <I>Stream</I>,
including any bounds or discriminants. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>22</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT>&nbsp;&nbsp;&nbsp;&nbsp;S'Input<DD Class="Hanging">
<A NAME="I4485"></A><A NAME="I4486"></A>S'Input denotes a function with
the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>23</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>function</B>&nbsp;S'Input(<BR>
&nbsp;&nbsp;&nbsp;<I>Stream</I>&nbsp;:&nbsp;<B>access</B>&nbsp;Ada.Streams.Root_Stream_Type'Class)<BR>
&nbsp;&nbsp;&nbsp;<B>return</B>&nbsp;<I>T</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">S'Input reads and returns one value from <I>Stream</I>,
using any bounds or discriminants written by a corresponding S'Output
to determine how much to read. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>25/1</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;For untagged
derived types, the Output and Input attributes of the parent type are
inherited as specified in <A HREF="RM-13-1.html">13.1</A>; otherwise,
the default implementations of these attributes are used. The default
implementations of Output and Input attributes execute as follows:</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>26</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>If <I>T</I> is an array type, S'Output first writes the
bounds, and S'Input first reads the bounds. If <I>T</I> has discriminants
without defaults, S'Output first writes the discriminants (using S'Write
for each), and S'Input first reads the discriminants (using S'Read for
each).</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>27</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>S'Output then calls S'Write to write the value of <I>Item</I>
to the stream. S'Input then creates an object (with the bounds or discriminants,
if any, taken from the stream), initializes it with S'Read, and returns
the value of the object. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>28</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;&nbsp;For every subtype
S'Class of a class-wide type <I>T</I>'Class: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>29</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT>&nbsp;&nbsp;&nbsp;&nbsp;S'Class'Output<DD Class="Hanging">
<A NAME="I4487"></A><A NAME="I4488"></A>S'Class'Output denotes a procedure
with the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>30</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>procedure</B>&nbsp;S'Class'Output(<BR>
&nbsp;&nbsp;&nbsp;<I>Stream</I>&nbsp;:&nbsp;<B>access</B>&nbsp;Ada.Streams.Root_Stream_Type'Class;<BR>
&nbsp;&nbsp;&nbsp;<I>Item</I>&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;<I>T</I>'Class)</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>31</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">First writes the external tag of <I>Item</I> to
<I>Stream</I> (by calling String'Output(Tags.External_Tag(<I>Item</I>'Tag)
-- see <A HREF="RM-3-9.html">3.9</A>) and then dispatches to the subprogram
denoted by the Output attribute of the specific type identified by the
tag.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>32</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT>&nbsp;&nbsp;&nbsp;&nbsp;S'Class'Input<DD Class="Hanging">
<A NAME="I4489"></A><A NAME="I4490"></A>S'Class'Input denotes a function
with the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>33</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>function</B>&nbsp;S'Class'Input(<BR>
&nbsp;&nbsp;&nbsp;<I>Stream</I>&nbsp;:&nbsp;<B>access</B>&nbsp;Ada.Streams.Root_Stream_Type'Class)<BR>
&nbsp;&nbsp;&nbsp;<B>return</B>&nbsp;<I>T</I>'Class</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>34</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">First reads the external tag from <I>Stream</I>
and determines the corresponding internal tag (by calling Tags.Internal_Tag(String'Input(<I>Stream</I>))
-- see <A HREF="RM-3-9.html">3.9</A>) and then dispatches to the subprogram
denoted by the Input attribute of the specific type identified by the
internal tag; returns that result. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>35</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I4491"></A><A NAME="I4492"></A>In the
default implementation of Read and Input for a composite type, for each
scalar component that is a discriminant or whose <FONT FACE="Arial, Helvetica">component_declaration</FONT>
includes a <FONT FACE="Arial, Helvetica">default_expression</FONT>, a
check is made that the value returned by Read for the component belongs
to its subtype. <A NAME="I4493"></A>Constraint_Error is raised if this
check fails. For other scalar components, no check is made. For each
component that is of an access type, if the implementation can detect
that the value returned by Read for the component is not a value of its
subtype, Constraint_Error is raised. If the value is not a value of its
subtype and this error is not detected, the component has an abnormal
value, and erroneous execution can result (see <A HREF="RM-13-9-1.html">13.9.1</A>).</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>35.1/1</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I4494"></A>In the default implementation
of Read and Input for a type, End_Error is raised if the end of the stream
is reached before the reading of a value of the type is completed.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>36/1</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I4495"></A><A NAME="I4496"></A><A NAME="I4497"></A><A NAME="I4498"></A><A NAME="I4499"></A><A NAME="I4500"></A><A NAME="I4501"></A><A NAME="I4502"></A>The
stream-oriented attributes may be specified for any type via an <FONT FACE="Arial, Helvetica">attribute_definition_clause</FONT>.
All nonlimited types have default implementations for these operations.
An <FONT FACE="Arial, Helvetica">attribute_reference</FONT> for one of
these attributes is illegal if the type is limited, unless the attribute
has been specified by an <FONT FACE="Arial, Helvetica">attribute_definition_clause</FONT>
or (for a type extension) the attribute has been specified for an ancestor
type. For an <FONT FACE="Arial, Helvetica">attribute_definition_clause</FONT>
specifying one of these attributes, the subtype of the Item parameter
shall be the base subtype if scalar, and the first subtype otherwise.
The same rule applies to the result of the Input function. </DIV>

<H4 ALIGN=CENTER>Implementation Requirements</H4>
<DIV Class="Paranum"><FONT SIZE=-2>36.1/1</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;For every subtype <I>S</I> of a language-defined
nonlimited specific type <I>T</I>, the output generated by S'Output or
S'Write shall be readable by S'Input or S'Read, respectively. This rule
applies across partitions if the implementation conforms to the Distributed
Systems Annex. </DIV>
<DIV Class="NotesHeader"><FONT SIZE=-1>NOTES</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>37</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>31&nbsp;&nbsp;For a definite subtype
S of a type <I>T</I>, only <I>T</I>'Write and <I>T</I>'Read are needed
to pass an arbitrary value of the subtype through a stream. For an indefinite
subtype S of a type <I>T</I>, <I>T</I>'Output and <I>T</I>'Input will
normally be needed, since <I>T</I>'Write and <I>T</I>'Read do not pass
bounds, discriminants, or tags.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>38</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>32&nbsp;&nbsp;User-specified attributes
of S'Class are not inherited by other class-wide types descended from
S. </FONT></DIV>

<H4 ALIGN=CENTER>Examples</H4>
<DIV Class="Paranum"><FONT SIZE=-2>39</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;&nbsp;<I>Example of user-defined
Write attribute:</I> </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>40</FONT></DIV>
<DIV Class="Examples"><TT><B>procedure</B>&nbsp;My_Write(<BR>
&nbsp;&nbsp;Stream&nbsp;:&nbsp;<B>access</B>&nbsp;Ada.Streams.Root_Stream_Type'Class;&nbsp;Item&nbsp;:&nbsp;My_Integer'Base);<BR>
<B>for</B>&nbsp;My_Integer'Write&nbsp;<B>use</B>&nbsp;My_Write;</TT></DIV>

<HR>
<P><A HREF="RM-TOC.html">Contents</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-0-29.html">Index</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-13-13-1.html">Previous</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-13-14.html">Next</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-TTL.html">Legal</A></P>
</BODY>
</HTML>