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 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>Ada95 - Scalar Types</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> <A HREF="RM-0-29.html">Index</A> <A HREF="RM-3-4-1.html">Previous</A> <A HREF="RM-3-5-1.html">Next</A></P>
<HR>
<H1> 3.5 Scalar Types</H1>
<DIV Class="Paranum"><FONT SIZE=-2>1</FONT></DIV>
<DIV Class="Normal"> <A NAME="I1485"></A><I>Scalar</I> types comprise
enumeration types, integer types, and real types. <A NAME="I1486"></A>Enumeration
types and integer types are called <I>discrete</I> types; <A NAME="I1487"></A>each
value of a discrete type has a <I>position number</I> which is an integer
value. <A NAME="I1488"></A>Integer types and real types are called <I>numeric</I>
types. All scalar types are ordered, that is, all relational operators
are predefined for their values.</DIV>
<H4 ALIGN=CENTER>Syntax</H4>
<DIV Class="Paranum"><FONT SIZE=-2>2</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">range_constraint<A NAME="I1489"></A>
::= </FONT> <B>range</B> <A NAME="I1490"></A><FONT FACE="Arial, Helvetica">range</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">range<A NAME="I1491"></A>
::= </FONT> <A NAME="I1492"></A><FONT FACE="Arial, Helvetica">range_attribute_reference</FONT><BR>
| <A NAME="I1493"></A><FONT FACE="Arial, Helvetica">simple_expression</FONT> .. <A NAME="I1494"></A><FONT FACE="Arial, Helvetica">simple_expression</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4</FONT></DIV>
<DIV Class="Normal"> <A NAME="I1495"></A><A NAME="I1496"></A><A NAME="I1497"></A><A NAME="I1498"></A>A
<I>range</I> has a <I>lower bound</I> and an <I>upper bound</I> and specifies
a subset of the values of some scalar type (the <I>type of the range</I>).
A range with lower bound L and upper bound R is described by ``L .. R''.
<A NAME="I1499"></A>If R is less than L, then the range is a <I>null
range</I>, and specifies an empty set of values. Otherwise, the range
specifies the values of the type from the lower bound to the upper bound,
inclusive. <A NAME="I1500"></A>A value <I>belongs</I> to a range if it
is of the type of the range, and is in the subset of values specified
by the range. <A NAME="I1501"></A>A value <I>satisfies</I> a range constraint
if it belongs to the associated range. <A NAME="I1502"></A>One range
is <I>included</I> in another if all values that belong to the first
range also belong to the second. </DIV>
<H4 ALIGN=CENTER>Name Resolution Rules</H4>
<DIV Class="Paranum"><FONT SIZE=-2>5</FONT></DIV>
<DIV Class="Normal"> <A NAME="I1503"></A>For a <FONT FACE="Arial, Helvetica">subtype_indication</FONT>
containing a <FONT FACE="Arial, Helvetica">range_constraint</FONT>, either
directly or as part of some other <FONT FACE="Arial, Helvetica">scalar_constraint</FONT>,
the type of the <FONT FACE="Arial, Helvetica">range</FONT> shall resolve
to that of the type determined by the <FONT FACE="Arial, Helvetica">subtype_mark</FONT>
of the <FONT FACE="Arial, Helvetica">subtype_indication</FONT>. <A NAME="I1504"></A>For
a <FONT FACE="Arial, Helvetica">range</FONT> of a given type, the <FONT FACE="Arial, Helvetica">simple_expression</FONT>s
of the <FONT FACE="Arial, Helvetica">range</FONT> (likewise, the <FONT FACE="Arial, Helvetica">simple_expression</FONT>s
of the equivalent <FONT FACE="Arial, Helvetica">range</FONT> for a <FONT FACE="Arial, Helvetica">range_attribute_reference</FONT>)
are expected to be of the type of the <FONT FACE="Arial, Helvetica">range</FONT>.
</DIV>
<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>6</FONT></DIV>
<DIV Class="Normal"> <A NAME="I1505"></A>The <I>base range</I> of a
scalar type is the range of finite values of the type that can be represented
in every unconstrained object of the type; it is also the range supported
at a minimum for intermediate values during the evaluation of expressions
involving predefined operators of the type. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7</FONT></DIV>
<DIV Class="Normal"> <A NAME="I1506"></A><A NAME="I1507"></A>A constrained
scalar subtype is one to which a range constraint applies. <A NAME="I1508"></A>The
<I>range</I> of a constrained scalar subtype is the range associated
with the range constraint of the subtype. The <I>range</I> of an unconstrained
scalar subtype is the base range of its type. </DIV>
<H4 ALIGN=CENTER>Dynamic Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<DIV Class="Normal"> <A NAME="I1509"></A>A range is <I>compatible</I>
with a scalar subtype if and only if it is either a null range or each
bound of the range belongs to the range of the subtype. <A NAME="I1510"></A>A
<FONT FACE="Arial, Helvetica">range_constraint</FONT> is <I>compatible</I>
with a scalar subtype if and only if its range is compatible with the
subtype. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9</FONT></DIV>
<DIV Class="Normal"> <A NAME="I1511"></A>The elaboration of a <FONT FACE="Arial, Helvetica">range_constraint</FONT>
consists of the evaluation of the <FONT FACE="Arial, Helvetica">range</FONT>.
<A NAME="I1512"></A>The evaluation of a <FONT FACE="Arial, Helvetica">range</FONT>
determines a lower bound and an upper bound. If <FONT FACE="Arial, Helvetica">simple_expression</FONT>s
are given to specify bounds, the evaluation of the <FONT FACE="Arial, Helvetica">range</FONT>
evaluates these <FONT FACE="Arial, Helvetica">simple_expression</FONT>s
in an arbitrary order, and converts them to the type of the <FONT FACE="Arial, Helvetica">range</FONT>.
<A NAME="I1513"></A>If a <FONT FACE="Arial, Helvetica">range_attribute_reference</FONT>
is given, the evaluation of the <FONT FACE="Arial, Helvetica">range</FONT>
consists of the evaluation of the <FONT FACE="Arial, Helvetica">range_attribute_reference</FONT>.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10</FONT></DIV>
<DIV Class="Normal"> <I>Attributes</I></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> For every scalar
subtype S, the following attributes are defined: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>12</FONT></DIV>
<DL Class="Hanging"><DT> S'First<DD Class="Hanging">
<A NAME="I1514"></A><A NAME="I1515"></A>S'First denotes the lower bound
of the range of S. The value of this attribute is of the type of S. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>13</FONT></DIV>
<DL Class="Hanging"><DT> S'Last<DD Class="Hanging">
<A NAME="I1516"></A><A NAME="I1517"></A>S'Last denotes the upper bound
of the range of S. The value of this attribute is of the type of S. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>14</FONT></DIV>
<DL Class="Hanging"><DT> S'Range<DD Class="Hanging">
<A NAME="I1518"></A><A NAME="I1519"></A>S'Range is equivalent to the
<FONT FACE="Arial, Helvetica">range</FONT> S'First .. S'Last.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>15</FONT></DIV>
<DL Class="Hanging"><DT> S'Base<DD Class="Hanging">
<A NAME="I1520"></A><A NAME="I1521"></A>S'Base denotes an unconstrained
subtype of the type of S. This unconstrained subtype is called the <I>base
subtype</I> of the type. <A NAME="I1522"></A></DL>
<DIV Class="Paranum"><FONT SIZE=-2>16</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT> S'Min<DD Class="Hanging">
<A NAME="I1523"></A><A NAME="I1524"></A>S'Min denotes a function with
the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>17</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>function</B> S'Min(<I>Left</I>, <I>Right</I> : S'Base)<BR>
<B>return</B> S'Base</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>18</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">The function returns the lesser of the values of
the two parameters. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>19</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT> S'Max<DD Class="Hanging">
<A NAME="I1525"></A><A NAME="I1526"></A>S'Max denotes a function with
the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>20</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>function</B> S'Max(<I>Left</I>, <I>Right</I> : S'Base)<BR>
<B>return</B> S'Base</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>21</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">The function returns the greater of the values of
the two parameters.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>22</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT> S'Succ<DD Class="Hanging">
<A NAME="I1527"></A><A NAME="I1528"></A>S'Succ denotes a function with
the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>23</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>function</B> S'Succ(<I>Arg</I> : S'Base)<BR>
<B>return</B> S'Base</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging"><A NAME="I1529"></A>For an enumeration type, the
function returns the value whose position number is one more than that
of the value of <I>Arg</I>; <A NAME="I1530"></A><A NAME="I1531"></A>Constraint_Error
is raised if there is no such value of the type. For an integer type,
the function returns the result of adding one to the value of <I>Arg</I>.
For a fixed point type, the function returns the result of adding <I>small</I>
to the value of <I>Arg</I>. For a floating point type, the function returns
the machine number (as defined in <A HREF="RM-3-5-7.html">3.5.7</A>)
immediately above the value of <I>Arg</I>; <A NAME="I1532"></A><A NAME="I1533"></A>Constraint_Error
is raised if there is no such machine number. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>25</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT> S'Pred<DD Class="Hanging">
<A NAME="I1534"></A><A NAME="I1535"></A>S'Pred denotes a function with
the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>26</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>function</B> S'Pred(<I>Arg</I> : S'Base)<BR>
<B>return</B> S'Base</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>27</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging"><A NAME="I1536"></A>For an enumeration type, the
function returns the value whose position number is one less than that
of the value of <I>Arg</I>; <A NAME="I1537"></A><A NAME="I1538"></A>Constraint_Error
is raised if there is no such value of the type. For an integer type,
the function returns the result of subtracting one from the value of
<I>Arg</I>. For a fixed point type, the function returns the result of
subtracting <I>small</I> from the value of <I>Arg</I>. For a floating
point type, the function returns the machine number (as defined in <A HREF="RM-3-5-7.html">3.5.7</A>)
immediately below the value of <I>Arg</I>; <A NAME="I1539"></A><A NAME="I1540"></A>Constraint_Error
is raised if there is no such machine number. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>28</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT> S'Wide_Image<DD Class="Hanging">
<A NAME="I1541"></A><A NAME="I1542"></A>S'Wide_Image denotes a function
with the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>29</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>function</B> S'Wide_Image(<I>Arg</I> : S'Base)<BR>
<B>return</B> Wide_String</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>30</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging"><A NAME="I1543"></A>The function returns an <I>image</I>
of the value of <I>Arg</I>, that is, a sequence of characters representing
the value in display form. The lower bound of the result is one.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>31</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">The image of an integer value is the corresponding
decimal literal, without underlines, leading zeros, exponent, or trailing
spaces, but with a single leading character that is either a minus sign
or a space. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>32</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging"><A NAME="I1544"></A>The image of an enumeration
value is either the corresponding identifier in upper case or the corresponding
character literal (including the two apostrophes); neither leading nor
trailing spaces are included. For a <I>nongraphic character</I> (a value
of a character type that has no enumeration literal associated with it),
the result is a corresponding language-defined or implementation-defined
name in upper case (for example, the image of the nongraphic character
identified as <I>nul</I> is ``NUL'' -- the quotes are not part of the
image). </DL>
<DIV Class="Paranum"><FONT SIZE=-2>33</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">The image of a floating point value is a decimal
real literal best approximating the value (rounded away from zero if
halfway between) with a single leading character that is either a minus
sign or a space, a single digit (that is nonzero unless the value is
zero), a decimal point, S'Digits-1 (see <A HREF="RM-3-5-8.html">3.5.8</A>)
digits after the decimal point (but one if S'Digits is one), an upper
case E, the sign of the exponent (either + or -), and two or more digits
(with leading zeros if necessary) representing the exponent. If S'Signed_Zeros
is True, then the leading character is a minus sign for a negatively
signed zero. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>34</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">The image of a fixed point value is a decimal real
literal best approximating the value (rounded away from zero if halfway
between) with a single leading character that is either a minus sign
or a space, one or more digits before the decimal point (with no redundant
leading zeros), a decimal point, and S'Aft (see <A HREF="RM-3-5-10.html">3.5.10</A>)
digits after the decimal point. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>35</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT> S'Image<DD Class="Hanging">
<A NAME="I1545"></A><A NAME="I1546"></A>S'Image denotes a function with
the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>36</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>function</B> S'Image(<I>Arg</I> : S'Base)<BR>
<B>return</B> String</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>37</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">The function returns an image of the value of <I>Arg</I>
as a String. The lower bound of the result is one. The image has the
same sequence of graphic characters as that defined for S'Wide_Image
if all the graphic characters are defined in Character; otherwise the
sequence of characters is implementation defined (but no shorter than
that of S'Wide_Image for the same value of <I>Arg</I>). </DL>
<DIV Class="Paranum"><FONT SIZE=-2>38</FONT></DIV>
<DL Class="Hanging"><DT> S'Wide_Width<DD Class="Hanging">
<A NAME="I1547"></A><A NAME="I1548"></A>S'Wide_Width denotes the maximum
length of a Wide_String returned by S'Wide_Image over all values of the
subtype S. It denotes zero for a subtype that has a null range. Its type
is <I>universal_integer</I>.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>39</FONT></DIV>
<DL Class="Hanging"><DT> S'Width<DD Class="Hanging">
<A NAME="I1549"></A><A NAME="I1550"></A>S'Width denotes the maximum length
of a String returned by S'Image over all values of the subtype S. It
denotes zero for a subtype that has a null range. Its type is <I>universal_integer</I>.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>40</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT> S'Wide_Value<DD Class="Hanging">
<A NAME="I1551"></A><A NAME="I1552"></A>S'Wide_Value denotes a function
with the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>41</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>function</B> S'Wide_Value(<I>Arg</I> : Wide_String)<BR>
<B>return</B> S'Base</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>42</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">This function returns a value given an image of
the value as a Wide_String, ignoring any leading or trailing spaces.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>43</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging"><A NAME="I1553"></A><A NAME="I1554"></A>For the
evaluation of a call on S'Wide_Value for an enumeration subtype S, if
the sequence of characters of the parameter (ignoring leading and trailing
spaces) has the syntax of an enumeration literal and if it corresponds
to a literal of the type of S (or corresponds to the result of S'Wide_Image
for a nongraphic character of the type), the result is the corresponding
enumeration value; <A NAME="I1555"></A><A NAME="I1556"></A>otherwise
Constraint_Error is raised. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>44</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging"><A NAME="I1557"></A>For the evaluation of a call
on S'Wide_Value (or S'Value) for an integer subtype S, if the sequence
of characters of the parameter (ignoring leading and trailing spaces)
has the syntax of an integer literal, with an optional leading sign character
(plus or minus for a signed type; only plus for a modular type), and
the corresponding numeric value belongs to the base range of the type
of S, then that value is the result; <A NAME="I1558"></A><A NAME="I1559"></A>otherwise
Constraint_Error is raised.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>45</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DD Class ="Hanging">For the evaluation of a call on S'Wide_Value (or
S'Value) for a real subtype S, if the sequence of characters of the parameter
(ignoring leading and trailing spaces) has the syntax of one of the following:
</DL>
<DIV Class="Paranum"><FONT SIZE=-2>46</FONT></DIV>
<UL Class="IndentedBulleted"><LI TYPE=DISC><FONT FACE="Arial, Helvetica">numeric_literal</FONT></LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>47</FONT></DIV>
<UL Class="IndentedBulleted"><LI TYPE=DISC><FONT FACE="Arial, Helvetica">numeral</FONT>.[<FONT FACE="Arial, Helvetica">exponent</FONT>]</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>48</FONT></DIV>
<UL Class="IndentedBulleted"><LI TYPE=DISC>.<FONT FACE="Arial, Helvetica">numeral</FONT>[<FONT FACE="Arial, Helvetica">exponent</FONT>]</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>49</FONT></DIV>
<UL Class="IndentedBulleted"><LI TYPE=DISC><FONT FACE="Arial, Helvetica">base</FONT>#<FONT FACE="Arial, Helvetica">based_numeral</FONT>.#[<FONT FACE="Arial, Helvetica">exponent</FONT>]</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>50</FONT></DIV>
<UL Class="IndentedBulleted"><LI TYPE=DISC><FONT FACE="Arial, Helvetica">base</FONT>#.<FONT FACE="Arial, Helvetica">based_numeral</FONT>#[<FONT FACE="Arial, Helvetica">exponent</FONT>]
</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>51</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging"><A NAME="I1560"></A>with an optional leading sign
character (plus or minus), and if the corresponding numeric value belongs
to the base range of the type of S, then that value is the result; <A NAME="I1561"></A><A NAME="I1562"></A>otherwise
Constraint_Error is raised. The sign of a zero value is preserved (positive
if none has been specified) if S'Signed_Zeros is True.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>52</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT> S'Value<DD Class="Hanging">
<A NAME="I1563"></A><A NAME="I1564"></A>S'Value denotes a function with
the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>53</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>function</B> S'Value(<I>Arg</I> : String)<BR>
<B>return</B> S'Base</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>54</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">This function returns a value given an image of
the value as a String, ignoring any leading or trailing spaces.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>55</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging"><A NAME="I1565"></A><A NAME="I1566"></A>For the
evaluation of a call on S'Value for an enumeration subtype S, if the
sequence of characters of the parameter (ignoring leading and trailing
spaces) has the syntax of an enumeration literal and if it corresponds
to a literal of the type of S (or corresponds to the result of S'Image
for a value of the type), the result is the corresponding enumeration
value; <A NAME="I1567"></A><A NAME="I1568"></A>otherwise Constraint_Error
is raised. For a numeric subtype S, the evaluation of a call on S'Value
with <I>Arg</I> of type String is equivalent to a call on S'Wide_Value
for a corresponding <I>Arg</I> of type Wide_String. </DL>
<H4 ALIGN=CENTER>Implementation Permissions</H4>
<DIV Class="Paranum"><FONT SIZE=-2>56</FONT></DIV>
<DIV Class="Normal"> An implementation may extend the Wide_Value,
Value, Wide_Image, and Image attributes of a floating point type to support
special values such as infinities and NaNs.</DIV>
<DIV Class="NotesHeader"><FONT SIZE=-1>NOTES</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>57</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>19 The evaluation of S'First
or S'Last never raises an exception. If a scalar subtype S has a nonnull
range, S'First and S'Last belong to this range. These values can, for
example, always be assigned to a variable of subtype S. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>58</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>20 For a subtype of a scalar
type, the result delivered by the attributes Succ, Pred, and Value might
not belong to the subtype; similarly, the actual parameters of the attributes
Succ, Pred, and Image need not belong to the subtype.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>59</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>21 For any value V (including
any nongraphic character) of an enumeration subtype S, S'Value(S'Image(V))
equals V, as does S'Wide_Value(S'Wide_Image(V)). Neither expression ever
raises Constraint_Error. </FONT></DIV>
<H4 ALIGN=CENTER>Examples</H4>
<DIV Class="Paranum"><FONT SIZE=-2>60</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> <I>Examples of
ranges:</I> </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>61</FONT></DIV>
<DIV Class="Examples"><TT>-10 .. 10<BR>
X .. X + 1<BR>
0.0 .. 2.0*Pi<BR>
Red .. Green <I>-- see <A HREF="RM-3-5-1.html">3.5.1</A></I><BR>
1 .. 0 <I>-- a null range</I><BR>
Table'Range <I>-- a range attribute reference (see <A HREF="RM-3-6.html">3.6</A>)</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>62</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> <I>Examples of
range constraints:</I> </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>63</FONT></DIV>
<DIV Class="Examples"><TT><B>range</B> -999.0 .. +999.0<BR>
<B>range</B> S'First+1 .. S'Last-1</TT></DIV>
<HR>
<P><A HREF="RM-TOC.html">Contents</A> <A HREF="RM-0-29.html">Index</A> <A HREF="RM-3-4-1.html">Previous</A> <A HREF="RM-3-5-1.html">Next</A> <A HREF="RM-TTL.html">Legal</A></P>
</BODY>
</HTML>
|