Dec 082017
 
Ada Language Reference Manual. (1 of 4).
File ADA-LRM1.ZIP from The Programmer’s Corner in
Category Miscellaneous Language Source Code
Ada Language Reference Manual. (1 of 4).
File Name File Size Zip Size Zip Type
CHAPA.DOC 26752 4603 deflated
CHAPB.DOC 10624 2893 deflated
CHAPC.DOC 13568 3161 deflated
CHAPD.DOC 21248 6242 deflated
CHAPE.DOC 19584 3766 deflated
CHAPF.DOC 2432 886 deflated
FOREWARD.DOC 4608 2119 deflated
INDEX.DOC 171776 32773 deflated
LRANNEX.MEN 384 127 deflated
LRCHAPAR.DAT 48896 8361 deflated
LRCHAPTR.MEN 512 179 deflated
LRCREDIT.DAT 1152 609 deflated
LREXPLN.DAT 640 346 deflated
LRM.EXE 187472 57538 deflated
LRMAIN.MEN 256 156 deflated
LRMINIT 242 94 deflated
LRMR.PRO 4096 1764 deflated
LRWELCOM.MEN 1920 176 deflated
POSTSCRP.DOC 3840 1531 deflated
TOC.DOC 7296 2342 deflated

Download File ADA-LRM1.ZIP Here

Contents of the CHAPA.DOC file







The following document is a draft of the corresponding chapter of the
version of the Ada Reference Manual produced in response to the Ansi
Canvass. It is given a limited circulation to Ada implementers and to
other groups contributing comments (according to the conventions defined in
RRM.comments). This draft should not be referred to in any publication.



ANSI-RM-A-v23 - Draft Chapter

A Predefined Language Attributes
version 23

83-02-11


This revision has considered all comments up to #5795






















































A. Predefined Language Attributes



This annex summarizes the definitions given elsewhere of the predefined
language attributes.



P'ADDRESS For a prefix P that denotes an object, a program unit, a
label, or an entry:

Yields the address of the first of the storage units
allocated to P. 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. (See 13.7.2.)

P'AFT For a prefix P that denotes a fixed point subtype:

Yields the number of decimal digits needed after the
point to accommodate the precision of the subtype P,
unless the delta of the subtype P is greater than 0.1, in
which case the attribute yields the value one. (P'AFT is
the smallest positive integer N for which (10**N)*P'DELTA
is greater than or equal to one.) The value of this
attribute is of the type universal_integer. (See
3.5.10.)

P'BASE For a prefix P that denotes a type or subtype:

This attribute denotes the base type of P. It is only
allowed as the prefix of the name of another attribute:
for example, P'BASE'FIRST. (See 3.3.3.)

P'CALLABLE For a prefix P that is appropriate for a task type:

Yields the value FALSE when the execution of the task P
is either completed or terminated, or when the task is
abnormal; yields the value TRUE otherwise. The value of
this attribute is of the predefined type BOOLEAN. (See
9.9.)

P'CONSTRAINED For a prefix P that denotes an object of a type with
discriminants:




A - 1








Yields the value TRUE if a discriminant constraint
applies to the object P, or if the object is a constant
(including a formal parameter or generic formal parameter
of mode in); yields the value FALSE otherwise. If P is
a generic formal parameter of mode in out, or if P is a
formal parameter of mode in out or out and the type mark
given in the corresponding parameter specification
denotes an unconstrained type with discriminants, then
the value of this attribute is obtained from that of the
corresponding actual parameter. The value of this
attribute is of the predefined type BOOLEAN. (See
3.7.4.)













































A - 2








P'CONSTRAINED For a prefix P that denotes a private type or subtype:

Yields the value FALSE if P denotes an unconstrained
nonformal private type with discriminants; also yields
the value FALSE if P denotes a generic formal private
type and the associated actual subtype is either an
unconstrained type with discriminants or an unconstrained
array type; yields the value TRUE otherwise. The value
of this attribute is of the predefined type BOOLEAN.
(See 7.4.2.)
1

P'COUNT For a prefix P that denotes an entry of a task unit:

