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-2014, 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 3, 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. --
22 -- As a special exception under Section 7 of GPL version 3, you are granted --
23 -- additional permissions described in the GCC Runtime Library Exception, --
24 -- version 3.1, as published by the Free Software Foundation. --
26 -- You should have received a copy of the GNU General Public License and --
27 -- a copy of the GCC Runtime Library Exception along with this program; --
28 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
29 -- <http://www.gnu.org/licenses/>. --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- Extensive contributions were provided by Ada Core Technologies Inc. --
34 ------------------------------------------------------------------------------
36 with Ada
.Characters
.Latin_1
;
38 package Ada
.Strings
.Maps
is
40 -- In accordance with Ada 2005 AI-362
42 --------------------------------
43 -- Character Set Declarations --
44 --------------------------------
46 type Character_Set
is private;
47 pragma Preelaborable_Initialization
(Character_Set
);
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 pragma Preelaborable_Initialization
(Character_Mapping
);
109 -- Representation for a character to character mapping:
112 (Map
: Character_Mapping
;
113 Element
: Character) return Character;
115 Identity
: constant Character_Mapping
;
117 ----------------------------
118 -- Operations on Mappings --
119 ----------------------------
122 (From
, To
: Character_Sequence
) return Character_Mapping
;
125 (Map
: Character_Mapping
) return Character_Sequence
;
128 (Map
: Character_Mapping
) return Character_Sequence
;
130 type Character_Mapping_Function
is
131 access function (From
: Character) return Character;
134 pragma Inline
(Is_In
);
135 pragma Inline
(Value
);
137 type Character_Set_Internal
is array (Character) of Boolean;
138 pragma Pack
(Character_Set_Internal
);
140 type Character_Set
is new Character_Set_Internal
;
141 -- Note: the reason for this level of derivation is to make sure
142 -- that the predefined logical operations on this type remain
143 -- accessible. The operations on Character_Set are overridden by
144 -- the defined operations in the spec, but the operations defined
145 -- on Character_Set_Internal remain visible.
147 Null_Set
: constant Character_Set
:= (others => False);
149 type Character_Mapping
is array (Character) of Character;
151 package L
renames Ada
.Characters
.Latin_1
;
153 Identity
: constant Character_Mapping
:=
187 L
.Exclamation
& -- '!' 33
188 L
.Quotation
& -- '"' 34
189 L
.Number_Sign
& -- '#' 35
190 L
.Dollar_Sign
& -- '$' 36
191 L
.Percent_Sign
& -- '%' 37
192 L
.Ampersand
& -- '&' 38
193 L
.Apostrophe
& -- ''' 39
194 L
.Left_Parenthesis
& -- '(' 40
195 L
.Right_Parenthesis
& -- ')' 41
196 L
.Asterisk
& -- '*' 42
197 L
.Plus_Sign
& -- '+' 43
200 L
.Full_Stop
& -- '.' 46
201 L
.Solidus
& -- '/' 47
213 L
.Semicolon
& -- ';' 59
214 L
.Less_Than_Sign
& -- '<' 60
215 L
.Equals_Sign
& -- '=' 61
216 L
.Greater_Than_Sign
& -- '>' 62
217 L
.Question
& -- '?' 63
218 L
.Commercial_At
& -- '@' 64
245 L
.Left_Square_Bracket
& -- '[' 91
246 L
.Reverse_Solidus
& -- '\' 92
247 L
.Right_Square_Bracket
& -- ']' 93
248 L
.Circumflex
& -- '^' 94
249 L
.Low_Line
& -- '_' 95
277 L
.Left_Curly_Bracket
& -- '{' 123
278 L
.Vertical_Line
& -- '|' 124
279 L
.Right_Curly_Bracket
& -- '}' 125
282 L
.Reserved_128
& -- Reserved_128 128
283 L
.Reserved_129
& -- Reserved_129 129
286 L
.Reserved_132
& -- Reserved_132 132
307 L
.Reserved_153
& -- Reserved_153 153
314 L
.No_Break_Space
& -- No_Break_Space 160
315 L
.Inverted_Exclamation
& -- Inverted_Exclamation 161
316 L
.Cent_Sign
& -- Cent_Sign 162
317 L
.Pound_Sign
& -- Pound_Sign 163
318 L
.Currency_Sign
& -- Currency_Sign 164
319 L
.Yen_Sign
& -- Yen_Sign 165
320 L
.Broken_Bar
& -- Broken_Bar 166
321 L
.Section_Sign
& -- Section_Sign 167
322 L
.Diaeresis
& -- Diaeresis 168
323 L
.Copyright_Sign
& -- Copyright_Sign 169
324 L
.Feminine_Ordinal_Indicator
& -- Feminine_Ordinal_Indicator 170
325 L
.Left_Angle_Quotation
& -- Left_Angle_Quotation 171
326 L
.Not_Sign
& -- Not_Sign 172
327 L
.Soft_Hyphen
& -- Soft_Hyphen 173
328 L
.Registered_Trade_Mark_Sign
& -- Registered_Trade_Mark_Sign 174
329 L
.Macron
& -- Macron 175
330 L
.Degree_Sign
& -- Degree_Sign 176
331 L
.Plus_Minus_Sign
& -- Plus_Minus_Sign 177
332 L
.Superscript_Two
& -- Superscript_Two 178
333 L
.Superscript_Three
& -- Superscript_Three 179
334 L
.Acute
& -- Acute 180
335 L
.Micro_Sign
& -- Micro_Sign 181
336 L
.Pilcrow_Sign
& -- Pilcrow_Sign 182
337 L
.Middle_Dot
& -- Middle_Dot 183
338 L
.Cedilla
& -- Cedilla 184
339 L
.Superscript_One
& -- Superscript_One 185
340 L
.Masculine_Ordinal_Indicator
& -- Masculine_Ordinal_Indicator 186
341 L
.Right_Angle_Quotation
& -- Right_Angle_Quotation 187
342 L
.Fraction_One_Quarter
& -- Fraction_One_Quarter 188
343 L
.Fraction_One_Half
& -- Fraction_One_Half 189
344 L
.Fraction_Three_Quarters
& -- Fraction_Three_Quarters 190
345 L
.Inverted_Question
& -- Inverted_Question 191
346 L
.UC_A_Grave
& -- UC_A_Grave 192
347 L
.UC_A_Acute
& -- UC_A_Acute 193
348 L
.UC_A_Circumflex
& -- UC_A_Circumflex 194
349 L
.UC_A_Tilde
& -- UC_A_Tilde 195
350 L
.UC_A_Diaeresis
& -- UC_A_Diaeresis 196
351 L
.UC_A_Ring
& -- UC_A_Ring 197
352 L
.UC_AE_Diphthong
& -- UC_AE_Diphthong 198
353 L
.UC_C_Cedilla
& -- UC_C_Cedilla 199
354 L
.UC_E_Grave
& -- UC_E_Grave 200
355 L
.UC_E_Acute
& -- UC_E_Acute 201
356 L
.UC_E_Circumflex
& -- UC_E_Circumflex 202
357 L
.UC_E_Diaeresis
& -- UC_E_Diaeresis 203
358 L
.UC_I_Grave
& -- UC_I_Grave 204
359 L
.UC_I_Acute
& -- UC_I_Acute 205
360 L
.UC_I_Circumflex
& -- UC_I_Circumflex 206
361 L
.UC_I_Diaeresis
& -- UC_I_Diaeresis 207
362 L
.UC_Icelandic_Eth
& -- UC_Icelandic_Eth 208
363 L
.UC_N_Tilde
& -- UC_N_Tilde 209
364 L
.UC_O_Grave
& -- UC_O_Grave 210
365 L
.UC_O_Acute
& -- UC_O_Acute 211
366 L
.UC_O_Circumflex
& -- UC_O_Circumflex 212
367 L
.UC_O_Tilde
& -- UC_O_Tilde 213
368 L
.UC_O_Diaeresis
& -- UC_O_Diaeresis 214
369 L
.Multiplication_Sign
& -- Multiplication_Sign 215
370 L
.UC_O_Oblique_Stroke
& -- UC_O_Oblique_Stroke 216
371 L
.UC_U_Grave
& -- UC_U_Grave 217
372 L
.UC_U_Acute
& -- UC_U_Acute 218
373 L
.UC_U_Circumflex
& -- UC_U_Circumflex 219
374 L
.UC_U_Diaeresis
& -- UC_U_Diaeresis 220
375 L
.UC_Y_Acute
& -- UC_Y_Acute 221
376 L
.UC_Icelandic_Thorn
& -- UC_Icelandic_Thorn 222
377 L
.LC_German_Sharp_S
& -- LC_German_Sharp_S 223
378 L
.LC_A_Grave
& -- LC_A_Grave 224
379 L
.LC_A_Acute
& -- LC_A_Acute 225
380 L
.LC_A_Circumflex
& -- LC_A_Circumflex 226
381 L
.LC_A_Tilde
& -- LC_A_Tilde 227
382 L
.LC_A_Diaeresis
& -- LC_A_Diaeresis 228
383 L
.LC_A_Ring
& -- LC_A_Ring 229
384 L
.LC_AE_Diphthong
& -- LC_AE_Diphthong 230
385 L
.LC_C_Cedilla
& -- LC_C_Cedilla 231
386 L
.LC_E_Grave
& -- LC_E_Grave 232
387 L
.LC_E_Acute
& -- LC_E_Acute 233
388 L
.LC_E_Circumflex
& -- LC_E_Circumflex 234
389 L
.LC_E_Diaeresis
& -- LC_E_Diaeresis 235
390 L
.LC_I_Grave
& -- LC_I_Grave 236
391 L
.LC_I_Acute
& -- LC_I_Acute 237
392 L
.LC_I_Circumflex
& -- LC_I_Circumflex 238
393 L
.LC_I_Diaeresis
& -- LC_I_Diaeresis 239
394 L
.LC_Icelandic_Eth
& -- LC_Icelandic_Eth 240
395 L
.LC_N_Tilde
& -- LC_N_Tilde 241
396 L
.LC_O_Grave
& -- LC_O_Grave 242
397 L
.LC_O_Acute
& -- LC_O_Acute 243
398 L
.LC_O_Circumflex
& -- LC_O_Circumflex 244
399 L
.LC_O_Tilde
& -- LC_O_Tilde 245
400 L
.LC_O_Diaeresis
& -- LC_O_Diaeresis 246
401 L
.Division_Sign
& -- Division_Sign 247
402 L
.LC_O_Oblique_Stroke
& -- LC_O_Oblique_Stroke 248
403 L
.LC_U_Grave
& -- LC_U_Grave 249
404 L
.LC_U_Acute
& -- LC_U_Acute 250
405 L
.LC_U_Circumflex
& -- LC_U_Circumflex 251
406 L
.LC_U_Diaeresis
& -- LC_U_Diaeresis 252
407 L
.LC_Y_Acute
& -- LC_Y_Acute 253
408 L
.LC_Icelandic_Thorn
& -- LC_Icelandic_Thorn 254
409 L
.LC_Y_Diaeresis
); -- LC_Y_Diaeresis 255
411 end Ada
.Strings
.Maps
;