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-2011, 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 3,  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 COPYING3.  If not, go to --
19-- http://www.gnu.org/licenses for a complete copy of the license.          --
20--                                                                          --
21-- GNAT was originally developed  by the GNAT team at  New York University. --
22-- Extensive contributions were provided by Ada Core Technologies Inc.      --
23--                                                                          --
24------------------------------------------------------------------------------
25
26--  This package provides an Import to the C functions which provide
27--  values related to types on the target system. It is only needed for
28--  exp_dbug and the elaboration of ttypes.
29
30--  NOTE:  Any changes in this package must be reflected in jgettarg.ads
31--  and aa_getta.ads!
32
33--  Note that all these values return sizes of C types with corresponding
34--  names. This allows GNAT to define the corresponding Ada types to have
35--  the same representation. There is one exception to this: the
36--  Wide_Character_Type uses twice the size of a C char, instead of the
37--  size of wchar_t.
38
39with Types; use Types;
40
41package Get_Targ is
42   pragma Preelaborate;
43
44   function Get_Bits_Per_Unit return Pos;
45   pragma Import (C, Get_Bits_Per_Unit, "get_target_bits_per_unit");
46
47   function Get_Bits_Per_Word return Pos;
48   pragma Import (C, Get_Bits_Per_Word, "get_target_bits_per_word");
49
50   function Get_Char_Size return Pos; -- Standard.Character'Size
51   pragma Import (C, Get_Char_Size, "get_target_char_size");
52
53   function Get_Wchar_T_Size return Pos; -- Interfaces.C.wchar_t'Size
54   pragma Import (C, Get_Wchar_T_Size, "get_target_wchar_t_size");
55
56   function Get_Short_Size return Pos; -- Standard.Short_Integer'Size
57   pragma Import (C, Get_Short_Size, "get_target_short_size");
58
59   function Get_Int_Size return Pos; -- Standard.Integer'Size
60   pragma Import (C, Get_Int_Size, "get_target_int_size");
61
62   function Get_Long_Size return Pos; -- Standard.Long_Integer'Size
63   pragma Import (C, Get_Long_Size, "get_target_long_size");
64
65   function Get_Long_Long_Size return Pos; -- Standard.Long_Long_Integer'Size
66   pragma Import (C, Get_Long_Long_Size, "get_target_long_long_size");
67
68   function Get_Float_Size return Pos; -- Standard.Float'Size
69   pragma Import (C, Get_Float_Size, "get_target_float_size");
70
71   function Get_Double_Size return Pos; -- Standard.Long_Float'Size
72   pragma Import (C, Get_Double_Size, "get_target_double_size");
73
74   function Get_Long_Double_Size return Pos; -- Standard.Long_Long_Float'Size
75   pragma Import (C, Get_Long_Double_Size, "get_target_long_double_size");
76
77   function Get_Pointer_Size return Pos; -- System.Address'Size
78   pragma Import (C, Get_Pointer_Size, "get_target_pointer_size");
79
80   function Get_Maximum_Alignment return Pos;
81   pragma Import (C, Get_Maximum_Alignment, "get_target_maximum_alignment");
82
83   function Get_Float_Words_BE return Nat;
84   pragma Import (C, Get_Float_Words_BE, "get_float_words_be");
85
86   function Get_Words_BE return Nat;
87   pragma Import (C, Get_Words_BE, "get_words_be");
88
89   function Get_Bytes_BE return Nat;
90   pragma Import (C, Get_Bytes_BE, "get_bytes_be");
91
92   function Get_Bits_BE return Nat;
93   pragma Import (C, Get_Bits_BE, "get_bits_be");
94
95   function Get_Strict_Alignment return Nat;
96   pragma Import (C, Get_Strict_Alignment, "get_target_strict_alignment");
97
98   function Get_System_Allocator_Alignment return Nat;
99   pragma Import (C, Get_System_Allocator_Alignment,
100                  "get_target_system_allocator_alignment");
101
102   function Get_Double_Float_Alignment return Nat;
103   pragma Import (C, Get_Double_Float_Alignment,
104                  "get_target_double_float_alignment");
105
106   function Get_Double_Scalar_Alignment return Nat;
107   pragma Import (C, Get_Double_Scalar_Alignment,
108                  "get_target_double_scalar_alignment");
109
110   function Get_Max_Unaligned_Field return Pos;
111   --  Returns the maximum supported size in bits for a field that is
112   --  not aligned on a storage unit boundary.
113
114   function Width_From_Size  (Size : Pos) return Pos;
115   function Digits_From_Size (Size : Pos) return Pos;
116   --  Calculate values for 'Width or 'Digits from 'Size
117
118end Get_Targ;
119