cpu/intel: Add socket types
[coreboot2.git] / src / lib / gnat / i-c.ads
blob7e90a60e659f4f15470e951e3b3c24ceb6107f7c
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- I N T E R F A C E S . C --
6 -- --
7 -- S p e c --
8 -- --
9 -- This specification is derived from the Ada Reference Manual for use with --
10 -- GNAT. In accordance with the copyright of that document, you can freely --
11 -- copy and modify this specification, provided that if you redistribute a --
12 -- modified version, any changes that you have made are clearly indicated. --
13 -- --
14 ------------------------------------------------------------------------------
16 with System.Parameters;
18 package Interfaces.C is
19 pragma Pure;
21 -- Declaration's based on C's <limits.h>
23 CHAR_BIT : constant := 8;
24 SCHAR_MIN : constant := -128;
25 SCHAR_MAX : constant := 127;
26 UCHAR_MAX : constant := 255;
28 -- Signed and Unsigned Integers. Note that in GNAT, we have ensured that
29 -- the standard predefined Ada types correspond to the standard C types
31 -- Note: the Integer qualifications used in the declaration of type long
32 -- avoid ambiguities when compiling in the presence of s-auxdec.ads and
33 -- a non-private system.address type.
35 type int is new Integer;
36 type short is new Short_Integer;
37 type long is range -(2 ** (System.Parameters.long_bits - Integer'(1)))
38 .. +(2 ** (System.Parameters.long_bits - Integer'(1))) - 1;
40 type signed_char is range SCHAR_MIN .. SCHAR_MAX;
41 for signed_char'Size use CHAR_BIT;
43 type unsigned is mod 2 ** int'Size;
44 type unsigned_short is mod 2 ** short'Size;
45 type unsigned_long is mod 2 ** long'Size;
47 type unsigned_char is mod (UCHAR_MAX + 1);
48 for unsigned_char'Size use CHAR_BIT;
50 subtype plain_char is unsigned_char; -- ??? should be parameterized
52 -- Note: the Integer qualifications used in the declaration of ptrdiff_t
53 -- avoid ambiguities when compiling in the presence of s-auxdec.ads and
54 -- a non-private system.address type.
56 type ptrdiff_t is
57 range -(2 ** (System.Parameters.ptr_bits - Integer'(1))) ..
58 +(2 ** (System.Parameters.ptr_bits - Integer'(1)) - 1);
60 type size_t is mod 2 ** System.Parameters.ptr_bits;
62 -- For convenience, also provide an uintptr_t type
63 type uintptr_t is mod 2 ** System.Parameters.ptr_bits;
65 ----------------------------
66 -- Characters and Strings --
67 ----------------------------
69 type char is new Character;
71 nul : constant char := char'First;
73 function To_C (Item : Character) return char;
74 function To_Ada (Item : char) return Character;
76 type char_array is array (size_t range <>) of aliased char;
77 for char_array'Component_Size use CHAR_BIT;
79 function Is_Nul_Terminated (Item : char_array) return Boolean;
81 end Interfaces.C;