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