1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- I N T E R F A C E S . C . E X T E N S I O N S --
9 -- Copyright (C) 1992-2018, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
32 -- This package contains additional C-related definitions, intended for use
33 -- with either manually or automatically generated bindings to C libraries.
37 package Interfaces.C.Extensions is
40 -- Definitions for C "void" and "void *" types
42 subtype void is System.Address;
43 subtype void_ptr is System.Address;
45 -- Definitions for C incomplete/unknown structs
47 subtype opaque_structure_def is System.Address;
48 type opaque_structure_def_ptr is access opaque_structure_def;
49 for opaque_structure_def_ptr'Storage_Size use 0;
51 -- Definitions for C++ incomplete/unknown classes
53 subtype incomplete_class_def is System.Address;
54 type incomplete_class_def_ptr is access incomplete_class_def;
55 for incomplete_class_def_ptr'Storage_Size use 0;
59 subtype bool is plain_char;
61 -- 64-bit integer types
63 subtype long_long is Long_Long_Integer;
64 type unsigned_long_long is mod 2 ** 64;
66 -- 128-bit integer type available on 64-bit platforms:
67 -- typedef int signed_128 __attribute__ ((mode (TI)));
69 type Signed_128 is record
70 low, high : unsigned_long_long;
72 pragma Convention (C_Pass_By_Copy, Signed_128);
73 for Signed_128'Alignment use unsigned_long_long'Alignment * 2;
75 -- 128-bit floating-point type available on x86:
76 -- typedef long_double float_128 __attribute__ ((mode (TF)));
78 type Float_128 is record
79 low, high : unsigned_long_long;
81 pragma Convention (C_Pass_By_Copy, Float_128);
82 for Float_128'Alignment use unsigned_long_long'Alignment * 2;
84 -- Types for bitfields
86 type Unsigned_1 is mod 2 ** 1;
87 for Unsigned_1'Size use 1;
89 type Unsigned_2 is mod 2 ** 2;
90 for Unsigned_2'Size use 2;
92 type Unsigned_3 is mod 2 ** 3;
93 for Unsigned_3'Size use 3;
95 type Unsigned_4 is mod 2 ** 4;
96 for Unsigned_4'Size use 4;
98 type Unsigned_5 is mod 2 ** 5;
99 for Unsigned_5'Size use 5;
101 type Unsigned_6 is mod 2 ** 6;
102 for Unsigned_6'Size use 6;
104 type Unsigned_7 is mod 2 ** 7;
105 for Unsigned_7'Size use 7;
107 type Unsigned_8 is mod 2 ** 8;
108 for Unsigned_8'Size use 8;
110 type Unsigned_9 is mod 2 ** 9;
111 for Unsigned_9'Size use 9;
113 type Unsigned_10 is mod 2 ** 10;
114 for Unsigned_10'Size use 10;
116 type Unsigned_11 is mod 2 ** 11;
117 for Unsigned_11'Size use 11;
119 type Unsigned_12 is mod 2 ** 12;
120 for Unsigned_12'Size use 12;
122 type Unsigned_13 is mod 2 ** 13;
123 for Unsigned_13'Size use 13;
125 type Unsigned_14 is mod 2 ** 14;
126 for Unsigned_14'Size use 14;
128 type Unsigned_15 is mod 2 ** 15;
129 for Unsigned_15'Size use 15;
131 type Unsigned_16 is mod 2 ** 16;
132 for Unsigned_16'Size use 16;
134 type Unsigned_17 is mod 2 ** 17;
135 for Unsigned_17'Size use 17;
137 type Unsigned_18 is mod 2 ** 18;
138 for Unsigned_18'Size use 18;
140 type Unsigned_19 is mod 2 ** 19;
141 for Unsigned_19'Size use 19;
143 type Unsigned_20 is mod 2 ** 20;
144 for Unsigned_20'Size use 20;
146 type Unsigned_21 is mod 2 ** 21;
147 for Unsigned_21'Size use 21;
149 type Unsigned_22 is mod 2 ** 22;
150 for Unsigned_22'Size use 22;
152 type Unsigned_23 is mod 2 ** 23;
153 for Unsigned_23'Size use 23;
155 type Unsigned_24 is mod 2 ** 24;
156 for Unsigned_24'Size use 24;
158 type Unsigned_25 is mod 2 ** 25;
159 for Unsigned_25'Size use 25;
161 type Unsigned_26 is mod 2 ** 26;
162 for Unsigned_26'Size use 26;
164 type Unsigned_27 is mod 2 ** 27;
165 for Unsigned_27'Size use 27;
167 type Unsigned_28 is mod 2 ** 28;
168 for Unsigned_28'Size use 28;
170 type Unsigned_29 is mod 2 ** 29;
171 for Unsigned_29'Size use 29;
173 type Unsigned_30 is mod 2 ** 30;
174 for Unsigned_30'Size use 30;
176 type Unsigned_31 is mod 2 ** 31;
177 for Unsigned_31'Size use 31;
179 type Unsigned_32 is mod 2 ** 32;
180 for Unsigned_32'Size use 32;
182 type Unsigned_33 is mod 2 ** 33;
183 for Unsigned_33'Size use 33;
185 type Unsigned_34 is mod 2 ** 34;
186 for Unsigned_34'Size use 34;
188 type Unsigned_35 is mod 2 ** 35;
189 for Unsigned_35'Size use 35;
191 type Unsigned_36 is mod 2 ** 36;
192 for Unsigned_36'Size use 36;
194 type Unsigned_37 is mod 2 ** 37;
195 for Unsigned_37'Size use 37;
197 type Unsigned_38 is mod 2 ** 38;
198 for Unsigned_38'Size use 38;
200 type Unsigned_39 is mod 2 ** 39;
201 for Unsigned_39'Size use 39;
203 type Unsigned_40 is mod 2 ** 40;
204 for Unsigned_40'Size use 40;
206 type Unsigned_41 is mod 2 ** 41;
207 for Unsigned_41'Size use 41;
209 type Unsigned_42 is mod 2 ** 42;
210 for Unsigned_42'Size use 42;
212 type Unsigned_43 is mod 2 ** 43;
213 for Unsigned_43'Size use 43;
215 type Unsigned_44 is mod 2 ** 44;
216 for Unsigned_44'Size use 44;
218 type Unsigned_45 is mod 2 ** 45;
219 for Unsigned_45'Size use 45;
221 type Unsigned_46 is mod 2 ** 46;
222 for Unsigned_46'Size use 46;
224 type Unsigned_47 is mod 2 ** 47;
225 for Unsigned_47'Size use 47;
227 type Unsigned_48 is mod 2 ** 48;
228 for Unsigned_48'Size use 48;
230 type Unsigned_49 is mod 2 ** 49;
231 for Unsigned_49'Size use 49;
233 type Unsigned_50 is mod 2 ** 50;
234 for Unsigned_50'Size use 50;
236 type Unsigned_51 is mod 2 ** 51;
237 for Unsigned_51'Size use 51;
239 type Unsigned_52 is mod 2 ** 52;
240 for Unsigned_52'Size use 52;
242 type Unsigned_53 is mod 2 ** 53;
243 for Unsigned_53'Size use 53;
245 type Unsigned_54 is mod 2 ** 54;
246 for Unsigned_54'Size use 54;
248 type Unsigned_55 is mod 2 ** 55;
249 for Unsigned_55'Size use 55;
251 type Unsigned_56 is mod 2 ** 56;
252 for Unsigned_56'Size use 56;
254 type Unsigned_57 is mod 2 ** 57;
255 for Unsigned_57'Size use 57;
257 type Unsigned_58 is mod 2 ** 58;
258 for Unsigned_58'Size use 58;
260 type Unsigned_59 is mod 2 ** 59;
261 for Unsigned_59'Size use 59;
263 type Unsigned_60 is mod 2 ** 60;
264 for Unsigned_60'Size use 60;
266 type Unsigned_61 is mod 2 ** 61;
267 for Unsigned_61'Size use 61;
269 type Unsigned_62 is mod 2 ** 62;
270 for Unsigned_62'Size use 62;
272 type Unsigned_63 is mod 2 ** 63;
273 for Unsigned_63'Size use 63;
275 type Unsigned_64 is mod 2 ** 64;
276 for Unsigned_64'Size use 64;
278 type Signed_2 is range -2 ** 1 .. 2 ** 1 - 1;
279 for Signed_2'Size use 2;
281 type Signed_3 is range -2 ** 2 .. 2 ** 2 - 1;
282 for Signed_3'Size use 3;
284 type Signed_4 is range -2 ** 3 .. 2 ** 3 - 1;
285 for Signed_4'Size use 4;
287 type Signed_5 is range -2 ** 4 .. 2 ** 4 - 1;
288 for Signed_5'Size use 5;
290 type Signed_6 is range -2 ** 5 .. 2 ** 5 - 1;
291 for Signed_6'Size use 6;
293 type Signed_7 is range -2 ** 6 .. 2 ** 6 - 1;
294 for Signed_7'Size use 7;
296 type Signed_8 is range -2 ** 7 .. 2 ** 7 - 1;
297 for Signed_8'Size use 8;
299 type Signed_9 is range -2 ** 8 .. 2 ** 8 - 1;
300 for Signed_9'Size use 9;
302 type Signed_10 is range -2 ** 9 .. 2 ** 9 - 1;
303 for Signed_10'Size use 10;
305 type Signed_11 is range -2 ** 10 .. 2 ** 10 - 1;
306 for Signed_11'Size use 11;
308 type Signed_12 is range -2 ** 11 .. 2 ** 11 - 1;
309 for Signed_12'Size use 12;
311 type Signed_13 is range -2 ** 12 .. 2 ** 12 - 1;
312 for Signed_13'Size use 13;
314 type Signed_14 is range -2 ** 13 .. 2 ** 13 - 1;
315 for Signed_14'Size use 14;
317 type Signed_15 is range -2 ** 14 .. 2 ** 14 - 1;
318 for Signed_15'Size use 15;
320 type Signed_16 is range -2 ** 15 .. 2 ** 15 - 1;
321 for Signed_16'Size use 16;
323 type Signed_17 is range -2 ** 16 .. 2 ** 16 - 1;
324 for Signed_17'Size use 17;
326 type Signed_18 is range -2 ** 17 .. 2 ** 17 - 1;
327 for Signed_18'Size use 18;
329 type Signed_19 is range -2 ** 18 .. 2 ** 18 - 1;
330 for Signed_19'Size use 19;
332 type Signed_20 is range -2 ** 19 .. 2 ** 19 - 1;
333 for Signed_20'Size use 20;
335 type Signed_21 is range -2 ** 20 .. 2 ** 20 - 1;
336 for Signed_21'Size use 21;
338 type Signed_22 is range -2 ** 21 .. 2 ** 21 - 1;
339 for Signed_22'Size use 22;
341 type Signed_23 is range -2 ** 22 .. 2 ** 22 - 1;
342 for Signed_23'Size use 23;
344 type Signed_24 is range -2 ** 23 .. 2 ** 23 - 1;
345 for Signed_24'Size use 24;
347 type Signed_25 is range -2 ** 24 .. 2 ** 24 - 1;
348 for Signed_25'Size use 25;
350 type Signed_26 is range -2 ** 25 .. 2 ** 25 - 1;
351 for Signed_26'Size use 26;
353 type Signed_27 is range -2 ** 26 .. 2 ** 26 - 1;
354 for Signed_27'Size use 27;
356 type Signed_28 is range -2 ** 27 .. 2 ** 27 - 1;
357 for Signed_28'Size use 28;
359 type Signed_29 is range -2 ** 28 .. 2 ** 28 - 1;
360 for Signed_29'Size use 29;
362 type Signed_30 is range -2 ** 29 .. 2 ** 29 - 1;
363 for Signed_30'Size use 30;
365 type Signed_31 is range -2 ** 30 .. 2 ** 30 - 1;
366 for Signed_31'Size use 31;
368 type Signed_32 is range -2 ** 31 .. 2 ** 31 - 1;
369 for Signed_32'Size use 32;
371 type Signed_33 is range -2 ** 32 .. 2 ** 32 - 1;
372 for Signed_33'Size use 33;
374 type Signed_34 is range -2 ** 33 .. 2 ** 33 - 1;
375 for Signed_34'Size use 34;
377 type Signed_35 is range -2 ** 34 .. 2 ** 34 - 1;
378 for Signed_35'Size use 35;
380 type Signed_36 is range -2 ** 35 .. 2 ** 35 - 1;
381 for Signed_36'Size use 36;
383 type Signed_37 is range -2 ** 36 .. 2 ** 36 - 1;
384 for Signed_37'Size use 37;
386 type Signed_38 is range -2 ** 37 .. 2 ** 37 - 1;
387 for Signed_38'Size use 38;
389 type Signed_39 is range -2 ** 38 .. 2 ** 38 - 1;
390 for Signed_39'Size use 39;
392 type Signed_40 is range -2 ** 39 .. 2 ** 39 - 1;
393 for Signed_40'Size use 40;
395 type Signed_41 is range -2 ** 40 .. 2 ** 40 - 1;
396 for Signed_41'Size use 41;
398 type Signed_42 is range -2 ** 41 .. 2 ** 41 - 1;
399 for Signed_42'Size use 42;
401 type Signed_43 is range -2 ** 42 .. 2 ** 42 - 1;
402 for Signed_43'Size use 43;
404 type Signed_44 is range -2 ** 43 .. 2 ** 43 - 1;
405 for Signed_44'Size use 44;
407 type Signed_45 is range -2 ** 44 .. 2 ** 44 - 1;
408 for Signed_45'Size use 45;
410 type Signed_46 is range -2 ** 45 .. 2 ** 45 - 1;
411 for Signed_46'Size use 46;
413 type Signed_47 is range -2 ** 46 .. 2 ** 46 - 1;
414 for Signed_47'Size use 47;
416 type Signed_48 is range -2 ** 47 .. 2 ** 47 - 1;
417 for Signed_48'Size use 48;
419 type Signed_49 is range -2 ** 48 .. 2 ** 48 - 1;
420 for Signed_49'Size use 49;
422 type Signed_50 is range -2 ** 49 .. 2 ** 49 - 1;
423 for Signed_50'Size use 50;
425 type Signed_51 is range -2 ** 50 .. 2 ** 50 - 1;
426 for Signed_51'Size use 51;
428 type Signed_52 is range -2 ** 51 .. 2 ** 51 - 1;
429 for Signed_52'Size use 52;
431 type Signed_53 is range -2 ** 52 .. 2 ** 52 - 1;
432 for Signed_53'Size use 53;
434 type Signed_54 is range -2 ** 53 .. 2 ** 53 - 1;
435 for Signed_54'Size use 54;
437 type Signed_55 is range -2 ** 54 .. 2 ** 54 - 1;
438 for Signed_55'Size use 55;
440 type Signed_56 is range -2 ** 55 .. 2 ** 55 - 1;
441 for Signed_56'Size use 56;
443 type Signed_57 is range -2 ** 56 .. 2 ** 56 - 1;
444 for Signed_57'Size use 57;
446 type Signed_58 is range -2 ** 57 .. 2 ** 57 - 1;
447 for Signed_58'Size use 58;
449 type Signed_59 is range -2 ** 58 .. 2 ** 58 - 1;
450 for Signed_59'Size use 59;
452 type Signed_60 is range -2 ** 59 .. 2 ** 59 - 1;
453 for Signed_60'Size use 60;
455 type Signed_61 is range -2 ** 60 .. 2 ** 60 - 1;
456 for Signed_61'Size use 61;
458 type Signed_62 is range -2 ** 61 .. 2 ** 61 - 1;
459 for Signed_62'Size use 62;
461 type Signed_63 is range -2 ** 62 .. 2 ** 62 - 1;
462 for Signed_63'Size use 63;
464 type Signed_64 is range -2 ** 63 .. 2 ** 63 - 1;
465 for Signed_64'Size use 64;
467 end Interfaces.C.Extensions;