1 -----------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- I N T E R F A C E S . C --
10 -- This specification is adapted from the Ada Reference Manual for use with --
11 -- GNAT Hi Integrity Edition. In accordance with the copyright of that --
12 -- document, you can freely copy and modify this specification, provided --
13 -- that if you redistribute a modified version, any changes that you have --
14 -- made are clearly indicated. --
16 ------------------------------------------------------------------------------
18 -- This version contains only the type definitions for standard interfacing
19 -- with C. All functions have been removed from the original spec.
21 package Interfaces
.C
is
24 -- Declaration's based on C's <limits.h>
26 CHAR_BIT
: constant := 8;
27 SCHAR_MIN
: constant := -128;
28 SCHAR_MAX
: constant := 127;
29 UCHAR_MAX
: constant := 255;
31 -- Signed and Unsigned Integers. Note that in GNAT, we have ensured that
32 -- the standard predefined Ada types correspond to the standard C types
34 type int
is new Integer;
35 type short
is new Short_Integer;
36 type long
is new Long_Integer;
38 type signed_char
is range SCHAR_MIN
.. SCHAR_MAX
;
39 for signed_char
'Size use CHAR_BIT
;
41 type unsigned
is mod 2 ** int
'Size;
42 type unsigned_short
is mod 2 ** short
'Size;
43 type unsigned_long
is mod 2 ** long
'Size;
45 type unsigned_char
is mod (UCHAR_MAX
+ 1);
46 for unsigned_char
'Size use CHAR_BIT
;
48 subtype plain_char
is unsigned_char
;
51 range -(2 ** (Standard
'Address_Size - 1)) ..
52 +(2 ** (Standard
'Address_Size - 1) - 1);
54 type size_t
is mod 2 ** Standard
'Address_Size;
58 type C_float
is new Float;
59 type double
is new Standard
.Long_Float;
60 type long_double
is new Standard
.Long_Long_Float;
62 ----------------------------
63 -- Characters and Strings --
64 ----------------------------
66 type char
is new Character;
68 nul
: constant char
:= char
'First;
70 type char_array
is array (size_t
range <>) of aliased char
;
71 for char_array
'Component_Size use CHAR_BIT
;
73 ------------------------------------
74 -- Wide Character and Wide String --
75 ------------------------------------
77 type wchar_t
is new Wide_Character;
78 for wchar_t
'Size use Standard
'Wchar_T_Size;
80 wide_nul
: constant wchar_t
:= wchar_t
'First;
82 type wchar_array
is array (size_t
range <>) of aliased wchar_t
;