1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- A D A . S T R I N G S . M A P S --
9 -- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
11 -- This specification is derived from the Ada Reference Manual for use with --
12 -- GNAT. The copyright notice above, and the license provisions that follow --
13 -- apply solely to the contents of the part following the private keyword. --
15 -- GNAT is free software; you can redistribute it and/or modify it under --
16 -- terms of the GNU General Public License as published by the Free Soft- --
17 -- ware Foundation; either version 2, or (at your option) any later ver- --
18 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
19 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
20 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
21 -- for more details. You should have received a copy of the GNU General --
22 -- Public License distributed with GNAT; see file COPYING. If not, write --
23 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
24 -- MA 02111-1307, USA. --
26 -- As a special exception, if other files instantiate generics from this --
27 -- unit, or you link this unit with other files to produce an executable, --
28 -- this unit does not by itself cause the resulting executable to be --
29 -- covered by the GNU General Public License. This exception does not --
30 -- however invalidate any other reasons why the executable file might be --
31 -- covered by the GNU Public License. --
33 -- GNAT was originally developed by the GNAT team at New York University. --
34 -- Extensive contributions were provided by Ada Core Technologies Inc. --
36 ------------------------------------------------------------------------------
38 with Ada
.Characters
.Latin_1
;
40 package Ada
.Strings
.Maps
is
41 pragma Preelaborate
(Maps
);
43 package L
renames Ada
.Characters
.Latin_1
;
45 --------------------------------
46 -- Character Set Declarations --
47 --------------------------------
49 type Character_Set
is private;
50 -- Representation for a set of character values:
52 Null_Set
: constant Character_Set
;
54 ---------------------------
55 -- Constructors for Sets --
56 ---------------------------
58 type Character_Range
is record
62 -- Represents Character range Low .. High
64 type Character_Ranges
is array (Positive range <>) of Character_Range
;
66 function To_Set
(Ranges
: in Character_Ranges
) return Character_Set
;
68 function To_Set
(Span
: in Character_Range
) return Character_Set
;
70 function To_Ranges
(Set
: in Character_Set
) return Character_Ranges
;
72 ----------------------------------
73 -- Operations on Character Sets --
74 ----------------------------------
76 function "=" (Left
, Right
: in Character_Set
) return Boolean;
78 function "not" (Right
: in Character_Set
) return Character_Set
;
79 function "and" (Left
, Right
: in Character_Set
) return Character_Set
;
80 function "or" (Left
, Right
: in Character_Set
) return Character_Set
;
81 function "xor" (Left
, Right
: in Character_Set
) return Character_Set
;
82 function "-" (Left
, Right
: in Character_Set
) return Character_Set
;
85 (Element
: in Character;
86 Set
: in Character_Set
)
90 (Elements
: in Character_Set
;
91 Set
: in Character_Set
)
95 (Left
: in Character_Set
;
96 Right
: in Character_Set
)
100 subtype Character_Sequence
is String;
101 -- Alternative representation for a set of character values
103 function To_Set
(Sequence
: in Character_Sequence
) return Character_Set
;
105 function To_Set
(Singleton
: in Character) return Character_Set
;
107 function To_Sequence
(Set
: in Character_Set
) return Character_Sequence
;
109 ------------------------------------
110 -- Character Mapping Declarations --
111 ------------------------------------
113 type Character_Mapping
is private;
114 -- Representation for a character to character mapping:
117 (Map
: in Character_Mapping
;
118 Element
: in Character)
121 Identity
: constant Character_Mapping
;
123 ----------------------------
124 -- Operations on Mappings --
125 ----------------------------
128 (From
, To
: in Character_Sequence
)
129 return Character_Mapping
;
132 (Map
: in Character_Mapping
)
133 return Character_Sequence
;
136 (Map
: in Character_Mapping
)
137 return Character_Sequence
;
139 type Character_Mapping_Function
is
140 access function (From
: in Character) return Character;
147 pragma Inline
(Is_In
);
148 pragma Inline
(Value
);
150 type Character_Set_Internal
is array (Character) of Boolean;
151 pragma Pack
(Character_Set_Internal
);
153 type Character_Set
is new Character_Set_Internal
;
154 -- Note: the reason for this level of derivation is to make sure
155 -- that the predefined logical operations on this type remain
156 -- accessible. The operations on Character_Set are overridden by
157 -- the defined operations in the spec, but the operations defined
158 -- on Character_Set_Internal remain visible.
160 Null_Set
: constant Character_Set
:= (others => False);
162 type Character_Mapping
is array (Character) of Character;
164 Identity
: constant Character_Mapping
:=
198 L
.Exclamation
& -- '!' 33
199 L
.Quotation
& -- '"' 34
200 L
.Number_Sign
& -- '#' 35
201 L
.Dollar_Sign
& -- '$' 36
202 L
.Percent_Sign
& -- '%' 37
203 L
.Ampersand
& -- '&' 38
204 L
.Apostrophe
& -- ''' 39
205 L
.Left_Parenthesis
& -- '(' 40
206 L
.Right_Parenthesis
& -- ')' 41
207 L
.Asterisk
& -- '*' 42
208 L
.Plus_Sign
& -- '+' 43
211 L
.Full_Stop
& -- '.' 46
212 L
.Solidus
& -- '/' 47
224 L
.Semicolon
& -- ';' 59
225 L
.Less_Than_Sign
& -- '<' 60
226 L
.Equals_Sign
& -- '=' 61
227 L
.Greater_Than_Sign
& -- '>' 62
228 L
.Question
& -- '?' 63
229 L
.Commercial_At
& -- '@' 64
256 L
.Left_Square_Bracket
& -- '[' 91
257 L
.Reverse_Solidus
& -- '\' 92
258 L
.Right_Square_Bracket
& -- ']' 93
259 L
.Circumflex
& -- '^' 94
260 L
.Low_Line
& -- '_' 95
288 L
.Left_Curly_Bracket
& -- '{' 123
289 L
.Vertical_Line
& -- '|' 124
290 L
.Right_Curly_Bracket
& -- '}' 125
293 L
.Reserved_128
& -- Reserved_128 128
294 L
.Reserved_129
& -- Reserved_129 129
297 L
.Reserved_132
& -- Reserved_132 132
318 L
.Reserved_153
& -- Reserved_153 153
325 L
.No_Break_Space
& -- No_Break_Space 160
326 L
.Inverted_Exclamation
& -- Inverted_Exclamation 161
327 L
.Cent_Sign
& -- Cent_Sign 162
328 L
.Pound_Sign
& -- Pound_Sign 163
329 L
.Currency_Sign
& -- Currency_Sign 164
330 L
.Yen_Sign
& -- Yen_Sign 165
331 L
.Broken_Bar
& -- Broken_Bar 166
332 L
.Section_Sign
& -- Section_Sign 167
333 L
.Diaeresis
& -- Diaeresis 168
334 L
.Copyright_Sign
& -- Copyright_Sign 169
335 L
.Feminine_Ordinal_Indicator
& -- Feminine_Ordinal_Indicator 170
336 L
.Left_Angle_Quotation
& -- Left_Angle_Quotation 171
337 L
.Not_Sign
& -- Not_Sign 172
338 L
.Soft_Hyphen
& -- Soft_Hyphen 173
339 L
.Registered_Trade_Mark_Sign
& -- Registered_Trade_Mark_Sign 174
340 L
.Macron
& -- Macron 175
341 L
.Degree_Sign
& -- Degree_Sign 176
342 L
.Plus_Minus_Sign
& -- Plus_Minus_Sign 177
343 L
.Superscript_Two
& -- Superscript_Two 178
344 L
.Superscript_Three
& -- Superscript_Three 179
345 L
.Acute
& -- Acute 180
346 L
.Micro_Sign
& -- Micro_Sign 181
347 L
.Pilcrow_Sign
& -- Pilcrow_Sign 182
348 L
.Middle_Dot
& -- Middle_Dot 183
349 L
.Cedilla
& -- Cedilla 184
350 L
.Superscript_One
& -- Superscript_One 185
351 L
.Masculine_Ordinal_Indicator
& -- Masculine_Ordinal_Indicator 186
352 L
.Right_Angle_Quotation
& -- Right_Angle_Quotation 187
353 L
.Fraction_One_Quarter
& -- Fraction_One_Quarter 188
354 L
.Fraction_One_Half
& -- Fraction_One_Half 189
355 L
.Fraction_Three_Quarters
& -- Fraction_Three_Quarters 190
356 L
.Inverted_Question
& -- Inverted_Question 191
357 L
.UC_A_Grave
& -- UC_A_Grave 192
358 L
.UC_A_Acute
& -- UC_A_Acute 193
359 L
.UC_A_Circumflex
& -- UC_A_Circumflex 194
360 L
.UC_A_Tilde
& -- UC_A_Tilde 195
361 L
.UC_A_Diaeresis
& -- UC_A_Diaeresis 196
362 L
.UC_A_Ring
& -- UC_A_Ring 197
363 L
.UC_AE_Diphthong
& -- UC_AE_Diphthong 198
364 L
.UC_C_Cedilla
& -- UC_C_Cedilla 199
365 L
.UC_E_Grave
& -- UC_E_Grave 200
366 L
.UC_E_Acute
& -- UC_E_Acute 201
367 L
.UC_E_Circumflex
& -- UC_E_Circumflex 202
368 L
.UC_E_Diaeresis
& -- UC_E_Diaeresis 203
369 L
.UC_I_Grave
& -- UC_I_Grave 204
370 L
.UC_I_Acute
& -- UC_I_Acute 205
371 L
.UC_I_Circumflex
& -- UC_I_Circumflex 206
372 L
.UC_I_Diaeresis
& -- UC_I_Diaeresis 207
373 L
.UC_Icelandic_Eth
& -- UC_Icelandic_Eth 208
374 L
.UC_N_Tilde
& -- UC_N_Tilde 209
375 L
.UC_O_Grave
& -- UC_O_Grave 210
376 L
.UC_O_Acute
& -- UC_O_Acute 211
377 L
.UC_O_Circumflex
& -- UC_O_Circumflex 212
378 L
.UC_O_Tilde
& -- UC_O_Tilde 213
379 L
.UC_O_Diaeresis
& -- UC_O_Diaeresis 214
380 L
.Multiplication_Sign
& -- Multiplication_Sign 215
381 L
.UC_O_Oblique_Stroke
& -- UC_O_Oblique_Stroke 216
382 L
.UC_U_Grave
& -- UC_U_Grave 217
383 L
.UC_U_Acute
& -- UC_U_Acute 218
384 L
.UC_U_Circumflex
& -- UC_U_Circumflex 219
385 L
.UC_U_Diaeresis
& -- UC_U_Diaeresis 220
386 L
.UC_Y_Acute
& -- UC_Y_Acute 221
387 L
.UC_Icelandic_Thorn
& -- UC_Icelandic_Thorn 222
388 L
.LC_German_Sharp_S
& -- LC_German_Sharp_S 223
389 L
.LC_A_Grave
& -- LC_A_Grave 224
390 L
.LC_A_Acute
& -- LC_A_Acute 225
391 L
.LC_A_Circumflex
& -- LC_A_Circumflex 226
392 L
.LC_A_Tilde
& -- LC_A_Tilde 227
393 L
.LC_A_Diaeresis
& -- LC_A_Diaeresis 228
394 L
.LC_A_Ring
& -- LC_A_Ring 229
395 L
.LC_AE_Diphthong
& -- LC_AE_Diphthong 230
396 L
.LC_C_Cedilla
& -- LC_C_Cedilla 231
397 L
.LC_E_Grave
& -- LC_E_Grave 232
398 L
.LC_E_Acute
& -- LC_E_Acute 233
399 L
.LC_E_Circumflex
& -- LC_E_Circumflex 234
400 L
.LC_E_Diaeresis
& -- LC_E_Diaeresis 235
401 L
.LC_I_Grave
& -- LC_I_Grave 236
402 L
.LC_I_Acute
& -- LC_I_Acute 237
403 L
.LC_I_Circumflex
& -- LC_I_Circumflex 238
404 L
.LC_I_Diaeresis
& -- LC_I_Diaeresis 239
405 L
.LC_Icelandic_Eth
& -- LC_Icelandic_Eth 240
406 L
.LC_N_Tilde
& -- LC_N_Tilde 241
407 L
.LC_O_Grave
& -- LC_O_Grave 242
408 L
.LC_O_Acute
& -- LC_O_Acute 243
409 L
.LC_O_Circumflex
& -- LC_O_Circumflex 244
410 L
.LC_O_Tilde
& -- LC_O_Tilde 245
411 L
.LC_O_Diaeresis
& -- LC_O_Diaeresis 246
412 L
.Division_Sign
& -- Division_Sign 247
413 L
.LC_O_Oblique_Stroke
& -- LC_O_Oblique_Stroke 248
414 L
.LC_U_Grave
& -- LC_U_Grave 249
415 L
.LC_U_Acute
& -- LC_U_Acute 250
416 L
.LC_U_Circumflex
& -- LC_U_Circumflex 251
417 L
.LC_U_Diaeresis
& -- LC_U_Diaeresis 252
418 L
.LC_Y_Acute
& -- LC_Y_Acute 253
419 L
.LC_Icelandic_Thorn
& -- LC_Icelandic_Thorn 254
420 L
.LC_Y_Diaeresis
); -- LC_Y_Diaeresis 255
422 end Ada
.Strings
.Maps
;