Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git] / gcc / ada / a-strmap.ads
blob598b23488572567af30de3978efd63be6f0c0bf1
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-2005 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, 59 Temple Place - Suite 330, Boston, --
24 -- MA 02111-1307, 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 (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
57 Low : Character;
58 High : Character;
59 end 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;
82 function Is_In
83 (Element : Character;
84 Set : Character_Set) return Boolean;
86 function Is_Subset
87 (Elements : Character_Set;
88 Set : Character_Set) return Boolean;
90 function "<="
91 (Left : Character_Set;
92 Right : Character_Set) return Boolean
93 renames Is_Subset;
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:
110 function Value
111 (Map : Character_Mapping;
112 Element : Character) return Character;
114 Identity : constant Character_Mapping;
116 ----------------------------
117 -- Operations on Mappings --
118 ----------------------------
120 function To_Mapping
121 (From, To : Character_Sequence) return Character_Mapping;
123 function To_Domain
124 (Map : Character_Mapping) return Character_Sequence;
126 function To_Range
127 (Map : Character_Mapping) return Character_Sequence;
129 type Character_Mapping_Function is
130 access function (From : Character) return Character;
132 private
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 :=
153 (L.NUL & -- NUL 0
154 L.SOH & -- SOH 1
155 L.STX & -- STX 2
156 L.ETX & -- ETX 3
157 L.EOT & -- EOT 4
158 L.ENQ & -- ENQ 5
159 L.ACK & -- ACK 6
160 L.BEL & -- BEL 7
161 L.BS & -- BS 8
162 L.HT & -- HT 9
163 L.LF & -- LF 10
164 L.VT & -- VT 11
165 L.FF & -- FF 12
166 L.CR & -- CR 13
167 L.SO & -- SO 14
168 L.SI & -- SI 15
169 L.DLE & -- DLE 16
170 L.DC1 & -- DC1 17
171 L.DC2 & -- DC2 18
172 L.DC3 & -- DC3 19
173 L.DC4 & -- DC4 20
174 L.NAK & -- NAK 21
175 L.SYN & -- SYN 22
176 L.ETB & -- ETB 23
177 L.CAN & -- CAN 24
178 L.EM & -- EM 25
179 L.SUB & -- SUB 26
180 L.ESC & -- ESC 27
181 L.FS & -- FS 28
182 L.GS & -- GS 29
183 L.RS & -- RS 30
184 L.US & -- US 31
185 L.Space & -- ' ' 32
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
197 L.Comma & -- ',' 44
198 L.Hyphen & -- '-' 45
199 L.Full_Stop & -- '.' 46
200 L.Solidus & -- '/' 47
201 '0' & -- '0' 48
202 '1' & -- '1' 49
203 '2' & -- '2' 50
204 '3' & -- '3' 51
205 '4' & -- '4' 52
206 '5' & -- '5' 53
207 '6' & -- '6' 54
208 '7' & -- '7' 55
209 '8' & -- '8' 56
210 '9' & -- '9' 57
211 L.Colon & -- ':' 58
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
218 'A' & -- 'A' 65
219 'B' & -- 'B' 66
220 'C' & -- 'C' 67
221 'D' & -- 'D' 68
222 'E' & -- 'E' 69
223 'F' & -- 'F' 70
224 'G' & -- 'G' 71
225 'H' & -- 'H' 72
226 'I' & -- 'I' 73
227 'J' & -- 'J' 74
228 'K' & -- 'K' 75
229 'L' & -- 'L' 76
230 'M' & -- 'M' 77
231 'N' & -- 'N' 78
232 'O' & -- 'O' 79
233 'P' & -- 'P' 80
234 'Q' & -- 'Q' 81
235 'R' & -- 'R' 82
236 'S' & -- 'S' 83
237 'T' & -- 'T' 84
238 'U' & -- 'U' 85
239 'V' & -- 'V' 86
240 'W' & -- 'W' 87
241 'X' & -- 'X' 88
242 'Y' & -- 'Y' 89
243 'Z' & -- 'Z' 90
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
249 L.Grave & -- '`' 96
250 L.LC_A & -- 'a' 97
251 L.LC_B & -- 'b' 98
252 L.LC_C & -- 'c' 99
253 L.LC_D & -- 'd' 100
254 L.LC_E & -- 'e' 101
255 L.LC_F & -- 'f' 102
256 L.LC_G & -- 'g' 103
257 L.LC_H & -- 'h' 104
258 L.LC_I & -- 'i' 105
259 L.LC_J & -- 'j' 106
260 L.LC_K & -- 'k' 107
261 L.LC_L & -- 'l' 108
262 L.LC_M & -- 'm' 109
263 L.LC_N & -- 'n' 110
264 L.LC_O & -- 'o' 111
265 L.LC_P & -- 'p' 112
266 L.LC_Q & -- 'q' 113
267 L.LC_R & -- 'r' 114
268 L.LC_S & -- 's' 115
269 L.LC_T & -- 't' 116
270 L.LC_U & -- 'u' 117
271 L.LC_V & -- 'v' 118
272 L.LC_W & -- 'w' 119
273 L.LC_X & -- 'x' 120
274 L.LC_Y & -- 'y' 121
275 L.LC_Z & -- 'z' 122
276 L.Left_Curly_Bracket & -- '{' 123
277 L.Vertical_Line & -- '|' 124
278 L.Right_Curly_Bracket & -- '}' 125
279 L.Tilde & -- '~' 126
280 L.DEL & -- DEL 127
281 L.Reserved_128 & -- Reserved_128 128
282 L.Reserved_129 & -- Reserved_129 129
283 L.BPH & -- BPH 130
284 L.NBH & -- NBH 131
285 L.Reserved_132 & -- Reserved_132 132
286 L.NEL & -- NEL 133
287 L.SSA & -- SSA 134
288 L.ESA & -- ESA 135
289 L.HTS & -- HTS 136
290 L.HTJ & -- HTJ 137
291 L.VTS & -- VTS 138
292 L.PLD & -- PLD 139
293 L.PLU & -- PLU 140
294 L.RI & -- RI 141
295 L.SS2 & -- SS2 142
296 L.SS3 & -- SS3 143
297 L.DCS & -- DCS 144
298 L.PU1 & -- PU1 145
299 L.PU2 & -- PU2 146
300 L.STS & -- STS 147
301 L.CCH & -- CCH 148
302 L.MW & -- MW 149
303 L.SPA & -- SPA 150
304 L.EPA & -- EPA 151
305 L.SOS & -- SOS 152
306 L.Reserved_153 & -- Reserved_153 153
307 L.SCI & -- SCI 154
308 L.CSI & -- CSI 155
309 L.ST & -- ST 156
310 L.OSC & -- OSC 157
311 L.PM & -- PM 158
312 L.APC & -- APC 159
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;