File: AA-3-5-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 (195 lines) | stat: -rw-r--r-- 14,234 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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
    <TITLE>AARM95 - Character 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="AA-TOC.html">Contents</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-0-29.html">Index</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-3-5-1.html">Previous</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-3-5-3.html">Next</A></P>
<HR>
<H1> 3.5.2 Character Types</H1>

<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>1</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;<A NAME="I1643"></A>An enumeration type is said
to be a <I>character type</I> if at least one of its enumeration literals
is a <FONT FACE="Arial, Helvetica">character_literal</FONT>.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>2</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;<A NAME="I1644"></A><A NAME="I1645"></A><A NAME="I1646"></A><A NAME="I1647"></A>The
predefined type Character is a character type whose values correspond
to the 256 code positions of Row 00 (also known as Latin-1) of the ISO
10646 Basic Multilingual Plane (BMP). Each of the graphic characters
of Row 00 of the BMP has a corresponding <FONT FACE="Arial, Helvetica">character_literal</FONT>
in Character. Each of the nongraphic positions of Row 00 (0000-001F and
007F-009F) has a corresponding language-defined name, which is not usable
as an enumeration literal, but which is usable with the attributes (Wide_)Image
and (Wide_)Value; these names are given in the definition of type Character
in <A HREF="AA-A-1.html">A.1</A>, ``<A HREF="AA-A-1.html">The Package
Standard</A>'', but are set in <I>italics</I>. <A NAME="I1648"></A></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;<A NAME="I1649"></A><A NAME="I1650"></A><A NAME="I1651"></A>The
predefined type Wide_Character is a character type whose values correspond
to the 65536 code positions of the ISO 10646 Basic Multilingual Plane
(BMP). Each of the graphic characters of the BMP has a corresponding
<FONT FACE="Arial, Helvetica">character_literal</FONT> in Wide_Character.
The first 256 values of Wide_Character have the same <FONT FACE="Arial, Helvetica">character_literal</FONT>
or language-defined name as defined for Character. The last 2 values
of Wide_Character correspond to the nongraphic positions FFFE and FFFF
of the BMP, and are assigned the language-defined names <I>FFFE</I> and
<I>FFFF</I>. As with the other language-defined names for nongraphic
characters, the names <I>FFFE</I> and <I>FFFF</I> are usable only with
the attributes (Wide_)Image and (Wide_)Value; they are not usable as
enumeration literals. All other values of Wide_Character are considered
graphic characters, and have a corresponding <FONT FACE="Arial, Helvetica">character_literal</FONT>.
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>3.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>The language-defined
names are not usable as enumeration literals to avoid &quot;polluting&quot;
the name space. Since Wide_Character is defined in Standard, if the names
FFFE and FFFF were usable as enumeration literals, they would hide other
nonoverloadable declarations with the same names in <B>use</B>-d packages.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>3.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>ISO 10646 has not defined the
meaning of all of the code positions from 0100 through FFFD, but they
are all considered graphic characters by Ada to simplify the implementation,
and to allow for revisions to ISO 10646. In ISO 10646, FFFE and FFFF
are special, and will never be associated with graphic characters in
any revision. </FONT></DIV>

<H4 ALIGN=CENTER>Implementation Permissions</H4>
<DIV Class="Paranum"><FONT SIZE=-2>4</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;<A NAME="I1652"></A>In a nonstandard mode, an
implementation may provide other interpretations for the predefined types
Character and Wide_Character[, to conform to local conventions]. </DIV>

<H4 ALIGN=CENTER>Implementation Advice</H4>
<DIV Class="Paranum"><FONT SIZE=-2>5</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;<A NAME="I1653"></A>If an implementation supports
a mode with alternative interpretations for Character and Wide_Character,
the set of graphic characters of Character should nevertheless remain
a proper subset of the set of graphic characters of Wide_Character. Any
character set ``localizations'' should be reflected in the results of
the subprograms defined in the language-defined package Characters.Handling
(see <A HREF="AA-A-3.html">A.3</A>) available in such a mode. In a mode
with an alternative interpretation of Character, the implementation should
also support a corresponding change in what is a legal <FONT FACE="Arial, Helvetica">identifier_letter</FONT>.
</DIV>
<DIV Class="NotesHeader"><FONT SIZE=-1>NOTES</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>23&nbsp;&nbsp;The language-defined library
package Characters.Latin_1 (see <A HREF="AA-A-3-3.html">A.3.3</A>) includes
the declaration of constants denoting control characters, lower case
characters, and special characters of the predefined type Character.
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>To be honest: </B>The package
ASCII does the same, but only for the first 128 characters of Character.
Hence, it is an obsolescent package, and we no longer mention it here.
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>24&nbsp;&nbsp;A conventional character
set such as <I>EBCDIC</I> can be declared as a character type; the internal
codes of the characters can be specified by an <FONT FACE="Arial, Helvetica">enumeration_representation_clause</FONT>
as explained in clause <A HREF="AA-13-4.html">13.4</A>. </FONT></DIV>

<H4 ALIGN=CENTER>Examples</H4>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;<I>Example of a
character type: </I></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9</FONT></DIV>
<DIV Class="Examples"><TT><B>type</B>&nbsp;Roman_Digit&nbsp;<B>is</B>&nbsp;('I',&nbsp;'V',&nbsp;'X',&nbsp;'L',&nbsp;'C',&nbsp;'D',&nbsp;'M');</TT></DIV>

<H4 ALIGN=CENTER>Inconsistencies With Ada 83</H4>
<DIV Class="Paranum"><FONT SIZE=-2>9.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><A NAME="I1654"></A>The declaration
of Wide_Character in package Standard hides use-visible declarations
with the same defining identifier. In the unlikely event that an Ada
83 program had depended on such a use-visible declaration, and the program
remains legal after the substitution of Standard.Wide_Character, the
meaning of the program will be different. </FONT></DIV>

<H4 ALIGN=CENTER>Incompatibilities With Ada 83</H4>
<DIV Class="Paranum"><FONT SIZE=-2>9.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><A NAME="I1655"></A>The presence
of Wide_Character in package Standard means that an expression such as
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9.c</FONT></DIV>
<DIV Class="SmallExamples"><TT>'a'&nbsp;=&nbsp;'b'</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9.d</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>is ambiguous in Ada 95, whereas
in Ada 83 both literals could be resolved to be of type Character.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9.e</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The change in visibility rules
(see <A HREF="AA-4-2.html">4.2</A>) for character literals means that
additional qualification might be necessary to resolve expressions involving
overloaded subprograms and character literals. </FONT></DIV>

<H4 ALIGN=CENTER>Extensions to Ada 83</H4>
<DIV Class="Paranum"><FONT SIZE=-2>9.f</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><A NAME="I1656"></A>The type Character
has been extended to have 256 positions, and the type Wide_Character
has been added. Note that this change was already approved by the ARG
for Ada 83 conforming compilers.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9.g</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The rules for referencing character
literals are changed (see <A HREF="AA-4-2.html">4.2</A>), so that the
declaration of the character type need not be directly visible to use
its literals, similar to <B>null</B> and string literals. Context is
used to resolve their type. </FONT></DIV>

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