OSDN Git Service

2007-04-20 Ed Schonberg <schonberg@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / get_targ.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                             G E T _ T A R G                              --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --          Copyright (C) 1992-2005 Free Software Foundation, Inc.          --
10 --                                                                          --
11 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
12 -- terms of the  GNU General Public License as published  by the Free Soft- --
13 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
14 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
17 -- for  more details.  You should have  received  a copy of the GNU General --
18 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
19 -- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
20 -- Boston, MA 02110-1301, USA.                                              --
21 --                                                                          --
22 -- GNAT was originally developed  by the GNAT team at  New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
24 --                                                                          --
25 ------------------------------------------------------------------------------
26
27 --  This package provides an Import to the C functions which provide
28 --  values related to types on the target system. It is only needed for
29 --  exp_dbug and the elaboration of ttypes.
30
31 --  NOTE:  Any changes in this package must be reflected in jgettarg.ads
32 --  and aa_getta.ads!
33
34 --  Note that all these values return sizes of C types with corresponding
35 --  names. This allows GNAT to define the corresponding Ada types to have
36 --  the same representation. There is one exception to this: the
37 --  Wide_Character_Type uses twice the size of a C char, instead of the
38 --  size of wchar_t.
39
40 with Types; use Types;
41
42 package Get_Targ is
43    pragma Preelaborate;
44
45    function Get_Bits_Per_Unit return Pos;
46    pragma Import (C, Get_Bits_Per_Unit, "get_target_bits_per_unit");
47
48    function Get_Bits_Per_Word return Pos;
49    pragma Import (C, Get_Bits_Per_Word, "get_target_bits_per_word");
50
51    function Get_Char_Size return Pos; -- Standard.Character'Size
52    pragma Import (C, Get_Char_Size, "get_target_char_size");
53
54    function Get_Wchar_T_Size return Pos; -- Interfaces.C.wchar_t'Size
55    pragma Import (C, Get_Wchar_T_Size, "get_target_wchar_t_size");
56
57    function Get_Short_Size return Pos; -- Standard.Short_Integer'Size
58    pragma Import (C, Get_Short_Size, "get_target_short_size");
59
60    function Get_Int_Size return Pos; -- Standard.Integer'Size
61    pragma Import (C, Get_Int_Size, "get_target_int_size");
62
63    function Get_Long_Size return Pos; -- Standard.Long_Integer'Size
64    pragma Import (C, Get_Long_Size, "get_target_long_size");
65
66    function Get_Long_Long_Size return Pos; -- Standard.Long_Long_Integer'Size
67    pragma Import (C, Get_Long_Long_Size, "get_target_long_long_size");
68
69    function Get_Float_Size return Pos; -- Standard.Float'Size
70    pragma Import (C, Get_Float_Size, "get_target_float_size");
71
72    function Get_Double_Size return Pos; -- Standard.Long_Float'Size
73    pragma Import (C, Get_Double_Size, "get_target_double_size");
74
75    function Get_Long_Double_Size return Pos; -- Standard.Long_Long_Float'Size
76    pragma Import (C, Get_Long_Double_Size, "get_target_long_double_size");
77
78    function Get_Pointer_Size return Pos; -- System.Address'Size
79    pragma Import (C, Get_Pointer_Size, "get_target_pointer_size");
80
81    function Get_Maximum_Alignment return Pos;
82    pragma Import (C, Get_Maximum_Alignment, "get_target_maximum_alignment");
83
84    function Get_Float_Words_BE return Nat;
85    pragma Import (C, Get_Float_Words_BE, "get_float_words_be");
86
87    function Get_Words_BE return Nat;
88    pragma Import (C, Get_Words_BE, "get_words_be");
89
90    function Get_Bytes_BE return Nat;
91    pragma Import (C, Get_Bytes_BE, "get_bytes_be");
92
93    function Get_Bits_BE return Nat;
94    pragma Import (C, Get_Bits_BE, "get_bits_be");
95
96    function Get_Strict_Alignment return Nat;
97    pragma Import (C, Get_Strict_Alignment, "get_strict_alignment");
98
99    function Get_Max_Unaligned_Field return Pos;
100    --  Returns the maximum supported size in bits for a field that is
101    --  not aligned on a storage unit boundary.
102
103    function Width_From_Size  (Size : Pos) return Pos;
104    function Digits_From_Size (Size : Pos) return Pos;
105    --  Calculate values for 'Width or 'Digits from 'Size
106
107 end Get_Targ;