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