13.7 The Package System
[For each implementation there is a library package
called System which includes the definitions of certain configuration-dependent
characteristics.]
Static Semantics
The following language-defined
library package exists:
Implementation defined: The contents
of the visible part of package Systemand its language-defined
children.
{
AI95-00362-01}
package System
is
pragma Pure Preelaborate(System);
type Name
is implementation-defined-enumeration-type;
System_Name :
constant Name :=
implementation-defined;
-- System-Dependent Named Numbers:
Min_Int :
constant :=
root_integer'First;
Max_Int :
constant :=
root_integer'Last;
Max_Binary_Modulus :
constant :=
implementation-defined;
Max_Nonbinary_Modulus :
constant :=
implementation-defined;
Max_Base_Digits :
constant :=
root_real'Digits;
Max_Digits :
constant :=
implementation-defined;
Max_Mantissa :
constant :=
implementation-defined;
Fine_Delta :
constant :=
implementation-defined;
Tick :
constant :=
implementation-defined;
-- Storage-related Declarations:
type Address
is implementation-defined;
Null_Address :
constant Address;
Storage_Unit :
constant :=
implementation-defined;
Word_Size :
constant :=
implementation-defined * Storage_Unit;
Memory_Size :
constant :=
implementation-defined;
{
AI05-0229-1}
--
Address Comparison:
function "<" (Left, Right : Address)
return Boolean
with Convention => Intrinsic;
function "<="(Left, Right : Address)
return Boolean
with Convention => Intrinsic;
function ">" (Left, Right : Address)
return Boolean
with Convention => Intrinsic;
function ">="(Left, Right : Address)
return Boolean
with Convention => Intrinsic;
function "=" (Left, Right : Address)
return Boolean
with Convention => Intrinsic;
--
function "/=" (Left, Right : Address)
return Boolean;
--
"/=" is implicitly defined
pragma Convention(Intrinsic, "<");
... -- and so on for all language-defined subprograms in this package
{
AI95-00221-01}
--
Other System-Dependent Declarations:
type Bit_Order
is (
High_Order_First,
Low_Order_First);
Default_Bit_Order :
constant Bit_Order
:= implementation-defined;
--
Priority-related declarations (see D.1):
subtype Any_Priority
is Integer
range implementation-defined;
subtype Priority
is Any_Priority
range Any_Priority'First ..
implementation-defined;
subtype Interrupt_Priority
is Any_Priority
range Priority'Last+1 ..
Any_Priority'Last;
Default_Priority :
constant Priority :=
(Priority'First + Priority'Last)/2;
private
... -- not specified by the language
end System;
Name is an enumeration subtype. Values of type Name
are the names of alternative machine configurations handled by the implementation.
System_Name represents the current machine configuration.
The named numbers Fine_Delta and Tick are of the
type universal_real; the others are of the type universal_integer.
The meanings of the
named numbers are:
[ Min_Int
The smallest (most negative) value allowed for the expressions of a
signed_integer_type_definition.
Max_Int
The largest (most positive) value allowed for the expressions of a
signed_integer_type_definition.
Max_Binary_Modulus
A power of two such that it, and all lesser positive powers of two, are
allowed as the modulus of a
modular_type_definition.
Max_Nonbinary_Modulus
A value such that it, and all lesser positive integers, are allowed as
the modulus of a
modular_type_definition.
Ramification: There is no requirement
that Max_Nonbinary_Modulus be less than or equal to Max_Binary_Modulus,
although that's what makes most sense. On a typical 32-bit machine, for
example, Max_Binary_Modulus will be 2**32 and Max_Nonbinary_Modulus will
be 2**31, because supporting nonbinary moduli in above 2**31 causes implementation
difficulties.
Max_Base_Digits
The largest value allowed for the requested decimal precision in a
floating_point_definition.
Max_Digits
The largest value allowed for the requested decimal precision in a
floating_point_definition
that has no
real_range_specification.
Max_Digits is less than or equal to Max_Base_Digits.
Max_Mantissa
The largest possible number of binary digits in the mantissa of machine
numbers of a user-defined ordinary fixed point type. (The mantissa is
defined in
Annex G.)
Fine_Delta
The smallest delta allowed in an
ordinary_fixed_point_definition
that has the
real_range_specification
range –1.0 .. 1.0. ]
Tick
A period in seconds approximating the real time interval during which
the value of Calendar.Clock remains constant.
Ramification: There is no required relationship
between System.Tick and Duration'Small, other than the one described
here.
The inaccuracy of the
delay_statement
has no relation to Tick. In particular, it is possible that the clock
used for the
delay_statement
is less accurate than Calendar.Clock.
We considered making Tick a run-time-determined
quantity, to allow for easier configurability. However, this would not
be upward compatible, and the desired configurability can be achieved
using functionality defined in
Annex D, “
Real-Time
Systems”.
Storage_Unit
The number of bits per storage element.
Word_Size
The number of bits per word.
Memory_Size
An implementation-defined value [that is intended to reflect the memory
size of the configuration in storage elements.]
Discussion: It is unspecified whether
this refers to the size of the address space, the amount of physical
memory on the machine, or perhaps some other interpretation of “memory
size.” In any case, the value has to be given by a static expression,
even though the amount of memory on many modern machines is a dynamic
quantity in several ways. Thus, Memory_Size is not very useful.
{
AI95-00161-01}
Address is
of a definite, nonlimited type
with preelaborable initialization (see 10.2.1).
Address represents machine addresses capable of addressing individual
storage elements. Null_Address is an address that is distinct from the
address of any object or program unit.
Ramification: The implementation has
to ensure that there is at least one address that nothing will be allocated
to; Null_Address will be one such address.
Ramification: Address is the type of
the result of the attribute Address.
Reason: Address is required to be nonlimited
and definite because it is important to be able to assign addresses,
and to declare uninitialized address variables.
Ramification: {
AI95-00161-01}
If System.Address is defined as a private type
(as suggested below), it might be necessary to add a pragma Preelaborable_Initialization
to the specification of System in order that Address have preelaborable
initialization as required.
{
AI95-00221-01}
Default_Bit_Order shall be a static constant.
See
13.5.3 for an explanation of
Bit_Order and Default_Bit_Order.
Implementation Permissions
{
AI95-00362-01}
An implementation may add additional implementation-defined declarations
to package System and its children. [However, it is usually better for
the implementation to provide additional functionality via implementation-defined
children of System.]
Package System may be declared
pure.
Ramification: The declarations in package
System and its children can be implicit. For example, since Address is
not limited, the predefined "=" and "/=" operations
are probably sufficient. However, the implementation is not required
to use the predefined "=".
Implementation Advice
Address should be of a
private type.
Reason: This promotes uniformity by avoiding
having implementation-defined predefined operations for the type. We
don't require it, because implementations may want to stick with what
they have.
Implementation Advice:
Type System.Address should be a private
type.
Implementation Note: It is not necessary
for Address to be able to point at individual bits within a storage element.
Nor is it necessary for it to be able to point at machine registers.
It is intended as a memory address that matches the hardware's notion
of an address.
The representation of the null value
of a general access type should be the same as that of Null_Address;
instantiations of Unchecked_Conversion should work accordingly. If the
implementation supports interfaces to other languages, the representation
of the null value of a general access type should be the same
as in those other languages, if appropriate.
Note that the children of the Interfaces package
will generally provide foreign-language-specific null values where appropriate.
See UI-0065 regarding Null_Address.
18 There are also some language-defined
child packages of System defined elsewhere.
Extensions to Ada 83
The
declarations Max_Binary_Modulus, Max_Nonbinary_Modulus, Max_Base_Digits,
Null_Address, Word_Size, Bit_Order, Default_Bit_Order, Any_Priority,
Interrupt_Priority, and Default_Priority are added to System in Ada 95.
The presence of ordering operators for type Address is also guaranteed
(the existence of these depends on the definition of Address in an Ada
83 implementation). We do not list these as incompatibilities, as the
contents of System can vary between implementations anyway; thus a program
that depends on the contents of System (by using use System;
for example) is already at risk of being incompatible when moved between
Ada implementations.
Wording Changes from Ada 83
Much of the content of System is standardized,
to provide more uniformity across implementations. Implementations can
still add their own declarations to System, but are encouraged to do
so via children of System.
Some of the named numbers are defined more explicitly
in terms of the standard numeric types.
The pragmas System_Name, Storage_Unit, and Memory_Size
are no longer defined by the language. However, the corresponding declarations
in package System still exist. Existing implementations may continue
to support the three pragmas as implementation-defined pragmas, if they
so desire.
Priority semantics, including subtype Priority,
have been moved to the Real Time Annex.
Extensions to Ada 95
{
AI95-00161-01}
Amendment Correction:
Type Address is defined to have preelaborable initialization, so that
it can be used without restriction in preelaborated units. (If Address
is defined to be a private type, as suggested by the Implementation Advice,
in Ada 95 it cannot be used in some contexts in a preelaborated units.
This is an unnecessary portability issue.)
{
AI95-00221-01}
Amendment Correction: Default_Bit_Order
is now a static constant.
{
AI95-00362-01}
Package System is now Pure, so it can be portably
used in more places. (Ada 95 allowed it to be Pure, but did not require
that.)
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe