OSDN Git Service

New Language: Ada
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-stoele.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --               S Y S T E M . S T O R A G E _ E L E M E N T S              --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --                            $Revision: 1.23 $                             --
10 --                                                                          --
11 -- This specification is adapted from the Ada Reference Manual for use with --
12 -- GNAT.  In accordance with the copyright of that document, you can freely --
13 -- copy and modify this specification,  provided that if you redistribute a --
14 -- modified version,  any changes that you have made are clearly indicated. --
15 --                                                                          --
16 ------------------------------------------------------------------------------
17
18 --  Warning: declarations in this package are ambiguous with respect to the
19 --  extra declarations that can be introduced into System using Extend_System.
20 --  It is a good idea to avoid use clauses for this package!
21
22 pragma Warnings (Off);
23 --  This is to stop bootstrap problems with the use of Inline_Always
24 --  To be removed (along with redundant Inline pragmas) in 3.13.
25
26 package System.Storage_Elements is
27 pragma Pure (Storage_Elements);
28 --  Note that we take advantage of the implementation permission to make
29 --  this unit Pure instead of Preelaborable; see RM 13.7.1(15).
30
31    type Storage_Offset is range
32      -(2 ** (Standard."-" (Standard'Address_Size, 1))) ..
33      +(2 ** (Standard."-" (Standard'Address_Size, 1))) - 1;
34    --  Note: the reason for the qualification of "-" here by Standard is
35    --  that we have a current bug in GNAT that otherwise causes a bogus
36    --  ambiguity when this unit is analyzed in an Rtsfind context.
37
38    subtype Storage_Count is Storage_Offset range 0 .. Storage_Offset'Last;
39
40    type Storage_Element is mod 2 ** Storage_Unit;
41    for Storage_Element'Size use Storage_Unit;
42
43    type Storage_Array is
44      array (Storage_Offset range <>) of aliased Storage_Element;
45    for Storage_Array'Component_Size use Storage_Unit;
46
47    --  Address arithmetic
48
49    function "+" (Left : Address; Right : Storage_Offset) return Address;
50    pragma Convention (Intrinsic, "+");
51    pragma Inline ("+");
52    pragma Inline_Always ("+");
53
54    function "+" (Left : Storage_Offset; Right : Address) return Address;
55    pragma Convention (Intrinsic, "+");
56    pragma Inline ("+");
57    pragma Inline_Always ("+");
58
59    function "-" (Left : Address; Right : Storage_Offset) return Address;
60    pragma Convention (Intrinsic, "-");
61    pragma Inline ("-");
62    pragma Inline_Always ("-");
63
64    function "-" (Left, Right : Address) return Storage_Offset;
65    pragma Convention (Intrinsic, "-");
66    pragma Inline ("-");
67    pragma Inline_Always ("-");
68
69    function "mod"
70      (Left  : Address;
71       Right : Storage_Offset)
72       return  Storage_Offset;
73    pragma Convention (Intrinsic, "mod");
74    pragma Inline ("mod");
75    pragma Inline_Always ("mod");
76
77    --  Conversion to/from integers
78
79    type Integer_Address is mod Memory_Size;
80
81    function To_Address (Value : Integer_Address) return Address;
82    pragma Convention (Intrinsic, To_Address);
83    pragma Inline (To_Address);
84    pragma Inline_Always (To_Address);
85
86    function To_Integer (Value : Address) return Integer_Address;
87    pragma Convention (Intrinsic, To_Integer);
88    pragma Inline (To_Integer);
89    pragma Inline_Always (To_Integer);
90
91 end System.Storage_Elements;