| 1 |
@comment{ $Source: e:\\cvsroot/ARM/Source/pre_strings.mss,v $ } |
| 2 |
@comment{ $Revision: 1.87 $ $Date: 2019/11/15 05:03:42 $ $Author: randy $ } |
| 3 |
@Part(predefstrings, Root="ada.mss") |
| 4 |
@Comment{$Date: 2019/11/15 05:03:42 $} |
| 5 |
|
| 6 |
@RMNewPageVer{Version=[3]}@Comment{For printed version of Ada 2012 RM} |
| 7 |
@LabeledClause{String Handling} |
| 8 |
|
| 9 |
@begin{Intro} |
| 10 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]} |
| 11 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0299-1]} |
| 12 |
This @Chg{Version=[3],New=[subclause],Old=[clause]} |
| 13 |
presents the specifications of the package Strings and |
| 14 |
several child packages, which provide facilities for dealing with |
| 15 |
string data. Fixed-length, |
| 16 |
bounded-length, and unbounded-length strings are supported, for @Chg{Version=[2],New=[],Old=[both]} |
| 17 |
String@Chg{Version=[2],New=[,],Old=[ and]} Wide_String@Chg{Version=[2],New=[, |
| 18 |
and Wide_Wide_String],Old=[]}. |
| 19 |
The string-handling subprograms include searches for pattern strings |
| 20 |
and for characters in program-specified sets, |
| 21 |
translation (via a character-to-character mapping), and transformation |
| 22 |
(replacing, inserting, overwriting, and deleting of substrings). |
| 23 |
@end{Intro} |
| 24 |
|
| 25 |
@begin{Extend83} |
| 26 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0299-1]} |
| 27 |
@Defn{extensions to Ada 83} |
| 28 |
This @Chg{Version=[3],New=[subclause],Old=[clause]} |
| 29 |
is new to Ada 95. |
| 30 |
@end{Extend83} |
| 31 |
|
| 32 |
@begin{Diffword95} |
| 33 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]} |
| 34 |
@ChgAdded{Version=[2],Text=[Included Wide_Wide_String in this description; |
| 35 |
the individual changes are documented as extensions as needed.]} |
| 36 |
@end{Diffword95} |
| 37 |
|
| 38 |
|
| 39 |
@LabeledSubClause{The Package Strings} |
| 40 |
@begin{Intro} |
| 41 |
The package Strings provides declarations |
| 42 |
common to the string handling packages. |
| 43 |
@end{Intro} |
| 44 |
|
| 45 |
@begin{StaticSem} |
| 46 |
@Leading@;The library package Strings has the following declaration: |
| 47 |
@begin{example} |
| 48 |
@ChildUnit{Parent=[Ada],Child=[Strings]}@key[package] Ada.Strings @key[is] |
| 49 |
@key[pragma] Pure(Strings); |
| 50 |
|
| 51 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]} |
| 52 |
@AdaObjDefn{Space} : @key[constant] Character := ' '; |
| 53 |
@AdaObjDefn{Wide_Space} : @key[constant] Wide_Character := ' ';@Chg{Version=[2],New=[ |
| 54 |
@AdaObjDefn{Wide_Wide_Space} : @key[constant] Wide_Wide_Character := ' ';],Old=[]} |
| 55 |
|
| 56 |
@AdaExcDefn{Length_Error}, @AdaExcDefn{Pattern_Error}, @AdaExcDefn{Index_Error}, @AdaExcDefn{Translation_Error} : @key[exception]; |
| 57 |
|
| 58 |
@key[type] @AdaTypeDefn{Alignment} @key[is] (Left, Right, Center); |
| 59 |
@key[type] @AdaTypeDefn{Truncation} @key[is] (Left, Right, Error); |
| 60 |
@key[type] @AdaTypeDefn{Membership} @key[is] (Inside, Outside); |
| 61 |
@key[type] @AdaTypeDefn{Direction} @key[is] (Forward, Backward); |
| 62 |
@key[type] @AdaTypeDefn{Trim_End} @key[is] (Left, Right, Both); |
| 63 |
@key[end] Ada.Strings; |
| 64 |
@end{example} |
| 65 |
@end{StaticSem} |
| 66 |
|
| 67 |
@begin{Incompatible95} |
| 68 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]} |
| 69 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0005-1]} |
| 70 |
@ChgAdded{Version=[2],Text=[@Defn{incompatibilities with Ada 95} |
| 71 |
Constant Wide_Wide_Space is @Chg{Version=[3],New=[],Old=[newly ]}added |
| 72 |
to Ada.Strings. If Ada.Strings is |
| 73 |
referenced in a @nt{use_clause}, and an entity @i<E> with a |
| 74 |
@nt{defining_identifier} of Wide_Wide_Space is defined in a package that is |
| 75 |
also referenced in a @nt{use_clause}, the entity @i<E> may no longer be |
| 76 |
use-visible, resulting in errors. This should be rare and is easily fixed if |
| 77 |
it does occur.]} |
| 78 |
@end{Incompatible95} |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
@RMNewPageVer{Version=[1]}@Comment{Insert page break so printed Ada 95 w/ Corr RM looks better.} |
| 83 |
@LabeledSubClause{The Package Strings.Maps} |
| 84 |
@begin{Intro} |
| 85 |
The package Strings.Maps defines the types, operations, and other |
| 86 |
entities needed for character sets and character-to-character mappings. |
| 87 |
@end{Intro} |
| 88 |
|
| 89 |
@begin{StaticSem} |
| 90 |
@Leading@;The library package Strings.Maps has the following declaration: |
| 91 |
@begin{example} |
| 92 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00362-01]} |
| 93 |
@ChildUnit{Parent=[Ada.Strings],Child=[Maps]}@key[package] Ada.Strings.Maps @key[is] |
| 94 |
@key[pragma] @Chg{Version=[2],New=[Pure],Old=[Preelaborate]}(Maps); |
| 95 |
|
| 96 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00161-01]} |
| 97 |
--@Examcom{ Representation for a set of character values:} |
| 98 |
@key[type] @AdaTypeDefn{Character_Set} @key[is] @key[private];@Chg{Version=[2],New=[ |
| 99 |
@key[pragma] Preelaborable_Initialization(Character_Set);],Old=[]} |
| 100 |
|
| 101 |
@AdaObjDefn{Null_Set} : @key[constant] Character_Set; |
| 102 |
|
| 103 |
@key[type] @AdaTypeDefn{Character_Range} @key[is] |
| 104 |
@Key[record] |
| 105 |
Low : Character; |
| 106 |
High : Character; |
| 107 |
@key[end] @key[record]; |
| 108 |
-- @Examcom[Represents Character range Low..High] |
| 109 |
|
| 110 |
@key[type] @AdaTypeDefn{Character_Ranges} @key[is] @key[array] (Positive @key[range] <>) @key[of] Character_Range; |
| 111 |
|
| 112 |
@key[function] @AdaSubDefn{To_Set} (Ranges : @key[in] Character_Ranges)@key[return] Character_Set; |
| 113 |
|
| 114 |
@key[function] @AdaSubDefn{To_Set} (Span : @key[in] Character_Range)@key[return] Character_Set; |
| 115 |
|
| 116 |
@key[function] @AdaSubDefn{To_Ranges} (Set : @key[in] Character_Set) @key[return] Character_Ranges; |
| 117 |
|
| 118 |
@key[function] "=" (Left, Right : @key[in] Character_Set) @key[return] Boolean; |
| 119 |
|
| 120 |
@key[function] "@key[not]" (Right : @key[in] Character_Set) @key[return] Character_Set; |
| 121 |
@key[function] "@key[and]" (Left, Right : @key[in] Character_Set) @key[return] Character_Set; |
| 122 |
@key[function] "@key[or]" (Left, Right : @key[in] Character_Set) @key[return] Character_Set; |
| 123 |
@key[function] "@key[xor]" (Left, Right : @key[in] Character_Set) @key[return] Character_Set; |
| 124 |
@key[function] "-" (Left, Right : @key[in] Character_Set) @key[return] Character_Set; |
| 125 |
|
| 126 |
@key[function] @AdaSubDefn{Is_In} (Element : @key[in] Character; |
| 127 |
Set : @key[in] Character_Set) |
| 128 |
@key[return] Boolean; |
| 129 |
|
| 130 |
@key[function] @AdaSubDefn{Is_Subset} (Elements : @key[in] Character_Set; |
| 131 |
Set : @key[in] Character_Set) |
| 132 |
@key[return] Boolean; |
| 133 |
|
| 134 |
@key[function] "<=" (Left : @key[in] Character_Set; |
| 135 |
Right : @key[in] Character_Set) |
| 136 |
@key[return] Boolean @key[renames] Is_Subset; |
| 137 |
|
| 138 |
|
| 139 |
--@Examcom{ Alternative representation for a set of character values:} |
| 140 |
@key[subtype] @AdaSubtypeDefn{Name=[Character_Sequence],Of=[String]} @key[is] String; |
| 141 |
|
| 142 |
@key[function] @AdaSubDefn{To_Set} (Sequence : @key[in] Character_Sequence)@key[return] Character_Set; |
| 143 |
|
| 144 |
@key[function] @AdaSubDefn{To_Set} (Singleton : @key[in] Character) @key[return] Character_Set; |
| 145 |
|
| 146 |
@key[function] @AdaSubDefn{To_Sequence} (Set : @key[in] Character_Set) @key[return] Character_Sequence; |
| 147 |
|
| 148 |
|
| 149 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00161-01]} |
| 150 |
--@Examcom{ Representation for a character to character mapping:} |
| 151 |
@key[type] @AdaTypeDefn{Character_Mapping} @key[is] @key[private];@Chg{Version=[2],New=[ |
| 152 |
@key[pragma] Preelaborable_Initialization(Character_Mapping);],Old=[]} |
| 153 |
|
| 154 |
@key[function] @AdaSubDefn{Value} (Map : @key[in] Character_Mapping; |
| 155 |
Element : @key[in] Character) |
| 156 |
@key[return] Character; |
| 157 |
|
| 158 |
@AdaObjDefn{Identity} : @key[constant] Character_Mapping; |
| 159 |
|
| 160 |
@key[function] @AdaSubDefn{To_Mapping} (From, To : @key[in] Character_Sequence) |
| 161 |
@key[return] Character_Mapping; |
| 162 |
|
| 163 |
@key[function] @AdaSubDefn{To_Domain} (Map : @key[in] Character_Mapping) |
| 164 |
@key[return] Character_Sequence; |
| 165 |
@key[function] @AdaSubDefn{To_Range} (Map : @key[in] Character_Mapping) |
| 166 |
@key[return] Character_Sequence; |
| 167 |
|
| 168 |
@key{type} @AdaTypeDefn{Character_Mapping_Function} @key{is} |
| 169 |
@key{access} @key{function} (From : @key{in} Character) @key{return} Character; |
| 170 |
|
| 171 |
@key[private] |
| 172 |
... -- @Examcom{not specified by the language} |
| 173 |
@key[end] Ada.Strings.Maps; |
| 174 |
@end{example} |
| 175 |
|
| 176 |
An object of type Character_Set represents a set of characters. |
| 177 |
|
| 178 |
Null_Set represents the set containing no characters. |
| 179 |
|
| 180 |
An object Obj of type Character_Range represents the set of characters |
| 181 |
in the range Obj.Low .. Obj.High. |
| 182 |
|
| 183 |
An object Obj of type Character_Ranges represents the |
| 184 |
union of the sets corresponding to Obj(I) for I in Obj'Range. |
| 185 |
@begin{DescribeCode} |
| 186 |
@begin{Example}@Keepnext |
| 187 |
@key[function] To_Set (Ranges : @key[in] Character_Ranges) @key[return] Character_Set; |
| 188 |
@end{Example} |
| 189 |
@Trailing@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0264-1]} |
| 190 |
If Ranges'Length=0 then Null_Set is returned; |
| 191 |
otherwise@Chg{Version=[3],New=[,],Old=[]} |
| 192 |
the returned value represents the set corresponding to Ranges. |
| 193 |
|
| 194 |
@begin{Example}@Keepnext |
| 195 |
@key[function] To_Set (Span : @key[in] Character_Range) @key[return] Character_Set; |
| 196 |
@end{Example} |
| 197 |
|
| 198 |
The returned value represents the set containing each character in Span. |
| 199 |
@begin{Example}@Keepnext |
| 200 |
@key[function] To_Ranges (Set : @key[in] Character_Set) @key[return] Character_Ranges; |
| 201 |
@end{Example} |
| 202 |
@Trailing@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0264-1]} |
| 203 |
If Set = Null_Set@Chg{Version=[3],New=[,],Old=[]} |
| 204 |
then an empty Character_Ranges array is returned; |
| 205 |
otherwise@Chg{Version=[3],New=[,],Old=[]} the shortest array of contiguous |
| 206 |
ranges of Character values in Set, in increasing order of Low, is returned. |
| 207 |
|
| 208 |
@begin{Example}@Keepnext |
| 209 |
@key[function] "=" (Left, Right : @key[in] Character_Set) @key[return] Boolean; |
| 210 |
@end{Example} |
| 211 |
@Trailing@;The function "=" returns True if Left and Right represent identical sets, |
| 212 |
and False otherwise. |
| 213 |
@end{DescribeCode} |
| 214 |
|
| 215 |
@Trailing@;Each of the logical operators "@key[not]", "@key[and]", "@key[or]", |
| 216 |
and "@key[xor]" returns |
| 217 |
a Character_Set value that represents the set obtained by applying |
| 218 |
the corresponding operation to the set(s) represented by the parameter(s) |
| 219 |
of the operator. |
| 220 |
"@en"(Left, Right) is equivalent to "and"(Left, "not"(Right)). |
| 221 |
@begin{reason} |
| 222 |
The set minus operator is provided for efficiency.@end{reason} |
| 223 |
|
| 224 |
@begin{DescribeCode} |
| 225 |
@begin{Example}@Keepnext |
| 226 |
@key[function] Is_In (Element : @key[in] Character; |
| 227 |
Set : @key[in] Character_Set); |
| 228 |
@key[return] Boolean; |
| 229 |
@end{Example} |
| 230 |
@Trailing@;Is_In returns True if Element is in Set, and False otherwise. |
| 231 |
|
| 232 |
@begin{Example}@Keepnext |
| 233 |
@key[function] Is_Subset (Elements : @key[in] Character_Set; |
| 234 |
Set : @key[in] Character_Set) |
| 235 |
@key[return] Boolean; |
| 236 |
@end{Example} |
| 237 |
@Trailing@;Is_Subset returns True if |
| 238 |
Elements is a subset of Set, and False otherwise. |
| 239 |
|
| 240 |
@begin{Example}@Keepnext |
| 241 |
@key[subtype] Character_Sequence @key[is] String; |
| 242 |
@end{Example} |
| 243 |
@Trailing@;The Character_Sequence subtype is used to portray a set of character |
| 244 |
values and also to identify the domain and range of a character |
| 245 |
mapping. |
| 246 |
@begin{reason} |
| 247 |
Although a named subtype is redundant @em the predefined type String |
| 248 |
could have been used for the parameter to To_Set and To_Mapping |
| 249 |
below @em the use of a differently named subtype identifies the intended |
| 250 |
purpose of the parameter. |
| 251 |
@end{reason} |
| 252 |
|
| 253 |
@begin{Example}@Keepnext |
| 254 |
@key[function] To_Set (Sequence : @key[in] Character_Sequence) @key[return] Character_Set;@* |
| 255 |
@key[function] To_Set (Singleton : @key[in] Character) @key[return] Character_Set; |
| 256 |
@end{Example} |
| 257 |
@Trailing@;Sequence portrays the set of character values that it explicitly |
| 258 |
contains (ignoring duplicates). |
| 259 |
Singleton portrays the set comprising a single Character. |
| 260 |
Each of the To_Set functions |
| 261 |
returns a Character_Set value that represents |
| 262 |
the set portrayed by Sequence or Singleton. |
| 263 |
|
| 264 |
@begin{Example}@Keepnext |
| 265 |
@key[function] To_Sequence (Set : @key[in] Character_Set) @key[return] Character_Sequence; |
| 266 |
@end{Example} |
| 267 |
@Trailing@;The function To_Sequence returns a Character_Sequence value |
| 268 |
containing each of the characters in the set represented by Set, in |
| 269 |
ascending order with no duplicates. |
| 270 |
|
| 271 |
@begin{Example}@Keepnext |
| 272 |
@key[type] Character_Mapping @key[is] @key[private]; |
| 273 |
@end{Example} |
| 274 |
@Trailing@;An object of type Character_Mapping represents a |
| 275 |
Character-to-Character mapping. |
| 276 |
|
| 277 |
@begin{Example}@Keepnext |
| 278 |
@key[function] Value (Map : @key[in] Character_Mapping; |
| 279 |
Element : @key[in] Character) |
| 280 |
@key[return] Character; |
| 281 |
@end{Example} |
| 282 |
@Trailing@;The function Value returns the Character value to which Element maps |
| 283 |
with respect to the mapping represented by Map. |
| 284 |
@end{DescribeCode} |
| 285 |
|
| 286 |
@Defn2{Term=[match], Sec=(a character to a pattern character)} |
| 287 |
A character C @i{matches} a pattern character P |
| 288 |
with respect to a given Character_Mapping value Map if |
| 289 |
Value(Map, C) = P. |
| 290 |
@Defn2{Term=[match], Sec=(a string to a pattern string)} |
| 291 |
A string S @i{matches} a pattern string P with respect to a |
| 292 |
given Character_Mapping if their lengths are the same |
| 293 |
and if each character in S matches its corresponding character in |
| 294 |
the pattern string P. |
| 295 |
@begin{Discussion} |
| 296 |
In an earlier version of the string handling packages, |
| 297 |
the definition of matching was symmetrical, namely |
| 298 |
C matches P if Value(Map,C) = Value(Map,P). |
| 299 |
However, applying the mapping |
| 300 |
to the pattern was confusing according to some reviewers. |
| 301 |
Furthermore, if the symmetrical version is needed, it can |
| 302 |
be achieved by applying the mapping to the pattern (via translation) prior to |
| 303 |
passing it as a parameter. |
| 304 |
@end{Discussion} |
| 305 |
|
| 306 |
String handling subprograms that deal with character mappings have |
| 307 |
parameters whose type is Character_Mapping. |
| 308 |
@begin{DescribeCode} |
| 309 |
@begin{Example}@Keepnext |
| 310 |
Identity : @key[constant] Character_Mapping; |
| 311 |
@end{Example} |
| 312 |
@Trailing@;Identity maps each Character to itself. |
| 313 |
|
| 314 |
@begin{Example}@Keepnext |
| 315 |
@key[function] To_Mapping (From, To : @key[in] Character_Sequence) |
| 316 |
@key[return] Character_Mapping; |
| 317 |
@end{Example} |
| 318 |
@Trailing@;To_Mapping produces a Character_Mapping such that |
| 319 |
each element of From maps to the corresponding element of To, |
| 320 |
and each other character maps to itself. |
| 321 |
If From'Length /= To'Length, or |
| 322 |
if some character is repeated in From, then Translation_Error |
| 323 |
is propagated. |
| 324 |
|
| 325 |
@begin{Example}@Keepnext |
| 326 |
@key[function] To_Domain (Map : @key[in] Character_Mapping) @key[return] Character_Sequence; |
| 327 |
@end{Example} |
| 328 |
@Trailing@;To_Domain returns the shortest Character_Sequence value D such that |
| 329 |
each character not in D maps to itself, and such that |
| 330 |
the characters in D are in ascending order. |
| 331 |
The lower bound of D is 1. |
| 332 |
|
| 333 |
@begin{Example}@Keepnext |
| 334 |
@key[function] To_Range (Map : @key[in] Character_Mapping) @key[return] Character_Sequence; |
| 335 |
@end{Example} |
| 336 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0048],ARef=[AI95-00151-01]} |
| 337 |
@Trailing@;To_Range returns the Character_Sequence value R, |
| 338 |
@Chg{New=[],Old=[with lower bound 1 and upper bound Map'Length,]} |
| 339 |
such that if D = To_Domain(Map)@Chg{New=[, then R has the same bounds as D, |
| 340 |
and],Old=[ then]} D(I) maps to R(I) for each I in D'Range. |
| 341 |
@end{DescribeCode} |
| 342 |
|
| 343 |
An object F of type Character_Mapping_Function maps a Character |
| 344 |
value C to the Character value F.@key{all}(C), which is said to |
| 345 |
@i{match} C with respect to mapping function F. |
| 346 |
@Defn2[term=<match>,sec=<a character to a pattern character, with |
| 347 |
respect to a character mapping function>] |
| 348 |
@end{StaticSem} |
| 349 |
|
| 350 |
@begin{Notes} |
| 351 |
Character_Mapping and Character_Mapping_Function |
| 352 |
are used both for character equivalence |
| 353 |
mappings in the search subprograms (such as for case insensitivity) and |
| 354 |
as transformational mappings in the Translate subprograms. |
| 355 |
|
| 356 |
To_Domain(Identity) and To_Range(Identity) each returns the null string. |
| 357 |
@begin{Reason} |
| 358 |
Package Strings.Maps is not pure, since it declares an |
| 359 |
access-to-subprogram type. |
| 360 |
@end{Reason} |
| 361 |
@end{Notes} |
| 362 |
|
| 363 |
@begin{Examples} |
| 364 |
To_Mapping("ABCD", "ZZAB") returns a Character_Mapping that maps 'A' |
| 365 |
and 'B' to 'Z', 'C' to 'A', 'D' to 'B', and each other Character to |
| 366 |
itself. |
| 367 |
@end{Examples} |
| 368 |
|
| 369 |
@begin{Extend95} |
| 370 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00161-01]} |
| 371 |
@ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95} |
| 372 |
@b[Amendment Correction:] Added @nt{pragma} Preelaborable_Initialization to |
| 373 |
types Character_Set and Character_Mapping, so that they can be used |
| 374 |
to declare default-initialized objects in preelaborated units.]} |
| 375 |
|
| 376 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00362-01]} |
| 377 |
@ChgAdded{Version=[2],Text=[Strings.Maps is now Pure, |
| 378 |
so it can be used in pure units.]} |
| 379 |
@end{Extend95} |
| 380 |
|
| 381 |
@begin{DiffWord95} |
| 382 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0048],ARef=[AI95-00151-01]} |
| 383 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Corrected the definition of |
| 384 |
the range of the result of To_Range, since the Ada 95 definition makes no |
| 385 |
sense.]} |
| 386 |
@end{DiffWord95} |
| 387 |
|
| 388 |
|
| 389 |
@LabeledSubClause{Fixed-Length String Handling} |
| 390 |
@begin{Intro} |
| 391 |
The language-defined package Strings.Fixed provides string-handling subprograms |
| 392 |
for fixed-length strings; |
| 393 |
that is, for values of type Standard.String. |
| 394 |
Several of these subprograms are procedures that modify the contents of |
| 395 |
a String that is passed as an @key[out] or an @key[in] @key[out] parameter; |
| 396 |
each has additional |
| 397 |
parameters to control the effect when the logical length of the result |
| 398 |
differs from the parameter's length. |
| 399 |
|
| 400 |
For each function that returns a String, the lower bound of the returned |
| 401 |
value is 1. |
| 402 |
@begin{Discussion} |
| 403 |
@Chgref{Version=[2],Kind=[Revised],ARef=[AI95-00114-01]} |
| 404 |
Most operations that @Chg{Version=[2],New=[yield],Old=[yields]} a String |
| 405 |
are provided both as a |
| 406 |
function and as a procedure. The functional form is possibly a more aesthetic |
| 407 |
style but may introduce overhead due to extra copying or dynamic memory |
| 408 |
usage in some implementations. Thus a procedural form, with an @key[in] |
| 409 |
@key[out] parameter so that all copying is done `in place', is also |
| 410 |
supplied.@end{discussion} |
| 411 |
|
| 412 |
The basic model embodied in the package is that a fixed-length string |
| 413 |
comprises significant characters and possibly padding |
| 414 |
(with space characters) |
| 415 |
on either or both |
| 416 |
ends. When a shorter string is copied to a longer string, padding |
| 417 |
is inserted, and when a longer string is copied to a shorter one, |
| 418 |
padding is stripped. The Move procedure in Strings.Fixed, which takes a |
| 419 |
String as an @key[out] parameter, allows the programmer to control these |
| 420 |
effects. Similar control is provided by the string transformation |
| 421 |
procedures. |
| 422 |
@end{Intro} |
| 423 |
|
| 424 |
@begin{StaticSem} |
| 425 |
@Leading@keepnext |
| 426 |
@Leading@;The library package Strings.Fixed has the following declaration: |
| 427 |
@begin{example} |
| 428 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0241-1]} |
| 429 |
@key[with] Ada.Strings.Maps; |
| 430 |
@ChildUnit{Parent=[Ada.Strings],Child=[Fixed]}@key[package] Ada.Strings.Fixed@Chg{Version=[5],New=[],Old=[ @key[is]]} |
| 431 |
@Chg{Version=[5],New=[@key[with]],Old=[@key[pragma]]} Preelaborate@Chg{Version=[5],New=[, Nonblocking @key[is]],Old=[(Fixed);]} |
| 432 |
|
| 433 |
|
| 434 |
--@Examcom{ "Copy" procedure for strings of possibly different lengths} |
| 435 |
|
| 436 |
@key[procedure] @AdaSubDefn{Move} (Source : @key[in] String; |
| 437 |
Target : @key[out] String; |
| 438 |
Drop : @key[in] Truncation := Error; |
| 439 |
Justify : @key[in] Alignment := Left; |
| 440 |
Pad : @key[in] Character := Space); |
| 441 |
|
| 442 |
|
| 443 |
--@Examcom{ Search subprograms} |
| 444 |
|
| 445 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 446 |
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index} (Source : @key[in] String; |
| 447 |
Pattern : @key[in] String; |
| 448 |
From : @key[in] Positive; |
| 449 |
Going : @key[in] Direction := Forward; |
| 450 |
Mapping : @key[in] Maps.Character_Mapping := Maps.Identity) |
| 451 |
@key[return] Natural;]} |
| 452 |
|
| 453 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 454 |
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index} (Source : @key[in] String; |
| 455 |
Pattern : @key[in] String; |
| 456 |
From : @key[in] Positive; |
| 457 |
Going : @key[in] Direction := Forward; |
| 458 |
Mapping : @key[in] Maps.Character_Mapping_Function) |
| 459 |
@key[return] Natural;]} |
| 460 |
|
| 461 |
@key[function] @AdaSubDefn{Index} (Source : @key[in] String; |
| 462 |
Pattern : @key[in] String; |
| 463 |
Going : @key[in] Direction := Forward; |
| 464 |
Mapping : @key[in] Maps.Character_Mapping |
| 465 |
:= Maps.Identity) |
| 466 |
@key[return] Natural; |
| 467 |
|
| 468 |
@key[function] @AdaSubDefn{Index} (Source : @key[in] String; |
| 469 |
Pattern : @key[in] String; |
| 470 |
Going : @key[in] Direction := Forward; |
| 471 |
Mapping : @key[in] Maps.Character_Mapping_Function) |
| 472 |
@key[return] Natural; |
| 473 |
|
| 474 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 475 |
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index} (Source : @key[in] String; |
| 476 |
Set : @key[in] Maps.Character_Set; |
| 477 |
From : @key[in] Positive; |
| 478 |
Test : @key[in] Membership := Inside; |
| 479 |
Going : @key[in] Direction := Forward) |
| 480 |
@key[return] Natural;]} |
| 481 |
|
| 482 |
@key[function] @AdaSubDefn{Index} (Source : @key[in] String; |
| 483 |
Set : @key[in] Maps.Character_Set; |
| 484 |
Test : @key[in] Membership := Inside; |
| 485 |
Going : @key[in] Direction := Forward) |
| 486 |
@key[return] Natural; |
| 487 |
|
| 488 |
|
| 489 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 490 |
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index_Non_Blank} (Source : @key[in] String; |
| 491 |
From : @key[in] Positive; |
| 492 |
Going : @key[in] Direction := Forward) |
| 493 |
@key[return] Natural;]} |
| 494 |
|
| 495 |
@key[function] @AdaSubDefn{Index_Non_Blank} (Source : @key[in] String; |
| 496 |
Going : @key[in] Direction := Forward) |
| 497 |
@key[return] Natural; |
| 498 |
|
| 499 |
|
| 500 |
@key[function] @AdaSubDefn{Count} (Source : @key[in] String; |
| 501 |
Pattern : @key[in] String; |
| 502 |
Mapping : @key[in] Maps.Character_Mapping |
| 503 |
:= Maps.Identity) |
| 504 |
@key[return] Natural; |
| 505 |
|
| 506 |
@key[function] @AdaSubDefn{Count} (Source : @key[in] String; |
| 507 |
Pattern : @key[in] String; |
| 508 |
Mapping : @key[in] Maps.Character_Mapping_Function) |
| 509 |
@key[return] Natural; |
| 510 |
|
| 511 |
@key[function] @AdaSubDefn{Count} (Source : @key[in] String; |
| 512 |
Set : @key[in] Maps.Character_Set) |
| 513 |
@key[return] Natural; |
| 514 |
|
| 515 |
|
| 516 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0031-1]} |
| 517 |
@ChgAdded{Version=[3],Text=[ @key[procedure] @AdaSubDefn{Find_Token} (Source : @key[in] String; |
| 518 |
Set : @key[in] Maps.Character_Set; |
| 519 |
From : @key[in] Positive; |
| 520 |
Test : @key[in] Membership; |
| 521 |
First : @key[out] Positive; |
| 522 |
Last : @key[out] Natural);]} |
| 523 |
|
| 524 |
@key[procedure] @AdaSubDefn{Find_Token} (Source : @key[in] String; |
| 525 |
Set : @key[in] Maps.Character_Set; |
| 526 |
Test : @key[in] Membership; |
| 527 |
First : @key[out] Positive; |
| 528 |
Last : @key[out] Natural); |
| 529 |
|
| 530 |
|
| 531 |
@Keepnext@;--@Examcom{ String translation subprograms} |
| 532 |
|
| 533 |
@key[function] @AdaSubDefn{Translate} (Source : @key[in] String; |
| 534 |
Mapping : @key[in] Maps.Character_Mapping) |
| 535 |
@key[return] String; |
| 536 |
|
| 537 |
@key[procedure] @AdaSubDefn{Translate} (Source : @key[in] @key[out] String; |
| 538 |
Mapping : @key[in] Maps.Character_Mapping); |
| 539 |
|
| 540 |
|
| 541 |
@key[function] @AdaSubDefn{Translate} (Source : @key[in] String; |
| 542 |
Mapping : @key[in] Maps.Character_Mapping_Function) |
| 543 |
@key[return] String; |
| 544 |
|
| 545 |
@key[procedure] @AdaSubDefn{Translate} (Source : @key[in] @key[out] String; |
| 546 |
Mapping : @key[in] Maps.Character_Mapping_Function); |
| 547 |
|
| 548 |
@Keepnext@;--@Examcom{ String transformation subprograms} |
| 549 |
|
| 550 |
@key[function] @AdaSubDefn{Replace_Slice} (Source : @key[in] String; |
| 551 |
Low : @key[in] Positive; |
| 552 |
High : @key[in] Natural; |
| 553 |
By : @key[in] String) |
| 554 |
@key[return] String; |
| 555 |
|
| 556 |
@key[procedure] @AdaSubDefn{Replace_Slice} (Source : @key[in] @key[out] String; |
| 557 |
Low : @key[in] Positive; |
| 558 |
High : @key[in] Natural; |
| 559 |
By : @key[in] String; |
| 560 |
Drop : @key[in] Truncation := Error; |
| 561 |
Justify : @key[in] Alignment := Left; |
| 562 |
Pad : @key[in] Character := Space); |
| 563 |
|
| 564 |
|
| 565 |
@key[function] @AdaSubDefn{Insert} (Source : @key[in] String; |
| 566 |
Before : @key[in] Positive; |
| 567 |
New_Item : @key[in] String) |
| 568 |
@key[return] String; |
| 569 |
|
| 570 |
@key[procedure] @AdaSubDefn{Insert} (Source : @key[in] @key[out] String; |
| 571 |
Before : @key[in] Positive; |
| 572 |
New_Item : @key[in] String; |
| 573 |
Drop : @key[in] Truncation := Error); |
| 574 |
|
| 575 |
|
| 576 |
@key[function] @AdaSubDefn{Overwrite} (Source : @key[in] String; |
| 577 |
Position : @key[in] Positive; |
| 578 |
New_Item : @key[in] String) |
| 579 |
@key[return] String; |
| 580 |
|
| 581 |
@key[procedure] @AdaSubDefn{Overwrite} (Source : @key[in] @key[out] String; |
| 582 |
Position : @key[in] Positive; |
| 583 |
New_Item : @key[in] String; |
| 584 |
Drop : @key[in] Truncation := Right); |
| 585 |
|
| 586 |
|
| 587 |
@key[function] @AdaSubDefn{Delete} (Source : @key[in] String; |
| 588 |
From : @key[in] Positive; |
| 589 |
Through : @key[in] Natural) |
| 590 |
@key[return] String; |
| 591 |
|
| 592 |
@key[procedure] @AdaSubDefn{Delete} (Source : @key[in] @key[out] String; |
| 593 |
From : @key[in] Positive; |
| 594 |
Through : @key[in] Natural; |
| 595 |
Justify : @key[in] Alignment := Left; |
| 596 |
Pad : @key[in] Character := Space); |
| 597 |
|
| 598 |
--@Examcom{String selector subprograms} |
| 599 |
@key[function] @AdaSubDefn{Trim} (Source : @key[in] String; |
| 600 |
Side : @key[in] Trim_End) |
| 601 |
@key[return] String; |
| 602 |
|
| 603 |
@key[procedure] @AdaSubDefn{Trim} (Source : @key[in] @key[out] String; |
| 604 |
Side : @key[in] Trim_End; |
| 605 |
Justify : @key[in] Alignment := Left; |
| 606 |
Pad : @key[in] Character := Space); |
| 607 |
|
| 608 |
@key[function] @AdaSubDefn{Trim} (Source : @key[in] String; |
| 609 |
Left : @key[in] Maps.Character_Set; |
| 610 |
Right : @key[in] Maps.Character_Set) |
| 611 |
@key[return] String; |
| 612 |
|
| 613 |
@key[procedure] @AdaSubDefn{Trim} (Source : @key[in] @key[out] String; |
| 614 |
Left : @key[in] Maps.Character_Set; |
| 615 |
Right : @key[in] Maps.Character_Set; |
| 616 |
Justify : @key[in] Alignment := Strings.Left; |
| 617 |
Pad : @key[in] Character := Space); |
| 618 |
|
| 619 |
|
| 620 |
@key[function] @AdaSubDefn{Head} (Source : @key[in] String; |
| 621 |
Count : @key[in] Natural; |
| 622 |
Pad : @key[in] Character := Space) |
| 623 |
@key[return] String; |
| 624 |
|
| 625 |
@key[procedure] @AdaSubDefn{Head} (Source : @key[in] @key[out] String; |
| 626 |
Count : @key[in] Natural; |
| 627 |
Justify : @key[in] Alignment := Left; |
| 628 |
Pad : @key[in] Character := Space); |
| 629 |
|
| 630 |
@key[function] @AdaSubDefn{Tail} (Source : @key[in] String; |
| 631 |
Count : @key[in] Natural; |
| 632 |
Pad : @key[in] Character := Space) |
| 633 |
@key[return] String; |
| 634 |
|
| 635 |
@key[procedure] @AdaSubDefn{Tail} (Source : @key[in] @key[out] String; |
| 636 |
Count : @key[in] Natural; |
| 637 |
Justify : @key[in] Alignment := Left; |
| 638 |
Pad : @key[in] Character := Space); |
| 639 |
|
| 640 |
@keepnext@;--@Examcom{String constructor functions} |
| 641 |
|
| 642 |
@key[function] "*" (Left : @key[in] Natural; |
| 643 |
Right : @key[in] Character) @key[return] String; |
| 644 |
|
| 645 |
@key[function] "*" (Left : @key[in] Natural; |
| 646 |
Right : @key[in] String) @key[return] String; |
| 647 |
|
| 648 |
@key[end] Ada.Strings.Fixed; |
| 649 |
@end{example} |
| 650 |
|
| 651 |
The effects of the above subprograms are as follows. |
| 652 |
@begin{DescribeCode} |
| 653 |
@begin{Example}@Keepnext |
| 654 |
@key[procedure] Move (Source : @key[in] String; |
| 655 |
Target : @key[out] String; |
| 656 |
Drop : @key[in] Truncation := Error; |
| 657 |
Justify : @key[in] Alignment := Left; |
| 658 |
Pad : @key[in] Character := Space); |
| 659 |
@end{Example} |
| 660 |
@Leading@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0264-1]} |
| 661 |
The Move procedure copies characters from Source to Target. |
| 662 |
If Source has the same length as Target, then the effect is |
| 663 |
to assign Source to Target. |
| 664 |
If Source is shorter than Target@Chg{Version=[3],New=[,],Old=[]} then: |
| 665 |
@begin{itemize} |
| 666 |
If Justify=Left, then Source is copied into the first Source'Length |
| 667 |
characters of Target. |
| 668 |
|
| 669 |
If Justify=Right, then Source is copied into the last Source'Length |
| 670 |
characters of Target. |
| 671 |
|
| 672 |
If Justify=Center, then Source is copied into |
| 673 |
the middle Source'Length characters of Target. |
| 674 |
In this case, if the difference in length between |
| 675 |
Target and Source is odd, then the extra Pad character |
| 676 |
is on the right. |
| 677 |
|
| 678 |
Pad is copied to each Target character not otherwise assigned. |
| 679 |
@end{itemize} |
| 680 |
|
| 681 |
If Source is longer than Target, then the effect is based on |
| 682 |
Drop. |
| 683 |
@begin{itemize} |
| 684 |
If Drop=Left, then the rightmost Target'Length characters |
| 685 |
of Source are copied into Target. |
| 686 |
|
| 687 |
If Drop=Right, then the leftmost Target'Length characters |
| 688 |
of Source are copied into Target. |
| 689 |
|
| 690 |
@Leading@;If Drop=Error, then the effect depends on the value of the Justify |
| 691 |
parameter and also on whether any characters in Source other than |
| 692 |
Pad would fail to be copied: |
| 693 |
@begin{inneritemize} |
| 694 |
If Justify=Left, and if each of the rightmost Source'Length-Target'Length |
| 695 |
characters in Source is Pad, then the leftmost Target'Length characters |
| 696 |
of Source are copied to Target. |
| 697 |
|
| 698 |
If Justify=Right, and if each of the leftmost Source'Length-Target'Length |
| 699 |
characters in Source is Pad, then the rightmost Target'Length characters |
| 700 |
of Source are copied to Target. |
| 701 |
|
| 702 |
@Trailing@;Otherwise, Length_Error is propagated. |
| 703 |
@end{inneritemize} |
| 704 |
@end{itemize} |
| 705 |
@begin{ramification} |
| 706 |
The Move procedure will work even if Source and Target |
| 707 |
overlap.@end{ramification} |
| 708 |
@begin{reason} |
| 709 |
The order of parameters (Source before Target) |
| 710 |
corresponds to the order in COBOL's MOVE verb.@end{reason} |
| 711 |
|
| 712 |
@begin{Example} |
| 713 |
@ChgRef{Version=[2],Kind=[Added]} |
| 714 |
@ChgAdded{Version=[2],Text=[@key[function] Index (Source : @key[in] String; |
| 715 |
Pattern : @key[in] String; |
| 716 |
From : @key[in] Positive; |
| 717 |
Going : @key[in] Direction := Forward; |
| 718 |
Mapping : @key[in] Maps.Character_Mapping := Maps.Identity) |
| 719 |
@key[return] Natural;@* |
| 720 |
@key[function] Index (Source : @key[in] String; |
| 721 |
Pattern : @key[in] String; |
| 722 |
From : @key[in] Positive; |
| 723 |
Going : @key[in] Direction := Forward; |
| 724 |
Mapping : @key[in] Maps.Character_Mapping_Function) |
| 725 |
@key[return] Natural;]} |
| 726 |
@end{Example} |
| 727 |
|
| 728 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 729 |
@ChgRef{Version=[3],Kind=[RevisedAdded],ARef=[AI05-0056-1]} |
| 730 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Each Index function searches, starting from From, for a slice of |
| 731 |
Source, with length Pattern'Length, that matches Pattern with respect to |
| 732 |
Mapping; the parameter Going indicates the direction of the lookup. |
| 733 |
@Chg{Version=[3],New=[If Source is the null string, Index returns 0; |
| 734 |
otherwise, if],Old=[If]} |
| 735 |
From is not in Source'Range, then Index_Error is propagated. If Going = |
| 736 |
Forward, then Index returns the smallest index I which is greater than or equal |
| 737 |
to From such that the slice of Source starting at I matches Pattern. If Going = |
| 738 |
Backward, then Index returns the largest index I such that the slice of Source |
| 739 |
starting at I matches Pattern and has an upper bound less than or equal to |
| 740 |
From. If there is no such slice, then 0 is returned. If Pattern is the null |
| 741 |
string, then Pattern_Error is propagated.]} |
| 742 |
|
| 743 |
@begin{Discussion} |
| 744 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 745 |
@ChgAdded{Version=[2],Text=[There is no default parameter for From; the |
| 746 |
default value would need to depend on other parameters (the bounds of Source |
| 747 |
and the direction Going). It is better to use overloaded functions rather |
| 748 |
than a special value to represent the default.]} |
| 749 |
|
| 750 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 751 |
@ChgAdded{Version=[2],Text=[There is no default value for the Mapping |
| 752 |
parameter that is a Character_Mapping_Function; if there were, a call would |
| 753 |
be ambiguous since there is also a default for the Mapping parameter that is |
| 754 |
a Character_Mapping.]} |
| 755 |
|
| 756 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0056-1]} |
| 757 |
@ChgAdded{Version=[3],Text=[The language does not define when the |
| 758 |
Pattern_Error check is made. (That's because many common searching |
| 759 |
implementations require a nonempty pattern) That means that the result for |
| 760 |
a call like @f{Index ("", "")} could be 0 or could raise Pattern_Error. |
| 761 |
Similarly, in the call @f{Index ("", "", From => 2)}, the language does not |
| 762 |
define whether Pattern_Error or Index_Error is raised.]} |
| 763 |
|
| 764 |
@end{Discussion} |
| 765 |
|
| 766 |
@begin{Example}@Keepnext |
| 767 |
@key[function] Index (Source : @key[in] String; |
| 768 |
Pattern : @key[in] String; |
| 769 |
Going : @key[in] Direction := Forward; |
| 770 |
Mapping : @key[in] Maps.Character_Mapping |
| 771 |
:= Maps.Identity) |
| 772 |
@key[return] Natural;@* |
| 773 |
@key[function] Index (Source : @key[in] String; |
| 774 |
Pattern : @key[in] String; |
| 775 |
Going : @key[in] Direction := Forward; |
| 776 |
Mapping : @key[in] Maps.Character_Mapping_Function) |
| 777 |
@key[return] Natural; |
| 778 |
@end{Example} |
| 779 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00301-01]} |
| 780 |
@Comment{@ChgDeleted{Version=[2],Type=[Trailing],Text=[]}@Comment{Fake to hold conditional format.}Can't have both.} |
| 781 |
@ChgAdded{Version=[2],Type=[Leading],Text=[]}@Comment{Fake to hold conditional format.} |
| 782 |
@Chg{Version=[2],New=[If Going = Forward, returns], |
| 783 |
Old=[Each Index function searches for a slice of Source, with length |
| 784 |
Pattern'Length, that matches Pattern |
| 785 |
with respect to Mapping; |
| 786 |
the parameter Going indicates the direction of the lookup. |
| 787 |
If Going = Forward, then Index |
| 788 |
returns the smallest index I such that |
| 789 |
the slice of Source starting at I matches Pattern. |
| 790 |
If Going = Backward, then Index |
| 791 |
returns the largest index I such that |
| 792 |
the slice of Source starting at I matches Pattern. |
| 793 |
If there is no such slice, then 0 is returned. |
| 794 |
If Pattern is the null string then Pattern_Error is propagated.]} |
| 795 |
@begin{Example} |
| 796 |
@ChgRef{Version=[2],Kind=[Added]} |
| 797 |
@ChgAdded{Version=[2],Text=[ Index (Source, Pattern, Source'First, Forward, Mapping);]} |
| 798 |
@end{Example} |
| 799 |
@ChgRef{Version=[2],Kind=[Added]} |
| 800 |
@ChgRef{Version=[3],Kind=[RevisedAdded],ARef=[AI05-0264-1]} |
| 801 |
@ChgAdded{Version=[2],Type=[Leading],Text=[otherwise@Chg{Version=[3],New=[,],Old=[]} returns]} |
| 802 |
@begin{Example} |
| 803 |
@ChgRef{Version=[2],Kind=[Added]} |
| 804 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[ Index (Source, Pattern, Source'Last, Backward, Mapping);]} |
| 805 |
@end{Example} |
| 806 |
@begin{discussion} |
| 807 |
@ChgRef{Version=[2],Kind=[Deleted]}@ChgNote{Moved up} |
| 808 |
@ChgAdded{Version=[2],Text=[There is no default value for the Mapping |
| 809 |
parameter that is a Character_Mapping_Function; if there were, a call would |
| 810 |
be ambiguous since there is also a default for the Mapping parameter that is |
| 811 |
a Character_Mapping.]} |
| 812 |
@end{discussion} |
| 813 |
|
| 814 |
@begin{Example} |
| 815 |
@ChgRef{Version=[2],Kind=[Added]} |
| 816 |
@ChgAdded{Version=[2],Text=[@key[function] Index (Source : @key[in] String; |
| 817 |
Set : @key[in] Maps.Character_Set; |
| 818 |
From : @key[in] Positive; |
| 819 |
Test : @key[in] Membership := Inside; |
| 820 |
Going : @key[in] Direction := Forward) |
| 821 |
@key[return] Natural;]} |
| 822 |
@end{Example} |
| 823 |
|
| 824 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 825 |
@ChgRef{Version=[3],Kind=[RevisedAdded],ARef=[AI05-0056-1]} |
| 826 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Index searches for the first or |
| 827 |
last occurrence of any of a set of characters (when Test=Inside), or any of the |
| 828 |
complement of a set of characters (when Test=Outside). |
| 829 |
@Chg{Version=[3],New=[If Source is the null string, Index returns 0; |
| 830 |
otherwise, if],Old=[If]} From is not in |
| 831 |
Source'Range, then Index_Error is propagated. Otherwise, it returns the |
| 832 |
smallest index I >= From (if Going=Forward) or the largest index I <= From (if |
| 833 |
Going=Backward) such that Source(I) satisfies the Test condition with respect |
| 834 |
to Set; it returns 0 if there is no such Character in Source.]} |
| 835 |
|
| 836 |
@begin{Example}@Keepnext |
| 837 |
@key[function] Index (Source : @key[in] String; |
| 838 |
Set : @key[in] Maps.Character_Set; |
| 839 |
Test : @key[in] Membership := Inside; |
| 840 |
Going : @key[in] Direction := Forward) |
| 841 |
@key[return] Natural; |
| 842 |
@end{Example} |
| 843 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00301-01]} |
| 844 |
@Comment{@ChgDeleted{Version=[2],Type=[Trailing],Text=[]}@Comment{Fake to hold conditional format.}Can't have both.} |
| 845 |
@ChgAdded{Version=[2],Type=[Leading],Text=[]}@Comment{Fake to hold conditional format.} |
| 846 |
@Chg{Version=[2],New=[If Going = Forward, returns], |
| 847 |
Old=[Index searches for the first or last occurrence of any of a set of |
| 848 |
characters (when Test=Inside), |
| 849 |
or any of the complement of a set of characters (when Test=Outside). |
| 850 |
It returns the smallest index I (if Going=Forward) or the largest index I |
| 851 |
(if Going=Backward) such that |
| 852 |
Source(I) satisfies the Test condition with respect to Set; |
| 853 |
it returns 0 if there is no such Character in Source.]} |
| 854 |
@begin{Example} |
| 855 |
@ChgRef{Version=[2],Kind=[Added]} |
| 856 |
@ChgAdded{Version=[2],Text=[ Index (Source, Set, Source'First, Test, Forward);]} |
| 857 |
@end{Example} |
| 858 |
@ChgRef{Version=[2],Kind=[Added]} |
| 859 |
@ChgRef{Version=[3],Kind=[RevisedAdded],ARef=[AI05-0264-1]} |
| 860 |
@ChgAdded{Version=[2],Type=[Leading],Text=[otherwise@Chg{Version=[3],New=[,],Old=[]} returns]} |
| 861 |
@begin{Example} |
| 862 |
@ChgRef{Version=[2],Kind=[Added]} |
| 863 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[ Index (Source, Set, Source'Last, Test, Backward);]} |
| 864 |
@end{Example} |
| 865 |
|
| 866 |
@begin{Example} |
| 867 |
@ChgRef{Version=[2],Kind=[Added]} |
| 868 |
@ChgAdded{Version=[2],Text=[@key[function] Index_Non_Blank (Source : @key[in] String; |
| 869 |
From : @key[in] Positive; |
| 870 |
Going : @key[in] Direction := Forward) |
| 871 |
@key[return] Natural;]} |
| 872 |
@end{Example} |
| 873 |
|
| 874 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 875 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns Index (Source, Maps.To_Set(Space), From, Outside, Going);]} |
| 876 |
|
| 877 |
@begin{Example}@Keepnext |
| 878 |
@key[function] Index_Non_Blank (Source : @key[in] String; |
| 879 |
Going : @key[in] Direction := Forward) |
| 880 |
@key[return] Natural; |
| 881 |
@end{Example} |
| 882 |
@Trailing@;Returns Index(Source, Maps.To_Set(Space), Outside, Going) |
| 883 |
|
| 884 |
@begin{Example}@Keepnext |
| 885 |
@key[function] Count (Source : @key[in] String; |
| 886 |
Pattern : @key[in] String; |
| 887 |
Mapping : @key[in] Maps.Character_Mapping |
| 888 |
:= Maps.Identity) |
| 889 |
@key[return] Natural;@* |
| 890 |
@key[function] Count (Source : @key[in] String; |
| 891 |
Pattern : @key[in] String; |
| 892 |
Mapping : @key[in] Maps.Character_Mapping_Function) |
| 893 |
@key[return] Natural; |
| 894 |
@end{Example} |
| 895 |
@Trailing@;Returns the maximum number of nonoverlapping slices of Source that |
| 896 |
match Pattern with respect to Mapping. |
| 897 |
If Pattern is the null string then Pattern_Error is propagated. |
| 898 |
@begin{reason} |
| 899 |
We say `maximum number' because it is possible to slice a source |
| 900 |
string in different ways yielding different numbers of matches. For |
| 901 |
example if Source is "ABABABA" and Pattern is "ABA", then Count yields |
| 902 |
2, although there is a partitioning of Source that yields just 1 match, |
| 903 |
for the middle slice. Saying `maximum number' is equivalent to saying |
| 904 |
that the pattern match starts either at the low index or the high index |
| 905 |
position. |
| 906 |
@end{reason} |
| 907 |
|
| 908 |
@begin{Example}@Keepnext |
| 909 |
@key[function] Count (Source : @key[in] String; |
| 910 |
Set : @key[in] Maps.Character_Set) |
| 911 |
@key[return] Natural; |
| 912 |
@end{Example} |
| 913 |
@Trailing@;Returns the number of occurrences in Source of characters that |
| 914 |
are in Set. |
| 915 |
|
| 916 |
@begin{Example} |
| 917 |
@ChgRef{Version=[3],Kind=[Added]} |
| 918 |
@ChgAdded{Version=[3],Text=[@key[procedure] Find_Token (Source : @key[in] String; |
| 919 |
Set : @key[in] Maps.Character_Set; |
| 920 |
From : @key[in] Positive; |
| 921 |
Test : @key[in] Membership; |
| 922 |
First : @key[out] Positive; |
| 923 |
Last : @key[out] Natural);]} |
| 924 |
@end{Example} |
| 925 |
|
| 926 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0031-1]} |
| 927 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[If Source is not the null string and |
| 928 |
From is not in Source'Range, then Index_Error is raised. Otherwise, First is set |
| 929 |
to the index of the first character in Source(From .. Source'Last) that |
| 930 |
satisfies the Test condition. Last is set to the largest index such that all |
| 931 |
characters in Source(First .. Last) satisfy the Test condition. If no characters |
| 932 |
in Source(From .. Source'Last) satisfy the Test condition, First is set to From, |
| 933 |
and Last is set to 0.]} |
| 934 |
|
| 935 |
@begin{Example}@Keepnext |
| 936 |
@key[procedure] Find_Token (Source : @key[in] String; |
| 937 |
Set : @key[in] Maps.Character_Set; |
| 938 |
Test : @key[in] Membership; |
| 939 |
First : @key[out] Positive; |
| 940 |
Last : @key[out] Natural); |
| 941 |
@end{Example} |
| 942 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0049],ARef=[AI95-00128-01]} |
| 943 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0031-1]} |
| 944 |
@Trailing@;@Chg{Version=[3],New=[Equivalent to Find_Token (Source, Set, |
| 945 |
Source'First, Test, First, Last).],Old=[Find_Token returns in |
| 946 |
First and Last the indices of the beginning |
| 947 |
and end of the first slice of Source all of whose elements |
| 948 |
satisfy the Test condition, and such that the elements |
| 949 |
(if any) immediately before and after the slice do not |
| 950 |
satisfy the Test condition. |
| 951 |
If no such slice exists, then the value returned for Last is zero, and |
| 952 |
the value returned for First is Source'First@Chg{New=[; however, if |
| 953 |
Source'First is not in Positive then Constraint_Error |
| 954 |
is raised],Old=[]}.]} |
| 955 |
|
| 956 |
@begin{Ramification} |
| 957 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0031-1]} |
| 958 |
@ChgAdded{Version=[3],Text=[If Source'First is not in Positive, which can only |
| 959 |
happen for an empty string, this will raise Constraint_Error.]} |
| 960 |
@end{Ramification} |
| 961 |
|
| 962 |
@begin{Example}@Keepnext |
| 963 |
@key[function] Translate (Source : @key[in] String; |
| 964 |
Mapping : @key[in] Maps.Character_Mapping) |
| 965 |
@key[return] String;@* |
| 966 |
@key[function] Translate (Source : @key[in] String; |
| 967 |
Mapping : @key[in] Maps.Character_Mapping_Function) |
| 968 |
@key[return] String; |
| 969 |
@end{Example} |
| 970 |
@Trailing@;Returns the string S whose length is Source'Length and such |
| 971 |
that S(I) is the character to which Mapping maps the corresponding |
| 972 |
element of Source, for I in 1..Source'Length. |
| 973 |
|
| 974 |
@begin{Example}@Keepnext |
| 975 |
@key[procedure] Translate (Source : @key[in] @key[out] String; |
| 976 |
Mapping : @key[in] Maps.Character_Mapping);@* |
| 977 |
@key[procedure] Translate (Source : @key[in] @key[out] String; |
| 978 |
Mapping : @key[in] Maps.Character_Mapping_Function); |
| 979 |
@end{Example} |
| 980 |
@Trailing@;Equivalent to Source := Translate(Source, Mapping). |
| 981 |
|
| 982 |
@begin{Example}@Keepnext |
| 983 |
@key[function] Replace_Slice (Source : @key[in] String; |
| 984 |
Low : @key[in] Positive; |
| 985 |
High : @key[in] Natural; |
| 986 |
By : @key[in] String) |
| 987 |
@key[return] String; |
| 988 |
@end{Example} |
| 989 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0049],ARef=[AI95-00128-01]} |
| 990 |
@Chg{New=[@Leading],Old=[@Trailing]}If Low > Source'Last+1, or |
| 991 |
High < Source'First@en@;1, then Index_Error is propagated. |
| 992 |
Otherwise@Chg{New=[:],Old=[, if High >= Low then the returned string |
| 993 |
comprises Source(Source'First..Low@en@;1) & By & Source(High+1..Source'Last), |
| 994 |
and if High < Low then the returned string is |
| 995 |
Insert(Source, Before=>Low, New_Item=>By).]} |
| 996 |
|
| 997 |
@begin{Itemize} |
| 998 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0049],ARef=[AI95-00128-01]} |
| 999 |
@ChgAdded{Version=[1],Text=[If High >= Low, then the returned string comprises |
| 1000 |
Source(Source'First..Low@en@;1) & By & Source(High+1..Source'Last), but with |
| 1001 |
lower bound 1.@Trailing]} |
| 1002 |
|
| 1003 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0049],ARef=[AI95-00128-01]} |
| 1004 |
@ChgAdded{Version=[1],Text=[If High < Low, then the returned string is |
| 1005 |
Insert(Source, Before=>Low, New_Item=>By).]} |
| 1006 |
@end{Itemize} |
| 1007 |
|
| 1008 |
@begin{Example}@Keepnext |
| 1009 |
@key[procedure] Replace_Slice (Source : @key[in] @key[out] String; |
| 1010 |
Low : @key[in] Positive; |
| 1011 |
High : @key[in] Natural; |
| 1012 |
By : @key[in] String; |
| 1013 |
Drop : @key[in] Truncation := Error; |
| 1014 |
Justify : @key[in] Alignment := Left; |
| 1015 |
Pad : @key[in] Character := Space); |
| 1016 |
@end{Example} |
| 1017 |
@Trailing@;Equivalent to Move(Replace_Slice(Source, Low, High, |
| 1018 |
By), Source, Drop, Justify, Pad). |
| 1019 |
|
| 1020 |
@begin{Example}@Keepnext |
| 1021 |
@key[function] Insert (Source : @key[in] String; |
| 1022 |
Before : @key[in] Positive; |
| 1023 |
New_Item : @key[in] String) |
| 1024 |
@key[return] String; |
| 1025 |
@end{Example} |
| 1026 |
@Trailing@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0264-1]} |
| 1027 |
Propagates Index_Error if Before is not in Source'First .. Source'Last+1; |
| 1028 |
otherwise@Chg{Version=[3],New=[,],Old=[]} |
| 1029 |
returns Source(Source'First..Before@en@;1) & New_Item & |
| 1030 |
Source(Before..Source'Last), but with lower bound 1. |
| 1031 |
|
| 1032 |
|
| 1033 |
@begin{Example}@Keepnext |
| 1034 |
@key[procedure] Insert (Source : @key[in] @key[out] String; |
| 1035 |
Before : @key[in] Positive; |
| 1036 |
New_Item : @key[in] String; |
| 1037 |
Drop : @key[in] Truncation := Error); |
| 1038 |
@end{Example} |
| 1039 |
@Trailing@;Equivalent to Move(Insert(Source, Before, New_Item), Source, Drop). |
| 1040 |
|
| 1041 |
@begin{Example}@Keepnext |
| 1042 |
@key[function] Overwrite (Source : @key[in] String; |
| 1043 |
Position : @key[in] Positive; |
| 1044 |
New_Item : @key[in] String) |
| 1045 |
@key[return] String; |
| 1046 |
@end{Example} |
| 1047 |
@Trailing@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0264-1]} |
| 1048 |
Propagates Index_Error if Position is not in Source'First .. Source'Last+1; |
| 1049 |
otherwise@Chg{Version=[3],New=[,],Old=[]} |
| 1050 |
returns the string obtained from Source by consecutively replacing |
| 1051 |
characters starting at Position with corresponding characters from |
| 1052 |
New_Item. If the end of Source is reached before the characters in |
| 1053 |
New_Item are exhausted, the remaining characters from New_Item are |
| 1054 |
appended to the string. |
| 1055 |
|
| 1056 |
@begin{Example}@Keepnext |
| 1057 |
@key[procedure] Overwrite (Source : @key[in] @key[out] String; |
| 1058 |
Position : @key[in] Positive; |
| 1059 |
New_Item : @key[in] String; |
| 1060 |
Drop : @key[in] Truncation := Right); |
| 1061 |
@end{Example} |
| 1062 |
@Trailing@;Equivalent to Move(Overwrite(Source, Position, |
| 1063 |
New_Item), Source, Drop). |
| 1064 |
|
| 1065 |
@begin{Example}@Keepnext |
| 1066 |
@key[function] Delete (Source : @key[in] String; |
| 1067 |
From : @key[in] Positive; |
| 1068 |
Through : @key[in] Natural) |
| 1069 |
@key[return] String; |
| 1070 |
@end{Example} |
| 1071 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0049],ARef=[AI95-00128-01]} |
| 1072 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0264-1]} |
| 1073 |
@Trailing@;If From <= Through, the returned string is Replace_Slice(Source, From, |
| 1074 |
Through, "")@Chg{Version=[3],New=[;],Old=[,]} |
| 1075 |
otherwise@Chg{Version=[3],New=[,],Old=[]} it is Source@Chg{New=[ with lower |
| 1076 |
bound 1],Old=[]}. |
| 1077 |
|
| 1078 |
@begin{Example}@Keepnext |
| 1079 |
@key[procedure] Delete (Source : @key[in] @key[out] String; |
| 1080 |
From : @key[in] Positive; |
| 1081 |
Through : @key[in] Natural; |
| 1082 |
Justify : @key[in] Alignment := Left; |
| 1083 |
Pad : @key[in] Character := Space); |
| 1084 |
@end{Example} |
| 1085 |
@Trailing@;Equivalent to Move(Delete(Source, From, Through), |
| 1086 |
Source, Justify => Justify, Pad => Pad). |
| 1087 |
|
| 1088 |
@begin{Example}@Keepnext |
| 1089 |
@key[function] Trim (Source : @key[in] String; |
| 1090 |
Side : @key[in] Trim_End) |
| 1091 |
@key[return] String; |
| 1092 |
@end{Example} |
| 1093 |
@Trailing@;Returns the string obtained by removing from Source all leading |
| 1094 |
Space characters (if Side = Left), all trailing Space characters |
| 1095 |
(if Side = Right), or all leading and trailing Space characters |
| 1096 |
(if Side = Both). |
| 1097 |
|
| 1098 |
@begin{Example}@Keepnext |
| 1099 |
@key[procedure] Trim (Source : @key[in] @key[out] String; |
| 1100 |
Side : @key[in] Trim_End; |
| 1101 |
Justify : @key[in] Alignment := Left; |
| 1102 |
Pad : @key[in] Character := Space); |
| 1103 |
@end{Example} |
| 1104 |
@Trailing@;Equivalent to Move(Trim(Source, Side), Source, Justify=>Justify, Pad=>Pad). |
| 1105 |
|
| 1106 |
@begin{Example}@Keepnext |
| 1107 |
@key[function] Trim (Source : @key[in] String; |
| 1108 |
Left : @key[in] Maps.Character_Set; |
| 1109 |
Right : @key[in] Maps.Character_Set) |
| 1110 |
@key[return] String; |
| 1111 |
@end{Example} |
| 1112 |
@Trailing@;Returns the string obtained by removing from Source all leading |
| 1113 |
characters in Left and all trailing characters in Right. |
| 1114 |
|
| 1115 |
@begin{Example}@Keepnext |
| 1116 |
@key[procedure] Trim (Source : @key[in] @key[out] String; |
| 1117 |
Left : @key[in] Maps.Character_Set; |
| 1118 |
Right : @key[in] Maps.Character_Set; |
| 1119 |
Justify : @key[in] Alignment := Strings.Left; |
| 1120 |
Pad : @key[in] Character := Space); |
| 1121 |
@end{Example} |
| 1122 |
@Trailing@;Equivalent to Move(Trim(Source, Left, Right), Source, |
| 1123 |
Justify => Justify, Pad=>Pad). |
| 1124 |
|
| 1125 |
@begin{Example}@Keepnext |
| 1126 |
@key[function] Head (Source : @key[in] String; |
| 1127 |
Count : @key[in] Natural; |
| 1128 |
Pad : @key[in] Character := Space) |
| 1129 |
@key[return] String; |
| 1130 |
@end{Example} |
| 1131 |
@Trailing@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0264-1]} |
| 1132 |
Returns a string of length Count. If Count <= Source'Length, the |
| 1133 |
string comprises the first Count characters of Source. |
| 1134 |
Otherwise@Chg{Version=[3],New=[,],Old=[]} its contents |
| 1135 |
are Source concatenated with Count@en@;Source'Length Pad characters. |
| 1136 |
|
| 1137 |
@begin{Example}@Keepnext |
| 1138 |
@key[procedure] Head (Source : @key[in] @key[out] String; |
| 1139 |
Count : @key[in] Natural; |
| 1140 |
Justify : @key[in] Alignment := Left; |
| 1141 |
Pad : @key[in] Character := Space); |
| 1142 |
@end{Example} |
| 1143 |
@Trailing@;Equivalent to Move(Head(Source, Count, Pad), Source, Drop=>Error, |
| 1144 |
Justify=>Justify, Pad=>Pad). |
| 1145 |
|
| 1146 |
@begin{Example}@Keepnext |
| 1147 |
@key[function] Tail (Source : @key[in] String; |
| 1148 |
Count : @key[in] Natural; |
| 1149 |
Pad : @key[in] Character := Space) |
| 1150 |
@key[return] String; |
| 1151 |
@end{Example} |
| 1152 |
@Trailing@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0264-1]} |
| 1153 |
Returns a string of length Count. If Count <= Source'Length, the |
| 1154 |
string comprises the last Count characters of Source. |
| 1155 |
Otherwise@Chg{Version=[3],New=[,],Old=[]} its contents |
| 1156 |
are Count-Source'Length Pad characters concatenated with Source. |
| 1157 |
|
| 1158 |
@begin{Example}@Keepnext |
| 1159 |
@key[procedure] Tail (Source : @key[in] @key[out] String; |
| 1160 |
Count : @key[in] Natural; |
| 1161 |
Justify : @key[in] Alignment := Left; |
| 1162 |
Pad : @key[in] Character := Space); |
| 1163 |
@end{Example} |
| 1164 |
@Trailing@;Equivalent to Move(Tail(Source, Count, Pad), Source, Drop=>Error, |
| 1165 |
Justify=>Justify, Pad=>Pad). |
| 1166 |
|
| 1167 |
@begin{Example}@Keepnext |
| 1168 |
@key[function] "*" (Left : @key[in] Natural; |
| 1169 |
Right : @key[in] Character) @key[return] String;@* |
| 1170 |
@key[function] "*" (Left : @key[in] Natural; |
| 1171 |
Right : @key[in] String) @key[return] String; |
| 1172 |
@end{Example} |
| 1173 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0049],ARef=[AI95-00128-01]} |
| 1174 |
These functions replicate a character or string a specified number |
| 1175 |
of times. The first function returns a string whose length is Left and each |
| 1176 |
of whose elements is Right. The second function returns a string whose |
| 1177 |
length is Left*Right'Length and whose value is the null |
| 1178 |
string if Left = 0 and @Chg{New=[otherwise ],Old=[]}is |
| 1179 |
(Left@en@;1)*Right & Right @Chg{New=[with lower bound 1],Old=[otherwise]}. |
| 1180 |
@end{DescribeCode} |
| 1181 |
@end{StaticSem} |
| 1182 |
|
| 1183 |
@begin{Notes} |
| 1184 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0264-1]} |
| 1185 |
In the Index and Count functions taking Pattern and Mapping parameters, |
| 1186 |
the actual String parameter passed to Pattern should comprise characters |
| 1187 |
occurring as target characters of the mapping. |
| 1188 |
Otherwise@Chg{Version=[3],New=[,],Old=[]} the pattern will not match. |
| 1189 |
|
| 1190 |
In the Insert subprograms, inserting at the end of a string is obtained |
| 1191 |
by passing Source'Last+1 as the Before parameter. |
| 1192 |
|
| 1193 |
If a null Character_Mapping_Function is passed to any of the |
| 1194 |
string handling subprograms, Constraint_Error is propagated. |
| 1195 |
@end{Notes} |
| 1196 |
|
| 1197 |
@begin{Incompatible95} |
| 1198 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00301-01]} |
| 1199 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0005-1]} |
| 1200 |
@ChgAdded{Version=[2],Text=[@Defn{incompatibilities with Ada 95} |
| 1201 |
Overloaded versions of Index and Index_Non_Blank are |
| 1202 |
@Chg{Version=[3],New=[],Old=[newly ]}added to |
| 1203 |
Strings.Fixed. If Strings.Fixed is referenced in a @nt{use_clause}, and an |
| 1204 |
entity @i<E> with a @nt{defining_identifier} of Index or Index_Non_Blank is |
| 1205 |
defined in a package that is also referenced in a @nt{use_clause}, the entity |
| 1206 |
@i<E> may no longer be use-visible, resulting in errors. This should be rare |
| 1207 |
and is easily fixed if it does occur.]} |
| 1208 |
@end{Incompatible95} |
| 1209 |
|
| 1210 |
@begin{DiffWord95} |
| 1211 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0049],ARef=[AI95-00128-01]} |
| 1212 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Clarified that Find_Token |
| 1213 |
may raise Constraint_Error if Source'First is not in Positive (which is |
| 1214 |
only possible for a null string).]} |
| 1215 |
|
| 1216 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0049],ARef=[AI95-00128-01]} |
| 1217 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Clarified that Replace_Slice, |
| 1218 |
Delete, and "*" always return a string with lower bound 1.]} |
| 1219 |
@end{DiffWord95} |
| 1220 |
|
| 1221 |
@begin{Incompatible2005} |
| 1222 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0031-1]} |
| 1223 |
@ChgAdded{Version=[3],Text=[@Defn{incompatibilities with Ada 2005} |
| 1224 |
An overloaded version of Find_Token is added to |
| 1225 |
Strings.Fixed. If Strings.Fixed is referenced in a @nt{use_clause}, and an |
| 1226 |
entity @i<E> with a @nt{defining_identifier} of Find_Token is |
| 1227 |
defined in a package that is also referenced in a @nt{use_clause}, the entity |
| 1228 |
@i<E> may no longer be use-visible, resulting in errors. This should be rare |
| 1229 |
and is easily fixed if it does occur.]} |
| 1230 |
@end{Incompatible2005} |
| 1231 |
|
| 1232 |
@begin{DiffWord2005} |
| 1233 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0056-1]} |
| 1234 |
@ChgAdded{Version=[3],Text=[@b<Correction:> Clarified that Index |
| 1235 |
never raises Index_Error if the source string is null.]} |
| 1236 |
@end{DiffWord2005} |
| 1237 |
|
| 1238 |
|
| 1239 |
@LabeledSubClause{Bounded-Length String Handling} |
| 1240 |
@begin{Intro} |
| 1241 |
The language-defined package Strings.Bounded provides a generic package |
| 1242 |
each of whose instances yields a private type Bounded_String and a |
| 1243 |
set of operations. An object of a particular Bounded_String type |
| 1244 |
represents a String whose low bound is 1 and whose length |
| 1245 |
can vary conceptually |
| 1246 |
between 0 and a maximum size established at the |
| 1247 |
generic instantiation. |
| 1248 |
The subprograms for fixed-length string handling |
| 1249 |
are either overloaded directly for Bounded_String, or are modified as |
| 1250 |
needed to reflect the variability in length. Additionally, since the |
| 1251 |
Bounded_String type is private, appropriate constructor and selector |
| 1252 |
operations are provided. |
| 1253 |
@begin{reason} |
| 1254 |
Strings.Bounded declares an inner generic package, versus itself |
| 1255 |
being directly a generic child of Strings, in order to retain |
| 1256 |
compatibility with a version of the string-handling packages that |
| 1257 |
is generic with respect to the character and string types.@end{reason} |
| 1258 |
@begin{reason} |
| 1259 |
The bound of a bounded-length string is specified as a parameter |
| 1260 |
to a generic, versus as the value for a discriminant, because of the |
| 1261 |
inappropriateness of assignment and equality of discriminated types for |
| 1262 |
the copying and comparison of bounded strings.@end{reason} |
| 1263 |
@end{Intro} |
| 1264 |
|
| 1265 |
@begin{StaticSem} |
| 1266 |
@Leading@Keepnext@;The library package Strings.Bounded has the following declaration: |
| 1267 |
@begin{example} |
| 1268 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0241-1]} |
| 1269 |
@key[with] Ada.Strings.Maps; |
| 1270 |
@ChildUnit{Parent=[Ada.Strings],Child=[Bounded]}@key[package] Ada.Strings.Bounded@Chg{Version=[5],New=[],Old=[ @key[is]]} |
| 1271 |
@Chg{Version=[5],New=[@key[with]],Old=[@key[pragma]]} Preelaborate@Chg{Version=[5],New=[, Nonblocking @key[is]],Old=[(Bounded);]} |
| 1272 |
|
| 1273 |
|
| 1274 |
@key[generic] |
| 1275 |
Max : Positive; --@Examcom{ Maximum length of a Bounded_String} |
| 1276 |
@key[package] @AdaPackDefn{Generic_Bounded_Length} @key[is] |
| 1277 |
|
| 1278 |
@AdaObjDefn{Max_Length} : @key[constant] Positive := Max; |
| 1279 |
|
| 1280 |
@key[type] @AdaTypeDefn{Bounded_String} @key[is] @key[private]; |
| 1281 |
|
| 1282 |
@AdaObjDefn{Null_Bounded_String} : @key[constant] Bounded_String; |
| 1283 |
|
| 1284 |
@key[subtype] @AdaSubtypeDefn{Name=[Length_Range],Of=[Natural]} @key[is] Natural @key[range] 0 .. Max_Length; |
| 1285 |
|
| 1286 |
@key[function] @AdaSubDefn{Length} (Source : @key[in] Bounded_String) @key[return] Length_Range; |
| 1287 |
|
| 1288 |
|
| 1289 |
--@Examcom{ Conversion, Concatenation, and Selection functions} |
| 1290 |
|
| 1291 |
@key[function] @AdaSubDefn{To_Bounded_String} (Source : @key[in] String; |
| 1292 |
Drop : @key[in] Truncation := Error) |
| 1293 |
@key[return] Bounded_String; |
| 1294 |
|
| 1295 |
@key[function] @AdaSubDefn{To_String} (Source : @key[in] Bounded_String) @key[return] String; |
| 1296 |
|
| 1297 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 1298 |
@ChgAdded{Version=[2],Text=[ @key[procedure] @AdaSubDefn{Set_Bounded_String} |
| 1299 |
(Target : @key[out] Bounded_String; |
| 1300 |
Source : @key[in] String; |
| 1301 |
Drop : @key[in] Truncation := Error);]} |
| 1302 |
|
| 1303 |
@key[function] @AdaSubDefn{Append} (Left, Right : @key[in] Bounded_String; |
| 1304 |
Drop : @key[in] Truncation := Error) |
| 1305 |
@key[return] Bounded_String; |
| 1306 |
|
| 1307 |
@key[function] @AdaSubDefn{Append} (Left : @key[in] Bounded_String; |
| 1308 |
Right : @key[in] String; |
| 1309 |
Drop : @key[in] Truncation := Error) |
| 1310 |
@key[return] Bounded_String; |
| 1311 |
|
| 1312 |
@key[function] @AdaSubDefn{Append} (Left : @key[in] String; |
| 1313 |
Right : @key[in] Bounded_String; |
| 1314 |
Drop : @key[in] Truncation := Error) |
| 1315 |
@key[return] Bounded_String; |
| 1316 |
|
| 1317 |
@key[function] @AdaSubDefn{Append} (Left : @key[in] Bounded_String; |
| 1318 |
Right : @key[in] Character; |
| 1319 |
Drop : @key[in] Truncation := Error) |
| 1320 |
@key[return] Bounded_String; |
| 1321 |
|
| 1322 |
@key[function] @AdaSubDefn{Append} (Left : @key[in] Character; |
| 1323 |
Right : @key[in] Bounded_String; |
| 1324 |
Drop : @key[in] Truncation := Error) |
| 1325 |
@key[return] Bounded_String; |
| 1326 |
|
| 1327 |
@key[procedure] @AdaSubDefn{Append} (Source : @key[in out] Bounded_String; |
| 1328 |
New_Item : @key[in] Bounded_String; |
| 1329 |
Drop : @key[in] Truncation := Error); |
| 1330 |
|
| 1331 |
@key[procedure] @AdaSubDefn{Append} (Source : @key[in out] Bounded_String; |
| 1332 |
New_Item : @key[in] String; |
| 1333 |
Drop : @key[in] Truncation := Error); |
| 1334 |
|
| 1335 |
@key[procedure] @AdaSubDefn{Append} (Source : @key[in out] Bounded_String; |
| 1336 |
New_Item : @key[in] Character; |
| 1337 |
Drop : @key[in] Truncation := Error); |
| 1338 |
|
| 1339 |
@key[function] "&" (Left, Right : @key[in] Bounded_String) |
| 1340 |
@key[return] Bounded_String; |
| 1341 |
|
| 1342 |
@key[function] "&" (Left : @key[in] Bounded_String; Right : @key[in] String) |
| 1343 |
@key[return] Bounded_String; |
| 1344 |
|
| 1345 |
@key[function] "&" (Left : @key[in] String; Right : @key[in] Bounded_String) |
| 1346 |
@key[return] Bounded_String; |
| 1347 |
|
| 1348 |
@key[function] "&" (Left : @key[in] Bounded_String; Right : @key[in] Character) |
| 1349 |
@key[return] Bounded_String; |
| 1350 |
|
| 1351 |
@key[function] "&" (Left : @key[in] Character; Right : @key[in] Bounded_String) |
| 1352 |
@key[return] Bounded_String; |
| 1353 |
|
| 1354 |
|
| 1355 |
@key[function] @AdaSubDefn{Element} (Source : @key[in] Bounded_String; |
| 1356 |
Index : @key[in] Positive) |
| 1357 |
@key[return] Character; |
| 1358 |
|
| 1359 |
@key[procedure] @AdaSubDefn{Replace_Element} (Source : @key[in] @key[out] Bounded_String; |
| 1360 |
Index : @key[in] Positive; |
| 1361 |
By : @key[in] Character); |
| 1362 |
|
| 1363 |
|
| 1364 |
@key[function] @AdaSubDefn{Slice} (Source : @key[in] Bounded_String; |
| 1365 |
Low : @key[in] Positive; |
| 1366 |
High : @key[in] Natural) |
| 1367 |
@key[return] String; |
| 1368 |
|
| 1369 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 1370 |
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Bounded_Slice} |
| 1371 |
(Source : @key[in] Bounded_String; |
| 1372 |
Low : @key[in] Positive; |
| 1373 |
High : @key[in] Natural) |
| 1374 |
@key[return] Bounded_String;]} |
| 1375 |
|
| 1376 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 1377 |
@ChgAdded{Version=[2],Text=[ @key[procedure] @AdaSubDefn{Bounded_Slice} |
| 1378 |
(Source : @key[in] Bounded_String; |
| 1379 |
Target : @key[out] Bounded_String; |
| 1380 |
Low : @key[in] Positive; |
| 1381 |
High : @key[in] Natural);]} |
| 1382 |
|
| 1383 |
@key[function] "=" (Left, Right : @key[in] Bounded_String) @key[return] Boolean; |
| 1384 |
@key[function] "=" (Left : @key[in] Bounded_String; Right : @key[in] String) |
| 1385 |
@key[return] Boolean; |
| 1386 |
|
| 1387 |
@key[function] "=" (Left : @key[in] String; Right : @key[in] Bounded_String) |
| 1388 |
@key[return] Boolean; |
| 1389 |
|
| 1390 |
|
| 1391 |
@key[function] "<" (Left, Right : @key[in] Bounded_String) @key[return] Boolean; |
| 1392 |
|
| 1393 |
@key[function] "<" (Left : @key[in] Bounded_String; Right : @key[in] String) |
| 1394 |
@key[return] Boolean; |
| 1395 |
|
| 1396 |
@key[function] "<" (Left : @key[in] String; Right : @key[in] Bounded_String) |
| 1397 |
@key[return] Boolean; |
| 1398 |
|
| 1399 |
@key[function] "<=" (Left, Right : @key[in] Bounded_String) @key[return] Boolean; |
| 1400 |
|
| 1401 |
@key[function] "<=" (Left : @key[in] Bounded_String; Right : @key[in] String) |
| 1402 |
@key[return] Boolean; |
| 1403 |
|
| 1404 |
@key[function] "<=" (Left : @key[in] String; Right : @key[in] Bounded_String) |
| 1405 |
@key[return] Boolean; |
| 1406 |
|
| 1407 |
@key[function] ">" (Left, Right : @key[in] Bounded_String) @key[return] Boolean; |
| 1408 |
|
| 1409 |
@key[function] ">" (Left : @key[in] Bounded_String; Right : @key[in] String) |
| 1410 |
@key[return] Boolean; |
| 1411 |
|
| 1412 |
@key[function] ">" (Left : @key[in] String; Right : @key[in] Bounded_String) |
| 1413 |
@key[return] Boolean; |
| 1414 |
|
| 1415 |
@key[function] ">=" (Left, Right : @key[in] Bounded_String) @key[return] Boolean; |
| 1416 |
|
| 1417 |
@key[function] ">=" (Left : @key[in] Bounded_String; Right : @key[in] String) |
| 1418 |
@key[return] Boolean; |
| 1419 |
|
| 1420 |
@key[function] ">=" (Left : @key[in] String; Right : @key[in] Bounded_String) |
| 1421 |
@key[return] Boolean; |
| 1422 |
|
| 1423 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00301-01]} |
| 1424 |
--@Examcom{ Search @Chg{Version=[2],New=[subprograms],Old=[functions]}} |
| 1425 |
|
| 1426 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 1427 |
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index} (Source : @key[in] Bounded_String; |
| 1428 |
Pattern : @key[in] String; |
| 1429 |
From : @key[in] Positive; |
| 1430 |
Going : @key[in] Direction := Forward; |
| 1431 |
Mapping : @key[in] Maps.Character_Mapping := Maps.Identity) |
| 1432 |
@key[return] Natural;]} |
| 1433 |
|
| 1434 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 1435 |
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index} (Source : @key[in] Bounded_String; |
| 1436 |
Pattern : @key[in] String; |
| 1437 |
From : @key[in] Positive; |
| 1438 |
Going : @key[in] Direction := Forward; |
| 1439 |
Mapping : @key[in] Maps.Character_Mapping_Function) |
| 1440 |
@key[return] Natural;]} |
| 1441 |
|
| 1442 |
@key[function] @AdaSubDefn{Index} (Source : @key[in] Bounded_String; |
| 1443 |
Pattern : @key[in] String; |
| 1444 |
Going : @key[in] Direction := Forward; |
| 1445 |
Mapping : @key[in] Maps.Character_Mapping |
| 1446 |
:= Maps.Identity) |
| 1447 |
@key[return] Natural; |
| 1448 |
|
| 1449 |
@key[function] @AdaSubDefn{Index} (Source : @key[in] Bounded_String; |
| 1450 |
Pattern : @key[in] String; |
| 1451 |
Going : @key[in] Direction := Forward; |
| 1452 |
Mapping : @key[in] Maps.Character_Mapping_Function) |
| 1453 |
@key[return] Natural; |
| 1454 |
|
| 1455 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 1456 |
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index} (Source : @key[in] Bounded_String; |
| 1457 |
Set : @key[in] Maps.Character_Set; |
| 1458 |
From : @key[in] Positive; |
| 1459 |
Test : @key[in] Membership := Inside; |
| 1460 |
Going : @key[in] Direction := Forward) |
| 1461 |
@key[return] Natural;]} |
| 1462 |
|
| 1463 |
@key[function] @AdaSubDefn{Index} (Source : @key[in] Bounded_String; |
| 1464 |
Set : @key[in] Maps.Character_Set; |
| 1465 |
Test : @key[in] Membership := Inside; |
| 1466 |
Going : @key[in] Direction := Forward) |
| 1467 |
@key[return] Natural; |
| 1468 |
|
| 1469 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 1470 |
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index_Non_Blank} (Source : @key[in] Bounded_String; |
| 1471 |
From : @key[in] Positive; |
| 1472 |
Going : @key[in] Direction := Forward) |
| 1473 |
@key[return] Natural;]} |
| 1474 |
|
| 1475 |
@key[function] @AdaSubDefn{Index_Non_Blank} (Source : @key[in] Bounded_String; |
| 1476 |
Going : @key[in] Direction := Forward) |
| 1477 |
@key[return] Natural; |
| 1478 |
|
| 1479 |
|
| 1480 |
@key[function] @AdaSubDefn{Count} (Source : @key[in] Bounded_String; |
| 1481 |
Pattern : @key[in] String; |
| 1482 |
Mapping : @key[in] Maps.Character_Mapping |
| 1483 |
:= Maps.Identity) |
| 1484 |
@key[return] Natural; |
| 1485 |
|
| 1486 |
@key[function] @AdaSubDefn{Count} (Source : @key[in] Bounded_String; |
| 1487 |
Pattern : @key[in] String; |
| 1488 |
Mapping : @key[in] Maps.Character_Mapping_Function) |
| 1489 |
@key[return] Natural; |
| 1490 |
|
| 1491 |
@key[function] @AdaSubDefn{Count} (Source : @key[in] Bounded_String; |
| 1492 |
Set : @key[in] Maps.Character_Set) |
| 1493 |
@key[return] Natural; |
| 1494 |
|
| 1495 |
|
| 1496 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0031-1]} |
| 1497 |
@ChgAdded{Version=[3],Text=[ @key[procedure] @AdaSubDefn{Find_Token} (Source : @key[in] Bounded_String; |
| 1498 |
Set : @key[in] Maps.Character_Set; |
| 1499 |
From : @key[in] Positive; |
| 1500 |
Test : @key[in] Membership; |
| 1501 |
First : @key[out] Positive; |
| 1502 |
Last : @key[out] Natural);]} |
| 1503 |
|
| 1504 |
@key[procedure] @AdaSubDefn{Find_Token} (Source : @key[in] Bounded_String; |
| 1505 |
Set : @key[in] Maps.Character_Set; |
| 1506 |
Test : @key[in] Membership; |
| 1507 |
First : @key[out] Positive; |
| 1508 |
Last : @key[out] Natural); |
| 1509 |
|
| 1510 |
@Keepnext@; --@Examcom{ String translation subprograms} |
| 1511 |
|
| 1512 |
@key[function] @AdaSubDefn{Translate} (Source : @key[in] Bounded_String; |
| 1513 |
Mapping : @key[in] Maps.Character_Mapping) |
| 1514 |
@key[return] Bounded_String; |
| 1515 |
|
| 1516 |
@key[procedure] @AdaSubDefn{Translate} (Source : @key[in] @key[out] Bounded_String; |
| 1517 |
Mapping : @key[in] Maps.Character_Mapping); |
| 1518 |
|
| 1519 |
|
| 1520 |
@key[function] @AdaSubDefn{Translate} (Source : @key[in] Bounded_String; |
| 1521 |
Mapping : @key[in] Maps.Character_Mapping_Function) |
| 1522 |
@key[return] Bounded_String; |
| 1523 |
|
| 1524 |
@key[procedure] @AdaSubDefn{Translate} (Source : @key[in] @key[out] Bounded_String; |
| 1525 |
Mapping : @key[in] Maps.Character_Mapping_Function); |
| 1526 |
|
| 1527 |
@Keepnext@; --@Examcom{ String transformation subprograms} |
| 1528 |
|
| 1529 |
@key[function] @AdaSubDefn{Replace_Slice} (Source : @key[in] Bounded_String; |
| 1530 |
Low : @key[in] Positive; |
| 1531 |
High : @key[in] Natural; |
| 1532 |
By : @key[in] String; |
| 1533 |
Drop : @key[in] Truncation := Error) |
| 1534 |
@key[return] Bounded_String; |
| 1535 |
|
| 1536 |
|
| 1537 |
@key[procedure] @AdaSubDefn{Replace_Slice} (Source : @key[in] @key[out] Bounded_String; |
| 1538 |
Low : @key[in] Positive; |
| 1539 |
High : @key[in] Natural; |
| 1540 |
By : @key[in] String; |
| 1541 |
Drop : @key[in] Truncation := Error); |
| 1542 |
|
| 1543 |
|
| 1544 |
@key[function] @AdaSubDefn{Insert} (Source : @key[in] Bounded_String; |
| 1545 |
Before : @key[in] Positive; |
| 1546 |
New_Item : @key[in] String; |
| 1547 |
Drop : @key[in] Truncation := Error) |
| 1548 |
@key[return] Bounded_String; |
| 1549 |
|
| 1550 |
@key[procedure] @AdaSubDefn{Insert} (Source : @key[in] @key[out] Bounded_String; |
| 1551 |
Before : @key[in] Positive; |
| 1552 |
New_Item : @key[in] String; |
| 1553 |
Drop : @key[in] Truncation := Error); |
| 1554 |
|
| 1555 |
|
| 1556 |
@key[function] @AdaSubDefn{Overwrite} (Source : @key[in] Bounded_String; |
| 1557 |
Position : @key[in] Positive; |
| 1558 |
New_Item : @key[in] String; |
| 1559 |
Drop : @key[in] Truncation := Error) |
| 1560 |
@key[return] Bounded_String; |
| 1561 |
|
| 1562 |
@key[procedure] @AdaSubDefn{Overwrite} (Source : @key[in] @key[out] Bounded_String; |
| 1563 |
Position : @key[in] Positive; |
| 1564 |
New_Item : @key[in] String; |
| 1565 |
Drop : @key[in] Truncation := Error); |
| 1566 |
|
| 1567 |
@key[function] @AdaSubDefn{Delete} (Source : @key[in] Bounded_String; |
| 1568 |
From : @key[in] Positive; |
| 1569 |
Through : @key[in] Natural) |
| 1570 |
@key[return] Bounded_String; |
| 1571 |
|
| 1572 |
@key[procedure] @AdaSubDefn{Delete} (Source : @key[in] @key[out] Bounded_String; |
| 1573 |
From : @key[in] Positive; |
| 1574 |
Through : @key[in] Natural); |
| 1575 |
|
| 1576 |
--@Examcom{String selector subprograms} |
| 1577 |
|
| 1578 |
@key[function] @AdaSubDefn{Trim} (Source : @key[in] Bounded_String; |
| 1579 |
Side : @key[in] Trim_End) |
| 1580 |
@key[return] Bounded_String; |
| 1581 |
@key[procedure] @AdaSubDefn{Trim} (Source : @key[in] @key[out] Bounded_String; |
| 1582 |
Side : @key[in] Trim_End); |
| 1583 |
|
| 1584 |
@key[function] @AdaSubDefn{Trim} (Source : @key[in] Bounded_String; |
| 1585 |
Left : @key[in] Maps.Character_Set; |
| 1586 |
Right : @key[in] Maps.Character_Set) |
| 1587 |
@key[return] Bounded_String; |
| 1588 |
|
| 1589 |
@key[procedure] @AdaSubDefn{Trim} (Source : @key[in] @key[out] Bounded_String; |
| 1590 |
Left : @key[in] Maps.Character_Set; |
| 1591 |
Right : @key[in] Maps.Character_Set); |
| 1592 |
|
| 1593 |
@key[function] @AdaSubDefn{Head} (Source : @key[in] Bounded_String; |
| 1594 |
Count : @key[in] Natural; |
| 1595 |
Pad : @key[in] Character := Space; |
| 1596 |
Drop : @key[in] Truncation := Error) |
| 1597 |
@key[return] Bounded_String; |
| 1598 |
|
| 1599 |
@key[procedure] @AdaSubDefn{Head} (Source : @key[in] @key[out] Bounded_String; |
| 1600 |
Count : @key[in] Natural; |
| 1601 |
Pad : @key[in] Character := Space; |
| 1602 |
Drop : @key[in] Truncation := Error); |
| 1603 |
|
| 1604 |
@key[function] @AdaSubDefn{Tail} (Source : @key[in] Bounded_String; |
| 1605 |
Count : @key[in] Natural; |
| 1606 |
Pad : @key[in] Character := Space; |
| 1607 |
Drop : @key[in] Truncation := Error) |
| 1608 |
@key[return] Bounded_String; |
| 1609 |
|
| 1610 |
@key[procedure] @AdaSubDefn{Tail} (Source : @key[in] @key[out] Bounded_String; |
| 1611 |
Count : @key[in] Natural; |
| 1612 |
Pad : @key[in] Character := Space; |
| 1613 |
Drop : @key[in] Truncation := Error); |
| 1614 |
|
| 1615 |
--@Examcom{String constructor subprograms} |
| 1616 |
|
| 1617 |
@key[function] "*" (Left : @key[in] Natural; |
| 1618 |
Right : @key[in] Character) |
| 1619 |
@key[return] Bounded_String; |
| 1620 |
|
| 1621 |
@key[function] "*" (Left : @key[in] Natural; |
| 1622 |
Right : @key[in] String) |
| 1623 |
@key[return] Bounded_String; |
| 1624 |
|
| 1625 |
@key[function] "*" (Left : @key[in] Natural; |
| 1626 |
Right : @key[in] Bounded_String) |
| 1627 |
@key[return] Bounded_String; |
| 1628 |
|
| 1629 |
|
| 1630 |
@key[function] @AdaSubDefn{Replicate} (Count : @key[in] Natural; |
| 1631 |
Item : @key[in] Character; |
| 1632 |
Drop : @key[in] Truncation := Error) |
| 1633 |
@key[return] Bounded_String; |
| 1634 |
|
| 1635 |
@key[function] @AdaSubDefn{Replicate} (Count : @key[in] Natural; |
| 1636 |
Item : @key[in] String; |
| 1637 |
Drop : @key[in] Truncation := Error) |
| 1638 |
@key[return] Bounded_String; |
| 1639 |
|
| 1640 |
@key[function] @AdaSubDefn{Replicate} (Count : @key[in] Natural; |
| 1641 |
Item : @key[in] Bounded_String; |
| 1642 |
Drop : @key[in] Truncation := Error) |
| 1643 |
@key[return] Bounded_String; |
| 1644 |
|
| 1645 |
@key[private] |
| 1646 |
... -- @Examcom{not specified by the language} |
| 1647 |
@key[end] Generic_Bounded_Length; |
| 1648 |
|
| 1649 |
@key[end] Ada.Strings.Bounded; |
| 1650 |
@end{example} |
| 1651 |
|
| 1652 |
@begin{ImplNote} |
| 1653 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0097],ARef=[AI95-00115-01]} |
| 1654 |
@ChgRef{Version=[2],Kind=[DeletedAdded],ARef=[AI95-00344-01]} |
| 1655 |
@ChgDeleted{Version=[2],Text=[@Chg{Version=[1],New=[Bounded_String cannot be |
| 1656 |
implemented as a (directly) controlled type, |
| 1657 |
as Ada.Strings.Bounded.Generic_Bounded_Length can be instantiated at any |
| 1658 |
nesting depth. Bounded_String could have |
| 1659 |
a component of a controlled type, as long as that type is declared in some |
| 1660 |
other (nongeneric) package (including directly in Ada.Strings.Bounded).],Old=[]}]} |
| 1661 |
@ChgNote{AI-344 allows controlled types to be declared at |
| 1662 |
any nesting depth, so this note is obsolete.} |
| 1663 |
|
| 1664 |
@end{ImplNote} |
| 1665 |
|
| 1666 |
Null_Bounded_String represents the null string. |
| 1667 |
If an object of type Bounded_String is not otherwise initialized, it |
| 1668 |
will be initialized to the same value as Null_Bounded_String. |
| 1669 |
@begin{DescribeCode} |
| 1670 |
@begin{Example}@Keepnext |
| 1671 |
@key[function] Length (Source : @key[in] Bounded_String) @key[return] Length_Range; |
| 1672 |
@end{Example} |
| 1673 |
@Trailing@;The Length function returns the length of the string represented by |
| 1674 |
Source. |
| 1675 |
|
| 1676 |
@begin{Example}@Keepnext |
| 1677 |
@key[function] To_Bounded_String (Source : @key[in] String; |
| 1678 |
Drop : @key[in] Truncation := Error) |
| 1679 |
@key[return] Bounded_String; |
| 1680 |
@end{Example} |
| 1681 |
@Leading@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0264-1]} |
| 1682 |
If Source'Length <= Max_Length@Chg{Version=[3],New=[,],Old=[]} then |
| 1683 |
this function |
| 1684 |
returns a Bounded_String that represents Source. |
| 1685 |
Otherwise@Chg{Version=[3],New=[,],Old=[]} |
| 1686 |
the effect depends on the value of Drop: |
| 1687 |
@begin{itemize} |
| 1688 |
If Drop=Left, then |
| 1689 |
the result is a Bounded_String that represents the string comprising |
| 1690 |
the rightmost Max_Length characters of Source. |
| 1691 |
|
| 1692 |
If Drop=Right, then |
| 1693 |
the result is a Bounded_String that represents the string comprising |
| 1694 |
the leftmost Max_Length characters of Source. |
| 1695 |
|
| 1696 |
@Trailing@;If Drop=Error, then Strings.Length_Error is propagated. |
| 1697 |
@end{itemize} |
| 1698 |
|
| 1699 |
@begin{Example}@Keepnext |
| 1700 |
@key[function] To_String (Source : @key[in] Bounded_String) @key[return] String; |
| 1701 |
@end{Example} |
| 1702 |
@Trailing@;To_String returns the String value with lower bound 1 represented by |
| 1703 |
Source. If B is a Bounded_String, then B = To_Bounded_String(To_String(B)). |
| 1704 |
|
| 1705 |
@begin{Example} |
| 1706 |
@ChgRef{Version=[2],Kind=[Added]} |
| 1707 |
@ChgAdded{Version=[2],KeepNext=[T],Text=[@key[procedure] Set_Bounded_String |
| 1708 |
(Target : @key[out] Bounded_String; |
| 1709 |
Source : @key[in] String; |
| 1710 |
Drop : @key[in] Truncation := Error);]} |
| 1711 |
@end{Example} |
| 1712 |
|
| 1713 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 1714 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Equivalent to Target := To_Bounded_String (Source, Drop);]} |
| 1715 |
|
| 1716 |
@end{DescribeCode} |
| 1717 |
|
| 1718 |
Each of the Append functions returns a Bounded_String obtained by concatenating |
| 1719 |
the string or character given or represented by one of the parameters, |
| 1720 |
with the string or character given or represented by the other parameter, |
| 1721 |
and applying To_Bounded_String to the concatenation result string, |
| 1722 |
with Drop as provided to the Append function. |
| 1723 |
|
| 1724 |
Each of the procedures Append(Source, New_Item, Drop) has the same |
| 1725 |
effect as the corresponding assignment Source := |
| 1726 |
Append(Source, New_Item, Drop). |
| 1727 |
|
| 1728 |
Each of the "&" functions has the same effect as the corresponding |
| 1729 |
Append function, with Error as the Drop parameter. |
| 1730 |
@begin{DescribeCode} |
| 1731 |
@begin{Example}@Keepnext |
| 1732 |
@key[function] Element (Source : @key[in] Bounded_String; |
| 1733 |
Index : @key[in] Positive) |
| 1734 |
@key[return] Character; |
| 1735 |
@end{Example} |
| 1736 |
@Trailing@;Returns the character at position Index in the string represented |
| 1737 |
by Source; propagates Index_Error if Index > Length(Source). |
| 1738 |
|
| 1739 |
@begin{Example}@Keepnext |
| 1740 |
@key[procedure] Replace_Element (Source : @key[in] @key[out] Bounded_String; |
| 1741 |
Index : @key[in] Positive; |
| 1742 |
By : @key[in] Character); |
| 1743 |
@end{Example} |
| 1744 |
@Trailing@;Updates Source such that the character at position Index in the |
| 1745 |
string represented by Source is By; |
| 1746 |
propagates Index_Error if Index > Length(Source). |
| 1747 |
|
| 1748 |
@begin{Example}@Keepnext |
| 1749 |
@key[function] Slice (Source : @key[in] Bounded_String; |
| 1750 |
Low : @key[in] Positive; |
| 1751 |
High : @key[in] Natural) |
| 1752 |
@key[return] String; |
| 1753 |
@end{Example} |
| 1754 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0049],ARef=[AI95-00128-01]} |
| 1755 |
@ChgRef{Version=[1],Kind=[Revised],ARef=[AI95-00238-01]} |
| 1756 |
@Trailing@;Returns the slice at positions Low through High in the string |
| 1757 |
represented by Source; propagates Index_Error if |
| 1758 |
Low > Length(Source)+1@Chg{New=[ or High > Length(Source)],Old=[]}.@Chg{Version=[2], |
| 1759 |
New=[ The bounds of the returned string are Low and High.],Old=[]}. |
| 1760 |
|
| 1761 |
@begin{Example} |
| 1762 |
@ChgRef{Version=[2],Kind=[Added]} |
| 1763 |
@ChgAdded{Version=[2],KeepNext=[T],Text=[@key[function] Bounded_Slice |
| 1764 |
(Source : @key[in] Bounded_String; |
| 1765 |
Low : @key[in] Positive; |
| 1766 |
High : @key[in] Natural) |
| 1767 |
@key[return] Bounded_String;]} |
| 1768 |
@end{Example} |
| 1769 |
|
| 1770 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 1771 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the slice at positions Low |
| 1772 |
through High in the string represented by Source as a bounded string; |
| 1773 |
propagates Index_Error if Low > Length(Source)+1 or High > Length(Source).]} |
| 1774 |
|
| 1775 |
@begin{Example} |
| 1776 |
@ChgRef{Version=[2],Kind=[Added]} |
| 1777 |
@ChgAdded{Version=[2],KeepNext=[T],Text=[@key[procedure] Bounded_Slice |
| 1778 |
(Source : @key[in] Bounded_String; |
| 1779 |
Target : @key[out] Bounded_String; |
| 1780 |
Low : @key[in] Positive; |
| 1781 |
High : @key[in] Natural);]} |
| 1782 |
@end{Example} |
| 1783 |
|
| 1784 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 1785 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Equivalent to Target := Bounded_Slice (Source, Low, High);]} |
| 1786 |
|
| 1787 |
@end{DescribeCode} |
| 1788 |
|
| 1789 |
Each of the functions "=", "<", ">", "<=", and ">=" |
| 1790 |
returns the same result as the corresponding String |
| 1791 |
operation applied to the String values given or represented by |
| 1792 |
the two parameters. |
| 1793 |
|
| 1794 |
Each of the search subprograms (Index, Index_Non_Blank, |
| 1795 |
Count, Find_Token) has the |
| 1796 |
same effect as the corresponding subprogram in Strings.Fixed applied |
| 1797 |
to the string represented by the Bounded_String parameter. |
| 1798 |
|
| 1799 |
Each of the Translate subprograms, when applied to a Bounded_String, has |
| 1800 |
an analogous effect to the corresponding subprogram in Strings.Fixed. |
| 1801 |
For the Translate function, |
| 1802 |
the translation is applied to the string represented by the Bounded_String |
| 1803 |
parameter, and the result is converted (via To_Bounded_String) to a |
| 1804 |
Bounded_String. |
| 1805 |
For the Translate procedure, the string represented by the Bounded_String |
| 1806 |
parameter after the translation is given by the Translate function for |
| 1807 |
fixed-length strings applied to the string represented by the |
| 1808 |
original value of the parameter. |
| 1809 |
|
| 1810 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0049],ARef=[AI95-00128-01]} |
| 1811 |
Each of the transformation subprograms (Replace_Slice, Insert, |
| 1812 |
Overwrite, Delete), selector subprograms (Trim, Head, Tail), |
| 1813 |
and constructor functions ("*") has an effect based on its |
| 1814 |
corresponding subprogram in Strings.Fixed, and Replicate is based on |
| 1815 |
Fixed."*". @Chg{New=[In the case of a function], |
| 1816 |
Old=[For each of these subprograms]}, the corresponding |
| 1817 |
fixed-length string subprogram is applied to the string represented by |
| 1818 |
the Bounded_String parameter. To_Bounded_String is applied the result |
| 1819 |
string, with Drop (or Error in the case of Generic_Bounded_Length."*") |
| 1820 |
determining the effect when the string length exceeds Max_Length. |
| 1821 |
@Chg{New=[In the case of a procedure, the corresponding function in |
| 1822 |
Strings.@!Bounded.@!Generic_@!Bounded_@!Length is applied, with the result |
| 1823 |
assigned into the Source parameter.],Old=[]} |
| 1824 |
@begin{Ramification} |
| 1825 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00114-01]} |
| 1826 |
The "/=" operations between Bounded_String and String, and between String |
| 1827 |
and Bounded_String, are automatically defined based on the @Chg{Version=[2], |
| 1828 |
New=[corresponding],Old=[corrsponding]} |
| 1829 |
"=" operations. |
| 1830 |
@end{Ramification} |
| 1831 |
@end{StaticSem} |
| 1832 |
|
| 1833 |
@begin{ImplAdvice} |
| 1834 |
Bounded string objects should not be implemented by implicit |
| 1835 |
pointers and dynamic allocation. |
| 1836 |
@ChgImplAdvice{Version=[2],Kind=[Added],Text=[@ChgAdded{Version=[2], |
| 1837 |
Text=[Bounded string objects should not be implemented by implicit |
| 1838 |
pointers and dynamic allocation.]}]} |
| 1839 |
@begin{ImplNote} |
| 1840 |
@Leading@;The following is a possible implementation of the private part |
| 1841 |
of the package: |
| 1842 |
@begin{example} |
| 1843 |
@key[type] Bounded_String_Internals (Length : Length_Range := 0) @key[is] |
| 1844 |
@key[record] |
| 1845 |
Data : String(1..Length); |
| 1846 |
@key[end] @key[record]; |
| 1847 |
|
| 1848 |
@key[type] Bounded_String @key[is] |
| 1849 |
@key[record] |
| 1850 |
Data : Bounded_String_Internals; --@Examcom{ Unconstrained} |
| 1851 |
@key[end] @key[record]; |
| 1852 |
|
| 1853 |
Null_Bounded_String : @key[constant] Bounded_String := |
| 1854 |
(Data => (Length => 0, |
| 1855 |
Data => (1..0 => ' '))); |
| 1856 |
@end{example} |
| 1857 |
@end{ImplNote} |
| 1858 |
@end{ImplAdvice} |
| 1859 |
|
| 1860 |
|
| 1861 |
@begin{Inconsistent95} |
| 1862 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00238-01]} |
| 1863 |
@ChgAdded{Version=[2],Text=[@Defn{inconsistencies with Ada 95} |
| 1864 |
@B[Amendment Correction:] The bounds of the string returned from |
| 1865 |
Slice are now defined. This is technically an inconsistency; if a program |
| 1866 |
depended on some other lower bound for the string returned from Slice, |
| 1867 |
it could fail when compiled with Ada 2005. Such code is not portable even |
| 1868 |
between Ada 95 implementations, so it should be very rare.]} |
| 1869 |
@end{Inconsistent95} |
| 1870 |
|
| 1871 |
@begin{Incompatible95} |
| 1872 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00301-01]} |
| 1873 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0005-1]} |
| 1874 |
@ChgAdded{Version=[2],Text=[@Defn{incompatibilities with Ada 95} |
| 1875 |
Procedure Set_Bounded_String, two Bounded_Slice subprograms, and overloaded |
| 1876 |
versions of Index and Index_Non_Blank are |
| 1877 |
@Chg{Version=[3],New=[],Old=[newly ]}added to |
| 1878 |
Strings.Bounded.Generic_Bounded_Length. If an instance of Generic_Bounded_Length is |
| 1879 |
referenced in a @nt{use_clause}, and an entity @i<E> with the |
| 1880 |
@nt{defining_identifier} as a new entity in Generic_Bounded_Length is defined in a |
| 1881 |
package that is also referenced in a @nt{use_clause}, the entity @i<E> may no |
| 1882 |
longer be use-visible, resulting in errors. This should be rare and is easily |
| 1883 |
fixed if it does occur.]} |
| 1884 |
@end{Incompatible95} |
| 1885 |
|
| 1886 |
@begin{DiffWord95} |
| 1887 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0049],ARef=[AI95-00128-01]} |
| 1888 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Corrected the conditions for |
| 1889 |
which Slice raises Index_Error.]} |
| 1890 |
|
| 1891 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0049],ARef=[AI95-00128-01]} |
| 1892 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Clarified the meaning of |
| 1893 |
transformation, selector, and constructor subprograms by describing the |
| 1894 |
effects of procedures and functions separately.]} |
| 1895 |
@end{DiffWord95} |
| 1896 |
|
| 1897 |
@begin{Incompatible2005} |
| 1898 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0031-1]} |
| 1899 |
@ChgAdded{Version=[3],Text=[@Defn{incompatibilities with Ada 2005} |
| 1900 |
An overloaded version of Find_Token is added to |
| 1901 |
Strings.Bounded.Generic_Bounded_Length. If an instance of Generic_Bounded_Length is |
| 1902 |
referenced in a @nt{use_clause}, and an |
| 1903 |
entity @i<E> with a @nt{defining_identifier} of Find_Token is |
| 1904 |
defined in a package that is also referenced in a @nt{use_clause}, the entity |
| 1905 |
@i<E> may no longer be use-visible, resulting in errors. This should be rare |
| 1906 |
and is easily fixed if it does occur.]} |
| 1907 |
@end{Incompatible2005} |
| 1908 |
|
| 1909 |
|
| 1910 |
|
| 1911 |
@LabeledSubClause{Unbounded-Length String Handling} |
| 1912 |
@begin{Intro} |
| 1913 |
The language-defined package Strings.Unbounded provides a |
| 1914 |
private type Unbounded_String and a |
| 1915 |
set of operations. An object of type Unbounded_String represents a String |
| 1916 |
whose low bound is 1 and whose length |
| 1917 |
can vary conceptually between 0 and Natural'Last. |
| 1918 |
The subprograms for fixed-length string handling |
| 1919 |
are either overloaded directly for Unbounded_String, or are modified as |
| 1920 |
needed to reflect the flexibility in length. Since the |
| 1921 |
Unbounded_String type is private, relevant constructor and selector |
| 1922 |
operations are provided. |
| 1923 |
@begin{reason} |
| 1924 |
The transformation operations for fixed- and bounded-length strings that |
| 1925 |
are not necessarily length preserving are supplied for Unbounded_String |
| 1926 |
as procedures as well as functions. |
| 1927 |
This allows an implementation to do an initial allocation for |
| 1928 |
an unbounded string and to avoid further allocations as long |
| 1929 |
as the length does not exceed the allocated length. |
| 1930 |
@end{reason} |
| 1931 |
@end{Intro} |
| 1932 |
|
| 1933 |
@begin{StaticSem} |
| 1934 |
@Leading@;The library package Strings.Unbounded has the following declaration: |
| 1935 |
@begin{example} |
| 1936 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0241-1]} |
| 1937 |
@key[with] Ada.Strings.Maps; |
| 1938 |
@ChildUnit{Parent=[Ada.Strings],Child=[Unbounded]}@key[package] Ada.Strings.Unbounded@Chg{Version=[5],New=[],Old=[ @key[is]]} |
| 1939 |
@Chg{Version=[5],New=[@key[with]],Old=[@key[pragma]]} Preelaborate@Chg{Version=[5],New=[, Nonblocking @key[is]],Old=[(Unbounded);]} |
| 1940 |
|
| 1941 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00161-01]} |
| 1942 |
@key[type] @AdaTypeDefn{Unbounded_String} @key[is] @key[private];@Chg{Version=[2],New=[ |
| 1943 |
@key[pragma] Preelaborable_Initialization(Unbounded_String);],Old=[]} |
| 1944 |
|
| 1945 |
@AdaObjDefn{Null_Unbounded_String} : @key[constant] Unbounded_String; |
| 1946 |
|
| 1947 |
@key[function] @AdaSubDefn{Length} (Source : @key[in] Unbounded_String) @key[return] Natural; |
| 1948 |
|
| 1949 |
@key[type] @AdaTypeDefn{String_Access} @key[is] @key[access] @key[all] String; |
| 1950 |
@key[procedure] @AdaSubDefn{Free} (X : @key[in] @key[out] String_Access); |
| 1951 |
|
| 1952 |
--@Examcom{ Conversion, Concatenation, and Selection functions} |
| 1953 |
|
| 1954 |
@key[function] @AdaSubDefn{To_Unbounded_String} (Source : @key[in] String) |
| 1955 |
@key[return] Unbounded_String; |
| 1956 |
|
| 1957 |
@key[function] @AdaSubDefn{To_Unbounded_String} (Length : @key[in] Natural) |
| 1958 |
@key[return] Unbounded_String; |
| 1959 |
|
| 1960 |
@key[function] @AdaSubDefn{To_String} (Source : @key[in] Unbounded_String) @key[return] String; |
| 1961 |
|
| 1962 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 1963 |
@ChgAdded{Version=[2],Text=[ @key[procedure] @AdaSubDefn{Set_Unbounded_String} |
| 1964 |
(Target : @key[out] Unbounded_String; |
| 1965 |
Source : @key[in] String);]} |
| 1966 |
|
| 1967 |
@key[procedure] @AdaSubDefn{Append} (Source : @key[in out] Unbounded_String; |
| 1968 |
New_Item : @key[in] Unbounded_String); |
| 1969 |
|
| 1970 |
@key[procedure] @AdaSubDefn{Append} (Source : @key[in out] Unbounded_String; |
| 1971 |
New_Item : @key[in] String); |
| 1972 |
|
| 1973 |
@key[procedure] @AdaSubDefn{Append} (Source : @key[in out] Unbounded_String; |
| 1974 |
New_Item : @key[in] Character); |
| 1975 |
|
| 1976 |
@key[function] "&" (Left, Right : @key[in] Unbounded_String) |
| 1977 |
@key[return] Unbounded_String; |
| 1978 |
|
| 1979 |
@key[function] "&" (Left : @key[in] Unbounded_String; Right : @key[in] String) |
| 1980 |
@key[return] Unbounded_String; |
| 1981 |
|
| 1982 |
@key[function] "&" (Left : @key[in] String; Right : @key[in] Unbounded_String) |
| 1983 |
@key[return] Unbounded_String; |
| 1984 |
|
| 1985 |
@key[function] "&" (Left : @key[in] Unbounded_String; Right : @key[in] Character) |
| 1986 |
@key[return] Unbounded_String; |
| 1987 |
|
| 1988 |
@key[function] "&" (Left : @key[in] Character; Right : @key[in] Unbounded_String) |
| 1989 |
@key[return] Unbounded_String; |
| 1990 |
|
| 1991 |
|
| 1992 |
@key[function] @AdaSubDefn{Element} (Source : @key[in] Unbounded_String; |
| 1993 |
Index : @key[in] Positive) |
| 1994 |
@key[return] Character; |
| 1995 |
|
| 1996 |
@key[procedure] @AdaSubDefn{Replace_Element} (Source : @key[in] @key[out] Unbounded_String; |
| 1997 |
Index : @key[in] Positive; |
| 1998 |
By : @key[in] Character); |
| 1999 |
|
| 2000 |
|
| 2001 |
@key[function] @AdaSubDefn{Slice} (Source : @key[in] Unbounded_String; |
| 2002 |
Low : @key[in] Positive; |
| 2003 |
High : @key[in] Natural) |
| 2004 |
@key[return] String; |
| 2005 |
|
| 2006 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 2007 |
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Unbounded_Slice} |
| 2008 |
(Source : @key[in] Unbounded_String; |
| 2009 |
Low : @key[in] Positive; |
| 2010 |
High : @key[in] Natural) |
| 2011 |
@key[return] Unbounded_String;]} |
| 2012 |
|
| 2013 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 2014 |
@ChgAdded{Version=[2],Text=[ @key[procedure] @AdaSubDefn{Unbounded_Slice} |
| 2015 |
(Source : @key[in] Unbounded_String; |
| 2016 |
Target : @key[out] Unbounded_String; |
| 2017 |
Low : @key[in] Positive; |
| 2018 |
High : @key[in] Natural);]} |
| 2019 |
|
| 2020 |
@key[function] "=" (Left, Right : @key[in] Unbounded_String) @key[return] Boolean; |
| 2021 |
|
| 2022 |
@key[function] "=" (Left : @key[in] Unbounded_String; Right : @key[in] String) |
| 2023 |
@key[return] Boolean; |
| 2024 |
|
| 2025 |
@key[function] "=" (Left : @key[in] String; Right : @key[in] Unbounded_String) |
| 2026 |
@key[return] Boolean; |
| 2027 |
|
| 2028 |
@key[function] "<" (Left, Right : @key[in] Unbounded_String) @key[return] Boolean; |
| 2029 |
|
| 2030 |
@key[function] "<" (Left : @key[in] Unbounded_String; Right : @key[in] String) |
| 2031 |
@key[return] Boolean; |
| 2032 |
|
| 2033 |
@key[function] "<" (Left : @key[in] String; Right : @key[in] Unbounded_String) |
| 2034 |
@key[return] Boolean; |
| 2035 |
|
| 2036 |
@key[function] "<=" (Left, Right : @key[in] Unbounded_String) @key[return] Boolean; |
| 2037 |
|
| 2038 |
@key[function] "<=" (Left : @key[in] Unbounded_String; Right : @key[in] String) |
| 2039 |
@key[return] Boolean; |
| 2040 |
|
| 2041 |
@key[function] "<=" (Left : @key[in] String; Right : @key[in] Unbounded_String) |
| 2042 |
@key[return] Boolean; |
| 2043 |
|
| 2044 |
@key[function] ">" (Left, Right : @key[in] Unbounded_String) @key[return] Boolean; |
| 2045 |
|
| 2046 |
@key[function] ">" (Left : @key[in] Unbounded_String; Right : @key[in] String) |
| 2047 |
@key[return] Boolean; |
| 2048 |
|
| 2049 |
@key[function] ">" (Left : @key[in] String; Right : @key[in] Unbounded_String) |
| 2050 |
@key[return] Boolean; |
| 2051 |
|
| 2052 |
@key[function] ">=" (Left, Right : @key[in] Unbounded_String) @key[return] Boolean; |
| 2053 |
|
| 2054 |
@key[function] ">=" (Left : @key[in] Unbounded_String; Right : @key[in] String) |
| 2055 |
@key[return] Boolean; |
| 2056 |
|
| 2057 |
@key[function] ">=" (Left : @key[in] String; Right : @key[in] Unbounded_String) |
| 2058 |
@key[return] Boolean; |
| 2059 |
|
| 2060 |
|
| 2061 |
--@Examcom{ Search subprograms} |
| 2062 |
|
| 2063 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 2064 |
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index} (Source : @key[in] Unbounded_String; |
| 2065 |
Pattern : @key[in] String; |
| 2066 |
From : @key[in] Positive; |
| 2067 |
Going : @key[in] Direction := Forward; |
| 2068 |
Mapping : @key[in] Maps.Character_Mapping := Maps.Identity) |
| 2069 |
@key[return] Natural;]} |
| 2070 |
|
| 2071 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 2072 |
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index} (Source : @key[in] Unbounded_String; |
| 2073 |
Pattern : @key[in] String; |
| 2074 |
From : @key[in] Positive; |
| 2075 |
Going : @key[in] Direction := Forward; |
| 2076 |
Mapping : @key[in] Maps.Character_Mapping_Function) |
| 2077 |
@key[return] Natural;]} |
| 2078 |
|
| 2079 |
@key[function] @AdaSubDefn{Index} (Source : @key[in] Unbounded_String; |
| 2080 |
Pattern : @key[in] String; |
| 2081 |
Going : @key[in] Direction := Forward; |
| 2082 |
Mapping : @key[in] Maps.Character_Mapping |
| 2083 |
:= Maps.Identity) |
| 2084 |
@key[return] Natural; |
| 2085 |
|
| 2086 |
@key[function] @AdaSubDefn{Index} (Source : @key[in] Unbounded_String; |
| 2087 |
Pattern : @key[in] String; |
| 2088 |
Going : @key[in] Direction := Forward; |
| 2089 |
Mapping : @key[in] Maps.Character_Mapping_Function) |
| 2090 |
@key[return] Natural; |
| 2091 |
|
| 2092 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 2093 |
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index} (Source : @key[in] Unbounded_String; |
| 2094 |
Set : @key[in] Maps.Character_Set; |
| 2095 |
From : @key[in] Positive; |
| 2096 |
Test : @key[in] Membership := Inside; |
| 2097 |
Going : @key[in] Direction := Forward) |
| 2098 |
@key[return] Natural;]} |
| 2099 |
|
| 2100 |
@key[function] @AdaSubDefn{Index} (Source : @key[in] Unbounded_String; |
| 2101 |
Set : @key[in] Maps.Character_Set; |
| 2102 |
Test : @key[in] Membership := Inside; |
| 2103 |
Going : @key[in] Direction := Forward) @key[return] Natural; |
| 2104 |
|
| 2105 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 2106 |
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index_Non_Blank} (Source : @key[in] Unbounded_String; |
| 2107 |
From : @key[in] Positive; |
| 2108 |
Going : @key[in] Direction := Forward) |
| 2109 |
@key[return] Natural;]} |
| 2110 |
|
| 2111 |
@key[function] @AdaSubDefn{Index_Non_Blank} (Source : @key[in] Unbounded_String; |
| 2112 |
Going : @key[in] Direction := Forward) |
| 2113 |
@key[return] Natural; |
| 2114 |
|
| 2115 |
|
| 2116 |
@key[function] @AdaSubDefn{Count} (Source : @key[in] Unbounded_String; |
| 2117 |
Pattern : @key[in] String; |
| 2118 |
Mapping : @key[in] Maps.Character_Mapping |
| 2119 |
:= Maps.Identity) |
| 2120 |
@key[return] Natural; |
| 2121 |
|
| 2122 |
@key[function] @AdaSubDefn{Count} (Source : @key[in] Unbounded_String; |
| 2123 |
Pattern : @key[in] String; |
| 2124 |
Mapping : @key[in] Maps.Character_Mapping_Function) |
| 2125 |
@key[return] Natural; |
| 2126 |
|
| 2127 |
@key[function] @AdaSubDefn{Count} (Source : @key[in] Unbounded_String; |
| 2128 |
Set : @key[in] Maps.Character_Set) |
| 2129 |
@key[return] Natural; |
| 2130 |
|
| 2131 |
|
| 2132 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0031-1]} |
| 2133 |
@ChgAdded{Version=[3],Text=[ @key[procedure] @AdaSubDefn{Find_Token} (Source : @key[in] Unbounded_String; |
| 2134 |
Set : @key[in] Maps.Character_Set; |
| 2135 |
From : @key[in] Positive; |
| 2136 |
Test : @key[in] Membership; |
| 2137 |
First : @key[out] Positive; |
| 2138 |
Last : @key[out] Natural);]} |
| 2139 |
|
| 2140 |
@key[procedure] @AdaSubDefn{Find_Token} (Source : @key[in] Unbounded_String; |
| 2141 |
Set : @key[in] Maps.Character_Set; |
| 2142 |
Test : @key[in] Membership; |
| 2143 |
First : @key[out] Positive; |
| 2144 |
Last : @key[out] Natural); |
| 2145 |
|
| 2146 |
|
| 2147 |
@Keepnext@;--@Examcom{ String translation subprograms} |
| 2148 |
|
| 2149 |
@key[function] @AdaSubDefn{Translate} (Source : @key[in] Unbounded_String; |
| 2150 |
Mapping : @key[in] Maps.Character_Mapping) |
| 2151 |
@key[return] Unbounded_String; |
| 2152 |
|
| 2153 |
@key[procedure] @AdaSubDefn{Translate} (Source : @key[in] @key[out] Unbounded_String; |
| 2154 |
Mapping : @key[in] Maps.Character_Mapping); |
| 2155 |
|
| 2156 |
@key[function] @AdaSubDefn{Translate} (Source : @key[in] Unbounded_String; |
| 2157 |
Mapping : @key[in] Maps.Character_Mapping_Function) |
| 2158 |
@key[return] Unbounded_String; |
| 2159 |
|
| 2160 |
@key[procedure] @AdaSubDefn{Translate} (Source : @key[in] @key[out] Unbounded_String; |
| 2161 |
Mapping : @key[in] Maps.Character_Mapping_Function); |
| 2162 |
|
| 2163 |
@Keepnext@;--@Examcom{ String transformation subprograms} |
| 2164 |
|
| 2165 |
@key[function] @AdaSubDefn{Replace_Slice} (Source : @key[in] Unbounded_String; |
| 2166 |
Low : @key[in] Positive; |
| 2167 |
High : @key[in] Natural; |
| 2168 |
By : @key[in] String) |
| 2169 |
@key[return] Unbounded_String; |
| 2170 |
|
| 2171 |
@key[procedure] @AdaSubDefn{Replace_Slice} (Source : @key[in] @key[out] Unbounded_String; |
| 2172 |
Low : @key[in] Positive; |
| 2173 |
High : @key[in] Natural; |
| 2174 |
By : @key[in] String); |
| 2175 |
|
| 2176 |
@key[function] @AdaSubDefn{Insert} (Source : @key[in] Unbounded_String; |
| 2177 |
Before : @key[in] Positive; |
| 2178 |
New_Item : @key[in] String) |
| 2179 |
@key[return] Unbounded_String; |
| 2180 |
|
| 2181 |
@key[procedure] @AdaSubDefn{Insert} (Source : @key[in] @key[out] Unbounded_String; |
| 2182 |
Before : @key[in] Positive; |
| 2183 |
New_Item : @key[in] String); |
| 2184 |
|
| 2185 |
@key[function] @AdaSubDefn{Overwrite} (Source : @key[in] Unbounded_String; |
| 2186 |
Position : @key[in] Positive; |
| 2187 |
New_Item : @key[in] String) |
| 2188 |
@key[return] Unbounded_String; |
| 2189 |
|
| 2190 |
@key[procedure] @AdaSubDefn{Overwrite} (Source : @key[in] @key[out] Unbounded_String; |
| 2191 |
Position : @key[in] Positive; |
| 2192 |
New_Item : @key[in] String); |
| 2193 |
|
| 2194 |
@key[function] @AdaSubDefn{Delete} (Source : @key[in] Unbounded_String; |
| 2195 |
From : @key[in] Positive; |
| 2196 |
Through : @key[in] Natural) |
| 2197 |
@key[return] Unbounded_String; |
| 2198 |
|
| 2199 |
@key[procedure] @AdaSubDefn{Delete} (Source : @key[in] @key[out] Unbounded_String; |
| 2200 |
From : @key[in] Positive; |
| 2201 |
Through : @key[in] Natural); |
| 2202 |
|
| 2203 |
@key[function] @AdaSubDefn{Trim} (Source : @key[in] Unbounded_String; |
| 2204 |
Side : @key[in] Trim_End) |
| 2205 |
@key[return] Unbounded_String; |
| 2206 |
|
| 2207 |
@key[procedure] @AdaSubDefn{Trim} (Source : @key[in] @key[out] Unbounded_String; |
| 2208 |
Side : @key[in] Trim_End); |
| 2209 |
|
| 2210 |
@key[function] @AdaSubDefn{Trim} (Source : @key[in] Unbounded_String; |
| 2211 |
Left : @key[in] Maps.Character_Set; |
| 2212 |
Right : @key[in] Maps.Character_Set) |
| 2213 |
@key[return] Unbounded_String; |
| 2214 |
|
| 2215 |
@key[procedure] @AdaSubDefn{Trim} (Source : @key[in] @key[out] Unbounded_String; |
| 2216 |
Left : @key[in] Maps.Character_Set; |
| 2217 |
Right : @key[in] Maps.Character_Set); |
| 2218 |
|
| 2219 |
|
| 2220 |
@key[function] @AdaSubDefn{Head} (Source : @key[in] Unbounded_String; |
| 2221 |
Count : @key[in] Natural; |
| 2222 |
Pad : @key[in] Character := Space) |
| 2223 |
@key[return] Unbounded_String; |
| 2224 |
|
| 2225 |
@key[procedure] @AdaSubDefn{Head} (Source : @key[in] @key[out] Unbounded_String; |
| 2226 |
Count : @key[in] Natural; |
| 2227 |
Pad : @key[in] Character := Space); |
| 2228 |
|
| 2229 |
@key[function] @AdaSubDefn{Tail} (Source : @key[in] Unbounded_String; |
| 2230 |
Count : @key[in] Natural; |
| 2231 |
Pad : @key[in] Character := Space) |
| 2232 |
@key[return] Unbounded_String; |
| 2233 |
|
| 2234 |
@key[procedure] @AdaSubDefn{Tail} (Source : @key[in] @key[out] Unbounded_String; |
| 2235 |
Count : @key[in] Natural; |
| 2236 |
Pad : @key[in] Character := Space); |
| 2237 |
|
| 2238 |
@key[function] "*" (Left : @key[in] Natural; |
| 2239 |
Right : @key[in] Character) |
| 2240 |
@key[return] Unbounded_String; |
| 2241 |
|
| 2242 |
@key[function] "*" (Left : @key[in] Natural; |
| 2243 |
Right : @key[in] String) |
| 2244 |
@key[return] Unbounded_String; |
| 2245 |
|
| 2246 |
@key[function] "*" (Left : @key[in] Natural; |
| 2247 |
Right : @key[in] Unbounded_String) |
| 2248 |
@key[return] Unbounded_String; |
| 2249 |
|
| 2250 |
@key[private] |
| 2251 |
... -- @Examcom{not specified by the language} |
| 2252 |
@key[end] Ada.Strings.Unbounded; |
| 2253 |
@end{example} |
| 2254 |
|
| 2255 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00360-01]} |
| 2256 |
@ChgAdded{Version=[2],Text=[The type Unbounded_String |
| 2257 |
needs finalization@PDefn2{Term=<needs finalization>,Sec=<language-defined type>} |
| 2258 |
(see @RefSecNum{Assignment and Finalization}).]} |
| 2259 |
|
| 2260 |
Null_Unbounded_String represents the null String. |
| 2261 |
If an object of type Unbounded_String is not otherwise initialized, it |
| 2262 |
will be initialized to the same value as Null_Unbounded_String. |
| 2263 |
|
| 2264 |
The function Length returns the length of the String represented by Source. |
| 2265 |
|
| 2266 |
The type String_Access provides a (nonprivate) access type for explicit |
| 2267 |
processing of unbounded-length strings. The procedure Free performs |
| 2268 |
an unchecked deallocation of an object of type String_Access. |
| 2269 |
|
| 2270 |
The function To_Unbounded_String(Source : in String) |
| 2271 |
returns an Unbounded_String that represents Source. |
| 2272 |
The function To_Unbounded_String(Length : in Natural) |
| 2273 |
returns an Unbounded_String that represents an uninitialized String |
| 2274 |
whose length is Length. |
| 2275 |
|
| 2276 |
@Leading@;The function To_String returns the String with lower bound 1 |
| 2277 |
represented by Source. To_String and To_Unbounded_String are related as follows: |
| 2278 |
@begin{itemize} |
| 2279 |
If S is a String, then To_String(To_Unbounded_String(S)) = S. |
| 2280 |
|
| 2281 |
If U is an Unbounded_String, then To_Unbounded_String(To_String(U)) = U. |
| 2282 |
@end{itemize} |
| 2283 |
|
| 2284 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 2285 |
@ChgAdded{Version=[2],Text=[The procedure Set_Unbounded_String sets Target to an Unbounded_String that |
| 2286 |
represents Source.]} |
| 2287 |
|
| 2288 |
For each of the Append procedures, |
| 2289 |
the resulting string represented by the Source parameter is given |
| 2290 |
by the concatenation of the original value of Source and the value |
| 2291 |
of New_Item. |
| 2292 |
|
| 2293 |
Each of the "&" functions returns an Unbounded_String obtained by concatenating |
| 2294 |
the string or character given or represented by one of the parameters, |
| 2295 |
with the string or character given or represented by the other parameter, |
| 2296 |
and applying To_Unbounded_String to the concatenation result string. |
| 2297 |
|
| 2298 |
@begin{Ramification} |
| 2299 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0005-1]} |
| 2300 |
@ChgAdded{Version=[5],Text=[If the resulting string is longer than |
| 2301 |
Natural'Last, Constraint_Error is raised as the upper bound of the underlying |
| 2302 |
String concatenation is outside of the range of the index subtype of Natural |
| 2303 |
(see @RefSecNum{Binary Adding Operators}). Note that the same is true for |
| 2304 |
other operations that attempt to create an overlong string: either they are defined |
| 2305 |
in terms of this concatenation operation (as with Append) or they are defined |
| 2306 |
in terms of Ada.Strings.Fixed operations (as with Insert and Replace_Slice), |
| 2307 |
which themselves are defined in terms of String concatenation (which raises |
| 2308 |
Constraint_Error for overlong strings as described above). Therefore, it is |
| 2309 |
never possible to create an Unbounded_String with a length greater than |
| 2310 |
Natural'Last.]} |
| 2311 |
@end{Ramification} |
| 2312 |
|
| 2313 |
The Element, Replace_Element, and Slice subprograms have the same effect |
| 2314 |
as the corresponding bounded-length string subprograms. |
| 2315 |
|
| 2316 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 2317 |
@ChgRef{Version=[3],Kind=[RevisedAdded],ARef=[AI05-0262-1]} |
| 2318 |
@ChgAdded{Version=[2],Text=[The function Unbounded_Slice returns the slice at |
| 2319 |
positions Low through High in the string represented by Source as an |
| 2320 |
Unbounded_String. The procedure Unbounded_Slice sets Target to the |
| 2321 |
Unbounded_String representing the slice at positions Low through High in the |
| 2322 |
string represented by Source. Both |
| 2323 |
@Chg{Version=[3],New=[subprograms],Old=[routines]} propagate Index_Error |
| 2324 |
if Low > Length(Source)+1 or High > Length(Source).]} |
| 2325 |
|
| 2326 |
Each of the functions "=", "<", ">", "<=", and ">=" |
| 2327 |
returns the same result as the corresponding String |
| 2328 |
operation applied to the String values given or represented by Left and Right. |
| 2329 |
|
| 2330 |
Each of the search subprograms (Index, Index_Non_Blank, Count, Find_Token) |
| 2331 |
has the same effect as the corresponding subprogram in Strings.Fixed applied |
| 2332 |
to the string represented by the Unbounded_String parameter. |
| 2333 |
|
| 2334 |
The Translate function has |
| 2335 |
an analogous effect to the corresponding subprogram in Strings.Fixed. |
| 2336 |
The translation is applied to the string represented by the Unbounded_String |
| 2337 |
parameter, and the result is converted (via To_Unbounded_String) to an |
| 2338 |
Unbounded_String. |
| 2339 |
|
| 2340 |
Each of the transformation functions (Replace_Slice, Insert, Overwrite, |
| 2341 |
Delete), selector functions (Trim, Head, Tail), and constructor functions |
| 2342 |
("*") is likewise analogous to its corresponding |
| 2343 |
subprogram in Strings.Fixed. For each of the subprograms, |
| 2344 |
the corresponding fixed-length string subprogram is applied to the string |
| 2345 |
represented by the Unbounded_String parameter, and |
| 2346 |
To_Unbounded_String is applied the result string. |
| 2347 |
|
| 2348 |
For each of the procedures Translate, |
| 2349 |
Replace_Slice, Insert, Overwrite, Delete, |
| 2350 |
Trim, Head, and Tail, the resulting string represented by the Source parameter |
| 2351 |
is given by the corresponding function for fixed-length strings applied to |
| 2352 |
the string represented by Source's original value. |
| 2353 |
@end{StaticSem} |
| 2354 |
|
| 2355 |
@begin{ImplReq} |
| 2356 |
No storage associated |
| 2357 |
with an Unbounded_String object shall be |
| 2358 |
lost upon assignment or scope exit. |
| 2359 |
@begin{ImplNote} |
| 2360 |
|
| 2361 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00301-01]} |
| 2362 |
A sample implementation of the private part of |
| 2363 |
the package and several of the subprograms appears in the @Chg{Version=[2], |
| 2364 |
New=[Ada 95 ],Old=[]}Rationale. |
| 2365 |
|
| 2366 |
@end{ImplNote} |
| 2367 |
@end{ImplReq} |
| 2368 |
|
| 2369 |
@begin{Incompatible95} |
| 2370 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00360-01]} |
| 2371 |
@ChgAdded{Version=[2],Text=[@Defn{incompatibilities with Ada 95} |
| 2372 |
@b[Amendment Correction:] Type Unbounded_String is defined to need |
| 2373 |
finalization. If the restriction No_Nested_Finalization (see |
| 2374 |
@RefSecNum{Tasking Restrictions}) applies to the partition, and |
| 2375 |
Unbounded_String does not have a controlled part, it will not be allowed in |
| 2376 |
local objects in Ada 2005 whereas it would be allowed in original Ada 95. |
| 2377 |
Such code is not portable, as most Ada compilers have a controlled part in |
| 2378 |
Unbounded_String, and thus would be illegal.]} |
| 2379 |
|
| 2380 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00301-01]} |
| 2381 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0005-1]} |
| 2382 |
@ChgAdded{Version=[2],Text=[Procedure Set_Unbounded_String, |
| 2383 |
two Unbounded_Slice subprograms, and overloaded |
| 2384 |
versions of Index and Index_Non_Blank are |
| 2385 |
@Chg{Version=[3],New=[],Old=[newly ]}added to Strings.Unbounded. |
| 2386 |
If Strings.Unbounded is |
| 2387 |
referenced in a @nt{use_clause}, and an entity @i<E> with the same |
| 2388 |
@nt{defining_identifier} as a new entity in Strings.Unbounded is defined in a |
| 2389 |
package that is also referenced in a @nt{use_clause}, the entity @i<E> may no |
| 2390 |
longer be use-visible, resulting in errors. This should be rare and is easily |
| 2391 |
fixed if it does occur.]} |
| 2392 |
@end{Incompatible95} |
| 2393 |
|
| 2394 |
@begin{Extend95} |
| 2395 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00161-01]} |
| 2396 |
@ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95} |
| 2397 |
@b[Amendment Correction:] Added a @nt{pragma} Preelaborable_Initialization to |
| 2398 |
type Unbounded_String, so that it can be used to declare default-initialized |
| 2399 |
objects in preelaborated units.]} |
| 2400 |
@end{Extend95} |
| 2401 |
|
| 2402 |
@begin{Incompatible2005} |
| 2403 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0031-1]} |
| 2404 |
@ChgAdded{Version=[3],Text=[@Defn{incompatibilities with Ada 2005} |
| 2405 |
An overloaded version of Find_Token is added to |
| 2406 |
Strings.Unbounded. If Strings.Unbounded is referenced in a @nt{use_clause}, |
| 2407 |
and an entity @i<E> with a @nt{defining_identifier} of Find_Token is |
| 2408 |
defined in a package that is also referenced in a @nt{use_clause}, the entity |
| 2409 |
@i<E> may no longer be use-visible, resulting in errors. This should be rare |
| 2410 |
and is easily fixed if it does occur.]} |
| 2411 |
@end{Incompatible2005} |
| 2412 |
|
| 2413 |
|
| 2414 |
@LabeledSubClause{String-Handling Sets and Mappings} |
| 2415 |
|
| 2416 |
@begin{Intro} |
| 2417 |
|
| 2418 |
The language-defined package Strings.Maps.Constants declares |
| 2419 |
Character_Set |
| 2420 |
and Character_Mapping |
| 2421 |
constants corresponding to classification and conversion functions |
| 2422 |
in package Characters.Handling. |
| 2423 |
@begin{discussion} |
| 2424 |
The Constants package is a child of Strings.Maps since it needs |
| 2425 |
visibility of the private part of Strings.Maps in order to |
| 2426 |
initialize the constants |
| 2427 |
in a preelaborable way (i.e. via aggregates versus function calls). |
| 2428 |
@end{discussion} |
| 2429 |
|
| 2430 |
@end{Intro} |
| 2431 |
|
| 2432 |
@begin{StaticSem} |
| 2433 |
@Leading@;The library package Strings.Maps.Constants has the following declaration: |
| 2434 |
|
| 2435 |
@begin{example} |
| 2436 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00362-01]} |
| 2437 |
@ChildUnit{Parent=[Ada.Strings.Maps],Child=[Constants]}@key[package] Ada.Strings.Maps.Constants @key[is] |
| 2438 |
@key[pragma] @Chg{Version=[2],New=[Pure],Old=[Preelaborate]}(Constants); |
| 2439 |
|
| 2440 |
@AdaObjDefn{Control_Set} : @key[constant] Character_Set; |
| 2441 |
@AdaObjDefn{Graphic_Set} : @key[constant] Character_Set; |
| 2442 |
@AdaObjDefn{Letter_Set} : @key[constant] Character_Set; |
| 2443 |
@AdaObjDefn{Lower_Set} : @key[constant] Character_Set; |
| 2444 |
@AdaObjDefn{Upper_Set} : @key[constant] Character_Set; |
| 2445 |
@AdaObjDefn{Basic_Set} : @key[constant] Character_Set; |
| 2446 |
@AdaObjDefn{Decimal_Digit_Set} : @key[constant] Character_Set; |
| 2447 |
@AdaObjDefn{Hexadecimal_Digit_Set} : @key[constant] Character_Set; |
| 2448 |
@AdaObjDefn{Alphanumeric_Set} : @key[constant] Character_Set; |
| 2449 |
@AdaObjDefn{Special_Set} : @key[constant] Character_Set; |
| 2450 |
@AdaObjDefn{ISO_646_Set} : @key[constant] Character_Set; |
| 2451 |
|
| 2452 |
@AdaObjDefn{Lower_Case_Map} : @key[constant] Character_Mapping; |
| 2453 |
--@Examcom{Maps to lower case for letters, else identity} |
| 2454 |
@AdaObjDefn{Upper_Case_Map} : @key[constant] Character_Mapping; |
| 2455 |
--@Examcom{Maps to upper case for letters, else identity} |
| 2456 |
@AdaObjDefn{Basic_Map} : @key[constant] Character_Mapping; |
| 2457 |
--@Examcom{Maps to basic letter for letters, else identity} |
| 2458 |
|
| 2459 |
@key[private] |
| 2460 |
... -- @Examcom{not specified by the language} |
| 2461 |
@key[end] Ada.Strings.Maps.Constants; |
| 2462 |
@end{example} |
| 2463 |
|
| 2464 |
|
| 2465 |
Each of these constants represents a correspondingly named |
| 2466 |
set of characters or |
| 2467 |
character mapping in Characters.Handling |
| 2468 |
(see @refsecnum(The Package Characters.Handling)). |
| 2469 |
@end{StaticSem} |
| 2470 |
|
| 2471 |
@begin{Notes} |
| 2472 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0114-1]} |
| 2473 |
@ChgAdded{Version=[3],Text=[There are certain characters which are defined to be |
| 2474 |
lower case letters by ISO 10646 and are therefore allowed in identifiers, but |
| 2475 |
are not considered lower case letters by Ada.Strings.Maps.Constants.]} |
| 2476 |
|
| 2477 |
@begin{Reason} |
| 2478 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 2479 |
@ChgAdded{Version=[3],Text=[This is to maintain runtime compatibility with the |
| 2480 |
Ada 95 definitions of these constants; existing correct programs could break if |
| 2481 |
the definitions were changed in a way the programs did not anticipate.]} |
| 2482 |
@end{Reason} |
| 2483 |
@end{Notes} |
| 2484 |
|
| 2485 |
@begin{Extend95} |
| 2486 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00362-01]} |
| 2487 |
@ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95} |
| 2488 |
Strings.Maps.Constants is now Pure, |
| 2489 |
so it can be used in pure units.]} |
| 2490 |
@end{Extend95} |
| 2491 |
|
| 2492 |
@begin{DiffWord2005} |
| 2493 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0114-1]} |
| 2494 |
@ChgAdded{Version=[3],Text=[@b<Correction:> Added a note to clarify that |
| 2495 |
these constants don't have any relationship to the characters allowed in |
| 2496 |
identifiers.]} |
| 2497 |
@end{DiffWord2005} |
| 2498 |
|
| 2499 |
|
| 2500 |
@LabeledSubClause{Wide_String Handling} |
| 2501 |
|
| 2502 |
@begin{Intro} |
| 2503 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00302-03]} |
| 2504 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0286-1]} |
| 2505 |
Facilities for handling strings of Wide_Character elements are |
| 2506 |
found in the packages Strings.@!Wide_Maps, Strings.@!Wide_Fixed, |
| 2507 |
Strings.@!Wide_@!Bounded, Strings.@!Wide_@!Unbounded, |
| 2508 |
and Strings.@!Wide_Maps.@!Wide_@!Constants@Chg{Version=[2],New=[, and in the |
| 2509 |
@Chg{Version=[3],New=[library ],Old=[]}functions Strings.@!Wide_Hash, |
| 2510 |
Strings.@!Wide_Fixed.@!Wide_Hash, |
| 2511 |
Strings.@!Wide_Bounded.@!Wide_Hash,@Chg{Version=[3],New=[],Old=[ and]} |
| 2512 |
Strings.@!Wide_Unbounded.@!Wide_Hash@Chg{Version=[3],New=[, |
| 2513 |
Strings.@!Wide_@!Hash_@!Case_@!Insensitive, |
| 2514 |
Strings.@!Wide_@!Fixed.Wide_@!Hash_@!Case_@!Insensitive, |
| 2515 |
Strings.@!Wide_@!Bounded.Wide_@!Hash_@!Case_@!Insensitive, |
| 2516 |
Strings.@!Wide_@!Unbounded.Wide_@!Hash_@!Case_@!Insensitive, |
| 2517 |
Strings.@!Wide_@!Equal_@!Case_@!Insensitive, |
| 2518 |
Strings.@!Wide_@!Fixed.Wide_@!Equal_@!Case_@!Insensitive, |
| 2519 |
Strings.@!Wide_@!Bounded.Wide_@!Equal_@!Case_@!Insensitive, and |
| 2520 |
Strings.@!Wide_@!Unbounded.Wide_@!Equal_@!Case_@!Insensitive],Old=[]}],Old=[]}. |
| 2521 |
They provide the same string-handling operations |
| 2522 |
as the corresponding packages@Chg{Version=[2],New=[ and functions],Old=[]} |
| 2523 |
for strings of Character elements. |
| 2524 |
@ChildUnit{Parent=[Ada.Strings],Child=[Wide_@!Fixed]} |
| 2525 |
@ChildUnit{Parent=[Ada.Strings],Child=[Wide_@!Bounded]} |
| 2526 |
@ChildUnit{Parent=[Ada.Strings],Child=[Wide_@!Unbounded]} |
| 2527 |
@ChildUnit{Parent=[Ada.Strings],Child=[Wide_@!Hash]} |
| 2528 |
@SubChildUnit{Parent=[Ada.Strings.Wide_@!Fixed],Child=[Wide_@!Hash]} |
| 2529 |
@SubChildUnit{Parent=[Ada.Strings.Wide_@!Bounded],Child=[Wide_@!Hash]} |
| 2530 |
@SubChildUnit{Parent=[Ada.Strings.Wide_@!Unbounded],Child=[Wide_@!Hash]} |
| 2531 |
@Chg{Version=[3],New=[@ChildUnit{Parent=[Ada.Strings],Child=[Wide_@!Equal_Case_Insensitive]} |
| 2532 |
@SubChildUnit{Parent=[Ada.Strings.Wide_@!Fixed],Child=[Wide_@!Equal_Case_Insensitive]} |
| 2533 |
@SubChildUnit{Parent=[Ada.Strings.Wide_@!Bounded],Child=[Wide_@!Equal_Case_Insensitive]} |
| 2534 |
@SubChildUnit{Parent=[Ada.Strings.Wide_@!Unbounded],Child=[Wide_@!Equal_Case_Insensitive]} |
| 2535 |
@ChildUnit{Parent=[Ada.Strings],Child=[Wide_@!Hash_Case_Insensitive]} |
| 2536 |
@SubChildUnit{Parent=[Ada.Strings.Wide_@!Fixed],Child=[Wide_@!Hash_Case_Insensitive]} |
| 2537 |
@SubChildUnit{Parent=[Ada.Strings.Wide_@!Bounded],Child=[Wide_@!Hash_Case_Insensitive]} |
| 2538 |
@SubChildUnit{Parent=[Ada.Strings.Wide_@!Unbounded],Child=[Wide_@!Hash_Case_Insensitive]}],Old=[]} |
| 2539 |
@ChildUnit{Parent=[Ada.Strings.Wide_@!Maps],Child=[Wide_@!Constants]} |
| 2540 |
@end{Intro} |
| 2541 |
|
| 2542 |
@begin{StaticSem} |
| 2543 |
The package Strings.Wide_Maps has the following declaration. |
| 2544 |
@begin{example} |
| 2545 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0241-1]} |
| 2546 |
@ChildUnit{Parent=[Ada.Strings],Child=[Wide_@!Maps]}@key[package] Ada.Strings.Wide_Maps@Chg{Version=[5],New=[],Old=[ @key[is]]} |
| 2547 |
@Chg{Version=[5],New=[@key[with]],Old=[@key[pragma]]} Preelaborate@Chg{Version=[5],New=[, Nonblocking @key[is]],Old=[(Wide_Maps);]} |
| 2548 |
|
| 2549 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00161-01]} |
| 2550 |
--@Examcom{ Representation for a set of Wide_Character values:} |
| 2551 |
@key[type] @AdaTypeDefn{Wide_Character_Set} @key[is] @key[private];@Chg{Version=[2],New=[ |
| 2552 |
@key[pragma] Preelaborable_Initialization(Wide_Character_Set);],Old=[]} |
| 2553 |
|
| 2554 |
@AdaObjDefn{Null_Set} : @key[constant] Wide_Character_Set; |
| 2555 |
|
| 2556 |
@key[type] @AdaTypeDefn{Wide_Character_Range} @key[is] |
| 2557 |
@key[record] |
| 2558 |
Low : Wide_Character; |
| 2559 |
High : Wide_Character; |
| 2560 |
@key[end] @key[record]; |
| 2561 |
-- @Examcom{Represents Wide_Character range Low..High} |
| 2562 |
|
| 2563 |
@key[type] @AdaTypeDefn{Wide_Character_Ranges} @key[is] @key[array] (Positive @key[range] <>) |
| 2564 |
@key[of] Wide_Character_Range; |
| 2565 |
|
| 2566 |
@key[function] @AdaSubDefn{To_Set} (Ranges : @key[in] Wide_Character_Ranges) |
| 2567 |
@key[return] Wide_Character_Set; |
| 2568 |
|
| 2569 |
@key[function] @AdaSubDefn{To_Set} (Span : @key[in] Wide_Character_Range) |
| 2570 |
@key[return] Wide_Character_Set; |
| 2571 |
|
| 2572 |
@key[function] @AdaSubDefn{To_Ranges} (Set : @key[in] Wide_Character_Set) |
| 2573 |
@key[return] Wide_Character_Ranges; |
| 2574 |
|
| 2575 |
@key[function] "=" (Left, Right : @key[in] Wide_Character_Set) @key[return] Boolean; |
| 2576 |
|
| 2577 |
@key[function] "@key[not]" (Right : @key[in] Wide_Character_Set) |
| 2578 |
@key[return] Wide_Character_Set; |
| 2579 |
@key[function] "@key[and]" (Left, Right : @key[in] Wide_Character_Set) |
| 2580 |
@key[return] Wide_Character_Set; |
| 2581 |
@key[function] "@key[or]" (Left, Right : @key[in] Wide_Character_Set) |
| 2582 |
@key[return] Wide_Character_Set; |
| 2583 |
@key[function] "@key[xor]" (Left, Right : @key[in] Wide_Character_Set) |
| 2584 |
@key[return] Wide_Character_Set; |
| 2585 |
@key[function] "-" (Left, Right : @key[in] Wide_Character_Set) |
| 2586 |
@key[return] Wide_Character_Set; |
| 2587 |
|
| 2588 |
@key[function] @AdaSubDefn{Is_In} (Element : @key[in] Wide_Character; |
| 2589 |
Set : @key[in] Wide_Character_Set) |
| 2590 |
@key[return] Boolean; |
| 2591 |
|
| 2592 |
@key[function] @AdaSubDefn{Is_Subset} (Elements : @key[in] Wide_Character_Set; |
| 2593 |
Set : @key[in] Wide_Character_Set) |
| 2594 |
@key[return] Boolean; |
| 2595 |
|
| 2596 |
@key[function] "<=" (Left : @key[in] Wide_Character_Set; |
| 2597 |
Right : @key[in] Wide_Character_Set) |
| 2598 |
@key[return] Boolean @key[renames] Is_Subset; |
| 2599 |
|
| 2600 |
|
| 2601 |
--@Examcom{ Alternative representation for a set of Wide_Character values:} |
| 2602 |
@key[subtype] @AdaSubtypeDefn{Name=[Wide_Character_Sequence],Of=[Wide_String]} @key[is] Wide_String; |
| 2603 |
|
| 2604 |
@key[function] @AdaSubDefn{To_Set} (Sequence : @key[in] Wide_Character_Sequence) |
| 2605 |
@key[return] Wide_Character_Set; |
| 2606 |
|
| 2607 |
@key[function] @AdaSubDefn{To_Set} (Singleton : @key[in] Wide_Character) |
| 2608 |
@key[return] Wide_Character_Set; |
| 2609 |
|
| 2610 |
@key[function] @AdaSubDefn{To_Sequence} (Set : @key[in] Wide_Character_Set) |
| 2611 |
@key[return] Wide_Character_Sequence; |
| 2612 |
|
| 2613 |
|
| 2614 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00161-01]} |
| 2615 |
--@Examcom{ Representation for a Wide_Character to Wide_Character mapping:} |
| 2616 |
@key[type] @AdaTypeDefn{Wide_Character_Mapping} @key[is] @key[private];@Chg{Version=[2],New=[ |
| 2617 |
@key[pragma] Preelaborable_Initialization(Wide_Character_Mapping);],Old=[]} |
| 2618 |
|
| 2619 |
@key[function] @AdaSubDefn{Value} (Map : @key[in] Wide_Character_Mapping; |
| 2620 |
Element : @key[in] Wide_Character) |
| 2621 |
@key[return] Wide_Character; |
| 2622 |
|
| 2623 |
@AdaObjDefn{Identity} : @key[constant] Wide_Character_Mapping; |
| 2624 |
|
| 2625 |
@key[function] @AdaSubDefn{To_Mapping} (From, To : @key[in] Wide_Character_Sequence) |
| 2626 |
@key[return] Wide_Character_Mapping; |
| 2627 |
|
| 2628 |
@key[function] @AdaSubDefn{To_Domain} (Map : @key[in] Wide_Character_Mapping) |
| 2629 |
@key[return] Wide_Character_Sequence; |
| 2630 |
|
| 2631 |
@key[function] @AdaSubDefn{To_Range} (Map : @key[in] Wide_Character_Mapping) |
| 2632 |
@key[return] Wide_Character_Sequence; |
| 2633 |
|
| 2634 |
|
| 2635 |
@key{type} @AdaTypeDefn{Wide_Character_Mapping_Function} @key{is} |
| 2636 |
@key{access} @key{function} (From : @key{in} Wide_Character) @key{return} Wide_Character; |
| 2637 |
|
| 2638 |
@key[private] |
| 2639 |
... -- @Examcom{not specified by the language} |
| 2640 |
@key[end] Ada.Strings.Wide_Maps; |
| 2641 |
@end{example} |
| 2642 |
|
| 2643 |
The context clause for each of the packages Strings.Wide_Fixed, |
| 2644 |
Strings.Wide_Bounded, and Strings.Wide_Unbounded |
| 2645 |
identifies Strings.Wide_Maps instead of Strings.Maps. |
| 2646 |
|
| 2647 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0223-1]} |
| 2648 |
@ChgAdded{Version=[3],Text=[Types Wide_Character_Set and Wide_Character_Mapping |
| 2649 |
need finalization.]} |
| 2650 |
|
| 2651 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00302-03]} |
| 2652 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0286-1]} |
| 2653 |
@Leading@;For each of the packages Strings.Fixed, Strings.Bounded, |
| 2654 |
Strings.Unbounded, and Strings.Maps.Constants@Chg{Version=[2],New=[, and |
| 2655 |
for @Chg{Version=[3],New=[library ],Old=[]}functions |
| 2656 |
Strings.Hash, Strings.Fixed.Hash, Strings.Bounded.Hash, |
| 2657 |
@Chg{Version=[3],New=[],Old=[and ]}Strings.@!Unbounded.Hash, |
| 2658 |
@Chg{Version=[3],New=[Strings.@!Hash_@!Case_@!Insensitive, |
| 2659 |
Strings.@!Fixed.Hash_@!Case_@!Insensitive, |
| 2660 |
Strings.@!Bounded.Hash_@!Case_@!Insensitive, |
| 2661 |
Strings.@!Unbounded.Hash_@!Case_@!Insensitive, |
| 2662 |
Strings.@!Equal_@!Case_@!Insensitive, |
| 2663 |
Strings.@!Fixed.Equal_@!Case_@!Insensitive, |
| 2664 |
Strings.@!Bounded.Equal_@!Case_@!Insensitive, and |
| 2665 |
Strings.@!Unbounded.Equal_@!Case_@!Insensitive, ],Old=[]}],Old=[]}the |
| 2666 |
corresponding wide string |
| 2667 |
package @Chg{Version=[3],New=[or function ],Old=[]}has |
| 2668 |
the same contents except that |
| 2669 |
@begin{itemize} |
| 2670 |
Wide_Space replaces Space |
| 2671 |
|
| 2672 |
Wide_Character replaces Character |
| 2673 |
|
| 2674 |
Wide_String replaces String |
| 2675 |
|
| 2676 |
Wide_Character_Set replaces Character_Set |
| 2677 |
|
| 2678 |
Wide_Character_Mapping replaces Character_Mapping |
| 2679 |
|
| 2680 |
Wide_Character_Mapping_Function replaces Character_Mapping_Function |
| 2681 |
|
| 2682 |
Wide_Maps replaces Maps |
| 2683 |
|
| 2684 |
Bounded_Wide_String replaces Bounded_String |
| 2685 |
|
| 2686 |
Null_Bounded_Wide_String replaces Null_Bounded_String |
| 2687 |
|
| 2688 |
To_Bounded_Wide_String replaces To_Bounded_String |
| 2689 |
|
| 2690 |
To_Wide_String replaces To_String |
| 2691 |
|
| 2692 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 2693 |
@ChgAdded{Version=[2],Text=[Set_Bounded_Wide_String replaces Set_Bounded_String]} |
| 2694 |
|
| 2695 |
Unbounded_Wide_String replaces Unbounded_String |
| 2696 |
|
| 2697 |
Null_Unbounded_Wide_String replaces Null_Unbounded_String |
| 2698 |
|
| 2699 |
Wide_String_Access replaces String_Access |
| 2700 |
|
| 2701 |
To_Unbounded_Wide_String replaces To_Unbounded_String |
| 2702 |
|
| 2703 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]} |
| 2704 |
@ChgAdded{Version=[2],Text=[Set_Unbounded_Wide_String replaces Set_Unbounded_String]} |
| 2705 |
|
| 2706 |
@end{Itemize} |
| 2707 |
|
| 2708 |
@Leading@keepnext@;The following additional declaration is present in |
| 2709 |
Strings.Wide_Maps.Wide_Constants: |
| 2710 |
@begin{example} |
| 2711 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01],ARef=[AI95-00395-01]} |
| 2712 |
@AdaObjDefn{Character_Set} : @key[constant] Wide_Maps.Wide_Character_Set; |
| 2713 |
--@Examcom{Contains each Wide_Character value WC such that}@Chg{Version=[2],New=[ |
| 2714 |
--],Old=[]}@Examcom{Characters.@Chg{Version=[2],New=[Conversions.],Old=[]}Is_Character(WC) is True} |
| 2715 |
@end{example} |
| 2716 |
@end{StaticSem} |
| 2717 |
|
| 2718 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00395-01]} |
| 2719 |
@ChgAdded{Version=[2],Text=[Each Wide_Character_Set constant in the package |
| 2720 |
Strings.Wide_Maps.Wide_Constants contains no values outside the Character |
| 2721 |
portion of Wide_Character. Similarly, each Wide_Character_Mapping constant in |
| 2722 |
this package is the identity mapping when applied to any element outside the |
| 2723 |
Character portion of Wide_Character.]} |
| 2724 |
|
| 2725 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00362-01]} |
| 2726 |
@ChgAdded{Version=[2],Text=[@nt{Pragma} Pure is replaced by |
| 2727 |
@nt{pragma} Preelaborate in Strings.Wide_Maps.Wide_Constants.]} |
| 2728 |
|
| 2729 |
@begin{Notes} |
| 2730 |
If a null Wide_Character_Mapping_Function is passed to any of the |
| 2731 |
Wide_String handling subprograms, Constraint_Error is propagated. |
| 2732 |
|
| 2733 |
@ChgRef{Version=[2],Kind=[DeletedNoDelMsg],ARef=[AI95-00395-01]} |
| 2734 |
@ChgDeleted{Version=[2],Text=[Each Wide_Character_Set constant in the package |
| 2735 |
Strings.Wide_Maps.Wide_Constants contains no values outside the Character |
| 2736 |
portion of Wide_Character. Similarly, each Wide_Character_Mapping |
| 2737 |
constant in this package is the identity mapping when applied to |
| 2738 |
any element outside the Character portion of Wide_Character.]} |
| 2739 |
@end{Notes} |
| 2740 |
|
| 2741 |
@begin{Incompatible95} |
| 2742 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00301-01]} |
| 2743 |
@ChgAdded{Version=[2],Text=[@Defn{incompatibilities with Ada 95} |
| 2744 |
Various new operations are added to Strings.Wide_Fixed, Strings.Wide_Bounded, |
| 2745 |
and Strings.Wide_Unbounded. If one of these packages is referenced in a |
| 2746 |
@nt{use_clause}, and an entity @i<E> with the same @nt{defining_identifier} |
| 2747 |
as a new entity is defined in a package that is also referenced in a |
| 2748 |
@nt{use_clause}, the entity @i<E> may no longer be use-visible, resulting in |
| 2749 |
errors. This should be rare and is easily fixed if it does occur.]} |
| 2750 |
@end{Incompatible95} |
| 2751 |
|
| 2752 |
@begin{Extend95} |
| 2753 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00161-01]} |
| 2754 |
@ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95} |
| 2755 |
@b[Amendment Correction:] Added @nt{pragma} Preelaborable_Initialization to |
| 2756 |
types Wide_Character_Set and Wide_Character_Mapping, so that they can be |
| 2757 |
used to declare default-initialized objects in preelaborated units.]} |
| 2758 |
@end{Extend95} |
| 2759 |
|
| 2760 |
@begin{DiffWord95} |
| 2761 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]} |
| 2762 |
@ChgAdded{Version=[2],Text=[Corrected the description of Character_Set.]} |
| 2763 |
|
| 2764 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00302-03]} |
| 2765 |
@ChgAdded{Version=[2],Text=[Added wide versions of Strings.Hash and |
| 2766 |
Strings.Unbounded.Hash.]} |
| 2767 |
|
| 2768 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00362-01]} |
| 2769 |
@ChgAdded{Version=[2],Text=[Added wording so that |
| 2770 |
Strings.Wide_Maps.Wide_Constants does not change to Pure.]} |
| 2771 |
|
| 2772 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00395-01]} |
| 2773 |
@ChgAdded{Version=[2],Text=[The second Note is now normative text, since |
| 2774 |
there is no way to derive it from the other rules. It's a little |
| 2775 |
weird given the use of Unicode character classifications in Ada 2005; |
| 2776 |
but changing it would be inconsistent with Ada 95 and a one-to-one |
| 2777 |
mapping isn't necessarily correct anyway.]} |
| 2778 |
@end{DiffWord95} |
| 2779 |
|
| 2780 |
@begin{Extend2005} |
| 2781 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0286-1]} |
| 2782 |
@ChgAdded{Version=[3],Text=[@Defn{extensions to Ada 2005} |
| 2783 |
The case insenstive library functions |
| 2784 |
(Strings.Wide_@!Equal_@!Case_@!Insensitive, |
| 2785 |
Strings.Wide_@!Fixed.Wide_@!Equal_@!Case_@!Insensitive, |
| 2786 |
Strings.Wide_@!Bounded.Wide_@!Equal_@!Case_@!Insensitive, |
| 2787 |
Strings.Wide_@!Unbounded.Wide_@!Equal_@!Case_@!Insensitive, |
| 2788 |
Strings.Wide_@!Hash_@!Case_@!Insensitive, |
| 2789 |
Strings.Wide_@!Fixed.Wide_@!Hash_@!Case_@!Insensitive, |
| 2790 |
Strings.Wide_@!Bounded.Wide_@!Hash_@!Case_@!Insensitive, and |
| 2791 |
Strings.Wide_@!Unbounded.Wide_@!Hash_@!Case_@!Insensitive) |
| 2792 |
are new.]} |
| 2793 |
@end{Extend2005} |
| 2794 |
|
| 2795 |
@begin{DiffWord2005} |
| 2796 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0223-1]} |
| 2797 |
@ChgAdded{Version=[3],Text=[@b<Correction>: Identified Wide_Character_Set |
| 2798 |
and Wide_Character_Mapping as needing finalization. It is likely that they |
| 2799 |
are implemented with a controlled type, so this change is unlikely to make |
| 2800 |
any difference in practice.]} |
| 2801 |
@end{DiffWord2005} |
| 2802 |
|
| 2803 |
|
| 2804 |
@LabeledAddedSubClause{Version=[2],Name=[Wide_Wide_String Handling]} |
| 2805 |
|
| 2806 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01],ARef=[AI95-00395-01]} |
| 2807 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0286-1]} |
| 2808 |
@ChgAdded{Version=[2],Text=[Facilities for handling strings of |
| 2809 |
Wide_Wide_Character elements are found in |
| 2810 |
the packages Strings.@!Wide_Wide_@!Maps, Strings.@!Wide_Wide_@!Fixed, |
| 2811 |
Strings.@!Wide_Wide_@!Bounded, Strings.@!Wide_Wide_@!Unbounded, and |
| 2812 |
Strings.@!Wide_Wide_@!Maps.@!Wide_Wide_@!Constants, and in the |
| 2813 |
@Chg{Version=[3],New=[library ],Old=[]}functions Strings.@!Wide_Wide_@!Hash, |
| 2814 |
Strings.@!Wide_Wide_@!Fixed.@!Wide_Wide_@!Hash, |
| 2815 |
Strings.@!Wide_Wide_@!Bounded.@!Wide_@!Wide_@!Hash,@Chg{Version=[3],New=[],Old=[ and]} |
| 2816 |
Strings.@!Wide_Wide_@!Unbounded.@!Wide_@!Wide_@!Hash@Chg{Version=[3],New=[, |
| 2817 |
Strings.@!Wide_Wide_@!Hash_@!Case_@!Insensitive, |
| 2818 |
Strings.@!Wide_Wide_@!Fixed.Wide_Wide_@!Hash_@!Case_@!Insensitive, |
| 2819 |
Strings.@!Wide_Wide_@!Bounded.Wide_Wide_@!Hash_@!Case_@!Insensitive, |
| 2820 |
Strings.@!Wide_Wide_@!Unbounded.Wide_Wide_@!Hash_@!Case_@!Insensitive, |
| 2821 |
Strings.@!Wide_Wide_@!Equal_@!Case_@!Insensitive, |
| 2822 |
Strings.@!Wide_Wide_@!Fixed.Wide_Wide_@!Equal_@!Case_@!Insensitive, |
| 2823 |
Strings.@!Wide_Wide_@!Bounded.Wide_Wide_@!Equal_@!Case_@!Insensitive, and |
| 2824 |
Strings.@!Wide_Wide_@!Unbounded.Wide_Wide_@!Equal_@!Case_@!Insensitive],Old=[]}. |
| 2825 |
They provide the same |
| 2826 |
string-handling operations as the corresponding packages and functions |
| 2827 |
for strings of Character elements. |
| 2828 |
@ChildUnit{Parent=[Ada.Strings],Child=[Wide_Wide_Fixed]} |
| 2829 |
@ChildUnit{Parent=[Ada.Strings],Child=[Wide_Wide_Bounded]} |
| 2830 |
@ChildUnit{Parent=[Ada.Strings],Child=[Wide_Wide_Unbounded]} |
| 2831 |
@ChildUnit{Parent=[Ada.Strings],Child=[Wide_Wide_@!Hash]} |
| 2832 |
@SubChildUnit{Parent=[Ada.Strings.Wide_Wide_@!Fixed],Child=[Wide_Wide_@!Hash]} |
| 2833 |
@SubChildUnit{Parent=[Ada.Strings.Wide_Wide_@!Bounded],Child=[Wide_Wide_@!Hash]} |
| 2834 |
@SubChildUnit{Parent=[Ada.Strings.Wide_Wide_@!Unbounded],Child=[Wide_Wide_@!Hash]} |
| 2835 |
@Chg{Version=[3],New=[@ChildUnit{Parent=[Ada.Strings],Child=[Wide_Wide_@!Equal_Case_Insensitive]} |
| 2836 |
@SubChildUnit{Parent=[Ada.Strings.Wide_Wide_@!Fixed],Child=[Wide_Wide_@!Equal_Case_Insensitive]} |
| 2837 |
@SubChildUnit{Parent=[Ada.Strings.Wide_Wide_@!Bounded],Child=[Wide_Wide_@!Equal_Case_Insensitive]} |
| 2838 |
@SubChildUnit{Parent=[Ada.Strings.Wide_Wide_@!Unbounded],Child=[Wide_Wide_@!Equal_Case_Insensitive]} |
| 2839 |
@ChildUnit{Parent=[Ada.Strings],Child=[Wide_Wide_@!Hash_Case_Insensitive]} |
| 2840 |
@SubChildUnit{Parent=[Ada.Strings.Wide_Wide_@!Fixed],Child=[Wide_Wide_@!Hash_Case_Insensitive]} |
| 2841 |
@SubChildUnit{Parent=[Ada.Strings.Wide_Wide_@!Bounded],Child=[Wide_Wide_@!Hash_Case_Insensitive]} |
| 2842 |
@SubChildUnit{Parent=[Ada.Strings.Wide_Wide_@!Unbounded],Child=[Wide_Wide_@!Hash_Case_Insensitive]}],Old=[]} |
| 2843 |
@ChildUnit{Parent=[Ada.Strings.Wide_Wide_@!Maps],Child=[Wide_Wide_@!Constants]}]} |
| 2844 |
|
| 2845 |
@begin{StaticSem} |
| 2846 |
|
| 2847 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]} |
| 2848 |
@ChgAdded{Version=[2],Type=[Leading],Text=[The library package Strings.Wide_Wide_Maps has the following declaration.]} |
| 2849 |
|
| 2850 |
@begin{Example} |
| 2851 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2852 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0241-1]} |
| 2853 |
@ChgAdded{Version=[2],Text=[@key<package> Ada.Strings.Wide_Wide_Maps@Chg{Version=[5],New=[],Old=[ @key[is]]}@ChildUnit{Parent=[Ada.Strings],Child=[Wide_Wide_Maps]} |
| 2854 |
@Chg{Version=[5],New=[@key[with]],Old=[@key[pragma]]} Preelaborate@Chg{Version=[5],New=[, Nonblocking @key[is]],Old=[(Wide_Wide_Maps);]}]} |
| 2855 |
|
| 2856 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2857 |
@ChgAdded{Version=[2],Text=[ -- @Examcom[Representation for a set of Wide_Wide_Character values:] |
| 2858 |
@key<type> @AdaTypeDefn{Wide_Wide_Character_Set} @key<is private>; |
| 2859 |
@key<pragma> Preelaborable_Initialization(Wide_Wide_Character_Set);]} |
| 2860 |
|
| 2861 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2862 |
@ChgAdded{Version=[2],Text=[ @AdaObjDefn{Null_Set} : @key<constant> Wide_Wide_Character_Set;]} |
| 2863 |
|
| 2864 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2865 |
@ChgAdded{Version=[2],Text=[ @key<type> @AdaTypeDefn{Wide_Wide_Character_Range} @key<is> |
| 2866 |
@key<record> |
| 2867 |
Low : Wide_Wide_Character; |
| 2868 |
High : Wide_Wide_Character; |
| 2869 |
@key<end record>; |
| 2870 |
-- @Examcom[Represents Wide_Wide_Character range Low..High]]} |
| 2871 |
|
| 2872 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2873 |
@ChgAdded{Version=[2],Text=[ @key<type> @AdaTypeDefn{Wide_Wide_Character_Ranges} @key<is array> (Positive @key<range> <>) |
| 2874 |
@key<of> Wide_Wide_Character_Range;]} |
| 2875 |
|
| 2876 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2877 |
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{To_Set} (Ranges : @key<in> Wide_Wide_Character_Ranges) |
| 2878 |
@key<return> Wide_Wide_Character_Set;]} |
| 2879 |
|
| 2880 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2881 |
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{To_Set} (Span : @key<in> Wide_Wide_Character_Range) |
| 2882 |
@key<return> Wide_Wide_Character_Set;]} |
| 2883 |
|
| 2884 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2885 |
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{To_Ranges} (Set : @key<in> Wide_Wide_Character_Set) |
| 2886 |
@key<return> Wide_Wide_Character_Ranges;]} |
| 2887 |
|
| 2888 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2889 |
@ChgAdded{Version=[2],Text=[ @key<function> "=" (Left, Right : @key<in> Wide_Wide_Character_Set) @key<return> Boolean;]} |
| 2890 |
|
| 2891 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2892 |
@ChgAdded{Version=[2],Text=[ @key<function> "@key<not>" (Right : @key<in> Wide_Wide_Character_Set) |
| 2893 |
@key<return> Wide_Wide_Character_Set; |
| 2894 |
@key<function> "@key<and>" (Left, Right : @key<in> Wide_Wide_Character_Set) |
| 2895 |
@key<return> Wide_Wide_Character_Set; |
| 2896 |
@key<function> "@key<or>" (Left, Right : @key<in> Wide_Wide_Character_Set) |
| 2897 |
@key<return> Wide_Wide_Character_Set; |
| 2898 |
@key<function> "@key<xor>" (Left, Right : @key<in> Wide_Wide_Character_Set) |
| 2899 |
@key<return> Wide_Wide_Character_Set; |
| 2900 |
@key<function> "-" (Left, Right : @key<in> Wide_Wide_Character_Set) |
| 2901 |
@key<return> Wide_Wide_Character_Set;]} |
| 2902 |
|
| 2903 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2904 |
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{Is_In} (Element : @key<in> Wide_Wide_Character; |
| 2905 |
Set : @key<in> Wide_Wide_Character_Set) |
| 2906 |
@key<return> Boolean;]} |
| 2907 |
|
| 2908 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2909 |
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{Is_Subset} (Elements : @key<in> Wide_Wide_Character_Set; |
| 2910 |
Set : @key<in> Wide_Wide_Character_Set) |
| 2911 |
@key<return> Boolean;]} |
| 2912 |
|
| 2913 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2914 |
@ChgAdded{Version=[2],Text=[ @key<function> "<=" (Left : @key<in> Wide_Wide_Character_Set; |
| 2915 |
Right : @key<in> Wide_Wide_Character_Set) |
| 2916 |
@key<return> Boolean @key<renames> Is_Subset;]} |
| 2917 |
|
| 2918 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2919 |
@ChgAdded{Version=[2],Text=[ -- @Examcom[Alternative representation for a set of Wide_Wide_Character values:] |
| 2920 |
@key<subtype> @AdaSubtypeDefn{Name=[Wide_Wide_Character_Sequence],Of=[Wide_Wide_String]} @key<is> Wide_Wide_String;]} |
| 2921 |
|
| 2922 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2923 |
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{To_Set} (Sequence : @key<in> Wide_Wide_Character_Sequence) |
| 2924 |
@key<return> Wide_Wide_Character_Set;]} |
| 2925 |
|
| 2926 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2927 |
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{To_Set} (Singleton : @key<in> Wide_Wide_Character) |
| 2928 |
@key<return> Wide_Wide_Character_Set;]} |
| 2929 |
|
| 2930 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2931 |
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{To_Sequence} (Set : @key<in> Wide_Wide_Character_Set) |
| 2932 |
@key<return> Wide_Wide_Character_Sequence;]} |
| 2933 |
|
| 2934 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2935 |
@ChgAdded{Version=[2],Text=[ -- @Examcom[Representation for a Wide_Wide_Character to Wide_Wide_Character] |
| 2936 |
-- @Examcom[mapping:] |
| 2937 |
@key<type> @AdaTypeDefn{Wide_Wide_Character_Mapping} @key<is private>; |
| 2938 |
@key<pragma> Preelaborable_Initialization(Wide_Wide_Character_Mapping);]} |
| 2939 |
|
| 2940 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2941 |
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{Value} (Map : @key<in> Wide_Wide_Character_Mapping; |
| 2942 |
Element : @key<in> Wide_Wide_Character) |
| 2943 |
@key<return> Wide_Wide_Character;]} |
| 2944 |
|
| 2945 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2946 |
@ChgAdded{Version=[2],Text=[ @AdaObjDefn{Identity} : @key<constant> Wide_Wide_Character_Mapping;]} |
| 2947 |
|
| 2948 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2949 |
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{To_Mapping} (From, To : @key<in> Wide_Wide_Character_Sequence) |
| 2950 |
@key<return> Wide_Wide_Character_Mapping;]} |
| 2951 |
|
| 2952 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2953 |
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{To_Domain} (Map : @key<in> Wide_Wide_Character_Mapping) |
| 2954 |
@key<return> Wide_Wide_Character_Sequence;]} |
| 2955 |
|
| 2956 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2957 |
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{To_Range} (Map : @key<in> Wide_Wide_Character_Mapping) |
| 2958 |
@key<return> Wide_Wide_Character_Sequence;]} |
| 2959 |
|
| 2960 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2961 |
@ChgAdded{Version=[2],Text=[ @key<type> @AdaTypeDefn{Wide_Wide_Character_Mapping_Function} @key<is> |
| 2962 |
@key<access function> (From : @key<in> Wide_Wide_Character) |
| 2963 |
@key<return> Wide_Wide_Character;]} |
| 2964 |
|
| 2965 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2966 |
@ChgAdded{Version=[2],Text=[@key<private> |
| 2967 |
... -- @Examcom[not specified by the language] |
| 2968 |
@key<end> Ada.Strings.Wide_Wide_Maps;]} |
| 2969 |
@end{Example} |
| 2970 |
|
| 2971 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]} |
| 2972 |
@ChgAdded{Version=[2],Text=[@ChildUnit{Parent=[Ada.Strings.Wide_@!Maps],Child=[Wide_@!Constants]} |
| 2973 |
The context clause for each of the packages Strings.Wide_Wide_Fixed, |
| 2974 |
Strings.Wide_Wide_Bounded, and Strings.Wide_Wide_Unbounded identifies |
| 2975 |
Strings.Wide_Wide_Maps instead of Strings.Maps.]} |
| 2976 |
|
| 2977 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0223-1]} |
| 2978 |
@ChgAdded{Version=[3],Text=[Types Wide_Wide_Character_Set and |
| 2979 |
Wide_Wide_Character_Mapping need finalization.]} |
| 2980 |
|
| 2981 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]} |
| 2982 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0286-1]} |
| 2983 |
@ChgAdded{Version=[2],Type=[Leading],Text=[For each of the packages |
| 2984 |
Strings.@!Fixed, Strings.@!Bounded, Strings.@!Unbounded, and Strings.@!Maps.Constants, |
| 2985 |
and for @Chg{Version=[3],New=[library ],Old=[]}functions |
| 2986 |
Strings.@!Hash, Strings.@!Fixed.Hash, Strings.@!Bounded.Hash, |
| 2987 |
@Chg{Version=[3],New=[],Old=[and ]}Strings.@!Unbounded.Hash, |
| 2988 |
@Chg{Version=[3],New=[Strings.@!Hash_@!Case_@!Insensitive, |
| 2989 |
Strings.@!Fixed.Hash_@!Case_@!Insensitive, |
| 2990 |
Strings.@!Bounded.Hash_@!Case_@!Insensitive, |
| 2991 |
Strings.@!Unbounded.Hash_@!Case_@!Insensitive, |
| 2992 |
Strings.@!Equal_@!Case_@!Insensitive, |
| 2993 |
Strings.@!Fixed.Equal_@!Case_@!Insensitive, |
| 2994 |
Strings.@!Bounded.Equal_@!Case_@!Insensitive, and |
| 2995 |
Strings.@!Unbounded.Equal_@!Case_@!Insensitive, |
| 2996 |
],Old=[]}the corresponding wide wide string package or function has the same |
| 2997 |
contents except that]} |
| 2998 |
|
| 2999 |
@begin{Itemize} |
| 3000 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3001 |
@ChgAdded{Version=[2],Text=[Wide_Wide_Space replaces Space]} |
| 3002 |
|
| 3003 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3004 |
@ChgAdded{Version=[2],Text=[Wide_Wide_Character replaces Character]} |
| 3005 |
|
| 3006 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3007 |
@ChgAdded{Version=[2],Text=[Wide_Wide_String replaces String]} |
| 3008 |
|
| 3009 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3010 |
@ChgAdded{Version=[2],Text=[Wide_Wide_Character_Set replaces Character_Set]} |
| 3011 |
|
| 3012 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3013 |
@ChgAdded{Version=[2],Text=[Wide_Wide_Character_Mapping replaces Character_Mapping]} |
| 3014 |
|
| 3015 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3016 |
@ChgAdded{Version=[2],Text=[Wide_Wide_Character_Mapping_Function replaces Character_Mapping_Function]} |
| 3017 |
|
| 3018 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3019 |
@ChgAdded{Version=[2],Text=[Wide_Wide_Maps replaces Maps]} |
| 3020 |
|
| 3021 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3022 |
@ChgAdded{Version=[2],Text=[Bounded_Wide_Wide_String replaces Bounded_String]} |
| 3023 |
|
| 3024 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3025 |
@ChgAdded{Version=[2],Text=[Null_Bounded_Wide_Wide_String replaces Null_Bounded_String]} |
| 3026 |
|
| 3027 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3028 |
@ChgAdded{Version=[2],Text=[To_Bounded_Wide_Wide_String replaces To_Bounded_String]} |
| 3029 |
|
| 3030 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3031 |
@ChgAdded{Version=[2],Text=[To_Wide_Wide_String replaces To_String]} |
| 3032 |
|
| 3033 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00301-01]} |
| 3034 |
@ChgAdded{Version=[2],Text=[Set_Bounded_Wide_Wide_String replaces Set_Bounded_String]} |
| 3035 |
|
| 3036 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3037 |
@ChgAdded{Version=[2],Text=[Unbounded_Wide_Wide_String replaces Unbounded_String]} |
| 3038 |
|
| 3039 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3040 |
@ChgAdded{Version=[2],Text=[Null_Unbounded_Wide_Wide_String replaces Null_Unbounded_String]} |
| 3041 |
|
| 3042 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3043 |
@ChgAdded{Version=[2],Text=[Wide_Wide_String_Access replaces String_Access]} |
| 3044 |
|
| 3045 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3046 |
@ChgAdded{Version=[2],Text=[To_Unbounded_Wide_Wide_String replaces To_Unbounded_String]} |
| 3047 |
|
| 3048 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00301-01]} |
| 3049 |
@ChgAdded{Version=[2],Text=[Set_Unbounded_Wide_Wide_String replaces Set_Unbounded_String]} |
| 3050 |
|
| 3051 |
@end{Itemize} |
| 3052 |
|
| 3053 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01],ARef=[AI95-00395-01]} |
| 3054 |
@ChgAdded{Version=[2],Type=[Leading],Keepnext=[T],Text=[The following |
| 3055 |
additional declarations are present in |
| 3056 |
Strings.Wide_Wide_Maps.Wide_Wide_Constants:]} |
| 3057 |
|
| 3058 |
@begin{Example} |
| 3059 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3060 |
@ChgAdded{Version=[2],Text=[@AdaObjDefn{Character_Set} : @key<constant> Wide_Wide_Maps.Wide_Wide_Character_Set; |
| 3061 |
-- @Examcom[Contains each Wide_Wide_Character value WWC such that] |
| 3062 |
-- @Examcom[Characters.Conversions.Is_Character(WWC) is True] |
| 3063 |
@AdaObjDefn{Wide_Character_Set} : @key<constant> Wide_Wide_Maps.Wide_Wide_Character_Set; |
| 3064 |
-- @Examcom[Contains each Wide_Wide_Character value WWC such that] |
| 3065 |
-- @Examcom[Characters.Conversions.Is_Wide_Character(WWC) is True]]} |
| 3066 |
@end{Example} |
| 3067 |
|
| 3068 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00395-01]} |
| 3069 |
@ChgAdded{Version=[2],Text=[Each Wide_Wide_Character_Set constant in the package |
| 3070 |
Strings.@!Wide_Wide_@!Maps.@!Wide_Wide_@!Constants contains no values outside the Character |
| 3071 |
portion of Wide_Wide_@!Character. Similarly, each Wide_Wide_@!Character_@!Mapping constant in |
| 3072 |
this package is the identity mapping when applied to any element outside the |
| 3073 |
Character portion of Wide_Wide_Character.]} |
| 3074 |
|
| 3075 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00395-01]} |
| 3076 |
@ChgAdded{Version=[2],Text=[@nt{Pragma} Pure is replaced by |
| 3077 |
@nt{pragma} Preelaborate in Strings.Wide_Wide_Maps.Wide_Wide_Constants.]} |
| 3078 |
|
| 3079 |
@end{StaticSem} |
| 3080 |
|
| 3081 |
@begin{Notes} |
| 3082 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]} |
| 3083 |
If a null Wide_Wide_Character_Mapping_Function is passed to any of the |
| 3084 |
Wide_Wide_String handling subprograms, Constraint_Error is propagated.]} |
| 3085 |
@end{Notes} |
| 3086 |
|
| 3087 |
@begin{Extend95} |
| 3088 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01],ARef=[AI95-00395-01]} |
| 3089 |
@ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95} |
| 3090 |
The double-wide string-handling packages (Strings.Wide_Wide_Maps, |
| 3091 |
Strings.Wide_Wide_Fixed, Strings.Wide_Wide_Bounded, |
| 3092 |
Strings.Wide_Wide_Unbounded, and Strings.Wide_Wide_Maps.Wide_Wide_Constants), |
| 3093 |
and functions Strings.Wide_Wide_Hash and |
| 3094 |
Strings.Wide_Wide_Unbounded.Wide_Wide_Hash are new.]} |
| 3095 |
@end{Extend95} |
| 3096 |
|
| 3097 |
@begin{Extend2005} |
| 3098 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0286-1]} |
| 3099 |
@ChgAdded{Version=[3],Text=[@Defn{extensions to Ada 2005} |
| 3100 |
The case insenstive library functions |
| 3101 |
(Strings.Wide_Wide_@!Equal_@!Case_@!Insensitive, |
| 3102 |
Strings.Wide_Wide_@!Fixed.Wide_Wide_@!Equal_@!Case_@!Insensitive, |
| 3103 |
Strings.Wide_Wide_@!Bounded.Wide_Wide_@!Equal_@!Case_@!Insensitive, |
| 3104 |
Strings.Wide_Wide_@!Unbounded.Wide_Wide_@!Equal_@!Case_@!Insensitive, |
| 3105 |
Strings.Wide_Wide_@!Hash_@!Case_@!Insensitive, |
| 3106 |
Strings.Wide_Wide_@!Fixed.Wide_Wide_@!Hash_@!Case_@!Insensitive, |
| 3107 |
Strings.Wide_Wide_@!Bounded.Wide_Wide_@!Hash_@!Case_@!Insensitive, and |
| 3108 |
Strings.Wide_Wide_@!Unbounded.Wide_Wide_@!Hash_@!Case_@!Insensitive) |
| 3109 |
are new.]} |
| 3110 |
@end{Extend2005} |
| 3111 |
|
| 3112 |
@begin{DiffWord2005} |
| 3113 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0223-1]} |
| 3114 |
@ChgAdded{Version=[3],Text=[@b<Correction>: Identified Wide_Wide_Character_Set |
| 3115 |
and Wide_Wide_Character_Mapping as needing finalization. It is likely that |
| 3116 |
they are implemented with a controlled type, so this change is unlikely to |
| 3117 |
make any difference in practice.]} |
| 3118 |
@end{DiffWord2005} |
| 3119 |
|
| 3120 |
|
| 3121 |
|
| 3122 |
|
| 3123 |
@LabeledAddedSubClause{Version=[2],Name=[String Hashing]} |
| 3124 |
|
| 3125 |
@begin{StaticSem} |
| 3126 |
|
| 3127 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00302-03]} |
| 3128 |
@ChgAdded{Version=[2],KeepNext=[T],Type=[Leading],Text=[The library |
| 3129 |
function Strings.Hash has the following declaration:]} |
| 3130 |
@begin{Example} |
| 3131 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3132 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0298-1]} |
| 3133 |
@ChgAdded{Version=[2],Text=[@key<with> Ada.Containers; |
| 3134 |
@key<function> Ada.Strings.Hash (Key : String) @key<return> Containers.Hash_Type;@SubChildUnit{Parent=[Ada.Strings],Child=[Hash]} |
| 3135 |
@key<pragma> Pure(@Chg{Version=[3],New=[Ada.Strings.Hash],Old=[Hash]});]} |
| 3136 |
@end{Example} |
| 3137 |
|
| 3138 |
@begin{DescribeCode} |
| 3139 |
|
| 3140 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3141 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns an implementation-defined |
| 3142 |
value which is a function of the value of Key. If @i<A> and @i<B> are strings |
| 3143 |
such that @i<A> equals @i<B>, Hash(@i<A>) equals Hash(@i<B>).]} |
| 3144 |
@ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 3145 |
Text=[The values returned by Strings.Hash.]}]} |
| 3146 |
|
| 3147 |
@end{DescribeCode} |
| 3148 |
|
| 3149 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00302-03]} |
| 3150 |
@ChgAdded{Version=[2],KeepNext=[T],Type=[Leading],Text=[The library |
| 3151 |
function Strings.Fixed.Hash has the following declaration:]} |
| 3152 |
@begin{Example} |
| 3153 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3154 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0298-1]} |
| 3155 |
@ChgAdded{Version=[2],Text=[@key<with> Ada.Containers, Ada.Strings.Hash; |
| 3156 |
@key<function> Ada.Strings.Fixed.Hash (Key : String) @key<return> Containers.Hash_Type |
| 3157 |
@key<renames> Ada.Strings.Hash;@Chg{Version=[3],New=[],Old=[ |
| 3158 |
@key<pragma> Pure(Hash);]}]} |
| 3159 |
@end{Example} |
| 3160 |
|
| 3161 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00302-03]} |
| 3162 |
@ChgAdded{Version=[2],KeepNext=[T],Type=[Leading],Text=[The generic library |
| 3163 |
function Strings.Bounded.Hash has the following declaration:]} |
| 3164 |
@begin{Example} |
| 3165 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3166 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0298-1]} |
| 3167 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0241-1]} |
| 3168 |
@ChgAdded{Version=[2],Text=[@key<with> Ada.Containers; |
| 3169 |
@key<generic>@SubChildUnit{Parent=[Ada.Strings.Bounded],Child=[Hash]} |
| 3170 |
@key<with package> Bounded @key<is> |
| 3171 |
@key<new> Ada.Strings.Bounded.Generic_Bounded_Length (<>); |
| 3172 |
@key<function> Ada.Strings.Bounded.Hash (Key : Bounded.Bounded_String) |
| 3173 |
@key<return> Containers.Hash_Type@Chg{Version=[5],New=[],Old=[;]} |
| 3174 |
@Chg{Version=[5],New=[@key[with]],Old=[@key[pragma]]} Preelaborate@Chg{Version=[5],New=[, Nonblocking],Old=[(@Chg{Version=[3],New=[Ada.Strings.Bounded.Hash],Old=[Hash]})]};]} |
| 3175 |
@end{Example} |
| 3176 |
|
| 3177 |
@begin{DescribeCode} |
| 3178 |
|
| 3179 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3180 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0001-1]} |
| 3181 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[@Chg{Version=[3],New=[Equivalent to], |
| 3182 |
Old=[Strings.Bounded.Hash is |
| 3183 |
equivalent to the function call]} Strings.Hash (Bounded.To_String (Key));]} |
| 3184 |
|
| 3185 |
@end{DescribeCode} |
| 3186 |
|
| 3187 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00302-03]} |
| 3188 |
@ChgAdded{Version=[2],KeepNext=[T],Type=[Leading],Text=[The library |
| 3189 |
function Strings.Unbounded.Hash has the following declaration:]} |
| 3190 |
@begin{Example} |
| 3191 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3192 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0298-1]} |
| 3193 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0241-1]} |
| 3194 |
@ChgAdded{Version=[2],Text=[@key<with> Ada.Containers; |
| 3195 |
@key<function> Ada.Strings.Unbounded.Hash (Key : Unbounded_String)@SubChildUnit{Parent=[Ada.Strings.Unbounded],Child=[Hash]} |
| 3196 |
@key<return> Containers.Hash_Type@Chg{Version=[5],New=[],Old=[;]} |
| 3197 |
@Chg{Version=[5],New=[@key[with]],Old=[@key[pragma]]} Preelaborate@Chg{Version=[5],New=[, Nonblocking],Old=[(@Chg{Version=[3],New=[Ada.Strings.Unbounded.Hash],Old=[Hash]})]};]} |
| 3198 |
@end{Example} |
| 3199 |
|
| 3200 |
@begin{DescribeCode} |
| 3201 |
|
| 3202 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3203 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0001-1]} |
| 3204 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[@Chg{Version=[3],New=[Equivalent to], |
| 3205 |
Old=[Strings.Unbounded.Hash is |
| 3206 |
equivalent to the function call]} |
| 3207 |
Strings.Hash (To_String (Key));]} |
| 3208 |
|
| 3209 |
@end{DescribeCode} |
| 3210 |
|
| 3211 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0001-1],ARef=[AI05-0298-1]} |
| 3212 |
@ChgAdded{Version=[3],KeepNext=[T],Type=[Leading],Text=[The library function |
| 3213 |
Strings.Hash_Case_Insensitive has the following declaration:]} |
| 3214 |
|
| 3215 |
@begin{Example} |
| 3216 |
@ChgRef{Version=[3],Kind=[Added]} |
| 3217 |
@ChgAdded{Version=[3],Text=[@key<with> Ada.Containers; |
| 3218 |
@key<function> Ada.Strings.Hash_Case_Insensitive (Key : String)@SubChildUnit{Parent=[Ada.Strings],Child=[Hash_Case_Insensitive]} |
| 3219 |
@key<return> Containers.Hash_Type; |
| 3220 |
@key<pragma> Pure(Ada.Strings.Hash_Case_Insensitive);]} |
| 3221 |
@end{Example} |
| 3222 |
|
| 3223 |
@begin{DescribeCode} |
| 3224 |
@ChgRef{Version=[3],Kind=[Added]} |
| 3225 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns an implementation-defined |
| 3226 |
value which is a function of the value of Key, converted to lower case. If |
| 3227 |
A and B are strings such that Strings.Equal_Case_Insensitive (A, B) (see |
| 3228 |
@RefSecNum{String Comparison}) is |
| 3229 |
True, then Hash_Case_Insensitive(A) equals Hash_Case_Insensitive(B).]} |
| 3230 |
@end{DescribeCode} |
| 3231 |
|
| 3232 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0001-1],ARef=[AI05-0298-1]} |
| 3233 |
@ChgAdded{Version=[3],KeepNext=[T],Type=[Leading],Text=[The library function |
| 3234 |
Strings.Fixed.Hash_Case_Insensitive has the following declaration:]} |
| 3235 |
|
| 3236 |
@begin{Example} |
| 3237 |
@ChgRef{Version=[3],Kind=[Added]} |
| 3238 |
@ChgAdded{Version=[3],Text=[@key<with> Ada.Containers, Ada.Strings.Hash_Case_Insensitive; |
| 3239 |
@key[function] Ada.Strings.Fixed.Hash_Case_Insensitive (Key : String)@SubChildUnit{Parent=[Ada.Strings.Fixed],Child=[Hash_Case_Insensitive]} |
| 3240 |
@key[return] Containers.Hash_Type @key[renames] Ada.Strings.Hash_Case_Insensitive;]} |
| 3241 |
@end{Example} |
| 3242 |
|
| 3243 |
|
| 3244 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0001-1],ARef=[AI05-0298-1]} |
| 3245 |
@ChgAdded{Version=[3],KeepNext=[T],Type=[Leading],Text=[The generic library |
| 3246 |
function Strings.Bounded.Hash_Case_Insensitive has the following declaration:]} |
| 3247 |
|
| 3248 |
@begin{Example} |
| 3249 |
@ChgRef{Version=[3],Kind=[Added]} |
| 3250 |
@ChgRef{Version=[5],Kind=[RevisedAdded],ARef=[AI12-0241-1]} |
| 3251 |
@ChgAdded{Version=[3],Text=[@key<with> Ada.Containers; |
| 3252 |
@key[generic] |
| 3253 |
@key[with package] Bounded @key[is] |
| 3254 |
@key[new] Ada.Strings.Bounded.Generic_Bounded_Length (<>); |
| 3255 |
@key[function] Ada.Strings.Bounded.Hash_Case_Insensitive@SubChildUnit{Parent=[Ada.Strings.Bounded],Child=[Hash_Case_Insensitive]} |
| 3256 |
(Key : Bounded.Bounded_String) @key[return] Containers.Hash_Type@Chg{Version=[5],New=[],Old=[;]} |
| 3257 |
@Chg{Version=[5],New=[@key[with]],Old=[@key[pragma]]} Preelaborate@Chg{Version=[5],New=[, Nonblocking],Old=[(Ada.Strings.Bounded.Hash_Case_Insensitive)]};]} |
| 3258 |
@end{Example} |
| 3259 |
|
| 3260 |
@begin{DescribeCode} |
| 3261 |
|
| 3262 |
@ChgRef{Version=[3],Kind=[Added]} |
| 3263 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Equivalent to |
| 3264 |
Strings.Hash_Case_Insensitive (Bounded.To_String (Key));]} |
| 3265 |
@end{DescribeCode} |
| 3266 |
|
| 3267 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0001-1],ARef=[AI05-0298-1]} |
| 3268 |
@ChgAdded{Version=[3],KeepNext=[T],Type=[Leading],Text=[The library function |
| 3269 |
Strings.Unbounded.Hash_Case_Insensitive has the following declaration:]} |
| 3270 |
|
| 3271 |
@begin{Example} |
| 3272 |
@ChgRef{Version=[3],Kind=[Added]} |
| 3273 |
@ChgRef{Version=[5],Kind=[RevisedAdded],ARef=[AI12-0241-1]} |
| 3274 |
@ChgAdded{Version=[3],Text=[@key<with> Ada.Containers; |
| 3275 |
@key[function] Ada.Strings.Unbounded.Hash_Case_Insensitive@SubChildUnit{Parent=[Ada.Strings.Unbounded],Child=[Hash_Case_Insensitive]} |
| 3276 |
(Key : Unbounded_String) @key[return] Containers.Hash_Type@Chg{Version=[5],New=[],Old=[;]} |
| 3277 |
@Chg{Version=[5],New=[@key[with]],Old=[@key[pragma]]} Preelaborate@Chg{Version=[5],New=[, Nonblocking],Old=[(Ada.Strings.Unbounded.Hash_Case_Insensitive)]};]} |
| 3278 |
@end{Example} |
| 3279 |
|
| 3280 |
@begin{DescribeCode} |
| 3281 |
@ChgRef{Version=[3],Kind=[Added]} |
| 3282 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Equivalent to |
| 3283 |
Strings.Hash_Case_Insensitive (To_String (Key));]} |
| 3284 |
@end{DescribeCode} |
| 3285 |
|
| 3286 |
@end{StaticSem} |
| 3287 |
|
| 3288 |
|
| 3289 |
@begin{ImplAdvice} |
| 3290 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00302-03]} |
| 3291 |
@ChgAdded{Version=[2],Text=[The Hash functions should be good hash |
| 3292 |
functions, returning a wide spread of values for different string values. It |
| 3293 |
should be unlikely for similar strings to return the same value.]} |
| 3294 |
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 3295 |
Text=[Strings.Hash should be good a hash |
| 3296 |
function, returning a wide spread of values for different string values, |
| 3297 |
and similar strings should rarely return the same value.]}]} |
| 3298 |
@begin{Ramification} |
| 3299 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 3300 |
@ChgAdded{Version=[2],Text=[The other functions are defined in terms of |
| 3301 |
Strings.Hash, so they don't need separate advice in the Annex.]} |
| 3302 |
@end{Ramification} |
| 3303 |
@end{ImplAdvice} |
| 3304 |
|
| 3305 |
|
| 3306 |
@begin{Extend95} |
| 3307 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00302-03]} |
| 3308 |
@ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95} |
| 3309 |
The Strings.Hash, Strings.Fixed.Hash, Strings.Bounded.Hash, and |
| 3310 |
Strings.Unbounded.Hash functions are new.]} |
| 3311 |
@end{Extend95} |
| 3312 |
|
| 3313 |
@begin{Extend2005} |
| 3314 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0001-1]} |
| 3315 |
@ChgAdded{Version=[3],Text=[@Defn{extensions to Ada 2005} |
| 3316 |
The Strings.Hash_Case_Insensitive, Strings.Fixed.Hash_Case_Insensitive, |
| 3317 |
Strings.Bounded.Hash_Case_Insensitive, and |
| 3318 |
Strings.Unbounded.Hash_Case_Insensitive functions are new.]} |
| 3319 |
@end{Extend2005} |
| 3320 |
|
| 3321 |
|
| 3322 |
@LabeledAddedSubClause{Version=[3],Name=[String Comparison]} |
| 3323 |
|
| 3324 |
@begin{StaticSem} |
| 3325 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0001-1],ARef=[AI05-0286-1],ARef=[AI05-0298-1]} |
| 3326 |
@ChgAdded{Version=[3],KeepNext=[T],Type=[Leading],Text=[The library function |
| 3327 |
Strings.Equal_Case_Insensitive has the following declaration:]} |
| 3328 |
|
| 3329 |
@begin{Example} |
| 3330 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3331 |
@ChgAdded{Version=[3],Text=[@key[function] Ada.Strings.Equal_Case_Insensitive (Left, Right : String)@SubChildUnit{Parent=[Ada.Strings],Child=[Equal_Case_Insensitive]} |
| 3332 |
@key[return] Boolean; |
| 3333 |
@key[pragma] Pure(Ada.Strings.Equal_Case_Insensitive);]} |
| 3334 |
@end{Example} |
| 3335 |
|
| 3336 |
@begin{DescribeCode} |
| 3337 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3338 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0263-1]} |
| 3339 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns True if the strings consist |
| 3340 |
of the same sequence of characters after applying locale-independent simple case |
| 3341 |
folding, as defined by documents referenced in |
| 3342 |
@Chg{Version=[5],New=[],Old=[the note in ]}Clause @Chg{Version=[5],New=[2],Old=[1]} |
| 3343 |
of ISO/IEC 10646:@Chg{Version=[5],New=[2017],Old=[2011]}. |
| 3344 |
Otherwise, returns False. This function uses the same method as is |
| 3345 |
used to determine whether two identifiers are the same.]} |
| 3346 |
|
| 3347 |
@begin{Discussion} |
| 3348 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0286-1]} |
| 3349 |
@ChgAdded{Version=[3],Text=[For String, this is equivalent to converting to |
| 3350 |
lower case and comparing. Not so for other string types. For Wide_Strings and |
| 3351 |
Wide_Wide_Strings, note that this result is a more accurate comparison than |
| 3352 |
converting the strings to lower case and comparing the results; it is possible |
| 3353 |
that the lower case conversions are the same but this routine will report the |
| 3354 |
strings as different. Additionally, Unicode says that the result of this |
| 3355 |
function will never change for strings made up solely of defined code points; |
| 3356 |
there is no such guarantee for case conversion to lower case.]} |
| 3357 |
|
| 3358 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0263-1]} |
| 3359 |
@ChgAdded{Version=[5],Text=[The @ldquote@;documents |
| 3360 |
referenced@rdquote means Unicode, Chapter 4 (specifically, section 4.2 @em |
| 3361 |
Case). See the Implementation Notes in subclause @RefSecNum{Identifiers} for |
| 3362 |
a source for machine-readable definitions of these properties.]} |
| 3363 |
@end{Discussion} |
| 3364 |
@end{DescribeCode} |
| 3365 |
|
| 3366 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0001-1],ARef=[AI05-0248-1],ARef=[AI05-0298-1]} |
| 3367 |
@ChgAdded{Version=[3],KeepNext=[T],Type=[Leading],Text=[The library function |
| 3368 |
Strings.Fixed.Equal_Case_Insensitive has the following declaration:]} |
| 3369 |
|
| 3370 |
@begin{Example} |
| 3371 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3372 |
@ChgAdded{Version=[3],Text=[@key[with] Ada.Strings.Equal_Case_Insensitive; |
| 3373 |
@key[function] Ada.Strings.Fixed.Equal_Case_Insensitive@SubChildUnit{Parent=[Ada.Strings.Fixed],Child=[Equal_Case_Insensitive]} |
| 3374 |
(Left, Right : String) @key[return] Boolean |
| 3375 |
@key[renames] Ada.Strings.Equal_Case_Insensitive;]} |
| 3376 |
@end{Example} |
| 3377 |
|
| 3378 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0001-1],ARef=[AI05-0248-1],ARef=[AI05-0298-1]} |
| 3379 |
@ChgAdded{Version=[3],KeepNext=[T],Type=[Leading],Text=[The generic library |
| 3380 |
function Strings.Bounded.Equal_Case_Insensitive has the following declaration:]} |
| 3381 |
|
| 3382 |
@begin{Example} |
| 3383 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3384 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0241-1]} |
| 3385 |
@ChgAdded{Version=[3],Text=[@key[generic] |
| 3386 |
@key[with package] Bounded @key[is] |
| 3387 |
@key[new] Ada.Strings.Bounded.Generic_Bounded_Length (<>); |
| 3388 |
@key[function] Ada.Strings.Bounded.Equal_Case_Insensitive@SubChildUnit{Parent=[Ada.Strings.Bounded],Child=[Equal_Case_Insensitive]} |
| 3389 |
(Left, Right : Bounded.Bounded_String) @key[return] Boolean@Chg{Version=[5],New=[],Old=[;]} |
| 3390 |
@Chg{Version=[5],New=[@key[with]],Old=[@key[pragma]]} Preelaborate@Chg{Version=[5],New=[, Nonblocking],Old=[(Ada.Strings.Bounded.Equal_Case_Insensitive)]};]} |
| 3391 |
@end{Example} |
| 3392 |
|
| 3393 |
@begin{DescribeCode} |
| 3394 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3395 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Equivalent to |
| 3396 |
Strings.Equal_Case_Insensitive (Bounded.To_String (Left), Bounded.To_String (Right));]} |
| 3397 |
@end{DescribeCode} |
| 3398 |
|
| 3399 |
|
| 3400 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0001-1],ARef=[AI05-0248-1],ARef=[AI05-0298-1]} |
| 3401 |
@ChgAdded{Version=[3],KeepNext=[T],Type=[Leading],Text=[The library function |
| 3402 |
Strings.Unbounded.Equal_Case_Insensitive has the following declaration:]} |
| 3403 |
|
| 3404 |
@begin{Example} |
| 3405 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3406 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0241-1]} |
| 3407 |
@ChgAdded{Version=[3],Text=[@key[function] Ada.Strings.Unbounded.Equal_Case_Insensitive@SubChildUnit{Parent=[Ada.Strings.Unbounded],Child=[Equal_Case_Insensitive]} |
| 3408 |
(Left, Right : Unbounded_String) @key[return] Boolean@Chg{Version=[5],New=[],Old=[;]} |
| 3409 |
@Chg{Version=[5],New=[@key[with]],Old=[@key[pragma]]} Preelaborate@Chg{Version=[5],New=[, Nonblocking],Old=[(Ada.Strings.Unbounded.Equal_Case_Insensitive)]};]} |
| 3410 |
@end{Example} |
| 3411 |
|
| 3412 |
@begin{DescribeCode} |
| 3413 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3414 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Equivalent to |
| 3415 |
Strings.Equal_Case_Insensitive (To_String (Left), To_String (Right));]} |
| 3416 |
@end{DescribeCode} |
| 3417 |
|
| 3418 |
|
| 3419 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0001-1],ARef=[AI05-0298-1]} |
| 3420 |
@ChgAdded{Version=[3],KeepNext=[T],Type=[Leading],Text=[The library function |
| 3421 |
Strings.Less_Case_Insensitive has the following declaration:]} |
| 3422 |
|
| 3423 |
@begin{Example} |
| 3424 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3425 |
@ChgAdded{Version=[3],Text=[@key[function] Ada.Strings.Less_Case_Insensitive (Left, Right : String)@SubChildUnit{Parent=[Ada.Strings],Child=[Less_Case_Insensitive]} |
| 3426 |
@key[return] Boolean; |
| 3427 |
@key[pragma] Pure(Ada.Strings.Less_Case_Insensitive);]} |
| 3428 |
@end{Example} |
| 3429 |
|
| 3430 |
@begin{DescribeCode} |
| 3431 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3432 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Performs a lexicographic comparison |
| 3433 |
of strings Left and Right, converted to lower case.]} |
| 3434 |
@end{DescribeCode} |
| 3435 |
|
| 3436 |
|
| 3437 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0001-1],ARef=[AI05-0248-1],ARef=[AI05-0298-1]} |
| 3438 |
@ChgAdded{Version=[3],KeepNext=[T],Type=[Leading],Text=[The library function |
| 3439 |
Strings.Fixed.Less_Case_Insensitive has the following declaration:]} |
| 3440 |
|
| 3441 |
@begin{Example} |
| 3442 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3443 |
@ChgAdded{Version=[3],Text=[@key[with] Ada.Strings.Less_Case_Insensitive; |
| 3444 |
@key[function] Ada.Strings.Fixed.Less_Case_Insensitive@SubChildUnit{Parent=[Ada.Strings.Fixed],Child=[Less_Case_Insensitive]} |
| 3445 |
(Left, Right : String) @key[return] Boolean |
| 3446 |
@key[renames] Ada.Strings.Less_Case_Insensitive;]} |
| 3447 |
@end{Example} |
| 3448 |
|
| 3449 |
|
| 3450 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0001-1],ARef=[AI05-0248-1],ARef=[AI05-0298-1]} |
| 3451 |
@ChgAdded{Version=[3],KeepNext=[T],Type=[Leading],Text=[The generic library |
| 3452 |
function Strings.Bounded.Less_Case_Insensitive has the following declaration:]} |
| 3453 |
|
| 3454 |
@begin{Example} |
| 3455 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3456 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0241-1]} |
| 3457 |
@ChgAdded{Version=[3],Text=[@key[generic] |
| 3458 |
@key[with package] Bounded @key[is] |
| 3459 |
@key[new] Ada.Strings.Bounded.Generic_Bounded_Length (<>); |
| 3460 |
@key[function] Ada.Strings.Bounded.Less_Case_Insensitive@SubChildUnit{Parent=[Ada.Strings.Bounded],Child=[Less_Case_Insensitive]} |
| 3461 |
(Left, Right : Bounded.Bounded_String) @key[return] Boolean@Chg{Version=[5],New=[],Old=[;]} |
| 3462 |
@Chg{Version=[5],New=[@key[with]],Old=[@key[pragma]]} Preelaborate@Chg{Version=[5],New=[, Nonblocking],Old=[(Ada.Strings.Bounded.Less_Case_Insensitive)]};]} |
| 3463 |
@end{Example} |
| 3464 |
|
| 3465 |
@begin{DescribeCode} |
| 3466 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3467 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Equivalent to |
| 3468 |
Strings.Less_Case_Insensitive (Bounded.To_String (Left), Bounded.To_String (Right));]} |
| 3469 |
@end{DescribeCode} |
| 3470 |
|
| 3471 |
|
| 3472 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0001-1],ARef=[AI05-0248-1],ARef=[AI05-0298-1]} |
| 3473 |
@ChgAdded{Version=[3],KeepNext=[T],Type=[Leading],Text=[The library function |
| 3474 |
Strings.Unbounded.Less_Case_Insensitive has the following declaration:]} |
| 3475 |
|
| 3476 |
@begin{Example} |
| 3477 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3478 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0241-1]} |
| 3479 |
@ChgAdded{Version=[3],Text=[@key[function] Ada.Strings.Unbounded.Less_Case_Insensitive@SubChildUnit{Parent=[Ada.Strings.Unbounded],Child=[Less_Case_Insensitive]} |
| 3480 |
(Left, Right : Unbounded_String) @key[return] Boolean@Chg{Version=[5],New=[],Old=[;]} |
| 3481 |
@Chg{Version=[5],New=[@key[with]],Old=[@key[pragma]]} Preelaborate@Chg{Version=[5],New=[, Nonblocking],Old=[(Ada.Strings.Unbounded.Less_Case_Insensitive)]};]} |
| 3482 |
@end{Example} |
| 3483 |
|
| 3484 |
@begin{DescribeCode} |
| 3485 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3486 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Equivalent to |
| 3487 |
Strings.Less_Case_Insensitive (To_String (Left), To_String (Right));]} |
| 3488 |
@end{DescribeCode} |
| 3489 |
|
| 3490 |
@end{StaticSem} |
| 3491 |
|
| 3492 |
@begin{Extend2005} |
| 3493 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0001-1],ARef=[AI05-0286-1]} |
| 3494 |
@ChgAdded{Version=[3],Text=[@Defn{extensions to Ada 2005} |
| 3495 |
The Strings.Equal_Case_Insensitive, Strings.Fixed.Equal_Case_Insensitive, |
| 3496 |
Strings.Bounded.Equal_Case_Insensitive, |
| 3497 |
Strings.Unbounded.Equal_Case_Insensitive, |
| 3498 |
Strings.Less_Case_Insensitive, Strings.Fixed.Less_Case_Insensitive, |
| 3499 |
Strings.Bounded.Less_Case_Insensitive, |
| 3500 |
Strings.Unbounded.Less_Case_Insensitive functions are new.]} |
| 3501 |
@end{Extend2005} |
| 3502 |
|
| 3503 |
|
| 3504 |
@LabeledAddedSubClause{Version=[3],Name=[String Encoding]} |
| 3505 |
|
| 3506 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3507 |
@ChgAdded{Version=[3],Text=[Facilities for encoding, decoding, and converting strings in various character |
| 3508 |
encoding schemes are provided by packages Strings.@!UTF_Encoding, |
| 3509 |
Strings.@!UTF_Encoding.@!Conversions, Strings.@!UTF_Encoding.@!Strings, |
| 3510 |
Strings.@!UTF_Encoding.@!Wide_Strings, and |
| 3511 |
Strings.@!UTF_Encoding.@!Wide_Wide_Strings.]} |
| 3512 |
|
| 3513 |
@begin{StaticSem} |
| 3514 |
|
| 3515 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3516 |
@ChgAdded{Version=[3],Type=[Leading],Text=[The encoding library packages have |
| 3517 |
the following declarations:]} |
| 3518 |
|
| 3519 |
@begin{Example} |
| 3520 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3521 |
@ChgAdded{Version=[3],Text=[@ChildUnit{Parent=[Ada.Strings],Child=[UTF_Encoding]}@key[package] Ada.Strings.UTF_Encoding @key[is] |
| 3522 |
@key[pragma] Pure (UTF_Encoding);]} |
| 3523 |
|
| 3524 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3525 |
@ChgAdded{Version=[3],Text=[ -- @Examcom[Declarations common to the string encoding packages] |
| 3526 |
@key[type] @AdaTypeDefn{Encoding_Scheme} @key[is] (UTF_8, UTF_16BE, UTF_16LE);]} |
| 3527 |
|
| 3528 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3529 |
@ChgAdded{Version=[3],Text=[ @key[subtype] @AdaSubtypeDefn{Name=[UTF_String],Of=[String]} @key[is] String;]} |
| 3530 |
|
| 3531 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3532 |
@ChgAdded{Version=[3],Text=[ @key[subtype] @AdaSubtypeDefn{Name=[UTF_8_String],Of=[String]} @key[is] String;]} |
| 3533 |
|
| 3534 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3535 |
@ChgAdded{Version=[3],Text=[ @key[subtype] @AdaSubtypeDefn{Name=[UTF_16_Wide_String],Of=[Wide_String]} @key[is] Wide_String;]} |
| 3536 |
|
| 3537 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3538 |
@ChgAdded{Version=[3],Text=[ @AdaExcDefn{Encoding_Error} : @key[exception];]} |
| 3539 |
|
| 3540 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3541 |
@ChgAdded{Version=[3],Text=[ @AdaObjDefn{BOM_8} : @key[constant] UTF_8_String := |
| 3542 |
Character'Val(16#EF#) & |
| 3543 |
Character'Val(16#BB#) & |
| 3544 |
Character'Val(16#BF#);]} |
| 3545 |
|
| 3546 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3547 |
@ChgAdded{Version=[3],Text=[ @AdaObjDefn{BOM_16BE} : @key[constant] UTF_String := |
| 3548 |
Character'Val(16#FE#) & |
| 3549 |
Character'Val(16#FF#);]} |
| 3550 |
|
| 3551 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3552 |
@ChgAdded{Version=[3],Text=[ @AdaObjDefn{BOM_16LE} : @key[constant] UTF_String := |
| 3553 |
Character'Val(16#FF#) & |
| 3554 |
Character'Val(16#FE#);]} |
| 3555 |
|
| 3556 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3557 |
@ChgAdded{Version=[3],Text=[ @AdaObjDefn{BOM_16} : @key[constant] UTF_16_Wide_String := |
| 3558 |
(1 => Wide_Character'Val(16#FEFF#));]} |
| 3559 |
|
| 3560 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3561 |
@ChgAdded{Version=[3],Text=[ @key[function] @AdaSubDefn{Encoding} (Item : UTF_String; |
| 3562 |
Default : Encoding_Scheme := UTF_8) |
| 3563 |
@key[return] Encoding_Scheme;]} |
| 3564 |
|
| 3565 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3566 |
@ChgAdded{Version=[3],Text=[@key[end] Ada.Strings.UTF_Encoding;]} |
| 3567 |
|
| 3568 |
|
| 3569 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3570 |
@ChgAdded{Version=[3],Text=[@ChildUnit{Parent=[Ada.Strings.UTF_Encoding],Child=[Conversions]}@key[package] Ada.Strings.UTF_Encoding.Conversions @key[is] |
| 3571 |
@key[pragma] Pure (Conversions);]} |
| 3572 |
|
| 3573 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3574 |
@ChgAdded{Version=[3],Text=[ -- @Examcom{Conversions between various encoding schemes} |
| 3575 |
@key[function] @AdaSubDefn{Convert} (Item : UTF_String; |
| 3576 |
Input_Scheme : Encoding_Scheme; |
| 3577 |
Output_Scheme : Encoding_Scheme; |
| 3578 |
Output_BOM : Boolean := False) @key[return] UTF_String;]} |
| 3579 |
|
| 3580 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3581 |
@ChgAdded{Version=[3],Text=[ @key[function] @AdaSubDefn{Convert} (Item : UTF_String; |
| 3582 |
Input_Scheme : Encoding_Scheme; |
| 3583 |
Output_BOM : Boolean := False) |
| 3584 |
@key[return] UTF_16_Wide_String;]} |
| 3585 |
|
| 3586 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3587 |
@ChgAdded{Version=[3],Text=[ @key[function] @AdaSubDefn{Convert} (Item : UTF_8_String; |
| 3588 |
Output_BOM : Boolean := False) |
| 3589 |
@key[return] UTF_16_Wide_String;]} |
| 3590 |
|
| 3591 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3592 |
@ChgAdded{Version=[3],Text=[ @key[function] @AdaSubDefn{Convert} (Item : UTF_16_Wide_String; |
| 3593 |
Output_Scheme : Encoding_Scheme; |
| 3594 |
Output_BOM : Boolean := False) @key[return] UTF_String;]} |
| 3595 |
|
| 3596 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3597 |
@ChgAdded{Version=[3],Text=[ @key[function] @AdaSubDefn{Convert} (Item : UTF_16_Wide_String; |
| 3598 |
Output_BOM : Boolean := False) @key[return] UTF_8_String;]} |
| 3599 |
|
| 3600 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3601 |
@ChgAdded{Version=[3],Text=[@key[end] Ada.Strings.UTF_Encoding.Conversions;]} |
| 3602 |
|
| 3603 |
|
| 3604 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3605 |
@ChgAdded{Version=[3],Text=[@ChildUnit{Parent=[Ada.Strings.UTF_Encoding],Child=[Strings]}@key[package] Ada.Strings.UTF_Encoding.Strings @key[is] |
| 3606 |
@key[pragma] Pure (Strings);]} |
| 3607 |
|
| 3608 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3609 |
@ChgAdded{Version=[3],Text=[ -- @Examcom{Encoding / decoding between String and various encoding schemes} |
| 3610 |
@key[function] @AdaSubDefn{Encode} (Item : String; |
| 3611 |
Output_Scheme : Encoding_Scheme; |
| 3612 |
Output_BOM : Boolean := False) @key[return] UTF_String;]} |
| 3613 |
|
| 3614 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3615 |
@ChgAdded{Version=[3],Text=[ @key[function] @AdaSubDefn{Encode} (Item : String; |
| 3616 |
Output_BOM : Boolean := False) @key[return] UTF_8_String;]} |
| 3617 |
|
| 3618 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3619 |
@ChgAdded{Version=[3],Text=[ @key[function] @AdaSubDefn{Encode} (Item : String; |
| 3620 |
Output_BOM : Boolean := False) |
| 3621 |
@key[return] UTF_16_Wide_String;]} |
| 3622 |
|
| 3623 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3624 |
@ChgAdded{Version=[3],Text=[ @key[function] @AdaSubDefn{Decode} (Item : UTF_String; |
| 3625 |
Input_Scheme : Encoding_Scheme) @key[return] String;]} |
| 3626 |
|
| 3627 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3628 |
@ChgAdded{Version=[3],Text=[ @key[function] @AdaSubDefn{Decode} (Item : UTF_8_String) @key[return] String;]} |
| 3629 |
|
| 3630 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3631 |
@ChgAdded{Version=[3],Text=[ @key[function] @AdaSubDefn{Decode} (Item : UTF_16_Wide_String) @key[return] String;]} |
| 3632 |
|
| 3633 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3634 |
@ChgAdded{Version=[3],Text=[@key[end] Ada.Strings.UTF_Encoding.Strings;]} |
| 3635 |
|
| 3636 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3637 |
@ChgAdded{Version=[3],Text=[@ChildUnit{Parent=[Ada.Strings.UTF_Encoding],Child=[Wide_Strings]}@key[package] Ada.Strings.UTF_Encoding.Wide_Strings @key[is] |
| 3638 |
@key[pragma] Pure (Wide_Strings);]} |
| 3639 |
|
| 3640 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3641 |
@ChgAdded{Version=[3],Text=[ -- @Examcom{Encoding / decoding between Wide_String and various encoding schemes} |
| 3642 |
@key[function] @AdaSubDefn{Encode} (Item : Wide_String; |
| 3643 |
Output_Scheme : Encoding_Scheme; |
| 3644 |
Output_BOM : Boolean := False) @key[return] UTF_String;]} |
| 3645 |
|
| 3646 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3647 |
@ChgAdded{Version=[3],Text=[ @key[function] @AdaSubDefn{Encode} (Item : Wide_String; |
| 3648 |
Output_BOM : Boolean := False) @key[return] UTF_8_String;]} |
| 3649 |
|
| 3650 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3651 |
@ChgAdded{Version=[3],Text=[ @key[function] @AdaSubDefn{Encode} (Item : Wide_String; |
| 3652 |
Output_BOM : Boolean := False) |
| 3653 |
@key[return] UTF_16_Wide_String;]} |
| 3654 |
|
| 3655 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3656 |
@ChgAdded{Version=[3],Text=[ @key[function] @AdaSubDefn{Decode} (Item : UTF_String; |
| 3657 |
Input_Scheme : Encoding_Scheme) @key[return] Wide_String;]} |
| 3658 |
|
| 3659 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3660 |
@ChgAdded{Version=[3],Text=[ @key[function] @AdaSubDefn{Decode} (Item : UTF_8_String) @key[return] Wide_String;]} |
| 3661 |
|
| 3662 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3663 |
@ChgAdded{Version=[3],Text=[ @key[function] @AdaSubDefn{Decode} (Item : UTF_16_Wide_String) @key[return] Wide_String;]} |
| 3664 |
|
| 3665 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3666 |
@ChgAdded{Version=[3],Text=[@key[end] Ada.Strings.UTF_Encoding.Wide_Strings;]} |
| 3667 |
|
| 3668 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3669 |
@ChgAdded{Version=[3],Text=[@ChildUnit{Parent=[Ada.Strings.UTF_Encoding],Child=[Wide_Wide_Strings]}@key[package] Ada.Strings.UTF_Encoding.Wide_Wide_Strings @key[is] |
| 3670 |
@key[pragma] Pure (Wide_Wide_Strings);]} |
| 3671 |
|
| 3672 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3673 |
@ChgAdded{Version=[3],Text=[ -- @Examcom{Encoding / decoding between Wide_Wide_String and various encoding schemes} |
| 3674 |
@key[function] @AdaSubDefn{Encode} (Item : Wide_Wide_String; |
| 3675 |
Output_Scheme : Encoding_Scheme; |
| 3676 |
Output_BOM : Boolean := False) @key[return] UTF_String;]} |
| 3677 |
|
| 3678 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3679 |
@ChgAdded{Version=[3],Text=[ @key[function] @AdaSubDefn{Encode} (Item : Wide_Wide_String; |
| 3680 |
Output_BOM : Boolean := False) @key[return] UTF_8_String;]} |
| 3681 |
|
| 3682 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3683 |
@ChgAdded{Version=[3],Text=[ @key[function] @AdaSubDefn{Encode} (Item : Wide_Wide_String; |
| 3684 |
Output_BOM : Boolean := False) |
| 3685 |
@key[return] UTF_16_Wide_String;]} |
| 3686 |
|
| 3687 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3688 |
@ChgAdded{Version=[3],Text=[ @key[function] @AdaSubDefn{Decode} (Item : UTF_String; |
| 3689 |
Input_Scheme : Encoding_Scheme) @key[return] Wide_Wide_String;]} |
| 3690 |
|
| 3691 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3692 |
@ChgAdded{Version=[3],Text=[ @key[function] @AdaSubDefn{Decode} (Item : UTF_8_String) @key[return] Wide_Wide_String;]} |
| 3693 |
|
| 3694 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3695 |
@ChgAdded{Version=[3],Text=[ @key[function] @AdaSubDefn{Decode} (Item : UTF_16_Wide_String) @key[return] Wide_Wide_String;]} |
| 3696 |
|
| 3697 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3698 |
@ChgAdded{Version=[3],Text=[@key[end] Ada.Strings.UTF_Encoding.Wide_Wide_Strings;]} |
| 3699 |
@end{Example} |
| 3700 |
|
| 3701 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2],ARef=[AI05-0262-1]} |
| 3702 |
@ChgAdded{Version=[3],Text=[The type Encoding_Scheme defines encoding schemes. |
| 3703 |
UTF_8 corresponds to the UTF-8 encoding scheme defined by Annex D of ISO/IEC |
| 3704 |
10646. UTF_16BE corresponds to the UTF-16 encoding scheme defined by Annex C of |
| 3705 |
ISO/IEC 10646 in 8 bit, big-endian order; and UTF_16LE corresponds to the |
| 3706 |
UTF-16 encoding scheme in 8 bit, little-endian |
| 3707 |
order.@Defn{encoding scheme}@Defn{character encoding}@Defn{UTF-8}@Defn{UTF-16}]} |
| 3708 |
|
| 3709 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3710 |
@ChgAdded{Version=[3],Text=[The subtype UTF_String is used to represent a String |
| 3711 |
of 8-bit values containing a sequence of values encoded in one of three ways |
| 3712 |
(UTF-8, UTF-16BE, or UTF-16LE). The subtype UTF_8_String is used to represent a |
| 3713 |
String of 8-bit values containing a sequence of values encoded in UTF-8. The |
| 3714 |
subtype UTF_16_Wide_String is used to represent a Wide_String of 16-bit values |
| 3715 |
containing a sequence of values encoded in UTF-16.]} |
| 3716 |
|
| 3717 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2],ARef=[AI05-0262-1]} |
| 3718 |
@ChgAdded{Version=[3],Text=[The BOM_8, BOM_16BE, BOM_16LE, and BOM_16 constants |
| 3719 |
correspond to values used at the start of a string to indicate the encoding.]} |
| 3720 |
|
| 3721 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0262-1],ARef=[AI05-0269-1]} |
| 3722 |
@ChgAdded{Version=[3],Text=[Each of the Encode functions takes a String, |
| 3723 |
Wide_String, or Wide_Wide_String Item parameter that is assumed to be an array |
| 3724 |
of unencoded characters. Each of the Convert functions takes a UTF_String, |
| 3725 |
UTF_8_String, or UTF_16_String Item parameter that is assumed to |
| 3726 |
contain characters whose position values correspond to a valid encoding sequence |
| 3727 |
according to the encoding scheme required by the function or specified by its |
| 3728 |
Input_Scheme parameter.]} |
| 3729 |
|
| 3730 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2],ARef=[AI05-0262-1],ARef=[AI05-0269-1]} |
| 3731 |
@ChgAdded{Version=[3],Text=[Each of the Convert and Encode functions returns |
| 3732 |
a UTF_String, UTF_8_String, or UTF_16_String value whose characters have position values |
| 3733 |
that correspond to the encoding of the Item parameter according to the |
| 3734 |
encoding scheme required by the function or specified by its Output_Scheme |
| 3735 |
parameter. For UTF_8, no overlong encoding is returned. A BOM is included |
| 3736 |
at the start of the returned string if the Output_BOM parameter is set to |
| 3737 |
True. The lower bound of the returned string is 1.]} |
| 3738 |
|
| 3739 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2],ARef=[AI05-0262-1]} |
| 3740 |
@ChgAdded{Version=[3],Text=[Each of the Decode functions takes a UTF_String, |
| 3741 |
UTF_8_String, or UTF_16_String Item parameter which is assumed to |
| 3742 |
contain characters whose position values correspond to a valid encoding sequence |
| 3743 |
according to the encoding scheme required by the function or specified by its |
| 3744 |
Input_Scheme parameter, and returns the corresponding String, Wide_String, or |
| 3745 |
Wide_Wide_String value. The lower bound of the returned string is 1.]} |
| 3746 |
|
| 3747 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2],ARef=[AI05-0262-1]} |
| 3748 |
@ChgAdded{Version=[3],Text=[For each of the Convert and Decode functions, an |
| 3749 |
initial BOM in the input that matches the expected encoding scheme is ignored, |
| 3750 |
and a different initial BOM causes Encoding_Error to be propagated.]} |
| 3751 |
|
| 3752 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3753 |
@ChgAdded{Version=[3],Type=[Leading],Text=[The exception Encoding_Error is also propagated in the following |
| 3754 |
situations:]} |
| 3755 |
@begin{Itemize} |
| 3756 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3757 |
@ChgRef{Version=[4],Kind=[Revised],ARef=[AI12-0088-1]} |
| 3758 |
@ChgAdded{Version=[3],Text=[By a @Chg{Version=[4],New=[Convert or |
| 3759 |
],Old=[]}Decode function when a UTF encoded |
| 3760 |
string contains an invalid encoding sequence.]} |
| 3761 |
|
| 3762 |
@begin{Honest} |
| 3763 |
@ChgRef{Version=[4],Kind=[AddedNormal],ARef=[AI12-0088-1]} |
| 3764 |
@ChgAdded{Version=[4],Text=[An overlong encoding is not invalid for the |
| 3765 |
purposes of this check, and this does not depend on the character set |
| 3766 |
version in use. Some recent character set standards declare overlong |
| 3767 |
encodings to be invalid; it would be unnecessary and unfriendly to users |
| 3768 |
for Convert or Decode to raise an exception for an overlong encoding.]} |
| 3769 |
@end{Honest} |
| 3770 |
|
| 3771 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3772 |
@ChgRef{Version=[4],Kind=[Revised],ARef=[AI12-0088-1]} |
| 3773 |
@ChgAdded{Version=[3],Text=[By a @Chg{Version=[4],New=[Convert or |
| 3774 |
],Old=[]}Decode function when the expected encoding is |
| 3775 |
UTF-16BE or UTF-16LE and the input string has an odd length.]} |
| 3776 |
|
| 3777 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0262-1]} |
| 3778 |
@ChgAdded{Version=[3],Text=[By a Decode function yielding a String when |
| 3779 |
the decoding of a sequence results in a code point whose value exceeds |
| 3780 |
16#FF#.]} |
| 3781 |
|
| 3782 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3783 |
@ChgAdded{Version=[3],Text=[By a Decode function yielding a Wide_String when |
| 3784 |
the decoding of a sequence results in a code point whose value exceeds |
| 3785 |
16#FFFF#.]} |
| 3786 |
|
| 3787 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0262-1]} |
| 3788 |
@ChgAdded{Version=[3],Text=[By an Encode function taking a Wide_String as |
| 3789 |
input when an invalid character appears in the input. In particular, the |
| 3790 |
characters whose position is in the range 16#D800# .. 16#DFFF# are invalid |
| 3791 |
because they conflict with UTF-16 surrogate encodings, and the characters |
| 3792 |
whose position is 16#FFFE# or 16#FFFF# are also invalid because they |
| 3793 |
conflict with BOM codes.]} |
| 3794 |
@end{Itemize} |
| 3795 |
|
| 3796 |
@begin{DescribeCode} |
| 3797 |
@begin{Example} |
| 3798 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3799 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Encoding (Item : UTF_String; |
| 3800 |
Default : Encoding_Scheme := UTF_8) |
| 3801 |
@key[return] Encoding_Scheme;]} |
| 3802 |
@end{Example} |
| 3803 |
|
| 3804 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2],ARef=[AI05-0269-1]} |
| 3805 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Inspects a UTF_String value to |
| 3806 |
determine whether it starts with a BOM for UTF-8, UTF-16BE, or UTF_16LE. If so, |
| 3807 |
returns the scheme corresponding to the BOM; otherwise, returns the value of |
| 3808 |
Default.]} |
| 3809 |
|
| 3810 |
@begin{Example} |
| 3811 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3812 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Convert (Item : UTF_String; |
| 3813 |
Input_Scheme : Encoding_Scheme; |
| 3814 |
Output_Scheme : Encoding_Scheme; |
| 3815 |
Output_BOM : Boolean := False) @key[return] UTF_String;]} |
| 3816 |
@end{Example} |
| 3817 |
|
| 3818 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3819 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns the value of Item |
| 3820 |
(originally encoded in UTF-8, UTF-16LE, or UTF-16BE as specified by |
| 3821 |
Input_Scheme) encoded in one of these three schemes as |
| 3822 |
specified by Output_Scheme.]} |
| 3823 |
|
| 3824 |
@begin{Example} |
| 3825 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3826 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Convert (Item : UTF_String; |
| 3827 |
Input_Scheme : Encoding_Scheme; |
| 3828 |
Output_BOM : Boolean := False) |
| 3829 |
@key[return] UTF_16_Wide_String;]} |
| 3830 |
@end{Example} |
| 3831 |
|
| 3832 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3833 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns the value of Item |
| 3834 |
(originally encoded in UTF-8, UTF-16LE, or UTF-16BE as specified by |
| 3835 |
Input_Scheme) encoded in UTF-16.]} |
| 3836 |
|
| 3837 |
@begin{Example} |
| 3838 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3839 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Convert (Item : UTF_8_String; |
| 3840 |
Output_BOM : Boolean := False) |
| 3841 |
@key[return] UTF_16_Wide_String;]} |
| 3842 |
@end{Example} |
| 3843 |
|
| 3844 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3845 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns the value of Item |
| 3846 |
(originally encoded in UTF-8) encoded in UTF-16.]} |
| 3847 |
|
| 3848 |
@begin{Example} |
| 3849 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3850 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Convert (Item : UTF_16_Wide_String; |
| 3851 |
Output_Scheme : Encoding_Scheme; |
| 3852 |
Output_BOM : Boolean := False) @key[return] UTF_String;]} |
| 3853 |
@end{Example} |
| 3854 |
|
| 3855 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3856 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns the value of Item |
| 3857 |
(originally encoded in UTF-16) encoded in UTF-8, |
| 3858 |
UTF-16LE, or UTF-16BE as specified by Output_Scheme.]} |
| 3859 |
|
| 3860 |
@begin{Example} |
| 3861 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3862 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Convert (Item : UTF_16_Wide_String; |
| 3863 |
Output_BOM : Boolean := False) @key[return] UTF_8_String;]} |
| 3864 |
@end{Example} |
| 3865 |
|
| 3866 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3867 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns the value of Item |
| 3868 |
(originally encoded in UTF-16) encoded in UTF-8.]} |
| 3869 |
|
| 3870 |
@begin{Example} |
| 3871 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3872 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Encode (Item : String; |
| 3873 |
Output_Scheme : Encoding_Scheme; |
| 3874 |
Output_BOM : Boolean := False) @key[return] UTF_String;]} |
| 3875 |
@end{Example} |
| 3876 |
|
| 3877 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0262-1]} |
| 3878 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns the value of Item |
| 3879 |
encoded in UTF-8, UTF-16LE, or UTF-16BE as specified |
| 3880 |
by Output_Scheme.]} |
| 3881 |
|
| 3882 |
@begin{Example} |
| 3883 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3884 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Encode (Item : String; |
| 3885 |
Output_BOM : Boolean := False) @key[return] UTF_8_String;]} |
| 3886 |
@end{Example} |
| 3887 |
|
| 3888 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3889 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns the value of Item |
| 3890 |
encoded in UTF-8.]} |
| 3891 |
|
| 3892 |
@begin{Example} |
| 3893 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3894 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Encode (Item : String; |
| 3895 |
Output_BOM : Boolean := False) @key[return] UTF_16_Wide_String;]} |
| 3896 |
@end{Example} |
| 3897 |
|
| 3898 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3899 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns the value of Item |
| 3900 |
encoded in UTF_16.]} |
| 3901 |
|
| 3902 |
@begin{Example} |
| 3903 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3904 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Decode (Item : UTF_String; |
| 3905 |
Input_Scheme : Encoding_Scheme) @key[return] String;]} |
| 3906 |
@end{Example} |
| 3907 |
|
| 3908 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3909 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns the result of decoding Item, |
| 3910 |
which is encoded in UTF-8, UTF-16LE, or UTF-16BE as specified by Input_Scheme.]} |
| 3911 |
|
| 3912 |
@begin{Example} |
| 3913 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3914 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Decode (Item : UTF_8_String) @key[return] String;]} |
| 3915 |
@end{Example} |
| 3916 |
|
| 3917 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3918 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns the result of decoding Item, |
| 3919 |
which is encoded in UTF-8.]} |
| 3920 |
|
| 3921 |
@begin{Example} |
| 3922 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3923 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Decode (Item : UTF_16_Wide_String) @key[return] String;]} |
| 3924 |
@end{Example} |
| 3925 |
|
| 3926 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3927 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns the result of decoding Item, |
| 3928 |
which is encoded in UTF-16.]} |
| 3929 |
|
| 3930 |
@begin{Example} |
| 3931 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3932 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Encode (Item : Wide_String; |
| 3933 |
Output_Scheme : Encoding_Scheme; |
| 3934 |
Output_BOM : Boolean := False) @key[return] UTF_String;]} |
| 3935 |
@end{Example} |
| 3936 |
|
| 3937 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0262-1]} |
| 3938 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns the value of Item |
| 3939 |
encoded in UTF-8, UTF-16LE, or UTF-16BE as specified |
| 3940 |
by Output_Scheme.]} |
| 3941 |
|
| 3942 |
@begin{Example} |
| 3943 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3944 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Encode (Item : Wide_String; |
| 3945 |
Output_BOM : Boolean := False) @key[return] UTF_8_String;]} |
| 3946 |
@end{Example} |
| 3947 |
|
| 3948 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3949 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns the value of Item |
| 3950 |
encoded in UTF-8.]} |
| 3951 |
|
| 3952 |
@begin{Example} |
| 3953 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3954 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Encode (Item : Wide_String; |
| 3955 |
Output_BOM : Boolean := False) @key[return] UTF_16_Wide_String;]} |
| 3956 |
@end{Example} |
| 3957 |
|
| 3958 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3959 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns the value of Item |
| 3960 |
encoded in UTF_16.]} |
| 3961 |
|
| 3962 |
@begin{Example} |
| 3963 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3964 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Decode (Item : UTF_String; |
| 3965 |
Input_Scheme : Encoding_Scheme) @key[return] Wide_String;]} |
| 3966 |
@end{Example} |
| 3967 |
|
| 3968 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3969 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns the result of decoding Item, |
| 3970 |
which is encoded in UTF-8, UTF-16LE, or UTF-16BE as specified by Input_Scheme.]} |
| 3971 |
|
| 3972 |
@begin{Example} |
| 3973 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3974 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Decode (Item : UTF_8_String) @key[return] Wide_String;]} |
| 3975 |
@end{Example} |
| 3976 |
|
| 3977 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3978 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns the result of decoding Item, which is encoded in UTF-8.]} |
| 3979 |
|
| 3980 |
@begin{Example} |
| 3981 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3982 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Decode (Item : UTF_16_Wide_String) @key[return] Wide_String;]} |
| 3983 |
@end{Example} |
| 3984 |
|
| 3985 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 3986 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns the result of decoding Item, |
| 3987 |
which is encoded in UTF-16.]} |
| 3988 |
|
| 3989 |
@begin{Example} |
| 3990 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 3991 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Encode (Item : Wide_Wide_String; |
| 3992 |
Output_Scheme : Encoding_Scheme; |
| 3993 |
Output_BOM : Boolean := False) @key[return] UTF_String;]} |
| 3994 |
@end{Example} |
| 3995 |
|
| 3996 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0262-1]} |
| 3997 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns the value of Item |
| 3998 |
encoded in UTF-8, UTF-16LE, or UTF-16BE as specified by Output_Scheme.]} |
| 3999 |
|
| 4000 |
@begin{Example} |
| 4001 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 4002 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Encode (Item : Wide_Wide_String; |
| 4003 |
Output_BOM : Boolean := False) @key[return] UTF_8_String;]} |
| 4004 |
@end{Example} |
| 4005 |
|
| 4006 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 4007 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns the value of Item |
| 4008 |
encoded in UTF-8.]} |
| 4009 |
|
| 4010 |
@begin{Example} |
| 4011 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 4012 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Encode (Item : Wide_Wide_String; |
| 4013 |
Output_BOM : Boolean := False) @key[return] UTF_16_Wide_String;]} |
| 4014 |
@end{Example} |
| 4015 |
|
| 4016 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 4017 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns the value of Item |
| 4018 |
encoded in UTF_16.]} |
| 4019 |
|
| 4020 |
@begin{Example} |
| 4021 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 4022 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Decode (Item : UTF_String; |
| 4023 |
Input_Scheme : Encoding_Scheme) @key[return] Wide_Wide_String;]} |
| 4024 |
@end{Example} |
| 4025 |
|
| 4026 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 4027 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns the result of decoding Item, |
| 4028 |
which is encoded in UTF-8, UTF-16LE, or UTF-16BE as specified by Input_Scheme.]} |
| 4029 |
|
| 4030 |
@begin{Example} |
| 4031 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 4032 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Decode (Item : UTF_8_String) @key[return] Wide_Wide_String;]} |
| 4033 |
@end{Example} |
| 4034 |
|
| 4035 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 4036 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns the result of decoding Item, |
| 4037 |
which is encoded in UTF-8.]} |
| 4038 |
|
| 4039 |
@begin{Example} |
| 4040 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 4041 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key[function] Decode (Item : UTF_16_Wide_String) @key[return] Wide_Wide_String;]} |
| 4042 |
@end{Example} |
| 4043 |
|
| 4044 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 4045 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[Returns the result of decoding Item, |
| 4046 |
which is encoded in UTF-16.]} |
| 4047 |
|
| 4048 |
@end{DescribeCode} |
| 4049 |
|
| 4050 |
@end{StaticSem} |
| 4051 |
|
| 4052 |
@begin{ImplAdvice} |
| 4053 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 4054 |
@ChgAdded{Version=[3],Text=[If an implementation supports other encoding |
| 4055 |
schemes, another similar child of Ada.Strings should be defined.]} |
| 4056 |
@ChgImplAdvice{Version=[3],Kind=[Added],Text=[@ChgAdded{Version=[3], |
| 4057 |
Text=[If an implementation supports other string encoding |
| 4058 |
schemes, a child of Ada.Strings similar to UTF_Encoding should be defined.]}]} |
| 4059 |
@end{ImplAdvice} |
| 4060 |
|
| 4061 |
@begin{Notes} |
| 4062 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 4063 |
@ChgAdded{Version=[3],Text=[A BOM (Byte-Order Mark, code position 16#FEFF#) can |
| 4064 |
be included in a file or other entity to indicate the encoding; it is skipped |
| 4065 |
when decoding. Typically, only the first line of a file or other entity contains |
| 4066 |
a BOM. When decoding, the Encoding function can be called on the first line to |
| 4067 |
determine the encoding; this encoding will then be used in subsequent calls to |
| 4068 |
Decode to convert all of the lines to an internal format.]} |
| 4069 |
@end{Notes} |
| 4070 |
|
| 4071 |
@begin{Extend2005} |
| 4072 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0137-2]} |
| 4073 |
@ChgAdded{Version=[3],Text=[@Defn{extensions to Ada 2005} |
| 4074 |
The packages Strings.UTF_Encoding, Strings.UTF_Encoding.Conversions, |
| 4075 |
Strings.UTF_Encoding.Strings, Strings.UTF_Encoding.Wide_Strings, |
| 4076 |
and Strings.UTF_Encoding.Wide_Wide_Strings are new.]} |
| 4077 |
@end{Extend2005} |
| 4078 |
|
| 4079 |
@begin{Diffword2012} |
| 4080 |
@ChgRef{Version=[4],Kind=[AddedNormal],ARef=[AI12-0088-1]} |
| 4081 |
@ChgAdded{Version=[4],Text=[@b<Corrigendum:> Fixed the omission that Convert |
| 4082 |
routines make the same checks on input as Decode routines.]} |
| 4083 |
@end{Diffword2012} |
| 4084 |
|
| 4085 |
|
| 4086 |
@LabeledAddedSubClause{Version=[5],Name=[Universal Text Buffers]} |
| 4087 |
|
| 4088 |
@begin{Intro} |
| 4089 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0340-1]} |
| 4090 |
@ChgAdded{Version=[5],Text=[A universal text buffer can be used to save and |
| 4091 |
retrieve text of any language-defined string type. The types used to save and |
| 4092 |
retrieve the text need not be the same.]} |
| 4093 |
@end{Intro} |
| 4094 |
|
| 4095 |
@begin{StaticSem} |
| 4096 |
|
| 4097 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0340-1]} |
| 4098 |
@ChgAdded{Version=[5],Type=[Leading],Text=[The text buffer library packages have |
| 4099 |
the following declarations:]} |
| 4100 |
|
| 4101 |
@begin{Example} |
| 4102 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0340-1]} |
| 4103 |
@ChgAdded{Version=[5],Text=[@ChildUnit{Parent=[Ada.Strings],Child=[Text_Buffers]}@key[package] Ada.Strings.Text_Buffers |
| 4104 |
@key[with] Pure, Nonblocking, Global => @key[null is]]} |
| 4105 |
|
| 4106 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 4107 |
@ChgAdded{Version=[5],Text=[ @key[type] @AdaTypeDefn{Text_Buffer_Count} @key[is range] 0 .. @RI<implementation-defined>;]} |
| 4108 |
|
| 4109 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 4110 |
@ChgAdded{Version=[5],Text=[ @AdaObjDefn{New_Line_Count} : @key[constant] Text_Buffer_Count := @RI<implementation-defined>;]} |
| 4111 |
|
| 4112 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 4113 |
@ChgAdded{Version=[5],Text=[ @key[type] @AdaTypeDefn{Root_Buffer_Type} @key[is abstract tagged private];]} |
| 4114 |
|
| 4115 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 4116 |
@ChgAdded{Version=[5],Text=[ @key[function] @AdaSubDefn{Character_Count} (Buffer : Root_Buffer_Type) |
| 4117 |
@key[return] Text_Buffer_Count @key[is abstract];]} |
| 4118 |
|
| 4119 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 4120 |
@ChgAdded{Version=[5],Text=[ @key[procedure] @AdaSubDefn{Clear} (Buffer : Root_Buffer_Type) @key[is abstract] |
| 4121 |
@key[with] Post'Class => Character_Count (Buffer) = 0;]} |
| 4122 |
|
| 4123 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 4124 |
@ChgAdded{Version=[5],Text=[ @key[procedure] @AdaSubDefn{Get} ( |
| 4125 |
Buffer : @key[in out] Root_Buffer_Type; |
| 4126 |
Item : @key[out] String; |
| 4127 |
Last : @key[out] Natural) @key[is abstract] |
| 4128 |
@key[with] Post'Class => |
| 4129 |
(@key[declare] |
| 4130 |
Num_Read : @key[constant] Text_Buffer_Count := |
| 4131 |
Text_Buffer_Count'Min |
| 4132 |
(Character_Count(Buffer)'Old, Item'Length); |
| 4133 |
@key[begin] |
| 4134 |
Last = Num_Read + Item'First - 1 @key[and then] |
| 4135 |
Character_Count (Buffer) = |
| 4136 |
Character_Count (Buffer)'Old - Num_Read);]} |
| 4137 |
|
| 4138 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 4139 |
@ChgAdded{Version=[5],Text=[ @key[procedure] @AdaSubDefn{Wide_Get} ( |
| 4140 |
Buffer : @key[in out] Root_Buffer_Type; |
| 4141 |
Item : @key[out] Wide_String; |
| 4142 |
Last : @key[out] Natural) @key[is abstract] |
| 4143 |
@key[with] Post'Class => |
| 4144 |
(@key[declare] |
| 4145 |
Num_Read : @key[constant] Text_Buffer_Count := |
| 4146 |
Text_Buffer_Count'Min |
| 4147 |
(Character_Count(Buffer)'Old, Item'Length); |
| 4148 |
@key[begin] |
| 4149 |
Last = Num_Read + Item'First - 1 @key[and then] |
| 4150 |
Character_Count (Buffer) = |
| 4151 |
Character_Count (Buffer)'Old - Num_Read);]} |
| 4152 |
|
| 4153 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 4154 |
@ChgAdded{Version=[5],Text=[ @key[procedure] @AdaSubDefn{Wide_Wide_Get} ( |
| 4155 |
Buffer : @key[in out] Root_Buffer_Type; |
| 4156 |
Item : @key[out] Wide_Wide_String; |
| 4157 |
Last : @key[out] Natural) @key[is abstract] |
| 4158 |
@key[with] Post'Class => |
| 4159 |
(@key[declare] |
| 4160 |
Num_Read : @key[constant] Text_Buffer_Count := |
| 4161 |
Text_Buffer_Count'Min |
| 4162 |
(Character_Count(Buffer)'Old, Item'Length); |
| 4163 |
@key[begin] |
| 4164 |
Last = Num_Read + Item'First - 1 @key[and then] |
| 4165 |
Character_Count (Buffer) = |
| 4166 |
Character_Count (Buffer)'Old - Num_Read);]} |
| 4167 |
|
| 4168 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 4169 |
@ChgAdded{Version=[5],Text=[ @key[function] @AdaSubDefn{End_of_Line} (Buffer : @key[in] Root_Buffer_Type) |
| 4170 |
@key[return] Boolean @key[is abstract];]} |
| 4171 |
|
| 4172 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 4173 |
@ChgAdded{Version=[5],Text=[ @key[procedure] @AdaSubDefn{Put} ( |
| 4174 |
Buffer : @key[in out] Root_Buffer_Type; |
| 4175 |
Item : @key[in] String) @key[is abstract] |
| 4176 |
@key[with] Post'Class => |
| 4177 |
Character_Count (Buffer) = |
| 4178 |
Character_Count (Buffer)'Old + Item'Length;]} |
| 4179 |
|
| 4180 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 4181 |
@ChgAdded{Version=[5],Text=[ @key[procedure] @AdaSubDefn{Wide_Put} ( |
| 4182 |
Buffer : @key[in out] Root_Buffer_Type; |
| 4183 |
Item : @key[in] Wide_String) @key[is abstract] |
| 4184 |
@key[with] Post'Class => |
| 4185 |
Character_Count (Buffer) = |
| 4186 |
Character_Count (Buffer)'Old + Item'Length;]} |
| 4187 |
|
| 4188 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 4189 |
@ChgAdded{Version=[5],Text=[ @key[procedure] @AdaSubDefn{Wide_Wide_Put} ( |
| 4190 |
Buffer : @key[in out] Root_Buffer_Type; |
| 4191 |
Item : @key[in] Wide_Wide_String) @key[is abstract] |
| 4192 |
@key[with] Post'Class => |
| 4193 |
Character_Count (Buffer) = |
| 4194 |
Character_Count (Buffer)'Old + Item'Length;]} |
| 4195 |
|
| 4196 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 4197 |
@ChgAdded{Version=[5],Text=[ @key[procedure] @AdaSubDefn{New_Line} (Buffer : @key[in out] Root_Buffer_Type) |
| 4198 |
@key[is abstract] |
| 4199 |
@key[with] Post'Class => |
| 4200 |
Character_Count (Buffer) = |
| 4201 |
Character_Count (Buffer)'Old + New_Line_Count;]} |
| 4202 |
|
| 4203 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 4204 |
@ChgAdded{Version=[5],Text=[@key[private] |
| 4205 |
... --@Examcom{ not specified by the language} |
| 4206 |
@key[end] Ada.Strings.Text_Buffers;]} |
| 4207 |
|
| 4208 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0340-1]} |
| 4209 |
@ChgAdded{Version=[5],Text=[@ChildUnit{Parent=[Ada.Strings.Text_Buffers],Child=[Unbounded]}@key[package] Ada.Strings.Text_Buffers.Unbounded |
| 4210 |
@key[with] Preelaborate, Nonblocking, Global => @key[null is]]} |
| 4211 |
|
| 4212 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 4213 |
@ChgAdded{Version=[5],Text=[ @key[type] @AdaTypeDefn{Buffer_Type} @key[is new] Root_Buffer_Type @key[with private] |
| 4214 |
@key[with] Default_Initial_Condition => |
| 4215 |
Character_Count (Buffer_Type) = 0;]} |
| 4216 |
|
| 4217 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 4218 |
@ChgAdded{Version=[5],Text=[ --@Examcom{ Nonabstract overridings of each inherited operation are declared here.}]} |
| 4219 |
|
| 4220 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 4221 |
@ChgAdded{Version=[5],Text=[@key[private] |
| 4222 |
... --@Examcom{ not specified by the language} |
| 4223 |
@key[end] Ada.Strings.Text_Buffers.Unbounded;]} |
| 4224 |
|
| 4225 |
|
| 4226 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0340-1]} |
| 4227 |
@ChgAdded{Version=[5],Text=[@ChildUnit{Parent=[Ada.Strings.Text_Buffers],Child=[Bounded]}@key[package] Ada.Strings.Text_Buffers.Bounded |
| 4228 |
@key[with] Pure, Nonblocking, Global => @key[null is]]} |
| 4229 |
|
| 4230 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 4231 |
@ChgAdded{Version=[5],Text=[ @key[type] @AdaTypeDefn{Buffer_Type} (Max_Characters : Text_Buffer_Count) |
| 4232 |
@key[is new] Root_Buffer_Type @key[with private] |
| 4233 |
@key[with] Default_Initial_Condition => |
| 4234 |
Character_Count (Buffer_Type) = 0;]} |
| 4235 |
|
| 4236 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 4237 |
@ChgAdded{Version=[5],Text=[ --@Examcom{ Nonabstract overridings of each inherited operation are declared here.} |
| 4238 |
--@Examcom{ For each of Put, Wide_Put, and Wide_Wide_Put,} |
| 4239 |
-- Pre => (@key[if] Character_Count (Buffer) + Item'Length > Buffer.Max_Characters |
| 4240 |
-- @key[then raise] Constraint_Error), |
| 4241 |
--@Examcom{ is added to the declaration. For New_Line,} |
| 4242 |
-- Pre => (@key[if] Character_Count (Buffer) + New_Line_Count > Buffer.Max_Characters |
| 4243 |
-- @key[then raise] Constraint_Error), |
| 4244 |
--@Examcom{ is added to the declaration.}]} |
| 4245 |
|
| 4246 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 4247 |
@ChgAdded{Version=[5],Text=[@key[private] |
| 4248 |
... --@Examcom{ not specified by the language} |
| 4249 |
@key[end] Ada.Strings.Text_Buffers.Bounded;]} |
| 4250 |
|
| 4251 |
@end{Example} |
| 4252 |
|
| 4253 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0340-1]} |
| 4254 |
@ChgAdded{Version=[5],Text=[Character_Count returns the number of characters |
| 4255 |
currently stored in a text buffer.]} |
| 4256 |
|
| 4257 |
@begin{Ramification} |
| 4258 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0340-1]} |
| 4259 |
@ChgAdded{Version=[5],Text=[This is lower-case "characters". The |
| 4260 |
representation isn't considered, so it is irrelevant what type of character |
| 4261 |
(Character, Wide_Character, or Wide_Wide_Character) was stored.]} |
| 4262 |
@end{Ramification} |
| 4263 |
|
| 4264 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0340-1]} |
| 4265 |
@ChgAdded{Version=[5],Text=[New_Line stores New_Line_Count characters that |
| 4266 |
represent a new line into a text buffer. End_of_Line returns True if the next |
| 4267 |
characters to be retrieved from the text buffer represent a new line.]} |
| 4268 |
|
| 4269 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0340-1]} |
| 4270 |
@ChgAdded{Version=[5],Text=[A call to Put, Wide_Put, or Wide_Wide_Put stores a |
| 4271 |
sequence of characters into the text buffer.]} |
| 4272 |
|
| 4273 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0340-1]} |
| 4274 |
@ChgAdded{Version=[5],Text=[A call to Get, Wide_Get, or Wide_Wide_Get returns |
| 4275 |
the same sequence of characters as was present in the calls that stored the |
| 4276 |
characters into the buffer. For a call to Get, if any character in the sequence |
| 4277 |
is not defined in Character, the result is implementation defined. Similarly, |
| 4278 |
for a call to Wide_Get, if any character in the sequence is not defined in |
| 4279 |
Wide_Character, the result is implementation defined.]} |
| 4280 |
|
| 4281 |
@ChgImplDef{Version=[5],Kind=[AddedNormal],Text=[@ChgAdded{Version=[5], |
| 4282 |
Text=[The value returned by a call to a Text_Buffer Get procedure if any |
| 4283 |
character in the returned sequence is not defined in Character.]}]} |
| 4284 |
|
| 4285 |
@ChgImplDef{Version=[5],Kind=[AddedNormal],Text=[@ChgAdded{Version=[5], |
| 4286 |
Text=[The value returned by a call to a Text_Buffer Wide_Get procedure if any |
| 4287 |
character in the returned sequence is not defined in Wide_Character.]}]} |
| 4288 |
|
| 4289 |
@begin{Ramification} |
| 4290 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0340-1]} |
| 4291 |
@ChgAdded{Version=[5],Text=[Even when the result is implementation defined, |
| 4292 |
the postconditions on the various Get routines require the length of the |
| 4293 |
returned string to match that of the number of characters removed from the |
| 4294 |
buffer.]} |
| 4295 |
@end{Ramification} |
| 4296 |
|
| 4297 |
@end{StaticSem} |
| 4298 |
|
| 4299 |
@begin{ImplAdvice} |
| 4300 |
|
| 4301 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0340-1]} |
| 4302 |
@ChgAdded{Version=[5],Text=[Bounded buffer objects should be implemented without |
| 4303 |
dynamic allocation.]} |
| 4304 |
|
| 4305 |
@ChgImplAdvice{Version=[5],Kind=[Added],Text=[@ChgAdded{Version=[5], |
| 4306 |
Text=[Bounded buffer objects should be implemented without dynamic allocation.]}]} |
| 4307 |
|
| 4308 |
@end{ImplAdvice} |
| 4309 |
|
| 4310 |
@begin{Extend2012} |
| 4311 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0340-1]} |
| 4312 |
@ChgAdded{Version=[5],Text=[@Defn{extensions to Ada 2012} |
| 4313 |
The packages Strings.Text_Buffers, Strings.Text_Buffers.Unbounded, |
| 4314 |
and Strings.Text_Buffers.Bounded are new.]} |
| 4315 |
@end{Extend2012} |
| 4316 |
|