Yields the number of entry calls presently queued on the
entry (if the attribute is evaluated within an accept
statement for the entry P, the count does not include the
calling task). The value of this attribute is of the
type universal_integer. (See 9.9.)

P'DELTA For a prefix P that denotes a fixed point subtype:

Yields the value of the delta specified in the fixed
accuracy definition for the subtype P. The value of this
attribute is of the type universal_real. (See 3.5.10.)

P'DIGITS For a prefix P that denotes a floating point subtype:

Yields the number of decimal digits in the decimal
mantissa of model numbers of the subtype P. (This
attribute yields the number D of section 3.5.7.) The
value of this attribute is of the type universal_integer.
(See 3.5.8.)

P'EMAX For a prefix P that denotes a floating point subtype:

Yields the largest exponent value in the binary canonical
form of model numbers of the subtype P. (This attribute
yields the product 4*B of section 3.5.7.) The value of
this attribute is of the type universal_integer. (See
3.5.8.)

P'EPSILON For a prefix P that denotes a floating point subtype:

Yields the absolute value of the difference between the
model number 1.0 and the next model number above, for the
subtype P. The value of this attribute is of the type
universal_real. (See 3.5.8.)

P'FIRST For a prefix P that denotes a scalar type, or a subtype
of a scalar type:

Yields the lower bound of P. The value of this attribute
has the same type as P. (See 3.5.)



A - 3








P'FIRST For a prefix P that is appropriate for an array type, or
that denotes a constrained array subtype:

Yields the lower bound of the first index range. The
value of this attribute has the same type as this lower
bound. (See 3.6.2 and 3.8.2.)



















































A - 4








P'FIRST(N) For a prefix P that is appropriate for an array type, or
that denotes a constrained array subtype:

Yields the lower bound of the N-th index range. The
value of this attribute has the same type as this lower
bound. The argument N must be a static expression of
type universal_integer. The value of N must be positive
(nonzero) and no greater than the dimensionality of the
array. (See 3.6.2 and 3.8.2.)

P'FIRST_BIT For a prefix P that denotes a component of a record
object:

Yields the offset, from the start of the first of the
storage units occupied by the component, of the first bit
occupied by the component. This offset is measured in
bits. The value of this attribute is of the type
universal_integer. (See 13.7.2.)


P'FORE For a prefix P that denotes a fixed point subtype:

Yields the minimum number of characters needed for the
integer part of the decimal representation of any value
of the subtype P, assuming that the representation does
not include an exponent, but includes a one-character
prefix that is either a minus sign or a space. (This
minimum number does not include superfluous zeros or
underlines, and is at least two.) The value of this
attribute is of the type universal_integer. (See
3.5.10.)

P'IMAGE For a prefix P that denotes a discrete type or subtype:

This attribute is a function with a single parameter.
The actual parameter X must be a value of the base type
of P. The result type is the predefined type STRING.
The result is the image of the value of X, that is, a
sequence of characters representing the value in display
form. The image of an integer value is the corresponding
decimal literal; without underlines, leading zeros,
exponent, or trailing spaces; but with a one character
prefix that is either a minus sign or a space.

The image of an enumeration value is either the
corresponding identifier in upper case or the
corresponding character literal (including the two
apostrophes); neither leading nor trailing spaces are
included. The image of a character other than a graphic
character is implementation-defined. (See 3.5.5.)

P'LARGE For a prefix P that denotes a real subtype:

The attribute yields the largest positive model number of
the subtype P. The value of this attribute is of the


A - 5








type universal_real. (See 3.5.8 and 3.5.10.)

P'LAST For a prefix P that denotes a scalar type, or a subtype
of a scalar type:

Yields the upper bound of P. The value of this attribute
has the same type as P. (See 3.5.)

P'LAST For a prefix P that is appropriate for an array type, or
that denotes a constrained array subtype:

Yields the upper bound of the first index range. The
value of this attribute has the same type as this upper
bound. (See 3.6.2 and 3.8.2.)











































A - 6








P'LAST(N) For a prefix P that is appropriate for an array
type, or that denotes a constrained array subtype:

Yields the upper bound of the N-th index range. The
value of this attribute has the same type as this upper
bound. The argument N must be a static expression of
type universal_integer. The value of N must be positive
(nonzero) and no greater than the dimensionality of the
array. (See 3.6.2 and 3.8.2.)



