File : i-c-hie.ads
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 -- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
10 -- --
11 -- This specification is derived from the Ada Reference Manual for use with --
12 -- GNAT. The copyright notice above, and the license provisions that follow --
13 -- apply solely to the contents of the part following the private keyword. --
14 -- --
15 -- GNAT is free software; you can redistribute it and/or modify it under --
16 -- terms of the GNU General Public License as published by the Free Soft- --
17 -- ware Foundation; either version 3, or (at your option) any later ver- --
18 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
19 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
20 -- or FITNESS FOR A PARTICULAR PURPOSE. --
21 -- --
22 -- --
23 -- --
24 -- --
25 -- --
26 -- You should have received a copy of the GNU General Public License and --
27 -- a copy of the GCC Runtime Library Exception along with this program; --
28 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
29 -- <http://www.gnu.org/licenses/>. --
30 -- --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- Extensive contributions were provided by Ada Core Technologies Inc. --
33 -- --
34 ------------------------------------------------------------------------------
35
36 -- This version contains only the type definitions for standard interfacing
37 -- with C. All functions have been removed from the original spec.
38
39 package Interfaces.C is
40 pragma Pure;
41
42 -- Declaration's based on C's <limits.h>
43
44 CHAR_BIT : constant := 8;
45 SCHAR_MIN : constant := -128;
46 SCHAR_MAX : constant := 127;
47 UCHAR_MAX : constant := 255;
48
49 -- Signed and Unsigned Integers. Note that in GNAT, we have ensured that
50 -- the standard predefined Ada types correspond to the standard C types
51
52 type int is new Integer;
53 type short is new Short_Integer;
54 type long is new Long_Integer;
55
56 type signed_char is range SCHAR_MIN .. SCHAR_MAX;
57 for signed_char'Size use CHAR_BIT;
58
59 type unsigned is mod 2 ** int'Size;
60 type unsigned_short is mod 2 ** short'Size;
61 type unsigned_long is mod 2 ** long'Size;
62
63 type unsigned_char is mod (UCHAR_MAX + 1);
64 for unsigned_char'Size use CHAR_BIT;
65
66 subtype plain_char is unsigned_char;
67
68 type ptrdiff_t is
69 range -(2 ** (Standard'Address_Size - 1)) ..
70 +(2 ** (Standard'Address_Size - 1) - 1);
71
72 type size_t is mod 2 ** Standard'Address_Size;
73
74 -- Floating-Point
75
76 type C_float is new Float;
77 type double is new Standard.Long_Float;
78 type long_double is new Standard.Long_Long_Float;
79
80 ----------------------------
81 -- Characters and Strings --
82 ----------------------------
83
84 type char is new Character;
85
86 nul : constant char := char'First;
87
88 type char_array is array (size_t range <>) of aliased char;
89 for char_array'Component_Size use CHAR_BIT;
90
91 ------------------------------------
92 -- Wide Character and Wide String --
93 ------------------------------------
94
95 type wchar_t is new Wide_Character;
96 for wchar_t'Size use Standard'Wchar_T_Size;
97
98 wide_nul : constant wchar_t := wchar_t'First;
99
100 type wchar_array is array (size_t range <>) of aliased wchar_t;
101
102 end Interfaces.C;