1 -----------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- I N T E R F A C E S . C --
9 -- This specification is adapted from the Ada Reference Manual for use with --
10 -- GNAT Hi Integrity Edition. In accordance with the copyright of that --
11 -- document, you can freely copy and modify this specification, provided --
12 -- that if you redistribute a modified version, any changes that you have --
13 -- made are clearly indicated. --
15 ------------------------------------------------------------------------------
17 -- This version contains only the type definitions for standard interfacing
18 -- with C. All functions have been removed from the original spec.
20 package Interfaces
.C
is
23 -- Declaration's based on C's <limits.h>
25 CHAR_BIT
: constant := 8;
26 SCHAR_MIN
: constant := -128;
27 SCHAR_MAX
: constant := 127;
28 UCHAR_MAX
: constant := 255;
30 -- Signed and Unsigned Integers. Note that in GNAT, we have ensured that
31 -- the standard predefined Ada types correspond to the standard C types
33 type int
is new Integer;
34 type short
is new Short_Integer;
35 type long
is new Long_Integer;
37 type signed_char
is range SCHAR_MIN
.. SCHAR_MAX
;
38 for signed_char
'Size use CHAR_BIT
;
40 type unsigned
is mod 2 ** int
'Size;
41 type unsigned_short
is mod 2 ** short
'Size;
42 type unsigned_long
is mod 2 ** long
'Size;
44 type unsigned_char
is mod (UCHAR_MAX
+ 1);
45 for unsigned_char
'Size use CHAR_BIT
;
47 subtype plain_char
is unsigned_char
;
50 range -(2 ** (Standard
'Address_Size - 1)) ..
51 +(2 ** (Standard
'Address_Size - 1) - 1);
53 type size_t
is mod 2 ** Standard
'Address_Size;
57 type C_float
is new Float;
58 type double
is new Standard
.Long_Float;
59 type long_double
is new Standard
.Long_Long_Float;
61 ----------------------------
62 -- Characters and Strings --
63 ----------------------------
65 type char
is new Character;
67 nul
: constant char
:= char
'First;
69 type char_array
is array (size_t
range <>) of aliased char
;
70 for char_array
'Component_Size use CHAR_BIT
;
72 ------------------------------------
73 -- Wide Character and Wide String --
74 ------------------------------------
76 type wchar_t
is new Wide_Character;
77 for wchar_t
'Size use Standard
'Wchar_T_Size;
79 wide_nul
: constant wchar_t
:= wchar_t
'First;
81 type wchar_array
is array (size_t
range <>) of aliased wchar_t
;