P'LAST_BIT For a prefix P that denotes a component of a record
object:

Yields the offset, from the start of the first of
the storage units occupied by the component, of the
last bit occupied by the component. This offset is
measured in bits. The value of this attribute is of
the type universal_integer. (See 13.7.2.)

P'LENGTH For a prefix P that is appropriate for an array
type, or that denotes a constrained array subtype:

Yields the number of values of the first index range
(zero for a null range). The value of this
attribute is of the type universal_integer. (See
3.6.2.)

P'LENGTH(N) For a prefix P that is appropriate for an array
type, or that denotes a constrained array subtype:

Yields the number of values of the N-th index range
(zero for a null range). The value of this
attribute is of the type universal_integer. The
argument N must be a static expression of type
universal_integer. The value of N must be positive
(nonzero) and no greater than the dimensionality of
the array. (See 3.6.2 and 3.8.2.)

P'MACHINE_EMAX For a prefix P that denotes a floating point type or
subtype:

Yields the largest value of exponent for the machine
representation of the base type of P. The value of
this attribute is of the type universal_integer.
(See 13.7.3.)

P'MACHINE_EMIN For a prefix P that denotes a floating point type or
subtype:

Yields the smallest (most negative) value of
exponent for the machine representation of the base
type of P. The value of this attribute is of the
type universal_integer. (See 13.7.3.)


A - 7








P'MACHINE_MANTISSA For a prefix P that denotes a floating point type or
subtype:

