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-2005 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 --------------------------------
44 -- Character Set Declarations --
45 --------------------------------
47 type Character_Set
is private;
48 -- Representation for a set of character values:
50 Null_Set
: constant Character_Set
;
52 ---------------------------
53 -- Constructors for Sets --
54 ---------------------------
56 type Character_Range
is record
60 -- Represents Character range Low .. High
62 type Character_Ranges
is array (Positive range <>) of Character_Range
;
64 function To_Set
(Ranges
: Character_Ranges
) return Character_Set
;
66 function To_Set
(Span
: Character_Range
) return Character_Set
;
68 function To_Ranges
(Set
: Character_Set
) return Character_Ranges
;
70 ----------------------------------
71 -- Operations on Character Sets --
72 ----------------------------------
74 function "=" (Left
, Right
: Character_Set
) return Boolean;
76 function "not" (Right
: Character_Set
) return Character_Set
;
77 function "and" (Left
, Right
: Character_Set
) return Character_Set
;
78 function "or" (Left
, Right
: Character_Set
) return Character_Set
;
79 function "xor" (Left
, Right
: Character_Set
) return Character_Set
;
80 function "-" (Left
, Right
: Character_Set
) return Character_Set
;
84 Set
: Character_Set
) return Boolean;
87 (Elements
: Character_Set
;
88 Set
: Character_Set
) return Boolean;
91 (Left
: Character_Set
;
92 Right
: Character_Set
) return Boolean
95 subtype Character_Sequence
is String;
96 -- Alternative representation for a set of character values
98 function To_Set
(Sequence
: Character_Sequence
) return Character_Set
;
99 function To_Set
(Singleton
: Character) return Character_Set
;
101 function To_Sequence
(Set
: Character_Set
) return Character_Sequence
;
103 ------------------------------------
104 -- Character Mapping Declarations --
105 ------------------------------------
107 type Character_Mapping
is private;
108 -- Representation for a character to character mapping:
111 (Map
: Character_Mapping
;
112 Element
: Character) return Character;
114 Identity
: constant Character_Mapping
;
116 ----------------------------
117 -- Operations on Mappings --
118 ----------------------------
121 (From
, To
: Character_Sequence
) return Character_Mapping
;
124 (Map
: Character_Mapping
) return Character_Sequence
;
127 (Map
: Character_Mapping
) return Character_Sequence
;
129 type Character_Mapping_Function
is
130 access function (From
: Character) return Character;
133 pragma Inline
(Is_In
);
134 pragma Inline
(Value
);
136 type Character_Set_Internal
is array (Character) of Boolean;
137 pragma Pack
(Character_Set_Internal
);
139 type Character_Set
is new Character_Set_Internal
;
140 -- Note: the reason for this level of derivation is to make sure
141 -- that the predefined logical operations on this type remain
142 -- accessible. The operations on Character_Set are overridden by
143 -- the defined operations in the spec, but the operations defined
144 -- on Character_Set_Internal remain visible.
146 Null_Set
: constant Character_Set
:= (others => False);
148 type Character_Mapping
is array (Character) of Character;
150 package L
renames Ada
.Characters
.Latin_1
;
152 Identity
: constant Character_Mapping
:=
186 L
.Exclamation
& -- '!' 33
187 L
.Quotation
& -- '"' 34
188 L
.Number_Sign
& -- '#' 35
189 L
.Dollar_Sign
& -- '$' 36
190 L
.Percent_Sign
& -- '%' 37
191 L
.Ampersand
& -- '&' 38
192 L
.Apostrophe
& -- ''' 39
193 L
.Left_Parenthesis
& -- '(' 40
194 L
.Right_Parenthesis
& -- ')' 41
195 L
.Asterisk
& -- '*' 42
196 L
.Plus_Sign
& -- '+' 43
199 L
.Full_Stop
& -- '.' 46
200 L
.Solidus
& -- '/' 47
212 L
.Semicolon
& -- ';' 59
213 L
.Less_Than_Sign
& -- '<' 60
214 L
.Equals_Sign
& -- '=' 61
215 L
.Greater_Than_Sign
& -- '>' 62
216 L
.Question
& -- '?' 63
217 L
.Commercial_At
& -- '@' 64
244 L
.Left_Square_Bracket
& -- '[' 91
245 L
.Reverse_Solidus
& -- '\' 92
246 L
.Right_Square_Bracket
& -- ']' 93
247 L
.Circumflex
& -- '^' 94
248 L
.Low_Line
& -- '_' 95
276 L
.Left_Curly_Bracket
& -- '{' 123
277 L
.Vertical_Line
& -- '|' 124
278 L
.Right_Curly_Bracket
& -- '}' 125
281 L
.Reserved_128
& -- Reserved_128 128
282 L
.Reserved_129
& -- Reserved_129 129
285 L
.Reserved_132
& -- Reserved_132 132
306 L
.Reserved_153
& -- Reserved_153 153
313 L
.No_Break_Space
& -- No_Break_Space 160
314 L
.Inverted_Exclamation
& -- Inverted_Exclamation 161
315 L
.Cent_Sign
& -- Cent_Sign 162
316 L
.Pound_Sign
& -- Pound_Sign 163
317 L
.Currency_Sign
& -- Currency_Sign 164
318 L
.Yen_Sign
& -- Yen_Sign 165
319 L
.Broken_Bar
& -- Broken_Bar 166
320 L
.Section_Sign
& -- Section_Sign 167
321 L
.Diaeresis
& -- Diaeresis 168
322 L
.Copyright_Sign
& -- Copyright_Sign 169
323 L
.Feminine_Ordinal_Indicator
& -- Feminine_Ordinal_Indicator 170
324 L
.Left_Angle_Quotation
& -- Left_Angle_Quotation 171
325 L
.Not_Sign
& -- Not_Sign 172
326 L
.Soft_Hyphen
& -- Soft_Hyphen 173
327 L
.Registered_Trade_Mark_Sign
& -- Registered_Trade_Mark_Sign 174
328 L
.Macron
& -- Macron 175
329 L
.Degree_Sign
& -- Degree_Sign 176
330 L
.Plus_Minus_Sign
& -- Plus_Minus_Sign 177
331 L
.Superscript_Two
& -- Superscript_Two 178
332 L
.Superscript_Three
& -- Superscript_Three 179
333 L
.Acute
& -- Acute 180
334 L
.Micro_Sign
& -- Micro_Sign 181
335 L
.Pilcrow_Sign
& -- Pilcrow_Sign 182
336 L
.Middle_Dot
& -- Middle_Dot 183
337 L
.Cedilla
& -- Cedilla 184
338 L
.Superscript_One
& -- Superscript_One 185
339 L
.Masculine_Ordinal_Indicator
& -- Masculine_Ordinal_Indicator 186
340 L
.Right_Angle_Quotation
& -- Right_Angle_Quotation 187
341 L
.Fraction_One_Quarter
& -- Fraction_One_Quarter 188
342 L
.Fraction_One_Half
& -- Fraction_One_Half 189
343 L
.Fraction_Three_Quarters
& -- Fraction_Three_Quarters 190
344 L
.Inverted_Question
& -- Inverted_Question 191
345 L
.UC_A_Grave
& -- UC_A_Grave 192
346 L
.UC_A_Acute
& -- UC_A_Acute 193
347 L
.UC_A_Circumflex
& -- UC_A_Circumflex 194
348 L
.UC_A_Tilde
& -- UC_A_Tilde 195
349 L
.UC_A_Diaeresis
& -- UC_A_Diaeresis 196
350 L
.UC_A_Ring
& -- UC_A_Ring 197
351 L
.UC_AE_Diphthong
& -- UC_AE_Diphthong 198
352 L
.UC_C_Cedilla
& -- UC_C_Cedilla 199
353 L
.UC_E_Grave
& -- UC_E_Grave 200
354 L
.UC_E_Acute
& -- UC_E_Acute 201
355 L
.UC_E_Circumflex
& -- UC_E_Circumflex 202
356 L
.UC_E_Diaeresis
& -- UC_E_Diaeresis 203
357 L
.UC_I_Grave
& -- UC_I_Grave 204
358 L
.UC_I_Acute
& -- UC_I_Acute 205
359 L
.UC_I_Circumflex
& -- UC_I_Circumflex 206
360 L
.UC_I_Diaeresis
& -- UC_I_Diaeresis 207
361 L
.UC_Icelandic_Eth
& -- UC_Icelandic_Eth 208
362 L
.UC_N_Tilde
& -- UC_N_Tilde 209
363 L
.UC_O_Grave
& -- UC_O_Grave 210
364 L
.UC_O_Acute
& -- UC_O_Acute 211
365 L
.UC_O_Circumflex
& -- UC_O_Circumflex 212
366 L
.UC_O_Tilde
& -- UC_O_Tilde 213
367 L
.UC_O_Diaeresis
& -- UC_O_Diaeresis 214
368 L
.Multiplication_Sign
& -- Multiplication_Sign 215
369 L
.UC_O_Oblique_Stroke
& -- UC_O_Oblique_Stroke 216
370 L
.UC_U_Grave
& -- UC_U_Grave 217
371 L
.UC_U_Acute
& -- UC_U_Acute 218
372 L
.UC_U_Circumflex
& -- UC_U_Circumflex 219
373 L
.UC_U_Diaeresis
& -- UC_U_Diaeresis 220
374 L
.UC_Y_Acute
& -- UC_Y_Acute 221
375 L
.UC_Icelandic_Thorn
& -- UC_Icelandic_Thorn 222
376 L
.LC_German_Sharp_S
& -- LC_German_Sharp_S 223
377 L
.LC_A_Grave
& -- LC_A_Grave 224
378 L
.LC_A_Acute
& -- LC_A_Acute 225
379 L
.LC_A_Circumflex
& -- LC_A_Circumflex 226
380 L
.LC_A_Tilde
& -- LC_A_Tilde 227
381 L
.LC_A_Diaeresis
& -- LC_A_Diaeresis 228
382 L
.LC_A_Ring
& -- LC_A_Ring 229
383 L
.LC_AE_Diphthong
& -- LC_AE_Diphthong 230
384 L
.LC_C_Cedilla
& -- LC_C_Cedilla 231
385 L
.LC_E_Grave
& -- LC_E_Grave 232
386 L
.LC_E_Acute
& -- LC_E_Acute 233
387 L
.LC_E_Circumflex
& -- LC_E_Circumflex 234
388 L
.LC_E_Diaeresis
& -- LC_E_Diaeresis 235
389 L
.LC_I_Grave
& -- LC_I_Grave 236
390 L
.LC_I_Acute
& -- LC_I_Acute 237
391 L
.LC_I_Circumflex
& -- LC_I_Circumflex 238
392 L
.LC_I_Diaeresis
& -- LC_I_Diaeresis 239
393 L
.LC_Icelandic_Eth
& -- LC_Icelandic_Eth 240
394 L
.LC_N_Tilde
& -- LC_N_Tilde 241
395 L
.LC_O_Grave
& -- LC_O_Grave 242
396 L
.LC_O_Acute
& -- LC_O_Acute 243
397 L
.LC_O_Circumflex
& -- LC_O_Circumflex 244
398 L
.LC_O_Tilde
& -- LC_O_Tilde 245
399 L
.LC_O_Diaeresis
& -- LC_O_Diaeresis 246
400 L
.Division_Sign
& -- Division_Sign 247
401 L
.LC_O_Oblique_Stroke
& -- LC_O_Oblique_Stroke 248
402 L
.LC_U_Grave
& -- LC_U_Grave 249
403 L
.LC_U_Acute
& -- LC_U_Acute 250
404 L
.LC_U_Circumflex
& -- LC_U_Circumflex 251
405 L
.LC_U_Diaeresis
& -- LC_U_Diaeresis 252
406 L
.LC_Y_Acute
& -- LC_Y_Acute 253
407 L
.LC_Icelandic_Thorn
& -- LC_Icelandic_Thorn 254
408 L
.LC_Y_Diaeresis
); -- LC_Y_Diaeresis 255
410 end Ada
.Strings
.Maps
;