gcc/
[official-gcc.git] / gcc / ada / a-strmap.ads
blobe2a9c1d594a58380aa279159879a2cd4cdbf8c8e
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- A D A . S T R I N G S . M A P S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2006, Free Software Foundation, Inc. --
10 -- --
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. --
14 -- --
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, 51 Franklin Street, Fifth Floor, --
24 -- Boston, MA 02110-1301, USA. --
25 -- --
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. --
32 -- --
33 -- GNAT was originally developed by the GNAT team at New York University. --
34 -- Extensive contributions were provided by Ada Core Technologies Inc. --
35 -- --
36 ------------------------------------------------------------------------------
38 with Ada.Characters.Latin_1;
40 package Ada.Strings.Maps is
41 pragma Preelaborate;
42 pragma Pure_05;
43 -- In accordance with Ada 2005 AI-362
45 --------------------------------
46 -- Character Set Declarations --
47 --------------------------------
49 type Character_Set is private;
50 pragma Preelaborable_Initialization (Character_Set);
51 -- Representation for a set of character values:
53 Null_Set : constant Character_Set;
55 ---------------------------
56 -- Constructors for Sets --
57 ---------------------------
59 type Character_Range is record
60 Low : Character;
61 High : Character;
62 end record;
63 -- Represents Character range Low .. High
65 type Character_Ranges is array (Positive range <>) of Character_Range;
67 function To_Set (Ranges : Character_Ranges) return Character_Set;
69 function To_Set (Span : Character_Range) return Character_Set;
71 function To_Ranges (Set : Character_Set) return Character_Ranges;
73 ----------------------------------
74 -- Operations on Character Sets --
75 ----------------------------------
77 function "=" (Left, Right : Character_Set) return Boolean;
79 function "not" (Right : Character_Set) return Character_Set;
80 function "and" (Left, Right : Character_Set) return Character_Set;
81 function "or" (Left, Right : Character_Set) return Character_Set;
82 function "xor" (Left, Right : Character_Set) return Character_Set;
83 function "-" (Left, Right : Character_Set) return Character_Set;
85 function Is_In
86 (Element : Character;
87 Set : Character_Set) return Boolean;
89 function Is_Subset
90 (Elements : Character_Set;
91 Set : Character_Set) return Boolean;
93 function "<="
94 (Left : Character_Set;
95 Right : Character_Set) return Boolean
96 renames Is_Subset;
98 subtype Character_Sequence is String;
99 -- Alternative representation for a set of character values
101 function To_Set (Sequence : Character_Sequence) return Character_Set;
102 function To_Set (Singleton : Character) return Character_Set;
104 function To_Sequence (Set : Character_Set) return Character_Sequence;
106 ------------------------------------
107 -- Character Mapping Declarations --
108 ------------------------------------
110 type Character_Mapping is private;
111 pragma Preelaborable_Initialization (Character_Mapping);
112 -- Representation for a character to character mapping:
114 function Value
115 (Map : Character_Mapping;
116 Element : Character) return Character;
118 Identity : constant Character_Mapping;
120 ----------------------------
121 -- Operations on Mappings --
122 ----------------------------
124 function To_Mapping
125 (From, To : Character_Sequence) return Character_Mapping;
127 function To_Domain
128 (Map : Character_Mapping) return Character_Sequence;
130 function To_Range
131 (Map : Character_Mapping) return Character_Sequence;
133 type Character_Mapping_Function is
134 access function (From : Character) return Character;
136 private
137 pragma Inline (Is_In);
138 pragma Inline (Value);
140 type Character_Set_Internal is array (Character) of Boolean;
141 pragma Pack (Character_Set_Internal);
143 type Character_Set is new Character_Set_Internal;
144 -- Note: the reason for this level of derivation is to make sure
145 -- that the predefined logical operations on this type remain
146 -- accessible. The operations on Character_Set are overridden by
147 -- the defined operations in the spec, but the operations defined
148 -- on Character_Set_Internal remain visible.
150 Null_Set : constant Character_Set := (others => False);
152 type Character_Mapping is array (Character) of Character;
154 package L renames Ada.Characters.Latin_1;
156 Identity : constant Character_Mapping :=
157 (L.NUL & -- NUL 0
158 L.SOH & -- SOH 1
159 L.STX & -- STX 2
160 L.ETX & -- ETX 3
161 L.EOT & -- EOT 4
162 L.ENQ & -- ENQ 5
163 L.ACK & -- ACK 6
164 L.BEL & -- BEL 7
165 L.BS & -- BS 8
166 L.HT & -- HT 9
167 L.LF & -- LF 10
168 L.VT & -- VT 11
169 L.FF & -- FF 12
170 L.CR & -- CR 13
171 L.SO & -- SO 14
172 L.SI & -- SI 15
173 L.DLE & -- DLE 16
174 L.DC1 & -- DC1 17
175 L.DC2 & -- DC2 18
176 L.DC3 & -- DC3 19
177 L.DC4 & -- DC4 20
178 L.NAK & -- NAK 21
179 L.SYN & -- SYN 22
180 L.ETB & -- ETB 23
181 L.CAN & -- CAN 24
182 L.EM & -- EM 25
183 L.SUB & -- SUB 26
184 L.ESC & -- ESC 27
185 L.FS & -- FS 28
186 L.GS & -- GS 29
187 L.RS & -- RS 30
188 L.US & -- US 31
189 L.Space & -- ' ' 32
190 L.Exclamation & -- '!' 33
191 L.Quotation & -- '"' 34
192 L.Number_Sign & -- '#' 35
193 L.Dollar_Sign & -- '$' 36
194 L.Percent_Sign & -- '%' 37
195 L.Ampersand & -- '&' 38
196 L.Apostrophe & -- ''' 39
197 L.Left_Parenthesis & -- '(' 40
198 L.Right_Parenthesis & -- ')' 41
199 L.Asterisk & -- '*' 42
200 L.Plus_Sign & -- '+' 43
201 L.Comma & -- ',' 44
202 L.Hyphen & -- '-' 45
203 L.Full_Stop & -- '.' 46
204 L.Solidus & -- '/' 47
205 '0' & -- '0' 48
206 '1' & -- '1' 49
207 '2' & -- '2' 50
208 '3' & -- '3' 51
209 '4' & -- '4' 52
210 '5' & -- '5' 53
211 '6' & -- '6' 54
212 '7' & -- '7' 55
213 '8' & -- '8' 56
214 '9' & -- '9' 57
215 L.Colon & -- ':' 58
216 L.Semicolon & -- ';' 59
217 L.Less_Than_Sign & -- '<' 60
218 L.Equals_Sign & -- '=' 61
219 L.Greater_Than_Sign & -- '>' 62
220 L.Question & -- '?' 63
221 L.Commercial_At & -- '@' 64
222 'A' & -- 'A' 65
223 'B' & -- 'B' 66
224 'C' & -- 'C' 67
225 'D' & -- 'D' 68
226 'E' & -- 'E' 69
227 'F' & -- 'F' 70
228 'G' & -- 'G' 71
229 'H' & -- 'H' 72
230 'I' & -- 'I' 73
231 'J' & -- 'J' 74
232 'K' & -- 'K' 75
233 'L' & -- 'L' 76
234 'M' & -- 'M' 77
235 'N' & -- 'N' 78
236 'O' & -- 'O' 79
237 'P' & -- 'P' 80
238 'Q' & -- 'Q' 81
239 'R' & -- 'R' 82
240 'S' & -- 'S' 83
241 'T' & -- 'T' 84
242 'U' & -- 'U' 85
243 'V' & -- 'V' 86
244 'W' & -- 'W' 87
245 'X' & -- 'X' 88
246 'Y' & -- 'Y' 89
247 'Z' & -- 'Z' 90
248 L.Left_Square_Bracket & -- '[' 91
249 L.Reverse_Solidus & -- '\' 92
250 L.Right_Square_Bracket & -- ']' 93
251 L.Circumflex & -- '^' 94
252 L.Low_Line & -- '_' 95
253 L.Grave & -- '`' 96
254 L.LC_A & -- 'a' 97
255 L.LC_B & -- 'b' 98
256 L.LC_C & -- 'c' 99
257 L.LC_D & -- 'd' 100
258 L.LC_E & -- 'e' 101
259 L.LC_F & -- 'f' 102
260 L.LC_G & -- 'g' 103
261 L.LC_H & -- 'h' 104
262 L.LC_I & -- 'i' 105
263 L.LC_J & -- 'j' 106
264 L.LC_K & -- 'k' 107
265 L.LC_L & -- 'l' 108
266 L.LC_M & -- 'm' 109
267 L.LC_N & -- 'n' 110
268 L.LC_O & -- 'o' 111
269 L.LC_P & -- 'p' 112
270 L.LC_Q & -- 'q' 113
271 L.LC_R & -- 'r' 114
272 L.LC_S & -- 's' 115
273 L.LC_T & -- 't' 116
274 L.LC_U & -- 'u' 117
275 L.LC_V & -- 'v' 118
276 L.LC_W & -- 'w' 119
277 L.LC_X & -- 'x' 120
278 L.LC_Y & -- 'y' 121
279 L.LC_Z & -- 'z' 122
280 L.Left_Curly_Bracket & -- '{' 123
281 L.Vertical_Line & -- '|' 124
282 L.Right_Curly_Bracket & -- '}' 125
283 L.Tilde & -- '~' 126
284 L.DEL & -- DEL 127
285 L.Reserved_128 & -- Reserved_128 128
286 L.Reserved_129 & -- Reserved_129 129
287 L.BPH & -- BPH 130
288 L.NBH & -- NBH 131
289 L.Reserved_132 & -- Reserved_132 132
290 L.NEL & -- NEL 133
291 L.SSA & -- SSA 134
292 L.ESA & -- ESA 135
293 L.HTS & -- HTS 136
294 L.HTJ & -- HTJ 137
295 L.VTS & -- VTS 138
296 L.PLD & -- PLD 139
297 L.PLU & -- PLU 140
298 L.RI & -- RI 141
299 L.SS2 & -- SS2 142
300 L.SS3 & -- SS3 143
301 L.DCS & -- DCS 144
302 L.PU1 & -- PU1 145
303 L.PU2 & -- PU2 146
304 L.STS & -- STS 147
305 L.CCH & -- CCH 148
306 L.MW & -- MW 149
307 L.SPA & -- SPA 150
308 L.EPA & -- EPA 151
309 L.SOS & -- SOS 152
310 L.Reserved_153 & -- Reserved_153 153
311 L.SCI & -- SCI 154
312 L.CSI & -- CSI 155
313 L.ST & -- ST 156
314 L.OSC & -- OSC 157
315 L.PM & -- PM 158
316 L.APC & -- APC 159
317 L.No_Break_Space & -- No_Break_Space 160
318 L.Inverted_Exclamation & -- Inverted_Exclamation 161
319 L.Cent_Sign & -- Cent_Sign 162
320 L.Pound_Sign & -- Pound_Sign 163
321 L.Currency_Sign & -- Currency_Sign 164
322 L.Yen_Sign & -- Yen_Sign 165
323 L.Broken_Bar & -- Broken_Bar 166
324 L.Section_Sign & -- Section_Sign 167
325 L.Diaeresis & -- Diaeresis 168
326 L.Copyright_Sign & -- Copyright_Sign 169
327 L.Feminine_Ordinal_Indicator & -- Feminine_Ordinal_Indicator 170
328 L.Left_Angle_Quotation & -- Left_Angle_Quotation 171
329 L.Not_Sign & -- Not_Sign 172
330 L.Soft_Hyphen & -- Soft_Hyphen 173
331 L.Registered_Trade_Mark_Sign & -- Registered_Trade_Mark_Sign 174
332 L.Macron & -- Macron 175
333 L.Degree_Sign & -- Degree_Sign 176
334 L.Plus_Minus_Sign & -- Plus_Minus_Sign 177
335 L.Superscript_Two & -- Superscript_Two 178
336 L.Superscript_Three & -- Superscript_Three 179
337 L.Acute & -- Acute 180
338 L.Micro_Sign & -- Micro_Sign 181
339 L.Pilcrow_Sign & -- Pilcrow_Sign 182
340 L.Middle_Dot & -- Middle_Dot 183
341 L.Cedilla & -- Cedilla 184
342 L.Superscript_One & -- Superscript_One 185
343 L.Masculine_Ordinal_Indicator & -- Masculine_Ordinal_Indicator 186
344 L.Right_Angle_Quotation & -- Right_Angle_Quotation 187
345 L.Fraction_One_Quarter & -- Fraction_One_Quarter 188
346 L.Fraction_One_Half & -- Fraction_One_Half 189
347 L.Fraction_Three_Quarters & -- Fraction_Three_Quarters 190
348 L.Inverted_Question & -- Inverted_Question 191
349 L.UC_A_Grave & -- UC_A_Grave 192
350 L.UC_A_Acute & -- UC_A_Acute 193
351 L.UC_A_Circumflex & -- UC_A_Circumflex 194
352 L.UC_A_Tilde & -- UC_A_Tilde 195
353 L.UC_A_Diaeresis & -- UC_A_Diaeresis 196
354 L.UC_A_Ring & -- UC_A_Ring 197
355 L.UC_AE_Diphthong & -- UC_AE_Diphthong 198
356 L.UC_C_Cedilla & -- UC_C_Cedilla 199
357 L.UC_E_Grave & -- UC_E_Grave 200
358 L.UC_E_Acute & -- UC_E_Acute 201
359 L.UC_E_Circumflex & -- UC_E_Circumflex 202
360 L.UC_E_Diaeresis & -- UC_E_Diaeresis 203
361 L.UC_I_Grave & -- UC_I_Grave 204
362 L.UC_I_Acute & -- UC_I_Acute 205
363 L.UC_I_Circumflex & -- UC_I_Circumflex 206
364 L.UC_I_Diaeresis & -- UC_I_Diaeresis 207
365 L.UC_Icelandic_Eth & -- UC_Icelandic_Eth 208
366 L.UC_N_Tilde & -- UC_N_Tilde 209
367 L.UC_O_Grave & -- UC_O_Grave 210
368 L.UC_O_Acute & -- UC_O_Acute 211
369 L.UC_O_Circumflex & -- UC_O_Circumflex 212
370 L.UC_O_Tilde & -- UC_O_Tilde 213
371 L.UC_O_Diaeresis & -- UC_O_Diaeresis 214
372 L.Multiplication_Sign & -- Multiplication_Sign 215
373 L.UC_O_Oblique_Stroke & -- UC_O_Oblique_Stroke 216
374 L.UC_U_Grave & -- UC_U_Grave 217
375 L.UC_U_Acute & -- UC_U_Acute 218
376 L.UC_U_Circumflex & -- UC_U_Circumflex 219
377 L.UC_U_Diaeresis & -- UC_U_Diaeresis 220
378 L.UC_Y_Acute & -- UC_Y_Acute 221
379 L.UC_Icelandic_Thorn & -- UC_Icelandic_Thorn 222
380 L.LC_German_Sharp_S & -- LC_German_Sharp_S 223
381 L.LC_A_Grave & -- LC_A_Grave 224
382 L.LC_A_Acute & -- LC_A_Acute 225
383 L.LC_A_Circumflex & -- LC_A_Circumflex 226
384 L.LC_A_Tilde & -- LC_A_Tilde 227
385 L.LC_A_Diaeresis & -- LC_A_Diaeresis 228
386 L.LC_A_Ring & -- LC_A_Ring 229
387 L.LC_AE_Diphthong & -- LC_AE_Diphthong 230
388 L.LC_C_Cedilla & -- LC_C_Cedilla 231
389 L.LC_E_Grave & -- LC_E_Grave 232
390 L.LC_E_Acute & -- LC_E_Acute 233
391 L.LC_E_Circumflex & -- LC_E_Circumflex 234
392 L.LC_E_Diaeresis & -- LC_E_Diaeresis 235
393 L.LC_I_Grave & -- LC_I_Grave 236
394 L.LC_I_Acute & -- LC_I_Acute 237
395 L.LC_I_Circumflex & -- LC_I_Circumflex 238
396 L.LC_I_Diaeresis & -- LC_I_Diaeresis 239
397 L.LC_Icelandic_Eth & -- LC_Icelandic_Eth 240
398 L.LC_N_Tilde & -- LC_N_Tilde 241
399 L.LC_O_Grave & -- LC_O_Grave 242
400 L.LC_O_Acute & -- LC_O_Acute 243
401 L.LC_O_Circumflex & -- LC_O_Circumflex 244
402 L.LC_O_Tilde & -- LC_O_Tilde 245
403 L.LC_O_Diaeresis & -- LC_O_Diaeresis 246
404 L.Division_Sign & -- Division_Sign 247
405 L.LC_O_Oblique_Stroke & -- LC_O_Oblique_Stroke 248
406 L.LC_U_Grave & -- LC_U_Grave 249
407 L.LC_U_Acute & -- LC_U_Acute 250
408 L.LC_U_Circumflex & -- LC_U_Circumflex 251
409 L.LC_U_Diaeresis & -- LC_U_Diaeresis 252
410 L.LC_Y_Acute & -- LC_Y_Acute 253
411 L.LC_Icelandic_Thorn & -- LC_Icelandic_Thorn 254
412 L.LC_Y_Diaeresis); -- LC_Y_Diaeresis 255
414 end Ada.Strings.Maps;