Yields the number of digits in the mantissa for the
machine representation of the base type of P (the
digits are extended digits in the range 0 to
P'MACHINE_RADIX - 1). The value of this attribute
is of the type universal_integer. (See 13.7.3.)

















































A - 8








P'MACHINE_OVERFLOWS For a prefix P that denotes a real type or subtype:

Yields the value TRUE if every predefined operation
on values of the base type of P either provides a
correct result, or raises the exception
NUMERIC_ERROR in overflow situations; yields the
value FALSE otherwise. The value of this attribute
is of the predefined type BOOLEAN. (See 13.7.3.)

P'MACHINE_RADIX For a prefix P that denotes a floating point type or
subtype:

Yields the value of the radix used by the machine
representation of the base type of P. The value of
this attribute is of the type universal_integer.
(See 13.7.3.)


P'MACHINE_ROUNDS For a prefix P that denotes a real type or subtype:

Yields the value TRUE if every predefined arithmetic
operation on values of the base type of P either
returns an exact result or performs rounding;
yields the value FALSE otherwise. The value of this
attribute is of the predefined type BOOLEAN. (See
13.7.3.)

P'MANTISSA For a prefix P that denotes a real subtype:

Yields the number of binary digits in the binary
mantissa of model numbers of the subtype P. (This
attribute yields the number B of section 3.5.7 for a
floating point type, or of section 3.5.9 for a fixed
point type.) The value of this attribute is of the
type universal_integer. (See 3.5.8 and 3.5.10.)

P'POS For a prefix P that denotes a discrete type or
subtype:

This attribute is a function with a single
parameter. The actual parameter X must be a value
of the base type of P. The result type is the type
universal_integer. The result is the position
number of the value of the actual parameter. (See
3.5.5.)

P'POSITION For a prefix P that denotes a component of a record
object:

Yields the offset, from the start of the first
storage unit occupied by the record, of the first of
the storage units occupied by the component. This
offset is measured in storage units. The value of
this attribute is of the type universal_integer.
(See 13.7.2.)


A - 9








P'PRED For a prefix P that denotes a discrete type or
subtype:

This attribute is a function with a single
parameter. The actual parameter X must be a value
of the base type of P. The result type is the base
type of P. The result is the value whose position
number is one less than that of X. The exception
CONSTRAINT_ERROR is raised if X equals P'BASE'FIRST.
(See 3.5.5.)

P'RANGE For a prefix P that is appropriate for an array
type, or that denotes a constrained array subtype:

Yields the first index range of P, that is, the
range P'FIRST .. P'LAST. (See 3.6.2.)









































A - 10








P'RANGE(N) For a prefix P that is appropriate for an array
type, or that denotes a constrained array subtype:

Yields the N-th index range of P, that is, the range
P'FIRST(N) .. P'LAST(N). (See 3.6.2.)

P'SAFE_EMAX For a prefix P that denotes a floating point type or
subtype:

Yields the largest exponent value in the binary
canonical form of safe numbers of the base type of
P. (This attribute yields the number E of section
3.5.7.) The value of this attribute is of the type
universal_integer. (See 3.5.8.)


P'SAFE_LARGE For a prefix P that denotes a real type or subtype:

Yields the largest positive safe number of the base
type of P. The value of this attribute is of the
type universal_real. (See 3.5.8 and 3.5.10.)

P'SAFE_SMALL For a prefix P that denotes a real type or subtype:

Yields the smallest positive (nonzero) safe number
of the base type of P. The value of this attribute
is of the type universal_real. (See 3.5.8 and
3.5.10.)

P'SIZE For a prefix P that denotes an object:

Yields the number of bits allocated to hold the
object. The value of this attribute is of the type
universal_integer. (See 13.7.2.)

P'SIZE For a prefix P that denotes any type or subtype:

Yields the minimum number of bits that is needed by
the implementation to hold any possible object of
the type or subtype P. The value of this attribute
is of the type universal_integer. (See 13.7.2.)

P'SMALL For a prefix P that denotes a real subtype:

Yields the smallest positive (nonzero) model number
of the subtype P. The value of this attribute is of
the type universal_real. (See 3.5.8 and 3.5.10.)

P'STORAGE_SIZE For a prefix P that denotes an access type or
subtype:

Yields the total number of storage units reserved
for the collection associated with the base type of
P. The value of this attribute is of the type
universal_integer. (See 13.7.2.)


A - 11








P'STORAGE_SIZE For a prefix P that denotes a task type or a task
object:

Yields the number of storage units reserved for each
activation of a task of the type P or for the
activation of the task object P. The value of this
attribute is of the type universal_integer. (See
13.7.2.)

















































A - 12








P'SUCC For a prefix P that denotes a discrete type or
subtype:

This attribute is a function with a single
parameter. The actual parameter X must be a value
of the base type of P. The result type is the base
type of P. The result is the value whose position
number is one greater than that of X. The
exception CONSTRAINT_ERROR is raised if X equals
P'BASE'LAST. (See 3.5.5.)

P'TERMINATED For a prefix P that is appropriate for a task type:

Yields the value TRUE if the task P is terminated;
yields the value FALSE otherwise. The value of this
attribute is of the predefined type BOOLEAN. (See
9.9.)


P'VAL For a prefix P that denotes a discrete type or
subtype:

This attribute is a special function with a single
parameter X which can be of any integer type. The
result type is the base type of P. The result is
the value whose position number is the
universal_integer value corresponding to X. The
exception CONSTRAINT_ERROR is raised if the
universal_integer value corresponding to X is not in
the range P'POS(P'BASE'FIRST) .. P'POS(P'BASE'LAST).
(See 3.5.5.)

P'VALUE For a prefix P that denotes a discrete type or
subtype:

This attribute is a function with a single
parameter. The actual parameter X must be a value
of the predefined type STRING. The result type is
the base type of P. Any leading and any trailing
spaces of the sequence of characters that
corresponds to X are ignored.

For an enumeration type, if the sequence of
characters has the syntax of an enumeration literal
and if this literal exists for the base type of P,
the result is the corresponding enumeration value.
For an integer type, if the sequence of characters
has the syntax of an integer literal, with an
optional single leading character that is a plus or
minus sign, and if there is a corresponding value in
the base type of P, the result is this value. In
any other case, the exception CONSTRAINT_ERROR is
raised. (See 3.5.5.)




A - 13








P'WIDTH For a prefix P that denotes a discrete subtype:

Yields the maximum image length over all values of
the subtype P (the image is the sequence of
characters returned by the attribute IMAGE). The
value of this attribute is of the type
universal_integer. (See 3.5.5.)


















































A - 14






 December 8, 2017  Add comments

Leave a Reply