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