[Home] [Prev] [Next] [Index]

13.7 The Package System

13.7 The Package System

1
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.

2
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;

3
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.

4
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.

5
pragma SYSTEM_NAME (enumeration_literal);

6
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.

7
pragma STORAGE_UNIT (numeric_literal);

8
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.

9
pragma MEMORY_SIZE (numeric_literal);

10
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.

11
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.

Note:

12
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.

13
References:

*
address clause 13.5

*
apply 10.1.1

*
attribute 4.1.4

*
compilation unit 10.1

*
must 1.6

*
named number 3.2

*
number declaration 3.2.2

*
numeric literal 2.4

*
package 7

*
package specification 7.1

*
pragma 2.8

*
program library 10.1

*
type 3.3

*
visibility 8.3

*
visible part 7.2

*
with clause 10.1.1

13.7.1 System-dependent Named Numbers

1
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.

2 MIN_INTThe smallest (most negative) value of all predefined integer types.
3 MAX_INT The largest (most positive) value of all predefined integer types.
4 MAX_DIGITSThe largest value allowed for the number of significant decimal digits in a floating point constraint.
5 MAX_MANTISSA               The largest possible number of binary digits in the mantissa of model numbers of a fixed point subtype.
6 FINE_DELTAThe smallest delta allowed in a fixed point constraint that has the range constraint -1.0 .. 1.0.
7 TICK The basic clock period, in seconds.
8
References:

*
allow 1.6

*
delta of a fixed point constraint 3.5.9

*
fixed point constraint 3.5.9

*
floating point constraint 3.5.7

*
integer type 3.5.4

*
model number 3.5.6

*
named number 3.2

*
package 7

*
range constraint 3.5

*
system package 13.7

*
type 3.3

*
universal_integer type 3.5.4

*
universal_real type 3.5.6

13.7.2 Representation Attributes

1
The values of certain implementation-dependent characteristics can be obtatined by interrogating appropriate representation attributes. These attributes are described below.

2
For any object, program unit, label, or entry X:

3 X'ADDRESS   Yields the address of the first of the storage units allocated to X. For a subprogram, package, task unit or label, this value refers to the machine code associated with the corresponding body or statement. For an entry for which an address clause has been given, the value refers to the corresponding hardware interrupt. The value of this attribute is of the type ADDRESS defined in the package SYSTEM.
4
For any type or subtype X or for any object X:

5 X'SIZE   Applied to an object, yields the number of bits allocated to hold the object. Applied to a type or subtype, yields the minimum number of bits that is needed by the implementation to hold any possible object of this type or subtype. The value of this attribute is of the type universal_integer.
6
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).

7
For any component C of a record object R:

8 R.C'POSITION   Yields the offset, from the start of the first storage unit occupied by the record, of the first of the storage units occupied by C. This offset is measured in storage units. The value of this attribute is of the type universal_integer.
9 R.C'FIRST_BIT   Yields the offset, from the start of the first of the storage units occupied by C, of the last bit occupied by C. This offset is measured in bits. The value of this attribute is of the type universal_integer.
10 R.C'LAST_BIT   Yields the offset, from the start of the first of the storage units occupied by C, of the last bit occupied by C. This offset is measured in bits. The value of this attribute is of the type universal_integer.
11
For any access type or subtype T:

12 T'STORAGE_SIZE   Yields the total number of storage units reserved for the collection associated with the base type of T. The value of this attribute is of the type universal_integer.
13
For any task type or task object T:

14 T'STORAGE_SIZE   Yields the number of storage units reserved for each activation of a task of the type T or for the activation of the task object T. The value of this attribute is of the type universal_integer.
Notes:

15
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.

16
References:

*
access subtype 3.8

*
access type 3.8

*
activation 9.3

*
actual parameter 6.2

*
address clause 13.5

*
address predefined type 13.7

*
attribute 4.1.4

*
base type 3.3

*
collection 3.8

*
component 3.3

*
entry 9.5

*
formal parameter 6.1

*
formal parameter 6.2

*
label 5.1

*
object 3.2

*
package 7

*
package body 7.1

*
parameter passing 6.2

*
program unit 6

*
record object 3.7

*
statement 5

*
storage unit 13.7

*
subprogram 6

*
subprogram body 6.3

*
subtype 3.3

*
system predefined package 13.7

*
task 9

*
task body 9.1

*
task object 9.2

*
task type 9.2

*
task unit 9

*
type 3.3

*
universal_integer type 3.5.4

13.7.3 Representation Attributes of Real Types

1
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.

2
For both floating point and fixed point types:

3 T'MACHINE_ROUNDSYields the value TRUE if every predefined arithmetic operation on values of the base type of T either returns an exact result or performs rounding; yields the value FALSE otherwise. The value of this attribute is of the predefined type BOOLEAN.
4 T'MACHINE_OVERFLOWSYields the value TRUE if every predefined operation on values of the base type of T either provides a correct result, or raises the exception NUMERIC_ERROR in overflow situations (see 4.5.7); yields the value FALSE otherwise. The value of this attribute is of the predefined type BOOLEAN.
5
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:

6 T'MACHINE_RADIXYields the value of the radix used by the machine representation of the base type of T (the digits are extended digits in the range 0 to T'MACHINE_RADIX -1). The value of this attribute is of the type universal_integer.
7 T'MACHINE_MANTISSA Yields the number of digits in the mantissa for the machine representation of the base type of T (the digits are extended digits in the range 0 to T'MACHINE_RADIX -1). The value of this attribute is of the type universal_integer.
8 T'MACHINE_EMAXYields the largest value of exponent for the machine representation of the base type of T. The value of this attribute is of the type universal_integer.
9 T'MACHINE_EMINYields the smallest (most negative) value of exponent for the machine representation of the base type of T. The value of this attribute is of the type universal_integer.

Note:

10
For many machines the largest machine representable number of type F is almost

(F'MACHINE_RADIX)**(F'MACHINE_EMAX),

11
and the smallest positive representable number is

F'MACHINE_RADIX ** (F'MACHINE_EMIN -1)

12
References:

*
arithmetic operator 4.5

*
attribute 4.1.4

*
base type 3.3

*
boolean predefined type 3.5.3

*
false boolean value 3.5.3

*
fixed point type 3.5.9

*
floating point type 3.5.7

*
model number 3.5.6

*
numeric type 3.5

*
numeric_error exception 11.1

*
predefined operation 3.3.3

*
radix 3.5.7

*
real type 3.5.6

*
subtype 3.3

*
true boolean value 3.5.3

*
type 3.3

*
universal_integer type 3.5.4



[Home] [Prev] [Next] [Index]

documentation@rational.com
Copyright © 1993-2000, Rational Software Corporation. All rights reserved.