For each implementation there is a predefined library package called SYSTEM which includes the definitions of certain configuration-dependent characteristics. The specification of the package SYSTEM is implementation-dependent and must be given in Appendix F. The visible part of this package must contain at least the following declarations.
package SYSTEM is type ADDRESS is implementation_defined; type NAME is implementation_defined_enumeration_type; SYSTEM_NAME : constant NAME := implementation_defined; STORAGE_UNIT : constant := implementation_defined; MEMORY_SIZE : constant := implementation_defined; --System-Dependent Named Numbers: MIN_INT : constant := implementation_defined; MAX_INT : constant := implementation_defined; MAX_DIGITS : constant := implementation_defined; MAX_MANTISSA : constant := implementation_defined; FINE_DELTA : constant := implementation_defined; TICK : constant := implementation_defined; --Other System_Dependent Declarations subtype PRIORITY is INTEGER range implementation_defined; ... end SYSTEM;
The type ADDRESS is the type of the addresses provided in address clauses; it is also the type of the result delivered by the attribute ADDRESS. Values of the enumeration type NAME are the names of alternative machine configurations handled by the implementation; one of these is the constant SYSTEM_NAME. The named number STORAGE_UNIT is the number of bits per storage unit; the named number MEMORY_SIZE is the number of available storage units in the configuration; these named numbers are of the type universal_integer.
An alternative form of the package SYSTEM, with given values for any of SYSTEM_NAME, STORAGE_UNIT, and MEMORY_SIZE, can be obtained by means of the corresponding pragmas. These pragmas are only allowed at the start of a compilation, before the first compilation unit (if any) of the compilation.
pragma SYSTEM_NAME (enumeration_literal);
The effect of the above pragma is to use the enumeration literal with the specified identifier for the definition of the constant SYSTEM_NAME. This pragma is only allowed if the specified identifier corresponds to one of the literals of the type NAME.
pragma STORAGE_UNIT (numeric_literal);
The effect of the above pragma is to use the value of the specified numeric literal for the definition of the named number STORAGE_UNIT.
pragma MEMORY_SIZE (numeric_literal);
The effect of the above pragma is to use the value of the specified numeric literal for the definition of the named number MEMORY_SIZE.
The compilation of any of these pragmas causes an implicit recompilation of the package SYSTEM. Consequently any compilation unit that names SYSTEM in its context clause becomes obsolete after this implicit recompilation. An implementation may impose further limitations on the use of these pragmas. For example, an implementation may allow them only at the start of the first compilation, when creating a new program library.
It is a consequence of the visibility rules that a declaration given in the package SYSTEM is not visible in a compilation unit unless this package is mentioned by a with clause that applies (directly or indirectly) to the compilation unit.
References: address clause, apply, attribute, compilation unit, must, named number, number declaration, numeric literal, package, package specification, pragma, program library, type, visibility, visible part, with clause.
Rationale references: 9 Packages, 15.6.1 The Package SYSTEM, 15.6.3 Representation Attributes
Style Guide references: 7.6.2 Package System
Within the package SYSTEM, the following named numbers are declared. The numbers FINE_DELTA and TICK are of the type universal_real; the others are of the type universal_integer.
References: allow, delta of a fixed point constraint, fixed point constraint, floating point constraint, integer type, model number, named number, package, range constraint, system package, type, universal_integer type, universal_real type.
Style Guide references: 7.4.3 Package Calendar, Type Duration, and System.Tick
The values of certain implementation-dependent characteristics can be obtatined by interrogating appropriate representation attributes. These attributes are described below.
For any object, program unit, label, or entry X:
For any type or subtype X or for any object X:
For the above two representation attributes, if the prefix is the name of a function, the attribute is understood to be an attribute of the function (not of the result of calling the function). Similarly, if the type of the prefix is an access type, the attribute is understood to be an attribute of the prefix (not of the designated object: attributes of the latter can be written with a prefix ending with the reserved word all).
For any component C of a record object R:
For any access type or subtype T:
For any task type or task object T:
For a task object X, the attribute X'SIZE gives the number of bits used to hold the object X, whereas X'STORAGE_SIZE gives the number of storage units allocated for the activation of the task designated by X. For a formal parameter X, if parameter passing is achieved by copy, then the attribute X'ADDRESS yields the address of the local copy; if parameter passing is by reference, then the address is that of the actual parameter.
References: access subtype, access type, activation, actual parameter, address clause, address predefined type, attribute, base type, collection, component, entry, formal parameter, and 6.2, label, object, package, package body, parameter passing, program unit, record object, statement, storage unit, subprogram, subprogram body, subtype, system predefined package, task, task body, task object, task type, task unit, type, universal_integer type.
Style Guide references: 7.3.1 Representation Clause
For every real type or subtype T, the following machine-dependent attributes are defined, which are not related to the model numbers. Programs using these attributes may thereby exploit properties that go beyond the minimal properties associated with the numeric type (see section 4.5.7 for the rules defining the accuracy of operations with real operands). Precautions must therefore be taken when using these machine- dependent attributes if portability is to be ensured.
For both floating point and fixed point types:
For floating point types, the following attributes provide characteristics of the underlying machine representation, in terms of the canonical form defined in section 3.5.7:
Note: For many machines the largest machine representable number of type F is almost
and the smallest positive representable number is
F'MACHINE_RADIX ** (F'MACHINE_EMIN -1)
References:arithmetic operator, attribute, base type, boolean predefined type, false boolean value, fixed point type, floating point type, model number, numeric type, numeric_error exception, predefined operation, radix, real type, subtype, true boolean value, type, universal_integer type.
Style Guide references: 7.2.3 Analysis
Address any questions or comments to firstname.lastname@example.org.