1 |
706 |
jeremybenn |
------------------------------------------------------------------------------
|
2 |
|
|
-- --
|
3 |
|
|
-- GNAT RUN-TIME COMPONENTS --
|
4 |
|
|
-- --
|
5 |
|
|
-- S Y S T E M . S C A L A R _ V A L U E S --
|
6 |
|
|
-- --
|
7 |
|
|
-- S p e c --
|
8 |
|
|
-- --
|
9 |
|
|
-- Copyright (C) 2001-2009, 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. --
|
17 |
|
|
-- --
|
18 |
|
|
-- As a special exception under Section 7 of GPL version 3, you are granted --
|
19 |
|
|
-- additional permissions described in the GCC Runtime Library Exception, --
|
20 |
|
|
-- version 3.1, as published by the Free Software Foundation. --
|
21 |
|
|
-- --
|
22 |
|
|
-- You should have received a copy of the GNU General Public License and --
|
23 |
|
|
-- a copy of the GCC Runtime Library Exception along with this program; --
|
24 |
|
|
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
|
25 |
|
|
-- <http://www.gnu.org/licenses/>. --
|
26 |
|
|
-- --
|
27 |
|
|
-- GNAT was originally developed by the GNAT team at New York University. --
|
28 |
|
|
-- Extensive contributions were provided by Ada Core Technologies Inc. --
|
29 |
|
|
-- --
|
30 |
|
|
------------------------------------------------------------------------------
|
31 |
|
|
|
32 |
|
|
-- This package defines the constants used for initializing scalar values
|
33 |
|
|
-- when pragma Initialize_Scalars is used. The actual values are defined
|
34 |
|
|
-- in the binder generated file. This package contains the Ada names that
|
35 |
|
|
-- are used by the generated code, which are linked to the actual values
|
36 |
|
|
-- by the use of pragma Import.
|
37 |
|
|
|
38 |
|
|
package System.Scalar_Values is
|
39 |
|
|
|
40 |
|
|
-- Note: logically this package should be Pure since it can be accessed
|
41 |
|
|
-- from pure units, but the IS_xxx variables below get set at run time,
|
42 |
|
|
-- so they have to be library level variables. In fact we only ever
|
43 |
|
|
-- access this from generated code, and the compiler knows that it is
|
44 |
|
|
-- OK to access this unit from generated code.
|
45 |
|
|
|
46 |
|
|
type Byte1 is mod 2 ** 8;
|
47 |
|
|
type Byte2 is mod 2 ** 16;
|
48 |
|
|
type Byte4 is mod 2 ** 32;
|
49 |
|
|
type Byte8 is mod 2 ** 64;
|
50 |
|
|
|
51 |
|
|
-- The explicit initializations here are not really required, since these
|
52 |
|
|
-- variables are always set by System.Scalar_Values.Initialize.
|
53 |
|
|
|
54 |
|
|
IS_Is1 : Byte1 := 0; -- Initialize 1 byte signed
|
55 |
|
|
IS_Is2 : Byte2 := 0; -- Initialize 2 byte signed
|
56 |
|
|
IS_Is4 : Byte4 := 0; -- Initialize 4 byte signed
|
57 |
|
|
IS_Is8 : Byte8 := 0; -- Initialize 8 byte signed
|
58 |
|
|
-- For the above cases, the undefined value (set by the binder -Sin switch)
|
59 |
|
|
-- is the largest negative number (1 followed by all zero bits).
|
60 |
|
|
|
61 |
|
|
IS_Iu1 : Byte1 := 0; -- Initialize 1 byte unsigned
|
62 |
|
|
IS_Iu2 : Byte2 := 0; -- Initialize 2 byte unsigned
|
63 |
|
|
IS_Iu4 : Byte4 := 0; -- Initialize 4 byte unsigned
|
64 |
|
|
IS_Iu8 : Byte8 := 0; -- Initialize 8 byte unsigned
|
65 |
|
|
-- For the above cases, the undefined value (set by the binder -Sin switch)
|
66 |
|
|
-- is the largest unsigned number (all 1 bits).
|
67 |
|
|
|
68 |
|
|
IS_Iz1 : Byte1 := 0; -- Initialize 1 byte zeroes
|
69 |
|
|
IS_Iz2 : Byte2 := 0; -- Initialize 2 byte zeroes
|
70 |
|
|
IS_Iz4 : Byte4 := 0; -- Initialize 4 byte zeroes
|
71 |
|
|
IS_Iz8 : Byte8 := 0; -- Initialize 8 byte zeroes
|
72 |
|
|
-- For the above cases, the undefined value (set by the binder -Sin switch)
|
73 |
|
|
-- is the zero (all 0 bits). This is used when zero is known to be an
|
74 |
|
|
-- invalid value.
|
75 |
|
|
|
76 |
|
|
-- The float definitions are aliased, because we use overlays to set them
|
77 |
|
|
|
78 |
|
|
IS_Isf : aliased Short_Float := 0.0; -- Initialize short float
|
79 |
|
|
IS_Ifl : aliased Float := 0.0; -- Initialize float
|
80 |
|
|
IS_Ilf : aliased Long_Float := 0.0; -- Initialize long float
|
81 |
|
|
IS_Ill : aliased Long_Long_Float := 0.0; -- Initialize long long float
|
82 |
|
|
|
83 |
|
|
procedure Initialize (Mode1 : Character; Mode2 : Character);
|
84 |
|
|
-- This procedure is called from the binder when Initialize_Scalars mode
|
85 |
|
|
-- is active. The arguments are the two characters from the -S switch,
|
86 |
|
|
-- with letters forced upper case. So for example if -S5a is given, then
|
87 |
|
|
-- Mode1 will be '5' and Mode2 will be 'A'. If the parameters are EV,
|
88 |
|
|
-- then this routine reads the environment variable GNAT_INIT_SCALARS.
|
89 |
|
|
-- The possible settings are the same as those for the -S switch (except
|
90 |
|
|
-- for EV), i.e. IN/LO/HO/xx, xx = 2 hex digits. If no -S switch is given
|
91 |
|
|
-- then the default of IN (invalid values) is passed on the call.
|
92 |
|
|
|
93 |
|
|
end System.Scalar_Values;
|